mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-15 17:56:26 -05:00
pinctrl: wmt: 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-5-556b0a530cd4@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
committed by
Linus Walleij
parent
8766f8e7f1
commit
a23b8eab75
@@ -507,8 +507,8 @@ static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset)
|
||||
return !!(readl_relaxed(data->base + reg_data_in) & BIT(bit));
|
||||
}
|
||||
|
||||
static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset,
|
||||
int val)
|
||||
static int wmt_gpio_set_value(struct gpio_chip *chip, unsigned int offset,
|
||||
int val)
|
||||
{
|
||||
struct wmt_pinctrl_data *data = gpiochip_get_data(chip);
|
||||
u32 bank = WMT_BANK_FROM_PIN(offset);
|
||||
@@ -517,19 +517,26 @@ static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset,
|
||||
|
||||
if (reg_data_out == NO_REG) {
|
||||
dev_err(data->dev, "no data out register defined\n");
|
||||
return;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (val)
|
||||
wmt_setbits(data, reg_data_out, BIT(bit));
|
||||
else
|
||||
wmt_clearbits(data, reg_data_out, BIT(bit));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
|
||||
int value)
|
||||
{
|
||||
wmt_gpio_set_value(chip, offset, value);
|
||||
int ret;
|
||||
|
||||
ret = wmt_gpio_set_value(chip, offset, value);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return pinctrl_gpio_direction_output(chip, offset);
|
||||
}
|
||||
|
||||
@@ -542,7 +549,7 @@ static const struct gpio_chip wmt_gpio_chip = {
|
||||
.direction_input = pinctrl_gpio_direction_input,
|
||||
.direction_output = wmt_gpio_direction_output,
|
||||
.get = wmt_gpio_get_value,
|
||||
.set = wmt_gpio_set_value,
|
||||
.set_rv = wmt_gpio_set_value,
|
||||
.can_sleep = false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user