mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 10:41:49 +02:00
pinctrl: cirrus: cs42l43: 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> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/20250612-gpiochip-set-rv-pinctrl-cirrus-v1-2-2d45c1f92557@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
76ba1bb25c
commit
e52c741907
|
|
@ -483,7 +483,8 @@ static int cs42l43_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
|
static int cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||||
|
int value)
|
||||||
{
|
{
|
||||||
struct cs42l43_pin *priv = gpiochip_get_data(chip);
|
struct cs42l43_pin *priv = gpiochip_get_data(chip);
|
||||||
unsigned int shift = offset + CS42L43_GPIO1_LVL_SHIFT;
|
unsigned int shift = offset + CS42L43_GPIO1_LVL_SHIFT;
|
||||||
|
|
@ -493,23 +494,27 @@ static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
|
||||||
offset + 1, str_high_low(value));
|
offset + 1, str_high_low(value));
|
||||||
|
|
||||||
ret = pm_runtime_resume_and_get(priv->dev);
|
ret = pm_runtime_resume_and_get(priv->dev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
dev_err(priv->dev, "Failed to resume for set: %d\n", ret);
|
return ret;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL1,
|
ret = regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL1,
|
||||||
BIT(shift), value << shift);
|
BIT(shift), value << shift);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(priv->dev, "Failed to set gpio%d: %d\n", offset + 1, ret);
|
return ret;
|
||||||
|
|
||||||
pm_runtime_put(priv->dev);
|
pm_runtime_put(priv->dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
|
static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
|
||||||
unsigned int offset, int value)
|
unsigned int offset, int value)
|
||||||
{
|
{
|
||||||
cs42l43_gpio_set(chip, offset, value);
|
int ret;
|
||||||
|
|
||||||
|
ret = cs42l43_gpio_set(chip, offset, value);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
return pinctrl_gpio_direction_output(chip, offset);
|
return pinctrl_gpio_direction_output(chip, offset);
|
||||||
}
|
}
|
||||||
|
|
@ -550,7 +555,7 @@ static int cs42l43_pin_probe(struct platform_device *pdev)
|
||||||
priv->gpio_chip.direction_output = cs42l43_gpio_direction_out;
|
priv->gpio_chip.direction_output = cs42l43_gpio_direction_out;
|
||||||
priv->gpio_chip.add_pin_ranges = cs42l43_gpio_add_pin_ranges;
|
priv->gpio_chip.add_pin_ranges = cs42l43_gpio_add_pin_ranges;
|
||||||
priv->gpio_chip.get = cs42l43_gpio_get;
|
priv->gpio_chip.get = cs42l43_gpio_get;
|
||||||
priv->gpio_chip.set = cs42l43_gpio_set;
|
priv->gpio_chip.set_rv = cs42l43_gpio_set;
|
||||||
priv->gpio_chip.label = dev_name(priv->dev);
|
priv->gpio_chip.label = dev_name(priv->dev);
|
||||||
priv->gpio_chip.parent = priv->dev;
|
priv->gpio_chip.parent = priv->dev;
|
||||||
priv->gpio_chip.can_sleep = true;
|
priv->gpio_chip.can_sleep = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user