> i was thinking about this the other day. the gps has it's own > processor, correct, and can act independently of the cpu? i'm > wondering if it's possible for the gps to keep it's fix while the main > cpu is in suspend. power usage will be higher than a full suspend, but > the phone will have a fix as soon as it resumes. is there any reason > why this can't happen?
I wrote attached patch for this few days ago - it is against mwester's stable kernel so probably still needs some tweaks for 2.6.28 series. Simply 'echo 1 > /sys/bus/i2c/devices/0-0073/neo1973-pm-gps.0/keep_on_in_suspend' and it will stay alive during suspend (echo 0 to turn it off - this is also the default). It also fixes a bug with re-enabling GPS on resume when it was on before (keep_on_in_suspend=0). I'm going to split this into 2 patches and send it to devel soon. vlado
diff -Naur knife-kernel-orig/arch/arm/mach-s3c2440/mach-gta02.c knife-kernel/arch/arm/mach-s3c2440/mach-gta02.c
--- knife-kernel-orig/arch/arm/mach-s3c2440/mach-gta02.c 2008-11-18 02:15:36.000000000 +0100
+++ knife-kernel/arch/arm/mach-s3c2440/mach-gta02.c 2009-01-01 10:56:31.000000000 +0100
@@ -714,6 +714,7 @@
PMU_VRAIL_F_UNUSED;
gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO5] = ((struct pmu_voltage_rail) {
.name = "rf_3v",
+ .flags = PMU_VRAIL_F_SUSPEND_ON,
.voltage = {
.init = 0,
.max = 3000,
diff -Naur knife-kernel-orig/arch/arm/plat-s3c24xx/neo1973_pm_gps.c knife-kernel/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
--- knife-kernel-orig/arch/arm/plat-s3c24xx/neo1973_pm_gps.c 2008-11-18 02:15:36.000000000 +0100
+++ knife-kernel/arch/arm/plat-s3c24xx/neo1973_pm_gps.c 2009-01-03 16:29:05.000000000 +0100
@@ -35,6 +35,7 @@
struct neo1973_pm_gps_data {
int power_was_on;
+ int keep_on_in_suspend;
};
static struct neo1973_pm_gps_data neo1973_gps;
@@ -271,9 +272,6 @@
/* This is the POWERON pin */
static void gps_pwron_set(int on)
{
-
- neo1973_gps.power_was_on = !!on;
-
#ifdef CONFIG_MACH_NEO1973_GTA01
if (machine_is_neo1973_gta01())
neo1973_gpb_setpin(GTA01_GPIO_GPS_PWRON, on);
@@ -354,6 +352,17 @@
return 0;
}
+/* This is the flag for keeping gps ON during suspend */
+static void gps_keep_on_in_suspend_set(int on)
+{
+ neo1973_gps.keep_on_in_suspend = on;
+}
+
+static int gps_keep_on_in_suspend_get(void)
+{
+ return neo1973_gps.keep_on_in_suspend;
+}
+
static ssize_t power_gps_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -374,6 +383,8 @@
} else if (!strcmp(attr->attr.name, "power_core_1v5") ||
!strcmp(attr->attr.name, "power_vdd_core_1v5")) {
ret = gps_power_1v5_get();
+ } else if (!strcmp(attr->attr.name, "keep_on_in_suspend")) {
+ ret = gps_keep_on_in_suspend_get();
}
if (ret)
@@ -393,6 +404,7 @@
} else if (!strcmp(attr->attr.name, "power_avdd_3v")) {
gps_power_3v_set(on);
} else if (!strcmp(attr->attr.name, "pwron")) {
+ neo1973_gps.power_was_on = !!on;
gps_pwron_set(on);
} else if (!strcmp(attr->attr.name, "reset")) {
gps_rst_set(on);
@@ -403,6 +415,8 @@
} else if (!strcmp(attr->attr.name, "power_core_1v5") ||
!strcmp(attr->attr.name, "power_vdd_core_1v5")) {
gps_power_1v5_set(on);
+ } else if (!strcmp(attr->attr.name, "keep_on_in_suspend")) {
+ gps_keep_on_in_suspend_set(on);
}
return count;
@@ -496,6 +510,7 @@
static DEVICE_ATTR(power_vdd_core_1v5, 0644, power_gps_read, power_gps_write);
static DEVICE_ATTR(power_sequence, 0644, power_sequence_read,
power_sequence_write);
+static DEVICE_ATTR(keep_on_in_suspend, 0644, power_gps_read, power_gps_write);
#ifdef CONFIG_PM
static int gta01_pm_gps_suspend(struct platform_device *pdev,
@@ -509,8 +524,14 @@
#endif /* CONFIG_MACH_NEO1973_GTA01 */
#ifdef CONFIG_MACH_NEO1973_GTA02
- if (machine_is_neo1973_gta02())
- gps_pwron_set(0);
+ if (machine_is_neo1973_gta02()) {
+ if (!neo1973_gps.keep_on_in_suspend ||
+ !neo1973_gps.power_was_on)
+ gps_pwron_set(0);
+ else
+ dev_warn(&pdev->dev, "GTA02: keeping gps ON "
+ "during suspend\n");
+ }
#endif /* CONFIG_MACH_NEO1973_GTA02 */
return 0;
@@ -526,7 +547,7 @@
#ifdef CONFIG_MACH_NEO1973_GTA02
if (machine_is_neo1973_gta02())
- if (neo1973_gps.power_was_on)
+ if (!neo1973_gps.keep_on_in_suspend && neo1973_gps.power_was_on)
gps_pwron_set(1);
#endif /* CONFIG_MACH_NEO1973_GTA02 */
@@ -556,6 +577,7 @@
static struct attribute *gta02_gps_sysfs_entries[] = {
&dev_attr_pwron.attr,
+ &dev_attr_keep_on_in_suspend.attr,
NULL
};
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Openmoko community mailing list [email protected] http://lists.openmoko.org/mailman/listinfo/community

