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-adc:ad7887 [18 Oct 2012 13:56] – [Buffer management] Lars-Peter Clausenresources:tools-software:linux-drivers:iio-adc:ad7887 [18 Feb 2013 15:25] – [Example platform device initialization] replace spaces with tabs Lars-Peter Clausen
Line 14: Line 14:
  
   * [[adi>EVAL-AD7887CBZ]]   * [[adi>EVAL-AD7887CBZ]]
 +
 ===== Description ===== ===== Description =====
  
Line 25: Line 26:
  
 ^  Source  ^  Mainlined?  ^ ^  Source  ^  Mainlined?  ^
-| [[git.linux.org>drivers/staging/iio/adc/ad7887_core.c|git]] |  [[git.linux.org>drivers/staging/iio/adc/ad7887_core.c|Yes]]  |+| [[git.linux.org>drivers/iio/adc/ad7887.c|git]] |  [[git.linux.org>drivers/iio/adc/ad7887.c|Yes]]  | 
 ===== Files ===== ===== Files =====
  
 ^ Function ^ File ^ ^ Function ^ File ^
-| driver  | [[git.linux.org>drivers/staging/iio/adc/ad7887_core.c]] | +| driver  | [[git.linux.org>drivers/iio/adc/ad7887.c]] | 
-driver  | [[git.linux.org>drivers/staging/iio/adc/ad7887_ring.c]] | +include | [[git.linux.org>include/linux/platform_data/ad7887.h]] |
-| include | [[git.linux.org>drivers/staging/iio/adc/ad7887.h]] | +
 ====== Example platform device initialization ====== ====== Example platform device initialization ======
  
Line 39: Line 39:
 The reference volatage may vary between boards and models. The platform_data for the device's "struct device" holds this information. The reference volatage may vary between boards and models. The platform_data for the device's "struct device" holds this information.
  
-<source trunk/drivers/staging/iio/adc/ad7887.h:ad7887_platform_data{} c linux-kernel>+<code c> 
 +/** 
 + * struct ad7887_platform_data - AD7887 ADC driver platform data 
 + * @en_dual: Whether to use dual channel mode. If set to true AIN1 becomes the 
 +  second input channel, and Vref is internally connected to Vdd. If set to 
 +  false the device is used in single channel mode and AIN1/Vref is used as 
 +  VREF input. 
 + * @use_onchip_refWhether to use the onchip reference. If set to true the 
 +  internal 2.5V reference is used. If set to false a external reference is 
 +  used. 
 + */ 
 +struct ad7887_platform_data { 
 + bool en_dual; 
 + bool use_onchip_ref; 
 +}
 +</code>
  
 <code c> <code c>
 static struct ad7887_platform_data ad7887_pdata = { static struct ad7887_platform_data ad7887_pdata = {
- .vref_mv = 2500, 
  .en_dual = false,  .en_dual = false,
  .use_onchip_ref = false,  .use_onchip_ref = false,
 }; };
 </code> </code>
- 
 ===== Specifying reference voltage via the regulator framework ===== ===== Specifying reference voltage via the regulator framework =====
  
-<note tip>+<WRAP tip>
 This driver supports also an alternative way of specifying the reference voltage, by using the Linux regulator framework. This driver supports also an alternative way of specifying the reference voltage, by using the Linux regulator framework.
-</note>+</WRAP>
  
 Below example specifies a 2.5 Volt reference for the SPI device 3 on SPI-Bus 0. (**spi0.3**) Below example specifies a 2.5 Volt reference for the SPI device 3 on SPI-Bus 0. (**spi0.3**)
Line 155: Line 168:
 "make qconfig") "make qconfig")
  
-<note>+<WRAP round help>
 The AD7887 Driver depends on **CONFIG_SPI** The AD7887 Driver depends on **CONFIG_SPI**
-</note>+</WRAP>
  
 <code> <code>
 Linux Kernel Configuration Linux Kernel Configuration
