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
;
50 const enum omap_display_type
*supported_displays
;
51 const enum omap_dss_output_id
*supported_outputs
;
52 const enum omap_color_mode
*supported_color_modes
;
53 const enum omap_overlay_caps
*overlay_caps
;
54 const char * const *clksrc_names
;
55 const struct dss_param_range
*dss_params
;
57 const enum omap_dss_rotation_type supported_rotation_types
;
59 const u32 buffer_size_unit
;
60 const u32 burst_size_unit
;
63 /* This struct is assigned to one of the below during initialization */
64 static const struct omap_dss_features
*omap_current_dss_features
;
66 static const struct dss_reg_field omap2_dss_reg_fields
[] = {
67 [FEAT_REG_FIRHINC
] = { 11, 0 },
68 [FEAT_REG_FIRVINC
] = { 27, 16 },
69 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 8, 0 },
70 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 24, 16 },
71 [FEAT_REG_FIFOSIZE
] = { 8, 0 },
72 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
73 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
74 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
75 [FEAT_REG_DSIPLL_REGN
] = { 0, 0 },
76 [FEAT_REG_DSIPLL_REGM
] = { 0, 0 },
77 [FEAT_REG_DSIPLL_REGM_DISPC
] = { 0, 0 },
78 [FEAT_REG_DSIPLL_REGM_DSI
] = { 0, 0 },
81 static const struct dss_reg_field omap3_dss_reg_fields
[] = {
82 [FEAT_REG_FIRHINC
] = { 12, 0 },
83 [FEAT_REG_FIRVINC
] = { 28, 16 },
84 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 11, 0 },
85 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 27, 16 },
86 [FEAT_REG_FIFOSIZE
] = { 10, 0 },
87 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
88 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
89 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
90 [FEAT_REG_DSIPLL_REGN
] = { 7, 1 },
91 [FEAT_REG_DSIPLL_REGM
] = { 18, 8 },
92 [FEAT_REG_DSIPLL_REGM_DISPC
] = { 22, 19 },
93 [FEAT_REG_DSIPLL_REGM_DSI
] = { 26, 23 },
96 static const struct dss_reg_field omap4_dss_reg_fields
[] = {
97 [FEAT_REG_FIRHINC
] = { 12, 0 },
98 [FEAT_REG_FIRVINC
] = { 28, 16 },
99 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 15, 0 },
100 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 31, 16 },
101 [FEAT_REG_FIFOSIZE
] = { 15, 0 },
102 [FEAT_REG_HORIZONTALACCU
] = { 10, 0 },
103 [FEAT_REG_VERTICALACCU
] = { 26, 16 },
104 [FEAT_REG_DISPC_CLK_SWITCH
] = { 9, 8 },
105 [FEAT_REG_DSIPLL_REGN
] = { 8, 1 },
106 [FEAT_REG_DSIPLL_REGM
] = { 20, 9 },
107 [FEAT_REG_DSIPLL_REGM_DISPC
] = { 25, 21 },
108 [FEAT_REG_DSIPLL_REGM_DSI
] = { 30, 26 },
111 static const struct dss_reg_field omap5_dss_reg_fields
[] = {
112 [FEAT_REG_FIRHINC
] = { 12, 0 },
113 [FEAT_REG_FIRVINC
] = { 28, 16 },
114 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 15, 0 },
115 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 31, 16 },
116 [FEAT_REG_FIFOSIZE
] = { 15, 0 },
117 [FEAT_REG_HORIZONTALACCU
] = { 10, 0 },
118 [FEAT_REG_VERTICALACCU
] = { 26, 16 },
119 [FEAT_REG_DISPC_CLK_SWITCH
] = { 9, 7 },
120 [FEAT_REG_DSIPLL_REGN
] = { 8, 1 },
121 [FEAT_REG_DSIPLL_REGM
] = { 20, 9 },
122 [FEAT_REG_DSIPLL_REGM_DISPC
] = { 25, 21 },
123 [FEAT_REG_DSIPLL_REGM_DSI
] = { 30, 26 },
126 static const enum omap_display_type omap2_dss_supported_displays
[] = {
127 /* OMAP_DSS_CHANNEL_LCD */
128 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
,
130 /* OMAP_DSS_CHANNEL_DIGIT */
131 OMAP_DISPLAY_TYPE_VENC
,
134 static const enum omap_display_type omap3430_dss_supported_displays
[] = {
135 /* OMAP_DSS_CHANNEL_LCD */
136 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
137 OMAP_DISPLAY_TYPE_SDI
| OMAP_DISPLAY_TYPE_DSI
,
139 /* OMAP_DSS_CHANNEL_DIGIT */
140 OMAP_DISPLAY_TYPE_VENC
,
143 static const enum omap_display_type omap3630_dss_supported_displays
[] = {
144 /* OMAP_DSS_CHANNEL_LCD */
145 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
146 OMAP_DISPLAY_TYPE_DSI
,
148 /* OMAP_DSS_CHANNEL_DIGIT */
149 OMAP_DISPLAY_TYPE_VENC
,
152 static const enum omap_display_type omap4_dss_supported_displays
[] = {
153 /* OMAP_DSS_CHANNEL_LCD */
154 OMAP_DISPLAY_TYPE_DBI
| OMAP_DISPLAY_TYPE_DSI
,
156 /* OMAP_DSS_CHANNEL_DIGIT */
157 OMAP_DISPLAY_TYPE_VENC
| OMAP_DISPLAY_TYPE_HDMI
,
159 /* OMAP_DSS_CHANNEL_LCD2 */
160 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
161 OMAP_DISPLAY_TYPE_DSI
,
164 static const enum omap_display_type omap5_dss_supported_displays
[] = {
165 /* OMAP_DSS_CHANNEL_LCD */
166 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
167 OMAP_DISPLAY_TYPE_DSI
,
169 /* OMAP_DSS_CHANNEL_DIGIT */
170 OMAP_DISPLAY_TYPE_HDMI
| OMAP_DISPLAY_TYPE_DPI
,
172 /* OMAP_DSS_CHANNEL_LCD2 */
173 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
174 OMAP_DISPLAY_TYPE_DSI
,
177 static const enum omap_dss_output_id omap2_dss_supported_outputs
[] = {
178 /* OMAP_DSS_CHANNEL_LCD */
179 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
,
181 /* OMAP_DSS_CHANNEL_DIGIT */
182 OMAP_DSS_OUTPUT_VENC
,
185 static const enum omap_dss_output_id omap3430_dss_supported_outputs
[] = {
186 /* OMAP_DSS_CHANNEL_LCD */
187 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
188 OMAP_DSS_OUTPUT_SDI
| OMAP_DSS_OUTPUT_DSI1
,
190 /* OMAP_DSS_CHANNEL_DIGIT */
191 OMAP_DSS_OUTPUT_VENC
,
194 static const enum omap_dss_output_id omap3630_dss_supported_outputs
[] = {
195 /* OMAP_DSS_CHANNEL_LCD */
196 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
197 OMAP_DSS_OUTPUT_DSI1
,
199 /* OMAP_DSS_CHANNEL_DIGIT */
200 OMAP_DSS_OUTPUT_VENC
,
203 static const enum omap_dss_output_id omap4_dss_supported_outputs
[] = {
204 /* OMAP_DSS_CHANNEL_LCD */
205 OMAP_DSS_OUTPUT_DBI
| OMAP_DSS_OUTPUT_DSI1
,
207 /* OMAP_DSS_CHANNEL_DIGIT */
208 OMAP_DSS_OUTPUT_VENC
| OMAP_DSS_OUTPUT_HDMI
,
210 /* OMAP_DSS_CHANNEL_LCD2 */
211 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
212 OMAP_DSS_OUTPUT_DSI2
,
215 static const enum omap_dss_output_id omap5_dss_supported_outputs
[] = {
216 /* OMAP_DSS_CHANNEL_LCD */
217 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
218 OMAP_DSS_OUTPUT_DSI1
| OMAP_DSS_OUTPUT_DSI2
,
220 /* OMAP_DSS_CHANNEL_DIGIT */
221 OMAP_DSS_OUTPUT_HDMI
| OMAP_DSS_OUTPUT_DPI
,
223 /* OMAP_DSS_CHANNEL_LCD2 */
224 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
225 OMAP_DSS_OUTPUT_DSI1
,
227 /* OMAP_DSS_CHANNEL_LCD3 */
228 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
229 OMAP_DSS_OUTPUT_DSI2
,
232 static const enum omap_color_mode omap2_dss_supported_color_modes
[] = {
234 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
235 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
236 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_RGB16
|
237 OMAP_DSS_COLOR_RGB24U
| OMAP_DSS_COLOR_RGB24P
,
239 /* OMAP_DSS_VIDEO1 */
240 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
241 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
244 /* OMAP_DSS_VIDEO2 */
245 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
246 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
250 static const enum omap_color_mode omap3_dss_supported_color_modes
[] = {
252 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
253 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
254 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
255 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
256 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_ARGB32
|
257 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
,
259 /* OMAP_DSS_VIDEO1 */
260 OMAP_DSS_COLOR_RGB24U
| OMAP_DSS_COLOR_RGB24P
|
261 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_RGB16
|
262 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_UYVY
,
264 /* OMAP_DSS_VIDEO2 */
265 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
266 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
267 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
268 OMAP_DSS_COLOR_UYVY
| OMAP_DSS_COLOR_ARGB32
|
269 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
,
272 static const enum omap_color_mode omap4_dss_supported_color_modes
[] = {
274 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
275 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
276 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
277 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
278 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_ARGB32
|
279 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
|
280 OMAP_DSS_COLOR_ARGB16_1555
| OMAP_DSS_COLOR_RGBX16
|
281 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_XRGB16_1555
,
283 /* OMAP_DSS_VIDEO1 */
284 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
285 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
286 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
287 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
288 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
289 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
290 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
291 OMAP_DSS_COLOR_RGBX32
,
293 /* OMAP_DSS_VIDEO2 */
294 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
295 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
296 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
297 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
298 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
299 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
300 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
301 OMAP_DSS_COLOR_RGBX32
,
303 /* OMAP_DSS_VIDEO3 */
304 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
305 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
306 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
307 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
308 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
309 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
310 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
311 OMAP_DSS_COLOR_RGBX32
,
314 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
315 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
316 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
317 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
318 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
319 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
320 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
321 OMAP_DSS_COLOR_RGBX32
,
324 static const enum omap_overlay_caps omap2_dss_overlay_caps
[] = {
326 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
328 /* OMAP_DSS_VIDEO1 */
329 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
330 OMAP_DSS_OVL_CAP_REPLICATION
,
332 /* OMAP_DSS_VIDEO2 */
333 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
334 OMAP_DSS_OVL_CAP_REPLICATION
,
337 static const enum omap_overlay_caps omap3430_dss_overlay_caps
[] = {
339 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_POS
|
340 OMAP_DSS_OVL_CAP_REPLICATION
,
342 /* OMAP_DSS_VIDEO1 */
343 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
344 OMAP_DSS_OVL_CAP_REPLICATION
,
346 /* OMAP_DSS_VIDEO2 */
347 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
348 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
351 static const enum omap_overlay_caps omap3630_dss_overlay_caps
[] = {
353 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
|
354 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
356 /* OMAP_DSS_VIDEO1 */
357 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
358 OMAP_DSS_OVL_CAP_REPLICATION
,
360 /* OMAP_DSS_VIDEO2 */
361 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
362 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_POS
|
363 OMAP_DSS_OVL_CAP_REPLICATION
,
366 static const enum omap_overlay_caps omap4_dss_overlay_caps
[] = {
368 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
|
369 OMAP_DSS_OVL_CAP_ZORDER
| OMAP_DSS_OVL_CAP_POS
|
370 OMAP_DSS_OVL_CAP_REPLICATION
,
372 /* OMAP_DSS_VIDEO1 */
373 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
374 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
375 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
377 /* OMAP_DSS_VIDEO2 */
378 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
379 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
380 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
382 /* OMAP_DSS_VIDEO3 */
383 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
384 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
385 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
388 static const char * const omap2_dss_clk_source_names
[] = {
389 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "N/A",
390 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "N/A",
391 [OMAP_DSS_CLK_SRC_FCK
] = "DSS_FCLK1",
394 static const char * const omap3_dss_clk_source_names
[] = {
395 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "DSI1_PLL_FCLK",
396 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "DSI2_PLL_FCLK",
397 [OMAP_DSS_CLK_SRC_FCK
] = "DSS1_ALWON_FCLK",
400 static const char * const omap4_dss_clk_source_names
[] = {
401 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "PLL1_CLK1",
402 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "PLL1_CLK2",
403 [OMAP_DSS_CLK_SRC_FCK
] = "DSS_FCLK",
404 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC
] = "PLL2_CLK1",
405 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI
] = "PLL2_CLK2",
408 static const char * const omap5_dss_clk_source_names
[] = {
409 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC
] = "DPLL_DSI1_A_CLK1",
410 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
] = "DPLL_DSI1_A_CLK2",
411 [OMAP_DSS_CLK_SRC_FCK
] = "DSS_CLK",
412 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC
] = "DPLL_DSI1_C_CLK1",
413 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI
] = "DPLL_DSI1_C_CLK2",
416 static const struct dss_param_range omap2_dss_param_range
[] = {
417 [FEAT_PARAM_DSS_FCK
] = { 0, 133000000 },
418 [FEAT_PARAM_DSS_PCD
] = { 2, 255 },
419 [FEAT_PARAM_DSIPLL_REGN
] = { 0, 0 },
420 [FEAT_PARAM_DSIPLL_REGM
] = { 0, 0 },
421 [FEAT_PARAM_DSIPLL_REGM_DISPC
] = { 0, 0 },
422 [FEAT_PARAM_DSIPLL_REGM_DSI
] = { 0, 0 },
423 [FEAT_PARAM_DSIPLL_FINT
] = { 0, 0 },
424 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, 0 },
425 [FEAT_PARAM_DOWNSCALE
] = { 1, 2 },
427 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
428 * scaler cannot scale a image with width more than 768.
430 [FEAT_PARAM_LINEWIDTH
] = { 1, 768 },
433 static const struct dss_param_range omap3_dss_param_range
[] = {
434 [FEAT_PARAM_DSS_FCK
] = { 0, 173000000 },
435 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
436 [FEAT_PARAM_DSIPLL_REGN
] = { 0, (1 << 7) - 1 },
437 [FEAT_PARAM_DSIPLL_REGM
] = { 0, (1 << 11) - 1 },
438 [FEAT_PARAM_DSIPLL_REGM_DISPC
] = { 0, (1 << 4) - 1 },
439 [FEAT_PARAM_DSIPLL_REGM_DSI
] = { 0, (1 << 4) - 1 },
440 [FEAT_PARAM_DSIPLL_FINT
] = { 750000, 2100000 },
441 [FEAT_PARAM_DSIPLL_LPDIV
] = { 1, (1 << 13) - 1},
442 [FEAT_PARAM_DSI_FCK
] = { 0, 173000000 },
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_REGN
] = { 0, (1 << 8) - 1 },
451 [FEAT_PARAM_DSIPLL_REGM
] = { 0, (1 << 12) - 1 },
452 [FEAT_PARAM_DSIPLL_REGM_DISPC
] = { 0, (1 << 5) - 1 },
453 [FEAT_PARAM_DSIPLL_REGM_DSI
] = { 0, (1 << 5) - 1 },
454 [FEAT_PARAM_DSIPLL_FINT
] = { 500000, 2500000 },
455 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, (1 << 13) - 1 },
456 [FEAT_PARAM_DSI_FCK
] = { 0, 170000000 },
457 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
458 [FEAT_PARAM_LINEWIDTH
] = { 1, 2048 },
461 static const struct dss_param_range omap5_dss_param_range
[] = {
462 [FEAT_PARAM_DSS_FCK
] = { 0, 209250000 },
463 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
464 [FEAT_PARAM_DSIPLL_REGN
] = { 0, (1 << 8) - 1 },
465 [FEAT_PARAM_DSIPLL_REGM
] = { 0, (1 << 12) - 1 },
466 [FEAT_PARAM_DSIPLL_REGM_DISPC
] = { 0, (1 << 5) - 1 },
467 [FEAT_PARAM_DSIPLL_REGM_DSI
] = { 0, (1 << 5) - 1 },
468 [FEAT_PARAM_DSIPLL_FINT
] = { 150000, 52000000 },
469 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, (1 << 13) - 1 },
470 [FEAT_PARAM_DSI_FCK
] = { 0, 209250000 },
471 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
472 [FEAT_PARAM_LINEWIDTH
] = { 1, 2048 },
475 static const enum dss_feat_id omap2_dss_feat_list
[] = {
477 FEAT_LCDENABLESIGNAL
,
480 FEAT_ROWREPEATENABLE
,
484 static const enum dss_feat_id omap3430_dss_feat_list
[] = {
486 FEAT_LCDENABLESIGNAL
,
489 FEAT_LINEBUFFERSPLIT
,
490 FEAT_ROWREPEATENABLE
,
492 FEAT_DSI_PLL_FREQSEL
,
493 FEAT_DSI_REVERSE_TXCLKESC
,
494 FEAT_VENC_REQUIRES_TV_DAC_CLK
,
498 FEAT_ALPHA_FIXED_ZORDER
,
500 FEAT_OMAP3_DSI_FIFO_BUG
,
501 FEAT_DPI_USES_VDDS_DSI
,
504 static const enum dss_feat_id am35xx_dss_feat_list
[] = {
506 FEAT_LCDENABLESIGNAL
,
509 FEAT_LINEBUFFERSPLIT
,
510 FEAT_ROWREPEATENABLE
,
512 FEAT_DSI_PLL_FREQSEL
,
513 FEAT_DSI_REVERSE_TXCLKESC
,
514 FEAT_VENC_REQUIRES_TV_DAC_CLK
,
518 FEAT_ALPHA_FIXED_ZORDER
,
520 FEAT_OMAP3_DSI_FIFO_BUG
,
523 static const enum dss_feat_id omap3630_dss_feat_list
[] = {
525 FEAT_LCDENABLESIGNAL
,
528 FEAT_LINEBUFFERSPLIT
,
529 FEAT_ROWREPEATENABLE
,
531 FEAT_DSI_PLL_PWR_BUG
,
532 FEAT_DSI_PLL_FREQSEL
,
536 FEAT_ALPHA_FIXED_ZORDER
,
538 FEAT_OMAP3_DSI_FIFO_BUG
,
539 FEAT_DPI_USES_VDDS_DSI
,
542 static const enum dss_feat_id omap4430_es1_0_dss_feat_list
[] = {
546 FEAT_DSI_DCS_CMD_CONFIG_VC
,
547 FEAT_DSI_VC_OCP_WIDTH
,
549 FEAT_HANDLE_UV_SEPARATE
,
554 FEAT_ALPHA_FREE_ZORDER
,
559 static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list
[] = {
563 FEAT_DSI_DCS_CMD_CONFIG_VC
,
564 FEAT_DSI_VC_OCP_WIDTH
,
566 FEAT_HDMI_CTS_SWMODE
,
567 FEAT_HANDLE_UV_SEPARATE
,
572 FEAT_ALPHA_FREE_ZORDER
,
577 static const enum dss_feat_id omap4_dss_feat_list
[] = {
581 FEAT_DSI_DCS_CMD_CONFIG_VC
,
582 FEAT_DSI_VC_OCP_WIDTH
,
584 FEAT_HDMI_CTS_SWMODE
,
585 FEAT_HDMI_AUDIO_USE_MCLK
,
586 FEAT_HANDLE_UV_SEPARATE
,
591 FEAT_ALPHA_FREE_ZORDER
,
596 static const enum dss_feat_id omap5_dss_feat_list
[] = {
600 FEAT_DSI_DCS_CMD_CONFIG_VC
,
601 FEAT_DSI_VC_OCP_WIDTH
,
603 FEAT_HDMI_CTS_SWMODE
,
604 FEAT_HDMI_AUDIO_USE_MCLK
,
605 FEAT_HANDLE_UV_SEPARATE
,
610 FEAT_ALPHA_FREE_ZORDER
,
613 FEAT_DSI_PLL_SELFREQDCO
,
619 /* OMAP2 DSS Features */
620 static const struct omap_dss_features omap2_dss_features
= {
621 .reg_fields
= omap2_dss_reg_fields
,
622 .num_reg_fields
= ARRAY_SIZE(omap2_dss_reg_fields
),
624 .features
= omap2_dss_feat_list
,
625 .num_features
= ARRAY_SIZE(omap2_dss_feat_list
),
629 .supported_displays
= omap2_dss_supported_displays
,
630 .supported_outputs
= omap2_dss_supported_outputs
,
631 .supported_color_modes
= omap2_dss_supported_color_modes
,
632 .overlay_caps
= omap2_dss_overlay_caps
,
633 .clksrc_names
= omap2_dss_clk_source_names
,
634 .dss_params
= omap2_dss_param_range
,
635 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
636 .buffer_size_unit
= 1,
637 .burst_size_unit
= 8,
640 /* OMAP3 DSS Features */
641 static const struct omap_dss_features omap3430_dss_features
= {
642 .reg_fields
= omap3_dss_reg_fields
,
643 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
645 .features
= omap3430_dss_feat_list
,
646 .num_features
= ARRAY_SIZE(omap3430_dss_feat_list
),
650 .supported_displays
= omap3430_dss_supported_displays
,
651 .supported_outputs
= omap3430_dss_supported_outputs
,
652 .supported_color_modes
= omap3_dss_supported_color_modes
,
653 .overlay_caps
= omap3430_dss_overlay_caps
,
654 .clksrc_names
= omap3_dss_clk_source_names
,
655 .dss_params
= omap3_dss_param_range
,
656 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
657 .buffer_size_unit
= 1,
658 .burst_size_unit
= 8,
662 * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
663 * vdds_dsi regulator.
665 static const struct omap_dss_features am35xx_dss_features
= {
666 .reg_fields
= omap3_dss_reg_fields
,
667 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
669 .features
= am35xx_dss_feat_list
,
670 .num_features
= ARRAY_SIZE(am35xx_dss_feat_list
),
674 .supported_displays
= omap3430_dss_supported_displays
,
675 .supported_outputs
= omap3430_dss_supported_outputs
,
676 .supported_color_modes
= omap3_dss_supported_color_modes
,
677 .overlay_caps
= omap3430_dss_overlay_caps
,
678 .clksrc_names
= omap3_dss_clk_source_names
,
679 .dss_params
= omap3_dss_param_range
,
680 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
681 .buffer_size_unit
= 1,
682 .burst_size_unit
= 8,
685 static const struct omap_dss_features omap3630_dss_features
= {
686 .reg_fields
= omap3_dss_reg_fields
,
687 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
689 .features
= omap3630_dss_feat_list
,
690 .num_features
= ARRAY_SIZE(omap3630_dss_feat_list
),
694 .supported_displays
= omap3630_dss_supported_displays
,
695 .supported_outputs
= omap3630_dss_supported_outputs
,
696 .supported_color_modes
= omap3_dss_supported_color_modes
,
697 .overlay_caps
= omap3630_dss_overlay_caps
,
698 .clksrc_names
= omap3_dss_clk_source_names
,
699 .dss_params
= omap3_dss_param_range
,
700 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
701 .buffer_size_unit
= 1,
702 .burst_size_unit
= 8,
705 /* OMAP4 DSS Features */
706 /* For OMAP4430 ES 1.0 revision */
707 static const struct omap_dss_features omap4430_es1_0_dss_features
= {
708 .reg_fields
= omap4_dss_reg_fields
,
709 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
711 .features
= omap4430_es1_0_dss_feat_list
,
712 .num_features
= ARRAY_SIZE(omap4430_es1_0_dss_feat_list
),
717 .supported_displays
= omap4_dss_supported_displays
,
718 .supported_outputs
= omap4_dss_supported_outputs
,
719 .supported_color_modes
= omap4_dss_supported_color_modes
,
720 .overlay_caps
= omap4_dss_overlay_caps
,
721 .clksrc_names
= omap4_dss_clk_source_names
,
722 .dss_params
= omap4_dss_param_range
,
723 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
724 .buffer_size_unit
= 16,
725 .burst_size_unit
= 16,
728 /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
729 static const struct omap_dss_features omap4430_es2_0_1_2_dss_features
= {
730 .reg_fields
= omap4_dss_reg_fields
,
731 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
733 .features
= omap4430_es2_0_1_2_dss_feat_list
,
734 .num_features
= ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list
),
739 .supported_displays
= omap4_dss_supported_displays
,
740 .supported_outputs
= omap4_dss_supported_outputs
,
741 .supported_color_modes
= omap4_dss_supported_color_modes
,
742 .overlay_caps
= omap4_dss_overlay_caps
,
743 .clksrc_names
= omap4_dss_clk_source_names
,
744 .dss_params
= omap4_dss_param_range
,
745 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
746 .buffer_size_unit
= 16,
747 .burst_size_unit
= 16,
750 /* For all the other OMAP4 versions */
751 static const struct omap_dss_features omap4_dss_features
= {
752 .reg_fields
= omap4_dss_reg_fields
,
753 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
755 .features
= omap4_dss_feat_list
,
756 .num_features
= ARRAY_SIZE(omap4_dss_feat_list
),
761 .supported_displays
= omap4_dss_supported_displays
,
762 .supported_outputs
= omap4_dss_supported_outputs
,
763 .supported_color_modes
= omap4_dss_supported_color_modes
,
764 .overlay_caps
= omap4_dss_overlay_caps
,
765 .clksrc_names
= omap4_dss_clk_source_names
,
766 .dss_params
= omap4_dss_param_range
,
767 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
768 .buffer_size_unit
= 16,
769 .burst_size_unit
= 16,
772 /* OMAP5 DSS Features */
773 static const struct omap_dss_features omap5_dss_features
= {
774 .reg_fields
= omap5_dss_reg_fields
,
775 .num_reg_fields
= ARRAY_SIZE(omap5_dss_reg_fields
),
777 .features
= omap5_dss_feat_list
,
778 .num_features
= ARRAY_SIZE(omap5_dss_feat_list
),
782 .supported_displays
= omap5_dss_supported_displays
,
783 .supported_outputs
= omap5_dss_supported_outputs
,
784 .supported_color_modes
= omap4_dss_supported_color_modes
,
785 .overlay_caps
= omap4_dss_overlay_caps
,
786 .clksrc_names
= omap5_dss_clk_source_names
,
787 .dss_params
= omap5_dss_param_range
,
788 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
789 .buffer_size_unit
= 16,
790 .burst_size_unit
= 16,
793 /* Functions returning values related to a DSS feature */
794 int dss_feat_get_num_mgrs(void)
796 return omap_current_dss_features
->num_mgrs
;
798 EXPORT_SYMBOL(dss_feat_get_num_mgrs
);
800 int dss_feat_get_num_ovls(void)
802 return omap_current_dss_features
->num_ovls
;
804 EXPORT_SYMBOL(dss_feat_get_num_ovls
);
806 int dss_feat_get_num_wbs(void)
808 return omap_current_dss_features
->num_wbs
;
811 unsigned long dss_feat_get_param_min(enum dss_range_param param
)
813 return omap_current_dss_features
->dss_params
[param
].min
;
816 unsigned long dss_feat_get_param_max(enum dss_range_param param
)
818 return omap_current_dss_features
->dss_params
[param
].max
;
821 enum omap_display_type
dss_feat_get_supported_displays(enum omap_channel channel
)
823 return omap_current_dss_features
->supported_displays
[channel
];
825 EXPORT_SYMBOL(dss_feat_get_supported_displays
);
827 enum omap_dss_output_id
dss_feat_get_supported_outputs(enum omap_channel channel
)
829 return omap_current_dss_features
->supported_outputs
[channel
];
831 EXPORT_SYMBOL(dss_feat_get_supported_outputs
);
833 enum omap_color_mode
dss_feat_get_supported_color_modes(enum omap_plane plane
)
835 return omap_current_dss_features
->supported_color_modes
[plane
];
837 EXPORT_SYMBOL(dss_feat_get_supported_color_modes
);
839 enum omap_overlay_caps
dss_feat_get_overlay_caps(enum omap_plane plane
)
841 return omap_current_dss_features
->overlay_caps
[plane
];
844 bool dss_feat_color_mode_supported(enum omap_plane plane
,
845 enum omap_color_mode color_mode
)
847 return omap_current_dss_features
->supported_color_modes
[plane
] &
851 const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id
)
853 return omap_current_dss_features
->clksrc_names
[id
];
856 u32
dss_feat_get_buffer_size_unit(void)
858 return omap_current_dss_features
->buffer_size_unit
;
861 u32
dss_feat_get_burst_size_unit(void)
863 return omap_current_dss_features
->burst_size_unit
;
866 /* DSS has_feature check */
867 bool dss_has_feature(enum dss_feat_id id
)
870 const enum dss_feat_id
*features
= omap_current_dss_features
->features
;
871 const int num_features
= omap_current_dss_features
->num_features
;
873 for (i
= 0; i
< num_features
; i
++) {
874 if (features
[i
] == id
)
881 void dss_feat_get_reg_field(enum dss_feat_reg_field id
, u8
*start
, u8
*end
)
883 if (id
>= omap_current_dss_features
->num_reg_fields
)
886 *start
= omap_current_dss_features
->reg_fields
[id
].start
;
887 *end
= omap_current_dss_features
->reg_fields
[id
].end
;
890 bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type
)
892 return omap_current_dss_features
->supported_rotation_types
& rot_type
;
895 void dss_features_init(enum omapdss_version version
)
898 case OMAPDSS_VER_OMAP24xx
:
899 omap_current_dss_features
= &omap2_dss_features
;
902 case OMAPDSS_VER_OMAP34xx_ES1
:
903 case OMAPDSS_VER_OMAP34xx_ES3
:
904 omap_current_dss_features
= &omap3430_dss_features
;
907 case OMAPDSS_VER_OMAP3630
:
908 omap_current_dss_features
= &omap3630_dss_features
;
911 case OMAPDSS_VER_OMAP4430_ES1
:
912 omap_current_dss_features
= &omap4430_es1_0_dss_features
;
915 case OMAPDSS_VER_OMAP4430_ES2
:
916 omap_current_dss_features
= &omap4430_es2_0_1_2_dss_features
;
919 case OMAPDSS_VER_OMAP4
:
920 omap_current_dss_features
= &omap4_dss_features
;
923 case OMAPDSS_VER_OMAP5
:
924 omap_current_dss_features
= &omap5_dss_features
;
927 case OMAPDSS_VER_AM35xx
:
928 omap_current_dss_features
= &am35xx_dss_features
;
932 DSSWARN("Unsupported OMAP version");