Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
resources:tools-software:linux-drivers:iio-dac:ad5593r [22 Feb 2016 17:52] – [Device tree example] Michael Hennerichresources:tools-software:linux-drivers:iio-dac:ad5593r [23 Feb 2016 14:17] – [Driver testing] Michael Hennerich
Line 26: Line 26:
  
 The AD5593R have an integrated 2.5 V, 25 ppm/°C reference, which is turned off by default, and an integrated temperature indicator, which gives an indication of the die temperature. The temperature value is read back as part of an ADC read sequence. The AD5593R have an integrated 2.5 V, 25 ppm/°C reference, which is turned off by default, and an integrated temperature indicator, which gives an indication of the die temperature. The temperature value is read back as part of an ADC read sequence.
 +
 +====== Source Code ======
 +
 +===== Status =====
 +
 +^ Source ^ Mainlined? ^
 +| [[linux.github>xcomm_zynq?drivers/iio/dac/ad5592r-base.c|git]] | WIP |
 +
 +===== Files =====
 +
 +^ Function ^ File ^
 +| driver  | [[linux.github>xcomm_zynq?drivers/iio/dac/ad5592r-base.c | drivers/iio/dac/ad5592r-base.c]] |
 +| include  | [[linux.github>xcomm_zynq?drivers/iio/dac/ad5592r-base.h | drivers/iio/dac/ad5592r-base.h]] |
 +| driver  | [[linux.github>xcomm_zynq?drivers/iio/dac/ad5593r.c | drivers/iio/dac/ad5593r.c]] |
 +| include  | [[linux.github>xcomm_zynq?include/dt-bindings/iio/adi,ad5592r.h | include/dt-bindings/iio/adi,ad5592r.h]] |
 +| Documentation  | [[linux.github>xcomm_zynq?Documentation/devicetree/bindings/iio/dac/ad5592r.txt | Documentation/devicetree/bindings/iio/dac/ad5592r.txt]] |
  
 ====== Hardware configuration ====== ====== Hardware configuration ======
