blob: 076f399a91533362fa3b09df993008afe7e56605 [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
44 const u32 has_feature;
45
46 const int num_mgrs;
47 const int num_ovls;
48 const enum omap_display_type *supported_displays;
49 const enum omap_color_mode *supported_color_modes;
Tomi Valkeinen67019db2011-08-15 15:18:15 +030050 const enum omap_overlay_caps *overlay_caps;
Taneja, Archit235e7db2011-03-14 23:28:21 -050051 const char * const *clksrc_names;
Taneja, Archit31ef8232011-03-14 23:28:22 -050052 const struct dss_param_range *dss_params;
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +030053
54 const u32 buffer_size_unit;
55 const u32 burst_size_unit;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053056};
57
58/* This struct is assigned to one of the below during initialization */
Tomi Valkeinenea290332011-04-20 10:09:36 +030059static const struct omap_dss_features *omap_current_dss_features;
Archit Tanejae1ef4d22010-09-15 18:47:29 +053060
61static const struct dss_reg_field omap2_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050062 [FEAT_REG_FIRHINC] = { 11, 0 },
63 [FEAT_REG_FIRVINC] = { 27, 16 },
64 [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
65 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
66 [FEAT_REG_FIFOSIZE] = { 8, 0 },
67 [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
68 [FEAT_REG_VERTICALACCU] = { 25, 16 },
69 [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
70 [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
71 [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
72 [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
73 [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 },
Archit Tanejae1ef4d22010-09-15 18:47:29 +053074};
75
76static const struct dss_reg_field omap3_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050077 [FEAT_REG_FIRHINC] = { 12, 0 },
78 [FEAT_REG_FIRVINC] = { 28, 16 },
79 [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
80 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
81 [FEAT_REG_FIFOSIZE] = { 10, 0 },
82 [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
83 [FEAT_REG_VERTICALACCU] = { 25, 16 },
84 [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
85 [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
86 [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
87 [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
88 [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
Archit Taneja87a74842011-03-02 11:19:50 +053089};
90
91static const struct dss_reg_field omap4_dss_reg_fields[] = {
Taneja, Archit49641112011-03-14 23:28:23 -050092 [FEAT_REG_FIRHINC] = { 12, 0 },
93 [FEAT_REG_FIRVINC] = { 28, 16 },
94 [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
95 [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
96 [FEAT_REG_FIFOSIZE] = { 15, 0 },
97 [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
98 [FEAT_REG_VERTICALACCU] = { 26, 16 },
99 [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
100 [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
101 [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
102 [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
103 [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530104};
105
106static const enum omap_display_type omap2_dss_supported_displays[] = {
107 /* OMAP_DSS_CHANNEL_LCD */
Tomi Valkeinenf8df01f2011-02-24 14:21:25 +0200108 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530109
110 /* OMAP_DSS_CHANNEL_DIGIT */
111 OMAP_DISPLAY_TYPE_VENC,
112};
113
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200114static const enum omap_display_type omap3430_dss_supported_displays[] = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530115 /* OMAP_DSS_CHANNEL_LCD */
116 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
117 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
118
119 /* OMAP_DSS_CHANNEL_DIGIT */
120 OMAP_DISPLAY_TYPE_VENC,
121};
122
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200123static const enum omap_display_type omap3630_dss_supported_displays[] = {
124 /* OMAP_DSS_CHANNEL_LCD */
125 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
126 OMAP_DISPLAY_TYPE_DSI,
127
128 /* OMAP_DSS_CHANNEL_DIGIT */
129 OMAP_DISPLAY_TYPE_VENC,
130};
131
Archit Tanejad50cd032010-12-02 11:27:08 +0000132static const enum omap_display_type omap4_dss_supported_displays[] = {
133 /* OMAP_DSS_CHANNEL_LCD */
134 OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
135
136 /* OMAP_DSS_CHANNEL_DIGIT */
Mythri P Kb1196012011-03-08 17:15:54 +0530137 OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
Archit Tanejad50cd032010-12-02 11:27:08 +0000138
139 /* OMAP_DSS_CHANNEL_LCD2 */
140 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
141 OMAP_DISPLAY_TYPE_DSI,
142};
143
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530144static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
145 /* OMAP_DSS_GFX */
146 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
147 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
148 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
149 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
150
151 /* OMAP_DSS_VIDEO1 */
152 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
153 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
154 OMAP_DSS_COLOR_UYVY,
155
156 /* OMAP_DSS_VIDEO2 */
157 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
158 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
159 OMAP_DSS_COLOR_UYVY,
160};
161
162static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
163 /* OMAP_DSS_GFX */
164 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
165 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
166 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
167 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
168 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
169 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
170
171 /* OMAP_DSS_VIDEO1 */
172 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
173 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
174 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
175
176 /* OMAP_DSS_VIDEO2 */
177 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
178 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
179 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
180 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
181 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
182};
183
Amber Jainf20e4222011-05-19 19:47:50 +0530184static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
185 /* OMAP_DSS_GFX */
186 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
187 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
188 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
189 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
190 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
191 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
192 OMAP_DSS_COLOR_ARGB16_1555,
193
194 /* OMAP_DSS_VIDEO1 */
195 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
196 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
197 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
198 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
199 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
200 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
201 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
202 OMAP_DSS_COLOR_RGBX32,
203
204 /* OMAP_DSS_VIDEO2 */
205 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
206 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
207 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
208 OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
209 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
210 OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
211 OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
212 OMAP_DSS_COLOR_RGBX32,
213};
214
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300215static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
216 /* OMAP_DSS_GFX */
217 0,
218
219 /* OMAP_DSS_VIDEO1 */
220 OMAP_DSS_OVL_CAP_SCALE,
221
222 /* OMAP_DSS_VIDEO2 */
223 OMAP_DSS_OVL_CAP_SCALE,
224};
225
226static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
227 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300228 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300229
230 /* OMAP_DSS_VIDEO1 */
231 OMAP_DSS_OVL_CAP_SCALE,
232
233 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300234 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300235};
236
237static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
238 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300239 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300240
241 /* OMAP_DSS_VIDEO1 */
242 OMAP_DSS_OVL_CAP_SCALE,
243
244 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300245 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
246 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300247};
248
249static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
250 /* OMAP_DSS_GFX */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300251 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300252
253 /* OMAP_DSS_VIDEO1 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300254 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
255 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300256
257 /* OMAP_DSS_VIDEO2 */
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300258 OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
259 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300260};
261
Taneja, Archit235e7db2011-03-14 23:28:21 -0500262static const char * const omap2_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530263 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
264 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
265 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
Archit Taneja067a57e2011-03-02 11:57:25 +0530266};
267
Taneja, Archit235e7db2011-03-14 23:28:21 -0500268static const char * const omap3_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530269 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
270 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
271 [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
Archit Taneja067a57e2011-03-02 11:57:25 +0530272};
273
Taneja, Archit235e7db2011-03-14 23:28:21 -0500274static const char * const omap4_dss_clk_source_names[] = {
Archit Taneja89a35e52011-04-12 13:52:23 +0530275 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
276 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
277 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
Archit Taneja5a8b5722011-05-12 17:26:29 +0530278 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
279 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
Taneja, Architea751592011-03-08 05:50:35 -0600280};
281
Taneja, Archit31ef8232011-03-14 23:28:22 -0500282static const struct dss_param_range omap2_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500283 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300284 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500285 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
286 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
287 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
288 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
289 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
290 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500291};
292
293static const struct dss_param_range omap3_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500294 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300295 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500296 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
297 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
298 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
299 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
300 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
301 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
Taneja, Archit31ef8232011-03-14 23:28:22 -0500302};
303
304static const struct dss_param_range omap4_dss_param_range[] = {
Taneja, Archit49641112011-03-14 23:28:23 -0500305 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
Tomi Valkeinen9eaaf202011-08-29 15:56:04 +0300306 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
Taneja, Archit49641112011-03-14 23:28:23 -0500307 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
308 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
309 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
310 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
311 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
312 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
Taneja, Archit31ef8232011-03-14 23:28:22 -0500313};
314
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530315/* OMAP2 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300316static const struct omap_dss_features omap2_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530317 .reg_fields = omap2_dss_reg_fields,
318 .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
319
Archit Tanejad50cd032010-12-02 11:27:08 +0000320 .has_feature =
321 FEAT_LCDENABLEPOL | FEAT_LCDENABLESIGNAL |
Archit Taneja87a74842011-03-02 11:19:50 +0530322 FEAT_PCKFREEENABLE | FEAT_FUNCGATED |
323 FEAT_ROWREPEATENABLE | FEAT_RESIZECONF,
Archit Tanejad50cd032010-12-02 11:27:08 +0000324
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530325 .num_mgrs = 2,
326 .num_ovls = 3,
327 .supported_displays = omap2_dss_supported_displays,
328 .supported_color_modes = omap2_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300329 .overlay_caps = omap2_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530330 .clksrc_names = omap2_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500331 .dss_params = omap2_dss_param_range,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300332 .buffer_size_unit = 1,
333 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530334};
335
336/* OMAP3 DSS Features */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300337static const struct omap_dss_features omap3430_dss_features = {
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530338 .reg_fields = omap3_dss_reg_fields,
339 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
340
Archit Tanejad50cd032010-12-02 11:27:08 +0000341 .has_feature =
342 FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL |
343 FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
Archit Taneja87a74842011-03-02 11:19:50 +0530344 FEAT_FUNCGATED | FEAT_ROWREPEATENABLE |
Archit Taneja9613c022011-03-22 06:33:36 -0500345 FEAT_LINEBUFFERSPLIT | FEAT_RESIZECONF |
Tomi Valkeinen525dae62011-05-18 11:59:21 +0300346 FEAT_DSI_PLL_FREQSEL | FEAT_DSI_REVERSE_TXCLKESC |
Tomi Valkeinen332e9d72011-05-27 14:22:16 +0300347 FEAT_VENC_REQUIRES_TV_DAC_CLK | FEAT_CPR | FEAT_PRELOAD |
348 FEAT_FIR_COEF_V,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530349
350 .num_mgrs = 2,
351 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200352 .supported_displays = omap3430_dss_supported_displays,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530353 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300354 .overlay_caps = omap3430_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530355 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500356 .dss_params = omap3_dss_param_range,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300357 .buffer_size_unit = 1,
358 .burst_size_unit = 8,
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530359};
360
Tomi Valkeinenea290332011-04-20 10:09:36 +0300361static const struct omap_dss_features omap3630_dss_features = {
Samreen8fbde102010-11-04 12:28:41 +0100362 .reg_fields = omap3_dss_reg_fields,
363 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
364
Archit Tanejad50cd032010-12-02 11:27:08 +0000365 .has_feature =
366 FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL |
367 FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300368 FEAT_FUNCGATED |
Archit Taneja87a74842011-03-02 11:19:50 +0530369 FEAT_ROWREPEATENABLE | FEAT_LINEBUFFERSPLIT |
Archit Taneja9613c022011-03-22 06:33:36 -0500370 FEAT_RESIZECONF | FEAT_DSI_PLL_PWR_BUG |
Tomi Valkeinen332e9d72011-05-27 14:22:16 +0300371 FEAT_DSI_PLL_FREQSEL | FEAT_CPR | FEAT_PRELOAD |
372 FEAT_FIR_COEF_V,
Samreen8fbde102010-11-04 12:28:41 +0100373
374 .num_mgrs = 2,
375 .num_ovls = 3,
Tomi Valkeinen4e777dd2011-02-24 14:20:31 +0200376 .supported_displays = omap3630_dss_supported_displays,
Samreen8fbde102010-11-04 12:28:41 +0100377 .supported_color_modes = omap3_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300378 .overlay_caps = omap3630_dss_overlay_caps,
Archit Taneja067a57e2011-03-02 11:57:25 +0530379 .clksrc_names = omap3_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500380 .dss_params = omap3_dss_param_range,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300381 .buffer_size_unit = 1,
382 .burst_size_unit = 8,
Samreen8fbde102010-11-04 12:28:41 +0100383};
384
Archit Tanejad50cd032010-12-02 11:27:08 +0000385/* OMAP4 DSS Features */
Ricardo Neri6ff70842011-05-18 22:23:33 -0500386/* For OMAP4430 ES 1.0 revision */
387static const struct omap_dss_features omap4430_es1_0_dss_features = {
388 .reg_fields = omap4_dss_reg_fields,
389 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
390
391 .has_feature =
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300392 FEAT_GLOBAL_ALPHA |
393 FEAT_MGR_LCD2 |
Ricardo Neri6ff70842011-05-18 22:23:33 -0500394 FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC |
395 FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH |
Tomi Valkeinen332e9d72011-05-27 14:22:16 +0300396 FEAT_DSI_GNQ | FEAT_HANDLE_UV_SEPARATE | FEAT_ATTR2 |
397 FEAT_CPR | FEAT_PRELOAD | FEAT_FIR_COEF_V,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500398
399 .num_mgrs = 3,
400 .num_ovls = 3,
401 .supported_displays = omap4_dss_supported_displays,
Amber Jainf20e4222011-05-19 19:47:50 +0530402 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300403 .overlay_caps = omap4_dss_overlay_caps,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500404 .clksrc_names = omap4_dss_clk_source_names,
405 .dss_params = omap4_dss_param_range,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300406 .buffer_size_unit = 16,
407 .burst_size_unit = 16,
Ricardo Neri6ff70842011-05-18 22:23:33 -0500408};
409
410/* For all the other OMAP4 versions */
Tomi Valkeinenea290332011-04-20 10:09:36 +0300411static const struct omap_dss_features omap4_dss_features = {
Archit Taneja87a74842011-03-02 11:19:50 +0530412 .reg_fields = omap4_dss_reg_fields,
413 .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
Archit Tanejad50cd032010-12-02 11:27:08 +0000414
415 .has_feature =
Tomi Valkeinenf6dc8152011-08-15 15:18:20 +0300416 FEAT_GLOBAL_ALPHA |
417 FEAT_MGR_LCD2 |
Archit Taneja9613c022011-03-22 06:33:36 -0500418 FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC |
Archit Taneja75d72472011-05-16 15:17:08 +0530419 FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH |
Amber Jainab5ca072011-05-19 19:47:53 +0530420 FEAT_DSI_GNQ | FEAT_HDMI_CTS_SWMODE |
Tomi Valkeinen332e9d72011-05-27 14:22:16 +0300421 FEAT_HANDLE_UV_SEPARATE | FEAT_ATTR2 | FEAT_CPR |
422 FEAT_PRELOAD | FEAT_FIR_COEF_V,
Archit Tanejad50cd032010-12-02 11:27:08 +0000423
424 .num_mgrs = 3,
425 .num_ovls = 3,
426 .supported_displays = omap4_dss_supported_displays,
Amber Jainf20e4222011-05-19 19:47:50 +0530427 .supported_color_modes = omap4_dss_supported_color_modes,
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300428 .overlay_caps = omap4_dss_overlay_caps,
Taneja, Architea751592011-03-08 05:50:35 -0600429 .clksrc_names = omap4_dss_clk_source_names,
Taneja, Archit31ef8232011-03-14 23:28:22 -0500430 .dss_params = omap4_dss_param_range,
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300431 .buffer_size_unit = 16,
432 .burst_size_unit = 16,
Archit Tanejad50cd032010-12-02 11:27:08 +0000433};
434
Mythri P K60634a22011-09-08 19:06:26 +0530435#if defined(CONFIG_OMAP4_DSS_HDMI)
436/* HDMI OMAP4 Functions*/
437static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
438
439 .video_configure = ti_hdmi_4xxx_basic_configure,
440 .phy_enable = ti_hdmi_4xxx_phy_enable,
441 .phy_disable = ti_hdmi_4xxx_phy_disable,
442 .read_edid = ti_hdmi_4xxx_read_edid,
443 .pll_enable = ti_hdmi_4xxx_pll_enable,
444 .pll_disable = ti_hdmi_4xxx_pll_disable,
445 .video_enable = ti_hdmi_4xxx_wp_video_start,
446};
447
448void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
449{
450 if (cpu_is_omap44xx())
451 ip_data->ops = &omap4_hdmi_functions;
452}
453#endif
454
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530455/* Functions returning values related to a DSS feature */
456int dss_feat_get_num_mgrs(void)
457{
458 return omap_current_dss_features->num_mgrs;
459}
460
461int dss_feat_get_num_ovls(void)
462{
463 return omap_current_dss_features->num_ovls;
464}
465
Taneja, Archit31ef8232011-03-14 23:28:22 -0500466unsigned long dss_feat_get_param_min(enum dss_range_param param)
Archit Taneja819d8072011-03-01 11:54:00 +0530467{
Taneja, Archit31ef8232011-03-14 23:28:22 -0500468 return omap_current_dss_features->dss_params[param].min;
469}
470
471unsigned long dss_feat_get_param_max(enum dss_range_param param)
472{
473 return omap_current_dss_features->dss_params[param].max;
Archit Taneja819d8072011-03-01 11:54:00 +0530474}
475
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530476enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
477{
478 return omap_current_dss_features->supported_displays[channel];
479}
480
481enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
482{
483 return omap_current_dss_features->supported_color_modes[plane];
484}
485
Tomi Valkeinen67019db2011-08-15 15:18:15 +0300486enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
487{
488 return omap_current_dss_features->overlay_caps[plane];
489}
490
Archit Taneja8dad2ab2010-11-25 17:58:10 +0530491bool dss_feat_color_mode_supported(enum omap_plane plane,
492 enum omap_color_mode color_mode)
493{
494 return omap_current_dss_features->supported_color_modes[plane] &
495 color_mode;
496}
497
Archit Taneja89a35e52011-04-12 13:52:23 +0530498const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
Archit Taneja067a57e2011-03-02 11:57:25 +0530499{
Taneja, Archit235e7db2011-03-14 23:28:21 -0500500 return omap_current_dss_features->clksrc_names[id];
Archit Taneja067a57e2011-03-02 11:57:25 +0530501}
502
Tomi Valkeinen5ed8cf52011-06-21 09:35:36 +0300503u32 dss_feat_get_buffer_size_unit(void)
504{
505 return omap_current_dss_features->buffer_size_unit;
506}
507
508u32 dss_feat_get_burst_size_unit(void)
509{
510 return omap_current_dss_features->burst_size_unit;
511}
512
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530513/* DSS has_feature check */
514bool dss_has_feature(enum dss_feat_id id)
515{
516 return omap_current_dss_features->has_feature & id;
517}
518
519void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
520{
521 if (id >= omap_current_dss_features->num_reg_fields)
522 BUG();
523
524 *start = omap_current_dss_features->reg_fields[id].start;
525 *end = omap_current_dss_features->reg_fields[id].end;
526}
527
528void dss_features_init(void)
529{
530 if (cpu_is_omap24xx())
531 omap_current_dss_features = &omap2_dss_features;
Samreen8fbde102010-11-04 12:28:41 +0100532 else if (cpu_is_omap3630())
533 omap_current_dss_features = &omap3630_dss_features;
534 else if (cpu_is_omap34xx())
535 omap_current_dss_features = &omap3430_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500536 else if (omap_rev() == OMAP4430_REV_ES1_0)
537 omap_current_dss_features = &omap4430_es1_0_dss_features;
538 else if (cpu_is_omap44xx())
Archit Tanejad50cd032010-12-02 11:27:08 +0000539 omap_current_dss_features = &omap4_dss_features;
Ricardo Neri6ff70842011-05-18 22:23:33 -0500540 else
541 DSSWARN("Unsupported OMAP version");
Archit Tanejae1ef4d22010-09-15 18:47:29 +0530542}