Post Go back to editing

Issue with AD5446 IIO DAC Driver

Category: Software
Product Number: AD5321
Software Version: NXP Kernel 5.4

I am currently working with the AD5446 IIO DAC driver in the Linux kernel and have encountered some unexpected behavior that I wanted to discuss with you.

Issue Description:

When writing specific values to the out_voltage0_raw sysfs attribute, I observed, via I2C monitoring, multiple messages being sent to the AD5321 device:
(Used the following command: `echo X > out_voltage0_raw`)
Writing a value of 1234 resulted in three messages (i2c transactions) being sent to the AD5321. The first sent data correctly (1234), the second with data 34 and the third with data of 0
Writing a value of 9 resulted in a single message with data of 9 (as expected).
Writing a value of 10 resulted in two messages, with the second message always containing a data value of zero.
To further diagnose the issue, I reviewed the driver code and added some debugging print statements, but I haven't yet been able to pinpoint the root cause of this behavior.

Steps Taken:

Checked the driver's write function (ad5446_write_raw), and it appears to handle the raw write as expected.
Reviewed the ad5622_write function, which sends data over I2C. This function seems to perform a single I2C write operation, but the behavior I'm observing suggests it (or some other function) might be called multiple times for certain values.
Validated the hardware by testing it without kernel involvement. The behavior was as expected, with values written correctly.
Given the above, I suspect there might be a condition within the driver code that's triggering multiple writes in specific scenarios.

Assistance Request:

Would you have any insights into this behavior, or can you point out if I might be overlooking something in the driver's operation? If this is a known issue, or if there are any workarounds or fixes, I'd greatly appreciate any guidance you can provide.

Thank you in advance for your time and assistance. I'm eager to ensure the driver operates correctly and am happy to provide any additional details or collaborate on a fix if needed.

Env:

VAR-SOM-MX6 - SOM - ARM

Custom linux built with yocto

Device tree: 

&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
status = "okay";
...
ad5321@0C {
compatible = "ad5321";
reg = <0x0c>;
vcc-supply = <&dac_vcc>;
};

ltc4151_motor_1@67 {
compatible = "lltc,ltc4151";
reg = <0x67>;
shunt-resistor-micro-ohms = <100000>;
};
...
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
 
 dac_vcc: fixedregulator@1 {
 compatible = "regulator-fixed";
 regulator-name = "fixed-supply";
 regulator-min-microvolt = <3300000>;
 regulator-max-microvolt = <3300000>;
 regulator-boot-on;
 };



Warm regards,

Top Replies

Parents Reply Children
No Data