pinctrl: mediatek: common: 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/20250425-gpiochip-set-rv-pinctrl-mediatek-v1-5-93e6a01855e7@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Bartosz Golaszewski
2025-04-25 11:01:01 +02:00
committed by Linus Walleij
parent 8a3f17df00
commit 23a5fa371c

View File

@@ -86,7 +86,7 @@ static int mtk_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
return 0;
}
static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int mtk_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
unsigned int reg_addr;
unsigned int bit;
@@ -100,7 +100,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
else
reg_addr = CLR_ADDR(reg_addr, pctl);
regmap_write(mtk_get_regmap(pctl, offset), reg_addr, bit);
return regmap_write(mtk_get_regmap(pctl, offset), reg_addr, bit);
}
static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin,
@@ -809,7 +809,12 @@ static const struct pinmux_ops mtk_pmx_ops = {
static int mtk_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
mtk_gpio_set(chip, offset, value);
int ret;
ret = mtk_gpio_set(chip, offset, value);
if (ret)
return ret;
return pinctrl_gpio_direction_output(chip, offset);
}
@@ -893,7 +898,7 @@ static const struct gpio_chip mtk_gpio_chip = {
.direction_input = pinctrl_gpio_direction_input,
.direction_output = mtk_gpio_direction_output,
.get = mtk_gpio_get,
.set = mtk_gpio_set,
.set_rv = mtk_gpio_set,
.to_irq = mtk_gpio_to_irq,
.set_config = mtk_gpio_set_config,
};