mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
pinctrl: ocelot: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/20250408-gpiochip-set-rv-pinctrl-part1-v1-9-c9d521d7c8c7@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
88c7e0bb9e
commit
089f1cad35
1 changed files with 9 additions and 8 deletions
|
@ -1950,17 +1950,18 @@ static int ocelot_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
|||
return !!(val & BIT(offset % 32));
|
||||
}
|
||||
|
||||
static void ocelot_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
static int ocelot_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct ocelot_pinctrl *info = gpiochip_get_data(chip);
|
||||
|
||||
if (value)
|
||||
regmap_write(info->map, REG(OCELOT_GPIO_OUT_SET, info, offset),
|
||||
BIT(offset % 32));
|
||||
else
|
||||
regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, offset),
|
||||
BIT(offset % 32));
|
||||
return regmap_write(info->map,
|
||||
REG(OCELOT_GPIO_OUT_SET, info, offset),
|
||||
BIT(offset % 32));
|
||||
|
||||
return regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, offset),
|
||||
BIT(offset % 32));
|
||||
}
|
||||
|
||||
static int ocelot_gpio_get_direction(struct gpio_chip *chip,
|
||||
|
@ -1996,7 +1997,7 @@ static int ocelot_gpio_direction_output(struct gpio_chip *chip,
|
|||
static const struct gpio_chip ocelot_gpiolib_chip = {
|
||||
.request = gpiochip_generic_request,
|
||||
.free = gpiochip_generic_free,
|
||||
.set = ocelot_gpio_set,
|
||||
.set_rv = ocelot_gpio_set,
|
||||
.get = ocelot_gpio_get,
|
||||
.get_direction = ocelot_gpio_get_direction,
|
||||
.direction_input = pinctrl_gpio_direction_input,
|
||||
|
|
Loading…
Add table
Reference in a new issue