mbox series

[v2,0/2] iio: ad74413r: allow setting sink current for digital input

Message ID 20230306094301.1357543-1-linux@rasmusvillemoes.dk (mailing list archive)
Headers show
Series iio: ad74413r: allow setting sink current for digital input | expand

Message

Rasmus Villemoes March 6, 2023, 9:42 a.m. UTC
Depending on the actual hardware wired up to a digital input channel,
it may be necessary to configure the ad74413r to sink a small
current. For example, in the case of a simple mechanical switch, the
charge on the external 68 nF capacitor (cf. the data sheet's Figure
34) will keep the channel as reading high even after the switch is
turned off again.

Add a DT binding and driver support for setting the desired sink current.

I have chosen the term "drive strength" because it matches existing
practice, even if this is only a sink. E.g. there's

 * @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the current
 *      passed as argument. The argument is in uA.

and indeed it would be trivial to hook up that
PIN_CONFIG_DRIVE_STRENGTH_UA in ad74413r_gpio_set_comp_config().

However, unlike the debounce time, there does not appear to be any way
to actually tweak the drive strength from userspace, nor do I know if
that would actually be a good idea. For our application(s), the
current sink needed is a property of the attached hardware, and thus
can and should be defined in DT.

v2:
- remove redundant type info in binding per Rob's bot
- use min() instead of if() in ad74413r_set_comp_drive_strength() per Jonathan

Rasmus Villemoes (2):
  dt-bindings: iio: ad74413r: allow setting sink current for digital
    input
  iio: ad74413r: wire up support for drive-strength-microamp property

 .../bindings/iio/addac/adi,ad74413r.yaml      |  9 ++++++++
 drivers/iio/addac/ad74413r.c                  | 23 +++++++++++++++++++
 2 files changed, 32 insertions(+)

Comments

Jonathan Cameron March 12, 2023, 3:48 p.m. UTC | #1
On Mon,  6 Mar 2023 10:42:59 +0100
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> Depending on the actual hardware wired up to a digital input channel,
> it may be necessary to configure the ad74413r to sink a small
> current. For example, in the case of a simple mechanical switch, the
> charge on the external 68 nF capacitor (cf. the data sheet's Figure
> 34) will keep the channel as reading high even after the switch is
> turned off again.
> 
> Add a DT binding and driver support for setting the desired sink current.
> 
> I have chosen the term "drive strength" because it matches existing
> practice, even if this is only a sink. E.g. there's
> 
>  * @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the current
>  *      passed as argument. The argument is in uA.
> 
> and indeed it would be trivial to hook up that
> PIN_CONFIG_DRIVE_STRENGTH_UA in ad74413r_gpio_set_comp_config().
> 
> However, unlike the debounce time, there does not appear to be any way
> to actually tweak the drive strength from userspace, nor do I know if
> that would actually be a good idea. For our application(s), the
> current sink needed is a property of the attached hardware, and thus
> can and should be defined in DT.
> 
> v2:
> - remove redundant type info in binding per Rob's bot
> - use min() instead of if() in ad74413r_set_comp_drive_strength() per Jonathan
> 
> Rasmus Villemoes (2):
>   dt-bindings: iio: ad74413r: allow setting sink current for digital
>     input
>   iio: ad74413r: wire up support for drive-strength-microamp property
> 
>  .../bindings/iio/addac/adi,ad74413r.yaml      |  9 ++++++++
>  drivers/iio/addac/ad74413r.c                  | 23 +++++++++++++++++++
>  2 files changed, 32 insertions(+)
> 
Series applied to the togreg branch of iio.git and pushed out as testing
for 0-day to take a first look at it.

Thanks,

Jonathan