diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2010-06-02 01:00:21 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-10-22 03:48:50 -0400 |
commit | 1b04cbeabdbda802c53f4bf85cd9db0c82643152 (patch) | |
tree | b444ff041e96fe2f7ed6c60afc4f8a6e4558d0ed /arch | |
parent | 2adcf194cbf3ec5181efa8e7af180e2c9f1a63e2 (diff) |
Blackfin: bf537-stamp: re-use the fixed regulator voltage driver
Rather than write our own ADP switch driver, use the existing fixed
regulator driver and rewrite the platform resources accordingly.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/mach-bf537/boards/stamp.c | 80 |
1 files changed, 25 insertions, 55 deletions
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index 328f002f76a0..3888b43e1b31 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c | |||
@@ -35,12 +35,13 @@ | |||
35 | #include <asm/reboot.h> | 35 | #include <asm/reboot.h> |
36 | #include <asm/portmux.h> | 36 | #include <asm/portmux.h> |
37 | #include <asm/dpmc.h> | 37 | #include <asm/dpmc.h> |
38 | #ifdef CONFIG_REGULATOR_ADP_SWITCH | 38 | #ifdef CONFIG_REGULATOR_FIXED_VOLTAGE |
39 | #include <linux/regulator/adp_switch.h> | 39 | #include <linux/regulator/fixed.h> |
40 | #endif | 40 | #endif |
41 | #ifdef CONFIG_REGULATOR_AD5398 | 41 | #ifdef CONFIG_REGULATOR_AD5398 |
42 | #include <linux/regulator/ad5398.h> | 42 | #include <linux/regulator/ad5398.h> |
43 | #endif | 43 | #endif |
44 | #include <linux/regulator/machine.h> | ||
44 | #include <linux/regulator/consumer.h> | 45 | #include <linux/regulator/consumer.h> |
45 | #include <linux/regulator/userspace-consumer.h> | 46 | #include <linux/regulator/userspace-consumer.h> |
46 | 47 | ||
@@ -2590,50 +2591,38 @@ static struct platform_device bfin_ac97 = { | |||
2590 | }; | 2591 | }; |
2591 | #endif | 2592 | #endif |
2592 | 2593 | ||
2593 | #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE) | 2594 | #if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) |
2594 | #define REGULATOR_ADP122 "adp122" | 2595 | #define REGULATOR_ADP122 "adp122" |
2595 | #define REGULATOR_ADP150 "adp150" | 2596 | #define REGULATOR_ADP122_UV 2500000 |
2596 | 2597 | ||
2597 | static struct regulator_consumer_supply adp122_consumers = { | 2598 | static struct regulator_consumer_supply adp122_consumers = { |
2598 | .supply = REGULATOR_ADP122, | 2599 | .supply = REGULATOR_ADP122, |
2599 | }; | 2600 | }; |
2600 | 2601 | ||
2601 | static struct regulator_consumer_supply adp150_consumers = { | 2602 | static struct regulator_init_data adp_switch_regulator_data = { |
2602 | .supply = REGULATOR_ADP150, | 2603 | .constraints = { |
2603 | }; | 2604 | .name = REGULATOR_ADP122, |
2604 | 2605 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
2605 | static struct regulator_init_data adp_switch_regulator_data[] = { | 2606 | .min_uV = REGULATOR_ADP122_UV, |
2606 | { | 2607 | .max_uV = REGULATOR_ADP122_UV, |
2607 | .constraints = { | 2608 | .min_uA = 0, |
2608 | .name = REGULATOR_ADP122, | 2609 | .max_uA = 300000, |
2609 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
2610 | .min_uA = 0, | ||
2611 | .max_uA = 300000, | ||
2612 | }, | ||
2613 | .num_consumer_supplies = 1, /* only 1 */ | ||
2614 | .consumer_supplies = &adp122_consumers, | ||
2615 | .driver_data = (void *)GPIO_PF2, /* gpio port only */ | ||
2616 | }, | ||
2617 | { | ||
2618 | .constraints = { | ||
2619 | .name = REGULATOR_ADP150, | ||
2620 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
2621 | .min_uA = 0, | ||
2622 | .max_uA = 150000, | ||
2623 | }, | ||
2624 | .num_consumer_supplies = 1, /* only 1 */ | ||
2625 | .consumer_supplies = &adp150_consumers, | ||
2626 | .driver_data = (void *)GPIO_PF3, /* gpio port only */ | ||
2627 | }, | 2610 | }, |
2611 | .num_consumer_supplies = 1, /* only 1 */ | ||
2612 | .consumer_supplies = &adp122_consumers, | ||
2628 | }; | 2613 | }; |
2629 | 2614 | ||
2630 | static struct adp_switch_platform_data adp_switch_pdata = { | 2615 | static struct fixed_voltage_config adp_switch_pdata = { |
2631 | .regulator_num = ARRAY_SIZE(adp_switch_regulator_data), | 2616 | .supply_name = REGULATOR_ADP122, |
2632 | .regulator_data = adp_switch_regulator_data, | 2617 | .microvolts = REGULATOR_ADP122_UV, |
2618 | .gpio = GPIO_PF2, | ||
2619 | .enable_high = 1, | ||
2620 | .enabled_at_boot = 0, | ||
2621 | .init_data = &adp_switch_regulator_data, | ||
2633 | }; | 2622 | }; |
2634 | 2623 | ||
2635 | static struct platform_device adp_switch_device = { | 2624 | static struct platform_device adp_switch_device = { |
2636 | .name = "adp_switch", | 2625 | .name = "reg-fixed-voltage", |
2637 | .id = 0, | 2626 | .id = 0, |
2638 | .dev = { | 2627 | .dev = { |
2639 | .platform_data = &adp_switch_pdata, | 2628 | .platform_data = &adp_switch_pdata, |
@@ -2659,24 +2648,6 @@ static struct platform_device adp122_userspace_consumer_device = { | |||
2659 | .platform_data = &adp122_userspace_comsumer_data, | 2648 | .platform_data = &adp122_userspace_comsumer_data, |
2660 | }, | 2649 | }, |
2661 | }; | 2650 | }; |
2662 | |||
2663 | static struct regulator_bulk_data adp150_bulk_data = { | ||
2664 | .supply = REGULATOR_ADP150, | ||
2665 | }; | ||
2666 | |||
2667 | static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = { | ||
2668 | .name = REGULATOR_ADP150, | ||
2669 | .num_supplies = 1, | ||
2670 | .supplies = &adp150_bulk_data, | ||
2671 | }; | ||
2672 | |||
2673 | static struct platform_device adp150_userspace_consumer_device = { | ||
2674 | .name = "reg-userspace-consumer", | ||
2675 | .id = 1, | ||
2676 | .dev = { | ||
2677 | .platform_data = &adp150_userspace_comsumer_data, | ||
2678 | }, | ||
2679 | }; | ||
2680 | #endif | 2651 | #endif |
2681 | #endif | 2652 | #endif |
2682 | 2653 | ||
@@ -2829,12 +2800,11 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
2829 | #endif | 2800 | #endif |
2830 | #endif | 2801 | #endif |
2831 | 2802 | ||
2832 | #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE) | 2803 | #if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) |
2833 | &adp_switch_device, | 2804 | &adp_switch_device, |
2834 | #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \ | 2805 | #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \ |
2835 | defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE) | 2806 | defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE) |
2836 | &adp122_userspace_consumer_device, | 2807 | &adp122_userspace_consumer_device, |
2837 | &adp150_userspace_consumer_device, | ||
2838 | #endif | 2808 | #endif |
2839 | #endif | 2809 | #endif |
2840 | 2810 | ||