From 003285f5a73979c5909d829e50465b582ee6ccf5 Mon Sep 17 00:00:00 2001 From: Balaji Rao Date: Thu, 20 Nov 2008 19:46:51 +0000 Subject: pm_gps_use_regulator_api.patch Change the pm_gps driver to use the regulator API. --- arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'arch/arm/plat-s3c24xx/neo1973_pm_gps.c') 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 #include +#include + 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, >a02_gps_attr_group); } return 0; -- cgit v1.2.3