aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2010-09-15 09:17:29 -0400
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-10-22 16:21:03 -0400
commite1ef4d236f11ef0cb674deead822d029f1bb2745 (patch)
tree5bd2144371e30917ebc0e9cad9b769c4c36a62ac /drivers/video
parent2308bfb8acbdab6883e5dd5bb1f4fe60ca5faefa (diff)
OMAP: DSS2: Introduce dss_features files
Add dss_features.c and dss_features.h for the dss_features framework. This framework will be used to move all cpu_is_xxx() and similar calls to a single place. Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/Makefile2
-rw-r--r--drivers/video/omap2/dss/dss_features.c191
-rw-r--r--drivers/video/omap2/dss/dss_features.h50
3 files changed, 242 insertions, 1 deletions
diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile
index d71b5d9d71b..7db17b5e570 100644
--- a/drivers/video/omap2/dss/Makefile
+++ b/drivers/video/omap2/dss/Makefile
@@ -1,5 +1,5 @@
1obj-$(CONFIG_OMAP2_DSS) += omapdss.o 1obj-$(CONFIG_OMAP2_DSS) += omapdss.o
2omapdss-y := core.o dss.o dispc.o display.o manager.o overlay.o 2omapdss-y := core.o dss.o dss_features.o dispc.o display.o manager.o overlay.o
3omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o 3omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
4omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o 4omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o
5omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o 5omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
new file mode 100644
index 00000000000..867f68de125
--- /dev/null
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -0,0 +1,191 @@
1/*
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
25#include <plat/display.h>
26#include <plat/cpu.h>
27
28#include "dss_features.h"
29
30/* Defines a generic omap register field */
31struct dss_reg_field {
32 enum dss_feat_reg_field id;
33 u8 start, end;
34};
35
36struct omap_dss_features {
37 const struct dss_reg_field *reg_fields;
38 const int num_reg_fields;
39
40 const u32 has_feature;
41
42 const int num_mgrs;
43 const int num_ovls;
44 const enum omap_display_type *supported_displays;
45 const enum omap_color_mode *supported_color_modes;
46};
47
48/* This struct is assigned to one of the below during initialization */
49static struct omap_dss_features *omap_current_dss_features;
50
51static const struct dss_reg_field omap2_dss_reg_fields[] = {
52 { FEAT_REG_FIRHINC, 11, 0 },
53 { FEAT_REG_FIRVINC, 27, 16 },
54 { FEAT_REG_FIFOLOWTHRESHOLD, 8, 0 },
55 { FEAT_REG_FIFOHIGHTHRESHOLD, 24, 16 },
56 { FEAT_REG_FIFOSIZE, 8, 0 },
57};
58
59static const struct dss_reg_field omap3_dss_reg_fields[] = {
60 { FEAT_REG_FIRHINC, 12, 0 },
61 { FEAT_REG_FIRVINC, 28, 16 },
62 { FEAT_REG_FIFOLOWTHRESHOLD, 11, 0 },
63 { FEAT_REG_FIFOHIGHTHRESHOLD, 27, 16 },
64 { FEAT_REG_FIFOSIZE, 10, 0 },
65};
66
67static const enum omap_display_type omap2_dss_supported_displays[] = {
68 /* OMAP_DSS_CHANNEL_LCD */
69 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
70 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
71
72 /* OMAP_DSS_CHANNEL_DIGIT */
73 OMAP_DISPLAY_TYPE_VENC,
74};
75
76static const enum omap_display_type omap3_dss_supported_displays[] = {
77 /* OMAP_DSS_CHANNEL_LCD */
78 OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
79 OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
80
81 /* OMAP_DSS_CHANNEL_DIGIT */
82 OMAP_DISPLAY_TYPE_VENC,
83};
84
85static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
86 /* OMAP_DSS_GFX */
87 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
88 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
89 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
90 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
91
92 /* OMAP_DSS_VIDEO1 */
93 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
94 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
95 OMAP_DSS_COLOR_UYVY,
96
97 /* OMAP_DSS_VIDEO2 */
98 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
99 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
100 OMAP_DSS_COLOR_UYVY,
101};
102
103static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
104 /* OMAP_DSS_GFX */
105 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
106 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
107 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
108 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
109 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
110 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
111
112 /* OMAP_DSS_VIDEO1 */
113 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
114 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
115 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
116
117 /* OMAP_DSS_VIDEO2 */
118 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
119 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
120 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
121 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
122 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
123};
124
125/* OMAP2 DSS Features */
126static struct omap_dss_features omap2_dss_features = {
127 .reg_fields = omap2_dss_reg_fields,
128 .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
129
130 .num_mgrs = 2,
131 .num_ovls = 3,
132 .supported_displays = omap2_dss_supported_displays,
133 .supported_color_modes = omap2_dss_supported_color_modes,
134};
135
136/* OMAP3 DSS Features */
137static struct omap_dss_features omap3_dss_features = {
138 .reg_fields = omap3_dss_reg_fields,
139 .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
140
141 .has_feature = FEAT_GLOBAL_ALPHA,
142
143 .num_mgrs = 2,
144 .num_ovls = 3,
145 .supported_displays = omap3_dss_supported_displays,
146 .supported_color_modes = omap3_dss_supported_color_modes,
147};
148
149/* Functions returning values related to a DSS feature */
150int dss_feat_get_num_mgrs(void)
151{
152 return omap_current_dss_features->num_mgrs;
153}
154
155int dss_feat_get_num_ovls(void)
156{
157 return omap_current_dss_features->num_ovls;
158}
159
160enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
161{
162 return omap_current_dss_features->supported_displays[channel];
163}
164
165enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
166{
167 return omap_current_dss_features->supported_color_modes[plane];
168}
169
170/* DSS has_feature check */
171bool dss_has_feature(enum dss_feat_id id)
172{
173 return omap_current_dss_features->has_feature & id;
174}
175
176void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
177{
178 if (id >= omap_current_dss_features->num_reg_fields)
179 BUG();
180
181 *start = omap_current_dss_features->reg_fields[id].start;
182 *end = omap_current_dss_features->reg_fields[id].end;
183}
184
185void dss_features_init(void)
186{
187 if (cpu_is_omap24xx())
188 omap_current_dss_features = &omap2_dss_features;
189 else
190 omap_current_dss_features = &omap3_dss_features;
191}
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h
new file mode 100644
index 00000000000..cb231eaa9b3
--- /dev/null
+++ b/drivers/video/omap2/dss/dss_features.h
@@ -0,0 +1,50 @@
1/*
2 * linux/drivers/video/omap2/dss/dss_features.h
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#ifndef __OMAP2_DSS_FEATURES_H
21#define __OMAP2_DSS_FEATURES_H
22
23#define MAX_DSS_MANAGERS 2
24#define MAX_DSS_OVERLAYS 3
25
26/* DSS has feature id */
27enum dss_feat_id {
28 FEAT_GLOBAL_ALPHA = 1 << 0,
29 FEAT_GLOBAL_ALPHA_VID1 = 1 << 1,
30};
31
32/* DSS register field id */
33enum dss_feat_reg_field {
34 FEAT_REG_FIRHINC,
35 FEAT_REG_FIRVINC,
36 FEAT_REG_FIFOHIGHTHRESHOLD,
37 FEAT_REG_FIFOLOWTHRESHOLD,
38 FEAT_REG_FIFOSIZE,
39};
40
41/* DSS Feature Functions */
42int dss_feat_get_num_mgrs(void);
43int dss_feat_get_num_ovls(void);
44enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel);
45enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane);
46
47bool dss_has_feature(enum dss_feat_id id);
48void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
49void dss_features_init(void);
50#endif