mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver
@ 2026-01-26 13:56 Bartosz Golaszewski
  2026-01-26 14:13 ` Abel Vesa
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2026-01-26 13:56 UTC (permalink / raw)
  To: Bjorn Andersson, Linus Walleij, Bartosz Golaszewski, Konrad Dybcio
  Cc: linux-arm-msm, linux-gpio, linux-kernel, Bartosz Golaszewski,
	Abel Vesa, stable

GPIO controller driver should typically implement the .get_direction()
callback as GPIOLIB internals may try to use it to determine the state
of a pin. Add it for the LPASS LPI driver.

Reported-by: Abel Vesa <abelvesa@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
index 78212f992843..76aed3296279 100644
--- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
@@ -312,6 +312,22 @@ static const struct pinconf_ops lpi_gpio_pinconf_ops = {
 	.pin_config_group_set		= lpi_config_set,
 };
 
+static int lpi_gpio_get_direction(struct gpio_chip *chip, unsigned int pin)
+{
+	unsigned long config = pinconf_to_config_packed(PIN_CONFIG_LEVEL, 0);
+	struct lpi_pinctrl *state = gpiochip_get_data(chip);
+	unsigned long arg;
+	int ret;
+
+	ret = lpi_config_get(state->ctrl, pin, &config);
+	if (ret)
+		return ret;
+
+	arg = pinconf_to_config_argument(config);
+
+	return arg ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
+}
+
 static int lpi_gpio_direction_input(struct gpio_chip *chip, unsigned int pin)
 {
 	struct lpi_pinctrl *state = gpiochip_get_data(chip);
@@ -409,6 +425,7 @@ static void lpi_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 #endif
 
 static const struct gpio_chip lpi_gpio_template = {
+	.get_direction		= lpi_gpio_get_direction,
 	.direction_input	= lpi_gpio_direction_input,
 	.direction_output	= lpi_gpio_direction_output,
 	.get			= lpi_gpio_get,
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver
  2026-01-26 13:56 [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver Bartosz Golaszewski
@ 2026-01-26 14:13 ` Abel Vesa
  2026-01-26 14:41 ` Konrad Dybcio
  2026-01-27  9:06 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Abel Vesa @ 2026-01-26 14:13 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bjorn Andersson, Linus Walleij, Bartosz Golaszewski,
	Konrad Dybcio, linux-arm-msm, linux-gpio, linux-kernel,
	Abel Vesa, stable

On 26-01-26 14:56:27, Bartosz Golaszewski wrote:
> GPIO controller driver should typically implement the .get_direction()
> callback as GPIOLIB internals may try to use it to determine the state
> of a pin. Add it for the LPASS LPI driver.
> 
> Reported-by: Abel Vesa <abelvesa@kernel.org>
> Cc: stable@vger.kernel.org
> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

Tested on Dell XPS13 9345 (x1e80100).

Tested-by: Abel Vesa <abel.vesa@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver
  2026-01-26 13:56 [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver Bartosz Golaszewski
  2026-01-26 14:13 ` Abel Vesa
@ 2026-01-26 14:41 ` Konrad Dybcio
  2026-01-26 15:54   ` Bartosz Golaszewski
  2026-01-27  9:06 ` Linus Walleij
  2 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2026-01-26 14:41 UTC (permalink / raw)
  To: Bartosz Golaszewski, Bjorn Andersson, Linus Walleij,
	Bartosz Golaszewski, Konrad Dybcio
  Cc: linux-arm-msm, linux-gpio, linux-kernel, Abel Vesa, stable

On 1/26/26 2:56 PM, Bartosz Golaszewski wrote:
> GPIO controller driver should typically implement the .get_direction()
> callback as GPIOLIB internals may try to use it to determine the state
> of a pin. Add it for the LPASS LPI driver.
> 
> Reported-by: Abel Vesa <abelvesa@kernel.org>
> Cc: stable@vger.kernel.org
> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # X1E CRD

Konrad


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver
  2026-01-26 14:41 ` Konrad Dybcio
@ 2026-01-26 15:54   ` Bartosz Golaszewski
  0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2026-01-26 15:54 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Bartosz Golaszewski, Bjorn Andersson, Konrad Dybcio,
	linux-arm-msm, linux-gpio, linux-kernel, Abel Vesa, stable,
	Konrad Dybcio

On Mon, Jan 26, 2026 at 3:41 PM Konrad Dybcio
<konrad.dybcio@oss.qualcomm.com> wrote:
>
> On 1/26/26 2:56 PM, Bartosz Golaszewski wrote:
> > GPIO controller driver should typically implement the .get_direction()
> > callback as GPIOLIB internals may try to use it to determine the state
> > of a pin. Add it for the LPASS LPI driver.
> >
> > Reported-by: Abel Vesa <abelvesa@kernel.org>
> > Cc: stable@vger.kernel.org
> > Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> > ---
>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # X1E CRD
>

Linus,

Just a heads-up: this is v6.19-rc8 material, as it got uncovered with
GPIO changes in rc6.

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver
  2026-01-26 13:56 [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver Bartosz Golaszewski
  2026-01-26 14:13 ` Abel Vesa
  2026-01-26 14:41 ` Konrad Dybcio
@ 2026-01-27  9:06 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2026-01-27  9:06 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bjorn Andersson, Bartosz Golaszewski, Konrad Dybcio,
	linux-arm-msm, linux-gpio, linux-kernel, Abel Vesa, stable

On Mon, Jan 26, 2026 at 2:56 PM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:

> GPIO controller driver should typically implement the .get_direction()
> callback as GPIOLIB internals may try to use it to determine the state
> of a pin. Add it for the LPASS LPI driver.
>
> Reported-by: Abel Vesa <abelvesa@kernel.org>
> Cc: stable@vger.kernel.org
> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

Patch applied for fixes! Thanks for fixing this.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-27  9:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-26 13:56 [PATCH] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver Bartosz Golaszewski
2026-01-26 14:13 ` Abel Vesa
2026-01-26 14:41 ` Konrad Dybcio
2026-01-26 15:54   ` Bartosz Golaszewski
2026-01-27  9:06 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®