All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuduo Sang <shuduo.sang@canonical.com>
To: ibm-acpi@hmh.eng.br, matthew.garrett@nebula.com,
	ibm-acpi-devel@lists.sourceforge.net,
	paltform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: bruce.ma@canonical.com
Subject: [PATCH] support thinkpad HKEY interface version 0x200
Date: Tue, 11 Mar 2014 20:24:19 +0800	[thread overview]
Message-ID: <531F0073.7060103@canonical.com> (raw)

Hi,

Please kindly review following patch. It support new BIOS which shiped
with Thinkpad X1 Carbon 2nd generation. Without it, hotkey mask be
routed to wrong branch and some hot key will not work.

Thanks,
Shuduo

>From 3c67b2731a61539363a62284a43b98fa3e2ba784 Mon Sep 17 00:00:00 2001
From: Shuduo Sang <shuduo.sang@canonical.com>
Date: Tue, 11 Mar 2014 20:13:15 +0800
Subject: [PATCH] support HKEY interface version 0x200

Thinkpad X1 Carbon 2nd generation ships with new BIOS will return HKEY
interface version 0x200. It need thinkpad-acpi support otherwise it
will be routed to wrong branch and hotkey mask is wrong.

Signed-off-by: Bruce Ma <bruce.ma@canonical.com>
Signed-off-by: Shuduo Sang <shuduo.sang@canonical.com>
---
 drivers/platform/x86/thinkpad_acpi.c | 39
+++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c
b/drivers/platform/x86/thinkpad_acpi.c
index defb6af..939fc81 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3244,11 +3244,8 @@ static int __init hotkey_init(struct
ibm_init_struct *iibm)
 	   A30, R30, R31, T20-22, X20-21, X22-24.  Detected by checking
 	   for HKEY interface version 0x100 */
 	if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
-		if ((hkeyv >> 8) != 1) {
-			pr_err("unknown version of the HKEY interface: 0x%x\n",
-			       hkeyv);
-			pr_err("please report this to %s\n", TPACPI_MAIL);
-		} else {
+		switch (hkeyv >> 8) {
+		case 1:
 			/*
 			 * MHKV 0x100 in A31, R40, R40e,
 			 * T4x, X31, and later
@@ -3261,13 +3258,41 @@ static int __init hotkey_init(struct
ibm_init_struct *iibm)
 			if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
 					"MHKA", "qd")) {
 				pr_err("missing MHKA handler, "
-				       "please report this to %s\n",
-				       TPACPI_MAIL);
+					"please report this to %s\n",
+					TPACPI_MAIL);
 				/* Fallback: pre-init for FN+F3,F4,F12 */
 				hotkey_all_mask = 0x080cU;
 			} else {
 				tp_features.hotkey_mask = 1;
 			}
+			break;
+
+		case 2:
+			/*
+			 * MHKV 0x200 in X1
+			 */
+			vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+				"firmware HKEY interface version: 0x%x\n",
+				hkeyv);
+
+			/* Paranoia check AND init hotkey_all_mask */
+			if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
+					"MHKA", "dd", 1)) {
+				pr_err("missing MHKA handler, "
+					"please report this to %s\n",
+					TPACPI_MAIL);
+				/* Fallback: pre-init for FN+F3,F4,F12 */
+				hotkey_all_mask = 0x080cU;
+			} else {
+				tp_features.hotkey_mask = 1;
+			}
+			break;
+
+		default:
+			pr_err("unknown version of the HKEY interface: 0x%x\n",
+			       hkeyv);
+			pr_err("please report this to %s\n", TPACPI_MAIL);
+			break;
 		}
 	}

-- 
1.9.0


             reply	other threads:[~2014-03-11 12:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 12:24 Shuduo Sang [this message]
2014-04-03 15:44 ` [ibm-acpi-devel] [PATCH] support thinkpad HKEY interface version 0x200 Henrique de Moraes Holschuh
     [not found]   ` <20140403154427.GB32027-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2014-04-03 16:21     ` Shuduo Sang
2014-04-03 17:03       ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
2014-04-11 13:10   ` Shuduo Sang
2014-04-11 13:43     ` Matthew Garrett
2014-04-11 13:55       ` Shuduo Sang
     [not found]         ` <CA+BAWBTb6Z1g-kNsyeAKAGjoUR1vXu3ZC33R+BO3+WH=64USoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-06 12:32           ` Shuduo Sang
     [not found]             ` <CA+BAWBQdGn54LO50Z0iB=X2D0r40Xp8+ryu1=GP7Kzv6PTU9bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-26 11:10               ` Shuduo Sang
     [not found]         ` <CA+BAWBRa8H_9ANHjMC0sa6GLvuMMY2jcgXxO8Ovp94tD9Pv0vg@mail.gmail.com>
2014-05-26 11:17           ` [ibm-acpi-devel] " Shuduo Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531F0073.7060103@canonical.com \
    --to=shuduo.sang@canonical.com \
    --cc=bruce.ma@canonical.com \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ibm-acpi@hmh.eng.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=paltform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.