summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2008-08-29 01:10:58 -0400
committerAndres Salomon <dilinger@debian.org>2008-08-29 01:10:58 -0400
commit278a61522038c37997270537f9f496532098f88d (patch)
treec4525965039507778f6f5278bdba069e48e7ccc8
parent7bee90029d84945533fa232f7241f256169df456 (diff)
downloadlwn-278a61522038c37997270537f9f496532098f88d.tar.gz
lwn-278a61522038c37997270537f9f496532098f88d.zip
[DCON]: Make sure the backlight level gets restored after sleep
Apparently somewhere along the line, the backlight value gets reset to full in the DCON silicon after coming back from a DCON sleep. This patch should remedy that. Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Signed-off-by: Andres Salomon <dilinger@debian.org>
-rw-r--r--drivers/video/olpc_dcon.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/video/olpc_dcon.c b/drivers/video/olpc_dcon.c
index a66b22261669..1e7d2c38cd6f 100644
--- a/drivers/video/olpc_dcon.c
+++ b/drivers/video/olpc_dcon.c
@@ -246,14 +246,8 @@ static int dcon_get_backlight(void)
return bl_val;
}
-static void dcon_set_backlight(int level)
+static void __dcon_set_backlight(int level)
{
- if (dcon_client == NULL)
- return;
-
- if (bl_val == (level & 0x0F))
- return;
-
bl_val = level & 0x0F;
dcon_write(DCON_REG_BRIGHT, bl_val);
@@ -269,6 +263,17 @@ static void dcon_set_backlight(int level)
}
}
+static void dcon_set_backlight(int level)
+{
+ if (dcon_client == NULL)
+ return;
+
+ if (bl_val == (level & 0x0F))
+ return;
+
+ __dcon_set_backlight(level);
+}
+
/* Set the output type to either color or mono */
static int dcon_set_output(int arg)
@@ -318,15 +323,17 @@ static void dcon_sleep(int state)
dcon_sleep_val = state;
}
else {
- /* Only re-enable the backlight if the backlight value is set */
- if (bl_val != 0)
- dcon_disp_mode |= MODE_BL_ENABLE;
-
if ((x=dcon_bus_stabilize(dcon_client, 1)))
printk(KERN_WARNING "olpc-dcon: unable to reinit dcon"
" hardware: %d!\n", x);
else
dcon_sleep_val = state;
+
+ /* There might be a bug wherein the backlight gets
+ * restored to full after sleep. Make sure it gets set
+ * just to be sure */
+
+ __dcon_set_backlight(bl_val);
}
/* We should turn off some stuff in the framebuffer - but what? */