ad525x_dpot.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =============================
  3. AD525x Digital Potentiometers
  4. =============================
  5. The ad525x_dpot driver exports a simple sysfs interface. This allows you to
  6. work with the immediate resistance settings as well as update the saved startup
  7. settings. Access to the factory programmed tolerance is also provided, but
  8. interpretation of this settings is required by the end application according to
  9. the specific part in use.
  10. Files
  11. =====
  12. Each dpot device will have a set of eeprom, rdac, and tolerance files. How
  13. many depends on the actual part you have, as will the range of allowed values.
  14. The eeprom files are used to program the startup value of the device.
  15. The rdac files are used to program the immediate value of the device.
  16. The tolerance files are the read-only factory programmed tolerance settings
  17. and may vary greatly on a part-by-part basis. For exact interpretation of
  18. this field, please consult the datasheet for your part. This is presented
  19. as a hex file for easier parsing.
  20. Example
  21. =======
  22. Locate the device in your sysfs tree. This is probably easiest by going into
  23. the common i2c directory and locating the device by the i2c slave address::
  24. # ls /sys/bus/i2c/devices/
  25. 0-0022 0-0027 0-002f
  26. So assuming the device in question is on the first i2c bus and has the slave
  27. address of 0x2f, we descend (unrelated sysfs entries have been trimmed)::
  28. # ls /sys/bus/i2c/devices/0-002f/
  29. eeprom0 rdac0 tolerance0
  30. You can use simple reads/writes to access these files::
  31. # cd /sys/bus/i2c/devices/0-002f/
  32. # cat eeprom0
  33. 0
  34. # echo 10 > eeprom0
  35. # cat eeprom0
  36. 10
  37. # cat rdac0
  38. 5
  39. # echo 3 > rdac0
  40. # cat rdac0
  41. 3