mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
gpio: ge: 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/20250825-gpio-mmio-gpio-conv-v1-14-356b4b1d5110@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
90ab705035
commit
56f548840e
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/gpio/generic.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
|
|
@ -51,24 +52,36 @@ MODULE_DEVICE_TABLE(of, gef_gpio_ids);
|
|||
|
||||
static int __init gef_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_generic_chip_config config;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct gpio_generic_chip *chip;
|
||||
struct gpio_chip *gc;
|
||||
void __iomem *regs;
|
||||
int ret;
|
||||
|
||||
gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
|
||||
if (!gc)
|
||||
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
|
||||
if (!chip)
|
||||
return -ENOMEM;
|
||||
|
||||
regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(regs))
|
||||
return PTR_ERR(regs);
|
||||
|
||||
ret = bgpio_init(gc, dev, 4, regs + GEF_GPIO_IN, regs + GEF_GPIO_OUT,
|
||||
NULL, NULL, regs + GEF_GPIO_DIRECT,
|
||||
BGPIOF_BIG_ENDIAN_BYTE_ORDER);
|
||||
config = (typeof(config)){
|
||||
.dev = dev,
|
||||
.sz = 4,
|
||||
.dat = regs + GEF_GPIO_IN,
|
||||
.set = regs + GEF_GPIO_OUT,
|
||||
.dirin = regs + GEF_GPIO_DIRECT,
|
||||
.flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER,
|
||||
};
|
||||
|
||||
ret = gpio_generic_chip_init(chip, &config);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "bgpio_init failed\n");
|
||||
return dev_err_probe(dev, ret,
|
||||
"failed to initialize the generic GPIO chip\n");
|
||||
|
||||
gc = &chip->gc;
|
||||
|
||||
/* Setup pointers to chip functions */
|
||||
gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", dev_fwnode(dev));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user