Re: [RESEND PATCH] iio: adis: set GPIO reset pin direction

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

 



On 7/7/21 1:53 PM, Hannu Hartikainen wrote:
[...]
GPIOD_OUT_LOW and GPIOD_OUT_HIGH have different semantics.[1] Is setting
the pin to use wrong semantics to save one line of code and possibly
toggle the pin one time less worth it? (The ADIS devices whose
datasheets I've read have the RST pin as active low, ie. GPIOD_OUT_LOW
is semantically correct.)

GPIOD_OUT_LOW does not mean that the GPIO is active low. OUT_LOW just means that the GPIO is configured as output in the non-asserted state[1]. Whether it is active low or active high is configured through the flags associated with the GPIO descriptor. E.g. when using devicetree this is typically the field after the GPIO offset.


If we really want that, I think the better choice is to use GPIO_ASIS,
gpiod_direction_output and gpiod_set_raw_value_cansleep and skip
semantically describing the pin altogether.
Requesting as output is the right solution.


[1] https://www.kernel.org/doc/html/latest/driver-api/gpio/consumer.html#obtaining-and-disposing-gpios





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux