From: Janani Sunil <jan.sun97@gmail.com>
To: Jonathan Cameron <jonathan.cameron@huawei.com>,
Janani Sunil <janani.sunil@analog.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Alexandru Ardelean <alexandru.ardelean@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
jan.sun97@gmail.com, gastmaier@gmail.com
Subject: Re: [PATCH 2/3] docs: iio: Add documentation for MAX22007 driver
Date: Wed, 7 Jan 2026 16:20:56 +0100 [thread overview]
Message-ID: <05379c1e-9114-494e-b7c7-c95243049197@gmail.com> (raw)
In-Reply-To: <20251219164751.000071a1@huawei.com>
Hi Johnathan,
Thank you for getting back to me.
On 12/19/25 17:47, Jonathan Cameron wrote:
> On Fri, 19 Dec 2025 16:31:16 +0100
> Janani Sunil <janani.sunil@analog.com> wrote:
>
>> Add documentation for MAX22007 driver which describes how the user
>> can access the driver using dtoverlays
>>
>> Signed-off-by: Janani Sunil <janani.sunil@analog.com>
> Hi Janani,
>
> We've recently had a few comments on whether driver specific docs add value
> (for particular drivers, sometimes they definitely do!). From what I'm
> seeing here, I'm not thinking this one needs a document. Not most drivers
> don't have such a file because they make use of standard ABI that is well
> documented. DT stuff always belongs in the dt-binding rather than these
> files. With both those elements gone there isn't much value to this file.
> So I'd drop it. We can easily add a file if something complex shows up
> in later patches, that justifies this.
>
> Thanks,
>
> Jonathan
I agree that this driver does not need a specific document. Will drop it.
>
>> ---
>> Documentation/iio/index.rst | 1 +
>> Documentation/iio/max22007.rst | 145 +++++++++++++++++++++++++++++++++++++++++
>> MAINTAINERS | 1 +
>> 3 files changed, 147 insertions(+)
>>
>> diff --git a/Documentation/iio/index.rst b/Documentation/iio/index.rst
>> index 315ae37d6fd4..7601bc2882e7 100644
>> --- a/Documentation/iio/index.rst
>> +++ b/Documentation/iio/index.rst
>> @@ -37,4 +37,5 @@ Industrial I/O Kernel Drivers
>> adxl345
>> bno055
>> ep93xx_adc
>> + max22007
>> opt4060
>> diff --git a/Documentation/iio/max22007.rst b/Documentation/iio/max22007.rst
>> new file mode 100644
>> index 000000000000..e04c563f1fd0
>> --- /dev/null
>> +++ b/Documentation/iio/max22007.rst
>> @@ -0,0 +1,145 @@
>> +.. SPDX-License-Identifier: GPL-2.0-only
>> +
>> +===============
>> +MAX22007 driver
>> +===============
>> +
>> +Device driver for Analog Devices Inc. MAX22007 quad-channel industrial DAC.
>> +The module name is ``max22007``.
>> +
>> +Supported devices
>> +=================
>> +
>> +* `MAX22007 <https://www.analog.com/en/products/max22007.html>`_
>> +
>> +Wiring connections
>> +==================
>> +
>> +The MAX22007 uses a standard SPI interface.
> I'd not bother with this section. Most SPI devices after all use
> the standard interface, so we can document this by not documenting anything
> else :)
>
>> +
>> +Device Tree Configuration
>> +=========================
> Anything here should be in the dt-binding. As such this section isn't useful.
>
>> +
>> +The device supports both global and per-channel configuration through device tree.
>> +
>> +Global Properties:
>> +
>> +* ``reset-gpios``: GPIO pin for hardware reset (optional, falls back to
>> + software reset if not specified)
>> +* ``vdd-supply``: Low-Voltage Power Supply from +2.7V to +5.5V (optional)
>> +* ``hvdd-supply``: Positive High-Voltage Power Supply from +8V to (HVSS +24V)
>> + for the Output Channels (optional)
>> +* ``hvss-supply``: Negative High-Voltage Power Supply from -2V to 0V for the
>> + Output Channels (optional)
>> +
>> +Per-channel properties:
>> +
>> +* ``adi,type``: Specify the channel output type - must be either "voltage" or "current" (mandatory)
>> +
>> +Note: The driver operates in transparent mode (immediate register-to-output updates).
>> +Channel mode is determined by the ``adi,type`` property:
>> +
>> +* ``adi,type = "current"``: the channel operates in current mode
>> +* ``adi,type = "voltage"``: the channel operates in voltage mode
>> +
>> +Device attributes
>> +=================
>> +
>> +The MAX22007 driver provides IIO DAC interfaces that vary based on the
>> +configured channel mode. Each channel appears as a separate IIO device
>> +attribute:
>> +
>> +* ``out_voltage_raw`` (voltage mode channels)
>> +* ``out_current_raw`` (current mode channels)
>> +* ``out_voltage_scale`` / ``out_current_scale`` (channel scaling factors)
>> +* ``out_voltage_powerdown`` / ``out_current_powerdown`` (channel power control)
>> +
>> +The driver automatically configures the IIO channel type based on the configured
>> +channel mode from device tree.
> This bit feels very standard and so not in need of extra documentation.
>
>> +
>> +Power Mode Control
>> +==================
>> +
>> +Each channel provides standard IIO ``powerdown`` attributes for runtime power
>> +control:
>> +
>> +* Write ``1`` to power down (disable) the channel output
>> +* Write ``0`` to power up (enable) the channel output
>> +* Read the attribute to get the current power state (1=powered down, 0=powered up)
>> +
>> +This allows individual channels to be powered on/off independently for power
>> +management and safety purposes.
> Likewise, this is very standard.
>
>> +
>> +Usage Examples
>> +==============
>> +
>> +Setting DAC output values:
>> +
>> +.. code-block:: bash
>> +
>> + # Set channel 0 (voltage mode) to raw value 655 (≈2V)
>> + # Output is updated immediately in transparent mode
>> + echo 655 > /sys/bus/iio/devices/iio:deviceX/out_voltage0_raw
>> +
>> + # Set channel 1 (current mode)
>> + # Output is updated immediately in transparent mode
>> + echo 1024 > /sys/bus/iio/devices/iio:deviceX/out_current1_raw
>> +
>> +Controlling channel power modes:
>> +
>> +.. code-block:: bash
>> +
>> + # Enable channel 0 (power up)
>> + echo 0 > /sys/bus/iio/devices/iio:deviceX/out_voltage0_powerdown
>> +
>> + # Disable channel 1 (power down)
>> + echo 1 > /sys/bus/iio/devices/iio:deviceX/out_current1_powerdown
>> +
>> + # Check current power state (0=powered up, 1=powered down)
>> + cat /sys/bus/iio/devices/iio:deviceX/out_voltage0_powerdown
>> +
>> +Reading channel values and scale factors:
>> +
>> +.. code-block:: bash
>> +
>> + # Read raw DAC value
>> + cat /sys/bus/iio/devices/iio:deviceX/out_voltage0_raw
>> +
>> + # Read scale factor (volts per LSB)
>> + cat /sys/bus/iio/devices/iio:deviceX/out_voltage0_scale
>> +
>> +Check available channels:
>> +
>> +.. code-block:: bash
>> +
>> + ls /sys/bus/iio/devices/iio:deviceX/out_*_raw
>> +
>> +Scale Calculations
>> +==================
>> +
>> +The driver provides accurate scale factors based on the hardware configuration:
> This information doesn't need to be provided explicitly. Anyone who
> wonders in detail about it can check the driver. For most users the fact
> it obeys the standard ABI rules is eough.
>
>> +
>> +**Voltage Mode:**
>> +
>> +- Scale = (5 × 2.5V) / 4096 = 0.003051757 V per LSB
>> +- Range: 0V to 12.5V over 12-bit (0-4095)
>> +- Formula: Output = Raw_Value × Scale
>> +
>> +**Current Mode:**
>> +
>> +- Scale = (2.5V / (2 × 50Ω)) / 4096 = 0.000006103515625 A per LSB
>> +- Range: 0A to 0.025A over 12-bit (0-4095)
>> +- Formula: Output = Raw_Value × Scale
>> +
>> +Driver Architecture
>> +===================
>> +
>> +The driver implements:
>> +
>> +* **CRC8 Error Checking**: Always-enabled CRC8 for SPI data integrity
>> +* **Channel Configuration**: Supports per-channel mode and power configuration
>> +
>> +Channel configuration (voltage/current mode) is set via the ``adi,type``
>> +device tree property and cannot be changed dynamically The driver requires
>> +proper device tree configuration with mandatory ``adi,type`` property for each
>> +channel.
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index e1addbd21562..6561455732c9 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1599,6 +1599,7 @@ L: linux-iio@vger.kernel.org
>> S: Supported
>> W: https://ez.analog.com/linux-software-drivers
>> F: Documentation/devicetree/bindings/iio/dac/adi,max22007.yaml
>> +F: Documentation/iio/max22007.rst
>>
>> ANALOG DEVICES INC ADA4250 DRIVER
>> M: Antoniu Miclaus <antoniu.miclaus@analog.com>
>>
next prev parent reply other threads:[~2026-01-07 15:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 15:31 [PATCH 0/3] Subject: [PATCH v1 0/3] iio: dac: Add support for MAX22007 DAC Janani Sunil
2025-12-19 15:31 ` [PATCH 1/3] dt-bindings: iio: dac: Add max22007 Janani Sunil
2025-12-19 15:50 ` Krzysztof Kozlowski
2026-01-07 15:13 ` Janani Sunil
2025-12-19 16:40 ` Jonathan Cameron
2026-01-07 15:18 ` Janani Sunil
2025-12-19 15:31 ` [PATCH 2/3] docs: iio: Add documentation for MAX22007 driver Janani Sunil
2025-12-19 16:47 ` Jonathan Cameron
2026-01-07 15:20 ` Janani Sunil [this message]
2025-12-19 15:31 ` [PATCH 3/3] iio: dac: Add MAX22007 DAC driver support Janani Sunil
2025-12-19 17:25 ` Jonathan Cameron
2026-01-07 15:28 ` Janani Sunil
2026-01-11 11:50 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=05379c1e-9114-494e-b7c7-c95243049197@gmail.com \
--to=jan.sun97@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.ardelean@analog.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=gastmaier@gmail.com \
--cc=janani.sunil@analog.com \
--cc=jic23@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox