[2/5] dt-bindings: iio: ad74413r: make refin-supply optional

Message ID 20221111143921.742194-3-linux@rasmusvillemoes.dk
State New
Headers
Series iio: addac: ad74413r: various fixups |

Commit Message

Rasmus Villemoes Nov. 11, 2022, 2:39 p.m. UTC
  The ad74412r/ad74413r has an internal 2.5V reference output, which (by
tying the REFOUT pin to the REFIN pin) can be used in lieu of an
external 2.5V input reference. So stop marking refin-supply as
required.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml | 1 -
 1 file changed, 1 deletion(-)
  

Comments

Jonathan Cameron Nov. 12, 2022, 4:54 p.m. UTC | #1
On Fri, 11 Nov 2022 15:39:18 +0100
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> The ad74412r/ad74413r has an internal 2.5V reference output, which (by
> tying the REFOUT pin to the REFIN pin) can be used in lieu of an
> external 2.5V input reference. So stop marking refin-supply as
> required.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>


Interesting corner case.  Given we have no way of knowing if the
wiring has REFOUT connected to REFIN I see two ways we should fix this.

1) Just have any DT doing this provide a fixed regulator.
2) Have the REFOUT supported as an actual regulator - in theory it might be
   wired to other devices.  This might get a little interesting ordering
   wise as we'll want to register the regulator before we try to consume
   it in the same driver.  I'm also not 100% sure there are no other issues
   in a driver providing and consuming the same regulator.

I'm not keen to just assume lack of regulator means the chip is wired
like this.  Would be a different question if this was just setting
an internal mux to use the regulator without external loop back being
needed.

Jonathan

> ---
>  Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
> index 03bb90a7f4f8..e954d5ae4f4f 100644
> --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
> +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
> @@ -56,7 +56,6 @@ required:
>    - reg
>    - spi-max-frequency
>    - spi-cpol
> -  - refin-supply
>  
>  additionalProperties: false
>
  
Rasmus Villemoes Nov. 14, 2022, 8:10 a.m. UTC | #2
On 12/11/2022 17.54, Jonathan Cameron wrote:
> On Fri, 11 Nov 2022 15:39:18 +0100
> Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> 
>> The ad74412r/ad74413r has an internal 2.5V reference output, which (by
>> tying the REFOUT pin to the REFIN pin) can be used in lieu of an
>> external 2.5V input reference. So stop marking refin-supply as
>> required.
>>
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> 
> 
> Interesting corner case.  Given we have no way of knowing if the
> wiring has REFOUT connected to REFIN I see two ways we should fix this.
> 
> 1) Just have any DT doing this provide a fixed regulator.
> 2) Have the REFOUT supported as an actual regulator - in theory it might be
>    wired to other devices.  This might get a little interesting ordering
>    wise as we'll want to register the regulator before we try to consume
>    it in the same driver.  I'm also not 100% sure there are no other issues
>    in a driver providing and consuming the same regulator.

Hm, I don't like the idea of exposing REFOUT as a real regulator. As you
write, there's gonna be interesting chicken-and-egg problems, and I also
don't think it can actually deliver any meaningful current, i.e. it
can't really (and shouldn't) be used for supplying other peripherals.

A third option is to have a boolean property to explicitly indicate that
"yes, we're using refout as refin", and then make the requirement in the
schema be "refin-supply XOR refout-as-refin".

But I think the simplest is (1), I will just add a fixed-regulator with
a suitable comment in my .dts, and patches 2,3 can be ignored.

Thanks,
Rasmus
  

Patch

diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
index 03bb90a7f4f8..e954d5ae4f4f 100644
--- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
+++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
@@ -56,7 +56,6 @@  required:
   - reg
   - spi-max-frequency
   - spi-cpol
-  - refin-supply
 
 additionalProperties: false