Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5afb287a authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij
Browse files

gpio: dln2: Fix gpio output value in dln2_gpio_direction_output()



dln2_gpio_direction_output() ignored the state passed into it. Fix it.
Also make dln2_gpio_pin_set_out_val return int, so we can check the error value.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Tested-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
Acked-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Reviewed-by: default avatarOctavian Purdila <octavian.purdila@intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 0acb0e71
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ static int dln2_gpio_pin_get_out_val(struct dln2_gpio *dln2, unsigned int pin)
	return !!ret;
}

static void dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2,
static int dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2,
				     unsigned int pin, int value)
{
	struct dln2_gpio_pin_val req = {
@@ -148,7 +148,7 @@ static void dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2,
		.value = value,
	};

	dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req,
	return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req,
				sizeof(req));
}

@@ -266,6 +266,13 @@ static int dln2_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
				      int value)
{
	struct dln2_gpio *dln2 = container_of(chip, struct dln2_gpio, gpio);
	int ret;

	ret = dln2_gpio_pin_set_out_val(dln2, offset, value);
	if (ret < 0)
		return ret;

	return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT);
}