blob: 47c15304fe87008c242aa9a58d3d18df427cc855 [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
109static const enum omap_display_type omap2_dss_supported_displays[] = {
110 /* OMAP_DSS_CHANNEL_LCD */
Tomi Valkeinenf8df01f2011-02-24 14:21:25 +0200111 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530112
113 /* OMAP_DSS_CHANNEL_DIGIT */
114 OMAP_DISPLAY_TYPE_VENC,
115};
116
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200117static const enum omap_display_type omap3430_dss_supported_displays[] = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530118 /* OMAP_DSS_CHANNEL_LCD */
119 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
120 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
121
122 /* OMAP_DSS_CHANNEL_DIGIT */
123 OMAP_DISPLAY_TYPE_VENC,
124};
125
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200126static const enum omap_display_type omap3630_dss_supported_displays[] = {
127 /* OMAP_DSS_CHANNEL_LCD */
128 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
129 OMAP_DISPLAY_TYPE_DSI,
130
131 /* OMAP_DSS_CHANNEL_DIGIT */
132 OMAP_DISPLAY_TYPE_VENC,
133};
134
Archit Tanejad50cd032010-12-02 11:27:08 +0000135static const enum omap_display_type omap4_dss_supported_displays[] = {
136 /* OMAP_DSS_CHANNEL_LCD */
137 OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
138
139 /* OMAP_DSS_CHANNEL_DIGIT */
Mythri P Kb1196012011-03-08 17:15:54 +0530140 OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
Archit Tanejad50cd032010-12-02 11:27:08 +0000141
142 /* OMAP_DSS_CHANNEL_LCD2 */
143 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
144 OMAP_DISPLAY_TYPE_DSI,
145};
146
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530147static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
148 /* OMAP_DSS_GFX */
149 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
150 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
151 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
152 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
153
154 /* OMAP_DSS_VIDEO1 */
155 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
156 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
157 OMAP_DSS_COLOR_UYVY,
158
159 /* OMAP_DSS_VIDEO2 */
160 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
161 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
162 OMAP_DSS_COLOR_UYVY,
163};
164
165static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
166 /* OMAP_DSS_GFX */
167 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
168 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
169 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
170 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
171 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
172 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
173
174 /* OMAP_DSS_VIDEO1 */
175 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
176 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
177 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
178
179 /* OMAP_DSS_VIDEO2 */
180 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
181 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
182 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
183 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
184 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
185};
186
Amber Jainf20e4222011-05-19 19:47:50 +0530187static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
188 /* OMAP_DSS_GFX */
189 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
190 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
191 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
192 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
193 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
194 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
Lajos Molnar08f32672012-02-21 19:36:30 +0530195 OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
196 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
Amber Jainf20e4222011-05-19 19:47:50 +0530197
198 /* OMAP_DSS_VIDEO1 */
199 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
200 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
201 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
202 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
203 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
204 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
205 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
206 OMAP_DSS_COLOR_RGBX32,
207
208 /* OMAP_DSS_VIDEO2 */
209 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
210 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
211 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
212 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
213 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
214 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
215 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
216 OMAP_DSS_COLOR_RGBX32,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530217
218 /* OMAP_DSS_VIDEO3 */
219 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
220 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
221 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
222 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
223 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
224 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
225 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
226 OMAP_DSS_COLOR_RGBX32,
Amber Jainf20e4222011-05-19 19:47:50 +0530227};
228
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300229static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
230 /* OMAP_DSS_GFX */
231 0,
232
233 /* OMAP_DSS_VIDEO1 */
234 OMAP_DSS_OVL_CAP_SCALE,
235
236 /* OMAP_DSS_VIDEO2 */
237 OMAP_DSS_OVL_CAP_SCALE,
238};
239
240static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
241 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300242 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300243
244 /* OMAP_DSS_VIDEO1 */
245 OMAP_DSS_OVL_CAP_SCALE,
246
247 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300248 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300249};
250
251static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
252 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300253 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300254
255 /* OMAP_DSS_VIDEO1 */
256 OMAP_DSS_OVL_CAP_SCALE,
257
258 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300259 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
260 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300261};
262
263static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
264 /* OMAP_DSS_GFX */
Archit Taneja11354dd2011-09-26 11:47:29 +0530265 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
266 OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300267
268 /* OMAP_DSS_VIDEO1 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300269 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
Archit Taneja11354dd2011-09-26 11:47:29 +0530270 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300271
272 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300273 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
Archit Taneja11354dd2011-09-26 11:47:29 +0530274 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530275
276 /* OMAP_DSS_VIDEO3 */
277 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
278 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300279};
280
Taneja, Archit235e7db2011-03-14 23:28:21 -0500281static const char * const omap2_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530282 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
283 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
284 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
Archit Taneja067a57e2011-03-02 11:57:25 +0530285};
286
Taneja, Archit235e7db2011-03-14 23:28:21 -0500287static const char * const omap3_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530288 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
289 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
290 [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
Archit Taneja067a57e2011-03-02 11:57:25 +0530291};
292
Taneja, Archit235e7db2011-03-14 23:28:21 -0500293static const char * const omap4_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530294 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
295 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
296 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
Archit Taneja5a8b5722011-05-12 17:26:29 +0530297 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
298 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
Taneja, Architea751592011-03-08 05:50:35 -0600299};
300
Taneja, Archit31ef8232011-03-14 23:28:22 -0500301static const struct dss_param_range omap2_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500302 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300303 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500304 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
305 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
306 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
307 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
308 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
309 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530310 [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530311 /*
312 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
313 * scaler cannot scale a image with width more than 768.
314 */
315 [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
Archit Taneja8f366162012-04-16 12:53:44 +0530316 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
317 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500318};
319
320static const struct dss_param_range omap3_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500321 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300322 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500323 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
324 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
325 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
326 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
327 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
328 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
Tomi Valkeinenbc63f302012-08-16 16:25:29 +0300329 [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530330 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530331 [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
Archit Taneja8f366162012-04-16 12:53:44 +0530332 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
333 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500334};
335
336static const struct dss_param_range omap4_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500337 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300338 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500339 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
340 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
341 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
342 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
343 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
344 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
Tomi Valkeinenbc63f302012-08-16 16:25:29 +0300345 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
Archit Taneja0373cac2011-09-08 13:25:17 +0530346 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
Chandrabhanu Mahapatra7282f1b2011-12-19 14:03:56 +0530347 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
Archit Taneja8f366162012-04-16 12:53:44 +0530348 [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 },
349 [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500350};
351
Archit Tanejac124f232012-01-30 10:52:39 +0530352static const enum dss_feat_id omap2_dss_feat_list[] = {
353 FEAT_LCDENABLEPOL,
354 FEAT_LCDENABLESIGNAL,
355 FEAT_PCKFREEENABLE,
356 FEAT_FUNCGATED,
357 FEAT_ROWREPEATENABLE,
358 FEAT_RESIZECONF,
359};
360
361static const enum dss_feat_id omap3430_dss_feat_list[] = {
362 FEAT_LCDENABLEPOL,
363 FEAT_LCDENABLESIGNAL,
364 FEAT_PCKFREEENABLE,
365 FEAT_FUNCGATED,
366 FEAT_LINEBUFFERSPLIT,
367 FEAT_ROWREPEATENABLE,
368 FEAT_RESIZECONF,
369 FEAT_DSI_PLL_FREQSEL,
370 FEAT_DSI_REVERSE_TXCLKESC,
371 FEAT_VENC_REQUIRES_TV_DAC_CLK,
372 FEAT_CPR,
373 FEAT_PRELOAD,
374 FEAT_FIR_COEF_V,
375 FEAT_ALPHA_FIXED_ZORDER,
376 FEAT_FIFO_MERGE,
377 FEAT_OMAP3_DSI_FIFO_BUG,
Chandrabhanu Mahapatra195e6722012-08-22 11:44:06 +0530378 FEAT_DPI_USES_VDDS_DSI,
Archit Tanejac124f232012-01-30 10:52:39 +0530379};
380
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400381static const enum dss_feat_id am35xx_dss_feat_list[] = {
382 FEAT_LCDENABLEPOL,
383 FEAT_LCDENABLESIGNAL,
384 FEAT_PCKFREEENABLE,
385 FEAT_FUNCGATED,
386 FEAT_LINEBUFFERSPLIT,
387 FEAT_ROWREPEATENABLE,
388 FEAT_RESIZECONF,
389 FEAT_DSI_PLL_FREQSEL,
390 FEAT_DSI_REVERSE_TXCLKESC,
391 FEAT_VENC_REQUIRES_TV_DAC_CLK,
392 FEAT_CPR,
393 FEAT_PRELOAD,
394 FEAT_FIR_COEF_V,
395 FEAT_ALPHA_FIXED_ZORDER,
396 FEAT_FIFO_MERGE,
397 FEAT_OMAP3_DSI_FIFO_BUG,
398};
399
Archit Tanejac124f232012-01-30 10:52:39 +0530400static const enum dss_feat_id omap3630_dss_feat_list[] = {
401 FEAT_LCDENABLEPOL,
402 FEAT_LCDENABLESIGNAL,
403 FEAT_PCKFREEENABLE,
404 FEAT_FUNCGATED,
405 FEAT_LINEBUFFERSPLIT,
406 FEAT_ROWREPEATENABLE,
407 FEAT_RESIZECONF,
408 FEAT_DSI_PLL_PWR_BUG,
409 FEAT_DSI_PLL_FREQSEL,
410 FEAT_CPR,
411 FEAT_PRELOAD,
412 FEAT_FIR_COEF_V,
413 FEAT_ALPHA_FIXED_ZORDER,
414 FEAT_FIFO_MERGE,
415 FEAT_OMAP3_DSI_FIFO_BUG,
416};
417
418static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
419 FEAT_MGR_LCD2,
420 FEAT_CORE_CLK_DIV,
421 FEAT_LCD_CLK_SRC,
422 FEAT_DSI_DCS_CMD_CONFIG_VC,
423 FEAT_DSI_VC_OCP_WIDTH,
424 FEAT_DSI_GNQ,
425 FEAT_HANDLE_UV_SEPARATE,
426 FEAT_ATTR2,
427 FEAT_CPR,
428 FEAT_PRELOAD,
429 FEAT_FIR_COEF_V,
430 FEAT_ALPHA_FREE_ZORDER,
431 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530432 FEAT_BURST_2D,
Archit Tanejac124f232012-01-30 10:52:39 +0530433};
434
Ricardo Neri70988192012-02-16 09:20:57 -0600435static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
436 FEAT_MGR_LCD2,
437 FEAT_CORE_CLK_DIV,
438 FEAT_LCD_CLK_SRC,
439 FEAT_DSI_DCS_CMD_CONFIG_VC,
440 FEAT_DSI_VC_OCP_WIDTH,
441 FEAT_DSI_GNQ,
442 FEAT_HDMI_CTS_SWMODE,
443 FEAT_HANDLE_UV_SEPARATE,
444 FEAT_ATTR2,
445 FEAT_CPR,
446 FEAT_PRELOAD,
447 FEAT_FIR_COEF_V,
448 FEAT_ALPHA_FREE_ZORDER,
449 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530450 FEAT_BURST_2D,
Ricardo Neri70988192012-02-16 09:20:57 -0600451};
452
Archit Tanejac124f232012-01-30 10:52:39 +0530453static const enum dss_feat_id omap4_dss_feat_list[] = {
454 FEAT_MGR_LCD2,
455 FEAT_CORE_CLK_DIV,
456 FEAT_LCD_CLK_SRC,
457 FEAT_DSI_DCS_CMD_CONFIG_VC,
458 FEAT_DSI_VC_OCP_WIDTH,
459 FEAT_DSI_GNQ,
460 FEAT_HDMI_CTS_SWMODE,
Ricardo Neri70988192012-02-16 09:20:57 -0600461 FEAT_HDMI_AUDIO_USE_MCLK,
Archit Tanejac124f232012-01-30 10:52:39 +0530462 FEAT_HANDLE_UV_SEPARATE,
463 FEAT_ATTR2,
464 FEAT_CPR,
465 FEAT_PRELOAD,
466 FEAT_FIR_COEF_V,
467 FEAT_ALPHA_FREE_ZORDER,
468 FEAT_FIFO_MERGE,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530469 FEAT_BURST_2D,
Archit Tanejac124f232012-01-30 10:52:39 +0530470};
471
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530472/* OMAP2 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300473static const struct omap_dss_features omap2_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530474 .reg_fields = omap2_dss_reg_fields,
475 .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
476
Archit Tanejac124f232012-01-30 10:52:39 +0530477 .features = omap2_dss_feat_list,
478 .num_features = ARRAY_SIZE(omap2_dss_feat_list),
Archit Tanejad50cd032010-12-02 11:27:08 +0000479
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530480 .num_mgrs = 2,
481 .num_ovls = 3,
482 .supported_displays = omap2_dss_supported_displays,
483 .supported_color_modes = omap2_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300484 .overlay_caps = omap2_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530485 .clksrc_names = omap2_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500486 .dss_params = omap2_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530487 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300488 .buffer_size_unit = 1,
489 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530490};
491
492/* OMAP3 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300493static const struct omap_dss_features omap3430_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530494 .reg_fields = omap3_dss_reg_fields,
495 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
496
Archit Tanejac124f232012-01-30 10:52:39 +0530497 .features = omap3430_dss_feat_list,
498 .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530499
500 .num_mgrs = 2,
501 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200502 .supported_displays = omap3430_dss_supported_displays,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530503 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300504 .overlay_caps = omap3430_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530505 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500506 .dss_params = omap3_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530507 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300508 .buffer_size_unit = 1,
509 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530510};
511
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400512/*
513 * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
514 * vdds_dsi regulator.
515 */
516static const struct omap_dss_features am35xx_dss_features = {
517 .reg_fields = omap3_dss_reg_fields,
518 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
519
520 .features = am35xx_dss_feat_list,
521 .num_features = ARRAY_SIZE(am35xx_dss_feat_list),
522
523 .num_mgrs = 2,
524 .num_ovls = 3,
525 .supported_displays = omap3430_dss_supported_displays,
526 .supported_color_modes = omap3_dss_supported_color_modes,
527 .overlay_caps = omap3430_dss_overlay_caps,
528 .clksrc_names = omap3_dss_clk_source_names,
529 .dss_params = omap3_dss_param_range,
530 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
531 .buffer_size_unit = 1,
532 .burst_size_unit = 8,
533};
534
Tomi Valkeinenea290332011-04-20 10:09:36 +0300535static const struct omap_dss_features omap3630_dss_features = {
Samreen8fbde102010-11-04 12:28:41 +0100536 .reg_fields = omap3_dss_reg_fields,
537 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
538
Archit Tanejac124f232012-01-30 10:52:39 +0530539 .features = omap3630_dss_feat_list,
540 .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
Samreen8fbde102010-11-04 12:28:41 +0100541
542 .num_mgrs = 2,
543 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200544 .supported_displays = omap3630_dss_supported_displays,
Samreen8fbde102010-11-04 12:28:41 +0100545 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300546 .overlay_caps = omap3630_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530547 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500548 .dss_params = omap3_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530549 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300550 .buffer_size_unit = 1,
551 .burst_size_unit = 8,
Samreen8fbde102010-11-04 12:28:41 +0100552};
553
Archit Tanejad50cd032010-12-02 11:27:08 +0000554/* OMAP4 DSS Features */
Ricardo Neri6ff70842011-05-18 22:23:33 -0500555/* For OMAP4430 ES 1.0 revision */
556static const struct omap_dss_features omap4430_es1_0_dss_features = {
557 .reg_fields = omap4_dss_reg_fields,
558 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
559
Archit Tanejac124f232012-01-30 10:52:39 +0530560 .features = omap4430_es1_0_dss_feat_list,
561 .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
Ricardo Neri6ff70842011-05-18 22:23:33 -0500562
563 .num_mgrs = 3,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530564 .num_ovls = 4,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500565 .supported_displays = omap4_dss_supported_displays,
Amber Jainf20e4222011-05-19 19:47:50 +0530566 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300567 .overlay_caps = omap4_dss_overlay_caps,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500568 .clksrc_names = omap4_dss_clk_source_names,
569 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530570 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300571 .buffer_size_unit = 16,
572 .burst_size_unit = 16,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500573};
574
Ricardo Neri70988192012-02-16 09:20:57 -0600575/* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
576static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
577 .reg_fields = omap4_dss_reg_fields,
578 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
579
580 .features = omap4430_es2_0_1_2_dss_feat_list,
581 .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
582
583 .num_mgrs = 3,
584 .num_ovls = 4,
585 .supported_displays = omap4_dss_supported_displays,
586 .supported_color_modes = omap4_dss_supported_color_modes,
587 .overlay_caps = omap4_dss_overlay_caps,
588 .clksrc_names = omap4_dss_clk_source_names,
589 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530590 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Ricardo Neri70988192012-02-16 09:20:57 -0600591 .buffer_size_unit = 16,
592 .burst_size_unit = 16,
593};
594
Ricardo Neri6ff70842011-05-18 22:23:33 -0500595/* For all the other OMAP4 versions */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300596static const struct omap_dss_features omap4_dss_features = {
Archit Taneja87a74842011-03-02 11:19:50 +0530597 .reg_fields = omap4_dss_reg_fields,
598 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
Archit Tanejad50cd032010-12-02 11:27:08 +0000599
Archit Tanejac124f232012-01-30 10:52:39 +0530600 .features = omap4_dss_feat_list,
601 .num_features = ARRAY_SIZE(omap4_dss_feat_list),
Archit Tanejad50cd032010-12-02 11:27:08 +0000602
603 .num_mgrs = 3,
Archit Tanejab8c095b2011-09-13 18:20:33 +0530604 .num_ovls = 4,
Archit Tanejad50cd032010-12-02 11:27:08 +0000605 .supported_displays = omap4_dss_supported_displays,
Amber Jainf20e4222011-05-19 19:47:50 +0530606 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300607 .overlay_caps = omap4_dss_overlay_caps,
Taneja, Architea751592011-03-08 05:50:35 -0600608 .clksrc_names = omap4_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500609 .dss_params = omap4_dss_param_range,
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530610 .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300611 .buffer_size_unit = 16,
612 .burst_size_unit = 16,
Archit Tanejad50cd032010-12-02 11:27:08 +0000613};
614
Mythri P K60634a22011-09-08 19:06:26 +0530615#if defined(CONFIG_OMAP4_DSS_HDMI)
616/* HDMI OMAP4 Functions*/
617static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
618
619 .video_configure = ti_hdmi_4xxx_basic_configure,
620 .phy_enable = ti_hdmi_4xxx_phy_enable,
621 .phy_disable = ti_hdmi_4xxx_phy_disable,
622 .read_edid = ti_hdmi_4xxx_read_edid,
Tomi Valkeinen759593f2011-08-29 18:10:20 +0300623 .detect = ti_hdmi_4xxx_detect,
Mythri P K60634a22011-09-08 19:06:26 +0530624 .pll_enable = ti_hdmi_4xxx_pll_enable,
625 .pll_disable = ti_hdmi_4xxx_pll_disable,
626 .video_enable = ti_hdmi_4xxx_wp_video_start,
Ricardo Neric0456be2012-04-27 13:48:45 -0500627 .video_disable = ti_hdmi_4xxx_wp_video_stop,
Mythri P K162874d2011-09-22 13:37:45 +0530628 .dump_wrapper = ti_hdmi_4xxx_wp_dump,
629 .dump_core = ti_hdmi_4xxx_core_dump,
630 .dump_pll = ti_hdmi_4xxx_pll_dump,
631 .dump_phy = ti_hdmi_4xxx_phy_dump,
Ricardo Neri7e151f72012-03-15 14:08:03 -0600632#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
Ricardo Neri80a48592011-11-27 16:09:58 -0600633 .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
Ricardo Neri027bdc82012-04-20 17:17:46 -0500634 .audio_disable = ti_hdmi_4xxx_wp_audio_disable,
Axel Castaneda Gonzalez3df9fb52012-05-03 09:00:21 -0500635 .audio_start = ti_hdmi_4xxx_audio_start,
636 .audio_stop = ti_hdmi_4xxx_audio_stop,
Ricardo Neri6ec355d2012-03-21 12:38:15 -0600637 .audio_config = ti_hdmi_4xxx_audio_config,
Ricardo Neri80a48592011-11-27 16:09:58 -0600638#endif
Mythri P K162874d2011-09-22 13:37:45 +0530639
Mythri P K60634a22011-09-08 19:06:26 +0530640};
641
642void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
643{
644 if (cpu_is_omap44xx())
645 ip_data->ops = &omap4_hdmi_functions;
646}
647#endif
648
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530649/* Functions returning values related to a DSS feature */
650int dss_feat_get_num_mgrs(void)
651{
652 return omap_current_dss_features->num_mgrs;
653}
654
655int dss_feat_get_num_ovls(void)
656{
657 return omap_current_dss_features->num_ovls;
658}
659
Taneja, Archit31ef8232011-03-14 23:28:22 -0500660unsigned long dss_feat_get_param_min(enum dss_range_param param)
Archit Taneja819d8072011-03-01 11:54:00 +0530661{
Taneja, Archit31ef8232011-03-14 23:28:22 -0500662 return omap_current_dss_features->dss_params[param].min;
663}
664
665unsigned long dss_feat_get_param_max(enum dss_range_param param)
666{
667 return omap_current_dss_features->dss_params[param].max;
Archit Taneja819d8072011-03-01 11:54:00 +0530668}
669
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530670enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
671{
672 return omap_current_dss_features->supported_displays[channel];
673}
674
675enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
676{
677 return omap_current_dss_features->supported_color_modes[plane];
678}
679
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300680enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
681{
682 return omap_current_dss_features->overlay_caps[plane];
683}
684
Archit Taneja8dad2ab2010-11-25 17:58:10 +0530685bool dss_feat_color_mode_supported(enum omap_plane plane,
686 enum omap_color_mode color_mode)
687{
688 return omap_current_dss_features->supported_color_modes[plane] &
689 color_mode;
690}
691
Archit Taneja89a35e52011-04-12 13:52:23 +0530692const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
Archit Taneja067a57e2011-03-02 11:57:25 +0530693{
Taneja, Archit235e7db2011-03-14 23:28:21 -0500694 return omap_current_dss_features->clksrc_names[id];
Archit Taneja067a57e2011-03-02 11:57:25 +0530695}
696
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300697u32 dss_feat_get_buffer_size_unit(void)
698{
699 return omap_current_dss_features->buffer_size_unit;
700}
701
702u32 dss_feat_get_burst_size_unit(void)
703{
704 return omap_current_dss_features->burst_size_unit;
705}
706
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530707/* DSS has_feature check */
708bool dss_has_feature(enum dss_feat_id id)
709{
Archit Tanejac124f232012-01-30 10:52:39 +0530710 int i;
711 const enum dss_feat_id *features = omap_current_dss_features->features;
712 const int num_features = omap_current_dss_features->num_features;
713
714 for (i = 0; i < num_features; i++) {
715 if (features[i] == id)
716 return true;
717 }
718
719 return false;
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530720}
721
722void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
723{
724 if (id >= omap_current_dss_features->num_reg_fields)
725 BUG();
726
727 *start = omap_current_dss_features->reg_fields[id].start;
728 *end = omap_current_dss_features->reg_fields[id].end;
729}
730
Chandrabhanu Mahapatra65e006f2012-05-11 19:19:55 +0530731bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
732{
733 return omap_current_dss_features->supported_rotation_types & rot_type;
734}
735
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530736void dss_features_init(void)
737{
738 if (cpu_is_omap24xx())
739 omap_current_dss_features = &omap2_dss_features;
Samreen8fbde102010-11-04 12:28:41 +0100740 else if (cpu_is_omap3630())
741 omap_current_dss_features = &omap3630_dss_features;
Raphaël Assénat524d9f42012-09-19 15:53:14 -0400742 else if (cpu_is_omap34xx()) {
743 if (soc_is_am35xx()) {
744 omap_current_dss_features = &am35xx_dss_features;
745 } else {
746 omap_current_dss_features = &omap3430_dss_features;
747 }
748 }
Ricardo Neri6ff70842011-05-18 22:23:33 -0500749 else if (omap_rev() == OMAP4430_REV_ES1_0)
750 omap_current_dss_features = &omap4430_es1_0_dss_features;
Ricardo Neri70988192012-02-16 09:20:57 -0600751 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
752 omap_rev() == OMAP4430_REV_ES2_1 ||
753 omap_rev() == OMAP4430_REV_ES2_2)
754 omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500755 else if (cpu_is_omap44xx())
Archit Tanejad50cd032010-12-02 11:27:08 +0000756 omap_current_dss_features = &omap4_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500757 else
758 DSSWARN("Unsupported OMAP version");
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530759}