Commit 241d79f0 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Andy Shevchenko
Browse files

pinctrl: intel: 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: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 83ab731c
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -1033,7 +1033,7 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned int offset)
	return !!(padcfg0 & PADCFG0_GPIORXSTATE);
}

static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
static int intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
			  int value)
{
	struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
@@ -1043,11 +1043,11 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,

	pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
	if (pin < 0)
		return;
		return -EINVAL;

	reg = intel_get_padcfg(pctrl, pin, PADCFG0);
	if (!reg)
		return;
		return -EINVAL;

	guard(raw_spinlock_irqsave)(&pctrl->lock);

@@ -1057,6 +1057,8 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
	else
		padcfg0 &= ~PADCFG0_GPIOTXSTATE;
	writel(padcfg0, reg);

	return 0;
}

static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1094,7 +1096,12 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offse
static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
				       int value)
{
	intel_gpio_set(chip, offset, value);
	int ret;

	ret = intel_gpio_set(chip, offset, value);
	if (ret)
		return ret;

	return pinctrl_gpio_direction_output(chip, offset);
}

@@ -1106,7 +1113,7 @@ static const struct gpio_chip intel_gpio_chip = {
	.direction_input = intel_gpio_direction_input,
	.direction_output = intel_gpio_direction_output,
	.get = intel_gpio_get,
	.set = intel_gpio_set,
	.set_rv = intel_gpio_set,
	.set_config = gpiochip_generic_config,
};