mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
gpio: logicvc: use new 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. Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-9-b22245cde81a@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
722332f58a
commit
ba2ce44332
|
|
@ -61,23 +61,22 @@ static int logicvc_gpio_get(struct gpio_chip *chip, unsigned offset)
|
|||
return !!(value & bit);
|
||||
}
|
||||
|
||||
static void logicvc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
static int logicvc_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct logicvc_gpio *logicvc = gpiochip_get_data(chip);
|
||||
unsigned int reg, bit;
|
||||
|
||||
logicvc_gpio_offset(logicvc, offset, ®, &bit);
|
||||
|
||||
regmap_update_bits(logicvc->regmap, reg, bit, value ? bit : 0);
|
||||
return regmap_update_bits(logicvc->regmap, reg, bit, value ? bit : 0);
|
||||
}
|
||||
|
||||
static int logicvc_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
/* Pins are always configured as output, so just set the value. */
|
||||
logicvc_gpio_set(chip, offset, value);
|
||||
|
||||
return 0;
|
||||
return logicvc_gpio_set(chip, offset, value);
|
||||
}
|
||||
|
||||
static struct regmap_config logicvc_gpio_regmap_config = {
|
||||
|
|
@ -135,7 +134,7 @@ static int logicvc_gpio_probe(struct platform_device *pdev)
|
|||
logicvc->chip.ngpio = LOGICVC_CTRL_GPIO_BITS +
|
||||
LOGICVC_POWER_CTRL_GPIO_BITS;
|
||||
logicvc->chip.get = logicvc_gpio_get;
|
||||
logicvc->chip.set = logicvc_gpio_set;
|
||||
logicvc->chip.set_rv = logicvc_gpio_set;
|
||||
logicvc->chip.direction_output = logicvc_gpio_direction_output;
|
||||
|
||||
return devm_gpiochip_add_data(dev, &logicvc->chip, logicvc);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user