Skip to content

Commit 3553a2f

Browse files
dilingertorvalds
authored andcommitted
OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers
Since there's no way to autodetect panel modes, we're forced to hardcode them in the driver and add a big fat #ifdef. The OLPC DCON needs a specific mode line (at 1200x900). This adds it to both gxfb and lxfb. (Jordan said: We could probably detect the panel mode, but there isn't any reason to since the panel timings are well known and won't change. While OFW detection would be good computer science fu, it would be a wasted effort since its so easy to hard code them into the table.) Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Jordan Crouse <jordan.crouse@amd.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent fd96795 commit 3553a2f

2 files changed

Lines changed: 67 additions & 7 deletions

File tree

‎drivers/video/geode/gxfb_core.c‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int vram;
4141
static int vt_switch;
4242

4343
/* Modes relevant to the GX (taken from modedb.c) */
44-
static const struct fb_videomode gx_modedb[] __initdata = {
44+
static struct fb_videomode gx_modedb[] __initdata = {
4545
/* 640x480-60 VESA */
4646
{ NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
4747
0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
@@ -108,6 +108,35 @@ static const struct fb_videomode gx_modedb[] __initdata = {
108108
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
109109
};
110110

111+
#ifdef CONFIG_OLPC
112+
#include <asm/olpc.h>
113+
114+
static struct fb_videomode gx_dcon_modedb[] __initdata = {
115+
/* The only mode the DCON has is 1200x900 */
116+
{ NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
117+
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
118+
FB_VMODE_NONINTERLACED, 0 }
119+
};
120+
121+
static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
122+
{
123+
if (olpc_has_dcon()) {
124+
*modedb = (struct fb_videomode *) gx_dcon_modedb;
125+
*size = ARRAY_SIZE(gx_dcon_modedb);
126+
} else {
127+
*modedb = (struct fb_videomode *) gx_modedb;
128+
*size = ARRAY_SIZE(gx_modedb);
129+
}
130+
}
131+
132+
#else
133+
static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
134+
{
135+
*modedb = (struct fb_videomode *) gx_modedb;
136+
*size = ARRAY_SIZE(gx_modedb);
137+
}
138+
#endif
139+
111140
static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
112141
{
113142
if (var->xres > 1600 || var->yres > 1200)
@@ -350,6 +379,9 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
350379
int ret;
351380
unsigned long val;
352381

382+
struct fb_videomode *modedb_ptr;
383+
unsigned int modedb_size;
384+
353385
info = gxfb_init_fbinfo(&pdev->dev);
354386
if (!info)
355387
return -ENOMEM;
@@ -369,8 +401,9 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
369401
else
370402
par->enable_crt = 1;
371403

404+
get_modedb(&modedb_ptr, &modedb_size);
372405
ret = fb_find_mode(&info->var, info, mode_option,
373-
gx_modedb, ARRAY_SIZE(gx_modedb), NULL, 16);
406+
modedb_ptr, modedb_size, NULL, 16);
374407
if (ret == 0 || ret == 4) {
375408
dev_err(&pdev->dev, "could not find valid video mode\n");
376409
ret = -EINVAL;

‎drivers/video/geode/lxfb_core.c‎

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int vt_switch;
3636
* we try to make it something sane - 640x480-60 is sane
3737
*/
3838

39-
static const struct fb_videomode geode_modedb[] __initdata = {
39+
static struct fb_videomode geode_modedb[] __initdata = {
4040
/* 640x480-60 */
4141
{ NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2,
4242
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
@@ -217,6 +217,35 @@ static const struct fb_videomode geode_modedb[] __initdata = {
217217
0, FB_VMODE_NONINTERLACED, 0 },
218218
};
219219

220+
#ifdef CONFIG_OLPC
221+
#include <asm/olpc.h>
222+
223+
static struct fb_videomode olpc_dcon_modedb[] __initdata = {
224+
/* The only mode the DCON has is 1200x900 */
225+
{ NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
226+
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
227+
FB_VMODE_NONINTERLACED, 0 }
228+
};
229+
230+
static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
231+
{
232+
if (olpc_has_dcon()) {
233+
*modedb = (struct fb_videomode *) olpc_dcon_modedb;
234+
*size = ARRAY_SIZE(olpc_dcon_modedb);
235+
} else {
236+
*modedb = (struct fb_videomode *) geode_modedb;
237+
*size = ARRAY_SIZE(geode_modedb);
238+
}
239+
}
240+
241+
#else
242+
static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
243+
{
244+
*modedb = (struct fb_videomode *) geode_modedb;
245+
*size = ARRAY_SIZE(geode_modedb);
246+
}
247+
#endif
248+
220249
static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
221250
{
222251
if (var->xres > 1920 || var->yres > 1440)
@@ -477,7 +506,7 @@ static int __init lxfb_probe(struct pci_dev *pdev,
477506
int ret;
478507

479508
struct fb_videomode *modedb_ptr;
480-
int modedb_size;
509+
unsigned int modedb_size;
481510

482511
info = lxfb_init_fbinfo(&pdev->dev);
483512

@@ -502,9 +531,7 @@ static int __init lxfb_probe(struct pci_dev *pdev,
502531

503532
/* Set up the mode database */
504533

505-
modedb_ptr = (struct fb_videomode *) geode_modedb;
506-
modedb_size = ARRAY_SIZE(geode_modedb);
507-
534+
get_modedb(&modedb_ptr, &modedb_size);
508535
ret = fb_find_mode(&info->var, info, mode_option,
509536
modedb_ptr, modedb_size, NULL, 16);
510537

0 commit comments

Comments
 (0)