lkml.org 
[lkml]   [2014]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput
Date
The initial value of the gpio is passed to gpiod_direction_output. Currently
this value is the raw value of the GPIO line, but it should be the logical
value.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
drivers/gpio/gpiolib.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4e10b10..111a1f1 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1751,6 +1751,9 @@ int gpiod_direction_output(struct gpio_desc *desc, int value)
return -EINVAL;
}

+ if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
+ value = !value;
+
/* GPIOs used for IRQs shall not be set as output */
if (test_bit(FLAG_USED_AS_IRQ, &desc->flags)) {
gpiod_err(desc,
--
1.8.5.3


\
 
 \ /
  Last update: 2014-02-10 16:41    [W:0.071 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site