From patchwork Wed Nov 11 22:05:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398541 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 4CWf2P1WZ9z9s0b for ; Thu, 12 Nov 2020 09:06:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726108AbgKKWGU (ORCPT ); Wed, 11 Nov 2020 17:06:20 -0500 Received: from mga09.intel.com ([134.134.136.24]:1069 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgKKWGU (ORCPT ); Wed, 11 Nov 2020 17:06:20 -0500 IronPort-SDR: 04zdcvQpAIRZOrtTC3QkXr4iFb1V0WJq7XAtUynap8ENHr0IAi679rKWz9E/gDuoF6j5Q8eKeU +we3+Utx+CEg== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="170391842" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="170391842" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:20 -0800 IronPort-SDR: rM/ENGk5ZM1TMullU2QHXcfQBTURLeJeFpeqlV06TSwMEgADjsEeJIFjR2Dt/S3SAgCsLdSMGO vep8/TgYrofA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="366093065" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 11 Nov 2020 14:06:18 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 52ACCD2; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 01/18] gpiolib: use proper API to pack pin configuration parameters Date: Thu, 12 Nov 2020 00:05:42 +0200 Message-Id: <20201111220559.39680-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Instead of open coded macro use, call pinconf_to_config_packed(). Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index b45487aace7e..87bb73991337 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2111,7 +2111,7 @@ static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) break; } - config = PIN_CONF_PACKED(mode, arg); + config = pinconf_to_config_packed(mode, arg); return gpio_do_set_config(gc, gpio_chip_hwgpio(desc), config); } From patchwork Wed Nov 11 22:05:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398549 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 4CWf2T4srsz9sSn for ; Thu, 12 Nov 2020 09:06:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 Received: from mga06.intel.com ([134.134.136.31]:46583 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbgKKWGY (ORCPT ); Wed, 11 Nov 2020 17:06:24 -0500 IronPort-SDR: z9qP4pH6GK/bRfaDYak9vrxNslgfBDPoZKHEtD7hkt6vDJ6epWJyMwqEaUbtxpxgM9WLw2PIql I9VINEy5lV5Q== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="231846505" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="231846505" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:23 -0800 IronPort-SDR: /tP3RCF5T3Z9pskdREtkxJc1chg1P2WvPH17YOEyDUkMt7fL/SKlTS+ZsWee3tLLp86bvGw3h/ BbPsKLOo29/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="531880822" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 11 Nov 2020 14:06:18 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5B8A1142; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 02/18] gpiolib: Extract gpio_set_config_with_argument() for future use Date: Thu, 12 Nov 2020 00:05:43 +0200 Message-Id: <20201111220559.39680-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org In the future we will need to have a separate function that takes an arbitrary argument value. Extract gpio_set_config_with_argument() for that purpose. Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 87bb73991337..5210f396f0cd 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2094,10 +2094,19 @@ static int gpio_do_set_config(struct gpio_chip *gc, unsigned int offset, return gc->set_config(gc, offset, config); } -static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) +static int gpio_set_config_with_argument(struct gpio_desc *desc, + enum pin_config_param mode, + u32 argument) { struct gpio_chip *gc = desc->gdev->chip; unsigned long config; + + config = pinconf_to_config_packed(mode, argument); + return gpio_do_set_config(gc, gpio_chip_hwgpio(desc), config); +} + +static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) +{ unsigned int arg; switch (mode) { @@ -2111,8 +2120,7 @@ static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) break; } - config = pinconf_to_config_packed(mode, arg); - return gpio_do_set_config(gc, gpio_chip_hwgpio(desc), config); + return gpio_set_config_with_argument(desc, mode, arg); } static int gpio_set_bias(struct gpio_desc *desc) From patchwork Wed Nov 11 22:05:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398542 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 4CWf2P3khhz9sSn for ; Thu, 12 Nov 2020 09:06:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725996AbgKKWGV (ORCPT ); Wed, 11 Nov 2020 17:06:21 -0500 Received: from mga12.intel.com ([192.55.52.136]:8979 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgKKWGU (ORCPT ); Wed, 11 Nov 2020 17:06:20 -0500 IronPort-SDR: AG6khnMltrNPl2FQIUjikBn35UIxMrVrh/g0mHfZ05AuA2/IkuHPpcRCBMby7X2ztrsGm6nDuZ 99qIjFL3nu8Q== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="149498438" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="149498438" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:19 -0800 IronPort-SDR: lZNuABw3NuOBq2EUUIAS7K9L/5v7JP5dtZAhUpaQfbkQRa6xo+m/tVVrtE7EsJyYufoYV840pF PmC41EQGa18w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="530385547" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 11 Nov 2020 14:06:18 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 697B11CC; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 03/18] gpiolib: move bias related code from gpio_set_config() to gpio_set_bias() Date: Thu, 12 Nov 2020 00:05:44 +0200 Message-Id: <20201111220559.39680-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Move bias related code from gpio_set_config() to gpio_set_bias(). Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5210f396f0cd..2bfc44ca4425 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2107,25 +2107,13 @@ static int gpio_set_config_with_argument(struct gpio_desc *desc, static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) { - unsigned int arg; - - switch (mode) { - case PIN_CONFIG_BIAS_PULL_DOWN: - case PIN_CONFIG_BIAS_PULL_UP: - arg = 1; - break; - - default: - arg = 0; - break; - } - - return gpio_set_config_with_argument(desc, mode, arg); + return gpio_set_config_with_argument(desc, mode, 0); } static int gpio_set_bias(struct gpio_desc *desc) { enum pin_config_param bias; + unsigned int arg; int ret; if (test_bit(FLAG_BIAS_DISABLE, &desc->flags)) @@ -2137,7 +2125,18 @@ static int gpio_set_bias(struct gpio_desc *desc) else return 0; - ret = gpio_set_config(desc, bias); + switch (bias) { + case PIN_CONFIG_BIAS_PULL_DOWN: + case PIN_CONFIG_BIAS_PULL_UP: + arg = 1; + break; + + default: + arg = 0; + break; + } + + ret = gpio_set_config_with_argument(desc, bias, arg); if (ret != -ENOTSUPP) return ret; From patchwork Wed Nov 11 22:05: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: 1398543 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 4CWf2Q0rTtz9sTK for ; Thu, 12 Nov 2020 09:06:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725933AbgKKWGV (ORCPT ); Wed, 11 Nov 2020 17:06:21 -0500 Received: from mga11.intel.com ([192.55.52.93]:61332 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKKWGV (ORCPT ); Wed, 11 Nov 2020 17:06:21 -0500 IronPort-SDR: rij4CGH989K841Y4QOdNz3f8u5t1mJ3DStv5jTn9UA27OpznLcm/romTv8hxbmGE472mrgAfa7 5xgVcMgWQ41Q== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="166717637" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="166717637" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:20 -0800 IronPort-SDR: lJ87Q1bc0zbCSSpJDCRu5TWw8cJgTWLpAYRsxsoJEtOHiqyVQRlFqWOD/ppd9bxwLmy9EEM5DJ fTu7BHuS1pYw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="308626166" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 11 Nov 2020 14:06:19 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 777653D3; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 04/18] gpiolib: Extract gpio_set_config_with_argument_optional() helper Date: Thu, 12 Nov 2020 00:05:45 +0200 Message-Id: <20201111220559.39680-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This function is useful for internal use in the GPIO library. There will be new user coming, prepare a helper for the new comer and the existing ones. Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib.c | 53 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 2bfc44ca4425..c4f73597a54d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2105,6 +2105,29 @@ static int gpio_set_config_with_argument(struct gpio_desc *desc, return gpio_do_set_config(gc, gpio_chip_hwgpio(desc), config); } +static int gpio_set_config_with_argument_optional(struct gpio_desc *desc, + enum pin_config_param mode, + u32 argument) +{ + struct device *dev = &desc->gdev->dev; + int gpio = gpio_chip_hwgpio(desc); + int ret; + + ret = gpio_set_config_with_argument(desc, mode, argument); + if (ret != -ENOTSUPP) + return ret; + + switch (mode) { + case PIN_CONFIG_PERSIST_STATE: + dev_dbg(dev, "Persistence not supported for GPIO %d\n", gpio); + break; + default: + break; + } + + return 0; +} + static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) { return gpio_set_config_with_argument(desc, mode, 0); @@ -2114,7 +2137,6 @@ static int gpio_set_bias(struct gpio_desc *desc) { enum pin_config_param bias; unsigned int arg; - int ret; if (test_bit(FLAG_BIAS_DISABLE, &desc->flags)) bias = PIN_CONFIG_BIAS_DISABLE; @@ -2136,11 +2158,7 @@ static int gpio_set_bias(struct gpio_desc *desc) break; } - ret = gpio_set_config_with_argument(desc, bias, arg); - if (ret != -ENOTSUPP) - return ret; - - return 0; + return gpio_set_config_with_argument_optional(desc, bias, arg); } /** @@ -2381,11 +2399,6 @@ EXPORT_SYMBOL_GPL(gpiod_set_debounce); */ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory) { - struct gpio_chip *gc; - unsigned long packed; - int gpio; - int rc; - VALIDATE_DESC(desc); /* * Handle FLAG_TRANSITORY first, enabling queries to gpiolib for @@ -2394,21 +2407,9 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory) assign_bit(FLAG_TRANSITORY, &desc->flags, transitory); /* If the driver supports it, set the persistence state now */ - gc = desc->gdev->chip; - if (!gc->set_config) - return 0; - - packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, - !transitory); - gpio = gpio_chip_hwgpio(desc); - rc = gpio_do_set_config(gc, gpio, packed); - if (rc == -ENOTSUPP) { - dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", - gpio); - return 0; - } - - return rc; + return gpio_set_config_with_argument_optional(desc, + PIN_CONFIG_PERSIST_STATE, + !transitory); } EXPORT_SYMBOL_GPL(gpiod_set_transitory); From patchwork Wed Nov 11 22:05: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: 1398547 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 4CWf2S45Hwz9sSn for ; Thu, 12 Nov 2020 09:06:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 Received: from mga06.intel.com ([134.134.136.31]:46583 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 IronPort-SDR: ed7XoormgvXMcQESlUh1lurCYjz1hIxFYPbD0u7HIcpxUqK+lOK3BkSnEMSSKPbRinxJC/yAw/ 1Bv5g348kd+A== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="231846504" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="231846504" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: RFWgZ9diKTFAPy5QYhVQs79PRmmxYKDffNN8zBk+H8yXCLFHwJxjqpmPyJh0Z+XwokN8MmW1KM EtW82K7I9z9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="531880821" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 11 Nov 2020 14:06:18 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8065A420; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Mika Westerberg , Hans de Goede Subject: [PATCH v6 05/18] gpiolib: Introduce gpio_set_debounce_timeout() for internal use Date: Thu, 12 Nov 2020 00:05:46 +0200 Message-Id: <20201111220559.39680-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org In some cases we would like to have debounce setter which doesn't fail when a feature is not supported by a controller. Cc: Mika Westerberg Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede --- drivers/gpio/gpiolib.c | 7 +++++++ drivers/gpio/gpiolib.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c4f73597a54d..0d691ec512a4 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2161,6 +2161,13 @@ static int gpio_set_bias(struct gpio_desc *desc) return gpio_set_config_with_argument_optional(desc, bias, arg); } +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce) +{ + return gpio_set_config_with_argument_optional(desc, + PIN_CONFIG_INPUT_DEBOUNCE, + debounce); +} + /** * gpiod_direction_input - set the GPIO direction to input * @desc: GPIO to set to input diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 16bc5731673c..9b1a1c782704 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -136,6 +136,7 @@ int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, unsigned long lflags, enum gpiod_flags dflags); +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags); From patchwork Wed Nov 11 22:05: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: 1398545 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 4CWf2R4hXfz9sTK for ; Thu, 12 Nov 2020 09:06:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726704AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 Received: from mga12.intel.com ([192.55.52.136]:8979 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKKWGW (ORCPT ); Wed, 11 Nov 2020 17:06:22 -0500 IronPort-SDR: xsHP4hFQKRcnrtGyTo2e2mOFeeWZxxpj9u8IcCL4W8UN7J3qsHKv54iYDFemDohT/WfmFypLFM fZ8GX2bmR5Ng== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="149498443" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="149498443" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: Pg+DbF9TLZJu7SvfCAXg70Jp0wmCtVgadwlZmiPozw6lSDT9n/oj67lu+JtlgIDz2wToREfB+i r84K47a2biMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="366390829" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 11 Nov 2020 14:06:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8AAB4497; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Jamie McClymont , Hans de Goede , Mika Westerberg Subject: [PATCH v6 06/18] gpiolib: acpi: Respect bias settings for GpioInt() resource Date: Thu, 12 Nov 2020 00:05:47 +0200 Message-Id: <20201111220559.39680-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> 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: Hans de Goede Acked-by: Linus Walleij Reviewed-by: Mika Westerberg --- 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 Wed Nov 11 22:05:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398544 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 4CWf2R1BfJz9s0b for ; Thu, 12 Nov 2020 09:06:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbgKKWGW (ORCPT ); Wed, 11 Nov 2020 17:06:22 -0500 Received: from mga04.intel.com ([192.55.52.120]:53545 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKKWGW (ORCPT ); Wed, 11 Nov 2020 17:06:22 -0500 IronPort-SDR: l7toK0PSdfAB6d1CF9HrKcsBuQU6VM/VpZJriBujq7EcWsP+oiWh1/qXfOljmXQVeKYA6cGM4S nDz/y4JRRdNA== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="167641919" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="167641919" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: LRDacouciD5W8t9T5p45XrZHa/5UOJ19642NTv96w6UqwSOpmd7gHWZgUoTG7b08WZRnjjE904 daE+iSI0N30Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="356817214" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 11 Nov 2020 14:06:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 95E1F4B0; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 07/18] gpiolib: acpi: Use named item for enum gpiod_flags variable Date: Thu, 12 Nov 2020 00:05:48 +0200 Message-Id: <20201111220559.39680-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-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: Hans de Goede Acked-by: Linus Walleij 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 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 Wed Nov 11 22:05:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398550 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 4CWf2V18ZGz9sTK for ; Thu, 12 Nov 2020 09:06:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726566AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 Received: from mga09.intel.com ([134.134.136.24]:1078 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726859AbgKKWGY (ORCPT ); Wed, 11 Nov 2020 17:06:24 -0500 IronPort-SDR: MrSAGxc5UmWUF7u+8eoH/lThdb9ErY/mLHPay5Wy61qARBs4FEhNPgzn5m/NmalzM0U5qajiGr RgsENdZLYt3w== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="170391851" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="170391851" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: EJYQCr8lP+fFmKxTYk44i0oSwAajUbmWl0/ima9ssUCGdrYEYJzuynsPQi1dnqsjdJNhXkEF7D KLtdKGOI8yPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="323414185" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 11 Nov 2020 14:06:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A16214D4; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Coiby Xu , Hans de Goede , Mika Westerberg Subject: [PATCH v6 08/18] gpiolib: acpi: Take into account debounce settings Date: Thu, 12 Nov 2020 00:05:49 +0200 Message-Id: <20201111220559.39680-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org We didn't take into account the debounce settings supplied by ACPI. This change is targeting the mentioned gap. Reported-by: Coiby Xu Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Acked-by: Linus Walleij Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 18 ++++++++++++++++++ drivers/gpio/gpiolib-acpi.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index c127b410a7a2..a9254de964cc 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -299,6 +299,10 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, return AE_OK; } + ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); + if (ret) + goto fail_free_desc; + ret = gpiochip_lock_as_irq(chip, pin); if (ret) { dev_err(chip->parent, @@ -664,6 +668,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, agpio->pin_table[pin_index]); lookup->info.pin_config = agpio->pin_config; + lookup->info.debounce = agpio->debounce_timeout; lookup->info.gpioint = gpioint; /* @@ -961,6 +966,10 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) if (ret < 0) return ret; + ret = gpio_set_debounce_timeout(desc, info.debounce); + if (ret) + return ret; + irq_flags = acpi_dev_get_irq_type(info.triggering, info.polarity); @@ -1048,6 +1057,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, if (!found) { enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio); const char *label = "ACPI:OpRegion"; + int ret; desc = gpiochip_request_own_desc(chip, pin, label, GPIO_ACTIVE_HIGH, @@ -1058,6 +1068,14 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, goto out; } + ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); + if (ret) { + gpiochip_free_own_desc(desc); + mutex_unlock(&achip->conn_lock); + status = AE_ERROR; + goto out; + } + conn = kzalloc(sizeof(*conn), GFP_KERNEL); if (!conn) { status = AE_NO_MEMORY; diff --git a/drivers/gpio/gpiolib-acpi.h b/drivers/gpio/gpiolib-acpi.h index 1c6d65cf0629..e2edb632b2cc 100644 --- a/drivers/gpio/gpiolib-acpi.h +++ b/drivers/gpio/gpiolib-acpi.h @@ -18,6 +18,7 @@ struct acpi_device; * @pin_config: pin bias as provided by ACPI * @polarity: interrupt polarity as provided by ACPI * @triggering: triggering type as provided by ACPI + * @debounce: debounce timeout as provided by ACPI * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping */ struct acpi_gpio_info { @@ -27,6 +28,7 @@ struct acpi_gpio_info { int pin_config; int polarity; int triggering; + unsigned int debounce; unsigned int quirks; }; From patchwork Wed Nov 11 22:05:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398551 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 4CWf2V4nQwz9sSn for ; Thu, 12 Nov 2020 09:06:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 Received: from mga02.intel.com ([134.134.136.20]:65375 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbgKKWGY (ORCPT ); Wed, 11 Nov 2020 17:06:24 -0500 IronPort-SDR: DVT077+iPXPGVSSw802dnyExxW9vn3V4N13P0NUwUzUhjLKlULMOyAZMDGLkAr7i3F2c5ibBEB RblvP/V2ApRg== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="157241316" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="157241316" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:23 -0800 IronPort-SDR: uX5Lt0jCwKYl+0hYntFKx/Dlo/ohaT7WhanTiiNe2Ap8P3NHlJgRSr/OKZy+HAvdqm69F1vfst OjjVpnrAnkpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="360718158" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 11 Nov 2020 14:06:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id AC16752A; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Mika Westerberg , Hans de Goede Subject: [PATCH v6 09/18] gpiolib: acpi: Move non-critical code outside of critical section Date: Thu, 12 Nov 2020 00:05:50 +0200 Message-Id: <20201111220559.39680-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Mika noticed that some code is run under mutex when it doesn't require the lock, like an error code assignment. Move non-critical code outside of critical section. Suggested-by: Mika Westerberg Cc: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib-acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index a9254de964cc..b00171d2aaf5 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1063,8 +1063,8 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, GPIO_ACTIVE_HIGH, flags); if (IS_ERR(desc)) { - status = AE_ERROR; mutex_unlock(&achip->conn_lock); + status = AE_ERROR; goto out; } @@ -1078,9 +1078,9 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, conn = kzalloc(sizeof(*conn), GFP_KERNEL); if (!conn) { - status = AE_NO_MEMORY; gpiochip_free_own_desc(desc); mutex_unlock(&achip->conn_lock); + status = AE_NO_MEMORY; goto out; } From patchwork Wed Nov 11 22:05:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398558 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 4CWf2w3rXpz9s0b for ; Thu, 12 Nov 2020 09:06:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727132AbgKKWGk (ORCPT ); Wed, 11 Nov 2020 17:06:40 -0500 Received: from mga06.intel.com ([134.134.136.31]:46594 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbgKKWGk (ORCPT ); Wed, 11 Nov 2020 17:06:40 -0500 IronPort-SDR: gXDdS5Jd+zqMrtoA0loHDNAtFiyCevf2wvZCIrG/aQoV/iVNjDlGBfCjUWoWUSNwpTbxBFiPrh ggoJ5iBI37mQ== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="231846506" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="231846506" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:23 -0800 IronPort-SDR: cmruokTKKSKoIjpa6+bgQluKV74Eq8gqyVtUaqJLzNMsgxSGuwghywpP9qdiRUjCsM9pX0vYHJ gW1irZf+oLCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="531880835" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 11 Nov 2020 14:06:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B7E065DB; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 10/18] gpiolib: acpi: Move acpi_gpio_to_gpiod_flags() upper in the code Date: Thu, 12 Nov 2020 00:05:51 +0200 Message-Id: <20201111220559.39680-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Move acpi_gpio_to_gpiod_flags() upper in the code to allow further refactoring. Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 66 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index b00171d2aaf5..ac1bde0720f2 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -205,6 +205,39 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio) acpi_gpiochip_request_irq(acpi_gpio, event); } +static enum gpiod_flags +acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio) +{ + switch (agpio->io_restriction) { + case ACPI_IO_RESTRICT_INPUT: + return GPIOD_IN; + case ACPI_IO_RESTRICT_OUTPUT: + /* + * ACPI GPIO resources don't contain an initial value for the + * GPIO. Therefore we deduce that value from the pull field + * instead. If the pin is pulled up we assume default to be + * high, if it is pulled down we assume default to be low, + * otherwise we leave pin untouched. + */ + switch (agpio->pin_config) { + case ACPI_PIN_CONFIG_PULLUP: + return GPIOD_OUT_HIGH; + case ACPI_PIN_CONFIG_PULLDOWN: + return GPIOD_OUT_LOW; + default: + break; + } + default: + break; + } + + /* + * Assume that the BIOS has configured the direction and pull + * accordingly. + */ + return GPIOD_ASIS; +} + static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in) { const char *controller, *pin_str; @@ -530,39 +563,6 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev, return false; } -static enum gpiod_flags -acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio) -{ - switch (agpio->io_restriction) { - case ACPI_IO_RESTRICT_INPUT: - return GPIOD_IN; - case ACPI_IO_RESTRICT_OUTPUT: - /* - * ACPI GPIO resources don't contain an initial value for the - * GPIO. Therefore we deduce that value from the pull field - * instead. If the pin is pulled up we assume default to be - * high, if it is pulled down we assume default to be low, - * otherwise we leave pin untouched. - */ - switch (agpio->pin_config) { - case ACPI_PIN_CONFIG_PULLUP: - return GPIOD_OUT_HIGH; - case ACPI_PIN_CONFIG_PULLDOWN: - return GPIOD_OUT_LOW; - default: - break; - } - default: - break; - } - - /* - * Assume that the BIOS has configured the direction and pull - * accordingly. - */ - return GPIOD_ASIS; -} - static int __acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update) { From patchwork Wed Nov 11 22:05: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: 1398554 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 4CWf2X01Lgz9sSn for ; Thu, 12 Nov 2020 09:06:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbgKKWG0 (ORCPT ); Wed, 11 Nov 2020 17:06:26 -0500 Received: from mga09.intel.com ([134.134.136.24]:1069 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbgKKWGY (ORCPT ); Wed, 11 Nov 2020 17:06:24 -0500 IronPort-SDR: sAMHp8pII9bcA1MutOhQr+rql82iPqWyW3cg3Nk0mdskBt/opa+ETAdwoqHcSHYsgZMR4Lz+KB 4552cxgCHv7A== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="170391852" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="170391852" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:23 -0800 IronPort-SDR: lnmuvhVHc3dwD0m/NIcr71aueE/q2wQWoS0UydJNRPwm2VwwBMnoe3SnI4wlPAobk7DZiIsV62 w5nxkArVPtow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="323414186" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 11 Nov 2020 14:06:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C39D45F5; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Vasile-Laurentiu Stanimir , Hans de Goede , Mika Westerberg , Andy Shevchenko Subject: [PATCH v6 11/18] gpiolib: acpi: Set initial value for output pin based on bias and polarity Date: Thu, 12 Nov 2020 00:05:52 +0200 Message-Id: <20201111220559.39680-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Vasile-Laurentiu Stanimir GpioIo() resources don't contain an initial value for the output pin. Therefore instead of deducting its value solely based on bias field we should deduce that value from the polarity and the bias fields. Typical scenario is, when pin is defined in the table and its polarity, specified in _DSD or via platform code, is defined as active low, in the following call chain: -> acpi_populate_gpio_lookup() -> acpi_gpio_to_gpiod_flags() it will return GPIOD_OUT_HIGH if bias is set no matter if polarity is GPIO_ACTIVE_LOW, so it will return the current level instead of the logical level. Cc: Hans de Goede Cc: Mika Westerberg Signed-off-by: Vasile-Laurentiu Stanimir Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib-acpi.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index ac1bde0720f2..b47d5e8edaeb 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -206,7 +206,7 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio) } static enum gpiod_flags -acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio) +acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity) { switch (agpio->io_restriction) { case ACPI_IO_RESTRICT_INPUT: @@ -215,15 +215,17 @@ acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio) /* * ACPI GPIO resources don't contain an initial value for the * GPIO. Therefore we deduce that value from the pull field - * instead. If the pin is pulled up we assume default to be - * high, if it is pulled down we assume default to be low, - * otherwise we leave pin untouched. + * and the polarity instead. If the pin is pulled up we assume + * default to be high, if it is pulled down we assume default + * to be low, otherwise we leave pin untouched. For active low + * polarity values will be switched. See also + * Documentation/firmware-guide/acpi/gpio-properties.rst. */ switch (agpio->pin_config) { case ACPI_PIN_CONFIG_PULLUP: - return GPIOD_OUT_HIGH; + return polarity == GPIO_ACTIVE_LOW ? GPIOD_OUT_LOW : GPIOD_OUT_HIGH; case ACPI_PIN_CONFIG_PULLDOWN: - return GPIOD_OUT_LOW; + return polarity == GPIO_ACTIVE_LOW ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; default: break; } @@ -683,8 +685,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) lookup->info.polarity = agpio->polarity; lookup->info.triggering = agpio->triggering; } else { - lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio); lookup->info.polarity = lookup->active_low; + lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity); } } @@ -1055,12 +1057,13 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, } if (!found) { - enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio); + int polarity = GPIO_ACTIVE_HIGH; + enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio, polarity); const char *label = "ACPI:OpRegion"; int ret; desc = gpiochip_request_own_desc(chip, pin, label, - GPIO_ACTIVE_HIGH, + polarity, flags); if (IS_ERR(desc)) { mutex_unlock(&achip->conn_lock); From patchwork Wed Nov 11 22:05: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: 1398556 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 4CWf2Y080gz9sTL for ; Thu, 12 Nov 2020 09:06:29 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbgKKWG0 (ORCPT ); Wed, 11 Nov 2020 17:06:26 -0500 Received: from mga09.intel.com ([134.134.136.24]:1069 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726746AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 IronPort-SDR: TMxHM+UVoUR/DVkGjDFDOzawCiRfvm7OWXysJWbRLiYEv7fiS7t6GDEaw7aWg1nHFbVziF4vX+ nkdRxbF5j+xw== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="170391849" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="170391849" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: 72c0aqCNALxKP/w7uMGJF+qgjYwtV+Bj8n7jsh6rby37h4PJLlvErh+TxLjnLqHa2fhv4tnMze IFMjzoktMoBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="366093082" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 11 Nov 2020 14:06:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CF35460A; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 12/18] gpiolib: acpi: Make acpi_gpio_to_gpiod_flags() usable for GpioInt() Date: Thu, 12 Nov 2020 00:05:53 +0200 Message-Id: <20201111220559.39680-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org GpioInt() implies input configuration of the pin. Add this to the acpi_gpio_to_gpiod_flags() and make usable for GpioInt(). Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index b47d5e8edaeb..644067cc0f81 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -208,6 +208,10 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio) static enum gpiod_flags acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity) { + /* GpioInt() implies input configuration */ + if (agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) + return GPIOD_IN; + switch (agpio->io_restriction) { case ACPI_IO_RESTRICT_INPUT: return GPIOD_IN; @@ -681,13 +685,13 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) * - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH */ if (lookup->info.gpioint) { - lookup->info.flags = GPIOD_IN; lookup->info.polarity = agpio->polarity; lookup->info.triggering = agpio->triggering; } else { lookup->info.polarity = lookup->active_low; - lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity); } + + lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity); } return 1; From patchwork Wed Nov 11 22:05: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: 1398546 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 4CWf2S0hdYz9s0b for ; Thu, 12 Nov 2020 09:06:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 Received: from mga11.intel.com ([192.55.52.93]:61332 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 IronPort-SDR: dtrIFj3EiS20rcwbUp++llusc/zYBdNJEbtC+DFLxdDeriXtclvHO7I0t8gkeDxefWot31xsRd CH7rmGmH143A== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="166717639" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="166717639" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: U7iB+3DKO/ZMCZ6/t5mloAzRVDxa9EzfvIHZxUyWDQqsm1qK3usQe4EfpfEgIAvtXWxqYlPEEx Fh9YJirNdBTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="308626187" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 11 Nov 2020 14:06:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DAC50654; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 13/18] gpiolib: acpi: Extract acpi_request_own_gpiod() helper Date: Thu, 12 Nov 2020 00:05:54 +0200 Message-Id: <20201111220559.39680-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org It appears that we are using similar code excerpts for ACPI OpRegion and event handling. Deduplicate those excerpts by extracting a new acpi_request_own_gpiod() helper. Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 46 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 644067cc0f81..c46fd51007d0 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -244,6 +244,28 @@ acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity) return GPIOD_ASIS; } +static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip, + struct acpi_resource_gpio *agpio, + unsigned int index, + const char *label) +{ + int polarity = GPIO_ACTIVE_HIGH; + enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio, polarity); + unsigned int pin = agpio->pin_table[index]; + struct gpio_desc *desc; + int ret; + + desc = gpiochip_request_own_desc(chip, pin, label, polarity, flags); + if (IS_ERR(desc)) + return desc; + + ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); + if (ret) + gpiochip_free_own_desc(desc); + + return ret ? ERR_PTR(ret) : desc; +} + static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in) { const char *controller, *pin_str; @@ -329,8 +351,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, if (!handler) return AE_OK; - desc = gpiochip_request_own_desc(chip, pin, "ACPI:Event", - GPIO_ACTIVE_HIGH, GPIOD_IN); + desc = acpi_request_own_gpiod(chip, agpio, 0, "ACPI:Event"); if (IS_ERR(desc)) { dev_err(chip->parent, "Failed to request GPIO for pin 0x%04X, err %ld\n", @@ -338,10 +359,6 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, return AE_OK; } - ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); - if (ret) - goto fail_free_desc; - ret = gpiochip_lock_as_irq(chip, pin); if (ret) { dev_err(chip->parent, @@ -1061,28 +1078,13 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, } if (!found) { - int polarity = GPIO_ACTIVE_HIGH; - enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio, polarity); - const char *label = "ACPI:OpRegion"; - int ret; - - desc = gpiochip_request_own_desc(chip, pin, label, - polarity, - flags); + desc = acpi_request_own_gpiod(chip, agpio, i, "ACPI:OpRegion"); if (IS_ERR(desc)) { mutex_unlock(&achip->conn_lock); status = AE_ERROR; goto out; } - ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); - if (ret) { - gpiochip_free_own_desc(desc); - mutex_unlock(&achip->conn_lock); - status = AE_ERROR; - goto out; - } - conn = kzalloc(sizeof(*conn), GFP_KERNEL); if (!conn) { gpiochip_free_own_desc(desc); From patchwork Wed Nov 11 22:05:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398557 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 4CWf2c6MBcz9sSn for ; Thu, 12 Nov 2020 09:06:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbgKKWGa (ORCPT ); Wed, 11 Nov 2020 17:06:30 -0500 Received: from mga17.intel.com ([192.55.52.151]:62678 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbgKKWG3 (ORCPT ); Wed, 11 Nov 2020 17:06:29 -0500 IronPort-SDR: wwP+XpQpzr80nr4Q8HlpH4Qj+DFlEW460yY5Nj3ogjVuLOVQERy6eRe63a4xL9IO9jVYwq25dP R7hzgrfoGfBw== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="150076085" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="150076085" 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; 11 Nov 2020 14:06:25 -0800 IronPort-SDR: r8nzKSbgJscZMwNW5Q2msXocMC8y5BDnwDnbX8eBTefZeIBcKJEbI8SOdfNAQZ/4AKMUjVtyMI WF/lP9aY1tAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="328272992" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Nov 2020 14:06:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E5F86709; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 14/18] gpiolib: acpi: Convert pin_index to be u16 Date: Thu, 12 Nov 2020 00:05:55 +0200 Message-Id: <20201111220559.39680-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org As specified by ACPI the pin index is 16-bit unsigned integer. Define the variable, which holds it, accordingly. Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Acked-by: Linus Walleij Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index c46fd51007d0..a556e2ec0a39 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -660,7 +660,7 @@ int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, struct acpi_gpio_lookup { struct acpi_gpio_info info; int index; - int pin_index; + u16 pin_index; bool active_low; struct gpio_desc *desc; int n; @@ -676,7 +676,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) if (!lookup->desc) { const struct acpi_resource_gpio *agpio = &ares->data.gpio; bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; - int pin_index; + u16 pin_index; if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint) lookup->index++; @@ -822,7 +822,7 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev, if (ret) return ERR_PTR(ret); - dev_dbg(&adev->dev, "GPIO: _DSD returned %s %d %d %u\n", + dev_dbg(&adev->dev, "GPIO: _DSD returned %s %d %u %u\n", dev_name(&lookup.info.adev->dev), lookup.index, lookup.pin_index, lookup.active_low); } else { @@ -1018,7 +1018,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, struct gpio_chip *chip = achip->chip; struct acpi_resource_gpio *agpio; struct acpi_resource *ares; - int pin_index = (int)address; + u16 pin_index = address; acpi_status status; int length; int i; @@ -1041,7 +1041,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, return AE_BAD_PARAMETER; } - length = min(agpio->pin_table_length, (u16)(pin_index + bits)); + length = min_t(u16, agpio->pin_table_length, pin_index + bits); for (i = pin_index; i < length; ++i) { int pin = agpio->pin_table[i]; struct acpi_gpio_connection *conn; From patchwork Wed Nov 11 22:05:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398548 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 4CWf2T0Nv6z9sTK for ; Thu, 12 Nov 2020 09:06:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbgKKWGY (ORCPT ); Wed, 11 Nov 2020 17:06:24 -0500 Received: from mga12.intel.com ([192.55.52.136]:8979 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 IronPort-SDR: XT0sLtej1hKIydMLlNRDK5eLVVXG5mYDgycezKdf1fNW1yaMaJaTQeOUs54iF6saSCULjp6hN9 fLNuyYxQu3Ew== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="149498445" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="149498445" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:23 -0800 IronPort-SDR: umTcTC6G49hN5M5gCMam5gD7mDDcMcZMJtsJx17xF8kLLwgPJ2m2tlJbBOcJw2T/caQHX+X3zQ sNvG1jmjABPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="530385553" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 11 Nov 2020 14:06:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id F1200749; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Mika Westerberg Subject: [PATCH v6 15/18] gpiolib: acpi: Use BIT() macro to increase readability Date: Thu, 12 Nov 2020 00:05:56 +0200 Message-Id: <20201111220559.39680-16-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org We may use BIT() macro to increase readability in acpi_gpio_adr_space_handler(). Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index a556e2ec0a39..6cc5f91bfe2e 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1101,8 +1101,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, mutex_unlock(&achip->conn_lock); if (function == ACPI_WRITE) - gpiod_set_raw_value_cansleep(desc, - !!((1 << i) & *value)); + gpiod_set_raw_value_cansleep(desc, !!(*value & BIT(i))); else *value |= (u64)gpiod_get_raw_value_cansleep(desc) << i; } From patchwork Wed Nov 11 22:05:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398552 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 4CWf2W15dHz9s0b for ; Thu, 12 Nov 2020 09:06:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726865AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 Received: from mga04.intel.com ([192.55.52.120]:53545 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726901AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 IronPort-SDR: wqvsGmZrmgFxuaWsdntqSIpj8hmgifoYM9LqYlrMrxVXXHgtCw/P++Tf5ZrPsTQIzS8jJnz11N tKbMpm5lO6FQ== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="167641927" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="167641927" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:24 -0800 IronPort-SDR: tFNROCKKh686d9LpS41505xfnBi5to8XkpJWQJFfBhb4rOF1DF4xwTqU4gP4pCOlPcukiouzWW M1O2ERmDmceQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="356817233" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 11 Nov 2020 14:06:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0B4D474E; Thu, 12 Nov 2020 00:06:18 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v6 16/18] gpiolib: acpi: Make Intel GPIO tree official for GPIO ACPI work Date: Thu, 12 Nov 2020 00:05:57 +0200 Message-Id: <20201111220559.39680-17-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Make Intel GPIO tree official for GPIO ACPI work. Signed-off-by: Andy Shevchenko --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index e73636b75f29..53236b2ea0af 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7483,6 +7483,7 @@ M: Andy Shevchenko L: linux-gpio@vger.kernel.org L: linux-acpi@vger.kernel.org S: Maintained +T: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git F: Documentation/firmware-guide/acpi/gpio-properties.rst F: drivers/gpio/gpiolib-acpi.c F: drivers/gpio/gpiolib-acpi.h From patchwork Wed Nov 11 22:05:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398555 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 4CWf2X3lj4z9s0b for ; Thu, 12 Nov 2020 09:06:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbgKKWG0 (ORCPT ); Wed, 11 Nov 2020 17:06:26 -0500 Received: from mga02.intel.com ([134.134.136.20]:65375 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726960AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 IronPort-SDR: FA2UzdtB/fgA13PbfVhQqAi2Ek9VWgiwGOEcngjnJ8VKeD8JkmiXZwfIGN7UodfAUk6qcSUw/z GbVqhlWY2JWw== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="157241318" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="157241318" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:24 -0800 IronPort-SDR: ydWJD01v2+d8BJzd9mb0JHa4TyJ/2EOXrxoei7uFdoD7vQxPaBI0FkeJS4seV/pkZ+Y7HtpBJk isOpA5dbj3Tw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="360718177" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 11 Nov 2020 14:06:23 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 15B76765; Thu, 12 Nov 2020 00:06:18 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v6 17/18] sh: Drop ARCH_NR_GPIOS definition Date: Thu, 12 Nov 2020 00:05:58 +0200 Message-Id: <20201111220559.39680-18-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The default by generic header is the same, hence drop unnecessary definition. Signed-off-by: Andy Shevchenko --- arch/sh/include/asm/gpio.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h index 351918894e86..d643250f0a0f 100644 --- a/arch/sh/include/asm/gpio.h +++ b/arch/sh/include/asm/gpio.h @@ -16,7 +16,6 @@ #include #endif -#define ARCH_NR_GPIOS 512 #include #ifdef CONFIG_GPIOLIB From patchwork Wed Nov 11 22:05:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398553 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 4CWf2W4kl2z9sTK for ; Thu, 12 Nov 2020 09:06:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726849AbgKKWGZ (ORCPT ); Wed, 11 Nov 2020 17:06:25 -0500 Received: from mga12.intel.com ([192.55.52.136]:8979 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbgKKWGY (ORCPT ); Wed, 11 Nov 2020 17:06:24 -0500 IronPort-SDR: qcFPVv/vt686AVy1bKZmlk+WEM8Zjn4QQX6gxOp2DJacEsFSg6V6bDIPp2p/JSBmgqs+uDlMpm z/+/KRN9PyrQ== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="149498451" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="149498451" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:24 -0800 IronPort-SDR: lWfMqqGTnnKkMSfY+2xJl/6pQ3fF8czfVkujVznaq9PYVLigSsYCXuB6pieHMh7GPCLNFxkNc8 RwUrrSZb6MkA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="366390838" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 11 Nov 2020 14:06:23 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 232BB7A1; Thu, 12 Nov 2020 00:06:18 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v6 18/18] ARM: Drop ARCH_NR_GPIOS definition Date: Thu, 12 Nov 2020 00:05:59 +0200 Message-Id: <20201111220559.39680-19-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The conditional by the generic header is the same, hence drop unnecessary duplication. Signed-off-by: Andy Shevchenko --- arch/arm/include/asm/gpio.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index c50e383358c4..f3bb8a2bf788 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -2,10 +2,6 @@ #ifndef _ARCH_ARM_GPIO_H #define _ARCH_ARM_GPIO_H -#if CONFIG_ARCH_NR_GPIO > 0 -#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO -#endif - /* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */ #include