Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Documentation/ABI/testing/sysfs-bus-iio-dac-max22007
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_ldac_update
KernelVersion: 6.13
Contact: linux-iio@vger.kernel.org
Description:
Trigger LDAC (Load DAC) update for the specified channel. Write 1 to update DAC outputs.

What: /sys/bus/iio/devices/iio:deviceX/out_currentY_ldac_update
KernelVersion: 6.13
Contact: linux-iio@vger.kernel.org
Description:
Trigger LDAC (Load DAC) update for the specified channel.
Writing 1 will transfer the DAC register value to the actual
DAC output, effectively updating the analog output current.
Writing 0 has no effect. This is useful when using the
transparent latch mode is disabled, allowing manual control
over when DAC register changes take effect on the output.
Comment on lines +1 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting the use case for this DAC latch control feature. Why not always driving the device in 'transparent' mode? We already have out_voltageY_raw for each channel. Why make the user write to out_voltageY_raw and to out_currentY_ldac_update to get the DAC output updated? I'd just always write the proper bits to LD_CTRL whenever the user writes to out_voltageY_raw.

With that, I think adi,dac-latch-mode will no longer be needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being it a per channel thing, I'm also not buying it (at least yet). AFAIR, typical case for this sort of thing is to for the latch mode to update all the channels at once which might be useful (in IIO) when buffering and update all channels at once. If we are only supporting raw writes I would (at least for now) just support transparent mode. Or do you have an actual request for this?


What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powermode
What: /sys/bus/iio/devices/iio:deviceX/out_currentY_powermode
KernelVersion: 6.13
Contact: linux-iio@vger.kernel.org
Description:
Control the power state of the specified channel. Write "on" to
enable the channel output, or "off" to disable it. Reading
returns the current power state.
Comment on lines +18 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this be supported with out_voltageY_powerdown 1?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. With the above, I guess we do not need any custom ABI


What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powermode_available
What: /sys/bus/iio/devices/iio:deviceX/out_currentY_powermode_available
KernelVersion: 6.13
Contact: linux-iio@vger.kernel.org
Description:
Shows the available power modes for the channel. Always returns
"on off".
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
rpi-ltc6952.dtbo \
rpi-max14830-i2c.dtbo \
rpi-max14830-spi.dtbo \
rpi-max22007.dtbo \
rpi-max31335.dtbo \
rpi-poe.dtbo \
rpi-poe-plus.dtbo \
Expand Down
61 changes: 61 additions & 0 deletions arch/arm/boot/dts/overlays/rpi-max22007-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Analog Devices MAX22007
*
* hdl_project: <max22007_rpi>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need an hdl tag in here?!

*
* Copyright (C) 2025 Analog Devices Inc.
*/

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>

&spi0 {
status = "okay";

max22007: max22007@0 {
compatible = "adi,max22007";
reg = <0>;
spi-max-frequency = <500000>;
spi-cpha;
spi-cpol;
status = "okay";
reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
#address-cells = <1>;
#size-cells = <0>;

channel@0 {
reg = <0>;
adi,dac-latch-mode = "ldac-control";
adi,mode = "voltage";
};

channel@1 {
reg = <1>;
adi,dac-latch-mode = "ldac-control";
adi,mode = "voltage";
};

channel@2 {
reg = <2>;
adi,dac-latch-mode = "ldac-control";
adi,mode = "voltage";
};

channel@3 {
reg = <3>;
adi,dac-latch-mode = "ldac-control";
adi,mode = "voltage";
};
};
};

&spidev0 {
status = "disabled";
};

&spidev1 {
status = "disabled";
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overlay is a different patch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep it here until review and then move it later on? (please correct me if my understanding is wrong)

13 changes: 13 additions & 0 deletions drivers/iio/dac/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,19 @@ config MAX517
This driver can also be built as a module. If so, the module
will be called max517.

config MAX22007
tristate "Analog Devices MAX22007 DAC Driver"
depends on SPI
select REGMAP
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be REGMAP_SPI

select CRC8
help
Say Y here if you want to build a driver for Analog Devices MAX22007.

MAX22007 is a single-channel, 16-bit, voltage-output digital to
analog converter (DAC) with SPI interface.

If compiled as a module, it will be called max22007.

config MAX5522
tristate "Maxim MAX5522 DAC driver"
depends on SPI_MASTER
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/dac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ obj-$(CONFIG_LTC2664) += ltc2664.o
obj-$(CONFIG_LTC2688) += ltc2688.o
obj-$(CONFIG_M62332) += m62332.o
obj-$(CONFIG_MAX517) += max517.o
obj-$(CONFIG_MAX22007) += max22007.o
obj-$(CONFIG_MAX5522) += max5522.o
obj-$(CONFIG_MAX5821) += max5821.o
obj-$(CONFIG_MCP4725) += mcp4725.o
Expand Down
Loading