Change the pm_gps driver to use the regulator API.
---

 arch/arm/mach-s3c2440/mach-gta02.c     |   17 +++++++++++++++++
 arch/arm/plat-s3c24xx/neo1973_pm_gps.c |   23 ++++++++++++-----------
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c 
b/arch/arm/mach-s3c2440/mach-gta02.c
index 3143d51..c95a314 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -568,6 +568,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
  */
@@ -710,6 +717,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,
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c 
b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
index a3a6ad3..8f0a629 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;
@@ -280,8 +283,6 @@ static void gps_pwron_set(int 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,8 +297,11 @@ 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);
+
+               if ((!on) && (neo1973_gps.power_was_on))
+                       regulator_disable(neo1973_gps.regulator);
        }
 }
 
@@ -307,8 +311,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 +633,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 +660,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;


Reply via email to