From patchwork Wed Oct 14 13:31:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 269600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FFE0C433DF for ; Wed, 14 Oct 2020 13:32:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E032022203 for ; Wed, 14 Oct 2020 13:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727356AbgJNNcI (ORCPT ); Wed, 14 Oct 2020 09:32:08 -0400 Received: from mga05.intel.com ([192.55.52.43]:22636 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727250AbgJNNcI (ORCPT ); Wed, 14 Oct 2020 09:32:08 -0400 IronPort-SDR: f49HH/ckupomPUFV5On4nTdlqciZYY7DJxWa86vU/2+DcVHayC74E7omcnjtuEOewO/nyvserx ZO/LgbOJB4xQ== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="250805536" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="250805536" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 06:32:00 -0700 IronPort-SDR: DS+B36umcOceEjGB1XpPjXFFj70hXLoY1Ith21M8h5KXAoxbIe/+1IvdnF/hvwy1C7+2RjeWqx UdaHFCbDkNsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="299956023" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 14 Oct 2020 06:31:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 036B51A3; Wed, 14 Oct 2020 16:31:55 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Mika Westerberg , Hans de Goede Cc: Andy Shevchenko , Jamie McClymont Subject: [PATCH v1 1/3] gpiolib: acpi: Respect bias settings for GpioInt() resource Date: Wed, 14 Oct 2020 16:31:52 +0300 Message-Id: <20201014133154.30610-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org In some cases the GpioInt() resource is coming with bias settings which may affect system functioning. Respect bias settings for GpioInt() resource by calling acpi_gpio_update_gpiod_*flags() API in acpi_dev_gpio_irq_get(). While at it, refactor to configure flags first and, only when succeeded, map the IRQ descriptor. Reported-by: Jamie McClymont Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- This one highly depends on Intel pin control driver changes (for now [1], but might be more), so it's probably not supposed to be backported (at least right now). [1]: https://lore.kernel.org/linux-gpio/20201014104638.84043-1-andriy.shevchenko@linux.intel.com/T/ drivers/gpio/gpiolib-acpi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 834a12f3219e..52b961673f16 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -942,21 +942,25 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) if (info.gpioint && idx++ == index) { unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; + enum gpiod_flags dflags = info.flags; char label[32]; int irq; if (IS_ERR(desc)) return PTR_ERR(desc); - irq = gpiod_to_irq(desc); - if (irq < 0) - return irq; + acpi_gpio_update_gpiod_flags(&dflags, &info); + acpi_gpio_update_gpiod_lookup_flags(&lflags, &info); snprintf(label, sizeof(label), "GpioInt() %d", index); - ret = gpiod_configure_flags(desc, label, lflags, info.flags); + ret = gpiod_configure_flags(desc, label, lflags, dflags); if (ret < 0) return ret; + irq = gpiod_to_irq(desc); + if (irq < 0) + return irq; + irq_flags = acpi_dev_get_irq_type(info.triggering, info.polarity); From patchwork Wed Oct 14 13:31:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 269601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C791C43457 for ; Wed, 14 Oct 2020 13:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C342522201 for ; Wed, 14 Oct 2020 13:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbgJNNb7 (ORCPT ); Wed, 14 Oct 2020 09:31:59 -0400 Received: from mga17.intel.com ([192.55.52.151]:1113 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbgJNNb7 (ORCPT ); Wed, 14 Oct 2020 09:31:59 -0400 IronPort-SDR: oJSyYJBTfFz8eYsNGbNbgGTLhMAs7VFiNgfD04hVNA5Z2KCzLYSMiL3xY6crgsWr3HPjYEb4uB uWj6vRnlEOyw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="145966621" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="145966621" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 06:31:58 -0700 IronPort-SDR: fZVzV7IB8vmi5n2ekwe2Qe8kLOdALW07/TcQtxNiXhBp7z6bzGFyfiZGULQax2g1WUkCfF2sCw SUzIsF4EiXHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530830586" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 14 Oct 2020 06:31:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 13C2D163; Wed, 14 Oct 2020 16:31:56 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Mika Westerberg , Hans de Goede Cc: Andy Shevchenko Subject: [PATCH v1 2/3] gpiolib: acpi: Use named item for enum gpiod_flags variable Date: Wed, 14 Oct 2020 16:31:53 +0300 Message-Id: <20201014133154.30610-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201014133154.30610-1-andriy.shevchenko@linux.intel.com> References: <20201014133154.30610-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use named item instead of plain integer for enum gpiod_flags to make it clear that even 0 has its own meaning. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 52b961673f16..1b372f0dfe63 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1136,7 +1136,7 @@ acpi_gpiochip_parse_own_gpio(struct acpi_gpio_chip *achip, int ret; *lflags = GPIO_LOOKUP_FLAGS_DEFAULT; - *dflags = 0; + *dflags = GPIOD_ASIS; *name = NULL; ret = fwnode_property_read_u32_array(fwnode, "gpios", gpios, From patchwork Wed Oct 14 13:31:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 285599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0405DC433DF for ; Wed, 14 Oct 2020 13:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 985B222202 for ; Wed, 14 Oct 2020 13:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727660AbgJNNb7 (ORCPT ); Wed, 14 Oct 2020 09:31:59 -0400 Received: from mga09.intel.com ([134.134.136.24]:55600 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727250AbgJNNb7 (ORCPT ); Wed, 14 Oct 2020 09:31:59 -0400 IronPort-SDR: QfXhm0rMJMy+P+p2/QaurcAv/9wK4Ok6yhUWV3vFrqQyOeE22uLpGqmbocIFi7iRagGcWc7l5u XUcyIpFigd7g== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="166225248" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="166225248" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 06:31:58 -0700 IronPort-SDR: ExQw5Y2yQKWaPTt3q35ennsUwAFhVuJmWCIMMA087DP+WHZWWPNJHwa/8EAitBUbiBtamgQKU0 rnZLSXxDOkGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="346508366" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 14 Oct 2020 06:31:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 231341CC; Wed, 14 Oct 2020 16:31:56 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Mika Westerberg , Hans de Goede Cc: Andy Shevchenko Subject: [PATCH v1 3/3] gpiolib: of: Use named item for enum gpiod_flags variable Date: Wed, 14 Oct 2020 16:31:54 +0300 Message-Id: <20201014133154.30610-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201014133154.30610-1-andriy.shevchenko@linux.intel.com> References: <20201014133154.30610-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use named item instead of plain integer for enum gpiod_flags to make it clear that even 0 has its own meaning. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib-of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 2f895a2b8411..892a513b7a64 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -593,7 +593,7 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np, xlate_flags = 0; *lflags = GPIO_LOOKUP_FLAGS_DEFAULT; - *dflags = 0; + *dflags = GPIOD_ASIS; ret = of_property_read_u32(chip_np, "#gpio-cells", &tmp); if (ret)