Line 164: Line 180:
                                 attr 2: scale value: 452.147700000                                 attr 2: scale value: 452.147700000
  
 +</code>
 +=== IIO sysfs interface ===
 +
 +<code>
 +root@linaro-ubuntu-desktop:/sys/bus/iio/devices/iio:device2# ls -al
 +total 0
 +drwxr-xr-x 3 root root    0 Jan  1  1970 .
 +drwxr-xr-x 5 root root    0 Jan  1  1970 ..
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 dev
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_temp_offset
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_temp_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_temp_scale
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage1_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage2_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage3_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage_scale
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage_scale_available
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 name
 +lrwxrwxrwx 1 root root    0 Jan  1  1970 of_node -> ../../../../../../../firmware/devicetree/base/amba/i2c@e0004000/ad5593r@10
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 out_voltage0_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 out_voltage2_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 out_voltage3_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 out_voltage_scale
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 out_voltage_scale_available
 +drwxrwxrwx 2 root root    0 Jan  1  1970 power
 +lrwxrwxrwx 1 root root    0 Jan  1  1970 subsystem -> ../../../../../../../bus/iio
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 uevent
 +root@linaro-ubuntu-desktop:/sys/bus/iio/devices/iio:device2# 
 +</code>
 +
 +<code>
 +root@linaro-ubuntu-desktop:/sys/bus/iio/devices/iio:device2# grep "" *
 +dev:252:2
 +in_temp_offset:-753
 +in_temp_raw:810
 +in_temp_scale:376.789750000
 +in_voltage1_raw:0
 +in_voltage2_raw:0
 +in_voltage3_raw:0
 +in_voltage_scale:0.610351562
 +in_voltage_scale_available:0.610351562 1.220703124
 +name:ad5592r
 +out_voltage0_raw:0
 +out_voltage2_raw:0
 +out_voltage3_raw:0
 +out_voltage_scale:0.610351562
 +out_voltage_scale_available:0.610351562 1.220703124
 +uevent:MINOR=2
 +uevent:DEVNAME=iio:device2
 +uevent:DEVTYPE=iio_device
 +uevent:OF_NAME=ad5593r
 +uevent:OF_FULLNAME=/amba/i2c@e0004000/ad5593r@10
 +uevent:OF_COMPATIBLE_0=adi,ad5593r
 +uevent:OF_COMPATIBLE_N=1
 +</code>
 +
 +== Example obtaining the temperature in °C ==
 +
 +
 +
 +T =  ( in_temp_raw + in_temp_offset ) * in_temp_scale
 +
 +T = ( 810 - 753 ) * 376.78975 =  21477 mdeg C = 21.5 °C
 +
 +For more information see also here: [[git.linux.org>Documentation/ABI/testing/sysfs-bus-iio | IIO Kernel Documentation]]
 +
 +=== GPIO Testing  ===
 +
 +The GPIO sysfs interface allows users to manipulate any GPIO from userspace. Userspace utilizes a sysfs control interface to dynamically request and release individual GPIOs. Once a GPIO has been requested, writing to the newly created path allows you to control the direction and the data while reading from it returns the GPIO data (which usually corresponds to a 0 or 1 which represents the signal level).
 +
 +For more information see also here: [[git.linux.org>Documentation/gpio/sysfs.txt | GPIO Kernel Documentation]]
 +
 +<code>
 +root@linaro-ubuntu-desktop:~# cd /sys/class/gpio/
 +root@linaro-ubuntu-desktop:/sys/class/gpio# ls
 +export  gpiochip890  gpiochip898  gpiochip906  unexport
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio# cd gpiochip890
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpiochip890# ls -al
 +total 0
 +drwxr-xr-x 3 root root    0 Jan  1  1970 .
 +drwxr-xr-x 3 root root    0 Jan  1  1970 ..
 +-r--r--r-- 1 root root 4096 Feb 23 08:06 base
 +lrwxrwxrwx 1 root root    0 Feb 23 08:06 device -> ../../../0-0010
 +-r--r--r-- 1 root root 4096 Feb 23 08:06 label
 +-r--r--r-- 1 root root 4096 Feb 23 08:06 ngpio
 +drwxr-xr-x 2 root root    0 Feb 23 08:06 power
 +lrwxrwxrwx 1 root root    0 Jan  1  1970 subsystem -> ../../../../../../../../class/gpio
 +-rw-r--r-- 1 root root 4096 Jan  1  1970 uevent
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpiochip890# grep "" *
 +base:890
 +label:0-0010
 +ngpio:8
 +
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpiochip890# cd ..
 +root@linaro-ubuntu-desktop:/sys/class/gpio# echo 897 > export 
 +root@linaro-ubuntu-desktop:/sys/class/gpio# cd gpio897/
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# ls -al
 +total 0
 +drwxr-xr-x 3 root root    0 Feb 23 08:06 .
 +drwxr-xr-x 4 root root    0 Feb 23 08:06 ..
 +-rw-r--r-- 1 root root 4096 Feb 23 08:06 active_low
 +lrwxrwxrwx 1 root root    0 Feb 23 08:06 device -> ../../../0-0010
 +-rw-r--r-- 1 root root 4096 Feb 23 08:06 direction
 +drwxr-xr-x 2 root root    0 Feb 23 08:06 power
 +lrwxrwxrwx 1 root root    0 Feb 23 08:06 subsystem -> ../../../../../../../../class/gpio
 +-rw-r--r-- 1 root root 4096 Feb 23 08:06 uevent
 +-rw-r--r-- 1 root root 4096 Feb 23 08:06 value
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# cat direction 
 +in
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# cat value 
 +0
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# echo low > direction 
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# cat direction 
 +out
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# cat value 
 +0
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# echo high > direction                                                                                                                                    
 +
 +root@linaro-ubuntu-desktop:/sys/class/gpio/gpio897# cat value 
 +1
 </code> </code>
resources/tools-software/linux-drivers/iio-dac/ad5593r.txt · Last modified: 19 Jan 2018 10:12 by Alexandru Ardelean