blob: 406913949e2c49e7c1c730e06d80d80b9bd2f6a0 [file] [log] [blame]
Archit Tanejae1ef4d22010-09-15 18:47:29 +05301/*
2 * linux/drivers/video/omap2/dss/dss_features.c
3 *
4 * Copyright (C) 2010 Texas Instruments
5 * Author: Archit Taneja <archit@ti.com>
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
Tomi Valkeinena0b38cc2011-05-11 14:05:07 +030025#include <video/omapdss.h>
Archit Tanejae1ef4d22010-09-15 18:47:29 +053026#include <plat/cpu.h>
27
Archit Taneja067a57e2011-03-02 11:57:25 +053028#include "dss.h"
Archit Tanejae1ef4d22010-09-15 18:47:29 +053029#include "dss_features.h"
30
31/* Defines a generic omap register field */
32struct dss_reg_field {
Archit Tanejae1ef4d22010-09-15 18:47:29 +053033 u8 start, end;
34};
35
Taneja, Archit31ef8232011-03-14 23:28:22 -050036struct dss_param_range {
37 int min, max;
38};
39
Archit Tanejae1ef4d22010-09-15 18:47:29 +053040struct omap_dss_features {
41 const struct dss_reg_field *reg_fields;
42 const int num_reg_fields;
43
Archit Tanejac124f232012-01-30 10:52:39 +053044 const enum dss_feat_id *features;
45 const int num_features;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053046
47 const int num_mgrs;
48 const int num_ovls;
49 const enum omap_display_type *supported_displays;
50 const enum omap_color_mode *supported_color_modes;
Tomi Valkeinen67019db2011-08-15 15:18:15 +030051 const enum omap_overlay_caps *overlay_caps;
Taneja, Archit235e7db2011-03-14 23:28:21 -050052 const char * const *clksrc_names;
Taneja, Archit31ef8232011-03-14 23:28:22 -050053 const struct dss_param_range *dss_params;
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +030054
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +053055 const enum omap_dss_rotation_type supported_rotation_types;
56
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +030057 const u32 buffer_size_unit;
58 const u32 burst_size_unit;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053059};
60
61/* This struct is assigned to one of the below during initialization */
Tomi Valkeinenea290332011-04-20 10:09:36 +030062static const struct omap_dss_features *omap_current_dss_features;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053063
64static const struct dss_reg_field omap2_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050065 [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 },
Archit Tanejae1ef4d22010-09-15 18:47:29 +053077};
78
79static const struct dss_reg_field omap3_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050080 [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 },
Archit Taneja87a74842011-03-02 11:19:50 +053092};
93
94static const struct dss_reg_field omap4_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050095 [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 },
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530107};
108
Archit Taneja23362832012-04-08 16:47:01 +0530109static const struct dss_reg_field omap5_dss_reg_fields[] = {
110 [FEAT_REG_FIRHINC] = { 12, 0 },
111 [FEAT_REG_FIRVINC] = { 28, 16 },
112 [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
113 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
114 [FEAT_REG_FIFOSIZE] = { 15, 0 },
115 [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
116 [FEAT_REG_VERTICALACCU] = { 26, 16 },
117 [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 7 },
118 [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
119 [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
120 [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
121 [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
122};
123
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530124static const enum omap_display_type omap2_dss_supported_displays[] = {
125 /* OMAP_DSS_CHANNEL_LCD */
Tomi Valkeinenf8df01f2011-02-24 14:21:25 +0200126 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530127
128 /* OMAP_DSS_CHANNEL_DIGIT */
129 OMAP_DISPLAY_TYPE_VENC,
130};
131
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200132static const enum omap_display_type omap3430_dss_supported_displays[] = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530133 /* OMAP_DSS_CHANNEL_LCD */
134 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
135 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
136
137 /* OMAP_DSS_CHANNEL_DIGIT */
138 OMAP_DISPLAY_TYPE_VENC,
139};
140
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200141static const enum omap_display_type omap3630_dss_supported_displays[] = {
142 /* OMAP_DSS_CHANNEL_LCD */
143 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
144 OMAP_DISPLAY_TYPE_DSI,
145
146 /* OMAP_DSS_CHANNEL_DIGIT */
147 OMAP_DISPLAY_TYPE_VENC,
148};
149
Archit Tanejad50cd032010-12-02 11:27:08 +0000150static const enum omap_display_type omap4_dss_supported_displays[] = {
151 /* OMAP_DSS_CHANNEL_LCD */
152 OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
153
154 /* OMAP_DSS_CHANNEL_DIGIT */
Mythri P Kb1196012011-03-08 17:15:54 +0530155 OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
Archit Tanejad50cd032010-12-02 11:27:08 +0000156
157 /* OMAP_DSS_CHANNEL_LCD2 */
158 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
159 OMAP_DISPLAY_TYPE_DSI,
160};
161
Archit Taneja23362832012-04-08 16:47:01 +0530162static const enum omap_display_type omap5_dss_supported_displays[] = {
163 /* OMAP_DSS_CHANNEL_LCD */
164 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
165 OMAP_DISPLAY_TYPE_DSI,
166
167 /* OMAP_DSS_CHANNEL_DIGIT */
168 OMAP_DISPLAY_TYPE_HDMI | OMAP_DISPLAY_TYPE_DPI,
169
170 /* OMAP_DSS_CHANNEL_LCD2 */
171 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
172 OMAP_DISPLAY_TYPE_DSI,
173};
174
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530175static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
176 /* OMAP_DSS_GFX */
177 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
178 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
179 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
180 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
181
182 /* OMAP_DSS_VIDEO1 */
183 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
184 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
185 OMAP_DSS_COLOR_UYVY,
186
187 /* OMAP_DSS_VIDEO2 */
188 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
189 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
190 OMAP_DSS_COLOR_UYVY,
191};
192
193static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
194 /* OMAP_DSS_GFX */
195 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
196 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
197 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
198 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
199 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
200 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
201
202 /* OMAP_DSS_VIDEO1 */
203 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
204 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
205 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
206
207 /* OMAP_DSS_VIDEO2 */
208 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
209 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
210 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
211 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
212 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
213};
214
Amber Jainf20e4222011-05-19 19:47:50 +0530215static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
216 /* OMAP_DSS_GFX */
217 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
218 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
219 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
220 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
221 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
222 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
Lajos Molnar08f32672012-02-21 19:36:30 +0530223 OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
224 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
Amber Jainf20e4222011-05-19 19:47:50 +0530225
226 /* OMAP_DSS_VIDEO1 */
227 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
228 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
229 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
230 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
231 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
232 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
233 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
234 OMAP_DSS_COLOR_RGBX32,
235
236 /* OMAP_DSS_VIDEO2 */
237 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
238 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
239 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
240 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
241 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
242 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
243 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
244 OMAP_DSS_COLOR_RGBX32,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530245
246 /* OMAP_DSS_VIDEO3 */
247 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
248 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
249 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
250 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
251 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
252 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
253 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
254 OMAP_DSS_COLOR_RGBX32,
Amber Jainf20e4222011-05-19 19:47:50 +0530255};
256
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300257static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
258 /* OMAP_DSS_GFX */
259 0,
260
261 /* OMAP_DSS_VIDEO1 */
262 OMAP_DSS_OVL_CAP_SCALE,
263
264 /* OMAP_DSS_VIDEO2 */
265 OMAP_DSS_OVL_CAP_SCALE,
266};
267
268static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
269 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300270 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300271
272 /* OMAP_DSS_VIDEO1 */
273 OMAP_DSS_OVL_CAP_SCALE,
274
275 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300276 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300277};
278
279static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
280 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300281 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300282
283 /* OMAP_DSS_VIDEO1 */
284 OMAP_DSS_OVL_CAP_SCALE,
285
286 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300287 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
288 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300289};
290
291static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
292 /* OMAP_DSS_GFX */
Archit Taneja11354dd2011-09-26 11:47:29 +0530293 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
294 OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300295
296 /* OMAP_DSS_VIDEO1 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300297 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
Archit Taneja11354dd2011-09-26 11:47:29 +0530298 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300299
300 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300301 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
Archit Taneja11354dd2011-09-26 11:47:29 +0530302 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530303
304 /* OMAP_DSS_VIDEO3 */
305 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
306 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300307};
308
Taneja, Archit235e7db2011-03-14 23:28:21 -0500309static const char * const omap2_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530310 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
311 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
312 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
Archit Taneja067a57e2011-03-02 11:57:25 +0530313};
314
Taneja, Archit235e7db2011-03-14 23:28:21 -0500315static const char * const omap3_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530316 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
317 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
318 [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
Archit Taneja067a57e2011-03-02 11:57:25 +0530319};
320
Taneja, Archit235e7db2011-03-14 23:28:21 -0500321static const char * const omap4_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530322 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
323 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
324 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
Archit Taneja5a8b5722011-05-12 17:26:29 +0530325 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
326 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
Taneja, Architea751592011-03-08 05:50:35 -0600327};
328
Archit Taneja23362832012-04-08 16:47:01 +0530329static const char * const omap5_dss_clk_source_names[] = {
330 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DPLL_DSI1_A_CLK1",
331 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DPLL_DSI1_A_CLK2",
332 [OMAP_DSS_CLK_SRC_FCK] = "DSS_CLK",
333 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "DPLL_DSI1_C_CLK1",
334 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "DPLL_DSI1_C_CLK2",
335};
336
Taneja, Archit31ef8232011-03-14 23:28:22 -0500337static const struct dss_param_range omap2_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500338 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300339 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500340 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
341 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
342 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
343 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
344 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
345 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530346 [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530347 /*
348 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
349 * scaler cannot scale a image with width more than 768.
350 */
351 [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
Archit Taneja8f366162012-04-16 12:53:44 +0530352 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
353 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500354};
355
356static const struct dss_param_range omap3_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500357 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300358 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500359 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
360 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
361 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
362 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
363 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
364 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
Tomi Valkeinenbc63f302012-08-16 16:25:29 +0300365 [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530366 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530367 [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
Archit Taneja8f366162012-04-16 12:53:44 +0530368 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
369 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500370};
371
372static const struct dss_param_range omap4_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500373 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300374 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500375 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
376 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
377 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
378 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
379 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
380 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
Tomi Valkeinenbc63f302012-08-16 16:25:29 +0300381 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530382 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530383 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
Archit Taneja8f366162012-04-16 12:53:44 +0530384 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
385 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500386};
387
Archit Taneja23362832012-04-08 16:47:01 +0530388static const struct dss_param_range omap5_dss_param_range[] = {
389 [FEAT_PARAM_DSS_FCK] = { 0, 200000000 },
390 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
391 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
392 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
393 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
394 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
395 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
396 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
397 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
398 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
399 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
400 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
401 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
402};
403
Archit Tanejac124f232012-01-30 10:52:39 +0530404static const enum dss_feat_id omap2_dss_feat_list[] = {
405 FEAT_LCDENABLEPOL,
406 FEAT_LCDENABLESIGNAL,
407 FEAT_PCKFREEENABLE,
408 FEAT_FUNCGATED,
409 FEAT_ROWREPEATENABLE,
410 FEAT_RESIZECONF,
411};
412
413static const enum dss_feat_id omap3430_dss_feat_list[] = {
414 FEAT_LCDENABLEPOL,
415 FEAT_LCDENABLESIGNAL,
416 FEAT_PCKFREEENABLE,
417 FEAT_FUNCGATED,
418 FEAT_LINEBUFFERSPLIT,
419 FEAT_ROWREPEATENABLE,
420 FEAT_RESIZECONF,
421 FEAT_DSI_PLL_FREQSEL,
422 FEAT_DSI_REVERSE_TXCLKESC,
423 FEAT_VENC_REQUIRES_TV_DAC_CLK,
424 FEAT_CPR,
425 FEAT_PRELOAD,
426 FEAT_FIR_COEF_V,
427 FEAT_ALPHA_FIXED_ZORDER,
428 FEAT_FIFO_MERGE,
429 FEAT_OMAP3_DSI_FIFO_BUG,
Chandrabhanu Mahapatra195e6722012-08-22 11:44:06 +0530430 FEAT_DPI_USES_VDDS_DSI,
Archit Tanejac124f232012-01-30 10:52:39 +0530431};
432
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400433static const enum dss_feat_id am35xx_dss_feat_list[] = {
434 FEAT_LCDENABLEPOL,
435 FEAT_LCDENABLESIGNAL,
436 FEAT_PCKFREEENABLE,
437 FEAT_FUNCGATED,
438 FEAT_LINEBUFFERSPLIT,
439 FEAT_ROWREPEATENABLE,
440 FEAT_RESIZECONF,
441 FEAT_DSI_PLL_FREQSEL,
442 FEAT_DSI_REVERSE_TXCLKESC,
443 FEAT_VENC_REQUIRES_TV_DAC_CLK,
444 FEAT_CPR,
445 FEAT_PRELOAD,
446 FEAT_FIR_COEF_V,
447 FEAT_ALPHA_FIXED_ZORDER,
448 FEAT_FIFO_MERGE,
449 FEAT_OMAP3_DSI_FIFO_BUG,
450};
451
Archit Tanejac124f232012-01-30 10:52:39 +0530452static const enum dss_feat_id omap3630_dss_feat_list[] = {
453 FEAT_LCDENABLEPOL,
454 FEAT_LCDENABLESIGNAL,
455 FEAT_PCKFREEENABLE,
456 FEAT_FUNCGATED,
457 FEAT_LINEBUFFERSPLIT,
458 FEAT_ROWREPEATENABLE,
459 FEAT_RESIZECONF,
460 FEAT_DSI_PLL_PWR_BUG,
461 FEAT_DSI_PLL_FREQSEL,
462 FEAT_CPR,
463 FEAT_PRELOAD,
464 FEAT_FIR_COEF_V,
465 FEAT_ALPHA_FIXED_ZORDER,
466 FEAT_FIFO_MERGE,
467 FEAT_OMAP3_DSI_FIFO_BUG,
468};
469
470static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
471 FEAT_MGR_LCD2,
472 FEAT_CORE_CLK_DIV,
473 FEAT_LCD_CLK_SRC,
474 FEAT_DSI_DCS_CMD_CONFIG_VC,
475 FEAT_DSI_VC_OCP_WIDTH,
476 FEAT_DSI_GNQ,
477 FEAT_HANDLE_UV_SEPARATE,
478 FEAT_ATTR2,
479 FEAT_CPR,
480 FEAT_PRELOAD,
481 FEAT_FIR_COEF_V,
482 FEAT_ALPHA_FREE_ZORDER,
483 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530484 FEAT_BURST_2D,
Archit Tanejac124f232012-01-30 10:52:39 +0530485};
486
Ricardo Neri70988192012-02-16 09:20:57 -0600487static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
488 FEAT_MGR_LCD2,
489 FEAT_CORE_CLK_DIV,
490 FEAT_LCD_CLK_SRC,
491 FEAT_DSI_DCS_CMD_CONFIG_VC,
492 FEAT_DSI_VC_OCP_WIDTH,
493 FEAT_DSI_GNQ,
494 FEAT_HDMI_CTS_SWMODE,
495 FEAT_HANDLE_UV_SEPARATE,
496 FEAT_ATTR2,
497 FEAT_CPR,
498 FEAT_PRELOAD,
499 FEAT_FIR_COEF_V,
500 FEAT_ALPHA_FREE_ZORDER,
501 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530502 FEAT_BURST_2D,
Ricardo Neri70988192012-02-16 09:20:57 -0600503};
504
Archit Tanejac124f232012-01-30 10:52:39 +0530505static const enum dss_feat_id omap4_dss_feat_list[] = {
506 FEAT_MGR_LCD2,
507 FEAT_CORE_CLK_DIV,
508 FEAT_LCD_CLK_SRC,
509 FEAT_DSI_DCS_CMD_CONFIG_VC,
510 FEAT_DSI_VC_OCP_WIDTH,
511 FEAT_DSI_GNQ,
512 FEAT_HDMI_CTS_SWMODE,
Ricardo Neri70988192012-02-16 09:20:57 -0600513 FEAT_HDMI_AUDIO_USE_MCLK,
Archit Tanejac124f232012-01-30 10:52:39 +0530514 FEAT_HANDLE_UV_SEPARATE,
515 FEAT_ATTR2,
516 FEAT_CPR,
517 FEAT_PRELOAD,
518 FEAT_FIR_COEF_V,
519 FEAT_ALPHA_FREE_ZORDER,
520 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530521 FEAT_BURST_2D,
Archit Tanejac124f232012-01-30 10:52:39 +0530522};
523
Archit Taneja23362832012-04-08 16:47:01 +0530524static const enum dss_feat_id omap5_dss_feat_list[] = {
525 FEAT_MGR_LCD2,
526 FEAT_CORE_CLK_DIV,
527 FEAT_LCD_CLK_SRC,
528 FEAT_DSI_DCS_CMD_CONFIG_VC,
529 FEAT_DSI_VC_OCP_WIDTH,
530 FEAT_DSI_GNQ,
531 FEAT_HDMI_CTS_SWMODE,
532 FEAT_HDMI_AUDIO_USE_MCLK,
533 FEAT_HANDLE_UV_SEPARATE,
534 FEAT_ATTR2,
535 FEAT_CPR,
536 FEAT_PRELOAD,
537 FEAT_FIR_COEF_V,
538 FEAT_ALPHA_FREE_ZORDER,
539 FEAT_FIFO_MERGE,
540 FEAT_BURST_2D,
Tomi Valkeinenf8ef3d62012-08-22 16:00:31 +0300541 FEAT_DSI_PLL_SELFREQDCO,
Tomi Valkeinen6d446102012-08-22 16:00:40 +0300542 FEAT_DSI_PLL_REFSEL,
Tomi Valkeinen77ccbfb2012-09-24 15:15:57 +0300543 FEAT_DSI_PHY_DCC,
Archit Taneja23362832012-04-08 16:47:01 +0530544};
545
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530546/* OMAP2 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300547static const struct omap_dss_features omap2_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530548 .reg_fields = omap2_dss_reg_fields,
549 .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
550
Archit Tanejac124f232012-01-30 10:52:39 +0530551 .features = omap2_dss_feat_list,
552 .num_features = ARRAY_SIZE(omap2_dss_feat_list),
Archit Tanejad50cd032010-12-02 11:27:08 +0000553
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530554 .num_mgrs = 2,
555 .num_ovls = 3,
556 .supported_displays = omap2_dss_supported_displays,
557 .supported_color_modes = omap2_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300558 .overlay_caps = omap2_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530559 .clksrc_names = omap2_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500560 .dss_params = omap2_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530561 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300562 .buffer_size_unit = 1,
563 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530564};
565
566/* OMAP3 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300567static const struct omap_dss_features omap3430_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530568 .reg_fields = omap3_dss_reg_fields,
569 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
570
Archit Tanejac124f232012-01-30 10:52:39 +0530571 .features = omap3430_dss_feat_list,
572 .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530573
574 .num_mgrs = 2,
575 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200576 .supported_displays = omap3430_dss_supported_displays,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530577 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300578 .overlay_caps = omap3430_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530579 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500580 .dss_params = omap3_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530581 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300582 .buffer_size_unit = 1,
583 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530584};
585
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400586/*
587 * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
588 * vdds_dsi regulator.
589 */
590static const struct omap_dss_features am35xx_dss_features = {
591 .reg_fields = omap3_dss_reg_fields,
592 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
593
594 .features = am35xx_dss_feat_list,
595 .num_features = ARRAY_SIZE(am35xx_dss_feat_list),
596
597 .num_mgrs = 2,
598 .num_ovls = 3,
599 .supported_displays = omap3430_dss_supported_displays,
600 .supported_color_modes = omap3_dss_supported_color_modes,
601 .overlay_caps = omap3430_dss_overlay_caps,
602 .clksrc_names = omap3_dss_clk_source_names,
603 .dss_params = omap3_dss_param_range,
604 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
605 .buffer_size_unit = 1,
606 .burst_size_unit = 8,
607};
608
Tomi Valkeinenea290332011-04-20 10:09:36 +0300609static const struct omap_dss_features omap3630_dss_features = {
Samreen8fbde102010-11-04 12:28:41 +0100610 .reg_fields = omap3_dss_reg_fields,
611 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
612
Archit Tanejac124f232012-01-30 10:52:39 +0530613 .features = omap3630_dss_feat_list,
614 .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
Samreen8fbde102010-11-04 12:28:41 +0100615
616 .num_mgrs = 2,
617 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200618 .supported_displays = omap3630_dss_supported_displays,
Samreen8fbde102010-11-04 12:28:41 +0100619 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300620 .overlay_caps = omap3630_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530621 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500622 .dss_params = omap3_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530623 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300624 .buffer_size_unit = 1,
625 .burst_size_unit = 8,
Samreen8fbde102010-11-04 12:28:41 +0100626};
627
Archit Tanejad50cd032010-12-02 11:27:08 +0000628/* OMAP4 DSS Features */
Ricardo Neri6ff70842011-05-18 22:23:33 -0500629/* For OMAP4430 ES 1.0 revision */
630static const struct omap_dss_features omap4430_es1_0_dss_features = {
631 .reg_fields = omap4_dss_reg_fields,
632 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
633
Archit Tanejac124f232012-01-30 10:52:39 +0530634 .features = omap4430_es1_0_dss_feat_list,
635 .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
Ricardo Neri6ff70842011-05-18 22:23:33 -0500636
637 .num_mgrs = 3,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530638 .num_ovls = 4,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500639 .supported_displays = omap4_dss_supported_displays,
Amber Jainf20e4222011-05-19 19:47:50 +0530640 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300641 .overlay_caps = omap4_dss_overlay_caps,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500642 .clksrc_names = omap4_dss_clk_source_names,
643 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530644 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300645 .buffer_size_unit = 16,
646 .burst_size_unit = 16,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500647};
648
Ricardo Neri70988192012-02-16 09:20:57 -0600649/* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
650static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
651 .reg_fields = omap4_dss_reg_fields,
652 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
653
654 .features = omap4430_es2_0_1_2_dss_feat_list,
655 .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
656
657 .num_mgrs = 3,
658 .num_ovls = 4,
659 .supported_displays = omap4_dss_supported_displays,
660 .supported_color_modes = omap4_dss_supported_color_modes,
661 .overlay_caps = omap4_dss_overlay_caps,
662 .clksrc_names = omap4_dss_clk_source_names,
663 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530664 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Ricardo Neri70988192012-02-16 09:20:57 -0600665 .buffer_size_unit = 16,
666 .burst_size_unit = 16,
667};
668
Ricardo Neri6ff70842011-05-18 22:23:33 -0500669/* For all the other OMAP4 versions */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300670static const struct omap_dss_features omap4_dss_features = {
Archit Taneja87a74842011-03-02 11:19:50 +0530671 .reg_fields = omap4_dss_reg_fields,
672 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
Archit Tanejad50cd032010-12-02 11:27:08 +0000673
Archit Tanejac124f232012-01-30 10:52:39 +0530674 .features = omap4_dss_feat_list,
675 .num_features = ARRAY_SIZE(omap4_dss_feat_list),
Archit Tanejad50cd032010-12-02 11:27:08 +0000676
677 .num_mgrs = 3,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530678 .num_ovls = 4,
Archit Tanejad50cd032010-12-02 11:27:08 +0000679 .supported_displays = omap4_dss_supported_displays,
Amber Jainf20e4222011-05-19 19:47:50 +0530680 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300681 .overlay_caps = omap4_dss_overlay_caps,
Taneja, Architea751592011-03-08 05:50:35 -0600682 .clksrc_names = omap4_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500683 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530684 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300685 .buffer_size_unit = 16,
686 .burst_size_unit = 16,
Archit Tanejad50cd032010-12-02 11:27:08 +0000687};
688
Archit Taneja23362832012-04-08 16:47:01 +0530689/* OMAP5 DSS Features */
690static const struct omap_dss_features omap5_dss_features = {
691 .reg_fields = omap5_dss_reg_fields,
692 .num_reg_fields = ARRAY_SIZE(omap5_dss_reg_fields),
693
694 .features = omap5_dss_feat_list,
695 .num_features = ARRAY_SIZE(omap5_dss_feat_list),
696
697 .num_mgrs = 3,
698 .num_ovls = 4,
699 .supported_displays = omap5_dss_supported_displays,
700 .supported_color_modes = omap4_dss_supported_color_modes,
701 .overlay_caps = omap4_dss_overlay_caps,
702 .clksrc_names = omap5_dss_clk_source_names,
703 .dss_params = omap5_dss_param_range,
704 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
705 .buffer_size_unit = 16,
706 .burst_size_unit = 16,
707};
708
Mythri P K60634a22011-09-08 19:06:26 +0530709#if defined(CONFIG_OMAP4_DSS_HDMI)
710/* HDMI OMAP4 Functions*/
711static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
712
713 .video_configure = ti_hdmi_4xxx_basic_configure,
714 .phy_enable = ti_hdmi_4xxx_phy_enable,
715 .phy_disable = ti_hdmi_4xxx_phy_disable,
716 .read_edid = ti_hdmi_4xxx_read_edid,
Tomi Valkeinen759593f2011-08-29 18:10:20 +0300717 .detect = ti_hdmi_4xxx_detect,
Mythri P K60634a22011-09-08 19:06:26 +0530718 .pll_enable = ti_hdmi_4xxx_pll_enable,
719 .pll_disable = ti_hdmi_4xxx_pll_disable,
720 .video_enable = ti_hdmi_4xxx_wp_video_start,
Ricardo Neric0456be2012-04-27 13:48:45 -0500721 .video_disable = ti_hdmi_4xxx_wp_video_stop,
Mythri P K162874d2011-09-22 13:37:45 +0530722 .dump_wrapper = ti_hdmi_4xxx_wp_dump,
723 .dump_core = ti_hdmi_4xxx_core_dump,
724 .dump_pll = ti_hdmi_4xxx_pll_dump,
725 .dump_phy = ti_hdmi_4xxx_phy_dump,
Ricardo Neri7e151f72012-03-15 14:08:03 -0600726#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
Ricardo Neri80a48592011-11-27 16:09:58 -0600727 .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
Ricardo Neri027bdc82012-04-20 17:17:46 -0500728 .audio_disable = ti_hdmi_4xxx_wp_audio_disable,
Axel Castaneda Gonzalez3df9fb52012-05-03 09:00:21 -0500729 .audio_start = ti_hdmi_4xxx_audio_start,
730 .audio_stop = ti_hdmi_4xxx_audio_stop,
Ricardo Neri6ec355d2012-03-21 12:38:15 -0600731 .audio_config = ti_hdmi_4xxx_audio_config,
Ricardo Neri80a48592011-11-27 16:09:58 -0600732#endif
Mythri P K162874d2011-09-22 13:37:45 +0530733
Mythri P K60634a22011-09-08 19:06:26 +0530734};
735
736void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
737{
738 if (cpu_is_omap44xx())
739 ip_data->ops = &omap4_hdmi_functions;
740}
741#endif
742
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530743/* Functions returning values related to a DSS feature */
744int dss_feat_get_num_mgrs(void)
745{
746 return omap_current_dss_features->num_mgrs;
747}
748
749int dss_feat_get_num_ovls(void)
750{
751 return omap_current_dss_features->num_ovls;
752}
753
Taneja, Archit31ef8232011-03-14 23:28:22 -0500754unsigned long dss_feat_get_param_min(enum dss_range_param param)
Archit Taneja819d8072011-03-01 11:54:00 +0530755{
Taneja, Archit31ef8232011-03-14 23:28:22 -0500756 return omap_current_dss_features->dss_params[param].min;
757}
758
759unsigned long dss_feat_get_param_max(enum dss_range_param param)
760{
761 return omap_current_dss_features->dss_params[param].max;
Archit Taneja819d8072011-03-01 11:54:00 +0530762}
763
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530764enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
765{
766 return omap_current_dss_features->supported_displays[channel];
767}
768
769enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
770{
771 return omap_current_dss_features->supported_color_modes[plane];
772}
773
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300774enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
775{
776 return omap_current_dss_features->overlay_caps[plane];
777}
778
Archit Taneja8dad2ab2010-11-25 17:58:10 +0530779bool dss_feat_color_mode_supported(enum omap_plane plane,
780 enum omap_color_mode color_mode)
781{
782 return omap_current_dss_features->supported_color_modes[plane] &
783 color_mode;
784}
785
Archit Taneja89a35e52011-04-12 13:52:23 +0530786const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
Archit Taneja067a57e2011-03-02 11:57:25 +0530787{
Taneja, Archit235e7db2011-03-14 23:28:21 -0500788 return omap_current_dss_features->clksrc_names[id];
Archit Taneja067a57e2011-03-02 11:57:25 +0530789}
790
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300791u32 dss_feat_get_buffer_size_unit(void)
792{
793 return omap_current_dss_features->buffer_size_unit;
794}
795
796u32 dss_feat_get_burst_size_unit(void)
797{
798 return omap_current_dss_features->burst_size_unit;
799}
800
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530801/* DSS has_feature check */
802bool dss_has_feature(enum dss_feat_id id)
803{
Archit Tanejac124f232012-01-30 10:52:39 +0530804 int i;
805 const enum dss_feat_id *features = omap_current_dss_features->features;
806 const int num_features = omap_current_dss_features->num_features;
807
808 for (i = 0; i < num_features; i++) {
809 if (features[i] == id)
810 return true;
811 }
812
813 return false;
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530814}
815
816void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
817{
818 if (id >= omap_current_dss_features->num_reg_fields)
819 BUG();
820
821 *start = omap_current_dss_features->reg_fields[id].start;
822 *end = omap_current_dss_features->reg_fields[id].end;
823}
824
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530825bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
826{
827 return omap_current_dss_features->supported_rotation_types & rot_type;
828}
829
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530830void dss_features_init(void)
831{
832 if (cpu_is_omap24xx())
833 omap_current_dss_features = &omap2_dss_features;
Samreen8fbde102010-11-04 12:28:41 +0100834 else if (cpu_is_omap3630())
835 omap_current_dss_features = &omap3630_dss_features;
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400836 else if (cpu_is_omap34xx()) {
837 if (soc_is_am35xx()) {
838 omap_current_dss_features = &am35xx_dss_features;
839 } else {
840 omap_current_dss_features = &omap3430_dss_features;
841 }
842 }
Ricardo Neri6ff70842011-05-18 22:23:33 -0500843 else if (omap_rev() == OMAP4430_REV_ES1_0)
844 omap_current_dss_features = &omap4430_es1_0_dss_features;
Ricardo Neri70988192012-02-16 09:20:57 -0600845 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
846 omap_rev() == OMAP4430_REV_ES2_1 ||
847 omap_rev() == OMAP4430_REV_ES2_2)
848 omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500849 else if (cpu_is_omap44xx())
Archit Tanejad50cd032010-12-02 11:27:08 +0000850 omap_current_dss_features = &omap4_dss_features;
Archit Taneja23362832012-04-08 16:47:01 +0530851 else if (soc_is_omap54xx())
852 omap_current_dss_features = &omap5_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500853 else
854 DSSWARN("Unsupported OMAP version");
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530855}