Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: equilibrium: use new generic GPIO chip API

Convert the driver to using the new generic GPIO chip interfaces from
linux/gpio/generic.h.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/20250811-gpio-mmio-pinctrl-conv-v1-2-a84c5da2be20@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Bartosz Golaszewski and committed by
Linus Walleij
658cd189 4bcff9c0

+17 -11
+16 -10
drivers/pinctrl/pinctrl-equilibrium.c
··· 2 2 /* Copyright (C) 2019 Intel Corporation */ 3 3 4 4 #include <linux/gpio/driver.h> 5 + #include <linux/gpio/generic.h> 5 6 #include <linux/module.h> 6 7 #include <linux/of.h> 7 8 #include <linux/of_address.h> ··· 180 179 struct gpio_irq_chip *girq; 181 180 struct gpio_chip *gc; 182 181 183 - gc = &gctrl->chip; 182 + gc = &gctrl->chip.gc; 184 183 gc->label = gctrl->name; 185 184 gc->fwnode = gctrl->fwnode; 186 185 gc->request = gpiochip_generic_request; ··· 192 191 return 0; 193 192 } 194 193 195 - girq = &gctrl->chip.irq; 194 + girq = &gctrl->chip.gc.irq; 196 195 gpio_irq_chip_set_chip(girq, &eqbr_irq_chip); 197 196 girq->parent_handler = eqbr_irq_handler; 198 197 girq->num_parents = 1; ··· 209 208 210 209 static int gpiolib_reg(struct eqbr_pinctrl_drv_data *drvdata) 211 210 { 211 + struct gpio_generic_chip_config config; 212 212 struct device *dev = drvdata->dev; 213 213 struct eqbr_gpio_ctrl *gctrl; 214 214 struct device_node *np; ··· 241 239 } 242 240 raw_spin_lock_init(&gctrl->lock); 243 241 244 - ret = bgpio_init(&gctrl->chip, dev, gctrl->bank->nr_pins / 8, 245 - gctrl->membase + GPIO_IN, 246 - gctrl->membase + GPIO_OUTSET, 247 - gctrl->membase + GPIO_OUTCLR, 248 - gctrl->membase + GPIO_DIR, 249 - NULL, 0); 242 + config = (typeof(config)){ 243 + .dev = dev, 244 + .sz = gctrl->bank->nr_pins / 8, 245 + .dat = gctrl->membase + GPIO_IN, 246 + .set = gctrl->membase + GPIO_OUTSET, 247 + .clr = gctrl->membase + GPIO_OUTCLR, 248 + .dirout = gctrl->membase + GPIO_DIR, 249 + }; 250 + 251 + ret = gpio_generic_chip_init(&gctrl->chip, &config); 250 252 if (ret) { 251 253 dev_err(dev, "unable to init generic GPIO\n"); 252 254 return ret; ··· 260 254 if (ret) 261 255 return ret; 262 256 263 - ret = devm_gpiochip_add_data(dev, &gctrl->chip, gctrl); 257 + ret = devm_gpiochip_add_data(dev, &gctrl->chip.gc, gctrl); 264 258 if (ret) 265 259 return ret; 266 260 } ··· 505 499 bank->pin_base, pin); 506 500 return -ENODEV; 507 501 } 508 - gc = &gctrl->chip; 502 + gc = &gctrl->chip.gc; 509 503 gc->direction_output(gc, offset, 0); 510 504 continue; 511 505 default:
+1 -1
drivers/pinctrl/pinctrl-equilibrium.h
··· 96 96 * @lock: spin lock to protect gpio register write. 97 97 */ 98 98 struct eqbr_gpio_ctrl { 99 - struct gpio_chip chip; 99 + struct gpio_generic_chip chip; 100 100 struct fwnode_handle *fwnode; 101 101 struct eqbr_pin_bank *bank; 102 102 void __iomem *membase;