From 96960880c31131ab906e7e0627ab89e8319c385e Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Thu, 19 Apr 2012 10:55:35 -0500 Subject: 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. Reported-and-tested-by: Austin Lund Signed-off-by: Seth Forshee Signed-off-by: Matthew Garrett --- drivers/platform/x86/apple-gmux.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/platform/x86/apple-gmux.c') diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 8a582bdfdc76..6dcef4f199bb 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -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) + brightness = 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, }; -- cgit v1.2.3-59-g8ed1b From a2f01a899347fd97cb18094e5a55640cab552818 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Fri, 1 Jun 2012 15:18:52 -0400 Subject: apple-gmux: Fix up the suspend/resume patch I incorporated the wrong version of the suspend/resume patch for gmux, and so lost David Woodhouse's fix to leave the backlight level unchanged over suspend/resume. This fixes it up to v2. Signed-off-by: Matthew Garrett --- drivers/platform/x86/apple-gmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/platform/x86/apple-gmux.c') diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 6dcef4f199bb..694a15a56230 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -88,7 +88,7 @@ static int gmux_update_status(struct backlight_device *bd) u32 brightness = bd->props.brightness; if (bd->props.state & BL_CORE_SUSPENDED) - brightness = 0; + return 0; /* * Older gmux versions require writing out lower bytes first then -- cgit v1.2.3-59-g8ed1b