Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp660159ybg; Wed, 10 Jun 2020 10:14:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyDBPrnHB/qFnM9K86lyzXPGWcPgUXoeVhKVCumGLg23cBRjq6iKY1RZB7n4NQJfYHSy0C X-Received: by 2002:a17:906:6403:: with SMTP id d3mr4275947ejm.386.1591809281880; Wed, 10 Jun 2020 10:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591809281; cv=none; d=google.com; s=arc-20160816; b=k6oRlBsalZrRNoTXiSIwE1dTKFEOxdWiRV1PVowQKpvUkiCeRj3eJw+rtjW1k0P9b3 Lt5TuA6JsQT3uQMOfannkaI+te6Ajn6kh9cVImcyJTT3hNPGey0Jn6iiVd1GiLyeGYJU 81WfPshizmQ3TtQlCoHxMVo+AGL3DgyOpS/p1uxdRkr/+9MwCRaUbs2ETLT54p2hYuP8 cKB232GLEO0HvfHvYqFbZnGYRN7vOv47C4kEVUJpTGTcRSZBzBm8v5KJzVi/np1Yisu1 p43klYHPMjfos8tULSIPkn9Xsv4GOGsGnItKKaGigA4Yt9fqCsGY0q9xz/1SpM/jKuMx lrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=zRDfER/8zT+HTaqxdT4b9OkV1Fm5JbOq452YVD7GwWA=; b=D/+cjJSTfw6bWtXBoNeHEau/cVU87tFeQoVbaXbOykjWElwa9mPxfxygjePn/Ikym+ s2abEvNuizL+gGHENVG3oT03+XDkGpyCAPtKYcfM3z+lSoDEyJdcfhm262hTVLoU5twn AVZYfcicu5k048UTk4wvAwww+z5DsLJzsDL0bb/WFDxzPZFHdmGJQ4GcBLNefDawpMix O+j4MPsgCh1mTg42DHNFwDoJw46FaDIyDz4W7adc0brlEbEpKA1R7Zk5xrYIHrFMuxoI qLkcPzruLmIdGGELtpnPC84RGc40BoYuTL8f3+VYa941KG/hiub/Yb5tv/QgLxKayz2D ktkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si408123eji.209.2020.06.10.10.14.19; Wed, 10 Jun 2020 10:14:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730251AbgFJPiC (ORCPT + 99 others); Wed, 10 Jun 2020 11:38:02 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:43200 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgFJPiB (ORCPT ); Wed, 10 Jun 2020 11:38:01 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jj2ne-0003Cl-R4; Wed, 10 Jun 2020 15:37:59 +0000 From: Kai-Heng Feng To: alex.hung@canonical.com Cc: Kai-Heng Feng , Darren Hart , Andy Shevchenko , platform-driver-x86@vger.kernel.org (open list:INTEL HID EVENT DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] platform/x86: intel-hid: Use hp-wireless for rfkill on HP platforms Date: Wed, 10 Jun 2020 23:37:47 +0800 Message-Id: <20200610153747.27040-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wireless hotkey on HP platforms can trigger two events, if both hp-wireless and intel-hid are supported. Two events at the same time renders wireless hotkey useless. HP confirmed that hp-wireless (HPQ6001) should always be the canonical source of wireless hotkey event, so skip registering rfkill hotkey if HPQ6001 is present. Signed-off-by: Kai-Heng Feng --- drivers/platform/x86/intel-hid.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index 9ee79b74311c..31091c8faf70 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c @@ -25,6 +25,8 @@ static const struct acpi_device_id intel_hid_ids[] = { }; MODULE_DEVICE_TABLE(acpi, intel_hid_ids); +static bool hp_wireless_present; + /* In theory, these are HID usages. */ static const struct key_entry intel_hid_keymap[] = { /* 1: LSuper (Page 0x07, usage 0xE3) -- unclear what to do */ @@ -49,6 +51,29 @@ static const struct key_entry intel_hid_keymap[] = { { KE_END }, }; +static const struct key_entry intel_hid_no_rfkill_keymap[] = { + /* 1: LSuper (Page 0x07, usage 0xE3) -- unclear what to do */ + /* 2: Toggle SW_ROTATE_LOCK -- easy to implement if seen in wild */ + { KE_KEY, 3, { KEY_NUMLOCK } }, + { KE_KEY, 4, { KEY_HOME } }, + { KE_KEY, 5, { KEY_END } }, + { KE_KEY, 6, { KEY_PAGEUP } }, + { KE_KEY, 7, { KEY_PAGEDOWN } }, + /* 8: rfkill -- use hp-wireless instead */ + { KE_KEY, 9, { KEY_POWER } }, + { KE_KEY, 11, { KEY_SLEEP } }, + /* 13 has two different meanings in the spec -- ignore it. */ + { KE_KEY, 14, { KEY_STOPCD } }, + { KE_KEY, 15, { KEY_PLAYPAUSE } }, + { KE_KEY, 16, { KEY_MUTE } }, + { KE_KEY, 17, { KEY_VOLUMEUP } }, + { KE_KEY, 18, { KEY_VOLUMEDOWN } }, + { KE_KEY, 19, { KEY_BRIGHTNESSUP } }, + { KE_KEY, 20, { KEY_BRIGHTNESSDOWN } }, + /* 27: wake -- needs special handling */ + { KE_END }, +}; + /* 5 button array notification value. */ static const struct key_entry intel_array_keymap[] = { { KE_KEY, 0xC2, { KEY_LEFTMETA } }, /* Press */ @@ -317,7 +342,8 @@ static int intel_hid_input_setup(struct platform_device *device) if (!priv->input_dev) return -ENOMEM; - ret = sparse_keymap_setup(priv->input_dev, intel_hid_keymap, NULL); + ret = sparse_keymap_setup(priv->input_dev, hp_wireless_present ? + intel_hid_no_rfkill_keymap : intel_hid_keymap, NULL); if (ret) return ret; @@ -575,6 +601,9 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) dev_info(&dev->dev, "intel-hid: created platform device\n"); + if (!strcmp(acpi_device_hid(dev), "HPQ6001")) + hp_wireless_present = true; + return AE_OK; } -- 2.17.1