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/types.h>
22 #include <linux/err.h>
23 #include <linux/slab.h>
25 #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_color_mode *supported_color_modes;
51 const enum omap_overlay_caps *overlay_caps;
52 const char * const *clksrc_names;
53 const struct dss_param_range *dss_params;
55 const enum omap_dss_rotation_type supported_rotation_types;
57 const u32 buffer_size_unit;
58 const u32 burst_size_unit;
61 /* This struct is assigned to one of the below during initialization */
62 static const struct omap_dss_features *omap_current_dss_features;
64 static const struct dss_reg_field omap2_dss_reg_fields[] = {
65 [FEAT_REG_FIRHINC] = { 11, 0 },
66 [FEAT_REG_FIRVINC] = { 27, 16 },
67 [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
68 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
69 [FEAT_REG_FIFOSIZE] = { 8, 0 },
70 [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
71 [FEAT_REG_VERTICALACCU] = { 25, 16 },
72 [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
73 [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
74 [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
75 [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
76 [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 },
79 static const struct dss_reg_field omap3_dss_reg_fields[] = {
80 [FEAT_REG_FIRHINC] = { 12, 0 },
81 [FEAT_REG_FIRVINC] = { 28, 16 },
82 [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
83 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
84 [FEAT_REG_FIFOSIZE] = { 10, 0 },
85 [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
86 [FEAT_REG_VERTICALACCU] = { 25, 16 },
87 [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
88 [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
89 [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
90 [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
91 [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
94 static const struct dss_reg_field omap4_dss_reg_fields[] = {
95 [FEAT_REG_FIRHINC] = { 12, 0 },
96 [FEAT_REG_FIRVINC] = { 28, 16 },
97 [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
98 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
99 [FEAT_REG_FIFOSIZE] = { 15, 0 },
100 [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
101 [FEAT_REG_VERTICALACCU] = { 26, 16 },
102 [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
103 [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
104 [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
105 [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
106 [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
109 static const enum omap_display_type omap2_dss_supported_displays[] = {
110 /* OMAP_DSS_CHANNEL_LCD */
111 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
113 /* OMAP_DSS_CHANNEL_DIGIT */
114 OMAP_DISPLAY_TYPE_VENC,
117 static const enum omap_display_type omap3430_dss_supported_displays[] = {
118 /* OMAP_DSS_CHANNEL_LCD */
119 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
120 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
122 /* OMAP_DSS_CHANNEL_DIGIT */
123 OMAP_DISPLAY_TYPE_VENC,
126 static const enum omap_display_type omap3630_dss_supported_displays[] = {
127 /* OMAP_DSS_CHANNEL_LCD */
128 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
129 OMAP_DISPLAY_TYPE_DSI,
131 /* OMAP_DSS_CHANNEL_DIGIT */
132 OMAP_DISPLAY_TYPE_VENC,
135 static const enum omap_display_type omap4_dss_supported_displays[] = {
136 /* OMAP_DSS_CHANNEL_LCD */
137 OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
139 /* OMAP_DSS_CHANNEL_DIGIT */
140 OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
142 /* OMAP_DSS_CHANNEL_LCD2 */
143 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
144 OMAP_DISPLAY_TYPE_DSI,
147 static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
149 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
150 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
151 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
152 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
154 /* OMAP_DSS_VIDEO1 */
155 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
156 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
159 /* OMAP_DSS_VIDEO2 */
160 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
161 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
165 static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
167 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
168 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
169 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
170 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
171 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
172 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
174 /* OMAP_DSS_VIDEO1 */
175 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
176 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
177 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
179 /* OMAP_DSS_VIDEO2 */
180 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
181 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
182 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
183 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
184 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
187 static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
189 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
190 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
191 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
192 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
193 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
194 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
195 OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
196 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
198 /* OMAP_DSS_VIDEO1 */
199 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
200 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
201 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
202 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
203 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
204 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
205 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
206 OMAP_DSS_COLOR_RGBX32,
208 /* OMAP_DSS_VIDEO2 */
209 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
210 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
211 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
212 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
213 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
214 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
215 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
216 OMAP_DSS_COLOR_RGBX32,
218 /* OMAP_DSS_VIDEO3 */
219 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
220 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
221 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
222 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
223 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
224 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
225 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
226 OMAP_DSS_COLOR_RGBX32,
229 static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
233 /* OMAP_DSS_VIDEO1 */
234 OMAP_DSS_OVL_CAP_SCALE,
236 /* OMAP_DSS_VIDEO2 */
237 OMAP_DSS_OVL_CAP_SCALE,
240 static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
242 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
244 /* OMAP_DSS_VIDEO1 */
245 OMAP_DSS_OVL_CAP_SCALE,
247 /* OMAP_DSS_VIDEO2 */
248 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
251 static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
253 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
255 /* OMAP_DSS_VIDEO1 */
256 OMAP_DSS_OVL_CAP_SCALE,
258 /* OMAP_DSS_VIDEO2 */
259 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
260 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
263 static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
265 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
266 OMAP_DSS_OVL_CAP_ZORDER,
268 /* OMAP_DSS_VIDEO1 */
269 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
270 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
272 /* OMAP_DSS_VIDEO2 */
273 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
274 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
276 /* OMAP_DSS_VIDEO3 */
277 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
278 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
281 static const char * const omap2_dss_clk_source_names[] = {
282 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
283 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
284 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
287 static const char * const omap3_dss_clk_source_names[] = {
288 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
289 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
290 [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
293 static const char * const omap4_dss_clk_source_names[] = {
294 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
295 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
296 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
297 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
298 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
301 static const struct dss_param_range omap2_dss_param_range[] = {
302 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
303 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
304 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
305 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
306 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
307 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
308 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
309 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
310 [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
312 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
313 * scaler cannot scale a image with width more than 768.
315 [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
316 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
317 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
320 static const struct dss_param_range omap3_dss_param_range[] = {
321 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
322 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
323 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
324 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
325 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
326 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
327 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
328 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
329 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
330 [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
331 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
332 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
335 static const struct dss_param_range omap4_dss_param_range[] = {
336 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
337 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
338 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
339 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
340 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
341 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
342 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
343 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
344 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
345 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
346 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
347 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
350 static const enum dss_feat_id omap2_dss_feat_list[] = {
352 FEAT_LCDENABLESIGNAL,
355 FEAT_ROWREPEATENABLE,
359 static const enum dss_feat_id omap3430_dss_feat_list[] = {
361 FEAT_LCDENABLESIGNAL,
364 FEAT_LINEBUFFERSPLIT,
365 FEAT_ROWREPEATENABLE,
367 FEAT_DSI_PLL_FREQSEL,
368 FEAT_DSI_REVERSE_TXCLKESC,
369 FEAT_VENC_REQUIRES_TV_DAC_CLK,
373 FEAT_ALPHA_FIXED_ZORDER,
375 FEAT_OMAP3_DSI_FIFO_BUG,
378 static const enum dss_feat_id omap3630_dss_feat_list[] = {
380 FEAT_LCDENABLESIGNAL,
383 FEAT_LINEBUFFERSPLIT,
384 FEAT_ROWREPEATENABLE,
386 FEAT_DSI_PLL_PWR_BUG,
387 FEAT_DSI_PLL_FREQSEL,
391 FEAT_ALPHA_FIXED_ZORDER,
393 FEAT_OMAP3_DSI_FIFO_BUG,
396 static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
400 FEAT_DSI_DCS_CMD_CONFIG_VC,
401 FEAT_DSI_VC_OCP_WIDTH,
403 FEAT_HANDLE_UV_SEPARATE,
408 FEAT_ALPHA_FREE_ZORDER,
413 static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
417 FEAT_DSI_DCS_CMD_CONFIG_VC,
418 FEAT_DSI_VC_OCP_WIDTH,
420 FEAT_HDMI_CTS_SWMODE,
421 FEAT_HANDLE_UV_SEPARATE,
426 FEAT_ALPHA_FREE_ZORDER,
431 static const enum dss_feat_id omap4_dss_feat_list[] = {
435 FEAT_DSI_DCS_CMD_CONFIG_VC,
436 FEAT_DSI_VC_OCP_WIDTH,
438 FEAT_HDMI_CTS_SWMODE,
439 FEAT_HDMI_AUDIO_USE_MCLK,
440 FEAT_HANDLE_UV_SEPARATE,
445 FEAT_ALPHA_FREE_ZORDER,
450 /* OMAP2 DSS Features */
451 static const struct omap_dss_features omap2_dss_features = {
452 .reg_fields = omap2_dss_reg_fields,
453 .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
455 .features = omap2_dss_feat_list,
456 .num_features = ARRAY_SIZE(omap2_dss_feat_list),
460 .supported_displays = omap2_dss_supported_displays,
461 .supported_color_modes = omap2_dss_supported_color_modes,
462 .overlay_caps = omap2_dss_overlay_caps,
463 .clksrc_names = omap2_dss_clk_source_names,
464 .dss_params = omap2_dss_param_range,
465 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
466 .buffer_size_unit = 1,
467 .burst_size_unit = 8,
470 /* OMAP3 DSS Features */
471 static const struct omap_dss_features omap3430_dss_features = {
472 .reg_fields = omap3_dss_reg_fields,
473 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
475 .features = omap3430_dss_feat_list,
476 .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
480 .supported_displays = omap3430_dss_supported_displays,
481 .supported_color_modes = omap3_dss_supported_color_modes,
482 .overlay_caps = omap3430_dss_overlay_caps,
483 .clksrc_names = omap3_dss_clk_source_names,
484 .dss_params = omap3_dss_param_range,
485 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
486 .buffer_size_unit = 1,
487 .burst_size_unit = 8,
490 static const struct omap_dss_features omap3630_dss_features = {
491 .reg_fields = omap3_dss_reg_fields,
492 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
494 .features = omap3630_dss_feat_list,
495 .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
499 .supported_displays = omap3630_dss_supported_displays,
500 .supported_color_modes = omap3_dss_supported_color_modes,
501 .overlay_caps = omap3630_dss_overlay_caps,
502 .clksrc_names = omap3_dss_clk_source_names,
503 .dss_params = omap3_dss_param_range,
504 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
505 .buffer_size_unit = 1,
506 .burst_size_unit = 8,
509 /* OMAP4 DSS Features */
510 /* For OMAP4430 ES 1.0 revision */
511 static const struct omap_dss_features omap4430_es1_0_dss_features = {
512 .reg_fields = omap4_dss_reg_fields,
513 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
515 .features = omap4430_es1_0_dss_feat_list,
516 .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
520 .supported_displays = omap4_dss_supported_displays,
521 .supported_color_modes = omap4_dss_supported_color_modes,
522 .overlay_caps = omap4_dss_overlay_caps,
523 .clksrc_names = omap4_dss_clk_source_names,
524 .dss_params = omap4_dss_param_range,
525 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
526 .buffer_size_unit = 16,
527 .burst_size_unit = 16,
530 /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
531 static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
532 .reg_fields = omap4_dss_reg_fields,
533 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
535 .features = omap4430_es2_0_1_2_dss_feat_list,
536 .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
540 .supported_displays = omap4_dss_supported_displays,
541 .supported_color_modes = omap4_dss_supported_color_modes,
542 .overlay_caps = omap4_dss_overlay_caps,
543 .clksrc_names = omap4_dss_clk_source_names,
544 .dss_params = omap4_dss_param_range,
545 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
546 .buffer_size_unit = 16,
547 .burst_size_unit = 16,
550 /* For all the other OMAP4 versions */
551 static const struct omap_dss_features omap4_dss_features = {
552 .reg_fields = omap4_dss_reg_fields,
553 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
555 .features = omap4_dss_feat_list,
556 .num_features = ARRAY_SIZE(omap4_dss_feat_list),
560 .supported_displays = omap4_dss_supported_displays,
561 .supported_color_modes = omap4_dss_supported_color_modes,
562 .overlay_caps = omap4_dss_overlay_caps,
563 .clksrc_names = omap4_dss_clk_source_names,
564 .dss_params = omap4_dss_param_range,
565 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
566 .buffer_size_unit = 16,
567 .burst_size_unit = 16,
570 #if defined(CONFIG_OMAP4_DSS_HDMI)
571 /* HDMI OMAP4 Functions*/
572 static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
574 .video_configure = ti_hdmi_4xxx_basic_configure,
575 .phy_enable = ti_hdmi_4xxx_phy_enable,
576 .phy_disable = ti_hdmi_4xxx_phy_disable,
577 .read_edid = ti_hdmi_4xxx_read_edid,
578 .detect = ti_hdmi_4xxx_detect,
579 .pll_enable = ti_hdmi_4xxx_pll_enable,
580 .pll_disable = ti_hdmi_4xxx_pll_disable,
581 .video_enable = ti_hdmi_4xxx_wp_video_start,
582 .video_disable = ti_hdmi_4xxx_wp_video_stop,
583 .dump_wrapper = ti_hdmi_4xxx_wp_dump,
584 .dump_core = ti_hdmi_4xxx_core_dump,
585 .dump_pll = ti_hdmi_4xxx_pll_dump,
586 .dump_phy = ti_hdmi_4xxx_phy_dump,
587 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
588 .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
589 .audio_disable = ti_hdmi_4xxx_wp_audio_disable,
590 .audio_start = ti_hdmi_4xxx_audio_start,
591 .audio_stop = ti_hdmi_4xxx_audio_stop,
592 .audio_config = ti_hdmi_4xxx_audio_config,
597 void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
599 if (cpu_is_omap44xx())
600 ip_data->ops = &omap4_hdmi_functions;
604 /* Functions returning values related to a DSS feature */
605 int dss_feat_get_num_mgrs(void)
607 return omap_current_dss_features->num_mgrs;
610 int dss_feat_get_num_ovls(void)
612 return omap_current_dss_features->num_ovls;
615 unsigned long dss_feat_get_param_min(enum dss_range_param param)
617 return omap_current_dss_features->dss_params[param].min;
620 unsigned long dss_feat_get_param_max(enum dss_range_param param)
622 return omap_current_dss_features->dss_params[param].max;
625 enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
627 return omap_current_dss_features->supported_displays[channel];
630 enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
632 return omap_current_dss_features->supported_color_modes[plane];
635 enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
637 return omap_current_dss_features->overlay_caps[plane];
640 bool dss_feat_color_mode_supported(enum omap_plane plane,
641 enum omap_color_mode color_mode)
643 return omap_current_dss_features->supported_color_modes[plane] &
647 const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
649 return omap_current_dss_features->clksrc_names[id];
652 u32 dss_feat_get_buffer_size_unit(void)
654 return omap_current_dss_features->buffer_size_unit;
657 u32 dss_feat_get_burst_size_unit(void)
659 return omap_current_dss_features->burst_size_unit;
662 /* DSS has_feature check */
663 bool dss_has_feature(enum dss_feat_id id)
666 const enum dss_feat_id *features = omap_current_dss_features->features;
667 const int num_features = omap_current_dss_features->num_features;
669 for (i = 0; i < num_features; i++) {
670 if (features[i] == id)
677 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
679 if (id >= omap_current_dss_features->num_reg_fields)
682 *start = omap_current_dss_features->reg_fields[id].start;
683 *end = omap_current_dss_features->reg_fields[id].end;
686 bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
688 return omap_current_dss_features->supported_rotation_types & rot_type;
691 void dss_features_init(void)
693 if (cpu_is_omap24xx())
694 omap_current_dss_features = &omap2_dss_features;
695 else if (cpu_is_omap3630())
696 omap_current_dss_features = &omap3630_dss_features;
697 else if (cpu_is_omap34xx())
698 omap_current_dss_features = &omap3430_dss_features;
699 else if (omap_rev() == OMAP4430_REV_ES1_0)
700 omap_current_dss_features = &omap4430_es1_0_dss_features;
701 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
702 omap_rev() == OMAP4430_REV_ES2_1 ||
703 omap_rev() == OMAP4430_REV_ES2_2)
704 omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
705 else if (cpu_is_omap44xx())
706 omap_current_dss_features = &omap4_dss_features;
708 DSSWARN("Unsupported OMAP version");