Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 =============================
0004 AD525x Digital Potentiometers
0005 =============================
0006 
0007 The ad525x_dpot driver exports a simple sysfs interface.  This allows you to
0008 work with the immediate resistance settings as well as update the saved startup
0009 settings.  Access to the factory programmed tolerance is also provided, but
0010 interpretation of this settings is required by the end application according to
0011 the specific part in use.
0012 
0013 Files
0014 =====
0015 
0016 Each dpot device will have a set of eeprom, rdac, and tolerance files.  How
0017 many depends on the actual part you have, as will the range of allowed values.
0018 
0019 The eeprom files are used to program the startup value of the device.
0020 
0021 The rdac files are used to program the immediate value of the device.
0022 
0023 The tolerance files are the read-only factory programmed tolerance settings
0024 and may vary greatly on a part-by-part basis.  For exact interpretation of
0025 this field, please consult the datasheet for your part.  This is presented
0026 as a hex file for easier parsing.
0027 
0028 Example
0029 =======
0030 
0031 Locate the device in your sysfs tree.  This is probably easiest by going into
0032 the common i2c directory and locating the device by the i2c slave address::
0033 
0034         # ls /sys/bus/i2c/devices/
0035         0-0022  0-0027  0-002f
0036 
0037 So assuming the device in question is on the first i2c bus and has the slave
0038 address of 0x2f, we descend (unrelated sysfs entries have been trimmed)::
0039 
0040         # ls /sys/bus/i2c/devices/0-002f/
0041         eeprom0 rdac0 tolerance0
0042 
0043 You can use simple reads/writes to access these files::
0044 
0045         # cd /sys/bus/i2c/devices/0-002f/
0046 
0047         # cat eeprom0
0048         0
0049         # echo 10 > eeprom0
0050         # cat eeprom0
0051         10
0052 
0053         # cat rdac0
0054         5
0055         # echo 3 > rdac0
0056         # cat rdac0
0057         3