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

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
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment