Hi all,

I got a message "unhandled HKEY 0x60c0" when turning my Thinkpad Yoga into 
tablet mode and turning back to normal mode.
According to a message in this mailing list, this HKEY was also reported for 
Thinkpad Helix.
I have tried to figure out this issue and got a solution by looking into DSDT.

Thanks,

Taegil

---
 drivers/platform/x86/thinkpad_acpi.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c 
b/drivers/platform/x86/thinkpad_acpi.c
index defb6af..5a4c72e 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -207,6 +207,9 @@ enum tpacpi_hkey_event_t {
        /* AC-related events */
        TP_HKEY_EV_AC_CHANGED           = 0x6040, /* AC status changed */
 
+       /* Tablet mode of Thinkpad Yoga */
+       TP_HKEY_EV_TABLET_MODE          = 0x60c0, /* into or back from tablet */
+
        /* Misc */
        TP_HKEY_EV_RFKILL_CHANGED       = 0x7000, /* rfkill switch changed */
 };
@@ -300,7 +303,7 @@ static struct {
        u32 hotkey:1;
        u32 hotkey_mask:1;
        u32 hotkey_wlsw:1;
-       u32 hotkey_tablet:1;
+       u32 hotkey_tablet:2;
        u32 light:1;
        u32 light_status:1;
        u32 bright_acpimode:1;
@@ -2059,10 +2062,15 @@ static int hotkey_get_tablet_mode(int *status)
 {
        int s;
 
-       if (!acpi_evalf(hkey_handle, &s, "MHKG", "d"))
+       if (tp_features.hotkey_tablet == 1
+           && acpi_evalf(hkey_handle, &s, "MHKG", "d"))
+               *status = ((s & TP_HOTKEY_TABLET_MASK) != 0);
+       else if (tp_features.hotkey_tablet == 2
+                && acpi_evalf(hkey_handle, &s, "GMMS", "dd", 0))
+               *status = (s == 0x00010003);
+       else
                return -EIO;
 
-       *status = ((s & TP_HOTKEY_TABLET_MASK) != 0);
        return 0;
 }
 
@@ -3316,6 +3324,11 @@ static int __init hotkey_init(struct ibm_init_struct 
*iibm)
        if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) {
                tp_features.hotkey_tablet = 1;
                tabletsw_state = !!(status & TP_HOTKEY_TABLET_MASK);
+       } else if (!res && acpi_evalf(hkey_handle, &status, "GMMS", "qdd", 0)) {
+               tp_features.hotkey_tablet = 2;
+               tabletsw_state = (status == 0x00010003);
+       }
+       if (tp_features.hotkey_tablet) {
                pr_info("possible tablet mode switch found; "
                        "ThinkPad in %s mode\n",
                        (tabletsw_state) ? "tablet" : "laptop");
@@ -3612,6 +3625,12 @@ static bool hotkey_notify_6xxx(const u32 hkey,
                *ignore_acpi_ev = true;
                return true;
 
+       case TP_HKEY_EV_TABLET_MODE:   /* Thinkpad Yoga */
+               tpacpi_input_send_tabletsw();
+               hotkey_tablet_mode_notify_change();
+               *send_acpi_ev = false;
+               return true;
+
        default:
                pr_warn("unknown possible thermal alarm or keyboard event 
received\n");
                known = false;
-- 
1.9.0


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel

Reply via email to