* [PATCH 3/3] OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers
@ 2008-04-14 7:53 Andres Salomon
2008-04-14 8:33 ` Arnd Bergmann
2008-04-15 1:21 ` [PATCH 3/3] " Andrew Morton
0 siblings, 2 replies; 5+ messages in thread
From: Andres Salomon @ 2008-04-14 7:53 UTC (permalink / raw)
To: Andrew Morton
Cc: jordan.crouse, linux-fbdev-devel, adaplas, linux-kernel,
info-linux
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.
Signed-off-by: Andres Salomon <dilinger@debian.org>
---
drivers/video/geode/gxfb_core.c | 35 ++++++++++++++++++++++++++++++++++-
drivers/video/geode/lxfb_core.c | 35 +++++++++++++++++++++++++++++++----
2 files changed, 65 insertions(+), 5 deletions(-)
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 988c8e4..3e76e06 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -108,6 +108,35 @@ static const struct fb_videomode gx_modedb[] __initdata = {
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
};
+#ifdef CONFIG_OLPC
+#include <asm/olpc.h>
+
+static const struct fb_videomode gx_dcon_modedb[] __initdata = {
+ /* The only mode the DCON has is 1200x900 */
+ { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, 0 }
+};
+
+static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
+{
+ if (olpc_has_dcon()) {
+ *modedb = (struct fb_videomode *) gx_dcon_modedb;
+ *size = ARRAY_SIZE(gx_dcon_modedb);
+ } else {
+ *modedb = (struct fb_videomode *) gx_modedb;
+ *size = ARRAY_SIZE(gx_modedb);
+ }
+}
+
+#else
+static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
+{
+ *modedb = (struct fb_videomode *) gx_modedb;
+ *size = ARRAY_SIZE(gx_modedb);
+}
+#endif
+
static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
if (var->xres > 1600 || var->yres > 1200)
@@ -356,6 +385,9 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
int ret;
unsigned long val;
+ struct fb_videomode *modedb_ptr;
+ unsigned int modedb_size;
+
info = gxfb_init_fbinfo(&pdev->dev);
if (!info)
return -ENOMEM;
@@ -375,8 +407,9 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
else
par->enable_crt = 1;
+ get_modedb(&modedb_ptr, &modedb_size);
ret = fb_find_mode(&info->var, info, mode_option,
- gx_modedb, ARRAY_SIZE(gx_modedb), NULL, 16);
+ modedb_ptr, modedb_size, NULL, 16);
if (ret == 0 || ret == 4) {
dev_err(&pdev->dev, "could not find valid video mode\n");
ret = -EINVAL;
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
index e290981..28fa3c4 100644
--- a/drivers/video/geode/lxfb_core.c
+++ b/drivers/video/geode/lxfb_core.c
@@ -217,6 +217,35 @@ static const struct fb_videomode geode_modedb[] __initdata = {
0, FB_VMODE_NONINTERLACED, 0 },
};
+#ifdef CONFIG_OLPC
+#include <asm/olpc.h>
+
+const struct fb_videomode olpc_dcon_modedb[] __initdata = {
+ /* The only mode the DCON has is 1200x900 */
+ { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, 0 }
+};
+
+static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
+{
+ if (olpc_has_dcon()) {
+ *modedb = (struct fb_videomode *) olpc_dcon_modedb;
+ *size = ARRAY_SIZE(olpc_dcon_modedb);
+ } else {
+ *modedb = (struct fb_videomode *) geode_modedb;
+ *size = ARRAY_SIZE(geode_modedb);
+ }
+}
+
+#else
+static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
+{
+ *modedb = (struct fb_videomode *) geode_modedb;
+ *size = ARRAY_SIZE(geode_modedb);
+}
+#endif
+
static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
if (var->xres > 1920 || var->yres > 1440)
@@ -480,7 +509,7 @@ static int __init lxfb_probe(struct pci_dev *pdev,
int ret;
struct fb_videomode *modedb_ptr;
- int modedb_size;
+ unsigned int modedb_size;
info = lxfb_init_fbinfo(&pdev->dev);
@@ -505,9 +534,7 @@ static int __init lxfb_probe(struct pci_dev *pdev,
/* Set up the mode database */
- modedb_ptr = (struct fb_videomode *) geode_modedb;
- modedb_size = ARRAY_SIZE(geode_modedb);
-
+ get_modedb(&modedb_ptr, &modedb_size);
ret = fb_find_mode(&info->var, info, mode_option,
modedb_ptr, modedb_size, NULL, 16);
--
1.5.4.4
--
Need a kernel or Debian developer? Contact me, I'm looking for contracts.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 3/3] OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers
2008-04-14 7:53 [PATCH 3/3] OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers Andres Salomon
@ 2008-04-14 8:33 ` Arnd Bergmann
2008-04-14 15:18 ` Jordan Crouse
2008-04-15 1:21 ` [PATCH 3/3] " Andrew Morton
1 sibling, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2008-04-14 8:33 UTC (permalink / raw)
To: Andres Salomon
Cc: Andrew Morton, linux-kernel, info-linux, jordan.crouse, adaplas,
linux-fbdev-devel
On Monday 14 April 2008, Andres Salomon wrote:
> 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.
>
> Signed-off-by: Andres Salomon <dilinger@debian.org>
Since the XO is based on Open Firmware, shouldn't the panel size really be
a property in the device tree that can be read by this driver?
Arnd <><
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers
2008-04-14 8:33 ` Arnd Bergmann
@ 2008-04-14 15:18 ` Jordan Crouse
2008-04-14 15:33 ` Andres Salomon
0 siblings, 1 reply; 5+ messages in thread
From: Jordan Crouse @ 2008-04-14 15:18 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andres Salomon, Andrew Morton, linux-kernel, info-linux, adaplas,
linux-fbdev-devel
On 14/04/08 10:33 +0200, Arnd Bergmann wrote:
> On Monday 14 April 2008, Andres Salomon wrote:
> > 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.
> >
> > Signed-off-by: Andres Salomon <dilinger@debian.org>
>
> Since the XO is based on Open Firmware, shouldn't the panel size really be
> a property in the device tree that can be read by this driver?
Andre's description was slightly misleading. 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.
Jordan
--
Jordan Crouse
Systems Software Development Engineer
Advanced Micro Devices, Inc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers
2008-04-14 15:18 ` Jordan Crouse
@ 2008-04-14 15:33 ` Andres Salomon
0 siblings, 0 replies; 5+ messages in thread
From: Andres Salomon @ 2008-04-14 15:33 UTC (permalink / raw)
To: Jordan Crouse
Cc: Arnd Bergmann, Andrew Morton, linux-kernel, info-linux, adaplas,
linux-fbdev-devel
On Mon, 14 Apr 2008 09:18:56 -0600
Jordan Crouse <jordan.crouse@amd.com> wrote:
> On 14/04/08 10:33 +0200, Arnd Bergmann wrote:
> > On Monday 14 April 2008, Andres Salomon wrote:
> > > 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.
> > >
> > > Signed-off-by: Andres Salomon <dilinger@debian.org>
> >
> > Since the XO is based on Open Firmware, shouldn't the panel size really be
> > a property in the device tree that can be read by this driver?
>
> Andre's description was slightly misleading. 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.
>
> Jordan
>
Right, that's what I get for sending this stuff out at 4am. To be clear,
the issue that we have to hard code ways to access panel timing info on a
per-platform and/or per-bios basis. There's no standard way to fetch
it across all Geodes (that I'm aware of). Even the VSA doesn't really
help us here.
--
Need a kernel or Debian developer? Contact me, I'm looking for contracts.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers
2008-04-14 7:53 [PATCH 3/3] OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers Andres Salomon
2008-04-14 8:33 ` Arnd Bergmann
@ 2008-04-15 1:21 ` Andrew Morton
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2008-04-15 1:21 UTC (permalink / raw)
To: Andres Salomon
Cc: jordan.crouse, linux-fbdev-devel, adaplas, linux-kernel,
info-linux
On Mon, 14 Apr 2008 03:53:02 -0400 Andres Salomon <dilinger@queued.net> wrote:
>
> 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.
>
> ...
>
> +static const struct fb_videomode gx_dcon_modedb[] __initdata = {
> +const struct fb_videomode olpc_dcon_modedb[] __initdata = {
include/linux/init.h:38 points out that `const' and `__initdata' should
not be mixed.
I forget which architecture/compiler versions explode when we do this. But
it's not x86, iirc.
Still, it's poor form and, err, I don't immediately recall which tag we
_should_ use, and the comments in there are unhelpful. It might be
__initconst, but that has exactly zero users. Help.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-04-15 1:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14 7:53 [PATCH 3/3] OLPC: gxfb/lxfb: add DCON panel modes to framebuffer drivers Andres Salomon
2008-04-14 8:33 ` Arnd Bergmann
2008-04-14 15:18 ` Jordan Crouse
2008-04-14 15:33 ` Andres Salomon
2008-04-15 1:21 ` [PATCH 3/3] " Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).