This is an old revision of the document!
This is a Linux industrial I/O (IIO) subsystem driver, targeting temperature sensors. 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.
Source | Mainlined? |
---|---|
drivers/iio/temperature/ltc2983.c | yes |
Function | File |
---|---|
driver | drivers/iio/temperature/ltc2983.c |
The LTC2983 supports SPI interfaces. Currently, the devices can only be instantiated via device tree. All the sensors attached on the LTC2983 channels must be described and instantiated on the devicetree.
Required devicetree properties:
Example with thermoucouple and RTD:
spi0 { #address-cells = <1>; #size-cells = <0>; sensor_ltc2983: ltc2983@0 { compatible = "adi,ltc2983"; reg = <0>; #address-cells = <1>; #size-cells = <0>; adi,temperature-celcius; interrupts = <20 IRQ_TYPE_EDGE_RISING>; diode5: diode@5 { reg = <5>; adi,sensor-type = <28>; }; thermocouple@18 { reg = <18>; adi,sensor-type = <8>; //Type B adi,sensor-config = <1>; //Differential, open-circuit current adi,cold-junction-handle = <&diode5>; }; rsense2: rsense@2 { reg = <2>; adi,sensor-type = <29>; adi,rsense-val-micro-ohms = /bits/ 64 <1200000000>; //1.2Kohms }; rtd@14 { reg = <14>; adi,sensor-type = <15>; //PT1000 /*2-wire, internal gnd, no current rotation*/ adi,sensor-config = <1>; adi,excitation-current = <7>; //500uA adi,rsense-handle = <&rsense2>; }; }; };
For more details, look at bindings.
Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”).
The LTC2983 driver depends CONFIG_SPI.
Linux Kernel Configuration Device Drivers ---> <*> Industrial I/O support ---> --- Industrial I/O support [--snip--] Temperature sensors ---> [--snip--] -*- Analog Devices Multi-Sensor Digital Temperature Measurement System [--snip--]
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> cd iio:device0 root:/sys/bus/iio/devices/iio:device0> ls -l -r--r--r-- 1 root root 4096 Nov 16 11:17 dev -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp0_thermistor_raw -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp1_rtd_raw -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp2_diode_raw -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp3_thermocouple_raw -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp_scale -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_voltage0_direct_adc_raw -rw-r--r-- 1 root root 4096 Nov 16 11:17 in_voltage_scale -r--r--r-- 1 root root 4096 Nov 16 11:17 name lrwxrwxrwx 1 root root 0 Nov 16 11:17 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/ltc2983@0 drwxr-xr-x 2 root root 0 Nov 16 11:17 power lrwxrwxrwx 1 root root 0 Nov 16 11:17 subsystem -> ../../../../../../../../bus/iio -rw-r--r-- 1 root root 4096 Nov 16 11:17 uevent root:/sys/bus/iio/devices/iio:device0>
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat name ltc2983
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_temp0_thermistor_raw 1048576
Description:
scale to be applied to in_tempX_${sensor_type}_raw in order to obtain the measured temperature in °C or °F (depending on chip configuration).
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_temp_scale 0.000976562
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_direct_adc_raw 2621440
Description:
scale to be applied to in_voltageX_direct_adc_raw in order to obtain the measured voltage in Volts
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_voltage_scale 0.000000476