Lines Matching +full:gpio +full:- +full:reserved +full:- +full:ranges

1 // SPDX-License-Identifier: GPL-2.0-only
4 #include <linux/gpio/driver.h>
5 #include <linux/mfd/rohm-bd71828.h>
15 struct gpio_chip gpio; member
27 * we are dealing with - then we are done in bd71828_gpio_set()
32 ret = regmap_update_bits(bdgpio->chip.regmap, GPIO_OUT_REG(offset), in bd71828_gpio_set()
35 dev_err(bdgpio->chip.dev, "Could not set gpio to %d\n", value); in bd71828_gpio_set()
45 ret = regmap_read(bdgpio->chip.regmap, BD71828_REG_IO_STAT, in bd71828_gpio_get()
48 ret = regmap_read(bdgpio->chip.regmap, GPIO_OUT_REG(offset), in bd71828_gpio_get()
62 return -ENOTSUPP; in bd71828_gpio_set_config()
66 return regmap_update_bits(bdgpio->chip.regmap, in bd71828_gpio_set_config()
71 return regmap_update_bits(bdgpio->chip.regmap, in bd71828_gpio_set_config()
78 return -ENOTSUPP; in bd71828_gpio_set_config()
85 * we trust that if the pin is not excluded by "gpio-reserved-ranges" in bd71828_get_direction()
87 * on BD71828 can't really be used for general purpose input - input in bd71828_get_direction()
102 bd71828 = dev_get_drvdata(pdev->dev.parent); in bd71828_probe()
104 dev_err(&pdev->dev, "No MFD driver data\n"); in bd71828_probe()
105 return -EINVAL; in bd71828_probe()
108 bdgpio = devm_kzalloc(&pdev->dev, sizeof(*bdgpio), in bd71828_probe()
111 return -ENOMEM; in bd71828_probe()
113 bdgpio->chip.dev = &pdev->dev; in bd71828_probe()
114 bdgpio->gpio.parent = pdev->dev.parent; in bd71828_probe()
115 bdgpio->gpio.label = "bd71828-gpio"; in bd71828_probe()
116 bdgpio->gpio.owner = THIS_MODULE; in bd71828_probe()
117 bdgpio->gpio.get_direction = bd71828_get_direction; in bd71828_probe()
118 bdgpio->gpio.set_config = bd71828_gpio_set_config; in bd71828_probe()
119 bdgpio->gpio.can_sleep = true; in bd71828_probe()
120 bdgpio->gpio.get = bd71828_gpio_get; in bd71828_probe()
121 bdgpio->gpio.set = bd71828_gpio_set; in bd71828_probe()
122 bdgpio->gpio.base = -1; in bd71828_probe()
127 * "gpio-reserved-ranges" and exclude them from control in bd71828_probe()
129 bdgpio->gpio.ngpio = 4; in bd71828_probe()
130 bdgpio->gpio.of_node = pdev->dev.parent->of_node; in bd71828_probe()
131 bdgpio->chip.regmap = bd71828->regmap; in bd71828_probe()
133 return devm_gpiochip_add_data(&pdev->dev, &bdgpio->gpio, in bd71828_probe()
139 .name = "bd71828-gpio"
149 MODULE_ALIAS("platform:bd71828-gpio");