summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0023-DSS2-pass-the-default-FB-color-format-through-board.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0023-DSS2-pass-the-default-FB-color-format-through-board.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0023-DSS2-pass-the-default-FB-color-format-through-board.patch214
1 files changed, 214 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0023-DSS2-pass-the-default-FB-color-format-through-board.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0023-DSS2-pass-the-default-FB-color-format-through-board.patch
new file mode 100644
index 0000000000..6492905530
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0023-DSS2-pass-the-default-FB-color-format-through-board.patch
@@ -0,0 +1,214 @@
1From c02b843c2732bc7b15a3e35b5dd715d68225bbd1 Mon Sep 17 00:00:00 2001
2From: Imre Deak <imre.deak@nokia.com>
3Date: Wed, 8 Apr 2009 12:51:46 +0200
4Subject: [PATCH] DSS2: pass the default FB color format through board info
5
6Add a field to the FB memory region platform data, so that board
7init code can pass a default color format to the driver. Set this
8format as an initial setting for the given FB.
9
10This is needed for an upcoming patch that adds detection of the
11color format set by the bootloader.
12
13Signed-off-by: Imre Deak <imre.deak@nokia.com>
14---
15 drivers/video/omap2/omapfb/omapfb-main.c | 121 +++++++++++++++++++++++++++---
16 drivers/video/omap2/omapfb/omapfb.h | 2 +
17 include/linux/omapfb.h | 5 +
18 3 files changed, 117 insertions(+), 11 deletions(-)
19
20diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
21index 12ce0c3..67c67c2 100644
22--- a/drivers/video/omap2/omapfb/omapfb-main.c
23+++ b/drivers/video/omap2/omapfb/omapfb-main.c
24@@ -370,6 +370,21 @@ static enum omap_color_mode fb_mode_to_dss_mode(struct fb_var_screeninfo *var)
25 return -EINVAL;
26 }
27
28+static int dss_mode_to_fb_mode(enum omap_color_mode dssmode,
29+ struct fb_var_screeninfo *var)
30+{
31+ int i;
32+
33+ for (i = 0; i < ARRAY_SIZE(omapfb_colormodes); ++i) {
34+ struct omapfb_colormode *mode = &omapfb_colormodes[i];
35+ if (dssmode == mode->dssmode) {
36+ assign_colormode_to_var(var, mode);
37+ return 0;
38+ }
39+ }
40+ return -ENOENT;
41+}
42+
43 void set_fb_fix(struct fb_info *fbi)
44 {
45 struct fb_fix_screeninfo *fix = &fbi->fix;
46@@ -1267,6 +1282,60 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
47 return omapfb_alloc_fbmem(fbi, size, paddr);
48 }
49
50+static enum omap_color_mode fb_format_to_dss_mode(enum omapfb_color_format format)
51+{
52+ enum omap_color_mode mode;
53+
54+ switch (format) {
55+ case OMAPFB_COLOR_RGB565:
56+ mode = OMAP_DSS_COLOR_RGB16;
57+ break;
58+ case OMAPFB_COLOR_YUV422:
59+ mode = OMAP_DSS_COLOR_YUV2;
60+ break;
61+ case OMAPFB_COLOR_CLUT_8BPP:
62+ mode = OMAP_DSS_COLOR_CLUT8;
63+ break;
64+ case OMAPFB_COLOR_CLUT_4BPP:
65+ mode = OMAP_DSS_COLOR_CLUT4;
66+ break;
67+ case OMAPFB_COLOR_CLUT_2BPP:
68+ mode = OMAP_DSS_COLOR_CLUT2;
69+ break;
70+ case OMAPFB_COLOR_CLUT_1BPP:
71+ mode = OMAP_DSS_COLOR_CLUT1;
72+ break;
73+ case OMAPFB_COLOR_RGB444:
74+ mode = OMAP_DSS_COLOR_RGB12U;
75+ break;
76+ case OMAPFB_COLOR_YUY422:
77+ mode = OMAP_DSS_COLOR_UYVY;
78+ break;
79+ case OMAPFB_COLOR_ARGB16:
80+ mode = OMAP_DSS_COLOR_ARGB16;
81+ break;
82+ case OMAPFB_COLOR_RGB24U:
83+ mode = OMAP_DSS_COLOR_RGB24U;
84+ break;
85+ case OMAPFB_COLOR_RGB24P:
86+ mode = OMAP_DSS_COLOR_RGB24P;
87+ break;
88+ case OMAPFB_COLOR_ARGB32:
89+ mode = OMAP_DSS_COLOR_ARGB32;
90+ break;
91+ case OMAPFB_COLOR_RGBA32:
92+ mode = OMAP_DSS_COLOR_RGBA32;
93+ break;
94+ case OMAPFB_COLOR_RGBX32:
95+ mode = OMAP_DSS_COLOR_RGBX32;
96+ break;
97+ default:
98+ mode = -EINVAL;
99+ }
100+
101+ return mode;
102+}
103+
104 static int omapfb_parse_vram_param(const char *param, int max_entries,
105 unsigned long *sizes, unsigned long *paddrs)
106 {
107@@ -1483,9 +1552,36 @@ int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
108 }
109
110 var->nonstd = 0;
111+ var->bits_per_pixel = 0;
112
113 var->rotate = ofbi->rotation;
114
115+ /*
116+ * Check if there is a default color format set in the board file,
117+ * and use this format instead the default deducted from the
118+ * display bpp.
119+ */
120+ if (fbdev->dev->platform_data) {
121+ struct omapfb_platform_data *opd;
122+ int id = ofbi->id;
123+
124+ opd = fbdev->dev->platform_data;
125+ if (opd->mem_desc.region[id].format_used) {
126+ enum omap_color_mode mode;
127+ enum omapfb_color_format format;
128+
129+ format = opd->mem_desc.region[id].format;
130+ mode = fb_format_to_dss_mode(format);
131+ if (mode < 0) {
132+ r = mode;
133+ goto err;
134+ }
135+ r = dss_mode_to_fb_mode(mode, var);
136+ if (r < 0)
137+ goto err;
138+ }
139+ }
140+
141 if (display) {
142 u16 w, h;
143 display->get_resolution(display, &w, &h);
144@@ -1502,16 +1598,18 @@ int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
145 var->xres_virtual = var->xres;
146 var->yres_virtual = var->yres;
147
148- switch (display->get_recommended_bpp(display)) {
149- case 16:
150- var->bits_per_pixel = 16;
151- break;
152- case 24:
153- var->bits_per_pixel = 32;
154- break;
155- default:
156- dev_err(fbdev->dev, "illegal display bpp\n");
157- return -EINVAL;
158+ if (!var->bits_per_pixel) {
159+ switch (display->get_recommended_bpp(display)) {
160+ case 16:
161+ var->bits_per_pixel = 16;
162+ break;
163+ case 24:
164+ var->bits_per_pixel = 32;
165+ break;
166+ default:
167+ dev_err(fbdev->dev, "illegal display bpp\n");
168+ return -EINVAL;
169+ }
170 }
171 } else {
172 /* if there's no display, let's just guess some basic values */
173@@ -1519,7 +1617,8 @@ int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
174 var->yres = 240;
175 var->xres_virtual = var->xres;
176 var->yres_virtual = var->yres;
177- var->bits_per_pixel = 16;
178+ if (!var->bits_per_pixel)
179+ var->bits_per_pixel = 16;
180 }
181
182 r = check_fb_var(fbi, var);
183diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h
184index 65e9e6e..2607def 100644
185--- a/drivers/video/omap2/omapfb/omapfb.h
186+++ b/drivers/video/omap2/omapfb/omapfb.h
187@@ -27,6 +27,8 @@
188 #define DEBUG
189 #endif
190
191+#include <mach/display.h>
192+
193 #ifdef DEBUG
194 extern unsigned int omapfb_debug;
195 #define DBG(format, ...) \
196diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
197index 96190b2..7a34f22 100644
198--- a/include/linux/omapfb.h
199+++ b/include/linux/omapfb.h
200@@ -298,6 +298,11 @@ struct omapfb_mem_region {
201 void __iomem *vaddr;
202 unsigned long size;
203 u8 type; /* OMAPFB_PLANE_MEM_* */
204+ enum omapfb_color_format format;/* OMAPFB_COLOR_* */
205+ unsigned format_used:1; /* Must be set when format is set.
206+ * Needed b/c of the badly chosen 0
207+ * base for OMAPFB_COLOR_* values
208+ */
209 unsigned alloc:1; /* allocated by the driver */
210 unsigned map:1; /* kernel mapped by the driver */
211 };
212--
2131.5.6.5
214