blob: bfe7fc7b8593488e43e6bd9578986751a2239b9e [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;
Archit Taneja97f01b32012-09-26 16:42:39 +053050 const enum omap_dss_output_id *supported_outputs;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053051 const enum omap_color_mode *supported_color_modes;
Tomi Valkeinen67019db2011-08-15 15:18:15 +030052 const enum omap_overlay_caps *overlay_caps;
Taneja, Archit235e7db2011-03-14 23:28:21 -050053 const char * const *clksrc_names;
Taneja, Archit31ef8232011-03-14 23:28:22 -050054 const struct dss_param_range *dss_params;
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +030055
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +053056 const enum omap_dss_rotation_type supported_rotation_types;
57
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +030058 const u32 buffer_size_unit;
59 const u32 burst_size_unit;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053060};
61
62/* This struct is assigned to one of the below during initialization */
Tomi Valkeinenea290332011-04-20 10:09:36 +030063static const struct omap_dss_features *omap_current_dss_features;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053064
65static const struct dss_reg_field omap2_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050066 [FEAT_REG_FIRHINC] = { 11, 0 },
67 [FEAT_REG_FIRVINC] = { 27, 16 },
68 [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
69 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
70 [FEAT_REG_FIFOSIZE] = { 8, 0 },
71 [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
72 [FEAT_REG_VERTICALACCU] = { 25, 16 },
73 [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
74 [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
75 [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
76 [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
77 [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 },
Archit Tanejae1ef4d22010-09-15 18:47:29 +053078};
79
80static const struct dss_reg_field omap3_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050081 [FEAT_REG_FIRHINC] = { 12, 0 },
82 [FEAT_REG_FIRVINC] = { 28, 16 },
83 [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
84 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
85 [FEAT_REG_FIFOSIZE] = { 10, 0 },
86 [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
87 [FEAT_REG_VERTICALACCU] = { 25, 16 },
88 [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
89 [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
90 [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
91 [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
92 [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
Archit Taneja87a74842011-03-02 11:19:50 +053093};
94
95static const struct dss_reg_field omap4_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050096 [FEAT_REG_FIRHINC] = { 12, 0 },
97 [FEAT_REG_FIRVINC] = { 28, 16 },
98 [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
99 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
100 [FEAT_REG_FIFOSIZE] = { 15, 0 },
101 [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
102 [FEAT_REG_VERTICALACCU] = { 26, 16 },
103 [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
104 [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
105 [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
106 [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
107 [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530108};
109
Archit Taneja23362832012-04-08 16:47:01 +0530110static const struct dss_reg_field omap5_dss_reg_fields[] = {
111 [FEAT_REG_FIRHINC] = { 12, 0 },
112 [FEAT_REG_FIRVINC] = { 28, 16 },
113 [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
114 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
115 [FEAT_REG_FIFOSIZE] = { 15, 0 },
116 [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
117 [FEAT_REG_VERTICALACCU] = { 26, 16 },
118 [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 7 },
119 [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
120 [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
121 [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
122 [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
123};
124
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530125static const enum omap_display_type omap2_dss_supported_displays[] = {
126 /* OMAP_DSS_CHANNEL_LCD */
Tomi Valkeinenf8df01f2011-02-24 14:21:25 +0200127 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530128
129 /* OMAP_DSS_CHANNEL_DIGIT */
130 OMAP_DISPLAY_TYPE_VENC,
131};
132
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200133static const enum omap_display_type omap3430_dss_supported_displays[] = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530134 /* OMAP_DSS_CHANNEL_LCD */
135 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
136 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
137
138 /* OMAP_DSS_CHANNEL_DIGIT */
139 OMAP_DISPLAY_TYPE_VENC,
140};
141
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200142static const enum omap_display_type omap3630_dss_supported_displays[] = {
143 /* OMAP_DSS_CHANNEL_LCD */
144 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
145 OMAP_DISPLAY_TYPE_DSI,
146
147 /* OMAP_DSS_CHANNEL_DIGIT */
148 OMAP_DISPLAY_TYPE_VENC,
149};
150
Archit Tanejad50cd032010-12-02 11:27:08 +0000151static const enum omap_display_type omap4_dss_supported_displays[] = {
152 /* OMAP_DSS_CHANNEL_LCD */
153 OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
154
155 /* OMAP_DSS_CHANNEL_DIGIT */
Mythri P Kb1196012011-03-08 17:15:54 +0530156 OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
Archit Tanejad50cd032010-12-02 11:27:08 +0000157
158 /* OMAP_DSS_CHANNEL_LCD2 */
159 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
160 OMAP_DISPLAY_TYPE_DSI,
161};
162
Archit Taneja23362832012-04-08 16:47:01 +0530163static const enum omap_display_type omap5_dss_supported_displays[] = {
164 /* OMAP_DSS_CHANNEL_LCD */
165 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
166 OMAP_DISPLAY_TYPE_DSI,
167
168 /* OMAP_DSS_CHANNEL_DIGIT */
169 OMAP_DISPLAY_TYPE_HDMI | OMAP_DISPLAY_TYPE_DPI,
170
171 /* OMAP_DSS_CHANNEL_LCD2 */
172 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
173 OMAP_DISPLAY_TYPE_DSI,
174};
175
Archit Taneja97f01b32012-09-26 16:42:39 +0530176static const enum omap_dss_output_id omap2_dss_supported_outputs[] = {
177 /* OMAP_DSS_CHANNEL_LCD */
178 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
179
180 /* OMAP_DSS_CHANNEL_DIGIT */
181 OMAP_DSS_OUTPUT_VENC,
182};
183
184static const enum omap_dss_output_id omap3430_dss_supported_outputs[] = {
185 /* OMAP_DSS_CHANNEL_LCD */
186 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
187 OMAP_DSS_OUTPUT_SDI | OMAP_DSS_OUTPUT_DSI1,
188
189 /* OMAP_DSS_CHANNEL_DIGIT */
190 OMAP_DSS_OUTPUT_VENC,
191};
192
193static const enum omap_dss_output_id omap3630_dss_supported_outputs[] = {
194 /* OMAP_DSS_CHANNEL_LCD */
195 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
196 OMAP_DSS_OUTPUT_DSI1,
197
198 /* OMAP_DSS_CHANNEL_DIGIT */
199 OMAP_DSS_OUTPUT_VENC,
200};
201
202static const enum omap_dss_output_id omap4_dss_supported_outputs[] = {
203 /* OMAP_DSS_CHANNEL_LCD */
204 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
205 OMAP_DSS_OUTPUT_DSI1,
206
207 /* OMAP_DSS_CHANNEL_DIGIT */
208 OMAP_DSS_OUTPUT_VENC | OMAP_DSS_OUTPUT_HDMI |
209 OMAP_DSS_OUTPUT_DPI,
210
211 /* OMAP_DSS_CHANNEL_LCD2 */
212 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
213 OMAP_DSS_OUTPUT_DSI2,
214};
215
216static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
217 /* OMAP_DSS_CHANNEL_LCD */
218 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
219 OMAP_DSS_OUTPUT_DSI1 | OMAP_DSS_OUTPUT_DSI2,
220
221 /* OMAP_DSS_CHANNEL_DIGIT */
222 OMAP_DSS_OUTPUT_HDMI | OMAP_DSS_OUTPUT_DPI,
223
224 /* OMAP_DSS_CHANNEL_LCD2 */
225 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
226 OMAP_DSS_OUTPUT_DSI1,
227
228 /* OMAP_DSS_CHANNEL_LCD3 */
229 OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
230 OMAP_DSS_OUTPUT_DSI2,
231};
232
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530233static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
234 /* OMAP_DSS_GFX */
235 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
236 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
237 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
238 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
239
240 /* OMAP_DSS_VIDEO1 */
241 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
242 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
243 OMAP_DSS_COLOR_UYVY,
244
245 /* OMAP_DSS_VIDEO2 */
246 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
247 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
248 OMAP_DSS_COLOR_UYVY,
249};
250
251static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
252 /* OMAP_DSS_GFX */
253 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
254 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
255 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
256 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
257 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
258 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
259
260 /* OMAP_DSS_VIDEO1 */
261 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
262 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
263 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
264
265 /* OMAP_DSS_VIDEO2 */
266 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
267 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
268 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
269 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
270 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
271};
272
Amber Jainf20e4222011-05-19 19:47:50 +0530273static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
274 /* OMAP_DSS_GFX */
275 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
276 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
277 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
278 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
279 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
280 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
Lajos Molnar08f32672012-02-21 19:36:30 +0530281 OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
282 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
Amber Jainf20e4222011-05-19 19:47:50 +0530283
284 /* OMAP_DSS_VIDEO1 */
285 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
286 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
287 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
288 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
289 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
290 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
291 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
292 OMAP_DSS_COLOR_RGBX32,
293
294 /* OMAP_DSS_VIDEO2 */
295 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
296 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
297 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
298 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
299 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
300 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
301 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
302 OMAP_DSS_COLOR_RGBX32,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530303
304 /* OMAP_DSS_VIDEO3 */
305 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
306 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
307 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
308 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
309 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
310 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
311 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
312 OMAP_DSS_COLOR_RGBX32,
Amber Jainf20e4222011-05-19 19:47:50 +0530313};
314
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300315static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
316 /* OMAP_DSS_GFX */
317 0,
318
319 /* OMAP_DSS_VIDEO1 */
320 OMAP_DSS_OVL_CAP_SCALE,
321
322 /* OMAP_DSS_VIDEO2 */
323 OMAP_DSS_OVL_CAP_SCALE,
324};
325
326static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
327 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300328 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300329
330 /* OMAP_DSS_VIDEO1 */
331 OMAP_DSS_OVL_CAP_SCALE,
332
333 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300334 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300335};
336
337static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
338 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300339 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300340
341 /* OMAP_DSS_VIDEO1 */
342 OMAP_DSS_OVL_CAP_SCALE,
343
344 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300345 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
346 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300347};
348
349static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
350 /* OMAP_DSS_GFX */
Archit Taneja11354dd2011-09-26 11:47:29 +0530351 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
352 OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300353
354 /* OMAP_DSS_VIDEO1 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300355 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
Archit Taneja11354dd2011-09-26 11:47:29 +0530356 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300357
358 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300359 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
Archit Taneja11354dd2011-09-26 11:47:29 +0530360 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530361
362 /* OMAP_DSS_VIDEO3 */
363 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
364 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300365};
366
Taneja, Archit235e7db2011-03-14 23:28:21 -0500367static const char * const omap2_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530368 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
369 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
370 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
Archit Taneja067a57e2011-03-02 11:57:25 +0530371};
372
Taneja, Archit235e7db2011-03-14 23:28:21 -0500373static const char * const omap3_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530374 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
375 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
376 [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
Archit Taneja067a57e2011-03-02 11:57:25 +0530377};
378
Taneja, Archit235e7db2011-03-14 23:28:21 -0500379static const char * const omap4_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530380 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
381 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
382 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
Archit Taneja5a8b5722011-05-12 17:26:29 +0530383 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
384 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
Taneja, Architea751592011-03-08 05:50:35 -0600385};
386
Archit Taneja23362832012-04-08 16:47:01 +0530387static const char * const omap5_dss_clk_source_names[] = {
388 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DPLL_DSI1_A_CLK1",
389 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DPLL_DSI1_A_CLK2",
390 [OMAP_DSS_CLK_SRC_FCK] = "DSS_CLK",
391 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "DPLL_DSI1_C_CLK1",
392 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "DPLL_DSI1_C_CLK2",
393};
394
Taneja, Archit31ef8232011-03-14 23:28:22 -0500395static const struct dss_param_range omap2_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500396 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300397 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500398 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
399 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
400 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
401 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
402 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
403 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530404 [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530405 /*
406 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
407 * scaler cannot scale a image with width more than 768.
408 */
409 [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
Archit Taneja8f366162012-04-16 12:53:44 +0530410 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
411 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500412};
413
414static const struct dss_param_range omap3_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500415 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300416 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500417 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
418 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
419 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
420 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
421 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
422 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
Tomi Valkeinenbc63f302012-08-16 16:25:29 +0300423 [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530424 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530425 [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
Archit Taneja8f366162012-04-16 12:53:44 +0530426 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
427 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500428};
429
430static const struct dss_param_range omap4_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500431 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300432 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500433 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
434 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
435 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
436 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
437 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
438 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
Tomi Valkeinenbc63f302012-08-16 16:25:29 +0300439 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530440 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530441 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
Archit Taneja8f366162012-04-16 12:53:44 +0530442 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
443 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500444};
445
Archit Taneja23362832012-04-08 16:47:01 +0530446static const struct dss_param_range omap5_dss_param_range[] = {
447 [FEAT_PARAM_DSS_FCK] = { 0, 200000000 },
448 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
449 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
450 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
451 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
452 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
453 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
454 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
455 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
456 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
457 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
458 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
459 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
460};
461
Archit Tanejac124f232012-01-30 10:52:39 +0530462static const enum dss_feat_id omap2_dss_feat_list[] = {
463 FEAT_LCDENABLEPOL,
464 FEAT_LCDENABLESIGNAL,
465 FEAT_PCKFREEENABLE,
466 FEAT_FUNCGATED,
467 FEAT_ROWREPEATENABLE,
468 FEAT_RESIZECONF,
469};
470
471static const enum dss_feat_id omap3430_dss_feat_list[] = {
472 FEAT_LCDENABLEPOL,
473 FEAT_LCDENABLESIGNAL,
474 FEAT_PCKFREEENABLE,
475 FEAT_FUNCGATED,
476 FEAT_LINEBUFFERSPLIT,
477 FEAT_ROWREPEATENABLE,
478 FEAT_RESIZECONF,
479 FEAT_DSI_PLL_FREQSEL,
480 FEAT_DSI_REVERSE_TXCLKESC,
481 FEAT_VENC_REQUIRES_TV_DAC_CLK,
482 FEAT_CPR,
483 FEAT_PRELOAD,
484 FEAT_FIR_COEF_V,
485 FEAT_ALPHA_FIXED_ZORDER,
486 FEAT_FIFO_MERGE,
487 FEAT_OMAP3_DSI_FIFO_BUG,
Chandrabhanu Mahapatra195e6722012-08-22 11:44:06 +0530488 FEAT_DPI_USES_VDDS_DSI,
Archit Tanejac124f232012-01-30 10:52:39 +0530489};
490
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400491static const enum dss_feat_id am35xx_dss_feat_list[] = {
492 FEAT_LCDENABLEPOL,
493 FEAT_LCDENABLESIGNAL,
494 FEAT_PCKFREEENABLE,
495 FEAT_FUNCGATED,
496 FEAT_LINEBUFFERSPLIT,
497 FEAT_ROWREPEATENABLE,
498 FEAT_RESIZECONF,
499 FEAT_DSI_PLL_FREQSEL,
500 FEAT_DSI_REVERSE_TXCLKESC,
501 FEAT_VENC_REQUIRES_TV_DAC_CLK,
502 FEAT_CPR,
503 FEAT_PRELOAD,
504 FEAT_FIR_COEF_V,
505 FEAT_ALPHA_FIXED_ZORDER,
506 FEAT_FIFO_MERGE,
507 FEAT_OMAP3_DSI_FIFO_BUG,
508};
509
Archit Tanejac124f232012-01-30 10:52:39 +0530510static const enum dss_feat_id omap3630_dss_feat_list[] = {
511 FEAT_LCDENABLEPOL,
512 FEAT_LCDENABLESIGNAL,
513 FEAT_PCKFREEENABLE,
514 FEAT_FUNCGATED,
515 FEAT_LINEBUFFERSPLIT,
516 FEAT_ROWREPEATENABLE,
517 FEAT_RESIZECONF,
518 FEAT_DSI_PLL_PWR_BUG,
519 FEAT_DSI_PLL_FREQSEL,
520 FEAT_CPR,
521 FEAT_PRELOAD,
522 FEAT_FIR_COEF_V,
523 FEAT_ALPHA_FIXED_ZORDER,
524 FEAT_FIFO_MERGE,
525 FEAT_OMAP3_DSI_FIFO_BUG,
526};
527
528static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
529 FEAT_MGR_LCD2,
530 FEAT_CORE_CLK_DIV,
531 FEAT_LCD_CLK_SRC,
532 FEAT_DSI_DCS_CMD_CONFIG_VC,
533 FEAT_DSI_VC_OCP_WIDTH,
534 FEAT_DSI_GNQ,
535 FEAT_HANDLE_UV_SEPARATE,
536 FEAT_ATTR2,
537 FEAT_CPR,
538 FEAT_PRELOAD,
539 FEAT_FIR_COEF_V,
540 FEAT_ALPHA_FREE_ZORDER,
541 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530542 FEAT_BURST_2D,
Archit Tanejac124f232012-01-30 10:52:39 +0530543};
544
Ricardo Neri70988192012-02-16 09:20:57 -0600545static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
546 FEAT_MGR_LCD2,
547 FEAT_CORE_CLK_DIV,
548 FEAT_LCD_CLK_SRC,
549 FEAT_DSI_DCS_CMD_CONFIG_VC,
550 FEAT_DSI_VC_OCP_WIDTH,
551 FEAT_DSI_GNQ,
552 FEAT_HDMI_CTS_SWMODE,
553 FEAT_HANDLE_UV_SEPARATE,
554 FEAT_ATTR2,
555 FEAT_CPR,
556 FEAT_PRELOAD,
557 FEAT_FIR_COEF_V,
558 FEAT_ALPHA_FREE_ZORDER,
559 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530560 FEAT_BURST_2D,
Ricardo Neri70988192012-02-16 09:20:57 -0600561};
562
Archit Tanejac124f232012-01-30 10:52:39 +0530563static const enum dss_feat_id omap4_dss_feat_list[] = {
564 FEAT_MGR_LCD2,
565 FEAT_CORE_CLK_DIV,
566 FEAT_LCD_CLK_SRC,
567 FEAT_DSI_DCS_CMD_CONFIG_VC,
568 FEAT_DSI_VC_OCP_WIDTH,
569 FEAT_DSI_GNQ,
570 FEAT_HDMI_CTS_SWMODE,
Ricardo Neri70988192012-02-16 09:20:57 -0600571 FEAT_HDMI_AUDIO_USE_MCLK,
Archit Tanejac124f232012-01-30 10:52:39 +0530572 FEAT_HANDLE_UV_SEPARATE,
573 FEAT_ATTR2,
574 FEAT_CPR,
575 FEAT_PRELOAD,
576 FEAT_FIR_COEF_V,
577 FEAT_ALPHA_FREE_ZORDER,
578 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530579 FEAT_BURST_2D,
Archit Tanejac124f232012-01-30 10:52:39 +0530580};
581
Archit Taneja23362832012-04-08 16:47:01 +0530582static const enum dss_feat_id omap5_dss_feat_list[] = {
583 FEAT_MGR_LCD2,
584 FEAT_CORE_CLK_DIV,
585 FEAT_LCD_CLK_SRC,
586 FEAT_DSI_DCS_CMD_CONFIG_VC,
587 FEAT_DSI_VC_OCP_WIDTH,
588 FEAT_DSI_GNQ,
589 FEAT_HDMI_CTS_SWMODE,
590 FEAT_HDMI_AUDIO_USE_MCLK,
591 FEAT_HANDLE_UV_SEPARATE,
592 FEAT_ATTR2,
593 FEAT_CPR,
594 FEAT_PRELOAD,
595 FEAT_FIR_COEF_V,
596 FEAT_ALPHA_FREE_ZORDER,
597 FEAT_FIFO_MERGE,
598 FEAT_BURST_2D,
Tomi Valkeinenf8ef3d62012-08-22 16:00:31 +0300599 FEAT_DSI_PLL_SELFREQDCO,
Tomi Valkeinen6d446102012-08-22 16:00:40 +0300600 FEAT_DSI_PLL_REFSEL,
Tomi Valkeinen77ccbfb2012-09-24 15:15:57 +0300601 FEAT_DSI_PHY_DCC,
Archit Taneja23362832012-04-08 16:47:01 +0530602};
603
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530604/* OMAP2 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300605static const struct omap_dss_features omap2_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530606 .reg_fields = omap2_dss_reg_fields,
607 .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
608
Archit Tanejac124f232012-01-30 10:52:39 +0530609 .features = omap2_dss_feat_list,
610 .num_features = ARRAY_SIZE(omap2_dss_feat_list),
Archit Tanejad50cd032010-12-02 11:27:08 +0000611
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530612 .num_mgrs = 2,
613 .num_ovls = 3,
614 .supported_displays = omap2_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530615 .supported_outputs = omap2_dss_supported_outputs,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530616 .supported_color_modes = omap2_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300617 .overlay_caps = omap2_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530618 .clksrc_names = omap2_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500619 .dss_params = omap2_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530620 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300621 .buffer_size_unit = 1,
622 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530623};
624
625/* OMAP3 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300626static const struct omap_dss_features omap3430_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530627 .reg_fields = omap3_dss_reg_fields,
628 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
629
Archit Tanejac124f232012-01-30 10:52:39 +0530630 .features = omap3430_dss_feat_list,
631 .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530632
633 .num_mgrs = 2,
634 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200635 .supported_displays = omap3430_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530636 .supported_outputs = omap3430_dss_supported_outputs,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530637 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300638 .overlay_caps = omap3430_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530639 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500640 .dss_params = omap3_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530641 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300642 .buffer_size_unit = 1,
643 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530644};
645
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400646/*
647 * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
648 * vdds_dsi regulator.
649 */
650static const struct omap_dss_features am35xx_dss_features = {
651 .reg_fields = omap3_dss_reg_fields,
652 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
653
654 .features = am35xx_dss_feat_list,
655 .num_features = ARRAY_SIZE(am35xx_dss_feat_list),
656
657 .num_mgrs = 2,
658 .num_ovls = 3,
659 .supported_displays = omap3430_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530660 .supported_outputs = omap3430_dss_supported_outputs,
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400661 .supported_color_modes = omap3_dss_supported_color_modes,
662 .overlay_caps = omap3430_dss_overlay_caps,
663 .clksrc_names = omap3_dss_clk_source_names,
664 .dss_params = omap3_dss_param_range,
665 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
666 .buffer_size_unit = 1,
667 .burst_size_unit = 8,
668};
669
Tomi Valkeinenea290332011-04-20 10:09:36 +0300670static const struct omap_dss_features omap3630_dss_features = {
Samreen8fbde102010-11-04 12:28:41 +0100671 .reg_fields = omap3_dss_reg_fields,
672 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
673
Archit Tanejac124f232012-01-30 10:52:39 +0530674 .features = omap3630_dss_feat_list,
675 .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
Samreen8fbde102010-11-04 12:28:41 +0100676
677 .num_mgrs = 2,
678 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200679 .supported_displays = omap3630_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530680 .supported_outputs = omap3630_dss_supported_outputs,
Samreen8fbde102010-11-04 12:28:41 +0100681 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300682 .overlay_caps = omap3630_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530683 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500684 .dss_params = omap3_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530685 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300686 .buffer_size_unit = 1,
687 .burst_size_unit = 8,
Samreen8fbde102010-11-04 12:28:41 +0100688};
689
Archit Tanejad50cd032010-12-02 11:27:08 +0000690/* OMAP4 DSS Features */
Ricardo Neri6ff70842011-05-18 22:23:33 -0500691/* For OMAP4430 ES 1.0 revision */
692static const struct omap_dss_features omap4430_es1_0_dss_features = {
693 .reg_fields = omap4_dss_reg_fields,
694 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
695
Archit Tanejac124f232012-01-30 10:52:39 +0530696 .features = omap4430_es1_0_dss_feat_list,
697 .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
Ricardo Neri6ff70842011-05-18 22:23:33 -0500698
699 .num_mgrs = 3,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530700 .num_ovls = 4,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500701 .supported_displays = omap4_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530702 .supported_outputs = omap4_dss_supported_outputs,
Amber Jainf20e4222011-05-19 19:47:50 +0530703 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300704 .overlay_caps = omap4_dss_overlay_caps,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500705 .clksrc_names = omap4_dss_clk_source_names,
706 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530707 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300708 .buffer_size_unit = 16,
709 .burst_size_unit = 16,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500710};
711
Ricardo Neri70988192012-02-16 09:20:57 -0600712/* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
713static 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),
716
717 .features = omap4430_es2_0_1_2_dss_feat_list,
718 .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
719
720 .num_mgrs = 3,
721 .num_ovls = 4,
722 .supported_displays = omap4_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530723 .supported_outputs = omap4_dss_supported_outputs,
Ricardo Neri70988192012-02-16 09:20:57 -0600724 .supported_color_modes = omap4_dss_supported_color_modes,
725 .overlay_caps = omap4_dss_overlay_caps,
726 .clksrc_names = omap4_dss_clk_source_names,
727 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530728 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Ricardo Neri70988192012-02-16 09:20:57 -0600729 .buffer_size_unit = 16,
730 .burst_size_unit = 16,
731};
732
Ricardo Neri6ff70842011-05-18 22:23:33 -0500733/* For all the other OMAP4 versions */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300734static const struct omap_dss_features omap4_dss_features = {
Archit Taneja87a74842011-03-02 11:19:50 +0530735 .reg_fields = omap4_dss_reg_fields,
736 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
Archit Tanejad50cd032010-12-02 11:27:08 +0000737
Archit Tanejac124f232012-01-30 10:52:39 +0530738 .features = omap4_dss_feat_list,
739 .num_features = ARRAY_SIZE(omap4_dss_feat_list),
Archit Tanejad50cd032010-12-02 11:27:08 +0000740
741 .num_mgrs = 3,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530742 .num_ovls = 4,
Archit Tanejad50cd032010-12-02 11:27:08 +0000743 .supported_displays = omap4_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530744 .supported_outputs = omap4_dss_supported_outputs,
Amber Jainf20e4222011-05-19 19:47:50 +0530745 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300746 .overlay_caps = omap4_dss_overlay_caps,
Taneja, Architea751592011-03-08 05:50:35 -0600747 .clksrc_names = omap4_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500748 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530749 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300750 .buffer_size_unit = 16,
751 .burst_size_unit = 16,
Archit Tanejad50cd032010-12-02 11:27:08 +0000752};
753
Archit Taneja23362832012-04-08 16:47:01 +0530754/* OMAP5 DSS Features */
755static const struct omap_dss_features omap5_dss_features = {
756 .reg_fields = omap5_dss_reg_fields,
757 .num_reg_fields = ARRAY_SIZE(omap5_dss_reg_fields),
758
759 .features = omap5_dss_feat_list,
760 .num_features = ARRAY_SIZE(omap5_dss_feat_list),
761
762 .num_mgrs = 3,
763 .num_ovls = 4,
764 .supported_displays = omap5_dss_supported_displays,
Archit Taneja97f01b32012-09-26 16:42:39 +0530765 .supported_outputs = omap5_dss_supported_outputs,
Archit Taneja23362832012-04-08 16:47:01 +0530766 .supported_color_modes = omap4_dss_supported_color_modes,
767 .overlay_caps = omap4_dss_overlay_caps,
768 .clksrc_names = omap5_dss_clk_source_names,
769 .dss_params = omap5_dss_param_range,
770 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
771 .buffer_size_unit = 16,
772 .burst_size_unit = 16,
773};
774
Mythri P K60634a22011-09-08 19:06:26 +0530775#if defined(CONFIG_OMAP4_DSS_HDMI)
776/* HDMI OMAP4 Functions*/
777static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
778
779 .video_configure = ti_hdmi_4xxx_basic_configure,
780 .phy_enable = ti_hdmi_4xxx_phy_enable,
781 .phy_disable = ti_hdmi_4xxx_phy_disable,
782 .read_edid = ti_hdmi_4xxx_read_edid,
Tomi Valkeinen759593f2011-08-29 18:10:20 +0300783 .detect = ti_hdmi_4xxx_detect,
Mythri P K60634a22011-09-08 19:06:26 +0530784 .pll_enable = ti_hdmi_4xxx_pll_enable,
785 .pll_disable = ti_hdmi_4xxx_pll_disable,
786 .video_enable = ti_hdmi_4xxx_wp_video_start,
Ricardo Neric0456be2012-04-27 13:48:45 -0500787 .video_disable = ti_hdmi_4xxx_wp_video_stop,
Mythri P K162874d2011-09-22 13:37:45 +0530788 .dump_wrapper = ti_hdmi_4xxx_wp_dump,
789 .dump_core = ti_hdmi_4xxx_core_dump,
790 .dump_pll = ti_hdmi_4xxx_pll_dump,
791 .dump_phy = ti_hdmi_4xxx_phy_dump,
Ricardo Neri7e151f72012-03-15 14:08:03 -0600792#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
Ricardo Neri80a48592011-11-27 16:09:58 -0600793 .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
Ricardo Neri027bdc82012-04-20 17:17:46 -0500794 .audio_disable = ti_hdmi_4xxx_wp_audio_disable,
Axel Castaneda Gonzalez3df9fb52012-05-03 09:00:21 -0500795 .audio_start = ti_hdmi_4xxx_audio_start,
796 .audio_stop = ti_hdmi_4xxx_audio_stop,
Ricardo Neri6ec355d2012-03-21 12:38:15 -0600797 .audio_config = ti_hdmi_4xxx_audio_config,
Ricardo Neri80a48592011-11-27 16:09:58 -0600798#endif
Mythri P K162874d2011-09-22 13:37:45 +0530799
Mythri P K60634a22011-09-08 19:06:26 +0530800};
801
802void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
803{
804 if (cpu_is_omap44xx())
805 ip_data->ops = &omap4_hdmi_functions;
806}
807#endif
808
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530809/* Functions returning values related to a DSS feature */
810int dss_feat_get_num_mgrs(void)
811{
812 return omap_current_dss_features->num_mgrs;
813}
814
815int dss_feat_get_num_ovls(void)
816{
817 return omap_current_dss_features->num_ovls;
818}
819
Taneja, Archit31ef8232011-03-14 23:28:22 -0500820unsigned long dss_feat_get_param_min(enum dss_range_param param)
Archit Taneja819d8072011-03-01 11:54:00 +0530821{
Taneja, Archit31ef8232011-03-14 23:28:22 -0500822 return omap_current_dss_features->dss_params[param].min;
823}
824
825unsigned long dss_feat_get_param_max(enum dss_range_param param)
826{
827 return omap_current_dss_features->dss_params[param].max;
Archit Taneja819d8072011-03-01 11:54:00 +0530828}
829
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530830enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
831{
832 return omap_current_dss_features->supported_displays[channel];
833}
834
Archit Taneja97f01b32012-09-26 16:42:39 +0530835enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel)
836{
837 return omap_current_dss_features->supported_outputs[channel];
838}
839
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530840enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
841{
842 return omap_current_dss_features->supported_color_modes[plane];
843}
844
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300845enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
846{
847 return omap_current_dss_features->overlay_caps[plane];
848}
849
Archit Taneja8dad2ab2010-11-25 17:58:10 +0530850bool dss_feat_color_mode_supported(enum omap_plane plane,
851 enum omap_color_mode color_mode)
852{
853 return omap_current_dss_features->supported_color_modes[plane] &
854 color_mode;
855}
856
Archit Taneja89a35e52011-04-12 13:52:23 +0530857const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
Archit Taneja067a57e2011-03-02 11:57:25 +0530858{
Taneja, Archit235e7db2011-03-14 23:28:21 -0500859 return omap_current_dss_features->clksrc_names[id];
Archit Taneja067a57e2011-03-02 11:57:25 +0530860}
861
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300862u32 dss_feat_get_buffer_size_unit(void)
863{
864 return omap_current_dss_features->buffer_size_unit;
865}
866
867u32 dss_feat_get_burst_size_unit(void)
868{
869 return omap_current_dss_features->burst_size_unit;
870}
871
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530872/* DSS has_feature check */
873bool dss_has_feature(enum dss_feat_id id)
874{
Archit Tanejac124f232012-01-30 10:52:39 +0530875 int i;
876 const enum dss_feat_id *features = omap_current_dss_features->features;
877 const int num_features = omap_current_dss_features->num_features;
878
879 for (i = 0; i < num_features; i++) {
880 if (features[i] == id)
881 return true;
882 }
883
884 return false;
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530885}
886
887void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
888{
889 if (id >= omap_current_dss_features->num_reg_fields)
890 BUG();
891
892 *start = omap_current_dss_features->reg_fields[id].start;
893 *end = omap_current_dss_features->reg_fields[id].end;
894}
895
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530896bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
897{
898 return omap_current_dss_features->supported_rotation_types & rot_type;
899}
900
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530901void dss_features_init(void)
902{
903 if (cpu_is_omap24xx())
904 omap_current_dss_features = &omap2_dss_features;
Samreen8fbde102010-11-04 12:28:41 +0100905 else if (cpu_is_omap3630())
906 omap_current_dss_features = &omap3630_dss_features;
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400907 else if (cpu_is_omap34xx()) {
908 if (soc_is_am35xx()) {
909 omap_current_dss_features = &am35xx_dss_features;
910 } else {
911 omap_current_dss_features = &omap3430_dss_features;
912 }
913 }
Ricardo Neri6ff70842011-05-18 22:23:33 -0500914 else if (omap_rev() == OMAP4430_REV_ES1_0)
915 omap_current_dss_features = &omap4430_es1_0_dss_features;
Ricardo Neri70988192012-02-16 09:20:57 -0600916 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
917 omap_rev() == OMAP4430_REV_ES2_1 ||
918 omap_rev() == OMAP4430_REV_ES2_2)
919 omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500920 else if (cpu_is_omap44xx())
Archit Tanejad50cd032010-12-02 11:27:08 +0000921 omap_current_dss_features = &omap4_dss_features;
Archit Taneja23362832012-04-08 16:47:01 +0530922 else if (soc_is_omap54xx())
923 omap_current_dss_features = &omap5_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500924 else
925 DSSWARN("Unsupported OMAP version");
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530926}