[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241113-a4_pinctrl-v6-3-35ba2401ee35@amlogic.com>
Date: Wed, 13 Nov 2024 15:29:41 +0800
From: Xianwei Zhao via B4 Relay <devnull+xianwei.zhao.amlogic.com@...nel.org>
To: Linus Walleij <linus.walleij@...aro.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
Bartosz Golaszewski <brgl@...ev.pl>
Cc: linux-gpio@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-amlogic@...ts.infradead.org,
linux-kernel@...r.kernel.org, Xianwei Zhao <xianwei.zhao@...ogic.com>
Subject: [PATCH v6 3/5] pinctrl: meson: add interface of of_xlate
From: Xianwei Zhao <xianwei.zhao@...ogic.com>
Amlogic pinctrl software framework use system API of_gpio_simple_xlate
which only support linear one-to-one correspondence to translate gpiospec
to the GPIO number and flags before. It can not meet the non-linear needs.
Add the interface satisfies the underlying driver to implement the
transformation to meet the needs of various scenarios.
Reviewed-by: Neil Armstrong <neil.armstrong@...aro.org>
Signed-off-by: Xianwei Zhao <xianwei.zhao@...ogic.com>
---
drivers/pinctrl/meson/pinctrl-meson.c | 4 ++++
drivers/pinctrl/meson/pinctrl-meson.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 253a0cc57e39..fc0c0bef38c0 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -620,6 +620,10 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
pc->chip.base = -1;
pc->chip.ngpio = pc->data->num_pins;
pc->chip.can_sleep = false;
+ if (pc->data->of_xlate) {
+ pc->chip.of_gpio_n_cells = pc->data->of_gpio_n_cells;
+ pc->chip.of_xlate = pc->data->of_xlate;
+ }
ret = gpiochip_add_data(&pc->chip, pc);
if (ret) {
diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h
index 7883ea31a001..cbb3f22552b9 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.h
+++ b/drivers/pinctrl/meson/pinctrl-meson.h
@@ -120,6 +120,10 @@ struct meson_pinctrl_data {
const struct pinmux_ops *pmx_ops;
const void *pmx_data;
int (*parse_dt)(struct meson_pinctrl *pc);
+ int (*of_xlate)(struct gpio_chip *gc,
+ const struct of_phandle_args *gpiospec,
+ u32 *flags);
+ int of_gpio_n_cells;
};
struct meson_pinctrl {
--
2.37.1
Powered by blists - more mailing lists