mirror of
https://github.com/torvalds/linux.git
synced 2026-03-14 00:56:20 +01:00
pinctrl: spear: 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/20250612-gpiochip-set-rv-pinctrl-remaining-v1-12-556b0a530cd4@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
dfdbce9649
commit
d9727b4851
1 changed files with 7 additions and 4 deletions
|
|
@ -181,24 +181,27 @@ static int plgpio_get_value(struct gpio_chip *chip, unsigned offset)
|
|||
return is_plgpio_set(plgpio->regmap, offset, plgpio->regs.rdata);
|
||||
}
|
||||
|
||||
static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
|
||||
static int plgpio_set_value(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct plgpio *plgpio = gpiochip_get_data(chip);
|
||||
|
||||
if (offset >= chip->ngpio)
|
||||
return;
|
||||
return -EINVAL;
|
||||
|
||||
/* get correct offset for "offset" pin */
|
||||
if (plgpio->p2o && (plgpio->p2o_regs & PTO_WDATA_REG)) {
|
||||
offset = plgpio->p2o(offset);
|
||||
if (offset == -1)
|
||||
return;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (value)
|
||||
plgpio_reg_set(plgpio->regmap, offset, plgpio->regs.wdata);
|
||||
else
|
||||
plgpio_reg_reset(plgpio->regmap, offset, plgpio->regs.wdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int plgpio_request(struct gpio_chip *chip, unsigned offset)
|
||||
|
|
@ -579,7 +582,7 @@ static int plgpio_probe(struct platform_device *pdev)
|
|||
plgpio->chip.direction_input = plgpio_direction_input;
|
||||
plgpio->chip.direction_output = plgpio_direction_output;
|
||||
plgpio->chip.get = plgpio_get_value;
|
||||
plgpio->chip.set = plgpio_set_value;
|
||||
plgpio->chip.set_rv = plgpio_set_value;
|
||||
plgpio->chip.label = dev_name(&pdev->dev);
|
||||
plgpio->chip.parent = &pdev->dev;
|
||||
plgpio->chip.owner = THIS_MODULE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue