Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2391489rdb; Thu, 21 Sep 2023 18:20:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsTWWbyQ0HX7vNCzCG7Cyol56amKHzMcH5v9RybJ+KUqNSMwqvKLC624ObmdKqGPUi8Ekj X-Received: by 2002:a05:6358:881e:b0:143:723:8f89 with SMTP id hv30-20020a056358881e00b0014307238f89mr8817753rwb.4.1695345617413; Thu, 21 Sep 2023 18:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695345617; cv=none; d=google.com; s=arc-20160816; b=OCLntE2nBBwd28swUKiiqyjHr3J4gmhi2zSzBr+3YWjHFkBPyxwnHZm+ZJ1Higkv8F 6h6sf0V7KkiGBlD7OytwRwuL5f0130OIEQYHooF6vZEKcqTRDFqa8t8aw5aV8hivyWRF FJEB10w/U/1e5YCyhwv/WBMFhcb8KK57K8WLMfAZ3a89P3WqkSrhtr0dkLRNLr1ZwsWJ UaXsgn5rDYeqGXopglsfvUjax8o4zZpWkMnF7kV67gtKrNpva1MFsTAoS6alKhVTaGeC +yaBIIfOqIAsl03LZWyaHy75Zgxm5RATazkzN812EFWp9QqXAnfoc+4ZTkrwDsffaPsF V7gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6+D1LdATPdfFDeNVwYQdBcc4vhU2RAGKsUsmGnVlgFw=; fh=Y8NTCuHDNQUi1Y7edzN1WOu8jwcMKdKWGbAHrwF7W6M=; b=n19HbLkGrYfxLpEQzJYot6LpuCY1IyJ2IKrRF9OmGZPu0+jXwGCYt63oYtD1K21UfB 6Luk6jzeFXr3ee8ZA8QvAH4syLVPfap3/OQbuVrW/+oB2fEQOF3067a2z4mmgntiB2bM rmqrf8zAyF6Em3e0DeGL+xgmhJ3a7s0i0eSH8TCKiiQy/UThTb3qedK94aYuUDBNKrny 7fghEKUNDi9BaSzl6FHH0yHosmI0J/lakGr2O07bGz2IewWhIvgw/nBOOxeaCVp+p01y hbC/twsR6TdDYNEyDJ9j5HJZMrgUnlni7vMRAFgI7S1CLnPESrKaGx9Fc7Ab9CRoK1uk m3Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.de header.s=2017 header.b=LPmm0Pu3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.de Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bu6-20020a056a00410600b006910a45a23bsi2691569pfb.366.2023.09.21.18.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@posteo.de header.s=2017 header.b=LPmm0Pu3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 83651829A05B; Thu, 21 Sep 2023 10:13:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbjIURM4 (ORCPT + 99 others); Thu, 21 Sep 2023 13:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjIURLn (ORCPT ); Thu, 21 Sep 2023 13:11:43 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8206FFF90 for ; Thu, 21 Sep 2023 10:06:17 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1BDAD240105 for ; Thu, 21 Sep 2023 11:22:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1695288120; bh=KlagOBJ/Znqi813S+2Fe679zuj+86NZUSO3PsTHMyNI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=LPmm0Pu3SNgwlNsSM9gIxh1QJd1m67mMi2nH8+59Xx0X876YhVKTyvDWRDVg/LNzV kvM88FD6Aaio8GHeXEYaTYKvYNegD2TPLVcj5rp2mhwkNA/n+XinVFY/XrWmIqbG/H XKOGcM3hoGON5O6ZM0IXDPSu0HIs3B3ZvmUStgGwi5j/3+3DYnJpcC8+yD0GZv+Xhd U4WWZbh+0XCeT9Bl4dfbS67mNFNcRJ5bL/D8aF7AvqPZQeN8ACJZ03iTO1kc6B5SXb H+ApAzqv5lpkPeA47FuQtwi90ab2qzOh1Opu/82XtUqggj1zxQO+Mw6lFVV70vkeGO D6YVjNRBEo3vQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RrqfZ3sFWz9rxS; Thu, 21 Sep 2023 11:21:58 +0200 (CEST) From: Martin Kepplinger To: jikos@kernel.org, benjamin.tissoires@redhat.com, jm@lentin.co.uk, linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, Martin Kepplinger Subject: [PATCH] HID: lenovo: Fix middle-button behaviour for system suspend Date: Thu, 21 Sep 2023 09:21:40 +0000 Message-Id: <20230921092140.120533-1-martink@posteo.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 21 Sep 2023 10:13:00 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email After system suspend the middle-button mode is being reset to compatibility mode which simply breaks functionality for the devices where native mode is configured during probe(). Fix this by setting native mode in reset_resume() for the appropriate devices. Fixes: 94eefa271323 ("HID: lenovo: Use native middle-button mode for compact keyboards") Signed-off-by: Martin Kepplinger --- drivers/hid/hid-lenovo.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 44763c0da444..d20562b9eca6 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -1344,6 +1344,28 @@ static int lenovo_input_configured(struct hid_device *hdev, return 0; } +static int __maybe_unused lenovo_resume(struct hid_device *hdev) +{ + int ret; + + switch (hdev->product) { + case USB_DEVICE_ID_LENOVO_CUSBKBD: + case USB_DEVICE_ID_LENOVO_CBTKBD: + case USB_DEVICE_ID_LENOVO_TPIIUSBKBD: + case USB_DEVICE_ID_LENOVO_TPIIBTKBD: + /* Switch middle button to native mode again */ + ret = lenovo_send_cmd_cptkbd(hdev, 0x09, 0x01); + if (ret) + hid_warn(hdev, "Failed to switch middle button: %d\n", + ret); + break; + default: + ret = 0; + break; + } + + return ret; +} static const struct hid_device_id lenovo_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, @@ -1380,6 +1402,9 @@ static struct hid_driver lenovo_driver = { .raw_event = lenovo_raw_event, .event = lenovo_event, .report_fixup = lenovo_report_fixup, +#ifdef CONFIG_PM + .reset_resume = lenovo_resume, +#endif }; module_hid_driver(lenovo_driver); -- 2.39.2