mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
pinctrl: rk805: 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-2-c9d521d7c8c7@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
d843a42635
commit
9e8c4a2e4c
1 changed files with 13 additions and 13 deletions
|
@ -325,26 +325,26 @@ static int rk805_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
|||
return !!(val & pci->pin_cfg[offset].val_msk);
|
||||
}
|
||||
|
||||
static void rk805_gpio_set(struct gpio_chip *chip,
|
||||
unsigned int offset,
|
||||
int value)
|
||||
static int rk805_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct rk805_pctrl_info *pci = gpiochip_get_data(chip);
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(pci->rk808->regmap,
|
||||
pci->pin_cfg[offset].reg,
|
||||
pci->pin_cfg[offset].val_msk,
|
||||
value ? pci->pin_cfg[offset].val_msk : 0);
|
||||
if (ret)
|
||||
dev_err(pci->dev, "set gpio%d value %d failed\n",
|
||||
offset, value);
|
||||
return regmap_update_bits(pci->rk808->regmap,
|
||||
pci->pin_cfg[offset].reg,
|
||||
pci->pin_cfg[offset].val_msk,
|
||||
value ? pci->pin_cfg[offset].val_msk : 0);
|
||||
}
|
||||
|
||||
static int rk805_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned int offset, int value)
|
||||
{
|
||||
rk805_gpio_set(chip, offset, value);
|
||||
int ret;
|
||||
|
||||
ret = rk805_gpio_set(chip, offset, value);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return pinctrl_gpio_direction_output(chip, offset);
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ static const struct gpio_chip rk805_gpio_chip = {
|
|||
.free = gpiochip_generic_free,
|
||||
.get_direction = rk805_gpio_get_direction,
|
||||
.get = rk805_gpio_get,
|
||||
.set = rk805_gpio_set,
|
||||
.set_rv = rk805_gpio_set,
|
||||
.direction_input = pinctrl_gpio_direction_input,
|
||||
.direction_output = rk805_gpio_direction_output,
|
||||
.can_sleep = true,
|
||||
|
|
Loading…
Add table
Reference in a new issue