ad525x_dpot.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ---------------------------------
  2. AD525x Digital Potentiometers
  3. ---------------------------------
  4. The ad525x_dpot driver exports a simple sysfs interface. This allows you to
  5. work with the immediate resistance settings as well as update the saved startup
  6. settings. Access to the factory programmed tolerance is also provided, but
  7. interpretation of this settings is required by the end application according to
  8. the specific part in use.
  9. ---------
  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. -----------
  21. Example
  22. -----------
  23. Locate the device in your sysfs tree. This is probably easiest by going into
  24. the common i2c directory and locating the device by the i2c slave address.
  25. # ls /sys/bus/i2c/devices/
  26. 0-0022 0-0027 0-002f
  27. So assuming the device in question is on the first i2c bus and has the slave
  28. address of 0x2f, we descend (unrelated sysfs entries have been trimmed).
  29. # ls /sys/bus/i2c/devices/0-002f/
  30. eeprom0 rdac0 tolerance0
  31. You can use simple reads/writes to access these files:
  32. # cd /sys/bus/i2c/devices/0-002f/
  33. # cat eeprom0
  34. 0
  35. # echo 10 > eeprom0
  36. # cat eeprom0
  37. 10
  38. # cat rdac0
  39. 5
  40. # echo 3 > rdac0
  41. # cat rdac0
  42. 3