Re: [PATCH 1/2] dt-bindings: iio: dac: add support for mcp47a1

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <20260725225407.1768a2f5@jic23-huawei>
On Sat, 25 Jul 2026 10:41:30 -0500
David Lechner <[email protected]> wrote:

> On 7/25/26 3:12 AM, Joshua Crofts wrote:
> > On Sat, 25 Jul 2026 00:04:51 +0100
> > Jonathan Cameron <[email protected]> wrote:
> >   
> >> On Tue, 21 Jul 2026 20:24:38 +0200
> >> Joshua Crofts <[email protected]> wrote:
> >>  
> >>> The Microchip MCP47A1 is a 6-bit volatile Digital-to-Analog converted
> >>> which communicates via I2C.
> >>>
> >>> Signed-off-by: Joshua Crofts <[email protected]>
> >>> ---
> >>>  .../bindings/iio/dac/microchip,mcp47a1.yaml        | 56 ++++++++++++++++++++++
> >>>  MAINTAINERS                                        |  6 +++
> >>>  2 files changed, 62 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/iio/dac/microchip,mcp47a1.yaml b/Documentation/devicetree/bindings/iio/dac/microchip,mcp47a1.yaml
> >>> new file mode 100644
> >>> index 000000000000..3322fca03b3a
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/iio/dac/microchip,mcp47a1.yaml    
> >>  
> >>> +
> >>> +examples:
> >>> +  - |
> >>> +    i2c {
> >>> +          #address-cells = <1>;
> >>> +          #size-cells = <0>;
> >>> +
> >>> +          dac@2e {
> >>> +              compatible = "microchip,mcp47a1";
> >>> +              reg = <0x2e>;
> >>> +              vref-supply = <&vref_regulator>;
> >>> +              vdd-supply = <&vdd_regulator>;
> >>> +          };
> >>> +
> >>> +          dac@3e {
> >>> +              compatible = "microchip,mcp47a1";    
> >> Hi Joshua,
> >>
> >> What is the advantage of the second example?  I'd drop it.
> >>  
> > 
> > Hi Jonathan,
> > 
> > Per the datasheet, the MCP47A1 can have two different I2C slave
> > addresses (0x2e and 0x3e), which allows two DACs to share the
> > same bus, something I thought would be good to illustrate in the
> > example.

Given many i2c devices either come in a couple of variants or have
a pinstrap method to change their address, to me this looks like
an unnecessary level of detail.
> >   
> 
> I know we haven't done this much historically, but we could make
> that more obvious with this instead:
> 
>   reg:
>     items:
>       - enum: [0x2e, 0x3e]
> 
> Then the bindings validator would actually check for a valid
> address.
> 
Sure, there is some precedence. I did a quick grep and immediately
spotted:
Documentation/devicetree/bindings/regulator/adi,max77857.yaml

So, whilst I don't want to see a mass set of 'fixes' adding
limits on reg for available I2C addresses I'm fine with this style
in new bindings. 

Thanks,

Jonathan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.