All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput
@ 2014-02-10 15:03 Jean-Jacques Hiblot
  2014-02-10 15:27 ` Richard Genoud
  2014-02-11  4:22 ` Alexandre Courbot
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Jacques Hiblot @ 2014-02-10 15:03 UTC (permalink / raw)
  To: linus.walleij, gnurou
  Cc: linux-gpio, richard.genoud, linux-kernel, Jean-Jacques Hiblot

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput
  2014-02-10 15:03 [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput Jean-Jacques Hiblot
@ 2014-02-10 15:27 ` Richard Genoud
  2014-02-11  4:22 ` Alexandre Courbot
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Genoud @ 2014-02-10 15:27 UTC (permalink / raw)
  To: Jean-Jacques Hiblot; +Cc: Linus Walleij, gnurou, linux-gpio, linux-kernel

2014-02-10 16:03 GMT+01:00 Jean-Jacques Hiblot <jjhiblot@traphandler.com>:
> 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
>
Tested-by: Richard Genoud <richard.genoud@gmail.com>

I was just missing that for my gpio modem lines !
Thanks !

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput
  2014-02-10 15:03 [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput Jean-Jacques Hiblot
  2014-02-10 15:27 ` Richard Genoud
@ 2014-02-11  4:22 ` Alexandre Courbot
  2014-02-11  8:06   ` Jean-Jacques Hiblot
  2014-02-12 16:20   ` Linus Walleij
  1 sibling, 2 replies; 5+ messages in thread
From: Alexandre Courbot @ 2014-02-11  4:22 UTC (permalink / raw)
  To: Jean-Jacques Hiblot, Linus Walleij
  Cc: linux-gpio, richard.genoud, Linux Kernel Mailing List

On Tue, Feb 11, 2014 at 12:03 AM, Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> 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.

I think we have a patch that already does this:

http://www.kernelhub.org/?msg=390263&p=2

Linus said it would be merged for 3.15, but I am not seeing it in -next. Linus?

>
> 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput
  2014-02-11  4:22 ` Alexandre Courbot
@ 2014-02-11  8:06   ` Jean-Jacques Hiblot
  2014-02-12 16:20   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Jacques Hiblot @ 2014-02-11  8:06 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Jean-Jacques Hiblot, Linus Walleij, linux-gpio, Richard Genoud,
	Linux Kernel Mailing List

Hi Alexandre,

I somehow missed this one. Forget about my patch then.

Jean-Jacques

2014-02-11 5:22 GMT+01:00 Alexandre Courbot <gnurou@gmail.com>:
> On Tue, Feb 11, 2014 at 12:03 AM, Jean-Jacques Hiblot
> <jjhiblot@traphandler.com> wrote:
>> 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.
>
> I think we have a patch that already does this:
>
> http://www.kernelhub.org/?msg=390263&p=2
>
> Linus said it would be merged for 3.15, but I am not seeing it in -next. Linus?
>
>>
>> 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
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput
  2014-02-11  4:22 ` Alexandre Courbot
  2014-02-11  8:06   ` Jean-Jacques Hiblot
@ 2014-02-12 16:20   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2014-02-12 16:20 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Jean-Jacques Hiblot, linux-gpio, Richard Genoud,
	Linux Kernel Mailing List

On Tue, Feb 11, 2014 at 5:22 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
> On Tue, Feb 11, 2014 at 12:03 AM, Jean-Jacques Hiblot
> <jjhiblot@traphandler.com> wrote:
>> 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.
>
> I think we have a patch that already does this:
>
> http://www.kernelhub.org/?msg=390263&p=2
>
> Linus said it would be merged for 3.15, but I am not seeing it in -next. Linus?

I just haven't queued my devel branch for next yet. Will do
today now that I sent a batch of fixes to Torvalds.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-12 16:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-10 15:03 [PATCH] gpio: take in account the active low flag when configuring the gpio as an ouput Jean-Jacques Hiblot
2014-02-10 15:27 ` Richard Genoud
2014-02-11  4:22 ` Alexandre Courbot
2014-02-11  8:06   ` Jean-Jacques Hiblot
2014-02-12 16:20   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.