Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1647782

Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio

From Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio
Date 2017-05-23 10:20 +0200
Message-ID <tKdcS-x7-17@gated-at.bofh.it> (permalink)
References <tIRo5-3Bo-5@gated-at.bofh.it> <tIRo6-3Bo-15@gated-at.bofh.it> <tKdcS-x7-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> Reset GPIO is active low.
>>
>> Currently driver uses gpiod_set_value(1) to clean reset, which depends
>> on device tree to contain GPIO_ACTIVE_HIGH - that does not match reality.
>>
>> This fixes driver to use _raw version of gpiod_set_value() to enforce
>> active-low semantics despite of what's written in device tree. Allowing
>> device tree to override that only opens possibility for errors and does
>> not add any value.
>>
>> Additionally, use _cansleep version to make things work with i2c-gpio
>> and other sleeping gpio drivers.
> 
> The reset gpio comes from platform hence it should be handled by DTS.
> 
> In driver the gpio should not be raw.
> 
> Even the hi8435 is active low but platform may invert signal (f.e. by
> adding trigger on the circuit path).

I see.  However - isn't this pure theoretic?  Does such case exist?

In vast majority of cases, GPIO polarity is chip-specific, not
chip-use-specific.  Thus this knowlege belongs to driver and not to
device tree describing particular chip usage.  Having this always
defined at usage side is IMO major source of errors.

In this particular case, we already have device trees in the wild with
polarity set to active_high.  If we now change that to require
active_low, we break existing setups.  Not sure this is acceptable.

I'm unsure what is good way forward here. I believe it is at gpiolib
level, which perhaps should change how "logical value" is defined, such
that knowledge of chip-specific information is not forced to chip usage
scope.

Nikita

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] iio: hi8435: add raw access Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-19 16:50 +0200
  [PATCH 4/4] iio: hi8435: cleanup reset gpio Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-19 16:50 +0200
    Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Jonathan Cameron <jic23@kernel.org> - 2017-05-20 18:40 +0200
    Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-23 10:20 +0200
      Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Vladimir Barinov <vladimir.barinov@cogentembedded.com> - 2017-05-24 13:30 +0200
        Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Jonathan Cameron <jic23@kernel.org> - 2017-05-24 21:40 +0200
  [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-19 16:50 +0200
    Re: [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Jonathan Cameron <jic23@kernel.org> - 2017-05-20 18:40 +0200
    Re: [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Vladimir Barinov <vladimir.barinov@cogentembedded.com> - 2017-05-22 20:30 +0200
      Re: [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-23 09:30 +0200
  Re: [PATCH 1/4] iio: hi8435: add raw access Jonathan Cameron <jic23@kernel.org> - 2017-05-20 18:40 +0200
    Re: [PATCH 1/4] iio: hi8435: add raw access Vladimir Barinov <vladimir.barinov@cogentembedded.com> - 2017-05-22 19:30 +0200

csiph-web