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:
Warm regards,