diff options
author | Mike Rapoport <mike@compulab.co.il> | 2009-05-18 01:53:56 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-06-16 09:03:33 -0400 |
commit | a37ed43115b70e832c7e8cc7dabd026d127ad9db (patch) | |
tree | 97ca0b17fb83adb055cb2c058dba79befcdb4208 /arch/arm/mach-pxa | |
parent | 3cb05c97ad38aab0858fc176fd1577ac4a947bad (diff) |
[ARM] pxa/em-x270: add ability to control GPS and GPRS power
Register userspace-consumer devices to allow userspace control of
voltage regulators supplying GPS and GPRS modules
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/em-x270.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index b2d5a5394e47..5184a570ac5f 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/apm-emulation.h> | 30 | #include <linux/apm-emulation.h> |
31 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
32 | #include <linux/i2c/pca953x.h> | 32 | #include <linux/i2c/pca953x.h> |
33 | #include <linux/regulator/userspace-consumer.h> | ||
33 | 34 | ||
34 | #include <media/soc_camera.h> | 35 | #include <media/soc_camera.h> |
35 | 36 | ||
@@ -1038,6 +1039,52 @@ static void __init em_x270_init_camera(void) | |||
1038 | static inline void em_x270_init_camera(void) {} | 1039 | static inline void em_x270_init_camera(void) {} |
1039 | #endif | 1040 | #endif |
1040 | 1041 | ||
1042 | static struct regulator_bulk_data em_x270_gps_consumer_supply = { | ||
1043 | .supply = "vcc gps", | ||
1044 | }; | ||
1045 | |||
1046 | static struct regulator_userspace_consumer_data em_x270_gps_consumer_data = { | ||
1047 | .name = "vcc gps", | ||
1048 | .num_supplies = 1, | ||
1049 | .supplies = &em_x270_gps_consumer_supply, | ||
1050 | }; | ||
1051 | |||
1052 | static struct platform_device em_x270_gps_userspace_consumer = { | ||
1053 | .name = "reg-userspace-consumer", | ||
1054 | .id = 0, | ||
1055 | .dev = { | ||
1056 | .platform_data = &em_x270_gps_consumer_data, | ||
1057 | }, | ||
1058 | }; | ||
1059 | |||
1060 | static struct regulator_bulk_data em_x270_gprs_consumer_supply = { | ||
1061 | .supply = "vcc gprs", | ||
1062 | }; | ||
1063 | |||
1064 | static struct regulator_userspace_consumer_data em_x270_gprs_consumer_data = { | ||
1065 | .name = "vcc gprs", | ||
1066 | .num_supplies = 1, | ||
1067 | .supplies = &em_x270_gprs_consumer_supply | ||
1068 | }; | ||
1069 | |||
1070 | static struct platform_device em_x270_gprs_userspace_consumer = { | ||
1071 | .name = "reg-userspace-consumer", | ||
1072 | .id = 1, | ||
1073 | .dev = { | ||
1074 | .platform_data = &em_x270_gprs_consumer_data, | ||
1075 | } | ||
1076 | }; | ||
1077 | |||
1078 | static struct platform_device *em_x270_userspace_consumers[] = { | ||
1079 | &em_x270_gps_userspace_consumer, | ||
1080 | &em_x270_gprs_userspace_consumer, | ||
1081 | }; | ||
1082 | |||
1083 | static void __init em_x270_userspace_consumers_init(void) | ||
1084 | { | ||
1085 | platform_add_devices(ARRAY_AND_SIZE(em_x270_userspace_consumers)); | ||
1086 | } | ||
1087 | |||
1041 | /* DA9030 related initializations */ | 1088 | /* DA9030 related initializations */ |
1042 | #define REGULATOR_CONSUMER(_name, _dev, _supply) \ | 1089 | #define REGULATOR_CONSUMER(_name, _dev, _supply) \ |
1043 | static struct regulator_consumer_supply _name##_consumers[] = { \ | 1090 | static struct regulator_consumer_supply _name##_consumers[] = { \ |
@@ -1047,11 +1094,11 @@ static inline void em_x270_init_camera(void) {} | |||
1047 | }, \ | 1094 | }, \ |
1048 | } | 1095 | } |
1049 | 1096 | ||
1050 | REGULATOR_CONSUMER(ldo3, NULL, "vcc gps"); | 1097 | REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps"); |
1051 | REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); | 1098 | REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); |
1052 | REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); | 1099 | REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); |
1053 | REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); | 1100 | REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); |
1054 | REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs"); | 1101 | REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs"); |
1055 | 1102 | ||
1056 | #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ | 1103 | #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ |
1057 | static struct regulator_init_data _ldo##_data = { \ | 1104 | static struct regulator_init_data _ldo##_data = { \ |
@@ -1062,6 +1109,7 @@ REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs"); | |||
1062 | .enabled = 0, \ | 1109 | .enabled = 0, \ |
1063 | }, \ | 1110 | }, \ |
1064 | .valid_ops_mask = _ops_mask, \ | 1111 | .valid_ops_mask = _ops_mask, \ |
1112 | .apply_uV = 1, \ | ||
1065 | }, \ | 1113 | }, \ |
1066 | .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \ | 1114 | .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \ |
1067 | .consumer_supplies = _ldo##_consumers, \ | 1115 | .consumer_supplies = _ldo##_consumers, \ |
@@ -1240,6 +1288,7 @@ static void __init em_x270_init(void) | |||
1240 | em_x270_init_spi(); | 1288 | em_x270_init_spi(); |
1241 | em_x270_init_i2c(); | 1289 | em_x270_init_i2c(); |
1242 | em_x270_init_camera(); | 1290 | em_x270_init_camera(); |
1291 | em_x270_userspace_consumers_init(); | ||
1243 | } | 1292 | } |
1244 | 1293 | ||
1245 | MACHINE_START(EM_X270, "Compulab EM-X270") | 1294 | MACHINE_START(EM_X270, "Compulab EM-X270") |