This is a Linux industrial I/O (IIO) subsystem driver, targeting serial interface accelerometers. 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 |
---|---|
core driver | drivers/iio/accel/adxl313_core.c |
spi driver | drivers/iio/accel/adxl313_spi.c |
i2c driver | drivers/iio/accel/adxl313_i2c.c |
header | drivers/iio/accel/adxl313.h |
Documentation | adi,adxl313.yaml |
Required devicetree properties:
Required properties for SPI bus usage:
Optional properties:
Example for a SPI device node:
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/interrupt-controller/irq.h> spi { #address-cells = <1>; #size-cells = <0>; /* Example for a SPI device node */ accelerometer@0 { compatible = "adi,adxl313"; reg = <0>; spi-max-frequency = <5000000>; interrupt-parent = <&gpio0>; interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "INT1"; }; };
Example for a I2C device node:
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/interrupt-controller/irq.h> i2c0 { #address-cells = <1>; #size-cells = <0>; /* Example for a I2C device node */ accelerometer@53 { compatible = "adi,adxl313"; reg = <0x53>; interrupt-parent = <&gpio0>; interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "INT1"; }; };
This specifies any shell prompt running on the target
root@analog:~# cd /sys/bus/iio/devices/ root@analog:/sys/bus/iio/devices# ls iio:device0 iio_sysfs_trigger root@analog:/sys/bus/iio/devices# cd iio\:device0 root@analog:/sys/bus/iio/devices/iio:device0# ls -l total 0 -r--r--r-- 1 root root 4096 Sep 23 14:33 dev -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_sampling_frequency -r--r--r-- 1 root root 4096 Sep 23 14:33 in_accel_sampling_frequency_available -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_scale -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_x_calibbias -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_x_raw -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_y_calibbias -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_y_raw -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_z_calibbias -rw-r--r-- 1 root root 4096 Sep 23 14:33 in_accel_z_raw -r--r--r-- 1 root root 4096 Sep 23 14:33 name lrwxrwxrwx 1 root root 0 Sep 23 14:33 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/adxl313@0 drwxr-xr-x 2 root root 0 Sep 23 14:33 power lrwxrwxrwx 1 root root 0 Sep 23 14:33 subsystem -> ../../../../../../../../bus/iio -rw-r--r-- 1 root root 4096 Sep 23 14:33 uevent
This specifies any shell prompt running on the target
root@analog:/sys/bus/iio/devices/iio:device0# cat name adxl313
Description:
scale to be applied to in_accel_*_raw in order to obtain the acceleration.
This specifies any shell prompt running on the target
root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_scale 0.009576806
Description:
Raw unscaled acceleration measurement on x axis
This specifies any shell prompt running on the target
root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_x_raw -14
This specifies any shell prompt running on the target
root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_sampling_frequency_available 6.250000 12.500000 25.000000 50.000000 100.000000 200.000000 400.000000 800.000000 1600.000000 3200.000000 root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_sampling_frequency 100.000000 root@analog:/sys/bus/iio/devices/iio:device0# echo 12.5 > in_accel_sampling_frequency root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_sampling_frequency 12.500000
This specifies any shell prompt running on the target
root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_z_calibbias 0 root@analog:/sys/bus/iio/devices/iio:device0# echo 4 > in_accel_z_calibbias root@analog:/sys/bus/iio/devices/iio:device0# cat in_accel_z_calibbias 4