gpio: vf610: use new generic GPIO chip API
Convert the driver to using the new generic GPIO chip interfaces from linux/gpio/generic.h. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250826-gpio-mmio-gpio-conv-part2-v1-11-f67603e4b27e@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
+17
-10
@@ -10,6 +10,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/gpio/generic.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
@@ -28,7 +29,7 @@ struct fsl_gpio_soc_data {
|
||||
};
|
||||
|
||||
struct vf610_gpio_port {
|
||||
struct gpio_chip gc;
|
||||
struct gpio_generic_chip chip;
|
||||
void __iomem *base;
|
||||
void __iomem *gpio_base;
|
||||
const struct fsl_gpio_soc_data *sdata;
|
||||
@@ -108,7 +109,7 @@ static void vf610_gpio_irq_handler(struct irq_desc *desc)
|
||||
for_each_set_bit(pin, &irq_isfr, VF610_GPIO_PER_PORT) {
|
||||
vf610_gpio_writel(BIT(pin), port->base + PORT_ISFR);
|
||||
|
||||
generic_handle_domain_irq(port->gc.irq.domain, pin);
|
||||
generic_handle_domain_irq(port->chip.gc.irq.domain, pin);
|
||||
}
|
||||
|
||||
chained_irq_exit(chip, desc);
|
||||
@@ -214,6 +215,7 @@ static void vf610_gpio_disable_clk(void *data)
|
||||
|
||||
static int vf610_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_generic_chip_config config;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct vf610_gpio_port *port;
|
||||
struct gpio_chip *gc;
|
||||
@@ -293,7 +295,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
gc = &port->gc;
|
||||
gc = &port->chip.gc;
|
||||
flags = BGPIOF_PINCTRL_BACKEND;
|
||||
/*
|
||||
* We only read the output register for current value on output
|
||||
@@ -302,13 +304,18 @@ static int vf610_gpio_probe(struct platform_device *pdev)
|
||||
*/
|
||||
if (port->sdata->have_paddr)
|
||||
flags |= BGPIOF_READ_OUTPUT_REG_SET;
|
||||
ret = bgpio_init(gc, dev, 4,
|
||||
port->gpio_base + GPIO_PDIR,
|
||||
port->gpio_base + GPIO_PDOR,
|
||||
NULL,
|
||||
port->sdata->have_paddr ? port->gpio_base + GPIO_PDDR : NULL,
|
||||
NULL,
|
||||
flags);
|
||||
|
||||
config = (typeof(config)){
|
||||
.dev = dev,
|
||||
.sz = 4,
|
||||
.dat = port->gpio_base + GPIO_PDIR,
|
||||
.set = port->gpio_base + GPIO_PDOR,
|
||||
.dirout = port->sdata->have_paddr ?
|
||||
port->gpio_base + GPIO_PDDR : NULL,
|
||||
.flags = flags,
|
||||
};
|
||||
|
||||
ret = gpio_generic_chip_init(&port->chip, &config);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "unable to init generic GPIO\n");
|
||||
gc->label = dev_name(dev);
|
||||
|
||||
Reference in New Issue
Block a user