Re: [RFC PATCH] gpio: use "output-active" and "output-inactive" for gpio-hogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sun, Jun 04, 2017 at 12:10:49PM +0200, Uwe Kleine-König wrote:
> Using the following gpio hog:
> 
> 	{
> 		gpio-hog;
> 		gpios = <17 GPIO_ACTIVE_LOW>;
> 		output-high;
> 	}
> 
> results in the gpio to be set to (physically) low value, which is
> surprising. So support "output-active" which makes the semantic more
> obvious. The old semantic is still supported for backward compatibility.

Ugg. Can't say I'm a fan of the Linux GPIO subsystem inverting the logic 
for GPIO_ACTIVE_LOW...

> 
> Signed-off-by: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx>
> ---
> Hello,
> 
> the next logical step would be to go through all in-tree dts files and
> substitute the old properties by the new ones. I can do this as soon as
> the idea is discussed and considered to be good.
> 
> Maybe the same idea can be applied to the cpp definitions GPIOD_OUT_LOW
> and GPIOD_OUT_HIGH.
> 
> And btw I wondered about the binding that defines what should happen in
> this case:
> 
> 	{
> 		gpio-hog;
> 		gpios = <...>;
> 		output-high;
> 		output-low;
> 	}
> 
> I would have defined as undefined instead of inactive.
> 
> Best regards
> Uwe
> 
>  Documentation/devicetree/bindings/gpio/gpio.txt | 10 ++++++----
>  drivers/gpio/gpiolib-of.c                       |  4 ++++
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
> index 68d28f62a6f4..4d29e0b33435 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio.txt
> +++ b/Documentation/devicetree/bindings/gpio/gpio.txt
> @@ -196,10 +196,12 @@ This means that when multiple properties are present they will be searched
>  in the order presented below and the first match is taken as the intended
>  configuration.
>  - input:      A property specifying to set the GPIO direction as input.
> -- output-low  A property specifying to set the GPIO direction as output with
> -	      the value low.
> -- output-high A property specifying to set the GPIO direction as output with
> -	      the value high.
> +- output-inactive: A property specifying to set the GPIO direction as output
> +	      using the inactive level as value.
> +- output-active: A property specifying to set the GPIO direction as output
> +	      using the active level as value.
> +- output-low  A deprecated alias for "output-inactive".
> +- output-high A deprecated alias for "output-active".

The question is was this really what was expected. I guess based on the 
code it was. I would have expected these gave low or high voltage 
levels. Seems like Linuxisms defining the binding.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux