* [PATCH] save and restore adaptive keyboard mode for suspend and,resume
@ 2014-03-27 10:06 Shuduo Sang
2014-04-03 15:47 ` [ibm-acpi-devel] [PATCH] save and restore adaptive keyboard mode for suspend and, resume Henrique de Moraes Holschuh
0 siblings, 1 reply; 2+ messages in thread
From: Shuduo Sang @ 2014-03-27 10:06 UTC (permalink / raw)
To: ibm-acpi, matthew.garrett, ibm-acpi-devel, platform-driver-x86
Cc: bruce.ma, joey.zheng
Dan Aloni has submitted a patch to set adaptive mode to function mode
when system resume back. Thanks Dan. :)
Following patch can make it to be restored to previous mode like What
Windows does.
Thanks,
Shuduo
From 0ca960138518ceab23110141a0d7c0cafd54a859 Mon Sep 17 00:00:00 2001
From: Shuduo Sang <shuduo.sang@canonical.com>
Date: Thu, 27 Mar 2014 17:51:24 +0800
Subject: [PATCH] save and restore adaptive keyboard mode for suspend and
resume
The mode of adaptive keyboard on X1 Carbon need be saved first before
suspend then it can be restored after resume. Otherwise it will be
unusable.
Signed-off-by: Bruce Ma <bruce.ma@canonical.com>
Signed-off-by: Shuduo Sang <shuduo.sang@canonical.com>
---
drivers/platform/x86/thinkpad_acpi.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/platform/x86/thinkpad_acpi.c
b/drivers/platform/x86/thinkpad_acpi.c
index f8305d1..9a5a19d 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3855,13 +3855,28 @@ static void hotkey_notify(struct ibm_struct
*ibm, u32 event)
static void hotkey_suspend(void)
{
+ int hkeyv;
+
/* Do these on suspend, we get the events on early resume! */
hotkey_wakeup_reason = TP_ACPI_WAKEUP_NONE;
hotkey_autosleep_ack = 0;
+
+ /* save previous mode of adaptive keyboard of X1 Carbon */
+ if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
+ if ((hkeyv >> 8) == 2) {
+ if (!acpi_evalf(hkey_handle,
+ &adaptive_keyboard_prev_mode,
+ "GTRW", "dd", 0)) {
+ pr_err("Cannot read adaptive keyboard mode.\n");
+ }
+ }
+ }
}
static void hotkey_resume(void)
{
+ int hkeyv;
+
tpacpi_disable_brightness_delay();
if (hotkey_status_set(true) < 0 ||
@@ -3874,6 +3889,18 @@ static void hotkey_resume(void)
hotkey_wakeup_reason_notify_change();
hotkey_wakeup_hotunplug_complete_notify_change();
hotkey_poll_setup_safe(false);
+
+ /* restore previous mode of adapive keyboard of X1 Carbon */
+ if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
+ if ((hkeyv >> 8) == 2) {
+ if (!acpi_evalf(hkey_handle,
+ NULL,
+ "STRW", "vd",
+ adaptive_keyboard_prev_mode)) {
+ pr_err("Cannot set adaptive keyboard mode.\n");
+ }
+ }
+ }
}
/* procfs -------------------------------------------------------------- */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [ibm-acpi-devel] [PATCH] save and restore adaptive keyboard mode for suspend and, resume
2014-03-27 10:06 [PATCH] save and restore adaptive keyboard mode for suspend and,resume Shuduo Sang
@ 2014-04-03 15:47 ` Henrique de Moraes Holschuh
0 siblings, 0 replies; 2+ messages in thread
From: Henrique de Moraes Holschuh @ 2014-04-03 15:47 UTC (permalink / raw)
To: Shuduo Sang
Cc: ibm-acpi, matthew.garrett, ibm-acpi-devel, platform-driver-x86,
joey.zheng, bruce.ma
On Thu, 27 Mar 2014, Shuduo Sang wrote:
> Dan Aloni has submitted a patch to set adaptive mode to function mode
> when system resume back. Thanks Dan. :)
>
> Following patch can make it to be restored to previous mode like What
> Windows does.
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-03 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 10:06 [PATCH] save and restore adaptive keyboard mode for suspend and,resume Shuduo Sang
2014-04-03 15:47 ` [ibm-acpi-devel] [PATCH] save and restore adaptive keyboard mode for suspend and, resume Henrique de Moraes Holschuh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.