* [PATCH 1/2] pinctrl: starfive: jh7100: use new GPIO line value setter callbacks
2025-06-12 12:24 [PATCH 0/2] pinctrl: starfive: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-06-12 12:24 ` Bartosz Golaszewski
2025-06-18 3:28 ` Hal Feng
2025-06-12 12:24 ` [PATCH 2/2] pinctrl: starfive: jh7110: " Bartosz Golaszewski
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-06-12 12:24 UTC (permalink / raw)
To: Emil Renner Berthing, Jianlong Huang, Hal Feng, Linus Walleij,
Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
index 27f99183d994dccb92aac81ca42228bdb9225e87..78952523e5b62d2653f057fdb985438beba269b6 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
@@ -969,8 +969,8 @@ static int starfive_gpio_get(struct gpio_chip *gc, unsigned int gpio)
return !!(readl_relaxed(din) & BIT(gpio % 32));
}
-static void starfive_gpio_set(struct gpio_chip *gc, unsigned int gpio,
- int value)
+static int starfive_gpio_set(struct gpio_chip *gc, unsigned int gpio,
+ int value)
{
struct starfive_pinctrl *sfp = container_of(gc, struct starfive_pinctrl, gc);
void __iomem *dout = sfp->base + GPON_DOUT_CFG + 8 * gpio;
@@ -979,6 +979,8 @@ static void starfive_gpio_set(struct gpio_chip *gc, unsigned int gpio,
raw_spin_lock_irqsave(&sfp->lock, flags);
writel_relaxed(value, dout);
raw_spin_unlock_irqrestore(&sfp->lock, flags);
+
+ return 0;
}
static int starfive_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
@@ -1300,7 +1302,7 @@ static int starfive_probe(struct platform_device *pdev)
sfp->gc.direction_input = starfive_gpio_direction_input;
sfp->gc.direction_output = starfive_gpio_direction_output;
sfp->gc.get = starfive_gpio_get;
- sfp->gc.set = starfive_gpio_set;
+ sfp->gc.set_rv = starfive_gpio_set;
sfp->gc.set_config = starfive_gpio_set_config;
sfp->gc.add_pin_ranges = starfive_gpio_add_pin_ranges;
sfp->gc.base = -1;
--
2.48.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH 1/2] pinctrl: starfive: jh7100: use new GPIO line value setter callbacks
2025-06-12 12:24 ` [PATCH 1/2] pinctrl: starfive: jh7100: " Bartosz Golaszewski
@ 2025-06-18 3:28 ` Hal Feng
0 siblings, 0 replies; 7+ messages in thread
From: Hal Feng @ 2025-06-18 3:28 UTC (permalink / raw)
To: Bartosz Golaszewski, Emil Renner Berthing, Jianlong Huang,
Linus Walleij
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski
> On 12.06.25 20:25, Bartosz Golaszewski wrote:
>
> struct gpio_chip now has callbacks for setting line values that return an integer,
> allowing to indicate failures. Convert the driver to using them.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Hal Feng <hal.feng@starfivetech.com>
> ---
> drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> index
> 27f99183d994dccb92aac81ca42228bdb9225e87..78952523e5b62d2653f0
> 57fdb985438beba269b6 100644
> --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> @@ -969,8 +969,8 @@ static int starfive_gpio_get(struct gpio_chip *gc,
> unsigned int gpio)
> return !!(readl_relaxed(din) & BIT(gpio % 32)); }
>
> -static void starfive_gpio_set(struct gpio_chip *gc, unsigned int gpio,
> - int value)
> +static int starfive_gpio_set(struct gpio_chip *gc, unsigned int gpio,
> + int value)
> {
> struct starfive_pinctrl *sfp = container_of(gc, struct starfive_pinctrl,
> gc);
> void __iomem *dout = sfp->base + GPON_DOUT_CFG + 8 * gpio; @@ -
> 979,6 +979,8 @@ static void starfive_gpio_set(struct gpio_chip *gc, unsigned
> int gpio,
> raw_spin_lock_irqsave(&sfp->lock, flags);
> writel_relaxed(value, dout);
> raw_spin_unlock_irqrestore(&sfp->lock, flags);
> +
> + return 0;
> }
>
> static int starfive_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
> @@ -1300,7 +1302,7 @@ static int starfive_probe(struct platform_device
> *pdev)
> sfp->gc.direction_input = starfive_gpio_direction_input;
> sfp->gc.direction_output = starfive_gpio_direction_output;
> sfp->gc.get = starfive_gpio_get;
> - sfp->gc.set = starfive_gpio_set;
> + sfp->gc.set_rv = starfive_gpio_set;
> sfp->gc.set_config = starfive_gpio_set_config;
> sfp->gc.add_pin_ranges = starfive_gpio_add_pin_ranges;
> sfp->gc.base = -1;
>
> --
> 2.48.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] pinctrl: starfive: jh7110: use new GPIO line value setter callbacks
2025-06-12 12:24 [PATCH 0/2] pinctrl: starfive: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-12 12:24 ` [PATCH 1/2] pinctrl: starfive: jh7100: " Bartosz Golaszewski
@ 2025-06-12 12:24 ` Bartosz Golaszewski
2025-06-18 3:24 ` Hal Feng
2025-06-12 12:33 ` [PATCH 0/2] pinctrl: starfive: " Emil Renner Berthing
2025-06-18 12:06 ` Linus Walleij
3 siblings, 1 reply; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-06-12 12:24 UTC (permalink / raw)
To: Emil Renner Berthing, Jianlong Huang, Hal Feng, Linus Walleij,
Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 1d0d6c224c104e7e970d5e31e52b2fe3b19e2cad..082bb1c6cea9b29257b197f065c1a9deebc997fd 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -608,8 +608,7 @@ static int jh7110_gpio_get(struct gpio_chip *gc, unsigned int gpio)
return !!(readl_relaxed(reg) & BIT(gpio % 32));
}
-static void jh7110_gpio_set(struct gpio_chip *gc,
- unsigned int gpio, int value)
+static int jh7110_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
{
struct jh7110_pinctrl *sfp = container_of(gc,
struct jh7110_pinctrl, gc);
@@ -625,6 +624,8 @@ static void jh7110_gpio_set(struct gpio_chip *gc,
dout |= readl_relaxed(reg_dout) & ~mask;
writel_relaxed(dout, reg_dout);
raw_spin_unlock_irqrestore(&sfp->lock, flags);
+
+ return 0;
}
static int jh7110_gpio_set_config(struct gpio_chip *gc,
@@ -934,7 +935,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev)
sfp->gc.direction_input = jh7110_gpio_direction_input;
sfp->gc.direction_output = jh7110_gpio_direction_output;
sfp->gc.get = jh7110_gpio_get;
- sfp->gc.set = jh7110_gpio_set;
+ sfp->gc.set_rv = jh7110_gpio_set;
sfp->gc.set_config = jh7110_gpio_set_config;
sfp->gc.add_pin_ranges = jh7110_gpio_add_pin_ranges;
sfp->gc.base = info->gc_base;
--
2.48.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH 2/2] pinctrl: starfive: jh7110: use new GPIO line value setter callbacks
2025-06-12 12:24 ` [PATCH 2/2] pinctrl: starfive: jh7110: " Bartosz Golaszewski
@ 2025-06-18 3:24 ` Hal Feng
0 siblings, 0 replies; 7+ messages in thread
From: Hal Feng @ 2025-06-18 3:24 UTC (permalink / raw)
To: Bartosz Golaszewski, Emil Renner Berthing, Jianlong Huang,
Linus Walleij
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski
> On 11.06.25 14:14, Bartosz Golaszewski wrote:
>
> struct gpio_chip now has callbacks for setting line values that return an integer,
> allowing to indicate failures. Convert the driver to using them.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Hal Feng <hal.feng@starfivetech.com>
> ---
> drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> index
> 1d0d6c224c104e7e970d5e31e52b2fe3b19e2cad..082bb1c6cea9b29257b1
> 97f065c1a9deebc997fd 100644
> --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> @@ -608,8 +608,7 @@ static int jh7110_gpio_get(struct gpio_chip *gc,
> unsigned int gpio)
> return !!(readl_relaxed(reg) & BIT(gpio % 32)); }
>
> -static void jh7110_gpio_set(struct gpio_chip *gc,
> - unsigned int gpio, int value)
> +static int jh7110_gpio_set(struct gpio_chip *gc, unsigned int gpio, int
> +value)
> {
> struct jh7110_pinctrl *sfp = container_of(gc,
> struct jh7110_pinctrl, gc);
> @@ -625,6 +624,8 @@ static void jh7110_gpio_set(struct gpio_chip *gc,
> dout |= readl_relaxed(reg_dout) & ~mask;
> writel_relaxed(dout, reg_dout);
> raw_spin_unlock_irqrestore(&sfp->lock, flags);
> +
> + return 0;
> }
>
> static int jh7110_gpio_set_config(struct gpio_chip *gc, @@ -934,7 +935,7
> @@ int jh7110_pinctrl_probe(struct platform_device *pdev)
> sfp->gc.direction_input = jh7110_gpio_direction_input;
> sfp->gc.direction_output = jh7110_gpio_direction_output;
> sfp->gc.get = jh7110_gpio_get;
> - sfp->gc.set = jh7110_gpio_set;
> + sfp->gc.set_rv = jh7110_gpio_set;
> sfp->gc.set_config = jh7110_gpio_set_config;
> sfp->gc.add_pin_ranges = jh7110_gpio_add_pin_ranges;
> sfp->gc.base = info->gc_base;
>
> --
> 2.48.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] pinctrl: starfive: use new GPIO line value setter callbacks
2025-06-12 12:24 [PATCH 0/2] pinctrl: starfive: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-12 12:24 ` [PATCH 1/2] pinctrl: starfive: jh7100: " Bartosz Golaszewski
2025-06-12 12:24 ` [PATCH 2/2] pinctrl: starfive: jh7110: " Bartosz Golaszewski
@ 2025-06-12 12:33 ` Emil Renner Berthing
2025-06-18 12:06 ` Linus Walleij
3 siblings, 0 replies; 7+ messages in thread
From: Emil Renner Berthing @ 2025-06-12 12:33 UTC (permalink / raw)
To: Bartosz Golaszewski, Emil Renner Berthing, Jianlong Huang,
Hal Feng, Linus Walleij
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
Bartosz Golaszewski wrote:
> Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> values") added new line setter callbacks to struct gpio_chip. They allow
> to indicate failures to callers. We're in the process of converting all
> GPIO controllers to using them before removing the old ones. This series
> converts all GPIO chips in starfive pin control drivers.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thanks!
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
> ---
> Bartosz Golaszewski (2):
> pinctrl: starfive: jh7100: use new GPIO line value setter callbacks
> pinctrl: starfive: jh7110: use new GPIO line value setter callbacks
>
> drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 8 +++++---
> drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 7 ++++---
> 2 files changed, 9 insertions(+), 6 deletions(-)
> ---
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> change-id: 20250612-gpiochip-set-rv-pinctrl-starfive-89120203688c
>
> Best regards,
> --
> Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] pinctrl: starfive: use new GPIO line value setter callbacks
2025-06-12 12:24 [PATCH 0/2] pinctrl: starfive: use new GPIO line value setter callbacks Bartosz Golaszewski
` (2 preceding siblings ...)
2025-06-12 12:33 ` [PATCH 0/2] pinctrl: starfive: " Emil Renner Berthing
@ 2025-06-18 12:06 ` Linus Walleij
3 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2025-06-18 12:06 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Emil Renner Berthing, Jianlong Huang, Hal Feng, linux-gpio,
linux-kernel, Bartosz Golaszewski
On Thu, Jun 12, 2025 at 2:24 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> values") added new line setter callbacks to struct gpio_chip. They allow
> to indicate failures to callers. We're in the process of converting all
> GPIO controllers to using them before removing the old ones. This series
> converts all GPIO chips in starfive pin control drivers.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Patches applied!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread