Index: linux-2.6.15/arch/arm/mach-pxa/Makefile
===================================================================
--- linux-2.6.15.orig/arch/arm/mach-pxa/Makefile	2006-01-30 00:39:10.000000000 +0000
+++ linux-2.6.15/arch/arm/mach-pxa/Makefile	2006-01-30 00:39:24.000000000 +0000
@@ -15,7 +15,7 @@
 obj-$(CONFIG_PXA_SHARP_Cxx00)	+= spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
 obj-$(CONFIG_MACH_AKITA)	+= akita-ioexp.o
 obj-$(CONFIG_MACH_POODLE)	+= poodle.o
-obj-$(CONFIG_MACH_TOSA)         += tosa.o
+obj-$(CONFIG_MACH_TOSA)         += tosa.o tosa-power.o
 obj-$(CONFIG_MACH_HX2750)	+= hx2750.o hx2750_test.o
 
 # Support for blinky lights
Index: linux-2.6.15/arch/arm/mach-pxa/tosa-power.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.15/arch/arm/mach-pxa/tosa-power.c	2006-01-30 00:39:24.000000000 +0000
@@ -0,0 +1,141 @@
+/*
+ * Battery and Power Management code for Sharp SL-6000
+ *
+ * Copyright (c) 2005
+ *
+ * Based on code written by Sharp for 2.4 kernels
+ *
+ * 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
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/poll.h>
+#include <linux/timer.h>
+#include <linux/slab.h>
+#include <linux/stat.h>
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/smp_lock.h>
+#include <linux/apm_bios.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+
+#include <asm/hardware.h>
+#include <asm/hardware/scoop.h>
+#include <asm/mach-types.h>
+#include <asm/irq.h>
+#include <asm/apm.h>
+
+#include <asm/arch/pm.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/tosa.h>
+
+
+ 	// GPIO reset
+// 	pxa_gpio_mode(GPIO_ON_RESET | GPIO_OUT);
+// 	GPCR(GPIO_ON_RESET) |= GPIO_bit(GPIO_ON_RESET);
+
+#if 0
+#define R_WAKEUP_SRC (GPIO_bit(TOSA_GPIO_AC_IN) | GPIO_bit(TOSA_GPIO_JACKET_DETECT))
+#define F_WAKEUP_SRC	(GPIO_bit(TOSA_GPIO_POWERON) | GPIO_bit(TOSA_GPIO_RESET) | \
+			 GPIO_bit(TOSA_GPIO_AC_IN) | GPIO_bit(TOSA_GPIO_RECORD_BTN) | \
+			 GPIO_bit(TOSA_GPIO_SYNC) | GPIO_bit(TOSA_GPIO_USB_IN) | \
+			 GPIO_bit(TOSA_GPIO_JACKET_DETECT) )
+#endif
+#define R_WAKEUP_SRC (GPIO_bit(TOSA_GPIO_AC_IN) )
+#define F_WAKEUP_SRC	(GPIO_bit(TOSA_GPIO_POWERON) | GPIO_bit(TOSA_GPIO_RESET) | \
+			 GPIO_bit(TOSA_GPIO_AC_IN)  )
+
+#define WAKEUP_SRC	( R_WAKEUP_SRC | F_WAKEUP_SRC | PWER_RTC )
+
+
+#define WAKEUP_DEF_SRC	( GPIO_bit(TOSA_GPIO_POWERON) | GPIO_bit(TOSA_GPIO_RESET) | \
+			  GPIO_bit(TOSA_GPIO_AC_IN) | GPIO_bit(TOSA_GPIO_JACKET_DETECT) | \
+			  GPIO_bit(TOSA_GPIO_RECORD_BTN) | GPIO_bit(TOSA_GPIO_SYNC) )
+
+static int tosa_suspended = 0;
+
+extern struct pm_ops pxa_pm_ops;
+
+int tosa_enter_suspend(void)
+{
+	int i;
+	
+	
+	PWER = WAKEUP_SRC;	// Wake Up Enable
+	PRER = R_WAKEUP_SRC; 	// Rising Edge Enable
+	PFER = F_WAKEUP_SRC; 	// Falling Edge Enable
+
+	PEDR = WAKEUP_SRC;	// Edge Detect Register
+
+	for (i = 0; i <=15; i++) {
+		if ( PRER & PFER & GPIO_bit(i) ) {
+			if ( GPLR0 & GPIO_bit(i) )
+				PRER &= ~GPIO_bit(i); 
+			else
+				PFER &= ~GPIO_bit(i); 
+		}
+	}
+
+	if (!tosa_suspended) {
+		tosa_suspended=1;
+		return 1;
+	}
+
+	tosa_suspended=0;
+	return 0;
+}
+
+
+static int tosa_pxa_pm_enter(suspend_state_t state)
+{
+//    while (tosa_enter_suspend()) pxa_pm_enter_orig(state);
+    tosa_enter_suspend();
+    pxa_pm_enter(state);
+
+    return 0;
+}
+	
+static struct pm_ops tosa_pm_ops = {
+	.pm_disk_mode	= PM_DISK_FIRMWARE,
+	.prepare	= pxa_pm_prepare,
+	.enter		= tosa_pxa_pm_enter,
+	.finish		= pxa_pm_finish,
+};
+
+static int __init tosa_batt_probe(struct device *dev)
+{
+	pm_set_ops(&tosa_pm_ops);
+	return 0;
+}
+		    
+static int tosa_batt_remove(struct device *dev)
+{
+		    
+    return 0;
+}
+			
+static struct device_driver tosa_batt_driver = {
+    .name= "tosa-battery",
+    .bus= &platform_bus_type,
+    .probe= tosa_batt_probe,
+    .remove= tosa_batt_remove,
+};
+					
+static int __devinit tosa_batt_init(void)
+{
+    return driver_register(&tosa_batt_driver);
+}
+					    
+static void tosa_batt_exit(void)
+{
+    driver_unregister(&tosa_batt_driver);
+}
+						
+module_init(tosa_batt_init);
+module_exit(tosa_batt_exit);
Index: linux-2.6.15/arch/arm/mach-pxa/tosa.c
===================================================================
--- linux-2.6.15.orig/arch/arm/mach-pxa/tosa.c	2006-01-30 00:39:13.000000000 +0000
+++ linux-2.6.15/arch/arm/mach-pxa/tosa.c	2006-01-30 00:40:01.000000000 +0000
@@ -297,6 +297,14 @@
 	.resource	= tc6393_resources,
 };
 
+/*
+ * Tosa Powermanagement
+ */
+static struct platform_device tosa_battery_device = {
+	.name		= "tosa-battery",
+	.id		= -1,
+};
+
 static struct platform_device *devices[] __initdata = {
 	&tosascoop_device,
 	&tosascoop_jc_device,
@@ -304,6 +312,7 @@
 	&tosaled_device,
 	&tosa_audio_device,
 	&tc6393_device,
+	&tosa_battery_device,
 };
 
 static void __init tosa_init(void)

