* [PATCH] soc: fsl: qe: implement get_direction()
@ 2026-07-30 10:09 Christophe Leroy (CS GROUP)
2026-07-30 11:54 ` Bartosz Golaszewski
2026-08-03 13:05 ` Christophe Leroy (CS GROUP)
0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-07-30 10:09 UTC (permalink / raw)
To: RAGUENES Jean Noel, Qiang Zhao, Christophe Leroy (CS GROUP)
Cc: Linus Walleij, Bartosz Golaszewski, linuxppc-dev,
linux-arm-kernel, linux-kernel, linux-gpio
The lack of get_direction() callback in this driver causes GPIOLIB to
emit a warning. Implement it.
Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
drivers/soc/fsl/qe/gpio.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c
index 66828f2a3577..6d8f4d549fe2 100644
--- a/drivers/soc/fsl/qe/gpio.c
+++ b/drivers/soc/fsl/qe/gpio.c
@@ -135,6 +135,30 @@ static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
return 0;
}
+static int qe_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
+{
+ struct qe_gpio_chip *qe_gc = gpiochip_get_data(gc);
+ struct qe_pio_regs __iomem *regs = qe_gc->regs;
+ unsigned long flags;
+ u32 val, mask;
+
+ spin_lock_irqsave(&qe_gc->lock, flags);
+
+ if (gpio < QE_PIO_PINS / 2)
+ val = ioread32be(®s->cpdir1);
+ else
+ val = ioread32be(®s->cpdir2);
+
+ spin_unlock_irqrestore(&qe_gc->lock, flags);
+
+ mask = (u32)QE_PIO_DIR_OUT << (QE_PIO_PINS - 2 - (gpio % (QE_PIO_PINS / 2)) * 2);
+
+ if (val & mask)
+ return GPIO_LINE_DIRECTION_OUT;
+ else
+ return GPIO_LINE_DIRECTION_IN;
+}
+
struct qe_pin {
/*
* The qe_gpio_chip name is unfortunate, we should change that to
@@ -308,6 +332,7 @@ static int qe_gpio_probe(struct platform_device *ofdev)
gc->ngpio = QE_PIO_PINS;
gc->direction_input = qe_gpio_dir_in;
gc->direction_output = qe_gpio_dir_out;
+ gc->get_direction = qe_gpio_get_direction;
gc->get = qe_gpio_get;
gc->set = qe_gpio_set;
gc->set_multiple = qe_gpio_set_multiple;
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: fsl: qe: implement get_direction()
2026-07-30 10:09 [PATCH] soc: fsl: qe: implement get_direction() Christophe Leroy (CS GROUP)
@ 2026-07-30 11:54 ` Bartosz Golaszewski
2026-08-03 13:05 ` Christophe Leroy (CS GROUP)
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2026-07-30 11:54 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP)
Cc: Linus Walleij, Bartosz Golaszewski, linuxppc-dev,
linux-arm-kernel, linux-kernel, linux-gpio, RAGUENES Jean Noel,
Qiang Zhao
On Thu, 30 Jul 2026 12:09:40 +0200, "Christophe Leroy (CS GROUP)"
<chleroy@kernel.org> said:
> The lack of get_direction() callback in this driver causes GPIOLIB to
> emit a warning. Implement it.
>
> Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: fsl: qe: implement get_direction()
2026-07-30 10:09 [PATCH] soc: fsl: qe: implement get_direction() Christophe Leroy (CS GROUP)
2026-07-30 11:54 ` Bartosz Golaszewski
@ 2026-08-03 13:05 ` Christophe Leroy (CS GROUP)
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-08-03 13:05 UTC (permalink / raw)
To: RAGUENES Jean Noel, Qiang Zhao, Christophe Leroy (CS GROUP)
Cc: Linus Walleij, Bartosz Golaszewski, linuxppc-dev,
linux-arm-kernel, linux-kernel, linux-gpio
On Thu, 30 Jul 2026 12:09:40 +0200, Christophe Leroy (CS GROUP) wrote:
> The lack of get_direction() callback in this driver causes GPIOLIB to
> emit a warning. Implement it.
>
>
Applied, thanks!
[1/1] soc: fsl: qe: implement get_direction()
commit: e460ef309f44b39480209970f1dd462f051d6f30
Best regards,
--
Christophe Leroy (CS GROUP) <chleroy@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-03 13:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 10:09 [PATCH] soc: fsl: qe: implement get_direction() Christophe Leroy (CS GROUP)
2026-07-30 11:54 ` Bartosz Golaszewski
2026-08-03 13:05 ` Christophe Leroy (CS GROUP)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox