From patchwork Thu Oct 22 16:58:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1386341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CHD8s2qjQz9sPB for ; Fri, 23 Oct 2020 03:58:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2898354AbgJVQ6w (ORCPT ); Thu, 22 Oct 2020 12:58:52 -0400 Received: from mga17.intel.com ([192.55.52.151]:37596 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898332AbgJVQ6w (ORCPT ); Thu, 22 Oct 2020 12:58:52 -0400 IronPort-SDR: 5PbWAhRnY7yPgGn2oFGwRnERnVEKR5tAyujciDuIunREo/vKiavAFGymTptwMcxPzf5MCa8yJa 863zi4HcRaBQ== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="147419167" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="147419167" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 09:58:51 -0700 IronPort-SDR: GRdVEzrArwNe3Ss4Y8d2f3vESqd7eArs0f9yMHb9jJYm/lDiS4moaLcQib9gFaAH0D9PPUAZbw GOMiVJjW7bHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="321440180" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 22 Oct 2020 09:58:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EEE14B8; Thu, 22 Oct 2020 19:58:48 +0300 (EEST) From: Andy Shevchenko To: linux-gpio@vger.kernel.org, Linus@black.fi.intel.com, Walleij@black.fi.intel.com, linus.walleij@linaro.org, Bartosz Golaszewski , Hans de Goede Cc: Andy Shevchenko , Jamie McClymont , Mika Westerberg Subject: [PATCH v2 1/3] gpiolib: acpi: Respect bias settings for GpioInt() resource Date: Thu, 22 Oct 2020 19:58:45 +0300 Message-Id: <20201022165847.56153-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(). Reported-by: Jamie McClymont Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- v2: preserved ordering of IRQ map (Hans, Mika), added Rb tag (Mika) drivers/gpio/gpiolib-acpi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 834a12f3219e..3a39e8a93226 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -942,6 +942,7 @@ 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 = GPIOD_ASIS; char label[32]; int irq; @@ -952,8 +953,11 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) 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; From patchwork Thu Oct 22 16:58:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1386343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CHD8y5NPCz9sTL for ; Fri, 23 Oct 2020 03:58:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2898409AbgJVQ66 (ORCPT ); Thu, 22 Oct 2020 12:58:58 -0400 Received: from mga18.intel.com ([134.134.136.126]:27299 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898455AbgJVQ66 (ORCPT ); Thu, 22 Oct 2020 12:58:58 -0400 IronPort-SDR: XOhFJesKWZeakbDPa9z1BhaXLVzL3NKwgoQa8EUfQULHARqexDVR74ePQr4HSaaSHnhIqmOpQJ doolxc66v3aw== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="155346225" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="155346225" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 09:58:57 -0700 IronPort-SDR: PhI8w/z3Lstchtymdz09SDphI61dwK82CyaTG/CsEQb7Nwrd3W2PO1QagtiGqeZkoAhho97TI7 bi4dMFsZRutA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="359317206" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 22 Oct 2020 09:58:50 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 05C4287; Thu, 22 Oct 2020 19:58:48 +0300 (EEST) From: Andy Shevchenko To: linux-gpio@vger.kernel.org, Linus@black.fi.intel.com, Walleij@black.fi.intel.com, linus.walleij@linaro.org, Bartosz Golaszewski , Hans de Goede Cc: Andy Shevchenko , Mika Westerberg Subject: [PATCH v2 2/3] gpiolib: acpi: Use named item for enum gpiod_flags variable Date: Thu, 22 Oct 2020 19:58:46 +0300 Message-Id: <20201022165847.56153-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201022165847.56153-1-andriy.shevchenko@linux.intel.com> References: <20201022165847.56153-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 --- v2: added Rb tag (Mika) 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 3a39e8a93226..c127b410a7a2 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 Thu Oct 22 16:58:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1386342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CHD8y2tPsz9sPB for ; Fri, 23 Oct 2020 03:58:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2898456AbgJVQ66 (ORCPT ); Thu, 22 Oct 2020 12:58:58 -0400 Received: from mga18.intel.com ([134.134.136.126]:27299 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898409AbgJVQ65 (ORCPT ); Thu, 22 Oct 2020 12:58:57 -0400 IronPort-SDR: 3Zfz/KHm9M/QNbfTEi54k437tg0QVb7UTrEZC0yYtAnp51jPUclil5+YrEH9u4XNtAPupDWAMt N/e+H6dGd+BA== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="155346224" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="155346224" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 09:58:57 -0700 IronPort-SDR: LCYUlsMJaxV6DDb5cbSKEIYC/NtTeFXfWGLPKu7SIWcsyjwJOmmeJp5yxigptbXQGD+7xgHRvo OKhsd35oJ7Ww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="359317205" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 22 Oct 2020 09:58:50 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0F5D5F2; Thu, 22 Oct 2020 19:58:49 +0300 (EEST) From: Andy Shevchenko To: linux-gpio@vger.kernel.org, Linus@black.fi.intel.com, Walleij@black.fi.intel.com, linus.walleij@linaro.org, Bartosz Golaszewski , Hans de Goede Cc: Andy Shevchenko , Mika Westerberg Subject: [PATCH v2 3/3] gpiolib: of: Use named item for enum gpiod_flags variable Date: Thu, 22 Oct 2020 19:58:47 +0300 Message-Id: <20201022165847.56153-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201022165847.56153-1-andriy.shevchenko@linux.intel.com> References: <20201022165847.56153-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. Cc: Mika Westerberg Signed-off-by: Andy Shevchenko --- v2: no changes 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)