aboutsummaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorBalaji Rao <balajirrao@openmoko.org>2008-11-20 19:46:51 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-20 19:46:51 +0000
commit003285f5a73979c5909d829e50465b582ee6ccf5 (patch)
tree6b13d32461420f445c940aa9065a9837ca262e78 /arch/arm
parentf00ed35e0335f26e45405eb82776cef1d76ee5f3 (diff)
pm_gps_use_regulator_api.patch
Change the pm_gps driver to use the regulator API.
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-s3c2440/mach-gta02.c21
-rw-r--r--arch/arm/plat-s3c24xx/neo1973_pm_gps.c26
2 files changed, 33 insertions, 14 deletions
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 0780d5c8829..d0d7476602b 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -570,6 +570,13 @@ static struct regulator_consumer_supply ldo4_consumers[] = {
},
};
+static struct regulator_consumer_supply ldo5_consumers[] = {
+ {
+ .dev = &gta01_pm_bt_dev.dev,
+ .supply = "RF_3V",
+ },
+};
+
/*
* We need this dummy thing to fill the regulator consumers
*/
@@ -711,6 +718,16 @@ struct pcf50633_platform_data gta02_pcf_pdata = {
.num_consumer_supplies = 1,
.consumer_supplies = ldo4_consumers,
},
+ [PCF50633_REGULATOR_LDO5] = {
+ .constraints = {
+ .min_uV = 3000000,
+ .max_uV = 3000000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 1,
+ .consumer_supplies = ldo5_consumers,
+ },
[PCF50633_REGULATOR_HCLDO] = {
.constraints = {
.min_uV = 2000000,
@@ -1560,7 +1577,6 @@ static struct platform_device *gta02_devices[] __initdata = {
static struct platform_device *gta02_devices_pmu_children[] = {
&s3c_device_ts, /* input 1 */
&gta02_pm_gsm_dev,
- &gta01_pm_gps_dev,
&gta02_pm_usbhost_dev,
&s3c_device_spi_acc1, /* input 2 */
&s3c_device_spi_acc2, /* input 3 */
@@ -1578,6 +1594,9 @@ static void gta02_pcf50633_regulator_registered(struct pcf50633_data *pcf, int i
case PCF50633_REGULATOR_LDO4:
pdev = &gta01_pm_bt_dev;
break;
+ case PCF50633_REGULATOR_LDO5:
+ pdev = &gta01_pm_gps_dev;
+ break;
case PCF50633_REGULATOR_HCLDO:
pdev = &gta02_glamo_dev;
break;
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
index a3a6ad3b53f..1715769cbb1 100644
--- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
@@ -31,8 +31,11 @@
#include <mach/gta02.h>
#include <linux/pcf50633.h>
+#include <linux/regulator/consumer.h>
+
struct neo1973_pm_gps_data {
int power_was_on;
+ struct regulator *regulator;
};
static struct neo1973_pm_gps_data neo1973_gps;
@@ -273,15 +276,11 @@ static int gps_power_1v5_get(void)
static void gps_pwron_set(int on)
{
- neo1973_gps.power_was_on = !!on;
-
if (machine_is_neo1973_gta01())
neo1973_gpb_setpin(GTA01_GPIO_GPS_PWRON, on);
if (machine_is_neo1973_gta02()) {
if (on) {
- pcf50633_voltage_set(gta02_pcf_pdata.pcf,
- PCF50633_REGULATOR_LDO5, 3000);
/* return UART pins to being UART pins */
s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_TXD1);
/* remove pulldown now it won't be floating any more */
@@ -296,9 +295,13 @@ static void gps_pwron_set(int on)
/* don't let RX from unpowered GPS float */
s3c2410_gpio_pullup(S3C2410_GPH5, 1);
}
- pcf50633_onoff_set(gta02_pcf_pdata.pcf,
- PCF50633_REGULATOR_LDO5, on);
+ if (on && !neo1973_gps.power_was_on)
+ regulator_enable(neo1973_gps.regulator);
+ else if (!on && neo1973_gps.power_was_on)
+ regulator_disable(neo1973_gps.regulator);
}
+
+ neo1973_gps.power_was_on = !!on;
}
static int gps_pwron_get(void)
@@ -307,8 +310,7 @@ static int gps_pwron_get(void)
return !!s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON);
if (machine_is_neo1973_gta02())
- return !!pcf50633_onoff_get(gta02_pcf_pdata.pcf,
- PCF50633_REGULATOR_LDO5);
+ return regulator_is_enabled(neo1973_gps.regulator);
return -1;
}
@@ -630,10 +632,8 @@ static int __init gta01_pm_gps_probe(struct platform_device *pdev)
case GTA02v4_SYSTEM_REV:
case GTA02v5_SYSTEM_REV:
case GTA02v6_SYSTEM_REV:
- pcf50633_voltage_set(gta02_pcf_pdata.pcf,
- PCF50633_REGULATOR_LDO5, 3000);
- pcf50633_onoff_set(gta02_pcf_pdata.pcf,
- PCF50633_REGULATOR_LDO5, 0);
+ neo1973_gps.regulator = regulator_get(
+ &pdev->dev, "RF_3V");
dev_info(&pdev->dev, "FIC Neo1973 GPS Power Managerment:"
"starting\n");
break;
@@ -659,7 +659,7 @@ static int gta01_pm_gps_remove(struct platform_device *pdev)
}
if (machine_is_neo1973_gta02()) {
- pcf50633_onoff_set(gta02_pcf_pdata.pcf, PCF50633_REGULATOR_LDO5, 0);
+ regulator_put(neo1973_gps.regulator);
sysfs_remove_group(&pdev->dev.kobj, &gta02_gps_attr_group);
}
return 0;