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.

Jordan

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.
[DCON]: Make sure the backlight level gets restored after sleep

From: Jordan Crouse <[EMAIL PROTECTED]>

Signed-off-by: Jordan Crouse <[EMAIL PROTECTED]>
---

 drivers/video/olpc_dcon.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/video/olpc_dcon.c b/drivers/video/olpc_dcon.c
index a66b222..1e7d2c3 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? */
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to