Lines Matching +full:gpio +full:- +full:config

1 // SPDX-License-Identifier: GPL-2.0-only
3 * sl28cpld GPIO driver
9 #include <linux/gpio/driver.h>
10 #include <linux/gpio/regmap.h>
18 /* GPIO flavor */
25 /* input-only flavor */
28 /* output-only flavor */
50 struct gpio_regmap_config *config) in sl28cpld_gpio_irq_init() argument
54 struct device *dev = &pdev->dev; in sl28cpld_gpio_irq_init()
57 if (!device_property_read_bool(dev, "interrupt-controller")) in sl28cpld_gpio_irq_init()
66 return -ENOMEM; in sl28cpld_gpio_irq_init()
68 irq_chip->name = "sl28cpld-gpio-irq"; in sl28cpld_gpio_irq_init()
69 irq_chip->irqs = sl28cpld_gpio_irqs; in sl28cpld_gpio_irq_init()
70 irq_chip->num_irqs = ARRAY_SIZE(sl28cpld_gpio_irqs); in sl28cpld_gpio_irq_init()
71 irq_chip->num_regs = 1; in sl28cpld_gpio_irq_init()
72 irq_chip->status_base = base + GPIO_REG_IP; in sl28cpld_gpio_irq_init()
73 irq_chip->mask_base = base + GPIO_REG_IE; in sl28cpld_gpio_irq_init()
74 irq_chip->mask_invert = true; in sl28cpld_gpio_irq_init()
75 irq_chip->ack_base = base + GPIO_REG_IP; in sl28cpld_gpio_irq_init()
78 config->regmap, irq, in sl28cpld_gpio_irq_init()
84 config->irq_domain = regmap_irq_get_domain(irq_data); in sl28cpld_gpio_irq_init()
91 struct gpio_regmap_config config = {0}; in sl28cpld_gpio_probe() local
97 if (!pdev->dev.parent) in sl28cpld_gpio_probe()
98 return -ENODEV; in sl28cpld_gpio_probe()
100 type = (uintptr_t)device_get_match_data(&pdev->dev); in sl28cpld_gpio_probe()
102 return -ENODEV; in sl28cpld_gpio_probe()
104 ret = device_property_read_u32(&pdev->dev, "reg", &base); in sl28cpld_gpio_probe()
106 return -EINVAL; in sl28cpld_gpio_probe()
108 regmap = dev_get_regmap(pdev->dev.parent, NULL); in sl28cpld_gpio_probe()
110 return -ENODEV; in sl28cpld_gpio_probe()
112 config.regmap = regmap; in sl28cpld_gpio_probe()
113 config.parent = &pdev->dev; in sl28cpld_gpio_probe()
114 config.ngpio = 8; in sl28cpld_gpio_probe()
118 config.reg_dat_base = base + GPIO_REG_IN; in sl28cpld_gpio_probe()
119 config.reg_set_base = base + GPIO_REG_OUT; in sl28cpld_gpio_probe()
121 config.reg_dir_out_base = GPIO_REGMAP_ADDR(base + GPIO_REG_DIR); in sl28cpld_gpio_probe()
124 ret = sl28cpld_gpio_irq_init(pdev, base, &config); in sl28cpld_gpio_probe()
129 config.reg_set_base = base + GPO_REG_OUT; in sl28cpld_gpio_probe()
132 config.reg_dat_base = base + GPI_REG_IN; in sl28cpld_gpio_probe()
135 dev_err(&pdev->dev, "unknown type %d\n", type); in sl28cpld_gpio_probe()
136 return -ENODEV; in sl28cpld_gpio_probe()
139 return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(&pdev->dev, &config)); in sl28cpld_gpio_probe()
143 { .compatible = "kontron,sl28cpld-gpio", .data = (void *)SL28CPLD_GPIO },
144 { .compatible = "kontron,sl28cpld-gpi", .data = (void *)SL28CPLD_GPI },
145 { .compatible = "kontron,sl28cpld-gpo", .data = (void *)SL28CPLD_GPO },
153 .name = "sl28cpld-gpio",
159 MODULE_DESCRIPTION("sl28cpld GPIO Driver");