From patchwork Mon May 9 21:49:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9050241 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F8AE9F372 for ; Mon, 9 May 2016 21:50:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BFAE2011E for ; Mon, 9 May 2016 21:50:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 89C05200F3 for ; Mon, 9 May 2016 21:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752987AbcEIVuX (ORCPT ); Mon, 9 May 2016 17:50:23 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:63618 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753253AbcEIVuV (ORCPT ); Mon, 9 May 2016 17:50:21 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0MUQni-1b9LDo1G4o-00R4lw; Mon, 09 May 2016 23:49:42 +0200 From: Arnd Bergmann To: Ike Panhc , Darren Hart Cc: Arnd Bergmann , Denis Gordienko , Hans de Goede , Josh Boyer , Philippe Coval , Christian Hesse , Dmitry Tunin , John Dahlstrom , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ideapad-laptop: add a new WMI string for ESC key Date: Mon, 9 May 2016 23:49:21 +0200 Message-Id: <1462830577-1670360-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:Nhd9269ZVmfLvAr5dx1CUzmRnvFWykFkm8rOJbkD/nnEcBpOfHK +Afi6b/PuN5L+vb7KurYzGz0gZ4bN5o/4Cttfxh9F8jt+VnUJjn3sMHTecRFSQARlgjkFjI BgpUNY76oY3HA1hQigNlAqV4bPDUqQWCDtpXFoyWMxG39M1XIRjlKH+VP19AK4yPNPKwP6s ZJ93cL7FMh3uUsWj0hD9Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:M49/qsY/ky0=:ZT6H24ziDA61oAJ3DETw/g +zfx+JXgL6POI5MLOa7zt+wiNpwNymfDXaQyW2NM1hFl9fsvzPweH2i9+5nmi62fp3xZe86rX oD+RD3G58twgUC8+XWd5VNLvs4SVwoD70fjeKa1NXmF21YFuNvoOEXfSgWkSJYL7dsx3JN6Wf BcoO94mtRu614qe6/mBMfjy8xrAvxnLcW77bZEtXusj/50wha1x675obDQPNpoVuMqWhqhoSj JF8jj6QeFP33Liwo8Yhi2UV7ewEyRbWIs2QygVRouz1/4paxhBTdit/oLcIPd8oU4I7bITUKw OntJ9g1RpxI7zj3Y9MchdhQMS4+7CZASgDTJCOvD0BQ59684FZFv6VxctzUrsQbIVir6GqaOZ cyed+kjx8xiwr7upcNAYrXhstGgI/8+xzWUT89IN7+oZ4G9bCQwRBeOajHQILGht3rKdmJ1c1 Eznzfb3zjTuek8CcFLcUERc/bbecjNTMuz34Tn2wkGt/6W9z94LHLot+NtySfopRwQce4SX5Z dXWI4nmAg1m67FBnS0TW12gDFcqyuKG+dl8HgJgMDEIi43MjJqW6Cx7OVawbJWzl1UdqrztB/ QvmsJVuL2Y1j7vIV3c1wiRQnecaA7ZcpoUtE18UqJ7Qu1eoeNaEKlRjvbgLWTtde+GNOAQV1S aFXn+4tJNUTXTWCrF+Atrzp0CX0obk+2rzQu8hTpizC+dt+iyQvH7UYjW6R5DsXS6bgg= 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=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 My patch to the ideapad-laptop driver to get the ESC key working on the Yoga 1170 (Yoga 3) failed to do the same for the following model, the Lenovo Yoga 700. Denis Gordienko managed to get it working by adding another GUID for the new WMI interface. I have adapted his patch to normal coding style and simplified it a bit for inclusion, but this patch is currently untested. Link: https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/YOGA-3-14-How-to-reclaim-my-Esc-key-and-permanently-disable/m-p/3317499 Signed-off-by: Arnd Bergmann Cc: Denis Gordienko --- drivers/platform/x86/ideapad-laptop.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 1d49db124753..531ecca9dbe3 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -48,7 +48,10 @@ #define CFG_CAMERA_BIT (19) #if IS_ENABLED(CONFIG_ACPI_WMI) -static const char ideapad_wmi_fnesc_event[] = "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6"; +static const char* ideapad_wmi_fnesc_events[] = { + "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6", /* Yoga 3 */ + "56322276-8493-4CE8-A783-98C991274F5E", /* Yoga 700 */ +}; #endif enum { @@ -93,6 +96,7 @@ struct ideapad_private { struct dentry *debug; unsigned long cfg; bool has_hw_rfkill_switch; + const char *fnesc_guid; }; static bool no_bt_rfkill; @@ -990,8 +994,16 @@ static int ideapad_acpi_add(struct platform_device *pdev) ACPI_DEVICE_NOTIFY, ideapad_acpi_notify, priv); if (ret) goto notification_failed; + #if IS_ENABLED(CONFIG_ACPI_WMI) - ret = wmi_install_notify_handler(ideapad_wmi_fnesc_event, ideapad_wmi_notify, priv); + for (i = 0; i < ARRAY_SIZE(ideapad_wmi_fnesc_events); i++) { + ret = wmi_install_notify_handler(ideapad_wmi_fnesc_events[i], + ideapad_wmi_notify, priv); + if (ret == AE_OK) { + priv->fnesc_guid = ideapad_wmi_fnesc_events[i]; + break; + } + } if (ret != AE_OK && ret != AE_NOT_EXIST) goto notification_failed_wmi; #endif @@ -1021,7 +1033,8 @@ static int ideapad_acpi_remove(struct platform_device *pdev) int i; #if IS_ENABLED(CONFIG_ACPI_WMI) - wmi_remove_notify_handler(ideapad_wmi_fnesc_event); + if (priv->fnesc_guid) + wmi_remove_notify_handler(priv->fnesc_guid); #endif acpi_remove_notify_handler(priv->adev->handle, ACPI_DEVICE_NOTIFY, ideapad_acpi_notify);