Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dss_features.c
Go to the documentation of this file.
1 /*
2  * linux/drivers/video/omap2/dss/dss_features.c
3  *
4  * Copyright (C) 2010 Texas Instruments
5  * Author: Archit Taneja <[email protected]>
6  *
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.
10  *
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
14  * more details.
15  *
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/>.
18  */
19 
20 #include <linux/kernel.h>
21 #include <linux/types.h>
22 #include <linux/err.h>
23 #include <linux/slab.h>
24 
25 #include <video/omapdss.h>
26 #include <plat/cpu.h>
27 
28 #include "dss.h"
29 #include "dss_features.h"
30 
31 /* Defines a generic omap register field */
32 struct dss_reg_field {
34 };
35 
37  int min, max;
38 };
39 
41  const struct dss_reg_field *reg_fields;
42  const int num_reg_fields;
43 
44  const enum dss_feat_id *features;
45  const int num_features;
46 
47  const int num_mgrs;
48  const int num_ovls;
49  const int num_wbs;
54  const char * const *clksrc_names;
55  const struct dss_param_range *dss_params;
56 
58 
61 };
62 
63 /* This struct is assigned to one of the below during initialization */
64 static const struct omap_dss_features *omap_current_dss_features;
65 
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 },
79 };
80 
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 },
94 };
95 
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 },
109 };
110 
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 },
124 };
125 
126 static const enum omap_display_type omap2_dss_supported_displays[] = {
127  /* OMAP_DSS_CHANNEL_LCD */
129 
130  /* OMAP_DSS_CHANNEL_DIGIT */
132 };
133 
134 static const enum omap_display_type omap3430_dss_supported_displays[] = {
135  /* OMAP_DSS_CHANNEL_LCD */
138 
139  /* OMAP_DSS_CHANNEL_DIGIT */
141 };
142 
143 static const enum omap_display_type omap3630_dss_supported_displays[] = {
144  /* OMAP_DSS_CHANNEL_LCD */
147 
148  /* OMAP_DSS_CHANNEL_DIGIT */
150 };
151 
152 static const enum omap_display_type omap4_dss_supported_displays[] = {
153  /* OMAP_DSS_CHANNEL_LCD */
155 
156  /* OMAP_DSS_CHANNEL_DIGIT */
158 
159  /* OMAP_DSS_CHANNEL_LCD2 */
162 };
163 
164 static const enum omap_display_type omap5_dss_supported_displays[] = {
165  /* OMAP_DSS_CHANNEL_LCD */
168 
169  /* OMAP_DSS_CHANNEL_DIGIT */
171 
172  /* OMAP_DSS_CHANNEL_LCD2 */
175 };
176 
177 static const enum omap_dss_output_id omap2_dss_supported_outputs[] = {
178  /* OMAP_DSS_CHANNEL_LCD */
180 
181  /* OMAP_DSS_CHANNEL_DIGIT */
183 };
184 
185 static const enum omap_dss_output_id omap3430_dss_supported_outputs[] = {
186  /* OMAP_DSS_CHANNEL_LCD */
189 
190  /* OMAP_DSS_CHANNEL_DIGIT */
192 };
193 
194 static const enum omap_dss_output_id omap3630_dss_supported_outputs[] = {
195  /* OMAP_DSS_CHANNEL_LCD */
198 
199  /* OMAP_DSS_CHANNEL_DIGIT */
201 };
202 
203 static const enum omap_dss_output_id omap4_dss_supported_outputs[] = {
204  /* OMAP_DSS_CHANNEL_LCD */
207 
208  /* OMAP_DSS_CHANNEL_DIGIT */
211 
212  /* OMAP_DSS_CHANNEL_LCD2 */
215 };
216 
217 static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
218  /* OMAP_DSS_CHANNEL_LCD */
221 
222  /* OMAP_DSS_CHANNEL_DIGIT */
224 
225  /* OMAP_DSS_CHANNEL_LCD2 */
228 
229  /* OMAP_DSS_CHANNEL_LCD3 */
232 };
233 
234 static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
235  /* OMAP_DSS_GFX */
240 
241  /* OMAP_DSS_VIDEO1 */
245 
246  /* OMAP_DSS_VIDEO2 */
250 };
251 
252 static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
253  /* OMAP_DSS_GFX */
260 
261  /* OMAP_DSS_VIDEO1 */
265 
266  /* OMAP_DSS_VIDEO2 */
272 };
273 
274 static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
275  /* OMAP_DSS_GFX */
284 
285  /* OMAP_DSS_VIDEO1 */
294 
295  /* OMAP_DSS_VIDEO2 */
304 
305  /* OMAP_DSS_VIDEO3 */
314 
315  /* OMAP_DSS_WB */
324 };
325 
326 static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
327  /* OMAP_DSS_GFX */
329 
330  /* OMAP_DSS_VIDEO1 */
333 
334  /* OMAP_DSS_VIDEO2 */
337 };
338 
339 static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
340  /* OMAP_DSS_GFX */
343 
344  /* OMAP_DSS_VIDEO1 */
347 
348  /* OMAP_DSS_VIDEO2 */
351 };
352 
353 static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
354  /* OMAP_DSS_GFX */
357 
358  /* OMAP_DSS_VIDEO1 */
361 
362  /* OMAP_DSS_VIDEO2 */
366 };
367 
368 static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
369  /* OMAP_DSS_GFX */
373 
374  /* OMAP_DSS_VIDEO1 */
378 
379  /* OMAP_DSS_VIDEO2 */
383 
384  /* OMAP_DSS_VIDEO3 */
388 };
389 
390 static const char * const omap2_dss_clk_source_names[] = {
393  [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
394 };
395 
396 static const char * const omap3_dss_clk_source_names[] = {
397  [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
398  [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
399  [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
400 };
401 
402 static const char * const omap4_dss_clk_source_names[] = {
403  [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
404  [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
405  [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
407  [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
408 };
409 
410 static const char * const omap5_dss_clk_source_names[] = {
411  [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DPLL_DSI1_A_CLK1",
412  [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DPLL_DSI1_A_CLK2",
413  [OMAP_DSS_CLK_SRC_FCK] = "DSS_CLK",
414  [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "DPLL_DSI1_C_CLK1",
415  [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "DPLL_DSI1_C_CLK2",
416 };
417 
418 static const struct dss_param_range omap2_dss_param_range[] = {
419  [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
420  [FEAT_PARAM_DSS_PCD] = { 2, 255 },
421  [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
422  [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
423  [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
424  [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
425  [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
426  [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
427  [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
428  /*
429  * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
430  * scaler cannot scale a image with width more than 768.
431  */
432  [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
433  [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
434  [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
435 };
436 
437 static const struct dss_param_range omap3_dss_param_range[] = {
438  [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
439  [FEAT_PARAM_DSS_PCD] = { 1, 255 },
440  [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
441  [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
442  [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
443  [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
444  [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
445  [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
446  [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
447  [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
448  [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
449  [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
450  [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
451 };
452 
453 static const struct dss_param_range omap4_dss_param_range[] = {
454  [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
455  [FEAT_PARAM_DSS_PCD] = { 1, 255 },
456  [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
457  [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
458  [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
459  [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
460  [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
461  [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
462  [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
463  [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
464  [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
465  [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
466  [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
467 };
468 
469 static const struct dss_param_range omap5_dss_param_range[] = {
470  [FEAT_PARAM_DSS_FCK] = { 0, 200000000 },
471  [FEAT_PARAM_DSS_PCD] = { 1, 255 },
472  [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
473  [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
474  [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
475  [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
476  [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
477  [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
478  [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
479  [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
480  [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
481  [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
482  [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
483 };
484 
485 static const enum dss_feat_id omap2_dss_feat_list[] = {
492 };
493 
494 static const enum dss_feat_id omap3430_dss_feat_list[] = {
505  FEAT_CPR,
506  FEAT_PRELOAD,
512 };
513 
514 static const enum dss_feat_id am35xx_dss_feat_list[] = {
525  FEAT_CPR,
526  FEAT_PRELOAD,
531 };
532 
533 static const enum dss_feat_id omap3630_dss_feat_list[] = {
543  FEAT_CPR,
544  FEAT_PRELOAD,
549 };
550 
551 static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
557  FEAT_DSI_GNQ,
559  FEAT_ATTR2,
560  FEAT_CPR,
561  FEAT_PRELOAD,
566 };
567 
568 static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
574  FEAT_DSI_GNQ,
577  FEAT_ATTR2,
578  FEAT_CPR,
579  FEAT_PRELOAD,
584 };
585 
586 static const enum dss_feat_id omap4_dss_feat_list[] = {
592  FEAT_DSI_GNQ,
596  FEAT_ATTR2,
597  FEAT_CPR,
598  FEAT_PRELOAD,
603 };
604 
605 static const enum dss_feat_id omap5_dss_feat_list[] = {
611  FEAT_DSI_GNQ,
615  FEAT_ATTR2,
616  FEAT_CPR,
617  FEAT_PRELOAD,
625 };
626 
627 /* OMAP2 DSS Features */
628 static const struct omap_dss_features omap2_dss_features = {
629  .reg_fields = omap2_dss_reg_fields,
630  .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
631 
632  .features = omap2_dss_feat_list,
633  .num_features = ARRAY_SIZE(omap2_dss_feat_list),
634 
635  .num_mgrs = 2,
636  .num_ovls = 3,
637  .supported_displays = omap2_dss_supported_displays,
638  .supported_outputs = omap2_dss_supported_outputs,
639  .supported_color_modes = omap2_dss_supported_color_modes,
640  .overlay_caps = omap2_dss_overlay_caps,
641  .clksrc_names = omap2_dss_clk_source_names,
642  .dss_params = omap2_dss_param_range,
643  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
644  .buffer_size_unit = 1,
645  .burst_size_unit = 8,
646 };
647 
648 /* OMAP3 DSS Features */
649 static const struct omap_dss_features omap3430_dss_features = {
650  .reg_fields = omap3_dss_reg_fields,
651  .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
652 
653  .features = omap3430_dss_feat_list,
654  .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
655 
656  .num_mgrs = 2,
657  .num_ovls = 3,
658  .supported_displays = omap3430_dss_supported_displays,
659  .supported_outputs = omap3430_dss_supported_outputs,
660  .supported_color_modes = omap3_dss_supported_color_modes,
661  .overlay_caps = omap3430_dss_overlay_caps,
662  .clksrc_names = omap3_dss_clk_source_names,
663  .dss_params = omap3_dss_param_range,
664  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
665  .buffer_size_unit = 1,
666  .burst_size_unit = 8,
667 };
668 
669 /*
670  * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
671  * vdds_dsi regulator.
672  */
673 static const struct omap_dss_features am35xx_dss_features = {
674  .reg_fields = omap3_dss_reg_fields,
675  .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
676 
677  .features = am35xx_dss_feat_list,
678  .num_features = ARRAY_SIZE(am35xx_dss_feat_list),
679 
680  .num_mgrs = 2,
681  .num_ovls = 3,
682  .supported_displays = omap3430_dss_supported_displays,
683  .supported_outputs = omap3430_dss_supported_outputs,
684  .supported_color_modes = omap3_dss_supported_color_modes,
685  .overlay_caps = omap3430_dss_overlay_caps,
686  .clksrc_names = omap3_dss_clk_source_names,
687  .dss_params = omap3_dss_param_range,
688  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
689  .buffer_size_unit = 1,
690  .burst_size_unit = 8,
691 };
692 
693 static const struct omap_dss_features omap3630_dss_features = {
694  .reg_fields = omap3_dss_reg_fields,
695  .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
696 
697  .features = omap3630_dss_feat_list,
698  .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
699 
700  .num_mgrs = 2,
701  .num_ovls = 3,
702  .supported_displays = omap3630_dss_supported_displays,
703  .supported_outputs = omap3630_dss_supported_outputs,
704  .supported_color_modes = omap3_dss_supported_color_modes,
705  .overlay_caps = omap3630_dss_overlay_caps,
706  .clksrc_names = omap3_dss_clk_source_names,
707  .dss_params = omap3_dss_param_range,
708  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
709  .buffer_size_unit = 1,
710  .burst_size_unit = 8,
711 };
712 
713 /* OMAP4 DSS Features */
714 /* For OMAP4430 ES 1.0 revision */
715 static const struct omap_dss_features omap4430_es1_0_dss_features = {
716  .reg_fields = omap4_dss_reg_fields,
717  .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
718 
719  .features = omap4430_es1_0_dss_feat_list,
720  .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
721 
722  .num_mgrs = 3,
723  .num_ovls = 4,
724  .num_wbs = 1,
725  .supported_displays = omap4_dss_supported_displays,
726  .supported_outputs = omap4_dss_supported_outputs,
727  .supported_color_modes = omap4_dss_supported_color_modes,
728  .overlay_caps = omap4_dss_overlay_caps,
729  .clksrc_names = omap4_dss_clk_source_names,
730  .dss_params = omap4_dss_param_range,
731  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
732  .buffer_size_unit = 16,
733  .burst_size_unit = 16,
734 };
735 
736 /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
737 static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
738  .reg_fields = omap4_dss_reg_fields,
739  .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
740 
741  .features = omap4430_es2_0_1_2_dss_feat_list,
742  .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
743 
744  .num_mgrs = 3,
745  .num_ovls = 4,
746  .num_wbs = 1,
747  .supported_displays = omap4_dss_supported_displays,
748  .supported_outputs = omap4_dss_supported_outputs,
749  .supported_color_modes = omap4_dss_supported_color_modes,
750  .overlay_caps = omap4_dss_overlay_caps,
751  .clksrc_names = omap4_dss_clk_source_names,
752  .dss_params = omap4_dss_param_range,
753  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
754  .buffer_size_unit = 16,
755  .burst_size_unit = 16,
756 };
757 
758 /* For all the other OMAP4 versions */
759 static const struct omap_dss_features omap4_dss_features = {
760  .reg_fields = omap4_dss_reg_fields,
761  .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
762 
763  .features = omap4_dss_feat_list,
764  .num_features = ARRAY_SIZE(omap4_dss_feat_list),
765 
766  .num_mgrs = 3,
767  .num_ovls = 4,
768  .num_wbs = 1,
769  .supported_displays = omap4_dss_supported_displays,
770  .supported_outputs = omap4_dss_supported_outputs,
771  .supported_color_modes = omap4_dss_supported_color_modes,
772  .overlay_caps = omap4_dss_overlay_caps,
773  .clksrc_names = omap4_dss_clk_source_names,
774  .dss_params = omap4_dss_param_range,
775  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
776  .buffer_size_unit = 16,
777  .burst_size_unit = 16,
778 };
779 
780 /* OMAP5 DSS Features */
781 static const struct omap_dss_features omap5_dss_features = {
782  .reg_fields = omap5_dss_reg_fields,
783  .num_reg_fields = ARRAY_SIZE(omap5_dss_reg_fields),
784 
785  .features = omap5_dss_feat_list,
786  .num_features = ARRAY_SIZE(omap5_dss_feat_list),
787 
788  .num_mgrs = 3,
789  .num_ovls = 4,
790  .supported_displays = omap5_dss_supported_displays,
791  .supported_outputs = omap5_dss_supported_outputs,
792  .supported_color_modes = omap4_dss_supported_color_modes,
793  .overlay_caps = omap4_dss_overlay_caps,
794  .clksrc_names = omap5_dss_clk_source_names,
795  .dss_params = omap5_dss_param_range,
796  .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
797  .buffer_size_unit = 16,
798  .burst_size_unit = 16,
799 };
800 
801 #if defined(CONFIG_OMAP4_DSS_HDMI)
802 /* HDMI OMAP4 Functions*/
803 static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
804 
806  .phy_enable = ti_hdmi_4xxx_phy_enable,
807  .phy_disable = ti_hdmi_4xxx_phy_disable,
808  .read_edid = ti_hdmi_4xxx_read_edid,
809  .detect = ti_hdmi_4xxx_detect,
810  .pll_enable = ti_hdmi_4xxx_pll_enable,
811  .pll_disable = ti_hdmi_4xxx_pll_disable,
812  .video_enable = ti_hdmi_4xxx_wp_video_start,
813  .video_disable = ti_hdmi_4xxx_wp_video_stop,
814  .dump_wrapper = ti_hdmi_4xxx_wp_dump,
815  .dump_core = ti_hdmi_4xxx_core_dump,
816  .dump_pll = ti_hdmi_4xxx_pll_dump,
817  .dump_phy = ti_hdmi_4xxx_phy_dump,
818 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
819  .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
820  .audio_disable = ti_hdmi_4xxx_wp_audio_disable,
821  .audio_start = ti_hdmi_4xxx_audio_start,
822  .audio_stop = ti_hdmi_4xxx_audio_stop,
823  .audio_config = ti_hdmi_4xxx_audio_config,
824 #endif
825 
826 };
827 
828 void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
829 {
830  if (cpu_is_omap44xx())
831  ip_data->ops = &omap4_hdmi_functions;
832 }
833 #endif
834 
835 /* Functions returning values related to a DSS feature */
837 {
838  return omap_current_dss_features->num_mgrs;
839 }
840 
842 {
843  return omap_current_dss_features->num_ovls;
844 }
845 
847 {
848  return omap_current_dss_features->num_wbs;
849 }
850 
852 {
853  return omap_current_dss_features->dss_params[param].min;
854 }
855 
857 {
858  return omap_current_dss_features->dss_params[param].max;
859 }
860 
862 {
863  return omap_current_dss_features->supported_displays[channel];
864 }
865 
867 {
868  return omap_current_dss_features->supported_outputs[channel];
869 }
870 
872 {
873  return omap_current_dss_features->supported_color_modes[plane];
874 }
875 
877 {
878  return omap_current_dss_features->overlay_caps[plane];
879 }
880 
882  enum omap_color_mode color_mode)
883 {
884  return omap_current_dss_features->supported_color_modes[plane] &
885  color_mode;
886 }
887 
889 {
890  return omap_current_dss_features->clksrc_names[id];
891 }
892 
894 {
895  return omap_current_dss_features->buffer_size_unit;
896 }
897 
899 {
900  return omap_current_dss_features->burst_size_unit;
901 }
902 
903 /* DSS has_feature check */
905 {
906  int i;
907  const enum dss_feat_id *features = omap_current_dss_features->features;
908  const int num_features = omap_current_dss_features->num_features;
909 
910  for (i = 0; i < num_features; i++) {
911  if (features[i] == id)
912  return true;
913  }
914 
915  return false;
916 }
917 
919 {
920  if (id >= omap_current_dss_features->num_reg_fields)
921  BUG();
922 
923  *start = omap_current_dss_features->reg_fields[id].start;
924  *end = omap_current_dss_features->reg_fields[id].end;
925 }
926 
928 {
929  return omap_current_dss_features->supported_rotation_types & rot_type;
930 }
931 
933 {
934  if (cpu_is_omap24xx())
935  omap_current_dss_features = &omap2_dss_features;
936  else if (cpu_is_omap3630())
937  omap_current_dss_features = &omap3630_dss_features;
938  else if (cpu_is_omap34xx()) {
939  if (soc_is_am35xx()) {
940  omap_current_dss_features = &am35xx_dss_features;
941  } else {
942  omap_current_dss_features = &omap3430_dss_features;
943  }
944  }
945  else if (omap_rev() == OMAP4430_REV_ES1_0)
946  omap_current_dss_features = &omap4430_es1_0_dss_features;
947  else if (omap_rev() == OMAP4430_REV_ES2_0 ||
950  omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
951  else if (cpu_is_omap44xx())
952  omap_current_dss_features = &omap4_dss_features;
953  else if (soc_is_omap54xx())
954  omap_current_dss_features = &omap5_dss_features;
955  else
956  DSSWARN("Unsupported OMAP version");
957 }