iio: dac: add ad5706r (part 1)#3325
Conversation
Add device tree binding documentation for the Analog Devices AD5706R 4-channel 16-bit current output digital-to-analog converter. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for the Analog Devices AD5706R, a 4-channel 16-bit current output digital-to-analog converter with SPI interface. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Imply ad5706r for build Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
gastmaier
left a comment
There was a problem hiding this comment.
quick driver check only
| if (num_bytes == 1) | ||
| st->tx_buf[2] = (u8)val; | ||
| else if (num_bytes == 2) | ||
| put_unaligned_be16(val, &st->tx_buf[2]); |
There was a problem hiding this comment.
prefer be16_to_cpu, cpu_to_be16 calls
There was a problem hiding this comment.
Hi,
As this was already accepted upstream, I don't think it's worth editing further. Though I think I understand the merit of the suggestion.
| u8 rx_buf[4]; | ||
| }; | ||
|
|
||
| static int ad5706r_reg_len(unsigned int reg) |
There was a problem hiding this comment.
inline this method to allow the compiler to optimize
LLM reviewThis series adds a new IIO DAC driver for the Analog Devices AD5706R, a 4-channel 16-bit current-output DAC with SPI interface. run: 26096321359
|
|
the LLM review above makes a good point about the register address and such. although this patch is already reflected upstream, the part 2 PR that adds other features, |
| reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; | ||
| enable-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Maybe others can comment on that, but that is my view on the multi-device support
spi {
#address-cells = <1>;
#size-cells = <0>;
multi-dac@0 {
compatible = "adi,ad5706r";
reg = <0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <0>;
dac@0 {
reg = <0>
avdd-supply = <&avdd>;
iovdd-supply = <&iovdd>;
pvdd0-supply = <&pvdd>;
pvdd1-supply = <&pvdd>;
pvdd2-supply = <&pvdd>;
pvdd3-supply = <&pvdd>;
vref-supply = <&vref>;
pwms = <&pwm0 0 1000000 0>;
reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
enable-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
};
dac@1 {
reg = <1>
avdd-supply = <&avdd>;
iovdd-supply = <&iovdd>;
pvdd0-supply = <&pvdd>;
pvdd1-supply = <&pvdd>;
pvdd2-supply = <&pvdd>;
pvdd3-supply = <&pvdd>;
vref-supply = <&vref>;
pwms = <&pwm0 0 1000000 0>;
reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
enable-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
};
};
each dac node provides 4 channels, this example could be a single 8-channel iio device or two 4-channel iio devices... need to evaluate which one is best.
Another point here is to figure out resource sharing... maybe we want to set pwms, reset-gpios or enable-gpios to the parent node? and child nodes can inherit them being able to override...
| properties: | ||
| compatible: | ||
| enum: | ||
| - adi,ad5706r |
There was a problem hiding this comment.
consider adding support for ad5705r
PR Description
This PR is related to #3096
The upstream asked this to be split.
Part 1 - basic driver
Part 2 - device attributes
Part 3 - Channel attributes
Part 4 - debugfs attributes
The commits in this PR are already accepted upstream and is cherry picked.
This PR is for merging, the next feature will be PRed on top of this.
PR Type
PR Checklist