* [PATCH 1/3] Input: ad7879 - use new GPIO line value setter callbacks
2025-04-07 7:19 [PATCH 0/3] Input: convert GPIO chips to using new value setters Bartosz Golaszewski
@ 2025-04-07 7:19 ` Bartosz Golaszewski
2025-04-07 7:19 ` [PATCH 2/3] Input: adp5588 " Bartosz Golaszewski
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:19 UTC (permalink / raw)
To: Michael Hennerich, Dmitry Torokhov, Linus Walleij,
Bartosz Golaszewski
Cc: linux-input, linux-kernel, linux-gpio, 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/input/touchscreen/ad7879.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index f661e199b63c..12fc39f9e784 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -444,10 +444,11 @@ static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
return !!(val & AD7879_GPIO_DATA);
}
-static void ad7879_gpio_set_value(struct gpio_chip *chip,
- unsigned gpio, int value)
+static int ad7879_gpio_set_value(struct gpio_chip *chip, unsigned int gpio,
+ int value)
{
struct ad7879 *ts = gpiochip_get_data(chip);
+ int ret;
mutex_lock(&ts->mutex);
if (value)
@@ -455,8 +456,10 @@ static void ad7879_gpio_set_value(struct gpio_chip *chip,
else
ts->cmd_crtl2 &= ~AD7879_GPIO_DATA;
- ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2);
+ ret = ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2);
mutex_unlock(&ts->mutex);
+
+ return ret;
}
static int ad7879_gpio_add(struct ad7879 *ts)
@@ -472,7 +475,7 @@ static int ad7879_gpio_add(struct ad7879 *ts)
ts->gc.direction_input = ad7879_gpio_direction_input;
ts->gc.direction_output = ad7879_gpio_direction_output;
ts->gc.get = ad7879_gpio_get_value;
- ts->gc.set = ad7879_gpio_set_value;
+ ts->gc.set_rv = ad7879_gpio_set_value;
ts->gc.can_sleep = 1;
ts->gc.base = -1;
ts->gc.ngpio = 1;
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] Input: adp5588 - use new GPIO line value setter callbacks
2025-04-07 7:19 [PATCH 0/3] Input: convert GPIO chips to using new value setters Bartosz Golaszewski
2025-04-07 7:19 ` [PATCH 1/3] Input: ad7879 - use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-04-07 7:19 ` Bartosz Golaszewski
2025-04-07 7:19 ` [PATCH 3/3] Input: adp5589 " Bartosz Golaszewski
2025-04-15 8:31 ` [PATCH 0/3] Input: convert GPIO chips to using new value setters Linus Walleij
3 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:19 UTC (permalink / raw)
To: Michael Hennerich, Dmitry Torokhov, Linus Walleij,
Bartosz Golaszewski
Cc: linux-input, linux-kernel, linux-gpio, 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/input/keyboard/adp5588-keys.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index dc734974ce06..2b2aca08423a 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -232,8 +232,8 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned int off)
return !!(val & bit);
}
-static void adp5588_gpio_set_value(struct gpio_chip *chip,
- unsigned int off, int val)
+static int adp5588_gpio_set_value(struct gpio_chip *chip, unsigned int off,
+ int val)
{
struct adp5588_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
@@ -246,7 +246,8 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip,
else
kpad->dat_out[bank] &= ~bit;
- adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, kpad->dat_out[bank]);
+ return adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank,
+ kpad->dat_out[bank]);
}
static int adp5588_gpio_set_config(struct gpio_chip *chip, unsigned int off,
@@ -424,7 +425,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
kpad->gc.direction_input = adp5588_gpio_direction_input;
kpad->gc.direction_output = adp5588_gpio_direction_output;
kpad->gc.get = adp5588_gpio_get_value;
- kpad->gc.set = adp5588_gpio_set_value;
+ kpad->gc.set_rv = adp5588_gpio_set_value;
kpad->gc.set_config = adp5588_gpio_set_config;
kpad->gc.can_sleep = 1;
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] Input: adp5589 - use new GPIO line value setter callbacks
2025-04-07 7:19 [PATCH 0/3] Input: convert GPIO chips to using new value setters Bartosz Golaszewski
2025-04-07 7:19 ` [PATCH 1/3] Input: ad7879 - use new GPIO line value setter callbacks Bartosz Golaszewski
2025-04-07 7:19 ` [PATCH 2/3] Input: adp5588 " Bartosz Golaszewski
@ 2025-04-07 7:19 ` Bartosz Golaszewski
2025-04-15 9:06 ` Nuno Sá
2025-04-15 8:31 ` [PATCH 0/3] Input: convert GPIO chips to using new value setters Linus Walleij
3 siblings, 1 reply; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:19 UTC (permalink / raw)
To: Michael Hennerich, Dmitry Torokhov, Linus Walleij,
Bartosz Golaszewski
Cc: linux-input, linux-kernel, linux-gpio, 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/input/keyboard/adp5589-keys.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 81d0876ee358..986a789f1ec3 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -404,8 +404,8 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
return !!(val & bit);
}
-static void adp5589_gpio_set_value(struct gpio_chip *chip,
- unsigned off, int val)
+static int adp5589_gpio_set_value(struct gpio_chip *chip, unsigned int off,
+ int val)
{
struct adp5589_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
@@ -418,8 +418,9 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
else
kpad->dat_out[bank] &= ~bit;
- adp5589_write(kpad->client, kpad->var->reg(ADP5589_GPO_DATA_OUT_A) +
- bank, kpad->dat_out[bank]);
+ return adp5589_write(kpad->client,
+ kpad->var->reg(ADP5589_GPO_DATA_OUT_A) + bank,
+ kpad->dat_out[bank]);
}
static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
@@ -520,7 +521,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
kpad->gc.direction_input = adp5589_gpio_direction_input;
kpad->gc.direction_output = adp5589_gpio_direction_output;
kpad->gc.get = adp5589_gpio_get_value;
- kpad->gc.set = adp5589_gpio_set_value;
+ kpad->gc.set_rv = adp5589_gpio_set_value;
kpad->gc.can_sleep = 1;
kpad->gc.base = gpio_data->gpio_start;
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Input: adp5589 - use new GPIO line value setter callbacks
2025-04-07 7:19 ` [PATCH 3/3] Input: adp5589 " Bartosz Golaszewski
@ 2025-04-15 9:06 ` Nuno Sá
2025-04-17 12:31 ` Bartosz Golaszewski
0 siblings, 1 reply; 8+ messages in thread
From: Nuno Sá @ 2025-04-15 9:06 UTC (permalink / raw)
To: Bartosz Golaszewski, Michael Hennerich, Dmitry Torokhov,
Linus Walleij
Cc: linux-input, linux-kernel, linux-gpio, Bartosz Golaszewski
On Mon, 2025-04-07 at 09:19 +0200, Bartosz Golaszewski wrote:
> 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>
> ---
Let's maybe drop this one? I'll send a new version of this [1] that will drop
this driver...
BTW, I can already change my v2 and use .set_rv()...
[1]: https://lore.kernel.org/linux-input/20250313-dev-adp5589-fw-v1-13-20e80d4bd4ea@analog.com/
- Nuno Sá
> drivers/input/keyboard/adp5589-keys.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5589-keys.c
> b/drivers/input/keyboard/adp5589-keys.c
> index 81d0876ee358..986a789f1ec3 100644
> --- a/drivers/input/keyboard/adp5589-keys.c
> +++ b/drivers/input/keyboard/adp5589-keys.c
> @@ -404,8 +404,8 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip,
> unsigned off)
> return !!(val & bit);
> }
>
> -static void adp5589_gpio_set_value(struct gpio_chip *chip,
> - unsigned off, int val)
> +static int adp5589_gpio_set_value(struct gpio_chip *chip, unsigned int off,
> + int val)
> {
> struct adp5589_kpad *kpad = gpiochip_get_data(chip);
> unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
> @@ -418,8 +418,9 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
> else
> kpad->dat_out[bank] &= ~bit;
>
> - adp5589_write(kpad->client, kpad->var->reg(ADP5589_GPO_DATA_OUT_A) +
> - bank, kpad->dat_out[bank]);
> + return adp5589_write(kpad->client,
> + kpad->var->reg(ADP5589_GPO_DATA_OUT_A) + bank,
> + kpad->dat_out[bank]);
> }
>
> static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
> @@ -520,7 +521,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
> kpad->gc.direction_input = adp5589_gpio_direction_input;
> kpad->gc.direction_output = adp5589_gpio_direction_output;
> kpad->gc.get = adp5589_gpio_get_value;
> - kpad->gc.set = adp5589_gpio_set_value;
> + kpad->gc.set_rv = adp5589_gpio_set_value;
> kpad->gc.can_sleep = 1;
>
> kpad->gc.base = gpio_data->gpio_start;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Input: adp5589 - use new GPIO line value setter callbacks
2025-04-15 9:06 ` Nuno Sá
@ 2025-04-17 12:31 ` Bartosz Golaszewski
2025-04-22 9:01 ` Bartosz Golaszewski
0 siblings, 1 reply; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-17 12:31 UTC (permalink / raw)
To: Nuno Sá
Cc: Michael Hennerich, Dmitry Torokhov, Linus Walleij, linux-input,
linux-kernel, linux-gpio, Bartosz Golaszewski
On Tue, Apr 15, 2025 at 11:06 AM Nuno Sá <noname.nuno@gmail.com> wrote:
>
> On Mon, 2025-04-07 at 09:19 +0200, Bartosz Golaszewski wrote:
> > 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>
> > ---
>
> Let's maybe drop this one? I'll send a new version of this [1] that will drop
> this driver...
>
> BTW, I can already change my v2 and use .set_rv()...
>
> [1]: https://lore.kernel.org/linux-input/20250313-dev-adp5589-fw-v1-13-20e80d4bd4ea@analog.com/
>
Sure, as long as the new variant is used, I don't care.
Bart
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Input: adp5589 - use new GPIO line value setter callbacks
2025-04-17 12:31 ` Bartosz Golaszewski
@ 2025-04-22 9:01 ` Bartosz Golaszewski
0 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-22 9:01 UTC (permalink / raw)
To: Nuno Sá, Dmitry Torokhov
Cc: Michael Hennerich, Linus Walleij, linux-input, linux-kernel,
linux-gpio, Bartosz Golaszewski
On Thu, Apr 17, 2025 at 2:31 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Tue, Apr 15, 2025 at 11:06 AM Nuno Sá <noname.nuno@gmail.com> wrote:
> >
> > On Mon, 2025-04-07 at 09:19 +0200, Bartosz Golaszewski wrote:
> > > 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>
> > > ---
> >
> > Let's maybe drop this one? I'll send a new version of this [1] that will drop
> > this driver...
> >
> > BTW, I can already change my v2 and use .set_rv()...
> >
> > [1]: https://lore.kernel.org/linux-input/20250313-dev-adp5589-fw-v1-13-20e80d4bd4ea@analog.com/
> >
>
> Sure, as long as the new variant is used, I don't care.
>
> Bart
Dmitry,
Can you still pick up patches 1 and 2 please?
Bartosz
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] Input: convert GPIO chips to using new value setters
2025-04-07 7:19 [PATCH 0/3] Input: convert GPIO chips to using new value setters Bartosz Golaszewski
` (2 preceding siblings ...)
2025-04-07 7:19 ` [PATCH 3/3] Input: adp5589 " Bartosz Golaszewski
@ 2025-04-15 8:31 ` Linus Walleij
3 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-04-15 8:31 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Michael Hennerich, Dmitry Torokhov, linux-input, linux-kernel,
linux-gpio, Bartosz Golaszewski
On Mon, Apr 7, 2025 at 9:19 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all the GPIO controllers under drivers/input/.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The series:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread