From patchwork Thu Jan 12 16:38:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 644805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44202C61DB3 for ; Thu, 12 Jan 2023 16:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240926AbjALQqf (ORCPT ); Thu, 12 Jan 2023 11:46:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241262AbjALQoj (ORCPT ); Thu, 12 Jan 2023 11:44:39 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF69E58834; Thu, 12 Jan 2023 08:38:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541505; x=1705077505; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=68OPSiZVY1KVbajcXwUGWj+MRV19nF/DUDmqYU0Aj6I=; b=Zll/R+8E+ITOdeBMGhDfdNMkYX22wjgLCWKYmyt+hOgbYklUU5dSO4VL Kri2Y374BRL6l5iLHu+a1VZzoNILj6nRX6hX2W9nyNGmdn38cRh19ecJg AdU79KTaHgw8XRGAFSixlsWHgjLYvhnOhLtODTxjytBjz+KJvKSVfHlk6 YwMNG2ah77SRUOoexV3X6X3xbcL5eTBkj2GIR+uQytYuNYx3778Z09c/r hZgSQCI3NKm6B2aLuOGsKyoOVjmJM44bkrJS8TU6AftDExKwy7Q0Z2XOz Qge3XjP3eV/JPMdQB8Ql2xF800AKfK1ea6020fDC2Dq2TD/iEphwsZhyK A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="304132438" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="304132438" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:38:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690193082" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="690193082" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 12 Jan 2023 08:37:58 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E3D71E1; Thu, 12 Jan 2023 18:38:31 +0200 (EET) From: Andy Shevchenko To: Bartosz Golaszewski , Dmitry Torokhov , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Bartosz Golaszewski , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Andy Shevchenko Subject: [PATCH v1 1/2] pinctrl: bcm: bcm2835: Switch to use ->add_pin_ranges() Date: Thu, 12 Jan 2023 18:38:24 +0200 Message-Id: <20230112163825.72983-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Yeah, while the ->add_pin_ranges() shouldn't be used by DT drivers, this one requires it to support quite old firmware descriptions that do not have gpio-ranges property. The change allows to clean up GPIO library from OF specifics. There is no functional change intended. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 7857e612a100..fea1d1bcb389 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -358,16 +358,18 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip, return 0; } -static int bcm2835_of_gpio_ranges_fallback(struct gpio_chip *gc, - struct device_node *np) +static int bcm2835_add_pin_ranges_fallback(struct gpio_chip *gc) { + struct bcm2835_pinctrl *pc = gpiochip_get_data(gc); + struct device_node *np = dev_of_node(&gc->gpiodev->dev); struct pinctrl_dev *pctldev = of_pinctrl_get(np); - of_node_put(np); - if (!pctldev) return 0; + if (of_property_read_bool(np, "gpio-ranges")) + return 0; + gpiochip_add_pin_range(gc, pinctrl_dev_get_devname(pctldev), 0, 0, gc->ngpio); @@ -388,7 +390,7 @@ static const struct gpio_chip bcm2835_gpio_chip = { .base = -1, .ngpio = BCM2835_NUM_GPIOS, .can_sleep = false, - .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback, + .add_pin_ranges = bcm2835_add_pin_ranges_fallback, }; static const struct gpio_chip bcm2711_gpio_chip = { @@ -405,7 +407,7 @@ static const struct gpio_chip bcm2711_gpio_chip = { .base = -1, .ngpio = BCM2711_NUM_GPIOS, .can_sleep = false, - .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback, + .add_pin_ranges = bcm2835_add_pin_ranges_fallback, }; static void bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc, From patchwork Thu Jan 12 16:39:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 644803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A04CEC63797 for ; Thu, 12 Jan 2023 16:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240764AbjALQw6 (ORCPT ); Thu, 12 Jan 2023 11:52:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241490AbjALQu1 (ORCPT ); Thu, 12 Jan 2023 11:50:27 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A4735F91E; Thu, 12 Jan 2023 08:39:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541565; x=1705077565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fVWXQlK37xmphsZHTjVPbnx5CD+Mvd7qdaqifrAOEdQ=; b=RWaEbQPGCblTqH7MEVnFhCXiyWq52amsFuTZ7dFUovOWDdJZmHPJGOAH MD5hmVtztlSrrAtNv/sQ8sOhmK/w+ZJCwCF1P/+d71B6+4PdVnVnYY4ho 9hDtiZtrApsQsE2j0BMkp4c7DUhFyY8uE5Lrq53egwlyEAR33OIC+tZlm FamH2RwMwtqRICkwgOwjNVvmxRXpfjBYxqBLk4ucT2+us4cRSFJdt7XrK p7SHNs97InZaqsJVeAH3IQA4SwCboH/t3DlhL6OOBKm+ZEtP1gzmRZlEf T5ZqLKV89Gg4WaniTfeNY5wF2/HWxTnyvyq0Y8vU/7kA2BcZcNtnV7Qc/ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="304132775" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="304132775" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:39:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="635447461" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="635447461" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 12 Jan 2023 08:39:01 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7536B7C; Thu, 12 Jan 2023 18:39:35 +0200 (EET) From: Andy Shevchenko To: Bartosz Golaszewski , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski Subject: [PATCH v1 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency Date: Thu, 12 Jan 2023 18:39:20 +0200 Message-Id: <20230112163920.73102-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112163920.73102-1-andriy.shevchenko@linux.intel.com> References: <20230112163920.73102-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The driver doesn't depend on the OF_GPIO to be complied. Hence the proper header to use is mod_devicetable.h. Replace of*.h with the above mentioned and drop redundant dependency. Signed-off-by: Andy Shevchenko --- drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-wcd934x.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 9711fcb9a4e9..3b2078a654ce 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -700,7 +700,7 @@ config GPIO_VX855 config GPIO_WCD934X tristate "Qualcomm Technologies Inc WCD9340/WCD9341 GPIO controller driver" - depends on MFD_WCD934X && OF_GPIO + depends on MFD_WCD934X help This driver is to support GPIO block found on the Qualcomm Technologies Inc WCD9340/WCD9341 Audio Codec. diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c index 817750e4e033..e6a8df7211f8 100644 --- a/drivers/gpio/gpio-wcd934x.c +++ b/drivers/gpio/gpio-wcd934x.c @@ -1,11 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019, Linaro Limited +#include #include -#include #include #include -#include + +#include #define WCD_PIN_MASK(p) BIT(p) #define WCD_REG_DIR_CTL_OFFSET 0x42