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:ad7291 [06 Mar 2015 10:03] – update Michael Hennerich | resources:tools-software:linux-drivers:iio-adc:ad7291 [20 Dec 2016 10:24] (current) – fix links Lars-Peter Clausen | ||
---|---|---|---|
Line 18: | Line 18: | ||
===== Status ===== | ===== Status ===== | ||
- | ^ Source | + | ^ Source ^ Mainlined? ^ |
- | | [[staging.kernel.org> | + | | [[git.linux.org> |
===== Files ===== | ===== Files ===== | ||
^ Function ^ File ^ | ^ Function ^ File ^ | ||
- | | driver | + | | driver |
====== Example platform device initialization ====== | ====== Example platform device initialization ====== | ||
+ | ===== Specifying reference voltage via the regulator framework ===== | ||
+ | <WRAP tip> | ||
+ | In case the AD7291 on-chip 2.5V reference is not used, | ||
+ | this driver requires specifying the reference voltage, by using the Linux regulator framework. | ||
+ | </ | ||
+ | |||
+ | Below example specifies a 3.3 Volt reference for the I2C device 0-002a on I2C-Bus 0. (**0-002a**) | ||
+ | |||
+ | <code c> | ||
+ | #if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) | ||
+ | static struct regulator_consumer_supply ad7291_consumer_supplies[] = { | ||
+ | REGULATOR_SUPPLY(" | ||
+ | }; | ||
+ | |||
+ | static struct regulator_init_data board_avdd_reg_init_data = { | ||
+ | .constraints = { | ||
+ | .name = " | ||
+ | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
+ | }, | ||
+ | .consumer_supplies = ad7291_consumer_supplies, | ||
+ | .num_consumer_supplies = ARRAY_SIZE(ad7291_consumer_supplies), | ||
+ | }; | ||
+ | |||
+ | static struct fixed_voltage_config board_vdd_pdata = { | ||
+ | .supply_name = " | ||
+ | .microvolts = 3300000, | ||
+ | .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 | ||
+ | </ | ||
+ | |||
+ | <code c> | ||
+ | static struct platform_device *board_devices[] __initdata = { | ||
+ | #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, | ||
+ | |||
+ | [--snip--] | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | arch_initcall(board_init); | ||
+ | </ | ||