[PATCH 1/1] thinkpad_acpi: Make ThinkLight work with suspend / resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 The status of the ThinkLight was not restored on resume,
 make it work

Signed-off-by: Simon Danner <danner.simon@xxxxxxxxx>
---
 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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel


[Index of Archives]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite Photos]     [Yosemite Advice]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux