blob: 0be45034a7f7f5a72a87a2233280accf030f851c [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>
Dhaval Patel8bf7ff32016-07-20 18:13:24 -070020#include <drm/drmP.h>
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070021
Dhaval Patel8bf7ff32016-07-20 18:13:24 -070022/**
23 * Max hardware block count: For ex: max 12 SSPP pipes or
24 * 5 ctl paths. In all cases, it can have max 12 hardware blocks
25 * based on current design
26 */
27#define MAX_BLOCKS 12
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070028
29#define SDE_HW_VER(MAJOR, MINOR, STEP) (((MAJOR & 0xF) << 28) |\
30 ((MINOR & 0xFFF) << 16) |\
31 (STEP & 0xFFFF))
32
33#define SDE_HW_MAJOR(rev) ((rev) >> 28)
abeykunb85a5e32016-08-24 13:51:40 -040034#define SDE_HW_MINOR(rev) (((rev) >> 16) & 0xFFF)
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070035#define SDE_HW_STEP(rev) ((rev) & 0xFFFF)
36#define SDE_HW_MAJOR_MINOR(rev) ((rev) >> 16)
37
38#define IS_SDE_MAJOR_MINOR_SAME(rev1, rev2) \
39 (SDE_HW_MAJOR_MINOR((rev1)) == SDE_HW_MAJOR_MINOR((rev2)))
40
41#define SDE_HW_VER_170 SDE_HW_VER(1, 7, 0) /* 8996 v1.0 */
42#define SDE_HW_VER_171 SDE_HW_VER(1, 7, 1) /* 8996 v2.0 */
43#define SDE_HW_VER_172 SDE_HW_VER(1, 7, 2) /* 8996 v3.0 */
44#define SDE_HW_VER_300 SDE_HW_VER(3, 0, 0) /* 8998 v1.0 */
abeykunb85a5e32016-08-24 13:51:40 -040045#define SDE_HW_VER_400 SDE_HW_VER(4, 0, 0) /* msmskunk v1.0 */
46
47#define IS_MSMSKUNK_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_400)
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070048
Dhaval Patel47302cf2016-08-18 15:04:28 -070049#define MAX_IMG_WIDTH 0x3fff
50#define MAX_IMG_HEIGHT 0x3fff
51
Dhaval Patel44f12472016-08-29 12:19:47 -070052#define CRTC_DUAL_MIXERS 2
53
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -080054#define SDE_COLOR_PROCESS_VER(MAJOR, MINOR) \
55 ((((MAJOR) & 0xFFFF) << 16) | (((MINOR) & 0xFFFF)))
56#define SDE_COLOR_PROCESS_MAJOR(version) (((version) & 0xFFFF0000) >> 16)
57#define SDE_COLOR_PROCESS_MINOR(version) ((version) & 0xFFFF)
58
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070059/**
60 * MDP TOP BLOCK features
61 * @SDE_MDP_PANIC_PER_PIPE Panic configuration needs to be be done per pipe
62 * @SDE_MDP_10BIT_SUPPORT, Chipset supports 10 bit pixel formats
63 * @SDE_MDP_BWC, MDSS HW supports Bandwidth compression.
64 * @SDE_MDP_UBWC_1_0, This chipsets supports Universal Bandwidth
65 * compression initial revision
66 * @SDE_MDP_UBWC_1_5, Universal Bandwidth compression version 1.5
67 * @SDE_MDP_CDP, Client driven prefetch
68 * @SDE_MDP_MAX Maximum value
69
70 */
71enum {
72 SDE_MDP_PANIC_PER_PIPE = 0x1,
73 SDE_MDP_10BIT_SUPPORT,
74 SDE_MDP_BWC,
75 SDE_MDP_UBWC_1_0,
76 SDE_MDP_UBWC_1_5,
77 SDE_MDP_CDP,
78 SDE_MDP_MAX
79};
80
81/**
82 * SSPP sub-blocks/features
83 * @SDE_SSPP_SRC Src and fetch part of the pipes,
Clarence Ipe78efb72016-06-24 18:35:21 -040084 * @SDE_SSPP_SCALER_QSEED2, QSEED2 algorithm support
85 * @SDE_SSPP_SCALER_QSEED3, QSEED3 alogorithm support
86 * @SDE_SSPP_SCALER_RGB, RGB Scaler, supported by RGB pipes
87 * @SDE_SSPP_CSC, Support of Color space converion
abeykun62576142016-08-25 17:44:05 -040088 * @SDE_SSPP_CSC_10BIT, Support of 10-bit Color space conversion
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -080089 * @SDE_SSPP_HSIC, Global HSIC control
90 * @SDE_SSPP_MEMCOLOR Memory Color Support
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070091 * @SDE_SSPP_IGC, Inverse gamma correction
92 * @SDE_SSPP_PCC, Color correction support
93 * @SDE_SSPP_CURSOR, SSPP can be used as a cursor layer
Alan Kwong1a00e4d2016-07-18 09:42:30 -040094 * @SDE_SSPP_QOS, SSPP support QoS control, danger/safe/creq
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070095 * @SDE_SSPP_MAX maximum value
96 */
97enum {
98 SDE_SSPP_SRC = 0x1,
Clarence Ipe78efb72016-06-24 18:35:21 -040099 SDE_SSPP_SCALER_QSEED2,
100 SDE_SSPP_SCALER_QSEED3,
101 SDE_SSPP_SCALER_RGB,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700102 SDE_SSPP_CSC,
abeykun62576142016-08-25 17:44:05 -0400103 SDE_SSPP_CSC_10BIT,
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800104 SDE_SSPP_HSIC,
105 SDE_SSPP_MEMCOLOR,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700106 SDE_SSPP_IGC,
107 SDE_SSPP_PCC,
108 SDE_SSPP_CURSOR,
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400109 SDE_SSPP_QOS,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700110 SDE_SSPP_MAX
111};
112
113/*
114 * MIXER sub-blocks/features
115 * @SDE_MIXER_LAYER Layer mixer layer blend configuration,
116 * @SDE_MIXER_SOURCESPLIT Layer mixer supports source-split configuration
117 * @SDE_MIXER_GC Gamma correction block
118 * @SDE_MIXER_MAX maximum value
119 */
120enum {
121 SDE_MIXER_LAYER = 0x1,
122 SDE_MIXER_SOURCESPLIT,
123 SDE_MIXER_GC,
124 SDE_MIXER_MAX
125};
126
127/**
128 * DSPP sub-blocks
129 * @SDE_DSPP_IGC DSPP Inverse gamma correction block
130 * @SDE_DSPP_PCC Panel color correction block
131 * @SDE_DSPP_GC Gamma correction block
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800132 * @SDE_DSPP_HSIC Global HSIC block
133 * @SDE_DSPP_MEMCOLOR Memory Color block
134 * @SDE_DSPP_SIXZONE Six zone block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700135 * @SDE_DSPP_GAMUT Gamut bloc
136 * @SDE_DSPP_DITHER Dither block
Gopikrishnaiah Anandanb67b0d12016-06-23 11:43:08 -0700137 * @SDE_DSPP_HIST Histogram block
138 * @SDE_DSPP_VLUT PA VLUT block
139 * @SDE_DSPP_AD AD block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700140 * @SDE_DSPP_MAX maximum value
141 */
142enum {
143 SDE_DSPP_IGC = 0x1,
144 SDE_DSPP_PCC,
145 SDE_DSPP_GC,
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800146 SDE_DSPP_HSIC,
147 SDE_DSPP_MEMCOLOR,
148 SDE_DSPP_SIXZONE,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700149 SDE_DSPP_GAMUT,
150 SDE_DSPP_DITHER,
151 SDE_DSPP_HIST,
Gopikrishnaiah Anandanb67b0d12016-06-23 11:43:08 -0700152 SDE_DSPP_VLUT,
Gopikrishnaiah Anandan41980b42016-06-21 16:01:33 -0700153 SDE_DSPP_AD,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700154 SDE_DSPP_MAX
155};
156
157/**
158 * PINGPONG sub-blocks
159 * @SDE_PINGPONG_TE Tear check block
160 * @SDE_PINGPONG_TE2 Additional tear check block for split pipes
161 * @SDE_PINGPONG_SPLIT PP block supports split fifo
162 * @SDE_PINGPONG_DSC, Display stream compression blocks
163 * @SDE_PINGPONG_MAX
164 */
165enum {
166 SDE_PINGPONG_TE = 0x1,
167 SDE_PINGPONG_TE2,
168 SDE_PINGPONG_SPLIT,
169 SDE_PINGPONG_DSC,
170 SDE_PINGPONG_MAX
171};
172
173/**
Lloyd Atkinsoncf8996b2016-08-23 09:34:13 -0400174 * CTL sub-blocks
175 * @SDE_CTL_SPLIT_DISPLAY CTL supports video mode split display
176 * @SDE_CTL_PINGPONG_SPLIT CTL supports pingpong split
177 * @SDE_CTL_MAX
178 */
179enum {
180 SDE_CTL_SPLIT_DISPLAY = 0x1,
181 SDE_CTL_PINGPONG_SPLIT,
182 SDE_CTL_MAX
183};
184
185/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700186 * WB sub-blocks and features
187 * @SDE_WB_LINE_MODE Writeback module supports line/linear mode
188 * @SDE_WB_BLOCK_MODE Writeback module supports block mode read
189 * @SDE_WB_ROTATE rotation support,this is available if writeback
190 * supports block mode read
191 * @SDE_WB_CSC Writeback color conversion block support
192 * @SDE_WB_CHROMA_DOWN, Writeback chroma down block,
193 * @SDE_WB_DOWNSCALE, Writeback integer downscaler,
194 * @SDE_WB_DITHER, Dither block
195 * @SDE_WB_TRAFFIC_SHAPER, Writeback traffic shaper bloc
196 * @SDE_WB_UBWC_1_0, Writeback Universal bandwidth compression 1.0
197 * support
abeykunf1539f72016-08-24 16:08:03 -0400198 * @SDE_WB_UBWC_1_5 UBWC 1.5 support
Alan Kwong3232ca52016-07-29 02:27:47 -0400199 * @SDE_WB_YUV_CONFIG Writeback supports output of YUV colorspace
Alan Kwong9ffcd592016-09-27 07:41:56 -0400200 * @SDE_WB_PIPE_ALPHA Writeback supports pipe alpha
abeykunf1539f72016-08-24 16:08:03 -0400201 * @SDE_WB_XY_ROI_OFFSET Writeback supports x/y-offset of out ROI in
202 * the destination image
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700203 * @SDE_WB_MAX maximum value
204 */
205enum {
206 SDE_WB_LINE_MODE = 0x1,
207 SDE_WB_BLOCK_MODE,
208 SDE_WB_ROTATE = SDE_WB_BLOCK_MODE,
209 SDE_WB_CSC,
210 SDE_WB_CHROMA_DOWN,
211 SDE_WB_DOWNSCALE,
212 SDE_WB_DITHER,
213 SDE_WB_TRAFFIC_SHAPER,
214 SDE_WB_UBWC_1_0,
Alan Kwong3232ca52016-07-29 02:27:47 -0400215 SDE_WB_YUV_CONFIG,
Alan Kwong9ffcd592016-09-27 07:41:56 -0400216 SDE_WB_PIPE_ALPHA,
abeykunf1539f72016-08-24 16:08:03 -0400217 SDE_WB_XY_ROI_OFFSET,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700218 SDE_WB_MAX
219};
220
221/**
Alan Kwong5d324e42016-07-28 22:56:18 -0400222 * VBIF sub-blocks and features
223 * @SDE_VBIF_QOS_OTLIM VBIF supports OT Limit
224 * @SDE_VBIF_MAX maximum value
225 */
226enum {
227 SDE_VBIF_QOS_OTLIM = 0x1,
228 SDE_VBIF_MAX
229};
230
231/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700232 * MACRO SDE_HW_BLK_INFO - information of HW blocks inside SDE
233 * @id: enum identifying this block
234 * @base: register base offset to mdss
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700235 * @len: length of hardware block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700236 * @features bit mask identifying sub-blocks/features
237 */
238#define SDE_HW_BLK_INFO \
239 u32 id; \
240 u32 base; \
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700241 u32 len; \
242 unsigned long features; \
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700243
244/**
245 * MACRO SDE_HW_SUBBLK_INFO - information of HW sub-block inside SDE
246 * @id: enum identifying this sub-block
247 * @base: offset of this sub-block relative to the block
248 * offset
249 * @len register block length of this sub-block
250 */
251#define SDE_HW_SUBBLK_INFO \
252 u32 id; \
253 u32 base; \
254 u32 len
255
256/**
257 * struct sde_src_blk: SSPP part of the source pipes
258 * @info: HW register and features supported by this sub-blk
259 */
260struct sde_src_blk {
261 SDE_HW_SUBBLK_INFO;
262};
263
264/**
Clarence Ipe78efb72016-06-24 18:35:21 -0400265 * struct sde_scaler_blk: Scaler information
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700266 * @info: HW register and features supported by this sub-blk
abeykun48f407a2016-08-25 12:06:44 -0400267 * @version: qseed block revision
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700268 */
Clarence Ipe78efb72016-06-24 18:35:21 -0400269struct sde_scaler_blk {
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700270 SDE_HW_SUBBLK_INFO;
abeykun48f407a2016-08-25 12:06:44 -0400271 u32 version;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700272};
273
274struct sde_csc_blk {
275 SDE_HW_SUBBLK_INFO;
276};
277
278/**
279 * struct sde_pp_blk : Pixel processing sub-blk information
280 * @info: HW register and features supported by this sub-blk
281 * @version: HW Algorithm version
282 */
283struct sde_pp_blk {
284 SDE_HW_SUBBLK_INFO;
285 u32 version;
286};
287
288/**
Clarence Ipea3d6262016-07-15 16:20:11 -0400289 * struct sde_format_extended - define sde specific pixel format+modifier
290 * @fourcc_format: Base FOURCC pixel format code
291 * @modifier: 64-bit drm format modifier, same modifier must be applied to all
292 * framebuffer planes
293 */
294struct sde_format_extended {
295 uint32_t fourcc_format;
296 uint64_t modifier;
297};
298
299/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700300 * struct sde_sspp_sub_blks : SSPP sub-blocks
301 * @maxdwnscale: max downscale ratio supported(without DECIMATION)
302 * @maxupscale: maxupscale ratio supported
303 * @maxwidth: max pixelwidth supported by this pipe
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400304 * @danger_lut_linear: LUT to generate danger signals for linear format
305 * @safe_lut_linear: LUT to generate safe signals for linear format
306 * @danger_lut_tile: LUT to generate danger signals for tile format
307 * @safe_lut_tile: LUT to generate safe signals for tile format
308 * @danger_lut_nrt: LUT to generate danger signals for non-realtime use case
309 * @safe_lut_nrt: LUT to generate safe signals for non-realtime use case
310 * @creq_lut_nrt: LUT to generate creq signals for non-realtime use case
311 * @creq_vblank: creq priority during vertical blanking
312 * @danger_vblank: danger priority during vertical blanking
313 * @pixel_ram_size: size of latency hiding and de-tiling buffer in bytes
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700314 * @src_blk:
Clarence Ipe78efb72016-06-24 18:35:21 -0400315 * @scaler_blk:
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700316 * @csc_blk:
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800317 * @hsic:
318 * @memcolor:
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700319 * @pcc_blk:
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800320 * @igc_blk:
Clarence Ipea3d6262016-07-15 16:20:11 -0400321 * @format_list: Pointer to list of supported formats
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700322 */
323struct sde_sspp_sub_blks {
324 u32 maxlinewidth;
Alan Kwong1a00e4d2016-07-18 09:42:30 -0400325 u32 danger_lut_linear;
326 u32 safe_lut_linear;
327 u32 danger_lut_tile;
328 u32 safe_lut_tile;
329 u32 danger_lut_nrt;
330 u32 safe_lut_nrt;
331 u32 creq_lut_nrt;
332 u32 creq_vblank;
333 u32 danger_vblank;
334 u32 pixel_ram_size;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700335 u32 maxdwnscale;
336 u32 maxupscale;
Clarence Ip5e2a9222016-06-26 22:38:24 -0400337 u32 maxhdeciexp; /* max decimation is 2^value */
338 u32 maxvdeciexp; /* max decimation is 2^value */
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700339 struct sde_src_blk src_blk;
Clarence Ipe78efb72016-06-24 18:35:21 -0400340 struct sde_scaler_blk scaler_blk;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700341 struct sde_pp_blk csc_blk;
Benet Clark37809e62016-10-24 10:14:00 -0700342 struct sde_pp_blk hsic_blk;
343 struct sde_pp_blk memcolor_blk;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700344 struct sde_pp_blk pcc_blk;
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800345 struct sde_pp_blk igc_blk;
Clarence Ipea3d6262016-07-15 16:20:11 -0400346
347 const struct sde_format_extended *format_list;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700348};
349
350/**
351 * struct sde_lm_sub_blks: information of mixer block
352 * @maxwidth: Max pixel width supported by this mixer
353 * @maxblendstages: Max number of blend-stages supported
354 * @blendstage_base: Blend-stage register base offset
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800355 * @gc: gamma correction block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700356 */
357struct sde_lm_sub_blks {
358 u32 maxwidth;
359 u32 maxblendstages;
360 u32 blendstage_base[MAX_BLOCKS];
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800361 struct sde_pp_blk gc;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700362};
363
364struct sde_dspp_sub_blks {
365 struct sde_pp_blk igc;
366 struct sde_pp_blk pcc;
367 struct sde_pp_blk gc;
Gopikrishnaiah Anandane3842f32015-11-05 12:18:41 -0800368 struct sde_pp_blk hsic;
369 struct sde_pp_blk memcolor;
370 struct sde_pp_blk sixzone;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700371 struct sde_pp_blk gamut;
372 struct sde_pp_blk dither;
373 struct sde_pp_blk hist;
Gopikrishnaiah Anandan41980b42016-06-21 16:01:33 -0700374 struct sde_pp_blk ad;
Gopikrishnaiah Anandanb67b0d12016-06-23 11:43:08 -0700375 struct sde_pp_blk vlut;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700376};
377
378struct sde_pingpong_sub_blks {
379 struct sde_pp_blk te;
380 struct sde_pp_blk te2;
381 struct sde_pp_blk dsc;
382};
383
384struct sde_wb_sub_blocks {
385 u32 maxlinewidth;
386};
387
Ben Chan78647cd2016-06-26 22:02:47 -0400388struct sde_mdss_base_cfg {
389 SDE_HW_BLK_INFO;
390};
391
Alan Kwong5d324e42016-07-28 22:56:18 -0400392/**
393 * sde_clk_ctrl_type - Defines top level clock control signals
394 */
395enum sde_clk_ctrl_type {
396 SDE_CLK_CTRL_NONE,
397 SDE_CLK_CTRL_VIG0,
398 SDE_CLK_CTRL_VIG1,
399 SDE_CLK_CTRL_VIG2,
400 SDE_CLK_CTRL_VIG3,
401 SDE_CLK_CTRL_VIG4,
402 SDE_CLK_CTRL_RGB0,
403 SDE_CLK_CTRL_RGB1,
404 SDE_CLK_CTRL_RGB2,
405 SDE_CLK_CTRL_RGB3,
406 SDE_CLK_CTRL_DMA0,
407 SDE_CLK_CTRL_DMA1,
408 SDE_CLK_CTRL_CURSOR0,
409 SDE_CLK_CTRL_CURSOR1,
410 SDE_CLK_CTRL_WB0,
411 SDE_CLK_CTRL_WB1,
412 SDE_CLK_CTRL_WB2,
413 SDE_CLK_CTRL_MAX,
414};
415
416/* struct sde_clk_ctrl_reg : Clock control register
417 * @reg_off: register offset
418 * @bit_off: bit offset
419 */
420struct sde_clk_ctrl_reg {
421 u32 reg_off;
422 u32 bit_off;
423};
424
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700425/* struct sde_mdp_cfg : MDP TOP-BLK instance info
426 * @id: index identifying this block
427 * @base: register base offset to mdss
428 * @features bit mask identifying sub-blocks/features
429 * @highest_bank_bit: UBWC parameter
Alan Kwong5d324e42016-07-28 22:56:18 -0400430 * @clk_ctrls clock control register definition
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700431 */
432struct sde_mdp_cfg {
433 SDE_HW_BLK_INFO;
434 u32 highest_bank_bit;
Alan Kwong5d324e42016-07-28 22:56:18 -0400435 struct sde_clk_ctrl_reg clk_ctrls[SDE_CLK_CTRL_MAX];
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700436};
437
438/* struct sde_mdp_cfg : MDP TOP-BLK instance info
439 * @id: index identifying this block
440 * @base: register base offset to mdss
441 * @features bit mask identifying sub-blocks/features
442 */
443struct sde_ctl_cfg {
444 SDE_HW_BLK_INFO;
445};
446
447/**
448 * struct sde_sspp_cfg - information of source pipes
449 * @id: index identifying this block
450 * @base register offset of this block
451 * @features bit mask identifying sub-blocks/features
Lloyd Atkinson350bb412016-07-06 10:47:29 -0400452 * @sblk: SSPP sub-blocks information
Alan Kwong5d324e42016-07-28 22:56:18 -0400453 * @xin_id: bus client identifier
454 * @clk_ctrl clock control identifier
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700455 */
456struct sde_sspp_cfg {
457 SDE_HW_BLK_INFO;
458 const struct sde_sspp_sub_blks *sblk;
Alan Kwong5d324e42016-07-28 22:56:18 -0400459 u32 xin_id;
460 enum sde_clk_ctrl_type clk_ctrl;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700461};
462
463/**
464 * struct sde_lm_cfg - information of layer mixer blocks
465 * @id: index identifying this block
466 * @base register offset of this block
467 * @features bit mask identifying sub-blocks/features
Lloyd Atkinson350bb412016-07-06 10:47:29 -0400468 * @sblk: LM Sub-blocks information
469 * @dspp: ID of connected DSPP, DSPP_MAX if unsupported
470 * @pingpong: ID of connected PingPong, PINGPONG_MAX if unsupported
471 * @lm_pair_mask: Bitmask of LMs that can be controlled by same CTL
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700472 */
473struct sde_lm_cfg {
474 SDE_HW_BLK_INFO;
475 const struct sde_lm_sub_blks *sblk;
Lloyd Atkinson350bb412016-07-06 10:47:29 -0400476 u32 dspp;
477 u32 pingpong;
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400478 unsigned long lm_pair_mask;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700479};
480
481/**
482 * struct sde_dspp_cfg - information of DSPP blocks
483 * @id enum identifying this block
484 * @base register offset of this block
485 * @features bit mask identifying sub-blocks/features
486 * supported by this block
487 * @sblk sub-blocks information
488 */
489struct sde_dspp_cfg {
490 SDE_HW_BLK_INFO;
491 const struct sde_dspp_sub_blks *sblk;
492};
493
494/**
495 * struct sde_pingpong_cfg - information of PING-PONG blocks
496 * @id enum identifying this block
497 * @base register offset of this block
498 * @features bit mask identifying sub-blocks/features
499 * @sblk sub-blocks information
500 */
501struct sde_pingpong_cfg {
502 SDE_HW_BLK_INFO;
503 const struct sde_pingpong_sub_blks *sblk;
504};
505
506/**
507 * struct sde_cdm_cfg - information of chroma down blocks
508 * @id enum identifying this block
509 * @base register offset of this block
510 * @features bit mask identifying sub-blocks/features
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400511 * @intf_connect Bitmask of INTF IDs this CDM can connect to
512 * @wb_connect: Bitmask of Writeback IDs this CDM can connect to
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700513 */
514struct sde_cdm_cfg {
515 SDE_HW_BLK_INFO;
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400516 unsigned long intf_connect;
517 unsigned long wb_connect;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700518};
519
520/**
521 * struct sde_intf_cfg - information of timing engine blocks
522 * @id enum identifying this block
523 * @base register offset of this block
524 * @features bit mask identifying sub-blocks/features
525 * @type: Interface type(DSI, DP, HDMI)
Lloyd Atkinson2d4e7662015-11-05 15:52:07 -0500526 * @controller_id: Controller Instance ID in case of multiple of intf type
Lloyd Atkinsonf30546e2016-06-26 10:08:25 -0400527 * @prog_fetch_lines_worst_case Worst case latency num lines needed to prefetch
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700528 */
529struct sde_intf_cfg {
530 SDE_HW_BLK_INFO;
531 u32 type; /* interface type*/
Lloyd Atkinson2d4e7662015-11-05 15:52:07 -0500532 u32 controller_id;
Lloyd Atkinsonf30546e2016-06-26 10:08:25 -0400533 u32 prog_fetch_lines_worst_case;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700534};
535
536/**
537 * struct sde_wb_cfg - information of writeback blocks
538 * @id enum identifying this block
539 * @base register offset of this block
540 * @features bit mask identifying sub-blocks/features
Alan Kwongbb27c092016-07-20 16:41:25 -0400541 * @sblk sub-block information
542 * @format_list: Pointer to list of supported formats
Alan Kwong5d324e42016-07-28 22:56:18 -0400543 * @vbif_idx vbif identifier
544 * @xin_id client interface identifier
545 * @clk_ctrl clock control identifier
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700546 */
547struct sde_wb_cfg {
548 SDE_HW_BLK_INFO;
Alan Kwongbb27c092016-07-20 16:41:25 -0400549 const struct sde_wb_sub_blocks *sblk;
550 const struct sde_format_extended *format_list;
Alan Kwong5d324e42016-07-28 22:56:18 -0400551 u32 vbif_idx;
552 u32 xin_id;
553 enum sde_clk_ctrl_type clk_ctrl;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700554};
555
556/**
Alan Kwong5d324e42016-07-28 22:56:18 -0400557 * struct sde_vbif_dynamic_ot_cfg - dynamic OT setting
558 * @pps pixel per seconds
559 * @ot_limit OT limit to use up to specified pixel per second
560 */
561struct sde_vbif_dynamic_ot_cfg {
562 u64 pps;
563 u32 ot_limit;
564};
565
566/**
567 * struct sde_vbif_dynamic_ot_tbl - dynamic OT setting table
568 * @count length of cfg
569 * @cfg pointer to array of configuration settings with
570 * ascending requirements
571 */
572struct sde_vbif_dynamic_ot_tbl {
573 u32 count;
Alan Kwongb9d2f6f2016-10-12 00:27:07 -0400574 struct sde_vbif_dynamic_ot_cfg *cfg;
Alan Kwong5d324e42016-07-28 22:56:18 -0400575};
576
577/**
578 * struct sde_vbif_cfg - information of VBIF blocks
579 * @id enum identifying this block
580 * @base register offset of this block
581 * @features bit mask identifying sub-blocks/features
582 * @ot_rd_limit default OT read limit
583 * @ot_wr_limit default OT write limit
584 * @xin_halt_timeout maximum time (in usec) for xin to halt
585 * @dynamic_ot_rd_tbl dynamic OT read configuration table
586 * @dynamic_ot_wr_tbl dynamic OT write configuration table
587 */
588struct sde_vbif_cfg {
589 SDE_HW_BLK_INFO;
590 u32 default_ot_rd_limit;
591 u32 default_ot_wr_limit;
592 u32 xin_halt_timeout;
593 struct sde_vbif_dynamic_ot_tbl dynamic_ot_rd_tbl;
594 struct sde_vbif_dynamic_ot_tbl dynamic_ot_wr_tbl;
595};
596
597/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700598 * struct sde_mdss_cfg - information of MDSS HW
599 * This is the main catalog data structure representing
600 * this HW version. Contains number of instances,
601 * register offsets, capabilities of the all MDSS HW sub-blocks.
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700602 *
603 * @max_sspp_linewidth max source pipe line width support.
604 * @max_mixer_width max layer mixer line width support.
605 * @max_mixer_blendstages max layer mixer blend stages or
606 * supported z order
607 * @max_wb_linewidth max writeback line width support.
608 * @highest_bank_bit highest memory bit setting for tile buffers.
609 * @qseed_type qseed2 or qseed3 support.
Dhaval Patel1964fb92016-10-13 19:28:08 -0700610 * @has_src_split source split feature status
611 * @has_cdp Client driver prefetch feature status
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700612 */
613struct sde_mdss_cfg {
614 u32 hwversion;
615
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700616 u32 max_sspp_linewidth;
617 u32 max_mixer_width;
618 u32 max_mixer_blendstages;
619 u32 max_wb_linewidth;
620 u32 highest_bank_bit;
621 u32 qseed_type;
Dhaval Patel1964fb92016-10-13 19:28:08 -0700622 bool has_src_split;
623 bool has_cdp;
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700624
Ben Chan78647cd2016-06-26 22:02:47 -0400625 u32 mdss_count;
626 struct sde_mdss_base_cfg mdss[MAX_BLOCKS];
627
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700628 u32 mdp_count;
629 struct sde_mdp_cfg mdp[MAX_BLOCKS];
630
631 u32 ctl_count;
632 struct sde_ctl_cfg ctl[MAX_BLOCKS];
633
634 u32 sspp_count;
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700635 struct sde_sspp_cfg sspp[MAX_BLOCKS];
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700636
637 u32 mixer_count;
638 struct sde_lm_cfg mixer[MAX_BLOCKS];
639
640 u32 dspp_count;
641 struct sde_dspp_cfg dspp[MAX_BLOCKS];
642
643 u32 pingpong_count;
644 struct sde_pingpong_cfg pingpong[MAX_BLOCKS];
645
646 u32 cdm_count;
647 struct sde_cdm_cfg cdm[MAX_BLOCKS];
648
649 u32 intf_count;
650 struct sde_intf_cfg intf[MAX_BLOCKS];
651
652 u32 wb_count;
653 struct sde_wb_cfg wb[MAX_BLOCKS];
654
Alan Kwong5d324e42016-07-28 22:56:18 -0400655 u32 vbif_count;
656 struct sde_vbif_cfg vbif[MAX_BLOCKS];
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700657 /* Add additional block data structures here */
658};
659
660struct sde_mdss_hw_cfg_handler {
661 u32 major;
662 u32 minor;
663 struct sde_mdss_cfg* (*cfg_init)(u32);
664};
665
666/*
667 * Access Macros
668 */
669#define BLK_MDP(s) ((s)->mdp)
670#define BLK_CTL(s) ((s)->ctl)
671#define BLK_VIG(s) ((s)->vig)
672#define BLK_RGB(s) ((s)->rgb)
673#define BLK_DMA(s) ((s)->dma)
674#define BLK_CURSOR(s) ((s)->cursor)
675#define BLK_MIXER(s) ((s)->mixer)
676#define BLK_DSPP(s) ((s)->dspp)
677#define BLK_PINGPONG(s) ((s)->pingpong)
678#define BLK_CDM(s) ((s)->cdm)
679#define BLK_INTF(s) ((s)->intf)
680#define BLK_WB(s) ((s)->wb)
681#define BLK_AD(s) ((s)->ad)
682
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700683/**
Clarence Ip17162b52016-11-24 17:06:29 -0500684 * sde_hw_catalog_init - sde hardware catalog init API parses dtsi property
Dhaval Patel8bf7ff32016-07-20 18:13:24 -0700685 * and stores all parsed offset, hardware capabilities in config structure.
686 * @dev: drm device node.
687 * @hw_rev: caller needs provide the hardware revision before parsing.
688 *
689 * Return: parsed sde config structure
690 */
691struct sde_mdss_cfg *sde_hw_catalog_init(struct drm_device *dev, u32 hw_rev);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700692
Clarence Ip17162b52016-11-24 17:06:29 -0500693/**
694 * sde_hw_catalog_deinit - sde hardware catalog cleanup
695 * @sde_cfg: pointer returned from init function
696 */
697void sde_hw_catalog_deinit(struct sde_mdss_cfg *sde_cfg);
698
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700699#endif /* _SDE_HW_CATALOG_H */