* [PATCH] gpio: max77620: Implement .get_direction() callback
@ 2026-01-27 18:52 Diogo Ivo
2026-01-28 7:51 ` Linus Walleij
2026-01-28 9:14 ` Bartosz Golaszewski
0 siblings, 2 replies; 3+ messages in thread
From: Diogo Ivo @ 2026-01-27 18:52 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel, Diogo Ivo
Add support for reporting the current GPIO line direction by implementing
the .get_direction() callback for the MAX77620 GPIO controller.
Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
drivers/gpio/gpio-max77620.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 02eca400b307..e6c85411c695 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -132,6 +132,24 @@ static const struct irq_chip max77620_gpio_irqchip = {
GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
+static int max77620_gpio_get_dir(struct gpio_chip *gc, unsigned int offset)
+{
+ struct max77620_gpio *mgpio = gpiochip_get_data(gc);
+ unsigned int val;
+ int ret;
+
+ ret = regmap_read(mgpio->rmap, GPIO_REG_ADDR(offset), &val);
+ if (ret < 0) {
+ dev_err(mgpio->dev, "CNFG_GPIOx read failed: %d\n", ret);
+ return ret;
+ }
+
+ if (val & MAX77620_CNFG_GPIO_DIR_MASK)
+ return GPIO_LINE_DIRECTION_IN;
+ else
+ return GPIO_LINE_DIRECTION_OUT;
+}
+
static int max77620_gpio_dir_input(struct gpio_chip *gc, unsigned int offset)
{
struct max77620_gpio *mgpio = gpiochip_get_data(gc);
@@ -308,6 +326,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
mgpio->gpio_chip.label = pdev->name;
mgpio->gpio_chip.parent = pdev->dev.parent;
+ mgpio->gpio_chip.get_direction = max77620_gpio_get_dir;
mgpio->gpio_chip.direction_input = max77620_gpio_dir_input;
mgpio->gpio_chip.get = max77620_gpio_get;
mgpio->gpio_chip.direction_output = max77620_gpio_dir_output;
---
base-commit: de1901b57167aa8fa28cfe99d4c9cb181bad47d3
change-id: 20260127-smaug-spi_flash-4d3bd65cc74d
Best regards,
--
Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] gpio: max77620: Implement .get_direction() callback
2026-01-27 18:52 [PATCH] gpio: max77620: Implement .get_direction() callback Diogo Ivo
@ 2026-01-28 7:51 ` Linus Walleij
2026-01-28 9:14 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2026-01-28 7:51 UTC (permalink / raw)
To: Diogo Ivo; +Cc: Bartosz Golaszewski, linux-gpio, linux-kernel
On Tue, Jan 27, 2026 at 7:53 PM Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt> wrote:
> Add support for reporting the current GPIO line direction by implementing
> the .get_direction() callback for the MAX77620 GPIO controller.
>
> Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Looks good:
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: max77620: Implement .get_direction() callback
2026-01-27 18:52 [PATCH] gpio: max77620: Implement .get_direction() callback Diogo Ivo
2026-01-28 7:51 ` Linus Walleij
@ 2026-01-28 9:14 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2026-01-28 9:14 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Diogo Ivo
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel
On Tue, 27 Jan 2026 18:52:42 +0000, Diogo Ivo wrote:
> Add support for reporting the current GPIO line direction by implementing
> the .get_direction() callback for the MAX77620 GPIO controller.
>
>
Applied, thanks!
[1/1] gpio: max77620: Implement .get_direction() callback
https://git.kernel.org/brgl/c/4c4ff6e38768f2431ed153f110f2d1fcce848af8
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-28 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-27 18:52 [PATCH] gpio: max77620: Implement .get_direction() callback Diogo Ivo
2026-01-28 7:51 ` Linus Walleij
2026-01-28 9:14 ` Bartosz Golaszewski
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®