Skip to contentSkip to conversation

apple-gmux: Add suspend/resume support for the backlight

PATCH New Seth Forshee 1 participant 1 message May 10, 2012 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 apple-gmux: Add suspend/resume support for the backlight

After S3, the brightness might not be restored to the pre-suspend value. Request status update calls from the backlight core on suspend/resume to ensure the brightness value is restored.

---
Matthew: This is a replacement for the patch in linux-next, updated based on David's suggestion to leave the backlight level unchanged when suspended rather than setting it to 0. If possible I'd still like to see it land in 3.4.

 drivers/platform/x86/apple-gmux.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/apple-gmux.c +4 -0
index 8a582bd..694a15a 100644
@@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
 	struct apple_gmux_data *gmux_data = bl_get_data(bd);
 	u32 brightness = bd->props.brightness;
 
+	if (bd->props.state & BL_CORE_SUSPENDED)
+		return 0;
+
 	/*
 	 * Older gmux versions require writing out lower bytes first then
 	 * setting the upper byte to 0 to flush the values. Newer versions
@@ -102,6 +105,7 @@ static int gmux_update_status(struct backlight_device *bd)
 }
 
 static const struct backlight_ops gmux_bl_ops = {
+	.options = BL_CORE_SUSPENDRESUME,
 	.get_brightness = gmux_get_brightness,
 	.update_status = gmux_update_status,
 };
Signature · 1 line
1.7.9.5