* [PATCH] GPIOD: fix gpiod_direction_output initial value
@ 2014-04-29 12:27 Robert ABEL
2014-05-01 6:28 ` Alexandre Courbot
0 siblings, 1 reply; 3+ messages in thread
From: Robert ABEL @ 2014-04-29 12:27 UTC (permalink / raw)
To: linux-gpio; +Cc: linus.walleij, Robert ABEL
gpiod_direction_output initial value was used as raw value instead of
logical value. Convert value from logical to raw.
Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
---
drivers/gpio/gpiolib.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f48817d..2309322 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2032,6 +2032,10 @@ static int _gpiod_direction_output_raw(struct gpio_desc *desc, int value)
return -EIO;
}
+ /* convert logical value to raw value */
+ if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
+ value = !value;
+
/* Open drain pin should not be driven to 1 */
if (value && test_bit(FLAG_OPEN_DRAIN, &desc->flags))
return gpiod_direction_input(desc);
--
1.9.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] GPIOD: fix gpiod_direction_output initial value
2014-04-29 12:27 [PATCH] GPIOD: fix gpiod_direction_output initial value Robert ABEL
@ 2014-05-01 6:28 ` Alexandre Courbot
2014-05-05 9:31 ` Robert Abel
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Courbot @ 2014-05-01 6:28 UTC (permalink / raw)
To: Robert ABEL; +Cc: linux-gpio@vger.kernel.org, Linus Walleij
On Tue, Apr 29, 2014 at 9:27 PM, Robert ABEL
<rabel@cit-ec.uni-bielefeld.de> wrote:
> gpiod_direction_output initial value was used as raw value instead of
> logical value. Convert value from logical to raw.
Nope, the very point of gpiod_direction_output_raw() is that we don't
want to alter the signal according to the active_low property. What
your change effectively does is changing gpiod_direction_output_raw()
into gpiod_direction_output() (look at the latter).
>
> Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
> ---
> drivers/gpio/gpiolib.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index f48817d..2309322 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -2032,6 +2032,10 @@ static int _gpiod_direction_output_raw(struct gpio_desc *desc, int value)
> return -EIO;
> }
>
> + /* convert logical value to raw value */
> + if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
> + value = !value;
> +
> /* Open drain pin should not be driven to 1 */
> if (value && test_bit(FLAG_OPEN_DRAIN, &desc->flags))
> return gpiod_direction_input(desc);
> --
> 1.9.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-05 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-29 12:27 [PATCH] GPIOD: fix gpiod_direction_output initial value Robert ABEL
2014-05-01 6:28 ` Alexandre Courbot
2014-05-05 9:31 ` Robert Abel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).