[GXFB] Don't disable gamma correction if it was set up by the
BIOS/loader
David Woodhouse
dwmw2 at infradead.org
Tue Nov 7 22:38:29 EST 2006
Commit: c4f0e19d9b2a98367215ef6a5fe51a56ae66290c
Parent: 2a1ac100865f3210b5cc5ce83566744118b36c90
commit c4f0e19d9b2a98367215ef6a5fe51a56ae66290c
Author: David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Wed Nov 1 19:44:19 2006 +0800
Commit: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Wed Nov 1 19:44:19 2006 +0800
[GXFB] Don't disable gamma correction if it was set up by the BIOS/loader
We'll want OpenFirmware to set up the gamma correction for the OLPC
panel (and miswiring) before Linux boots -- so just leave it enabled.
Although the hardware starts up with random crap in the gamma table and
gamma 'correction' enabled, the BIOS or bootloader should have done
something about that by the time Linux is booting.
Also make sure we do enable gamma correction after the user loads a new
table, and disallow reading the table if gamma correction is disabled.
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
drivers/video/geode/gxfb_core.c | 6 ++++++
drivers/video/geode/video_gx.c | 9 +++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 5bf2a90..f95bc03 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -307,10 +307,16 @@ static int gxfb_ioctl( struct fb_info *i
for(i = 0; i < GXFB_GAMMA_DWORDS; i++)
writel(gamma[i] & 0xFFFFFF, par->vid_regs + GX_GDR);
+ writel(readl(par->vid_regs + GX_MISC) & ~GX_MISC_GAM_EN,
+ par->vid_regs + GX_MISC);
+
ret = 0;
break;
case FBIOGGAMMA:
+ if (readl(par->vid_regs + GX_MISC) & GX_MISC_GAM_EN)
+ return -EINVAL;
+
memset(gamma, 0, GXFB_GAMMA_SIZE);
writel(0, par->vid_regs + GX_GAR);
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 16d5b54..87b1a1b 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -240,15 +240,16 @@ static void gx_configure_display(struct
u32 dcfg, misc;
/* Set up the MISC register */
-
misc = readl(par->vid_regs + GX_MISC);
+ /* We leave gamma enabled if it was already enabled.
+ Although the hardware enables it without setting
+ up the gamma table, the BIOS or bootloader ought
+ to have either disabled it or loaded a table by now */
+
/* Power up the DAC */
misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN);
- /* Disable gamma correction */
- misc |= GX_MISC_GAM_EN;
-
writel(misc, par->vid_regs + GX_MISC);
/* Write the display configuration */
More information about the Commits-kernel
mailing list