- Device Drivers  ---> +    Device Drivers  ---> 
- [*] Staging drivers  ---> +        ... 
- <*>     Industrial I/O support ---> +        <*>     Industrial I/O support ---> 
-     --- Industrial I/O support +            --- Industrial I/O support 
-     -*-   Enable ring buffer support within IIO +            ... 
-     -*-     Industrial I/O lock free software ring +            Analog to digital converters  --- 
-     -*-   Enable triggered sampling support +                ... 
- +                <*>  Analog Devices AD7887 ADC driver 
-           *** Analog to digital converters *** +                ... 
-     [--snip--] +            ... 
- +        ...
-     <*>   Analog Devices AD7887 ADC driver +
- +
-     [--snip--] +
 </code> </code>
  
Line 185: Line 194:
 {{page>software:linux:docs:iio:iio_snippets#iio device files&noheader&firstseconly&noeditbtn}} {{page>software:linux:docs:iio:iio_snippets#iio device files&noheader&firstseconly&noeditbtn}}
  
-<box 100% green|shell prompt running on the target>+<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 <xterm> <xterm>
 root:/> **cd /sys/bus/iio/devices/** root:/> **cd /sys/bus/iio/devices/**
Line 201: Line 210:
 drwxr-xr-x    2 root     root             0 Jan  1 00:00 trigger drwxr-xr-x    2 root     root             0 Jan  1 00:00 trigger
 -rw-r--r--    1 root     root          4096 Jan  1 00:00 uevent -rw-r--r--    1 root     root          4096 Jan  1 00:00 uevent
-</xterm></box>+</xterm></WRAP>
  
  
Line 207: Line 216:
  
  
-<box 100% green|shell prompt running on the target>+<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 <xterm> <xterm>
 root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat name** root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat name**
 ad7887 ad7887
-</xterm></box>+</xterm></WRAP>
  
  
Line 219: Line 228:
 scale to be applied to in0_raw in order to obtain the measured voltage in millivolts. scale to be applied to in0_raw in order to obtain the measured voltage in millivolts.
  
-<box 100% green|shell prompt running on the target>+<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 <xterm> <xterm>
 root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat in_voltage_scale** root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat in_voltage_scale**
 0.610 0.610
-</xterm></box>+</xterm></WRAP>
  
 === Show channel 0 measurement === === Show channel 0 measurement ===
Line 230: Line 239:
 Raw unscaled voltage measurement on channel 0 Raw unscaled voltage measurement on channel 0
  
-<box 100% green|shell prompt running on the target>+<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 <xterm> <xterm>
 root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat in_voltage0_raw** root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat in_voltage0_raw**
 1492 1492
-</xterm></box>+</xterm></WRAP>
  
 **U** = //in0_raw * in_scale// = 1492 * 0.610 = **910.12 //mV//** **U** = //in0_raw * in_scale// = 1492 * 0.610 = **910.12 //mV//**
Line 247: Line 256:
 ===== Buffer management ===== ===== Buffer management =====
  
-<box 100% green|shell prompt running on the target>+<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 <xterm> <xterm>
 root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0/buffer> ls root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0/buffer> ls
 **enable**                  **length** **enable**                  **length**
  
-</xterm></box>+</xterm></WRAP>
  
 {{page>software:linux:docs:iio:iio_snippets#Buffer management&noheader&firstseconly&noeditbtn}} {{page>software:linux:docs:iio:iio_snippets#Buffer management&noheader&firstseconly&noeditbtn}}
  
-<box 100% green|shell prompt running on the target>+<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 <xterm> <xterm>
 root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0/scan_elements> ls root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0/scan_elements> ls
 in_voltage0_en           in_voltage0_type    timestamp_index in_voltage0_en           in_voltage0_type    timestamp_index
 in_voltage0_index        timestamp_en        timestamp_type in_voltage0_index        timestamp_en        timestamp_type
-</xterm></box>+</xterm></WRAP>
  
 {{page>software:linux:docs:iio:iio_snippets#Typical ADC scan elements&noheader&firstseconly&noeditbtn}} {{page>software:linux:docs:iio:iio_snippets#Typical ADC scan elements&noheader&firstseconly&noeditbtn}}
resources/tools-software/linux-drivers/iio-adc/ad7887.txt · Last modified: 27 Apr 2016 17:12 by Lars-Peter Clausen