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>
28 #include "dss_features.h"
30 /* Defines a generic omap register field */
31 struct dss_reg_field
{
35 struct dss_param_range
{
39 struct omap_dss_features
{
40 const struct dss_reg_field
*reg_fields
;
41 const int num_reg_fields
;
43 const enum dss_feat_id
*features
;
44 const int num_features
;
48 const enum omap_display_type
*supported_displays
;
49 const enum omap_dss_output_id
*supported_outputs
;
50 const enum omap_color_mode
*supported_color_modes
;
51 const enum omap_overlay_caps
*overlay_caps
;
52 const struct dss_param_range
*dss_params
;
54 const enum omap_dss_rotation_type supported_rotation_types
;
56 const u32 buffer_size_unit
;
57 const u32 burst_size_unit
;
60 /* This struct is assigned to one of the below during initialization */
61 static const struct omap_dss_features
*omap_current_dss_features
;
63 static const struct dss_reg_field omap2_dss_reg_fields
[] = {
64 [FEAT_REG_FIRHINC
] = { 11, 0 },
65 [FEAT_REG_FIRVINC
] = { 27, 16 },
66 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 8, 0 },
67 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 24, 16 },
68 [FEAT_REG_FIFOSIZE
] = { 8, 0 },
69 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
70 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
71 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
74 static const struct dss_reg_field omap3_dss_reg_fields
[] = {
75 [FEAT_REG_FIRHINC
] = { 12, 0 },
76 [FEAT_REG_FIRVINC
] = { 28, 16 },
77 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 11, 0 },
78 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 27, 16 },
79 [FEAT_REG_FIFOSIZE
] = { 10, 0 },
80 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
81 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
82 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
85 static const struct dss_reg_field am43xx_dss_reg_fields
[] = {
86 [FEAT_REG_FIRHINC
] = { 12, 0 },
87 [FEAT_REG_FIRVINC
] = { 28, 16 },
88 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 11, 0 },
89 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 27, 16 },
90 [FEAT_REG_FIFOSIZE
] = { 10, 0 },
91 [FEAT_REG_HORIZONTALACCU
] = { 9, 0 },
92 [FEAT_REG_VERTICALACCU
] = { 25, 16 },
93 [FEAT_REG_DISPC_CLK_SWITCH
] = { 0, 0 },
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 },
107 static const struct dss_reg_field omap5_dss_reg_fields
[] = {
108 [FEAT_REG_FIRHINC
] = { 12, 0 },
109 [FEAT_REG_FIRVINC
] = { 28, 16 },
110 [FEAT_REG_FIFOLOWTHRESHOLD
] = { 15, 0 },
111 [FEAT_REG_FIFOHIGHTHRESHOLD
] = { 31, 16 },
112 [FEAT_REG_FIFOSIZE
] = { 15, 0 },
113 [FEAT_REG_HORIZONTALACCU
] = { 10, 0 },
114 [FEAT_REG_VERTICALACCU
] = { 26, 16 },
115 [FEAT_REG_DISPC_CLK_SWITCH
] = { 9, 7 },
118 static const enum omap_display_type omap2_dss_supported_displays
[] = {
119 /* OMAP_DSS_CHANNEL_LCD */
120 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
,
122 /* OMAP_DSS_CHANNEL_DIGIT */
123 OMAP_DISPLAY_TYPE_VENC
,
126 static const enum omap_display_type omap3430_dss_supported_displays
[] = {
127 /* OMAP_DSS_CHANNEL_LCD */
128 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
129 OMAP_DISPLAY_TYPE_SDI
| OMAP_DISPLAY_TYPE_DSI
,
131 /* OMAP_DSS_CHANNEL_DIGIT */
132 OMAP_DISPLAY_TYPE_VENC
,
135 static const enum omap_display_type omap3630_dss_supported_displays
[] = {
136 /* OMAP_DSS_CHANNEL_LCD */
137 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
138 OMAP_DISPLAY_TYPE_DSI
,
140 /* OMAP_DSS_CHANNEL_DIGIT */
141 OMAP_DISPLAY_TYPE_VENC
,
144 static const enum omap_display_type am43xx_dss_supported_displays
[] = {
145 /* OMAP_DSS_CHANNEL_LCD */
146 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
,
149 static const enum omap_display_type omap4_dss_supported_displays
[] = {
150 /* OMAP_DSS_CHANNEL_LCD */
151 OMAP_DISPLAY_TYPE_DBI
| OMAP_DISPLAY_TYPE_DSI
,
153 /* OMAP_DSS_CHANNEL_DIGIT */
154 OMAP_DISPLAY_TYPE_VENC
| OMAP_DISPLAY_TYPE_HDMI
,
156 /* OMAP_DSS_CHANNEL_LCD2 */
157 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
158 OMAP_DISPLAY_TYPE_DSI
,
161 static const enum omap_display_type omap5_dss_supported_displays
[] = {
162 /* OMAP_DSS_CHANNEL_LCD */
163 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
164 OMAP_DISPLAY_TYPE_DSI
,
166 /* OMAP_DSS_CHANNEL_DIGIT */
167 OMAP_DISPLAY_TYPE_HDMI
| OMAP_DISPLAY_TYPE_DPI
,
169 /* OMAP_DSS_CHANNEL_LCD2 */
170 OMAP_DISPLAY_TYPE_DPI
| OMAP_DISPLAY_TYPE_DBI
|
171 OMAP_DISPLAY_TYPE_DSI
,
174 static const enum omap_dss_output_id omap2_dss_supported_outputs
[] = {
175 /* OMAP_DSS_CHANNEL_LCD */
176 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
,
178 /* OMAP_DSS_CHANNEL_DIGIT */
179 OMAP_DSS_OUTPUT_VENC
,
182 static const enum omap_dss_output_id omap3430_dss_supported_outputs
[] = {
183 /* OMAP_DSS_CHANNEL_LCD */
184 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
185 OMAP_DSS_OUTPUT_SDI
| OMAP_DSS_OUTPUT_DSI1
,
187 /* OMAP_DSS_CHANNEL_DIGIT */
188 OMAP_DSS_OUTPUT_VENC
,
191 static const enum omap_dss_output_id omap3630_dss_supported_outputs
[] = {
192 /* OMAP_DSS_CHANNEL_LCD */
193 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
194 OMAP_DSS_OUTPUT_DSI1
,
196 /* OMAP_DSS_CHANNEL_DIGIT */
197 OMAP_DSS_OUTPUT_VENC
,
200 static const enum omap_dss_output_id am43xx_dss_supported_outputs
[] = {
201 /* OMAP_DSS_CHANNEL_LCD */
202 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
,
205 static const enum omap_dss_output_id omap4_dss_supported_outputs
[] = {
206 /* OMAP_DSS_CHANNEL_LCD */
207 OMAP_DSS_OUTPUT_DBI
| OMAP_DSS_OUTPUT_DSI1
,
209 /* OMAP_DSS_CHANNEL_DIGIT */
210 OMAP_DSS_OUTPUT_VENC
| OMAP_DSS_OUTPUT_HDMI
,
212 /* OMAP_DSS_CHANNEL_LCD2 */
213 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
214 OMAP_DSS_OUTPUT_DSI2
,
217 static const enum omap_dss_output_id omap5_dss_supported_outputs
[] = {
218 /* OMAP_DSS_CHANNEL_LCD */
219 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
220 OMAP_DSS_OUTPUT_DSI1
| OMAP_DSS_OUTPUT_DSI2
,
222 /* OMAP_DSS_CHANNEL_DIGIT */
223 OMAP_DSS_OUTPUT_HDMI
,
225 /* OMAP_DSS_CHANNEL_LCD2 */
226 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
227 OMAP_DSS_OUTPUT_DSI1
,
229 /* OMAP_DSS_CHANNEL_LCD3 */
230 OMAP_DSS_OUTPUT_DPI
| OMAP_DSS_OUTPUT_DBI
|
231 OMAP_DSS_OUTPUT_DSI2
,
234 static const enum omap_color_mode omap2_dss_supported_color_modes
[] = {
236 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
237 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
238 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_RGB16
|
239 OMAP_DSS_COLOR_RGB24U
| OMAP_DSS_COLOR_RGB24P
,
241 /* OMAP_DSS_VIDEO1 */
242 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
243 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
246 /* OMAP_DSS_VIDEO2 */
247 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
248 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
252 static const enum omap_color_mode omap3_dss_supported_color_modes
[] = {
254 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
255 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
256 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
257 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
258 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_ARGB32
|
259 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
,
261 /* OMAP_DSS_VIDEO1 */
262 OMAP_DSS_COLOR_RGB24U
| OMAP_DSS_COLOR_RGB24P
|
263 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_RGB16
|
264 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_UYVY
,
266 /* OMAP_DSS_VIDEO2 */
267 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
268 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
269 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_YUV2
|
270 OMAP_DSS_COLOR_UYVY
| OMAP_DSS_COLOR_ARGB32
|
271 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
,
274 static const enum omap_color_mode omap4_dss_supported_color_modes
[] = {
276 OMAP_DSS_COLOR_CLUT1
| OMAP_DSS_COLOR_CLUT2
|
277 OMAP_DSS_COLOR_CLUT4
| OMAP_DSS_COLOR_CLUT8
|
278 OMAP_DSS_COLOR_RGB12U
| OMAP_DSS_COLOR_ARGB16
|
279 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB24U
|
280 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_ARGB32
|
281 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_RGBX32
|
282 OMAP_DSS_COLOR_ARGB16_1555
| OMAP_DSS_COLOR_RGBX16
|
283 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_XRGB16_1555
,
285 /* OMAP_DSS_VIDEO1 */
286 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
287 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
288 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
289 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
290 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
291 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
292 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
293 OMAP_DSS_COLOR_RGBX32
,
295 /* OMAP_DSS_VIDEO2 */
296 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
297 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
298 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
299 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
300 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
301 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
302 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
303 OMAP_DSS_COLOR_RGBX32
,
305 /* OMAP_DSS_VIDEO3 */
306 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
307 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
308 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
309 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
310 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
311 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
312 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
313 OMAP_DSS_COLOR_RGBX32
,
316 OMAP_DSS_COLOR_RGB16
| OMAP_DSS_COLOR_RGB12U
|
317 OMAP_DSS_COLOR_YUV2
| OMAP_DSS_COLOR_ARGB16_1555
|
318 OMAP_DSS_COLOR_RGBA32
| OMAP_DSS_COLOR_NV12
|
319 OMAP_DSS_COLOR_RGBA16
| OMAP_DSS_COLOR_RGB24U
|
320 OMAP_DSS_COLOR_RGB24P
| OMAP_DSS_COLOR_UYVY
|
321 OMAP_DSS_COLOR_ARGB16
| OMAP_DSS_COLOR_XRGB16_1555
|
322 OMAP_DSS_COLOR_ARGB32
| OMAP_DSS_COLOR_RGBX16
|
323 OMAP_DSS_COLOR_RGBX32
,
326 static const enum omap_overlay_caps omap2_dss_overlay_caps
[] = {
328 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
330 /* OMAP_DSS_VIDEO1 */
331 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
332 OMAP_DSS_OVL_CAP_REPLICATION
,
334 /* OMAP_DSS_VIDEO2 */
335 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
336 OMAP_DSS_OVL_CAP_REPLICATION
,
339 static const enum omap_overlay_caps omap3430_dss_overlay_caps
[] = {
341 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_POS
|
342 OMAP_DSS_OVL_CAP_REPLICATION
,
344 /* OMAP_DSS_VIDEO1 */
345 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
346 OMAP_DSS_OVL_CAP_REPLICATION
,
348 /* OMAP_DSS_VIDEO2 */
349 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
350 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
353 static const enum omap_overlay_caps omap3630_dss_overlay_caps
[] = {
355 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
|
356 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
358 /* OMAP_DSS_VIDEO1 */
359 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_POS
|
360 OMAP_DSS_OVL_CAP_REPLICATION
,
362 /* OMAP_DSS_VIDEO2 */
363 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
364 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_POS
|
365 OMAP_DSS_OVL_CAP_REPLICATION
,
368 static const enum omap_overlay_caps omap4_dss_overlay_caps
[] = {
370 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
| OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
|
371 OMAP_DSS_OVL_CAP_ZORDER
| OMAP_DSS_OVL_CAP_POS
|
372 OMAP_DSS_OVL_CAP_REPLICATION
,
374 /* OMAP_DSS_VIDEO1 */
375 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
376 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
377 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
379 /* OMAP_DSS_VIDEO2 */
380 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
381 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
382 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
384 /* OMAP_DSS_VIDEO3 */
385 OMAP_DSS_OVL_CAP_SCALE
| OMAP_DSS_OVL_CAP_GLOBAL_ALPHA
|
386 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA
| OMAP_DSS_OVL_CAP_ZORDER
|
387 OMAP_DSS_OVL_CAP_POS
| OMAP_DSS_OVL_CAP_REPLICATION
,
390 static const struct dss_param_range omap2_dss_param_range
[] = {
391 [FEAT_PARAM_DSS_FCK
] = { 0, 133000000 },
392 [FEAT_PARAM_DSS_PCD
] = { 2, 255 },
393 [FEAT_PARAM_DOWNSCALE
] = { 1, 2 },
395 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
396 * scaler cannot scale a image with width more than 768.
398 [FEAT_PARAM_LINEWIDTH
] = { 1, 768 },
401 static const struct dss_param_range omap3_dss_param_range
[] = {
402 [FEAT_PARAM_DSS_FCK
] = { 0, 173000000 },
403 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
404 [FEAT_PARAM_DSIPLL_LPDIV
] = { 1, (1 << 13) - 1},
405 [FEAT_PARAM_DSI_FCK
] = { 0, 173000000 },
406 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
407 [FEAT_PARAM_LINEWIDTH
] = { 1, 1024 },
410 static const struct dss_param_range am43xx_dss_param_range
[] = {
411 [FEAT_PARAM_DSS_FCK
] = { 0, 200000000 },
412 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
413 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
414 [FEAT_PARAM_LINEWIDTH
] = { 1, 1024 },
417 static const struct dss_param_range omap4_dss_param_range
[] = {
418 [FEAT_PARAM_DSS_FCK
] = { 0, 186000000 },
419 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
420 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, (1 << 13) - 1 },
421 [FEAT_PARAM_DSI_FCK
] = { 0, 170000000 },
422 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
423 [FEAT_PARAM_LINEWIDTH
] = { 1, 2048 },
426 static const struct dss_param_range omap5_dss_param_range
[] = {
427 [FEAT_PARAM_DSS_FCK
] = { 0, 209250000 },
428 [FEAT_PARAM_DSS_PCD
] = { 1, 255 },
429 [FEAT_PARAM_DSIPLL_LPDIV
] = { 0, (1 << 13) - 1 },
430 [FEAT_PARAM_DSI_FCK
] = { 0, 209250000 },
431 [FEAT_PARAM_DOWNSCALE
] = { 1, 4 },
432 [FEAT_PARAM_LINEWIDTH
] = { 1, 2048 },
435 static const enum dss_feat_id omap2_dss_feat_list
[] = {
437 FEAT_LCDENABLESIGNAL
,
440 FEAT_ROWREPEATENABLE
,
444 static const enum dss_feat_id omap3430_dss_feat_list
[] = {
446 FEAT_LCDENABLESIGNAL
,
449 FEAT_LINEBUFFERSPLIT
,
450 FEAT_ROWREPEATENABLE
,
452 FEAT_DSI_REVERSE_TXCLKESC
,
453 FEAT_VENC_REQUIRES_TV_DAC_CLK
,
457 FEAT_ALPHA_FIXED_ZORDER
,
459 FEAT_OMAP3_DSI_FIFO_BUG
,
460 FEAT_DPI_USES_VDDS_DSI
,
463 static const enum dss_feat_id am35xx_dss_feat_list
[] = {
465 FEAT_LCDENABLESIGNAL
,
468 FEAT_LINEBUFFERSPLIT
,
469 FEAT_ROWREPEATENABLE
,
471 FEAT_DSI_REVERSE_TXCLKESC
,
472 FEAT_VENC_REQUIRES_TV_DAC_CLK
,
476 FEAT_ALPHA_FIXED_ZORDER
,
478 FEAT_OMAP3_DSI_FIFO_BUG
,
481 static const enum dss_feat_id am43xx_dss_feat_list
[] = {
483 FEAT_LCDENABLESIGNAL
,
486 FEAT_LINEBUFFERSPLIT
,
487 FEAT_ROWREPEATENABLE
,
492 FEAT_ALPHA_FIXED_ZORDER
,
496 static const enum dss_feat_id omap3630_dss_feat_list
[] = {
498 FEAT_LCDENABLESIGNAL
,
501 FEAT_LINEBUFFERSPLIT
,
502 FEAT_ROWREPEATENABLE
,
504 FEAT_DSI_PLL_PWR_BUG
,
508 FEAT_ALPHA_FIXED_ZORDER
,
510 FEAT_OMAP3_DSI_FIFO_BUG
,
511 FEAT_DPI_USES_VDDS_DSI
,
514 static const enum dss_feat_id omap4430_es1_0_dss_feat_list
[] = {
518 FEAT_DSI_DCS_CMD_CONFIG_VC
,
519 FEAT_DSI_VC_OCP_WIDTH
,
521 FEAT_HANDLE_UV_SEPARATE
,
526 FEAT_ALPHA_FREE_ZORDER
,
531 static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list
[] = {
535 FEAT_DSI_DCS_CMD_CONFIG_VC
,
536 FEAT_DSI_VC_OCP_WIDTH
,
538 FEAT_HDMI_CTS_SWMODE
,
539 FEAT_HANDLE_UV_SEPARATE
,
544 FEAT_ALPHA_FREE_ZORDER
,
549 static const enum dss_feat_id omap4_dss_feat_list
[] = {
553 FEAT_DSI_DCS_CMD_CONFIG_VC
,
554 FEAT_DSI_VC_OCP_WIDTH
,
556 FEAT_HDMI_CTS_SWMODE
,
557 FEAT_HDMI_AUDIO_USE_MCLK
,
558 FEAT_HANDLE_UV_SEPARATE
,
563 FEAT_ALPHA_FREE_ZORDER
,
568 static const enum dss_feat_id omap5_dss_feat_list
[] = {
573 FEAT_DSI_DCS_CMD_CONFIG_VC
,
574 FEAT_DSI_VC_OCP_WIDTH
,
576 FEAT_HDMI_CTS_SWMODE
,
577 FEAT_HDMI_AUDIO_USE_MCLK
,
578 FEAT_HANDLE_UV_SEPARATE
,
583 FEAT_ALPHA_FREE_ZORDER
,
590 /* OMAP2 DSS Features */
591 static const struct omap_dss_features omap2_dss_features
= {
592 .reg_fields
= omap2_dss_reg_fields
,
593 .num_reg_fields
= ARRAY_SIZE(omap2_dss_reg_fields
),
595 .features
= omap2_dss_feat_list
,
596 .num_features
= ARRAY_SIZE(omap2_dss_feat_list
),
600 .supported_displays
= omap2_dss_supported_displays
,
601 .supported_outputs
= omap2_dss_supported_outputs
,
602 .supported_color_modes
= omap2_dss_supported_color_modes
,
603 .overlay_caps
= omap2_dss_overlay_caps
,
604 .dss_params
= omap2_dss_param_range
,
605 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
606 .buffer_size_unit
= 1,
607 .burst_size_unit
= 8,
610 /* OMAP3 DSS Features */
611 static const struct omap_dss_features omap3430_dss_features
= {
612 .reg_fields
= omap3_dss_reg_fields
,
613 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
615 .features
= omap3430_dss_feat_list
,
616 .num_features
= ARRAY_SIZE(omap3430_dss_feat_list
),
620 .supported_displays
= omap3430_dss_supported_displays
,
621 .supported_outputs
= omap3430_dss_supported_outputs
,
622 .supported_color_modes
= omap3_dss_supported_color_modes
,
623 .overlay_caps
= omap3430_dss_overlay_caps
,
624 .dss_params
= omap3_dss_param_range
,
625 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
626 .buffer_size_unit
= 1,
627 .burst_size_unit
= 8,
631 * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
632 * vdds_dsi regulator.
634 static const struct omap_dss_features am35xx_dss_features
= {
635 .reg_fields
= omap3_dss_reg_fields
,
636 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
638 .features
= am35xx_dss_feat_list
,
639 .num_features
= ARRAY_SIZE(am35xx_dss_feat_list
),
643 .supported_displays
= omap3430_dss_supported_displays
,
644 .supported_outputs
= omap3430_dss_supported_outputs
,
645 .supported_color_modes
= omap3_dss_supported_color_modes
,
646 .overlay_caps
= omap3430_dss_overlay_caps
,
647 .dss_params
= omap3_dss_param_range
,
648 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
649 .buffer_size_unit
= 1,
650 .burst_size_unit
= 8,
653 static const struct omap_dss_features am43xx_dss_features
= {
654 .reg_fields
= am43xx_dss_reg_fields
,
655 .num_reg_fields
= ARRAY_SIZE(am43xx_dss_reg_fields
),
657 .features
= am43xx_dss_feat_list
,
658 .num_features
= ARRAY_SIZE(am43xx_dss_feat_list
),
662 .supported_displays
= am43xx_dss_supported_displays
,
663 .supported_outputs
= am43xx_dss_supported_outputs
,
664 .supported_color_modes
= omap3_dss_supported_color_modes
,
665 .overlay_caps
= omap3430_dss_overlay_caps
,
666 .dss_params
= am43xx_dss_param_range
,
667 .supported_rotation_types
= OMAP_DSS_ROT_DMA
,
668 .buffer_size_unit
= 1,
669 .burst_size_unit
= 8,
672 static const struct omap_dss_features omap3630_dss_features
= {
673 .reg_fields
= omap3_dss_reg_fields
,
674 .num_reg_fields
= ARRAY_SIZE(omap3_dss_reg_fields
),
676 .features
= omap3630_dss_feat_list
,
677 .num_features
= ARRAY_SIZE(omap3630_dss_feat_list
),
681 .supported_displays
= omap3630_dss_supported_displays
,
682 .supported_outputs
= omap3630_dss_supported_outputs
,
683 .supported_color_modes
= omap3_dss_supported_color_modes
,
684 .overlay_caps
= omap3630_dss_overlay_caps
,
685 .dss_params
= omap3_dss_param_range
,
686 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_VRFB
,
687 .buffer_size_unit
= 1,
688 .burst_size_unit
= 8,
691 /* OMAP4 DSS Features */
692 /* For OMAP4430 ES 1.0 revision */
693 static const struct omap_dss_features omap4430_es1_0_dss_features
= {
694 .reg_fields
= omap4_dss_reg_fields
,
695 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
697 .features
= omap4430_es1_0_dss_feat_list
,
698 .num_features
= ARRAY_SIZE(omap4430_es1_0_dss_feat_list
),
702 .supported_displays
= omap4_dss_supported_displays
,
703 .supported_outputs
= omap4_dss_supported_outputs
,
704 .supported_color_modes
= omap4_dss_supported_color_modes
,
705 .overlay_caps
= omap4_dss_overlay_caps
,
706 .dss_params
= omap4_dss_param_range
,
707 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
708 .buffer_size_unit
= 16,
709 .burst_size_unit
= 16,
712 /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
713 static const struct omap_dss_features omap4430_es2_0_1_2_dss_features
= {
714 .reg_fields
= omap4_dss_reg_fields
,
715 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
717 .features
= omap4430_es2_0_1_2_dss_feat_list
,
718 .num_features
= ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list
),
722 .supported_displays
= omap4_dss_supported_displays
,
723 .supported_outputs
= omap4_dss_supported_outputs
,
724 .supported_color_modes
= omap4_dss_supported_color_modes
,
725 .overlay_caps
= omap4_dss_overlay_caps
,
726 .dss_params
= omap4_dss_param_range
,
727 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
728 .buffer_size_unit
= 16,
729 .burst_size_unit
= 16,
732 /* For all the other OMAP4 versions */
733 static const struct omap_dss_features omap4_dss_features
= {
734 .reg_fields
= omap4_dss_reg_fields
,
735 .num_reg_fields
= ARRAY_SIZE(omap4_dss_reg_fields
),
737 .features
= omap4_dss_feat_list
,
738 .num_features
= ARRAY_SIZE(omap4_dss_feat_list
),
742 .supported_displays
= omap4_dss_supported_displays
,
743 .supported_outputs
= omap4_dss_supported_outputs
,
744 .supported_color_modes
= omap4_dss_supported_color_modes
,
745 .overlay_caps
= omap4_dss_overlay_caps
,
746 .dss_params
= omap4_dss_param_range
,
747 .supported_rotation_types
= OMAP_DSS_ROT_DMA
| OMAP_DSS_ROT_TILER
,
748 .buffer_size_unit
= 16,
749 .burst_size_unit
= 16,
752 /* OMAP5 DSS Features */
753 static const struct omap_dss_features omap5_dss_features
= {
754 .reg_fields
= omap5_dss_reg_fields
,
755 .num_reg_fields
= ARRAY_SIZE(omap5_dss_reg_fields
),
757 .features
= omap5_dss_feat_list
,
758 .num_features
= ARRAY_SIZE(omap5_dss_feat_list
),
762 .supported_displays
= omap5_dss_supported_displays
,
763 .supported_outputs
= omap5_dss_supported_outputs
,
764 .supported_color_modes
= omap4_dss_supported_color_modes
,
765 .overlay_caps
= omap4_dss_overlay_caps
,
766 .dss_params
= omap5_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 /* Functions returning values related to a DSS feature */
773 int dss_feat_get_num_mgrs(void)
775 return omap_current_dss_features
->num_mgrs
;
777 EXPORT_SYMBOL(dss_feat_get_num_mgrs
);
779 int dss_feat_get_num_ovls(void)
781 return omap_current_dss_features
->num_ovls
;
783 EXPORT_SYMBOL(dss_feat_get_num_ovls
);
785 unsigned long dss_feat_get_param_min(enum dss_range_param param
)
787 return omap_current_dss_features
->dss_params
[param
].min
;
790 unsigned long dss_feat_get_param_max(enum dss_range_param param
)
792 return omap_current_dss_features
->dss_params
[param
].max
;
795 enum omap_display_type
dss_feat_get_supported_displays(enum omap_channel channel
)
797 return omap_current_dss_features
->supported_displays
[channel
];
800 enum omap_dss_output_id
dss_feat_get_supported_outputs(enum omap_channel channel
)
802 return omap_current_dss_features
->supported_outputs
[channel
];
805 enum omap_color_mode
dss_feat_get_supported_color_modes(enum omap_plane plane
)
807 return omap_current_dss_features
->supported_color_modes
[plane
];
809 EXPORT_SYMBOL(dss_feat_get_supported_color_modes
);
811 enum omap_overlay_caps
dss_feat_get_overlay_caps(enum omap_plane plane
)
813 return omap_current_dss_features
->overlay_caps
[plane
];
816 bool dss_feat_color_mode_supported(enum omap_plane plane
,
817 enum omap_color_mode color_mode
)
819 return omap_current_dss_features
->supported_color_modes
[plane
] &
823 u32
dss_feat_get_buffer_size_unit(void)
825 return omap_current_dss_features
->buffer_size_unit
;
828 u32
dss_feat_get_burst_size_unit(void)
830 return omap_current_dss_features
->burst_size_unit
;
833 /* DSS has_feature check */
834 bool dss_has_feature(enum dss_feat_id id
)
837 const enum dss_feat_id
*features
= omap_current_dss_features
->features
;
838 const int num_features
= omap_current_dss_features
->num_features
;
840 for (i
= 0; i
< num_features
; i
++) {
841 if (features
[i
] == id
)
848 void dss_feat_get_reg_field(enum dss_feat_reg_field id
, u8
*start
, u8
*end
)
850 if (id
>= omap_current_dss_features
->num_reg_fields
)
853 *start
= omap_current_dss_features
->reg_fields
[id
].start
;
854 *end
= omap_current_dss_features
->reg_fields
[id
].end
;
857 bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type
)
859 return omap_current_dss_features
->supported_rotation_types
& rot_type
;
862 void dss_features_init(enum omapdss_version version
)
865 case OMAPDSS_VER_OMAP24xx
:
866 omap_current_dss_features
= &omap2_dss_features
;
869 case OMAPDSS_VER_OMAP34xx_ES1
:
870 case OMAPDSS_VER_OMAP34xx_ES3
:
871 omap_current_dss_features
= &omap3430_dss_features
;
874 case OMAPDSS_VER_OMAP3630
:
875 omap_current_dss_features
= &omap3630_dss_features
;
878 case OMAPDSS_VER_OMAP4430_ES1
:
879 omap_current_dss_features
= &omap4430_es1_0_dss_features
;
882 case OMAPDSS_VER_OMAP4430_ES2
:
883 omap_current_dss_features
= &omap4430_es2_0_1_2_dss_features
;
886 case OMAPDSS_VER_OMAP4
:
887 omap_current_dss_features
= &omap4_dss_features
;
890 case OMAPDSS_VER_OMAP5
:
891 case OMAPDSS_VER_DRA7xx
:
892 omap_current_dss_features
= &omap5_dss_features
;
895 case OMAPDSS_VER_AM35xx
:
896 omap_current_dss_features
= &am35xx_dss_features
;
899 case OMAPDSS_VER_AM43xx
:
900 omap_current_dss_features
= &am43xx_dss_features
;
904 DSSWARN("Unsupported OMAP version");