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
resources:tools-software:linux-drivers:iio-adc:ad7291 [06 Mar 2015 10:03] – update Michael Hennerichresources: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   Mainlined?  +^ Source ^ Mainlined? ^ 
-| [[staging.kernel.org>drivers/staging/iio/adc/ad7291.c|git]] |  [[git.linux.org>drivers/staging/iio/adc/ad7291.c|Yes]]  |+| [[git.linux.org>drivers/iio/adc/ad7291.c|git]] | [[git.linux.org>drivers/iio/adc/ad7291.c|Yes]] |
 ===== Files ===== ===== Files =====
  
 ^ Function ^ File ^ ^ Function ^ File ^
-| driver  | [[staging.kernel.org>drivers/staging/iio/adc/ad7291.c]] |+| driver  | [[git.linux.org>drivers/iio/adc/ad7291.c]] |
  
 ====== 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.
 +</WRAP>
 +
 +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("vcc", "0-002a"),
 +};
 +
 +static struct regulator_init_data board_avdd_reg_init_data = {
 + .constraints = {
 + .name = "3V3",
 + .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 = "board-3V3",
 + .microvolts = 3300000,
 + .gpio = -EINVAL,
 + .enabled_at_boot = 0,
 + .init_data = &board_avdd_reg_init_data,
 +};
 +static struct platform_device brd_voltage_regulator = {
 + .name = "reg-fixed-voltage",
 + .id = -1,
 + .num_resources = 0,
 + .dev = {
 + .platform_data = &board_vdd_pdata,
 + },
 +};
 +#endif
 +</code>
 +
 +<code c>
 +static struct platform_device *board_devices[] __initdata = {
 +#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
 + &brd_voltage_regulator
 +#endif
 +};
 +</code>
 +
 +
 +<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>
  
  
resources/tools-software/linux-drivers/iio-adc/ad7291.1425632638.txt.gz · Last modified: 06 Mar 2015 10:03 by Michael Hennerich