mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 14:45:27 +00:00
gpio: crystalcove: 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. Link: https://lore.kernel.org/r/20250310-gpiochip-set-conversion-v1-12-03798bb833eb@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
2661dc2de1
commit
96498b83b3
@ -168,18 +168,18 @@ static int crystalcove_gpio_get(struct gpio_chip *chip, unsigned int gpio)
|
||||
return val & 0x1;
|
||||
}
|
||||
|
||||
static void crystalcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
|
||||
static int crystalcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
|
||||
{
|
||||
struct crystalcove_gpio *cg = gpiochip_get_data(chip);
|
||||
int reg = to_reg(gpio, CTRL_OUT);
|
||||
|
||||
if (reg < 0)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (value)
|
||||
regmap_update_bits(cg->regmap, reg, 1, 1);
|
||||
else
|
||||
regmap_update_bits(cg->regmap, reg, 1, 0);
|
||||
return regmap_update_bits(cg->regmap, reg, 1, 1);
|
||||
|
||||
return regmap_update_bits(cg->regmap, reg, 1, 0);
|
||||
}
|
||||
|
||||
static int crystalcove_irq_type(struct irq_data *data, unsigned int type)
|
||||
@ -349,7 +349,7 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
|
||||
cg->chip.direction_input = crystalcove_gpio_dir_in;
|
||||
cg->chip.direction_output = crystalcove_gpio_dir_out;
|
||||
cg->chip.get = crystalcove_gpio_get;
|
||||
cg->chip.set = crystalcove_gpio_set;
|
||||
cg->chip.set_rv = crystalcove_gpio_set;
|
||||
cg->chip.base = -1;
|
||||
cg->chip.ngpio = CRYSTALCOVE_VGPIO_NUM;
|
||||
cg->chip.can_sleep = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user