This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:tools-software:linux-drivers:iio-adc:ad7998 [26 Aug 2011 21:50] – [Supported Devices] Michael Hennerich | resources:tools-software:linux-drivers:iio-adc:ad7998 [05 Jan 2021 16:01] (current) – Removed old references Ioana Chelaru | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== AD7998 | + | ====== AD7998 |
===== Supported Devices ===== | ===== Supported Devices ===== | ||
- | This driver supports the\\ | + | * [[adi> |
- | [[adi> | + | |
- | [[adi> | + | |
- | [[adi> | + | |
- | [[adi> | + | |
- | [[adi> | + | |
- | [[adi> | + | |
- | [[adi> | + | |
- | [[adi> | + | |
+ | |||
+ | ===== Reference Circuits ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | ===== Evaluation Boards ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
===== Description ===== | ===== Description ===== | ||
Line 23: | Line 38: | ||
===== Status ===== | ===== Status ===== | ||
- | ^ Source | + | ^ Source ^ Mainlined? ^ |
- | | [[bfgit>linux-kernel?drivers/staging/iio/adc/ad799x_core.c|git]] | [[git.linux.org> | + | | [[git.linux.org>drivers/ |
===== Files ===== | ===== Files ===== | ||
^ Function ^ File ^ | ^ Function ^ File ^ | ||
- | | driver | + | | driver |
- | | driver | + | |
- | | include | [[git.linux.org> | + | |
====== Example platform device initialization ====== | ====== Example platform device initialization ====== | ||
Line 36: | Line 50: | ||
{{page> | {{page> | ||
- | The reference voltage may vary between boards and models. The platform_data for the device' | ||
- | <source trunk/drivers/ | + | ===== Specifying reference voltage via the regulator framework ===== |
+ | |||
+ | <WRAP tip> | ||
+ | In case the AD799x on-chip reference is not used, | ||
+ | this driver requires specifying the reference voltage, by using the Linux regulator framework. | ||
+ | </WRAP> | ||
+ | |||
+ | Below example specifies a 2.5 Volt reference for the I2C device 0-0024 on I2C-Bus 0. (**0-0024**) | ||
<code c> | <code c> | ||
- | static struct | + | #if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) |
- | .vref_mv = 2500, | + | static struct |
+ | REGULATOR_SUPPLY(" | ||
}; | }; | ||
+ | |||
+ | static struct regulator_init_data board_avdd_reg_init_data = { | ||
+ | .constraints = { | ||
+ | .name = " | ||
+ | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
+ | }, | ||
+ | .consumer_supplies = ad7998_consumer_supplies, | ||
+ | .num_consumer_supplies = ARRAY_SIZE(ad7998_consumer_supplies), | ||
+ | }; | ||
+ | |||
+ | static struct fixed_voltage_config board_vref_pdata = { | ||
+ | .supply_name = " | ||
+ | .microvolts = 2500000, | ||
+ | .gpio = -EINVAL, | ||
+ | .enabled_at_boot = 0, | ||
+ | .init_data = & | ||
+ | }; | ||
+ | static struct platform_device brd_voltage_regulator = { | ||
+ | .name = " | ||
+ | .id = -1, | ||
+ | .num_resources = 0, | ||
+ | .dev = { | ||
+ | .platform_data = & | ||
+ | }, | ||
+ | }; | ||
+ | #endif | ||
</ | </ | ||
- | <note tip> | + | <code c> |
- | In case platform_data is not present or set to NULL, the driver will use the AD7998 internal reference. | + | static struct platform_device *board_devices[] __initdata = { |
- | </note> | + | #if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) |
+ | & | ||
+ | #endif | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | <code c> | ||
+ | static int __init board_init(void) | ||
+ | { | ||
+ | [--snip--] | ||
+ | |||
+ | platform_add_devices(board_devices, ARRAY_SIZE(board_devices)); | ||
+ | |||
+ | [--snip--] | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | arch_initcall(board_init); | ||
+ | </code> | ||
{{page> | {{page> | ||
Line 59: | Line 124: | ||
{ | { | ||
I2C_BOARD_INFO(" | I2C_BOARD_INFO(" | ||
- | .platform_data = (void *)& | + | .platform_data = & |
.irq = IRQ_PG0, | .irq = IRQ_PG0, | ||
}, | }, | ||
Line 80: | Line 145: | ||
</ | </ | ||
- | ====== Adding Linux drive | + | ===== Devicetree ===== |
- | r support ====== | + | |
+ | Required devicetree properties: | ||
+ | * compatible: Needs to be " | ||
+ | * reg: The slave address used for the device | ||
+ | * vcc-supply: Phandle to the supply regulator | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | }; | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | }; | ||
+ | |||
+ | i2c: i2c@e0007000 { | ||
+ | # | ||
+ | # | ||
+ | | ||
+ | ... | ||
+ | |||
+ | | ||
+ | | ||
+ | reg = < | ||
+ | | ||
+ | | ||
+ | }; | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | ====== Adding Linux driver | ||
Configure kernel with "make menuconfig" | Configure kernel with "make menuconfig" | ||
"make qconfig" | "make qconfig" | ||
- | <note> | + | <WRAP round help> |
The AD7998 Driver depends on **CONFIG_I2C** | The AD7998 Driver depends on **CONFIG_I2C** | ||
- | </note> | + | </WRAP> |
< | < | ||
Line 117: | Line 218: | ||
{{page> | {{page> | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/> **cd / | root:/> **cd / | ||
root:/ | root:/ | ||
- | device0 | + | iio:device0 |
- | device0: | + | |
root:/ | root:/ | ||
- | root:/ | + | root:/ |
- | drwxr-xr-x | + | drwxr-xr-x |
- | 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-- |
- | -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 | lrwxrwxrwx | ||
drwxr-xr-x | drwxr-xr-x | ||
-rw-r--r-- | -rw-r--r-- | ||
- | </ | + | </ |
=== Show device name === | === Show device name === | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
ad7998 | ad7998 | ||
- | </ | + | </ |
=== Show scale === | === Show scale === | ||
**Description: | **Description: | ||
- | scale to be applied to in0_raw | + | scale to be applied to in_voltage0_raw |
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
1.000 | 1.000 | ||
- | </ | + | </ |
=== Show channel 0 measurement === | === Show channel 0 measurement === | ||
Line 168: | Line 269: | ||
Raw unscaled voltage measurement on channel 0 | Raw unscaled voltage measurement on channel 0 | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
1491 | 1491 | ||
- | </ | + | </ |
- | **U** = //in0_raw | + | **U** = //in_voltage0_raw |
===== Trigger management ===== | ===== Trigger management ===== | ||
Line 186: | Line 287: | ||
===== Buffer management ===== | ===== Buffer management ===== | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
- | **bytes_per_datum** | + | **enable** |
- | device0: | + | root:/ |
- | device0: | + | </ |
- | root:/ | + | |
- | </ | + | |
{{page> | {{page> | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
- | in0_en | + | in_voltage0_en |
- | in0_index | + | in_voltage0_index |
- | in1_en | + | in_voltage1_en |
- | in1_index | + | in_voltage1_index |
- | in2_en | + | in_voltage2_en |
- | root:/ | + | root:/ |
- | </ | + | </ |