2 * linux/drivers/video/omap2/dss/dss_features.c
4 * Copyright (C) 2010 Texas Instruments
5 * Author: Archit Taneja <archit@ti.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <linux/kernel.h>
21 #include <linux/module.h>
22 #include <linux/types.h>
23 #include <linux/err.h>
24 #include <linux/slab.h>
26 #include <video/omapdss.h>
29 #include "dss_features.h"
31 /* Defines a generic omap register field */
32 struct dss_reg_field
{
36 struct dss_param_range
{
40 struct omap_dss_features
{
41 const struct dss_reg_field
*reg_fields
;
42 const int num_reg_fields
;
44 const enum dss_feat_id
*features
;
45 const int num_features
;
49 const enum omap_display_type
*supported_displays
;
50 const enum omap_dss_output_id
*supported_outputs
;
51 const enum omap_color_mode
*supported_color_modes
;
52 const enum omap_overlay_caps
*overlay_caps
;
53 const char * const *clksrc_names
;
54 const struct dss_param_range
*dss_params
;
56 const enum omap_dss_rotation_type supported_rotation_types
;
58 const u32 buffer_size_unit
;
59 const u32 burst_size_unit
;
62 /* This struct is assigned to one of the below during initialization */
63 static const struct omap_dss_features
*omap_current_dss_features
;
65 static const struct dss_reg_field omap2_dss_reg_fields
[] = {
66 [FEAT_REG_FIRHINC
] = { 11, 0 },
67 [FEAT_REG_FIRVINC
] = { 27, 16 },
68 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 8, 0 },
69 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 24, 16 },
70 [FEAT_REG_FIFOSIZE
] = { 8, 0 },
71 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
72 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
73 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
76 static const struct dss_reg_field omap3_dss_reg_fields
[] = {
77 [FEAT_REG_FIRHINC
] = { 12, 0 },
78 [FEAT_REG_FIRVINC
] = { 28, 16 },
79 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 11, 0 },
80 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 27, 16 },
81 [FEAT_REG_FIFOSIZE
] = { 10, 0 },
82 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
83 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
84 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
87 static const struct dss_reg_field am43xx_dss_reg_fields
[] = {
88 [FEAT_REG_FIRHINC
] = { 12, 0 },
89 [FEAT_REG_FIRVINC
] = { 28, 16 },
90 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 11, 0 },
91 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 27, 16 },
92 [FEAT_REG_FIFOSIZE
] = { 10, 0 },
93 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
94 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
95 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
98 static const struct dss_reg_field omap4_dss_reg_fields
[] = {
99 [FEAT_REG_FIRHINC
] = { 12, 0 },
100 [FEAT_REG_FIRVINC
] = { 28, 16 },
101 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 15, 0 },
102 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 31, 16 },
103 [FEAT_REG_FIFOSIZE
] = { 15, 0 },
104 [FEAT_REG_HORIZONTALACCU
] = { 10, 0 },
105 [FEAT_REG_VERTICALACCU
] = { 26, 16 },
106 [FEAT_REG_DISPC_CLK_SWITCH
] = { 9, 8 },
109 static const struct dss_reg_field omap5_dss_reg_fields
[] = {
110 [FEAT_REG_FIRHINC
] = { 12, 0 },
111 [FEAT_REG_FIRVINC
] = { 28, 16 },
112 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 15, 0 },
113 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 31, 16 },
114 [FEAT_REG_FIFOSIZE
] = { 15, 0 },
115 [FEAT_REG_HORIZONTALACCU
] = { 10, 0 },
116 [FEAT_REG_VERTICALACCU
] = { 26, 16 },
117 [FEAT_REG_DISPC_CLK_SWITCH
] = { 9, 7 },
120 static const enum omap_display_type omap2_dss_supported_displays
[] = {
121 /* OMAP_DSS_CHANNEL_LCD */
122 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
,
124 /* OMAP_DSS_CHANNEL_DIGIT */
125 OMAP_DISPLAY_TYPE_VENC
,
128 static const enum omap_display_type omap3430_dss_supported_displays
[] = {
129 /* OMAP_DSS_CHANNEL_LCD */
130 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
131 OMAP_DISPLAY_TYPE_SDI
| OMAP_DISPLAY_TYPE_DSI
,
133 /* OMAP_DSS_CHANNEL_DIGIT */
134 OMAP_DISPLAY_TYPE_VENC
,
137 static const enum omap_display_type omap3630_dss_supported_displays
[] = {
138 /* OMAP_DSS_CHANNEL_LCD */
139 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
140 OMAP_DISPLAY_TYPE_DSI
,
142 /* OMAP_DSS_CHANNEL_DIGIT */
143 OMAP_DISPLAY_TYPE_VENC
,
146 static const enum omap_display_type am43xx_dss_supported_displays
[] = {
147 /* OMAP_DSS_CHANNEL_LCD */
148 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
,
151 static const enum omap_display_type omap4_dss_supported_displays
[] = {
152 /* OMAP_DSS_CHANNEL_LCD */
153 OMAP_DISPLAY_TYPE_DBI
| OMAP_DISPLAY_TYPE_DSI
,
155 /* OMAP_DSS_CHANNEL_DIGIT */
156 OMAP_DISPLAY_TYPE_VENC
| OMAP_DISPLAY_TYPE_HDMI
,
158 /* OMAP_DSS_CHANNEL_LCD2 */
159 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
160 OMAP_DISPLAY_TYPE_DSI
,
163 static const enum omap_display_type omap5_dss_supported_displays
[] = {
164 /* OMAP_DSS_CHANNEL_LCD */
165 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
166 OMAP_DISPLAY_TYPE_DSI
,
168 /* OMAP_DSS_CHANNEL_DIGIT */
169 OMAP_DISPLAY_TYPE_HDMI
| OMAP_DISPLAY_TYPE_DPI
,
171 /* OMAP_DSS_CHANNEL_LCD2 */
172 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
173 OMAP_DISPLAY_TYPE_DSI
,
176 static const enum omap_dss_output_id omap2_dss_supported_outputs
[] = {
177 /* OMAP_DSS_CHANNEL_LCD */
178 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
,
180 /* OMAP_DSS_CHANNEL_DIGIT */
181 OMAP_DSS_OUTPUT_VENC
,
184 static const enum omap_dss_output_id omap3430_dss_supported_outputs
[] = {
185 /* OMAP_DSS_CHANNEL_LCD */
186 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
187 OMAP_DSS_OUTPUT_SDI
| OMAP_DSS_OUTPUT_DSI1
,
189 /* OMAP_DSS_CHANNEL_DIGIT */
190 OMAP_DSS_OUTPUT_VENC
,
193 static const enum omap_dss_output_id omap3630_dss_supported_outputs
[] = {
194 /* OMAP_DSS_CHANNEL_LCD */
195 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
196 OMAP_DSS_OUTPUT_DSI1
,
198 /* OMAP_DSS_CHANNEL_DIGIT */
199 OMAP_DSS_OUTPUT_VENC
,
202 static const enum omap_dss_output_id am43xx_dss_supported_outputs
[] = {
203 /* OMAP_DSS_CHANNEL_LCD */
204 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
,
207 static const enum omap_dss_output_id omap4_dss_supported_outputs
[] = {
208 /* OMAP_DSS_CHANNEL_LCD */
209 OMAP_DSS_OUTPUT_DBI
| OMAP_DSS_OUTPUT_DSI1
,
211 /* OMAP_DSS_CHANNEL_DIGIT */
212 OMAP_DSS_OUTPUT_VENC
| OMAP_DSS_OUTPUT_HDMI
,
214 /* OMAP_DSS_CHANNEL_LCD2 */
215 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
216 OMAP_DSS_OUTPUT_DSI2
,
219 static const enum omap_dss_output_id omap5_dss_supported_outputs
[] = {
220 /* OMAP_DSS_CHANNEL_LCD */
221 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
222 OMAP_DSS_OUTPUT_DSI1
| OMAP_DSS_OUTPUT_DSI2
,
224 /* OMAP_DSS_CHANNEL_DIGIT */
225 OMAP_DSS_OUTPUT_HDMI
,
227 /* OMAP_DSS_CHANNEL_LCD2 */
228 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
229 OMAP_DSS_OUTPUT_DSI1
,
231 /* OMAP_DSS_CHANNEL_LCD3 */
232 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
233 OMAP_DSS_OUTPUT_DSI2
,
236 static const enum omap_color_mode omap2_dss_supported_color_modes
[] = {
238 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
239 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
240 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_RGB16
|
241 OMAP_DSS_COLOR_RGB24U
| OMAP_DSS_COLOR_RGB24P
,
243 /* OMAP_DSS_VIDEO1 */
244 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
245 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
248 /* OMAP_DSS_VIDEO2 */
249 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
250 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
254 static const enum omap_color_mode omap3_dss_supported_color_modes
[] = {
256 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
257 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
258 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
259 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
260 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_ARGB32
|
261 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
,
263 /* OMAP_DSS_VIDEO1 */
264 OMAP_DSS_COLOR_RGB24U
| OMAP_DSS_COLOR_RGB24P
|
265 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_RGB16
|
266 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_UYVY
,
268 /* OMAP_DSS_VIDEO2 */
269 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
270 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
271 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
272 OMAP_DSS_COLOR_UYVY
| OMAP_DSS_COLOR_ARGB32
|
273 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
,
276 static const enum omap_color_mode omap4_dss_supported_color_modes
[] = {
278 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
279 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
280 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
281 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
282 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_ARGB32
|
283 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
|
284 OMAP_DSS_COLOR_ARGB16_1555
| OMAP_DSS_COLOR_RGBX16
|
285 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_XRGB16_1555
,
287 /* OMAP_DSS_VIDEO1 */
288 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
289 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
290 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
291 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
292 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
293 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
294 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
295 OMAP_DSS_COLOR_RGBX32
,
297 /* OMAP_DSS_VIDEO2 */
298 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
299 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
300 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
301 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
302 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
303 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
304 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
305 OMAP_DSS_COLOR_RGBX32
,
307 /* OMAP_DSS_VIDEO3 */
308 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
309 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
310 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
311 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
312 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
313 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
314 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
315 OMAP_DSS_COLOR_RGBX32
,
318 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
319 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
320 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
321 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
322 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
323 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
324 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
325 OMAP_DSS_COLOR_RGBX32
,
328 static const enum omap_overlay_caps omap2_dss_overlay_caps
[] = {
330 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
332 /* OMAP_DSS_VIDEO1 */
333 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
334 OMAP_DSS_OVL_CAP_REPLICATION
,
336 /* OMAP_DSS_VIDEO2 */
337 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
338 OMAP_DSS_OVL_CAP_REPLICATION
,
341 static const enum omap_overlay_caps omap3430_dss_overlay_caps
[] = {
343 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_POS
|
344 OMAP_DSS_OVL_CAP_REPLICATION
,
346 /* OMAP_DSS_VIDEO1 */
347 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
348 OMAP_DSS_OVL_CAP_REPLICATION
,
350 /* OMAP_DSS_VIDEO2 */
351 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
352 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
355 static const enum omap_overlay_caps omap3630_dss_overlay_caps
[] = {
357 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
|
358 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
360 /* OMAP_DSS_VIDEO1 */
361 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
362 OMAP_DSS_OVL_CAP_REPLICATION
,
364 /* OMAP_DSS_VIDEO2 */
365 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
366 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_POS
|
367 OMAP_DSS_OVL_CAP_REPLICATION
,
370 static const enum omap_overlay_caps omap4_dss_overlay_caps
[] = {
372 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
|
373 OMAP_DSS_OVL_CAP_ZORDER
| OMAP_DSS_OVL_CAP_POS
|
374 OMAP_DSS_OVL_CAP_REPLICATION
,
376 /* OMAP_DSS_VIDEO1 */
377 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
378 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
379 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
381 /* OMAP_DSS_VIDEO2 */
382 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
383 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
384 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
386 /* OMAP_DSS_VIDEO3 */
387 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
388 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
389 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
392 static const char * const omap2_dss_clk_source_names
[] = {
393 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "N/A",
394 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "N/A",
395 [OMAP_DSS_CLK_SRC_FCK
] = "DSS_FCLK1",
398 static const char * const omap3_dss_clk_source_names
[] = {
399 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "DSI1_PLL_FCLK",
400 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "DSI2_PLL_FCLK",
401 [OMAP_DSS_CLK_SRC_FCK
] = "DSS1_ALWON_FCLK",
404 static const char * const omap4_dss_clk_source_names
[] = {
405 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "PLL1_CLK1",
406 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "PLL1_CLK2",
407 [OMAP_DSS_CLK_SRC_FCK
] = "DSS_FCLK",
408 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC
] = "PLL2_CLK1",
409 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI
] = "PLL2_CLK2",
412 static const char * const omap5_dss_clk_source_names
[] = {
413 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "DPLL_DSI1_A_CLK1",
414 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "DPLL_DSI1_A_CLK2",
415 [OMAP_DSS_CLK_SRC_FCK
] = "DSS_CLK",
416 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC
] = "DPLL_DSI1_C_CLK1",
417 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI
] = "DPLL_DSI1_C_CLK2",
420 static const struct dss_param_range omap2_dss_param_range
[] = {
421 [FEAT_PARAM_DSS_FCK
] = { 0, 133000000 },
422 [FEAT_PARAM_DSS_PCD
] = { 2, 255 },
423 [FEAT_PARAM_DOWNSCALE
] = { 1, 2 },
425 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
426 * scaler cannot scale a image with width more than 768.
428 [FEAT_PARAM_LINEWIDTH
] = { 1, 768 },
431 static const struct dss_param_range omap3_dss_param_range
[] = {
432 [FEAT_PARAM_DSS_FCK
] = { 0, 173000000 },
433 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
434 [FEAT_PARAM_DSIPLL_LPDIV
] = { 1, (1 << 13) - 1},
435 [FEAT_PARAM_DSI_FCK
] = { 0, 173000000 },
436 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
437 [FEAT_PARAM_LINEWIDTH
] = { 1, 1024 },
440 static const struct dss_param_range am43xx_dss_param_range
[] = {
441 [FEAT_PARAM_DSS_FCK
] = { 0, 200000000 },
442 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
443 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
444 [FEAT_PARAM_LINEWIDTH
] = { 1, 1024 },
447 static const struct dss_param_range omap4_dss_param_range
[] = {
448 [FEAT_PARAM_DSS_FCK
] = { 0, 186000000 },
449 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
450 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, (1 << 13) - 1 },
451 [FEAT_PARAM_DSI_FCK
] = { 0, 170000000 },
452 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
453 [FEAT_PARAM_LINEWIDTH
] = { 1, 2048 },
456 static const struct dss_param_range omap5_dss_param_range
[] = {
457 [FEAT_PARAM_DSS_FCK
] = { 0, 209250000 },
458 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
459 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, (1 << 13) - 1 },
460 [FEAT_PARAM_DSI_FCK
] = { 0, 209250000 },
461 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
462 [FEAT_PARAM_LINEWIDTH
] = { 1, 2048 },
465 static const enum dss_feat_id omap2_dss_feat_list
[] = {
467 FEAT_LCDENABLESIGNAL
,
470 FEAT_ROWREPEATENABLE
,
474 static const enum dss_feat_id omap3430_dss_feat_list
[] = {
476 FEAT_LCDENABLESIGNAL
,
479 FEAT_LINEBUFFERSPLIT
,
480 FEAT_ROWREPEATENABLE
,
482 FEAT_DSI_REVERSE_TXCLKESC
,
483 FEAT_VENC_REQUIRES_TV_DAC_CLK
,
487 FEAT_ALPHA_FIXED_ZORDER
,
489 FEAT_OMAP3_DSI_FIFO_BUG
,
490 FEAT_DPI_USES_VDDS_DSI
,
493 static const enum dss_feat_id am35xx_dss_feat_list
[] = {
495 FEAT_LCDENABLESIGNAL
,
498 FEAT_LINEBUFFERSPLIT
,
499 FEAT_ROWREPEATENABLE
,
501 FEAT_DSI_REVERSE_TXCLKESC
,
502 FEAT_VENC_REQUIRES_TV_DAC_CLK
,
506 FEAT_ALPHA_FIXED_ZORDER
,
508 FEAT_OMAP3_DSI_FIFO_BUG
,
511 static const enum dss_feat_id am43xx_dss_feat_list
[] = {
513 FEAT_LCDENABLESIGNAL
,
516 FEAT_LINEBUFFERSPLIT
,
517 FEAT_ROWREPEATENABLE
,
522 FEAT_ALPHA_FIXED_ZORDER
,
526 static const enum dss_feat_id omap3630_dss_feat_list
[] = {
528 FEAT_LCDENABLESIGNAL
,
531 FEAT_LINEBUFFERSPLIT
,
532 FEAT_ROWREPEATENABLE
,
534 FEAT_DSI_PLL_PWR_BUG
,
538 FEAT_ALPHA_FIXED_ZORDER
,
540 FEAT_OMAP3_DSI_FIFO_BUG
,
541 FEAT_DPI_USES_VDDS_DSI
,
544 static const enum dss_feat_id omap4430_es1_0_dss_feat_list
[] = {
548 FEAT_DSI_DCS_CMD_CONFIG_VC
,
549 FEAT_DSI_VC_OCP_WIDTH
,
551 FEAT_HANDLE_UV_SEPARATE
,
556 FEAT_ALPHA_FREE_ZORDER
,
561 static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list
[] = {
565 FEAT_DSI_DCS_CMD_CONFIG_VC
,
566 FEAT_DSI_VC_OCP_WIDTH
,
568 FEAT_HDMI_CTS_SWMODE
,
569 FEAT_HANDLE_UV_SEPARATE
,
574 FEAT_ALPHA_FREE_ZORDER
,
579 static const enum dss_feat_id omap4_dss_feat_list
[] = {
583 FEAT_DSI_DCS_CMD_CONFIG_VC
,
584 FEAT_DSI_VC_OCP_WIDTH
,
586 FEAT_HDMI_CTS_SWMODE
,
587 FEAT_HDMI_AUDIO_USE_MCLK
,
588 FEAT_HANDLE_UV_SEPARATE
,
593 FEAT_ALPHA_FREE_ZORDER
,
598 static const enum dss_feat_id omap5_dss_feat_list
[] = {
603 FEAT_DSI_DCS_CMD_CONFIG_VC
,
604 FEAT_DSI_VC_OCP_WIDTH
,
606 FEAT_HDMI_CTS_SWMODE
,
607 FEAT_HDMI_AUDIO_USE_MCLK
,
608 FEAT_HANDLE_UV_SEPARATE
,
613 FEAT_ALPHA_FREE_ZORDER
,
620 /* OMAP2 DSS Features */
621 static const struct omap_dss_features omap2_dss_features
= {
622 .reg_fields
= omap2_dss_reg_fields
,
623 .num_reg_fields
= ARRAY_SIZE(omap2_dss_reg_fields
),
625 .features
= omap2_dss_feat_list
,
626 .num_features
= ARRAY_SIZE(omap2_dss_feat_list
),
630 .supported_displays
= omap2_dss_supported_displays
,
631 .supported_outputs
= omap2_dss_supported_outputs
,
632 .supported_color_modes
= omap2_dss_supported_color_modes
,
633 .overlay_caps
= omap2_dss_overlay_caps
,
634 .clksrc_names
= omap2_dss_clk_source_names
,
635 .dss_params
= omap2_dss_param_range
,
636 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
637 .buffer_size_unit
= 1,
638 .burst_size_unit
= 8,
641 /* OMAP3 DSS Features */
642 static const struct omap_dss_features omap3430_dss_features
= {
643 .reg_fields
= omap3_dss_reg_fields
,
644 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
646 .features
= omap3430_dss_feat_list
,
647 .num_features
= ARRAY_SIZE(omap3430_dss_feat_list
),
651 .supported_displays
= omap3430_dss_supported_displays
,
652 .supported_outputs
= omap3430_dss_supported_outputs
,
653 .supported_color_modes
= omap3_dss_supported_color_modes
,
654 .overlay_caps
= omap3430_dss_overlay_caps
,
655 .clksrc_names
= omap3_dss_clk_source_names
,
656 .dss_params
= omap3_dss_param_range
,
657 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
658 .buffer_size_unit
= 1,
659 .burst_size_unit
= 8,
663 * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
664 * vdds_dsi regulator.
666 static const struct omap_dss_features am35xx_dss_features
= {
667 .reg_fields
= omap3_dss_reg_fields
,
668 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
670 .features
= am35xx_dss_feat_list
,
671 .num_features
= ARRAY_SIZE(am35xx_dss_feat_list
),
675 .supported_displays
= omap3430_dss_supported_displays
,
676 .supported_outputs
= omap3430_dss_supported_outputs
,
677 .supported_color_modes
= omap3_dss_supported_color_modes
,
678 .overlay_caps
= omap3430_dss_overlay_caps
,
679 .clksrc_names
= omap3_dss_clk_source_names
,
680 .dss_params
= omap3_dss_param_range
,
681 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
682 .buffer_size_unit
= 1,
683 .burst_size_unit
= 8,
686 static const struct omap_dss_features am43xx_dss_features
= {
687 .reg_fields
= am43xx_dss_reg_fields
,
688 .num_reg_fields
= ARRAY_SIZE(am43xx_dss_reg_fields
),
690 .features
= am43xx_dss_feat_list
,
691 .num_features
= ARRAY_SIZE(am43xx_dss_feat_list
),
695 .supported_displays
= am43xx_dss_supported_displays
,
696 .supported_outputs
= am43xx_dss_supported_outputs
,
697 .supported_color_modes
= omap3_dss_supported_color_modes
,
698 .overlay_caps
= omap3430_dss_overlay_caps
,
699 .clksrc_names
= omap2_dss_clk_source_names
,
700 .dss_params
= am43xx_dss_param_range
,
701 .supported_rotation_types
= OMAP_DSS_ROT_DMA
,
702 .buffer_size_unit
= 1,
703 .burst_size_unit
= 8,
706 static const struct omap_dss_features omap3630_dss_features
= {
707 .reg_fields
= omap3_dss_reg_fields
,
708 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
710 .features
= omap3630_dss_feat_list
,
711 .num_features
= ARRAY_SIZE(omap3630_dss_feat_list
),
715 .supported_displays
= omap3630_dss_supported_displays
,
716 .supported_outputs
= omap3630_dss_supported_outputs
,
717 .supported_color_modes
= omap3_dss_supported_color_modes
,
718 .overlay_caps
= omap3630_dss_overlay_caps
,
719 .clksrc_names
= omap3_dss_clk_source_names
,
720 .dss_params
= omap3_dss_param_range
,
721 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
722 .buffer_size_unit
= 1,
723 .burst_size_unit
= 8,
726 /* OMAP4 DSS Features */
727 /* For OMAP4430 ES 1.0 revision */
728 static const struct omap_dss_features omap4430_es1_0_dss_features
= {
729 .reg_fields
= omap4_dss_reg_fields
,
730 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
732 .features
= omap4430_es1_0_dss_feat_list
,
733 .num_features
= ARRAY_SIZE(omap4430_es1_0_dss_feat_list
),
737 .supported_displays
= omap4_dss_supported_displays
,
738 .supported_outputs
= omap4_dss_supported_outputs
,
739 .supported_color_modes
= omap4_dss_supported_color_modes
,
740 .overlay_caps
= omap4_dss_overlay_caps
,
741 .clksrc_names
= omap4_dss_clk_source_names
,
742 .dss_params
= omap4_dss_param_range
,
743 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
744 .buffer_size_unit
= 16,
745 .burst_size_unit
= 16,
748 /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
749 static const struct omap_dss_features omap4430_es2_0_1_2_dss_features
= {
750 .reg_fields
= omap4_dss_reg_fields
,
751 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
753 .features
= omap4430_es2_0_1_2_dss_feat_list
,
754 .num_features
= ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list
),
758 .supported_displays
= omap4_dss_supported_displays
,
759 .supported_outputs
= omap4_dss_supported_outputs
,
760 .supported_color_modes
= omap4_dss_supported_color_modes
,
761 .overlay_caps
= omap4_dss_overlay_caps
,
762 .clksrc_names
= omap4_dss_clk_source_names
,
763 .dss_params
= omap4_dss_param_range
,
764 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
765 .buffer_size_unit
= 16,
766 .burst_size_unit
= 16,
769 /* For all the other OMAP4 versions */
770 static const struct omap_dss_features omap4_dss_features
= {
771 .reg_fields
= omap4_dss_reg_fields
,
772 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
774 .features
= omap4_dss_feat_list
,
775 .num_features
= ARRAY_SIZE(omap4_dss_feat_list
),
779 .supported_displays
= omap4_dss_supported_displays
,
780 .supported_outputs
= omap4_dss_supported_outputs
,
781 .supported_color_modes
= omap4_dss_supported_color_modes
,
782 .overlay_caps
= omap4_dss_overlay_caps
,
783 .clksrc_names
= omap4_dss_clk_source_names
,
784 .dss_params
= omap4_dss_param_range
,
785 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
786 .buffer_size_unit
= 16,
787 .burst_size_unit
= 16,
790 /* OMAP5 DSS Features */
791 static const struct omap_dss_features omap5_dss_features
= {
792 .reg_fields
= omap5_dss_reg_fields
,
793 .num_reg_fields
= ARRAY_SIZE(omap5_dss_reg_fields
),
795 .features
= omap5_dss_feat_list
,
796 .num_features
= ARRAY_SIZE(omap5_dss_feat_list
),
800 .supported_displays
= omap5_dss_supported_displays
,
801 .supported_outputs
= omap5_dss_supported_outputs
,
802 .supported_color_modes
= omap4_dss_supported_color_modes
,
803 .overlay_caps
= omap4_dss_overlay_caps
,
804 .clksrc_names
= omap5_dss_clk_source_names
,
805 .dss_params
= omap5_dss_param_range
,
806 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
807 .buffer_size_unit
= 16,
808 .burst_size_unit
= 16,
811 /* Functions returning values related to a DSS feature */
812 int dss_feat_get_num_mgrs(void)
814 return omap_current_dss_features
->num_mgrs
;
816 EXPORT_SYMBOL(dss_feat_get_num_mgrs
);
818 int dss_feat_get_num_ovls(void)
820 return omap_current_dss_features
->num_ovls
;
822 EXPORT_SYMBOL(dss_feat_get_num_ovls
);
824 unsigned long dss_feat_get_param_min(enum dss_range_param param
)
826 return omap_current_dss_features
->dss_params
[param
].min
;
829 unsigned long dss_feat_get_param_max(enum dss_range_param param
)
831 return omap_current_dss_features
->dss_params
[param
].max
;
834 enum omap_display_type
dss_feat_get_supported_displays(enum omap_channel channel
)
836 return omap_current_dss_features
->supported_displays
[channel
];
839 enum omap_dss_output_id
dss_feat_get_supported_outputs(enum omap_channel channel
)
841 return omap_current_dss_features
->supported_outputs
[channel
];
844 enum omap_color_mode
dss_feat_get_supported_color_modes(enum omap_plane plane
)
846 return omap_current_dss_features
->supported_color_modes
[plane
];
848 EXPORT_SYMBOL(dss_feat_get_supported_color_modes
);
850 enum omap_overlay_caps
dss_feat_get_overlay_caps(enum omap_plane plane
)
852 return omap_current_dss_features
->overlay_caps
[plane
];
855 bool dss_feat_color_mode_supported(enum omap_plane plane
,
856 enum omap_color_mode color_mode
)
858 return omap_current_dss_features
->supported_color_modes
[plane
] &
862 const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id
)
864 return omap_current_dss_features
->clksrc_names
[id
];
867 u32
dss_feat_get_buffer_size_unit(void)
869 return omap_current_dss_features
->buffer_size_unit
;
872 u32
dss_feat_get_burst_size_unit(void)
874 return omap_current_dss_features
->burst_size_unit
;
877 /* DSS has_feature check */
878 bool dss_has_feature(enum dss_feat_id id
)
881 const enum dss_feat_id
*features
= omap_current_dss_features
->features
;
882 const int num_features
= omap_current_dss_features
->num_features
;
884 for (i
= 0; i
< num_features
; i
++) {
885 if (features
[i
] == id
)
892 void dss_feat_get_reg_field(enum dss_feat_reg_field id
, u8
*start
, u8
*end
)
894 if (id
>= omap_current_dss_features
->num_reg_fields
)
897 *start
= omap_current_dss_features
->reg_fields
[id
].start
;
898 *end
= omap_current_dss_features
->reg_fields
[id
].end
;
901 bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type
)
903 return omap_current_dss_features
->supported_rotation_types
& rot_type
;
906 void dss_features_init(enum omapdss_version version
)
909 case OMAPDSS_VER_OMAP24xx
:
910 omap_current_dss_features
= &omap2_dss_features
;
913 case OMAPDSS_VER_OMAP34xx_ES1
:
914 case OMAPDSS_VER_OMAP34xx_ES3
:
915 omap_current_dss_features
= &omap3430_dss_features
;
918 case OMAPDSS_VER_OMAP3630
:
919 omap_current_dss_features
= &omap3630_dss_features
;
922 case OMAPDSS_VER_OMAP4430_ES1
:
923 omap_current_dss_features
= &omap4430_es1_0_dss_features
;
926 case OMAPDSS_VER_OMAP4430_ES2
:
927 omap_current_dss_features
= &omap4430_es2_0_1_2_dss_features
;
930 case OMAPDSS_VER_OMAP4
:
931 omap_current_dss_features
= &omap4_dss_features
;
934 case OMAPDSS_VER_OMAP5
:
935 case OMAPDSS_VER_DRA7xx
:
936 omap_current_dss_features
= &omap5_dss_features
;
939 case OMAPDSS_VER_AM35xx
:
940 omap_current_dss_features
= &am35xx_dss_features
;
943 case OMAPDSS_VER_AM43xx
:
944 omap_current_dss_features
= &am43xx_dss_features
;
948 DSSWARN("Unsupported OMAP version");