sm501: add inversion controls for VBIASEN and FPEN
authorBen Dooks <ben-linux@fluff.org>
Thu, 24 Jul 2008 04:31:35 +0000 (21:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:40 +0000 (10:47 -0700)
Add flags to allow the driver to invert the sense of both VBIASEN and FPEN
signals comming from the SM501.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/sm501fb.c
include/linux/sm501.h

index 15d4a768b1f6f21b29f817a9f9ecee877dc60eb9..122a0f8495c85900e20f4cdbedd637f9252613d7 100644 (file)
@@ -663,15 +663,25 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
                sm501fb_sync_regs(fbi);
                mdelay(10);
 
+               /* VBIASEN */
+
                if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
-                       control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */
+                       if (pd->flags & SM501FB_FLAG_PANEL_INV_VBIASEN)
+                               control &= ~SM501_DC_PANEL_CONTROL_BIAS;
+                       else
+                               control |= SM501_DC_PANEL_CONTROL_BIAS;
+
                        writel(control, ctrl_reg);
                        sm501fb_sync_regs(fbi);
                        mdelay(10);
                }
 
                if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
-                       control |= SM501_DC_PANEL_CONTROL_FPEN;
+                       if (pd->flags & SM501FB_FLAG_PANEL_INV_FPEN)
+                               control &= ~SM501_DC_PANEL_CONTROL_FPEN;
+                       else
+                               control |= SM501_DC_PANEL_CONTROL_FPEN;
+
                        writel(control, ctrl_reg);
                        sm501fb_sync_regs(fbi);
                        mdelay(10);
@@ -679,14 +689,22 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
        } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) {
                /* disable panel power */
                if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
-                       control &= ~SM501_DC_PANEL_CONTROL_FPEN;
+                       if (pd->flags & SM501FB_FLAG_PANEL_INV_FPEN)
+                               control |= SM501_DC_PANEL_CONTROL_FPEN;
+                       else
+                               control &= ~SM501_DC_PANEL_CONTROL_FPEN;
+
                        writel(control, ctrl_reg);
                        sm501fb_sync_regs(fbi);
                        mdelay(10);
                }
 
                if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
-                       control &= ~SM501_DC_PANEL_CONTROL_BIAS;
+                       if (pd->flags & SM501FB_FLAG_PANEL_INV_VBIASEN)
+                               control |= SM501_DC_PANEL_CONTROL_BIAS;
+                       else
+                               control &= ~SM501_DC_PANEL_CONTROL_BIAS;
+
                        writel(control, ctrl_reg);
                        sm501fb_sync_regs(fbi);
                        mdelay(10);
index 95c1c39ba44598da0828d746f99435432f25fdb4..b530fa6a1d341c91c28d8992e61185a6b3a5f7e4 100644 (file)
@@ -73,6 +73,8 @@ extern unsigned long sm501_gpio_get(struct device *dev,
 #define SM501FB_FLAG_USE_HWACCEL       (1<<3)
 #define SM501FB_FLAG_PANEL_NO_FPEN     (1<<4)
 #define SM501FB_FLAG_PANEL_NO_VBIASEN  (1<<5)
+#define SM501FB_FLAG_PANEL_INV_FPEN    (1<<6)
+#define SM501FB_FLAG_PANEL_INV_VBIASEN (1<<7)
 
 struct sm501_platdata_fbsub {
        struct fb_videomode     *def_mode;