blob: 962cd0df3548003c416cf6aa6ee88a07550495ba [file] [log] [blame]
abeykunb85a5e32016-08-24 13:51:40 -04001/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _SDE_HW_CATALOG_H
14#define _SDE_HW_CATALOG_H
15
16#include <linux/kernel.h>
17#include <linux/bug.h>
18#include <linux/bitmap.h>
19#include <linux/err.h>
Alan Kwong67a3f792016-11-01 23:16:53 -040020#include <linux/msm-bus.h>
Dhaval Patel8bf7ff32016-07-20 18:13:24 -070021#include <drm/drmP.h>
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070022
Dhaval Patel8bf7ff32016-07-20 18:13:24 -070023/**
24 * Max hardware block count: For ex: max 12 SSPP pipes or
25 * 5 ctl paths. In all cases, it can have max 12 hardware blocks
26 * based on current design
27 */
28#define MAX_BLOCKS 12
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070029
30#define SDE_HW_VER(MAJOR, MINOR, STEP) (((MAJOR & 0xF) << 28) |\
31 ((MINOR & 0xFFF) << 16) |\
32 (STEP & 0xFFFF))
33
34#define SDE_HW_MAJOR(rev) ((rev) >> 28)
abeykunb85a5e32016-08-24 13:51:40 -040035#define SDE_HW_MINOR(rev) (((rev) >> 16) & 0xFFF)
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070036#define SDE_HW_STEP(rev) ((rev) & 0xFFFF)
37#define SDE_HW_MAJOR_MINOR(rev) ((rev) >> 16)
38
39#define IS_SDE_MAJOR_MINOR_SAME(rev1, rev2) \
40 (SDE_HW_MAJOR_MINOR((rev1)) == SDE_HW_MAJOR_MINOR((rev2)))
41
42#define SDE_HW_VER_170 SDE_HW_VER(1, 7, 0) /* 8996 v1.0 */
43#define SDE_HW_VER_171 SDE_HW_VER(1, 7, 1) /* 8996 v2.0 */
44#define SDE_HW_VER_172 SDE_HW_VER(1, 7, 2) /* 8996 v3.0 */
45#define SDE_HW_VER_300 SDE_HW_VER(3, 0, 0) /* 8998 v1.0 */
Lloyd Atkinson274cc462017-02-21 11:52:06 -050046#define SDE_HW_VER_301 SDE_HW_VER(3, 0, 1) /* 8998 v1.1 */
Kyle Yan6a20fae2017-02-14 13:34:41 -080047#define SDE_HW_VER_400 SDE_HW_VER(4, 0, 0) /* sdm845 v1.0 */
abeykunb85a5e32016-08-24 13:51:40 -040048
Kyle Yan6a20fae2017-02-14 13:34:41 -080049#define IS_SDM845_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_400)
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070050
Lloyd Atkinson77158732016-10-23 13:02:00 -040051#define SDE_HW_BLK_NAME_LEN 16
52
Dhaval Patel47302cf2016-08-18 15:04:28 -070053#define MAX_IMG_WIDTH 0x3fff
54#define MAX_IMG_HEIGHT 0x3fff
55
Dhaval Patel44f12472016-08-29 12:19:47 -070056#define CRTC_DUAL_MIXERS 2
57
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -080058#define SDE_COLOR_PROCESS_VER(MAJOR, MINOR) \
59 ((((MAJOR) & 0xFFFF) << 16) | (((MINOR) & 0xFFFF)))
60#define SDE_COLOR_PROCESS_MAJOR(version) (((version) & 0xFFFF0000) >> 16)
61#define SDE_COLOR_PROCESS_MINOR(version) ((version) & 0xFFFF)
62
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070063/**
Clarence Ip32bcb002017-03-13 12:26:44 -070064 * Supported UBWC feature versions
65 */
66enum {
67 SDE_HW_UBWC_VER_10 = 0x100,
68 SDE_HW_UBWC_VER_20 = 0x200,
69 SDE_HW_UBWC_VER_30 = 0x300,
70};
71
72#define IS_UBWC_20_SUPPORTED(rev) ((rev) >= SDE_HW_UBWC_VER_20)
73
74/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070075 * MDP TOP BLOCK features
76 * @SDE_MDP_PANIC_PER_PIPE Panic configuration needs to be be done per pipe
77 * @SDE_MDP_10BIT_SUPPORT, Chipset supports 10 bit pixel formats
78 * @SDE_MDP_BWC, MDSS HW supports Bandwidth compression.
79 * @SDE_MDP_UBWC_1_0, This chipsets supports Universal Bandwidth
80 * compression initial revision
81 * @SDE_MDP_UBWC_1_5, Universal Bandwidth compression version 1.5
82 * @SDE_MDP_CDP, Client driven prefetch
83 * @SDE_MDP_MAX Maximum value
84
85 */
86enum {
87 SDE_MDP_PANIC_PER_PIPE = 0x1,
88 SDE_MDP_10BIT_SUPPORT,
89 SDE_MDP_BWC,
90 SDE_MDP_UBWC_1_0,
91 SDE_MDP_UBWC_1_5,
92 SDE_MDP_CDP,
93 SDE_MDP_MAX
94};
95
96/**
97 * SSPP sub-blocks/features
98 * @SDE_SSPP_SRC Src and fetch part of the pipes,
Clarence Ipe78efb72016-06-24 18:35:21 -040099 * @SDE_SSPP_SCALER_QSEED2, QSEED2 algorithm support
100 * @SDE_SSPP_SCALER_QSEED3, QSEED3 alogorithm support
101 * @SDE_SSPP_SCALER_RGB, RGB Scaler, supported by RGB pipes
102 * @SDE_SSPP_CSC, Support of Color space converion
abeykun62576142016-08-25 17:44:05 -0400103 * @SDE_SSPP_CSC_10BIT, Support of 10-bit Color space conversion
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800104 * @SDE_SSPP_HSIC, Global HSIC control
105 * @SDE_SSPP_MEMCOLOR Memory Color Support
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700106 * @SDE_SSPP_IGC, Inverse gamma correction
107 * @SDE_SSPP_PCC, Color correction support
108 * @SDE_SSPP_CURSOR, SSPP can be used as a cursor layer
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400109 * @SDE_SSPP_QOS, SSPP support QoS control, danger/safe/creq
Veera Sundaram Sankaran02dd6ac2016-12-22 15:08:29 -0800110 * @SDE_SSPP_EXCL_RECT, SSPP supports exclusion rect
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800111 * @SDE_SSPP_SMART_DMA_V1, SmartDMA 1.0 support
112 * @SDE_SSPP_SMART_DMA_V2, SmartDMA 2.0 support
Alan Kwong4dd64c82017-02-04 18:41:51 -0800113 * @SDE_SSPP_SBUF, SSPP support inline stream buffer
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700114 * @SDE_SSPP_MAX maximum value
115 */
116enum {
117 SDE_SSPP_SRC = 0x1,
Clarence Ipe78efb72016-06-24 18:35:21 -0400118 SDE_SSPP_SCALER_QSEED2,
119 SDE_SSPP_SCALER_QSEED3,
120 SDE_SSPP_SCALER_RGB,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700121 SDE_SSPP_CSC,
abeykun62576142016-08-25 17:44:05 -0400122 SDE_SSPP_CSC_10BIT,
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800123 SDE_SSPP_HSIC,
124 SDE_SSPP_MEMCOLOR,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700125 SDE_SSPP_IGC,
126 SDE_SSPP_PCC,
127 SDE_SSPP_CURSOR,
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400128 SDE_SSPP_QOS,
Veera Sundaram Sankaran02dd6ac2016-12-22 15:08:29 -0800129 SDE_SSPP_EXCL_RECT,
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800130 SDE_SSPP_SMART_DMA_V1,
131 SDE_SSPP_SMART_DMA_V2,
Alan Kwong4dd64c82017-02-04 18:41:51 -0800132 SDE_SSPP_SBUF,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700133 SDE_SSPP_MAX
134};
135
136/*
137 * MIXER sub-blocks/features
138 * @SDE_MIXER_LAYER Layer mixer layer blend configuration,
139 * @SDE_MIXER_SOURCESPLIT Layer mixer supports source-split configuration
140 * @SDE_MIXER_GC Gamma correction block
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800141 * @SDE_DIM_LAYER Layer mixer supports dim layer
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700142 * @SDE_MIXER_MAX maximum value
143 */
144enum {
145 SDE_MIXER_LAYER = 0x1,
146 SDE_MIXER_SOURCESPLIT,
147 SDE_MIXER_GC,
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800148 SDE_DIM_LAYER,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700149 SDE_MIXER_MAX
150};
151
152/**
153 * DSPP sub-blocks
154 * @SDE_DSPP_IGC DSPP Inverse gamma correction block
155 * @SDE_DSPP_PCC Panel color correction block
156 * @SDE_DSPP_GC Gamma correction block
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800157 * @SDE_DSPP_HSIC Global HSIC block
158 * @SDE_DSPP_MEMCOLOR Memory Color block
159 * @SDE_DSPP_SIXZONE Six zone block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700160 * @SDE_DSPP_GAMUT Gamut bloc
161 * @SDE_DSPP_DITHER Dither block
Gopikrishnaiah Anandanb67b0d12016-06-23 11:43:08 -0700162 * @SDE_DSPP_HIST Histogram block
163 * @SDE_DSPP_VLUT PA VLUT block
164 * @SDE_DSPP_AD AD block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700165 * @SDE_DSPP_MAX maximum value
166 */
167enum {
168 SDE_DSPP_IGC = 0x1,
169 SDE_DSPP_PCC,
170 SDE_DSPP_GC,
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800171 SDE_DSPP_HSIC,
172 SDE_DSPP_MEMCOLOR,
173 SDE_DSPP_SIXZONE,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700174 SDE_DSPP_GAMUT,
175 SDE_DSPP_DITHER,
176 SDE_DSPP_HIST,
Gopikrishnaiah Anandanb67b0d12016-06-23 11:43:08 -0700177 SDE_DSPP_VLUT,
Gopikrishnaiah Anandan41980b42016-06-21 16:01:33 -0700178 SDE_DSPP_AD,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700179 SDE_DSPP_MAX
180};
181
182/**
183 * PINGPONG sub-blocks
184 * @SDE_PINGPONG_TE Tear check block
185 * @SDE_PINGPONG_TE2 Additional tear check block for split pipes
186 * @SDE_PINGPONG_SPLIT PP block supports split fifo
Clarence Ip8e69ad02016-12-09 09:43:57 -0500187 * @SDE_PINGPONG_SLAVE PP block is a suitable slave for split fifo
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700188 * @SDE_PINGPONG_DSC, Display stream compression blocks
189 * @SDE_PINGPONG_MAX
190 */
191enum {
192 SDE_PINGPONG_TE = 0x1,
193 SDE_PINGPONG_TE2,
194 SDE_PINGPONG_SPLIT,
Clarence Ip8e69ad02016-12-09 09:43:57 -0500195 SDE_PINGPONG_SLAVE,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700196 SDE_PINGPONG_DSC,
197 SDE_PINGPONG_MAX
198};
199
200/**
Lloyd Atkinsoncf8996b2016-08-23 09:34:13 -0400201 * CTL sub-blocks
202 * @SDE_CTL_SPLIT_DISPLAY CTL supports video mode split display
203 * @SDE_CTL_PINGPONG_SPLIT CTL supports pingpong split
Alan Kwong4dd64c82017-02-04 18:41:51 -0800204 * @SDE_CTL_SBUF CTL supports inline stream buffer
Lloyd Atkinsoncf8996b2016-08-23 09:34:13 -0400205 * @SDE_CTL_MAX
206 */
207enum {
208 SDE_CTL_SPLIT_DISPLAY = 0x1,
209 SDE_CTL_PINGPONG_SPLIT,
Alan Kwong4dd64c82017-02-04 18:41:51 -0800210 SDE_CTL_SBUF,
Lloyd Atkinsoncf8996b2016-08-23 09:34:13 -0400211 SDE_CTL_MAX
212};
213
214/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700215 * WB sub-blocks and features
216 * @SDE_WB_LINE_MODE Writeback module supports line/linear mode
217 * @SDE_WB_BLOCK_MODE Writeback module supports block mode read
218 * @SDE_WB_ROTATE rotation support,this is available if writeback
219 * supports block mode read
220 * @SDE_WB_CSC Writeback color conversion block support
221 * @SDE_WB_CHROMA_DOWN, Writeback chroma down block,
222 * @SDE_WB_DOWNSCALE, Writeback integer downscaler,
223 * @SDE_WB_DITHER, Dither block
224 * @SDE_WB_TRAFFIC_SHAPER, Writeback traffic shaper bloc
Clarence Ip32bcb002017-03-13 12:26:44 -0700225 * @SDE_WB_UBWC, Writeback Universal bandwidth compression
Alan Kwong3232ca52016-07-29 02:27:47 -0400226 * @SDE_WB_YUV_CONFIG Writeback supports output of YUV colorspace
Alan Kwong9ffcd592016-09-27 07:41:56 -0400227 * @SDE_WB_PIPE_ALPHA Writeback supports pipe alpha
abeykunf1539f72016-08-24 16:08:03 -0400228 * @SDE_WB_XY_ROI_OFFSET Writeback supports x/y-offset of out ROI in
229 * the destination image
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700230 * @SDE_WB_MAX maximum value
231 */
232enum {
233 SDE_WB_LINE_MODE = 0x1,
234 SDE_WB_BLOCK_MODE,
235 SDE_WB_ROTATE = SDE_WB_BLOCK_MODE,
236 SDE_WB_CSC,
237 SDE_WB_CHROMA_DOWN,
238 SDE_WB_DOWNSCALE,
239 SDE_WB_DITHER,
240 SDE_WB_TRAFFIC_SHAPER,
Clarence Ip32bcb002017-03-13 12:26:44 -0700241 SDE_WB_UBWC,
Alan Kwong3232ca52016-07-29 02:27:47 -0400242 SDE_WB_YUV_CONFIG,
Alan Kwong9ffcd592016-09-27 07:41:56 -0400243 SDE_WB_PIPE_ALPHA,
abeykunf1539f72016-08-24 16:08:03 -0400244 SDE_WB_XY_ROI_OFFSET,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700245 SDE_WB_MAX
246};
247
248/**
Alan Kwong5d324e42016-07-28 22:56:18 -0400249 * VBIF sub-blocks and features
250 * @SDE_VBIF_QOS_OTLIM VBIF supports OT Limit
251 * @SDE_VBIF_MAX maximum value
252 */
253enum {
254 SDE_VBIF_QOS_OTLIM = 0x1,
255 SDE_VBIF_MAX
256};
257
258/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700259 * MACRO SDE_HW_BLK_INFO - information of HW blocks inside SDE
Lloyd Atkinson77158732016-10-23 13:02:00 -0400260 * @name: string name for debug purposes
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700261 * @id: enum identifying this block
262 * @base: register base offset to mdss
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700263 * @len: length of hardware block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700264 * @features bit mask identifying sub-blocks/features
265 */
266#define SDE_HW_BLK_INFO \
Lloyd Atkinson77158732016-10-23 13:02:00 -0400267 char name[SDE_HW_BLK_NAME_LEN]; \
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700268 u32 id; \
269 u32 base; \
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700270 u32 len; \
271 unsigned long features; \
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700272
273/**
274 * MACRO SDE_HW_SUBBLK_INFO - information of HW sub-block inside SDE
Lloyd Atkinson77158732016-10-23 13:02:00 -0400275 * @name: string name for debug purposes
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700276 * @id: enum identifying this sub-block
277 * @base: offset of this sub-block relative to the block
278 * offset
279 * @len register block length of this sub-block
280 */
281#define SDE_HW_SUBBLK_INFO \
Lloyd Atkinson77158732016-10-23 13:02:00 -0400282 char name[SDE_HW_BLK_NAME_LEN]; \
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700283 u32 id; \
284 u32 base; \
285 u32 len
286
287/**
288 * struct sde_src_blk: SSPP part of the source pipes
289 * @info: HW register and features supported by this sub-blk
290 */
291struct sde_src_blk {
292 SDE_HW_SUBBLK_INFO;
293};
294
295/**
Clarence Ipe78efb72016-06-24 18:35:21 -0400296 * struct sde_scaler_blk: Scaler information
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700297 * @info: HW register and features supported by this sub-blk
abeykun48f407a2016-08-25 12:06:44 -0400298 * @version: qseed block revision
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700299 */
Clarence Ipe78efb72016-06-24 18:35:21 -0400300struct sde_scaler_blk {
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700301 SDE_HW_SUBBLK_INFO;
abeykun48f407a2016-08-25 12:06:44 -0400302 u32 version;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700303};
304
305struct sde_csc_blk {
306 SDE_HW_SUBBLK_INFO;
307};
308
309/**
310 * struct sde_pp_blk : Pixel processing sub-blk information
311 * @info: HW register and features supported by this sub-blk
312 * @version: HW Algorithm version
313 */
314struct sde_pp_blk {
315 SDE_HW_SUBBLK_INFO;
316 u32 version;
317};
318
319/**
Clarence Ipea3d6262016-07-15 16:20:11 -0400320 * struct sde_format_extended - define sde specific pixel format+modifier
321 * @fourcc_format: Base FOURCC pixel format code
322 * @modifier: 64-bit drm format modifier, same modifier must be applied to all
323 * framebuffer planes
324 */
325struct sde_format_extended {
326 uint32_t fourcc_format;
327 uint64_t modifier;
328};
329
330/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700331 * struct sde_sspp_sub_blks : SSPP sub-blocks
332 * @maxdwnscale: max downscale ratio supported(without DECIMATION)
333 * @maxupscale: maxupscale ratio supported
334 * @maxwidth: max pixelwidth supported by this pipe
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400335 * @danger_lut_linear: LUT to generate danger signals for linear format
336 * @safe_lut_linear: LUT to generate safe signals for linear format
337 * @danger_lut_tile: LUT to generate danger signals for tile format
338 * @safe_lut_tile: LUT to generate safe signals for tile format
339 * @danger_lut_nrt: LUT to generate danger signals for non-realtime use case
340 * @safe_lut_nrt: LUT to generate safe signals for non-realtime use case
341 * @creq_lut_nrt: LUT to generate creq signals for non-realtime use case
342 * @creq_vblank: creq priority during vertical blanking
343 * @danger_vblank: danger priority during vertical blanking
344 * @pixel_ram_size: size of latency hiding and de-tiling buffer in bytes
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800345 * @smart_dma_priority: hw priority of rect1 of multirect pipe
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700346 * @src_blk:
Clarence Ipe78efb72016-06-24 18:35:21 -0400347 * @scaler_blk:
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700348 * @csc_blk:
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800349 * @hsic:
350 * @memcolor:
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700351 * @pcc_blk:
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800352 * @igc_blk:
Clarence Ipea3d6262016-07-15 16:20:11 -0400353 * @format_list: Pointer to list of supported formats
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700354 */
355struct sde_sspp_sub_blks {
356 u32 maxlinewidth;
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400357 u32 danger_lut_linear;
358 u32 safe_lut_linear;
359 u32 danger_lut_tile;
360 u32 safe_lut_tile;
361 u32 danger_lut_nrt;
362 u32 safe_lut_nrt;
363 u32 creq_lut_nrt;
364 u32 creq_vblank;
365 u32 danger_vblank;
366 u32 pixel_ram_size;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700367 u32 maxdwnscale;
368 u32 maxupscale;
Clarence Ip5e2a9222016-06-26 22:38:24 -0400369 u32 maxhdeciexp; /* max decimation is 2^value */
370 u32 maxvdeciexp; /* max decimation is 2^value */
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800371 u32 smart_dma_priority;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700372 struct sde_src_blk src_blk;
Clarence Ipe78efb72016-06-24 18:35:21 -0400373 struct sde_scaler_blk scaler_blk;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700374 struct sde_pp_blk csc_blk;
Benet Clark37809e62016-10-24 10:14:00 -0700375 struct sde_pp_blk hsic_blk;
376 struct sde_pp_blk memcolor_blk;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700377 struct sde_pp_blk pcc_blk;
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800378 struct sde_pp_blk igc_blk;
Clarence Ipea3d6262016-07-15 16:20:11 -0400379
380 const struct sde_format_extended *format_list;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700381};
382
383/**
384 * struct sde_lm_sub_blks: information of mixer block
385 * @maxwidth: Max pixel width supported by this mixer
386 * @maxblendstages: Max number of blend-stages supported
387 * @blendstage_base: Blend-stage register base offset
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800388 * @gc: gamma correction block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700389 */
390struct sde_lm_sub_blks {
391 u32 maxwidth;
392 u32 maxblendstages;
393 u32 blendstage_base[MAX_BLOCKS];
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800394 struct sde_pp_blk gc;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700395};
396
397struct sde_dspp_sub_blks {
398 struct sde_pp_blk igc;
399 struct sde_pp_blk pcc;
400 struct sde_pp_blk gc;
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800401 struct sde_pp_blk hsic;
402 struct sde_pp_blk memcolor;
403 struct sde_pp_blk sixzone;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700404 struct sde_pp_blk gamut;
405 struct sde_pp_blk dither;
406 struct sde_pp_blk hist;
Gopikrishnaiah Anandan41980b42016-06-21 16:01:33 -0700407 struct sde_pp_blk ad;
Gopikrishnaiah Anandanb67b0d12016-06-23 11:43:08 -0700408 struct sde_pp_blk vlut;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700409};
410
411struct sde_pingpong_sub_blks {
412 struct sde_pp_blk te;
413 struct sde_pp_blk te2;
414 struct sde_pp_blk dsc;
415};
416
417struct sde_wb_sub_blocks {
418 u32 maxlinewidth;
419};
420
Ben Chan78647cd2016-06-26 22:02:47 -0400421struct sde_mdss_base_cfg {
422 SDE_HW_BLK_INFO;
423};
424
Alan Kwong5d324e42016-07-28 22:56:18 -0400425/**
426 * sde_clk_ctrl_type - Defines top level clock control signals
427 */
428enum sde_clk_ctrl_type {
429 SDE_CLK_CTRL_NONE,
430 SDE_CLK_CTRL_VIG0,
431 SDE_CLK_CTRL_VIG1,
432 SDE_CLK_CTRL_VIG2,
433 SDE_CLK_CTRL_VIG3,
434 SDE_CLK_CTRL_VIG4,
435 SDE_CLK_CTRL_RGB0,
436 SDE_CLK_CTRL_RGB1,
437 SDE_CLK_CTRL_RGB2,
438 SDE_CLK_CTRL_RGB3,
439 SDE_CLK_CTRL_DMA0,
440 SDE_CLK_CTRL_DMA1,
441 SDE_CLK_CTRL_CURSOR0,
442 SDE_CLK_CTRL_CURSOR1,
443 SDE_CLK_CTRL_WB0,
444 SDE_CLK_CTRL_WB1,
445 SDE_CLK_CTRL_WB2,
446 SDE_CLK_CTRL_MAX,
447};
448
449/* struct sde_clk_ctrl_reg : Clock control register
450 * @reg_off: register offset
451 * @bit_off: bit offset
452 */
453struct sde_clk_ctrl_reg {
454 u32 reg_off;
455 u32 bit_off;
456};
457
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700458/* struct sde_mdp_cfg : MDP TOP-BLK instance info
459 * @id: index identifying this block
460 * @base: register base offset to mdss
461 * @features bit mask identifying sub-blocks/features
462 * @highest_bank_bit: UBWC parameter
Clarence Ip32bcb002017-03-13 12:26:44 -0700463 * @ubwc_static: ubwc static configuration
464 * @ubwc_swizzle: ubwc default swizzle setting
Alan Kwong5d324e42016-07-28 22:56:18 -0400465 * @clk_ctrls clock control register definition
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700466 */
467struct sde_mdp_cfg {
468 SDE_HW_BLK_INFO;
469 u32 highest_bank_bit;
Clarence Ip32bcb002017-03-13 12:26:44 -0700470 u32 ubwc_static;
471 u32 ubwc_swizzle;
Alan Kwong5d324e42016-07-28 22:56:18 -0400472 struct sde_clk_ctrl_reg clk_ctrls[SDE_CLK_CTRL_MAX];
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700473};
474
475/* struct sde_mdp_cfg : MDP TOP-BLK instance info
476 * @id: index identifying this block
477 * @base: register base offset to mdss
478 * @features bit mask identifying sub-blocks/features
479 */
480struct sde_ctl_cfg {
481 SDE_HW_BLK_INFO;
482};
483
484/**
485 * struct sde_sspp_cfg - information of source pipes
486 * @id: index identifying this block
487 * @base register offset of this block
488 * @features bit mask identifying sub-blocks/features
Lloyd Atkinson350bb412016-07-06 10:47:29 -0400489 * @sblk: SSPP sub-blocks information
Alan Kwong5d324e42016-07-28 22:56:18 -0400490 * @xin_id: bus client identifier
491 * @clk_ctrl clock control identifier
abeykunf35ff332016-12-20 13:06:09 -0500492 * @type sspp type identifier
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700493 */
494struct sde_sspp_cfg {
495 SDE_HW_BLK_INFO;
496 const struct sde_sspp_sub_blks *sblk;
Alan Kwong5d324e42016-07-28 22:56:18 -0400497 u32 xin_id;
498 enum sde_clk_ctrl_type clk_ctrl;
abeykunf35ff332016-12-20 13:06:09 -0500499 u32 type;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700500};
501
502/**
503 * struct sde_lm_cfg - information of layer mixer blocks
504 * @id: index identifying this block
505 * @base register offset of this block
506 * @features bit mask identifying sub-blocks/features
Lloyd Atkinson350bb412016-07-06 10:47:29 -0400507 * @sblk: LM Sub-blocks information
508 * @dspp: ID of connected DSPP, DSPP_MAX if unsupported
509 * @pingpong: ID of connected PingPong, PINGPONG_MAX if unsupported
510 * @lm_pair_mask: Bitmask of LMs that can be controlled by same CTL
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700511 */
512struct sde_lm_cfg {
513 SDE_HW_BLK_INFO;
514 const struct sde_lm_sub_blks *sblk;
Lloyd Atkinson350bb412016-07-06 10:47:29 -0400515 u32 dspp;
516 u32 pingpong;
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400517 unsigned long lm_pair_mask;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700518};
519
520/**
521 * struct sde_dspp_cfg - information of DSPP blocks
522 * @id enum identifying this block
523 * @base register offset of this block
524 * @features bit mask identifying sub-blocks/features
525 * supported by this block
526 * @sblk sub-blocks information
527 */
528struct sde_dspp_cfg {
529 SDE_HW_BLK_INFO;
530 const struct sde_dspp_sub_blks *sblk;
531};
532
533/**
534 * struct sde_pingpong_cfg - information of PING-PONG blocks
535 * @id enum identifying this block
536 * @base register offset of this block
537 * @features bit mask identifying sub-blocks/features
538 * @sblk sub-blocks information
539 */
540struct sde_pingpong_cfg {
541 SDE_HW_BLK_INFO;
542 const struct sde_pingpong_sub_blks *sblk;
543};
544
545/**
Jeykumar Sankaran5c2f0702017-03-09 18:03:15 -0800546 * struct sde_dsc_cfg - information of DSC blocks
547 * @id enum identifying this block
548 * @base register offset of this block
549 * @features bit mask identifying sub-blocks/features
550 */
551struct sde_dsc_cfg {
552 SDE_HW_BLK_INFO;
553};
554
555/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700556 * struct sde_cdm_cfg - information of chroma down blocks
557 * @id enum identifying this block
558 * @base register offset of this block
559 * @features bit mask identifying sub-blocks/features
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400560 * @intf_connect Bitmask of INTF IDs this CDM can connect to
561 * @wb_connect: Bitmask of Writeback IDs this CDM can connect to
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700562 */
563struct sde_cdm_cfg {
564 SDE_HW_BLK_INFO;
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400565 unsigned long intf_connect;
566 unsigned long wb_connect;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700567};
568
569/**
570 * struct sde_intf_cfg - information of timing engine blocks
571 * @id enum identifying this block
572 * @base register offset of this block
573 * @features bit mask identifying sub-blocks/features
574 * @type: Interface type(DSI, DP, HDMI)
Lloyd Atkinson2d4e7662015-11-05 15:52:07 -0500575 * @controller_id: Controller Instance ID in case of multiple of intf type
Lloyd Atkinsonf30546e2016-06-26 10:08:25 -0400576 * @prog_fetch_lines_worst_case Worst case latency num lines needed to prefetch
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700577 */
578struct sde_intf_cfg {
579 SDE_HW_BLK_INFO;
580 u32 type; /* interface type*/
Lloyd Atkinson2d4e7662015-11-05 15:52:07 -0500581 u32 controller_id;
Lloyd Atkinsonf30546e2016-06-26 10:08:25 -0400582 u32 prog_fetch_lines_worst_case;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700583};
584
585/**
586 * struct sde_wb_cfg - information of writeback blocks
587 * @id enum identifying this block
588 * @base register offset of this block
589 * @features bit mask identifying sub-blocks/features
Alan Kwongbb27c092016-07-20 16:41:25 -0400590 * @sblk sub-block information
591 * @format_list: Pointer to list of supported formats
Alan Kwong5d324e42016-07-28 22:56:18 -0400592 * @vbif_idx vbif identifier
593 * @xin_id client interface identifier
594 * @clk_ctrl clock control identifier
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700595 */
596struct sde_wb_cfg {
597 SDE_HW_BLK_INFO;
Alan Kwongbb27c092016-07-20 16:41:25 -0400598 const struct sde_wb_sub_blocks *sblk;
599 const struct sde_format_extended *format_list;
Alan Kwong5d324e42016-07-28 22:56:18 -0400600 u32 vbif_idx;
601 u32 xin_id;
602 enum sde_clk_ctrl_type clk_ctrl;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700603};
604
605/**
Alan Kwong4dd64c82017-02-04 18:41:51 -0800606 * struct sde_rot_cfg - information of rotator blocks
607 * @id enum identifying this block
608 * @base register offset of this block
609 * @len length of hardware block
610 * @features bit mask identifying sub-blocks/features
611 * @pdev private device handle
612 * @scid subcache identifier
613 * @slice_size subcache slice size
614 */
615struct sde_rot_cfg {
616 SDE_HW_BLK_INFO;
617 void *pdev;
618 int scid;
619 size_t slice_size;
620};
621
622/**
Alan Kwong5d324e42016-07-28 22:56:18 -0400623 * struct sde_vbif_dynamic_ot_cfg - dynamic OT setting
624 * @pps pixel per seconds
625 * @ot_limit OT limit to use up to specified pixel per second
626 */
627struct sde_vbif_dynamic_ot_cfg {
628 u64 pps;
629 u32 ot_limit;
630};
631
632/**
633 * struct sde_vbif_dynamic_ot_tbl - dynamic OT setting table
634 * @count length of cfg
635 * @cfg pointer to array of configuration settings with
636 * ascending requirements
637 */
638struct sde_vbif_dynamic_ot_tbl {
639 u32 count;
Alan Kwongb9d2f6f2016-10-12 00:27:07 -0400640 struct sde_vbif_dynamic_ot_cfg *cfg;
Alan Kwong5d324e42016-07-28 22:56:18 -0400641};
642
643/**
644 * struct sde_vbif_cfg - information of VBIF blocks
645 * @id enum identifying this block
646 * @base register offset of this block
647 * @features bit mask identifying sub-blocks/features
648 * @ot_rd_limit default OT read limit
649 * @ot_wr_limit default OT write limit
650 * @xin_halt_timeout maximum time (in usec) for xin to halt
651 * @dynamic_ot_rd_tbl dynamic OT read configuration table
652 * @dynamic_ot_wr_tbl dynamic OT write configuration table
653 */
654struct sde_vbif_cfg {
655 SDE_HW_BLK_INFO;
656 u32 default_ot_rd_limit;
657 u32 default_ot_wr_limit;
658 u32 xin_halt_timeout;
659 struct sde_vbif_dynamic_ot_tbl dynamic_ot_rd_tbl;
660 struct sde_vbif_dynamic_ot_tbl dynamic_ot_wr_tbl;
661};
Gopikrishnaiah Anandan031d8ff2016-12-15 16:58:45 -0800662/**
663 * struct sde_reg_dma_cfg - information of lut dma blocks
664 * @id enum identifying this block
665 * @base register offset of this block
666 * @features bit mask identifying sub-blocks/features
667 * @version version of lutdma hw block
668 * @trigger_sel_off offset to trigger select registers of lutdma
669 */
670struct sde_reg_dma_cfg {
671 SDE_HW_BLK_INFO;
672 u32 version;
673 u32 trigger_sel_off;
674};
Alan Kwong5d324e42016-07-28 22:56:18 -0400675
676/**
Alan Kwong9aa061c2016-11-06 21:17:12 -0500677 * struct sde_perf_cfg - performance control settings
678 * @max_bw_low low threshold of maximum bandwidth (kbps)
679 * @max_bw_high high threshold of maximum bandwidth (kbps)
680 */
681struct sde_perf_cfg {
682 u32 max_bw_low;
683 u32 max_bw_high;
684};
685
686/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700687 * struct sde_mdss_cfg - information of MDSS HW
688 * This is the main catalog data structure representing
689 * this HW version. Contains number of instances,
690 * register offsets, capabilities of the all MDSS HW sub-blocks.
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700691 *
692 * @max_sspp_linewidth max source pipe line width support.
693 * @max_mixer_width max layer mixer line width support.
694 * @max_mixer_blendstages max layer mixer blend stages or
695 * supported z order
696 * @max_wb_linewidth max writeback line width support.
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700697 * @qseed_type qseed2 or qseed3 support.
Dhaval Patel5aad7452017-01-12 09:59:31 -0800698 * @csc_type csc or csc_10bit support.
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800699 * @smart_dma_rev Supported version of SmartDMA feature.
Dhaval Patel1964fb92016-10-13 19:28:08 -0700700 * @has_src_split source split feature status
701 * @has_cdp Client driver prefetch feature status
Clarence Ip32bcb002017-03-13 12:26:44 -0700702 * @has_wb_ubwc UBWC feature supported on WB
703 * @ubwc_version UBWC feature version (0x0 for not supported)
Alan Kwong4dd64c82017-02-04 18:41:51 -0800704 * @has_sbuf indicate if stream buffer is available
705 * @sbuf_headroom stream buffer headroom in lines
abeykunf35ff332016-12-20 13:06:09 -0500706 * @dma_formats Supported formats for dma pipe
707 * @cursor_formats Supported formats for cursor pipe
708 * @vig_formats Supported formats for vig pipe
709 * @wb_formats Supported formats for wb
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700710 */
711struct sde_mdss_cfg {
712 u32 hwversion;
713
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700714 u32 max_sspp_linewidth;
715 u32 max_mixer_width;
716 u32 max_mixer_blendstages;
717 u32 max_wb_linewidth;
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700718 u32 qseed_type;
Dhaval Patel5aad7452017-01-12 09:59:31 -0800719 u32 csc_type;
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800720 u32 smart_dma_rev;
Dhaval Patel1964fb92016-10-13 19:28:08 -0700721 bool has_src_split;
722 bool has_cdp;
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800723 bool has_dim_layer;
Clarence Ip32bcb002017-03-13 12:26:44 -0700724 bool has_wb_ubwc;
725 u32 ubwc_version;
Alan Kwong4dd64c82017-02-04 18:41:51 -0800726 bool has_sbuf;
727 u32 sbuf_headroom;
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700728
Ben Chan78647cd2016-06-26 22:02:47 -0400729 u32 mdss_count;
730 struct sde_mdss_base_cfg mdss[MAX_BLOCKS];
731
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700732 u32 mdp_count;
733 struct sde_mdp_cfg mdp[MAX_BLOCKS];
734
735 u32 ctl_count;
736 struct sde_ctl_cfg ctl[MAX_BLOCKS];
737
738 u32 sspp_count;
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700739 struct sde_sspp_cfg sspp[MAX_BLOCKS];
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700740
741 u32 mixer_count;
742 struct sde_lm_cfg mixer[MAX_BLOCKS];
743
744 u32 dspp_count;
745 struct sde_dspp_cfg dspp[MAX_BLOCKS];
746
747 u32 pingpong_count;
748 struct sde_pingpong_cfg pingpong[MAX_BLOCKS];
749
Jeykumar Sankaran5c2f0702017-03-09 18:03:15 -0800750 u32 dsc_count;
751 struct sde_dsc_cfg dsc[MAX_BLOCKS];
752
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700753 u32 cdm_count;
754 struct sde_cdm_cfg cdm[MAX_BLOCKS];
755
756 u32 intf_count;
757 struct sde_intf_cfg intf[MAX_BLOCKS];
758
759 u32 wb_count;
760 struct sde_wb_cfg wb[MAX_BLOCKS];
761
Alan Kwong4dd64c82017-02-04 18:41:51 -0800762 u32 rot_count;
763 struct sde_rot_cfg rot[MAX_BLOCKS];
764
Alan Kwong5d324e42016-07-28 22:56:18 -0400765 u32 vbif_count;
766 struct sde_vbif_cfg vbif[MAX_BLOCKS];
Gopikrishnaiah Anandan031d8ff2016-12-15 16:58:45 -0800767
768 u32 reg_dma_count;
769 struct sde_reg_dma_cfg dma_cfg;
Gopikrishnaiah Anandan9ba43782017-01-31 18:23:08 -0800770
771 u32 ad_count;
772
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700773 /* Add additional block data structures here */
Alan Kwong9aa061c2016-11-06 21:17:12 -0500774
775 struct sde_perf_cfg perf;
abeykunf35ff332016-12-20 13:06:09 -0500776 struct sde_format_extended *dma_formats;
777 struct sde_format_extended *cursor_formats;
778 struct sde_format_extended *vig_formats;
779 struct sde_format_extended *wb_formats;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700780};
781
782struct sde_mdss_hw_cfg_handler {
783 u32 major;
784 u32 minor;
785 struct sde_mdss_cfg* (*cfg_init)(u32);
786};
787
788/*
789 * Access Macros
790 */
791#define BLK_MDP(s) ((s)->mdp)
792#define BLK_CTL(s) ((s)->ctl)
793#define BLK_VIG(s) ((s)->vig)
794#define BLK_RGB(s) ((s)->rgb)
795#define BLK_DMA(s) ((s)->dma)
796#define BLK_CURSOR(s) ((s)->cursor)
797#define BLK_MIXER(s) ((s)->mixer)
798#define BLK_DSPP(s) ((s)->dspp)
799#define BLK_PINGPONG(s) ((s)->pingpong)
800#define BLK_CDM(s) ((s)->cdm)
801#define BLK_INTF(s) ((s)->intf)
802#define BLK_WB(s) ((s)->wb)
803#define BLK_AD(s) ((s)->ad)
804
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700805/**
Clarence Ip17162b52016-11-24 17:06:29 -0500806 * sde_hw_catalog_init - sde hardware catalog init API parses dtsi property
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700807 * and stores all parsed offset, hardware capabilities in config structure.
808 * @dev: drm device node.
809 * @hw_rev: caller needs provide the hardware revision before parsing.
810 *
811 * Return: parsed sde config structure
812 */
813struct sde_mdss_cfg *sde_hw_catalog_init(struct drm_device *dev, u32 hw_rev);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700814
Clarence Ip17162b52016-11-24 17:06:29 -0500815/**
816 * sde_hw_catalog_deinit - sde hardware catalog cleanup
817 * @sde_cfg: pointer returned from init function
818 */
819void sde_hw_catalog_deinit(struct sde_mdss_cfg *sde_cfg);
820
Jeykumar Sankaran2e655032017-02-04 14:05:45 -0800821/**
822 * sde_hw_sspp_multirect_enabled - check multirect enabled for the sspp
823 * @cfg: pointer to sspp cfg
824 */
825static inline bool sde_hw_sspp_multirect_enabled(const struct sde_sspp_cfg *cfg)
826{
827 return test_bit(SDE_SSPP_SMART_DMA_V1, &cfg->features) ||
828 test_bit(SDE_SSPP_SMART_DMA_V2, &cfg->features);
829}
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700830#endif /* _SDE_HW_CATALOG_H */