Re: [PATCH 1/2] dt-bindings: iio: dac: add MCP4821

From: Jonathan Cameron
Date: Sat Nov 25 2023 - 06:36:31 EST


On Fri, 17 Nov 2023 13:00:37 +0530
Anshul Dalal <anshulusr@xxxxxxxxx> wrote:

> Adds support for MCP48xx series of DACs.
>
> Datasheet:
> [MCP48x1] https://ww1.microchip.com/downloads/en/DeviceDoc/22244B.pdf
> [MCP48x2] https://ww1.microchip.com/downloads/en/DeviceDoc/20002249B.pdf
>
> Signed-off-by: Anshul Dalal <anshulusr@xxxxxxxxx>
Hi Anshul,

Usually we mark vdd-supply as required given I guess device doesn't work
without a supply. Obviously we don't actually have to provide it in a binding
if the supply is always on and we are fine with a stub regulator being
provided by the regulator subsystem.

There was some discussion about this a while back and conclusion was
mark them required in bindings anyway. We haven't yet updated this in all
the older IIO bindings and it's a minor thing, but given the build warning
on patch 2 you are going around again so might as well tidy that up!

Jonathan


> ---
> .../bindings/iio/dac/microchip,mcp4821.yaml | 63 +++++++++++++++++++
> 1 file changed, 63 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/dac/microchip,mcp4821.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/dac/microchip,mcp4821.yaml b/Documentation/devicetree/bindings/iio/dac/microchip,mcp4821.yaml
> new file mode 100644
> index 000000000000..904de15300bd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/microchip,mcp4821.yaml
> @@ -0,0 +1,63 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/dac/microchip,mcp4821.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip MCP4821 and similar DACs
> +
> +description: |
> + Supports MCP48x1 (single channel) and MCP48x2 (dual channel) series of DACs.
> + Device supports simplex communication over SPI in Mode 0,1 and Mode 1,1.
> +
> + +---------+--------------+-------------+
> + | Device | Resolution | Channels |
> + |---------|--------------|-------------|
> + | MCP4801 | 8-bit | 1 |
> + | MCP4811 | 10-bit | 1 |
> + | MCP4821 | 12-bit | 1 |
> + | MCP4802 | 8-bit | 2 |
> + | MCP4812 | 10-bit | 2 |
> + | MCP4822 | 12-bit | 2 |
> + +---------+--------------+-------------+
> +
> + Datasheet:
> + MCP48x1: https://ww1.microchip.com/downloads/en/DeviceDoc/22244B.pdf
> + MCP48x2: https://ww1.microchip.com/downloads/en/DeviceDoc/20002249B.pdf
> +
> +maintainers:
> + - Anshul Dalal <anshulusr@xxxxxxxxx>
> +
> +properties:
> + compatible:
> + enum:
> + - microchip,mcp4801
> + - microchip,mcp4811
> + - microchip,mcp4821
> + - microchip,mcp4802
> + - microchip,mcp4812
> + - microchip,mcp4822

Whilst I understand the reasoning of keeping these grouped by number of channels,
I'd still rather see them in numeric order here and probably also in the table above.
Given that grouping by resolution rather than channels would also be a valid choice,
I don't see a strong reason to keep them out of order.

Also, manufacturers often get creative with numbering (when they run of out of digits
for example - maybe they'll do a 16 channel variant one day and then be stuck) so
trying to group things is often a loosing game long term!

Jonathan


>