gpio: sodaville: use new generic GPIO chip API
Convert the driver to using the new generic GPIO chip interfaces from linux/gpio/generic.h. Reviewed-by: Andy Shevchenko <andy@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250910-gpio-mmio-gpio-conv-part4-v2-13-f3d1a4c57124@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
063411108d
commit
ae9a52990b
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/gpio/generic.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -39,7 +40,7 @@ struct sdv_gpio_chip_data {
|
|||
void __iomem *gpio_pub_base;
|
||||
struct irq_domain *id;
|
||||
struct irq_chip_generic *gc;
|
||||
struct gpio_chip chip;
|
||||
struct gpio_generic_chip gen_gc;
|
||||
};
|
||||
|
||||
static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type)
|
||||
|
@ -180,6 +181,7 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
|
|||
static int sdv_gpio_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *pci_id)
|
||||
{
|
||||
struct gpio_generic_chip_config config;
|
||||
struct sdv_gpio_chip_data *sd;
|
||||
int ret;
|
||||
u32 mux_val;
|
||||
|
@ -206,15 +208,21 @@ static int sdv_gpio_probe(struct pci_dev *pdev,
|
|||
if (!ret)
|
||||
writel(mux_val, sd->gpio_pub_base + GPMUXCTL);
|
||||
|
||||
ret = bgpio_init(&sd->chip, &pdev->dev, 4,
|
||||
sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR,
|
||||
NULL, sd->gpio_pub_base + GPOER, NULL, 0);
|
||||
config = (struct gpio_generic_chip_config) {
|
||||
.dev = &pdev->dev,
|
||||
.sz = 4,
|
||||
.dat = sd->gpio_pub_base + GPINR,
|
||||
.set = sd->gpio_pub_base + GPOUTR,
|
||||
.dirout = sd->gpio_pub_base + GPOER,
|
||||
};
|
||||
|
||||
ret = gpio_generic_chip_init(&sd->gen_gc, &config);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
sd->chip.ngpio = SDV_NUM_PUB_GPIOS;
|
||||
sd->gen_gc.gc.ngpio = SDV_NUM_PUB_GPIOS;
|
||||
|
||||
ret = devm_gpiochip_add_data(&pdev->dev, &sd->chip, sd);
|
||||
ret = devm_gpiochip_add_data(&pdev->dev, &sd->gen_gc.gc, sd);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "gpiochip_add() failed.\n");
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue