This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | resources:tools-software:linux-drivers:iio-adc:ad7998 [15 Nov 2012 14:58] – [Reference Circuit Notes] Add more Circuit Notes Lars-Peter Clausen | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== AD7998 IIO ADC Linux Driver ====== | ||
+ | ===== Supported Devices ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | |||
+ | ===== Reference Circuit Notes ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | ===== Evaluation Boards ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | This is a Linux industrial I/O ([[software: | ||
+ | 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 [[software: | ||
+ | |||
+ | ====== Source Code ====== | ||
+ | |||
+ | ===== Status ===== | ||
+ | |||
+ | ^ Source | ||
+ | | [[git.linux.org> | ||
+ | ===== Files ===== | ||
+ | |||
+ | ^ Function ^ File ^ | ||
+ | | driver | ||
+ | | driver | ||
+ | | include | [[git.linux.org> | ||
+ | |||
+ | ====== Example platform device initialization ====== | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | The reference voltage may vary between boards and models. The platform_data for the device' | ||
+ | |||
+ | <source trunk/ | ||
+ | |||
+ | <code c> | ||
+ | static struct ad799x_platform_data ad7998_pdata = { | ||
+ | .vref_mv = 2500, | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | <note tip> | ||
+ | In case platform_data is not present or set to NULL, the driver will use the AD7998 internal reference. | ||
+ | </ | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | Depending on the converter IC used, you may need to set the I2C_BOARD_INFO name accordingly, | ||
+ | |||
+ | <code c> | ||
+ | static struct i2c_board_info __initdata board_i2c_board_info[] = { | ||
+ | #if defined(CONFIG_AD799X) || defined(CONFIG_AD799X_MODULE) | ||
+ | { | ||
+ | I2C_BOARD_INFO(" | ||
+ | .platform_data = & | ||
+ | .irq = IRQ_PG0, | ||
+ | }, | ||
+ | #endif | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | <code c> | ||
+ | static int __init board_init(void) | ||
+ | { | ||
+ | [--snip--] | ||
+ | |||
+ | i2c_register_board_info(0, | ||
+ | ARRAY_SIZE(board_i2c_board_info)); | ||
+ | [--snip--] | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | arch_initcall(board_init); | ||
+ | </ | ||
+ | |||
+ | ====== Adding Linux drive | ||
+ | r support ====== | ||
+ | |||
+ | Configure kernel with "make menuconfig" | ||
+ | "make qconfig" | ||
+ | |||
+ | < | ||
+ | The AD7998 Driver depends on **CONFIG_I2C** | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Linux Kernel Configuration | ||
+ | Device Drivers | ||
+ | [*] Staging drivers | ||
+ | < | ||
+ | --- Industrial I/O support | ||
+ | -*- | ||
+ | -*- | ||
+ | -*- | ||
+ | |||
+ | *** Analog to digital converters *** | ||
+ | [--snip--] | ||
+ | |||
+ | < | ||
+ | -*- | ||
+ | |||
+ | [--snip--] | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Hardware configuration ====== | ||
+ | |||
+ | |||
+ | ====== Driver testing ====== | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | <box 100% green|shell prompt running on the target> | ||
+ | < | ||
+ | root:/> **cd / | ||
+ | root:/ | ||
+ | iio: | ||
+ | |||
+ | |||
+ | root:/ | ||
+ | |||
+ | root:/ | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | lrwxrwxrwx | ||
+ | drwxr-xr-x | ||
+ | -rw-r--r-- | ||
+ | </ | ||
+ | |||
+ | === Show device name === | ||
+ | |||
+ | <box 100% green|shell prompt running on the target> | ||
+ | < | ||
+ | root:/ | ||
+ | ad7998 | ||
+ | </ | ||
+ | |||
+ | === Show scale === | ||
+ | |||
+ | **Description: | ||
+ | scale to be applied to in_voltage0_raw in order to obtain the measured voltage in millivolts. | ||
+ | |||
+ | <box 100% green|shell prompt running on the target> | ||
+ | < | ||
+ | root:/ | ||
+ | 1.000 | ||
+ | </ | ||
+ | |||
+ | === Show channel 0 measurement === | ||
+ | |||
+ | **Description: | ||
+ | Raw unscaled voltage measurement on channel 0 | ||
+ | |||
+ | <box 100% green|shell prompt running on the target> | ||
+ | < | ||
+ | root:/ | ||
+ | 1491 | ||
+ | </ | ||
+ | |||
+ | **U** = // | ||
+ | |||
+ | ===== Trigger management ===== | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | ==== Available standalone trigger drivers ==== | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | ===== Buffer management ===== | ||
+ | |||
+ | <box 100% green|shell prompt running on the target> | ||
+ | < | ||
+ | root:/ | ||
+ | **enable** | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | <box 100% green|shell prompt running on the target> | ||
+ | < | ||
+ | root:/ | ||
+ | in_voltage0_en | ||
+ | in_voltage0_index | ||
+ | in_voltage1_en | ||
+ | in_voltage1_index | ||
+ | in_voltage2_en | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | {{page> | ||
+ | |||
+ | |||
+ | ====== More Information ====== | ||
+ | |||
+ | {{page> |