This is an old revision of the document!
This is a Linux industrial I/O (IIO) subsystem driver, targeting Digital Step Attenuator IIO devices with gpio interface. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See IIO for more information.
Function | File |
---|---|
driver | drivers/iio/amplifiers/hmc425a.c |
Documentation | Documentation/ABI/testing/sysfs-bus-iio |
compatible:
vcc-supply:
ctrl-gpios:
required:
#include <dt-bindings/gpio/gpio.h> &gpio { #address-cells = <1>; #size-cells = <0>; gpio_hmc425a: hmc425a { compatible = "adi,hmc425a"; ctrl-gpios = <&gpio 40 GPIO_ACTIVE_HIGH>, <&gpio 39 GPIO_ACTIVE_HIGH>, <&gpio 38 GPIO_ACTIVE_HIGH>, <&gpio 37 GPIO_ACTIVE_HIGH>, <&gpio 36 GPIO_ACTIVE_HIGH>, <&gpio 35 GPIO_ACTIVE_HIGH>; vcc-supply = <&foo>; }; }
Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)
The HMC425A Driver depends on CONFIG_GPIOLIB
Linux Kernel Configuration Device Drivers ---> <*> Industrial I/O support ---> --- Industrial I/O support Amplifiers ---> <*> Analog Devices HMC425A DSA
Each and every IIO device, typically a hardware chip, has a device folder under /sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under every of these directory folders reside a set of files, depending on the characteristics and features of the hardware device in question. These files are consistently generalized and documented in the IIO ABI documentation. In order to determine which IIO deviceX corresponds to which hardware device, the user can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the sequence in which the iio device drivers are loaded/registered is constant, the numbering is constant and may be known in advance.
This specifies any shell prompt running on the target
root:/> cd /sys/bus/iio/devices/ root:/sys/bus/iio/devices> ls iio:device0 root:/sys/bus/iio/devices> iio:device0 root:/> ls -l drwxr-xr-x 2 root root 0 Jan 1 00:00 . drwxr-xr-x 3 root root 0 Jan 1 00:00 .. -r--r--r-- 1 root root 4096 Jan 1 00:00 dev -r--r--r-- 1 root root 4096 Jan 1 00:00 name -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_voltage0_hardwaregain lrwxrwxrwx 1 root root 0 Jan 1 00:00 subsystem -> ../../../../../../../../../bus/iio -rw-r--r-- 1 root root 4096 Jan 1 00:00 uevent
This specifies any shell prompt running on the target
root:/> cd /sys/bus/iio/devices/iio\:device0/ root:/> cat name hmc425a
/sys/bus/iio/devices/iio:deviceX/out_voltageY_hardwaregain
Hardware applied gain factor. If shared across all channels, <type>_hardwaregain is used.
This specifies any shell prompt running on the target
root:/> cat out_voltage0_hardwaregain -31.500000 dB root:/> echo -10 > out_voltage0_hardwaregain root:/> cat out_voltage0_hardwaregain -10.000000 dB