The status of the ThinkLight was not restored on resume, make it work Signed-off-by: Simon Danner <danner.simon@xxxxxxxxx> Acked-by: Henrique de Moraes Holschuh <hmh@xxxxxxxxxx> --- drivers/platform/x86/thinkpad_acpi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 75dd651..c046909 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -4762,6 +4762,8 @@ static struct ibm_struct video_driver_data = { * Light (thinklight) subdriver */ +static int light_resume_status; + TPACPI_HANDLE(lght, root, "\\LGHT"); /* A21e, A2xm/p, T20-22, X20-21 */ TPACPI_HANDLE(ledb, ec, "LEDB"); /* G4x */ @@ -4921,11 +4923,38 @@ static int light_write(char *buf) return light_set_status(newstatus); } +static void light_suspend(void) +{ + if (!tp_features.light || !tp_features.light_status) + return; + + light_resume_status = light_get_status(); + + if (light_resume_status < 0) + pr_notice("failed to read light status for later restore" + "during resume: %d\n", light_resume_status); +} + +static void light_resume(void) +{ + int rc; + + if (!tp_features.light || !tp_features.light_status) + return; + + rc = light_set_status(light_resume_status); + if (rc < 0) + pr_notice("failed to restore light status: %d\n", rc); + +} + static struct ibm_struct light_driver_data = { .name = "light", .read = light_read, .write = light_write, .exit = light_exit, + .suspend = light_suspend, + .resume = light_resume, }; /************************************************************************* -- 1.8.0.2 -- To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html