Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3061594pxp; Mon, 14 Mar 2022 10:02:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEkArVxa+W5IuClRYlc4Wu4DMwLAkVeeKdpCr/z7p32cB3ElddGUetFzEw8BdzMZuHXREc X-Received: by 2002:a05:6a00:1312:b0:4e1:58c4:ddfd with SMTP id j18-20020a056a00131200b004e158c4ddfdmr24768138pfu.65.1647277344318; Mon, 14 Mar 2022 10:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647277344; cv=none; d=google.com; s=arc-20160816; b=TCvfuZB8q/nJCBZ4HZYykNPmojisHarL8G+XrQljofRRXOXyoOkUU0Fo56RhgNBHQZ KLFS6LmhXAL7sxpB5zjwZzO2IP0RfmBkDVrjMg7uDUvFeZJm+ZSy0eCCdZ9Nsjd9hWXm 8AWG4Fp5qHSM4eDppTEOMAu3lLg+7mUz3rslov3XpUiAXbjsAsg7+sD7EaAaQ5jplx0r qsGa4QJlRw8IRxafmquvs+XOONJ0kmO31hwQJ0aVr7n2x+9KEbLyYK6nUnVg9sim5CyN 4nC63s0eO/6c2PcCsCdsZ17MQSWg5tq2VKOJJtLBAsGGGTnvYfYy9BMau/+BsxuPbYzF eSzw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/8mnTcH61n08FnF37DgSuJDsVpKtu6fT+yEK+u0gCW4=; b=B4mX0lhuzZvVUS2pgmpLj11Y7e4cRQE+8kBc5l5ddElTc1nGokAXXGzLI5xgLNXPp1 jpVl3hTo+8nj7PiPzivRqLxq2axIxpZ22oqEGKKUuzcJcM4Uh+WryIvSAlNve7Oo8rkQ AUZ8C4sTeI3Hb4w6tmAeR3wyGYMj/L5EmTOijZQFg87T0GyyOZYSndexEncFo5dCSLql I+KmNqZgKpN14BGkcq+K3yHntITs7CO4e2HtdDAQfuY3ak/nTCq6iWR6WrKfWSrn4k7C lfa0LuXPa9JhHNUFxr7wLSJgmiCDx+O48u+oQGsnjGM4r4XwJr5h5l4kkMDTsmw6zr+B Wo0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2pOQYh5P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s19-20020a056a00195300b004f7c1da7dbdsi4487728pfk.335.2022.03.14.10.02.08; Mon, 14 Mar 2022 10:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2pOQYh5P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241179AbiCNMPp (ORCPT + 99 others); Mon, 14 Mar 2022 08:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241458AbiCNMIp (ORCPT ); Mon, 14 Mar 2022 08:08:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D31C04DF71; Mon, 14 Mar 2022 05:05:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8ED5B80DEC; Mon, 14 Mar 2022 12:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C284C36AE7; Mon, 14 Mar 2022 12:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259514; bh=uwf9dzxIwUnSO09Hn6uEZGOvmjnlWBgALoym4KdSelM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pOQYh5PpjHOAxQ2n6H5XmyLit3xjRq56/fYTb9Au8W+C3zaC+0ptrz6ZmscT/8uR sMfyFTKCJiToobQ0cyX+PDTJtMqBIERN+vwEMCT2lExXzzIfM3O4EWqkCgVNaiLALd lpssy/VWiBdPiaGJuJK8vUorv2S+qNtI7GQ876AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Andy Shevchenko , Mika Westerberg , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.15 024/110] gpiolib: acpi: Convert ACPI value of debounce to microseconds Date: Mon, 14 Mar 2022 12:53:26 +0100 Message-Id: <20220314112743.710609916@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko [ Upstream commit 660c619b9d7ccd28648ee3766cdbe94ec7b27402 ] 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 Signed-off-by: Sasha Levin --- 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 d040c72fea58..4c2e32c38acc 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 d1b9b721218f..9e151413f51a 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, -- 2.34.1