From patchwork Wed Mar 23 03:18:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1608426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=isEugv0T; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KNYWF3QF5z9s5V for ; Wed, 23 Mar 2022 14:19:52 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nWrXD-0000ww-H1; Wed, 23 Mar 2022 03:19:43 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nWrXA-0000w3-7w for kernel-team@lists.ubuntu.com; Wed, 23 Mar 2022 03:19:40 +0000 Received: from localhost.localdomain (unknown [10.101.196.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 441D93F1B5 for ; Wed, 23 Mar 2022 03:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648005580; bh=GFEL+xOzaRGAcy8nwWbQbJIlOBZrtr/1ccNi0FQ7pvA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=isEugv0TM/TVvRzL+hmIYJ4HUB1InOEHg0mE1ZuERQqhm8TirAy/FY5U62flzfWtD eWHwO2Ci91706SXdGwv0fZEmoH8+pIZ+9+1zhoKUOPVGA8FKK3+gnyhbkSQUq7BUcG /PuhPVnb3/rN7Tj+OC91rvJxXZp/pwsrhOPdkPmie1g61N06pJHzxKoTOnu9MXSY5b M2HetSl478cFppwx74Z3eFEv9w9H9lqeq51J6vCasSQs2nmvOhqblRVlLlV9tNDpdD Sg5oJB9+ns3r02zcOVj5peIrXriwRZMpGfycJyz3WhSGGplqH1UWOftb/MXbq5aNgd O2rGnwIbCDb1Q== From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [J/OEM-5.14] [PATCH 1/2] gpiolib: acpi: Convert ACPI value of debounce to microseconds Date: Wed, 23 Mar 2022 11:18:53 +0800 Message-Id: <20220323031854.31008-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323031854.31008-1-kai.heng.feng@canonical.com> References: <20220323031854.31008-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Andy Shevchenko BugLink: https://bugs.launchpad.net/bugs/1966010 It appears that GPIO ACPI library uses ACPI debounce values directly. However, the GPIO library APIs expect the debounce timeout to be in microseconds. Convert ACPI value of debounce to microseconds. While at it, document this detail where it is appropriate. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215664 Reported-by: Kai-Heng Feng Fixes: 8dcb7a15a585 ("gpiolib: acpi: Take into account debounce settings") Signed-off-by: Andy Shevchenko Tested-by: Kai-Heng Feng Reviewed-by: Mika Westerberg Signed-off-by: Bartosz Golaszewski (cherry picked from commit 660c619b9d7ccd28648ee3766cdbe94ec7b27402) Signed-off-by: Kai-Heng Feng --- drivers/gpio/gpiolib-acpi.c | 6 ++++-- drivers/gpio/gpiolib.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index d040c72fea582..4c2e32c38acca 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -311,7 +311,8 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip, if (IS_ERR(desc)) return desc; - ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); + /* ACPI uses hundredths of milliseconds units */ + ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout * 10); if (ret) dev_warn(chip->parent, "Failed to set debounce-timeout for pin 0x%04X, err %d\n", @@ -1052,7 +1053,8 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int ind if (ret < 0) return ret; - ret = gpio_set_debounce_timeout(desc, info.debounce); + /* ACPI uses hundredths of milliseconds units */ + ret = gpio_set_debounce_timeout(desc, info.debounce * 10); if (ret) return ret; diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d1b9b721218f2..9e151413f51a6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2186,6 +2186,16 @@ static int gpio_set_bias(struct gpio_desc *desc) return gpio_set_config_with_argument_optional(desc, bias, arg); } +/** + * gpio_set_debounce_timeout() - Set debounce timeout + * @desc: GPIO descriptor to set the debounce timeout + * @debounce: Debounce timeout in microseconds + * + * The function calls the certain GPIO driver to set debounce timeout + * in the hardware. + * + * Returns 0 on success, or negative error code otherwise. + */ int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce) { return gpio_set_config_with_argument_optional(desc, From patchwork Wed Mar 23 03:18:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1608428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=Xrso22x1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KNYWF3MlLz9s1l for ; Wed, 23 Mar 2022 14:19:52 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nWrXE-0000xZ-Lz; Wed, 23 Mar 2022 03:19:44 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nWrXB-0000wj-PE for kernel-team@lists.ubuntu.com; Wed, 23 Mar 2022 03:19:41 +0000 Received: from localhost.localdomain (unknown [10.101.196.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id A082A3F1B5 for ; Wed, 23 Mar 2022 03:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648005581; bh=A6Rt26hRPYZHx4BvSYZsWtk8KVClaPq2q8242t5Mcqk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xrso22x1BwuOMZ9+3Mbhf/ON9Nb3nfo4FxiuO9zOcRQMLMTSZhpijqJKitARk57Fp RFW2QzqhXkLCvCLuVxHCni07SWLUheL5IUlbafhRI6XiyQ6x92aqPEEC51jTEzAzNZ f2h/qzFIL6yMrZnUCnSEjxVPZ23+7XculSnGonNIAN07KxOehniq00nRUvk3+shnsO tqXXBaSeqhqQydpmn96JAMbmgObFvsE3q+QlGilLuBKBHO2Xh/JLgPNJ2ERU895z8U OnBrJ4DZL1FG5AckqEyyy8OReQHtWwpd6qgQ4C8Krbpy2Z1Waqdvvdw1MyafQt8CYk gqqtBvMIjue+Q== From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [J/OEM-5.14] [PATCH 2/2] ALSA: hda/realtek: Fix LED on Zbook Studio G9 Date: Wed, 23 Mar 2022 11:18:54 +0800 Message-Id: <20220323031854.31008-3-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323031854.31008-1-kai.heng.feng@canonical.com> References: <20220323031854.31008-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1966010 Commit 07bcab93946c ("ALSA: hda/realtek: Add support for HP Laptops") breaks mute and micmute LEDs because it changed the LED quirk from ALC285_FIXUP_HP_GPIO_LED to ALC245_FIXUP_HP_GPIO_LED, so change it back here. Also reorder the chain of quirks to ensure LED quirk is the last one being applied. Fixes: 07bcab93946c ("ALSA: hda/realtek: Add support for HP Laptops") Signed-off-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20220317221134.566358-1-kai.heng.feng@canonical.com Signed-off-by: Takashi Iwai (cherry picked from commit 864cb14c0fa22344613ae93d68e155bf9bbbc9fb linux-next) Signed-off-by: Kai-Heng Feng --- sound/pci/hda/patch_realtek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0ef70158f88ca..510cc11901950 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8773,9 +8773,9 @@ static const struct hda_fixup alc269_fixups[] = { }, [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = { .type = HDA_FIXUP_FUNC, - .v.func = alc245_fixup_hp_gpio_led, + .v.func = cs35l41_fixup_spi_four, .chained = true, - .chain_id = ALC245_FIXUP_CS35L41_SPI_4, + .chain_id = ALC285_FIXUP_HP_GPIO_LED, }, [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = { .type = HDA_FIXUP_VERBS,