Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4151676pxb; Mon, 27 Sep 2021 10:26:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy34zCQZHSMQf3Lua6jGAkM2108oJHW8ddMntyKmiIBByP3gjFpf/aE83nq2iBfUu+xFcrS X-Received: by 2002:a63:6983:: with SMTP id e125mr713976pgc.328.1632763582317; Mon, 27 Sep 2021 10:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632763582; cv=none; d=google.com; s=arc-20160816; b=EXLTViiA7o3vWE134V4TeJ5XVWgbP2phcteAr0SHLXCMnpRDTy5ogMsf6ipsOvZer5 yPh41qarQzvB/1LpGYNwqDnRsc1du2sJftZmAdvK5xDoVttao7PWDGQoYG8dx28m52cL EoK/Al7aPEtSiEKP33D/VlbMsomIsRXngUAvWKzkUYv7qVSLs1zo1AUH/qohdIg6EnIq TczFKANdzGsEMJZzDECpu7u9dBdBH6SYKUxa7AojIhU8I8J3pN+c5Lm/RieMsu8zf8Og 4R1SQyP0SJhnqElFvkGwL28+XrkHqgFem2SzR9bdhT67onKLQiAdshrgeZUQufcvjtAB AkqQ== 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=SmQhPEyeprPk6jKUqiklFbKJxpK7XXSAyRXzCjLHXxw=; b=AmzG2n0dBXm96f9f6rFFGXNzhIGOKeR+AmmP+laZISJ5cnLfRE6fJ6uQJKb0cRplJn RrlSb6OUa2c6Pdttu4kyh3T/0nzQ+97mcA216/2VUjLSu8DFzX+uRsVxSIV1fsgLIG+L I5UeO1eShzel/sXccwCdkcXnHTTIgYtNlHXwbJ+jf4aLZSEQnXZ/WYlv6QZwJummGjhm n7nP39o0dcrRf+opYR3/mF41KfLe5T9fFzrTbKN6mh/pNhz273RYkAMziEDT4/CZaRc8 CjYXsh2UN60P4qu1YMS2mePLvvL0xtJU9cZlSXTmoYAQS9ZlmfLMvkC9VErO5g0lvelM kXfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s12tMjP6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si22805357plk.198.2021.09.27.10.26.08; Mon, 27 Sep 2021 10:26:22 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s12tMjP6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238036AbhI0R0q (ORCPT + 99 others); Mon, 27 Sep 2021 13:26:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:35962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235622AbhI0RWm (ORCPT ); Mon, 27 Sep 2021 13:22:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E48746135F; Mon, 27 Sep 2021 17:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632762865; bh=kgD1e4RoCpFEZjZSZkXNK08KIkUZIuli5LgochcfZEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s12tMjP61SlER5qDVREA2Uv7C2MBEOHWx8kRuBT26repI2OmVPMZquUivddThJYBf s95xwZz9OGaReejMS//fn+chdWr9IMUCpm6dqjpHODmy8OgDP8AUqNO1HR6ETTeKZT rlZg2jensO3GYDWKwZTV//BM3OXgMQY4J1uNajTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , Hans de Goede , Andy Shevchenko , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.14 080/162] gpiolib: acpi: Make set-debounce-timeout failures non fatal Date: Mon, 27 Sep 2021 19:02:06 +0200 Message-Id: <20210927170236.222207460@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210927170233.453060397@linuxfoundation.org> References: <20210927170233.453060397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit cef0d022f55364d69017daeb9443bd31510ad6a2 ] Commit 8dcb7a15a585 ("gpiolib: acpi: Take into account debounce settings") made the gpiolib-acpi code call gpio_set_debounce_timeout() when requesting GPIOs. This in itself is fine, but it also made gpio_set_debounce_timeout() errors fatal, causing the requesting of the GPIO to fail. This is causing regressions. E.g. on a HP ElitePad 1000 G2 various _AEI specified GPIO ACPI event sources specify a debouncy timeout of 20 ms, but the pinctrl-baytrail.c only supports certain fixed values, the closest ones being 12 or 24 ms and pinctrl-baytrail.c responds with -EINVAL when specified a value which is not one of the fixed values. This is causing the acpi_request_own_gpiod() call to fail for 3 ACPI event sources on the HP ElitePad 1000 G2, which in turn is causing e.g. the battery charging vs discharging status to never get updated, even though a charger has been plugged-in or unplugged. Make gpio_set_debounce_timeout() errors non fatal, warning about the failure instead, to fix this regression. Note we should probably also fix various pinctrl drivers to just pick the first bigger discrete value rather then returning -EINVAL but this will need to be done on a per driver basis, where as this fix at least gets us back to where things were before and thus restores functionality on devices where this was lost due to gpio_set_debounce_timeout() errors. Fixes: 8dcb7a15a585 ("gpiolib: acpi: Take into account debounce settings") Depends-on: 2e2b496cebef ("gpiolib: acpi: Extract acpi_request_own_gpiod() helper") Reviewed-by: Mika Westerberg Signed-off-by: Hans de Goede Acked-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib-acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 411525ac4cc4..47712b6903b5 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -313,9 +313,11 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip, ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); if (ret) - gpiochip_free_own_desc(desc); + dev_warn(chip->parent, + "Failed to set debounce-timeout for pin 0x%04X, err %d\n", + pin, ret); - return ret ? ERR_PTR(ret) : desc; + return desc; } static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in) -- 2.33.0