From patchwork Tue Apr 19 11:11:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Nocera X-Patchwork-Id: 8878881 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C4FF9BF29F for ; Tue, 19 Apr 2016 11:16:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4430200D6 for ; Tue, 19 Apr 2016 11:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63F682026D for ; Tue, 19 Apr 2016 11:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753954AbcDSLQS (ORCPT ); Tue, 19 Apr 2016 07:16:18 -0400 Received: from slow1-d.mail.gandi.net ([217.70.178.86]:34763 "EHLO slow1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752373AbcDSLQR (ORCPT ); Tue, 19 Apr 2016 07:16:17 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by slow1-d.mail.gandi.net (Postfix) with ESMTP id 98CE047AFC4 for ; Tue, 19 Apr 2016 13:11:40 +0200 (CEST) Received: from mfilter38-d.gandi.net (mfilter38-d.gandi.net [217.70.178.169]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id B9ECBC5A74; Tue, 19 Apr 2016 13:11:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter38-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter38-d.gandi.net (mfilter38-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id P2kaV5_7CPMS; Tue, 19 Apr 2016 13:11:37 +0200 (CEST) X-Originating-IP: 83.155.44.161 Received: from classic.localdomain (mon69-7-83-155-44-161.fbx.proxad.net [83.155.44.161]) (Authenticated sender: hadess@hadess.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 17F57C5A5A; Tue, 19 Apr 2016 13:11:35 +0200 (CEST) From: Bastien Nocera To: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: Henrique de Moraes Holschuh , Darren Hart , Shuduo Sang , Bruce Ma Subject: [PATCH] thinkpad_acpi: support HKEY interface version 0x200 Date: Tue, 19 Apr 2016 13:11:34 +0200 Message-Id: <1461064294-2879-1-git-send-email-hadess@hadess.net> X-Mailer: git-send-email 2.7.3 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shuduo Sang The Thinkpad X1 Carbon 2nd generation (2014) ships with BIOS that will return HKEY interface version 0x200. It needs thinkpad-acpi support otherwise it will be routed to wrong branch and the hotkey mask will be wrong. https://bugzilla.kernel.org/show_bug.cgi?id=114731 Signed-off-by: Bruce Ma Signed-off-by: Shuduo Sang --- drivers/platform/x86/thinkpad_acpi.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index dad2984..c177936 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3357,11 +3357,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 @@ -3381,6 +3378,34 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) } 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; } }