[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250217-03-k1-gpio-v5-1-2863ec3e7b67@gentoo.org>
Date: Mon, 17 Feb 2025 20:57:44 +0800
From: Yixun Lan <dlan@...too.org>
To: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Conor Dooley <conor@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>
Cc: Yangyu Chen <cyy@...self.name>, Jisheng Zhang <jszhang@...nel.org>,
Jesse Taube <mr.bossman075@...il.com>,
Inochi Amaoto <inochiama@...look.com>, Icenowy Zheng <uwu@...nowy.me>,
Meng Zhang <zhangmeng.kevin@...ux.spacemit.com>, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, spacemit@...ts.linux.dev,
Yixun Lan <dlan@...too.org>
Subject: [PATCH v5 1/5] gpio: of: support to add custom add pin range
function
Export custom function to add gpio pin range from pinctrl
subsystem. This would make it possible to add pins to multi
gpio chips.
Signed-off-by: Yixun Lan <dlan@...too.org>
---
drivers/gpio/gpiolib-of.c | 5 ++++-
include/linux/gpio/driver.h | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 2e537ee979f3e2b6e8d5f86f3e121a66f2a8e083..64c8a153b823d65faebed9c4cd87952359b42765 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -1170,7 +1170,10 @@ int of_gpiochip_add(struct gpio_chip *chip)
if (chip->of_gpio_n_cells > MAX_PHANDLE_ARGS)
return -EINVAL;
- ret = of_gpiochip_add_pin_range(chip);
+ if (!chip->of_add_pin_range)
+ chip->of_add_pin_range = of_gpiochip_add_pin_range;
+
+ ret = chip->of_add_pin_range(chip);
if (ret)
return ret;
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 2dd7cb9cc270a68ddedbcdd5d44e0d0f88dfa785..a7b966c78a2f62075fb7804f6e96028564dda161 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -528,6 +528,13 @@ struct gpio_chip {
*/
int (*of_xlate)(struct gpio_chip *gc,
const struct of_phandle_args *gpiospec, u32 *flags);
+
+ /**
+ * @of_add_pin_range:
+ *
+ * Callback to add pin ranges from pinctrl
+ */
+ int (*of_add_pin_range)(struct gpio_chip *chip);
#endif /* CONFIG_OF_GPIO */
};
--
2.48.1
Powered by blists - more mailing lists