This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
resources:tools-software:linux-drivers:iio-adc:ad7887 [18 Oct 2012 13:56] – [Buffer management] Lars-Peter Clausen | resources: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> | * [[adi> | ||
+ | |||
===== Description ===== | ===== Description ===== | ||
Line 25: | Line 26: | ||
^ Source | ^ Source | ||
- | | [[git.linux.org> | + | | [[git.linux.org> |
===== Files ===== | ===== Files ===== | ||
^ Function ^ File ^ | ^ Function ^ File ^ | ||
- | | driver | + | | driver |
- | | driver | + | | include |
- | | include | [[git.linux.org> | + | |
====== 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' | The reference volatage may vary between boards and models. The platform_data for the device' | ||
- | <source trunk/drivers/staging/ | + | <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 | ||
+ | | ||
+ | | ||
+ | | ||
+ | * @use_onchip_ref: Whether to use the onchip reference. If set to true the | ||
+ | | ||
+ | | ||
+ | */ | ||
+ | struct | ||
+ | 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, | ||
}; | }; | ||
</ | </ | ||
- | |||
===== 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> |
< | < | ||
Linux Kernel Configuration | Linux Kernel Configuration | ||
- | Device Drivers | + | |
- | [*] Staging drivers | + | ... |
- | < | + | < |
- | | + | --- Industrial I/O support |
- | -*- | + | ... |
- | -*- | + | Analog to digital converters |
- | -*- | + | ... |
- | + | < | |
- | *** Analog to digital converters | + | ... |
- | [--snip--] | + | ... |
- | + | ... | |
- | | + | |
- | + | ||
- | [--snip--] | + | |
</ | </ | ||
Line 185: | Line 194: | ||
{{page> | {{page> | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/> **cd / | root:/> **cd / | ||
Line 201: | Line 210: | ||
drwxr-xr-x | drwxr-xr-x | ||
-rw-r--r-- | -rw-r--r-- | ||
- | </ | + | </ |
Line 207: | Line 216: | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/ | root:/ | ||
ad7887 | ad7887 | ||
- | </ | + | </ |
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. | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/ | root:/ | ||
0.610 | 0.610 | ||
- | </ | + | </ |
=== 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 | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/ | root:/ | ||
1492 | 1492 | ||
- | </ | + | </ |
**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 ===== | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/ | root:/ | ||
**enable** | **enable** | ||
- | </ | + | </ |
{{page> | {{page> | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/ | root:/ | ||
in_voltage0_en | in_voltage0_en | ||
in_voltage0_index | in_voltage0_index | ||
- | </ | + | </ |
{{page> | {{page> |