|
From: <hap...@us...> - 2007-01-30 12:54:30
|
Revision: 785
http://svn.sourceforge.net/hackndev/?rev=785&view=rev
Author: happy-slapin
Date: 2007-01-30 04:54:28 -0800 (Tue, 30 Jan 2007)
Log Message:
-----------
z72: Initial attempt to follow corgi steps with PM driver
z72: Added Zire 72 to line with MEM = STANDBY. Btw is this line really
working for other machines? Seems not... So I fixed hanging issue with
GPE.
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c
linux4palm/linux/trunk/arch/arm/mach-pxa/pxa27x.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-01-29 19:42:21 UTC (rev 784)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-01-30 12:54:28 UTC (rev 785)
@@ -1,8 +1,8 @@
/************************************************************************
* PalmOne Zire72 suspend/resume support *
* *
- * Authos: Jan Herman <2h...@se...> *
- * Sergey Lapin <sla...@gm...> *
+ * Authors: Jan Herman <2h...@se...> *
+ * Sergey Lapin <sla...@gm...> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 as *
@@ -18,17 +18,21 @@
#include <asm/mach-types.h>
#include <asm/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/pxa-pm_ll.h>
#include <asm/arch/hardware.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/palmz72-gpio.h>
-typedef struct
+struct pm_save_data
{
int brightness;
-} pm_save_data;
+ u32 jiffies;
+};
+static struct pm_save_data pm_save_data;
+
#ifdef CONFIG_PM
static int palmz72_suspend(struct device *dev, pm_message_t state)
{
@@ -42,13 +46,19 @@
/* Enabled Deep-Sleep mode ?? */
PCFR |= PCFR_DS;
+ /* Low power mode */
+ PCFR |= PCFR_OPDE;
+
/* Here are all of special for suspend PalmOne Zire 72 */
//printk("Palmz72_suspend: suspending...");
+ SET_PALMZ72_GPIO(LED, 0);
+
/* Turn off LCD power */
SET_PALMZ72_GPIO(LCD_POWER,0);
/* Turn off USB power */
SET_PALMZ72_GPIO(USB_POWER,0);
+
/* disable GPIO reset - DO NOT REMOVE! */
PCFR &= PCFR_GPR_EN;
@@ -59,7 +69,6 @@
static int palmz72_resume(struct device *dev)
{
-
/* Disabled Deep-Sleep mode ?? */
PCFR &= PCFR_DS;
@@ -73,6 +82,8 @@
SET_PALMZ72_GPIO(LCD_POWER,1);
/* Turn on USB power */
SET_PALMZ72_GPIO(USB_POWER,1);
+
+ SET_PALMZ72_GPIO(LED, 1);
return 0;
}
@@ -97,8 +108,61 @@
.resume = palmz72_pxa_ll_pm_resume,
};
+static int (*pxa_pm_enter)(suspend_state_t state);
+
+static void zire72_goto_sleep(suspend_state_t state)
+{
+ pxa_pm_enter(state);
+}
+
+static int zire72_enter_suspend(suspend_state_t state)
+{
+ /* Here we should implement wakeup conditions
+ If we have none, just return 1 to continue
+ sleeping */
+ if(PKSR & 0x00001) {
+ printk(KERN_NOTICE "Returning from sleep due to GPIO13\n");
+ return 0;
+ }
+ if(jiffies < ( pm_save_data.jiffies + msecs_to_jiffies(5000))) {
+ if(!(PKSR & 0xe0001))
+ pm_save_data.jiffies = jiffies;
+ zire72_goto_sleep(state);
+ return 1;
+ }
+ if(PKSR & 0xe0001) {
+ printk(KERN_NOTICE "Returning from sleep due to GPIOs 100-102 or 13\n");
+ return 0;
+ }
+ return 1;
+}
+
+
+static int zire72_pxa_pm_enter(suspend_state_t state)
+{
+ pm_save_data.jiffies = jiffies;
+ zire72_goto_sleep(state);
+
+ while (zire72_enter_suspend(state))
+ {}
+ return 0;
+}
+
+
+static struct pm_ops zire72_pm_ops = {
+ .pm_disk_mode = PM_DISK_FIRMWARE,
+ .prepare = pxa_pm_prepare,
+ .enter = zire72_pxa_pm_enter,
+ .finish = pxa_pm_finish,
+};
+
+extern struct pm_ops pxa_pm_ops;
+
static int palmz72_pm_probe(struct device *dev)
{
+ pm_save_data.jiffies = jiffies;
+ pxa_pm_enter = pxa_pm_ops.enter;
+ pm_set_ops(&zire72_pm_ops);
printk(KERN_NOTICE "PalmOne Zire72 power management driver registered\n");
return 0;
}
@@ -118,6 +182,7 @@
static void __exit palmz72_pm_exit(void)
{
+ pxa_pm_ops.enter = pxa_pm_enter;
driver_unregister(&palmz72_pm_driver);
}
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/pxa27x.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/pxa27x.c 2007-01-29 19:42:21 UTC (rev 784)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/pxa27x.c 2007-01-30 12:54:28 UTC (rev 785)
@@ -139,7 +139,7 @@
{
extern void pxa_cpu_standby(void);
extern void pxa_cpu_suspend(unsigned int);
-#if defined(MACH_XSCALE_PALMLD) || defined(MACH_XSCALE_PALMTX)
+#if defined(MACH_XSCALE_PALMLD) || defined(MACH_XSCALE_PALMTX) || defined(CONFIG_MACH_PALMZ72)
/* For safety. suspend_mem puts the device in an unresetable state.
* On TX one needs to desolder the battery to get out of it.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|