Index: linux-tosa/arch/arm/mach-pxa/tosa.c
===================================================================
--- linux-tosa.orig/arch/arm/mach-pxa/tosa.c	2006-08-29 16:52:59.000000000 +0100
+++ linux-tosa/arch/arm/mach-pxa/tosa.c	2006-08-29 16:55:25.959706776 +0100
@@ -2,6 +2,7 @@
  *  Support for Sharp SL-C6000x PDAs
  *  Model: (Tosa)
  *
+ *  Copyright (c) 2006 Wolfson Microelectronics PLC.
  *  Copyright (c) 2005 Dirk Opfer
  *
  *	Based on code written by Sharp/Lineo for 2.4 kernels
@@ -46,6 +47,8 @@
 #include <asm/hardware/tmio.h>
 #include <asm/mach/sharpsl_param.h>
 
+#include <linux/wm97xx.h>
+
 #include "generic.h"
 
 /*
@@ -428,6 +431,16 @@
     },
 };
 
+
+/*
+ * Tosa Touchscreen device
+ */
+
+static struct wm97xx_machinfo tosa_ts_machinfo = {
+    .get_hsync_time   = tosa_get_hsync_time,
+    .wait_hsync       = tosa_wait_hsync,
+};
+
 /*
  * Tosa Blueooth
  */
@@ -457,6 +470,7 @@
 	GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET);
 
 	mdelay(1000);
+    wm97xx_unset_machinfo();
 }
 
 static void tosa_restart(void)
@@ -501,6 +515,8 @@
 	platform_scoop_config = &tosa_pcmcia_config;
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
+
+    wm97xx_set_machinfo(&tosa_ts_machinfo);
 }
 
 static void __init fixup_tosa(struct machine_desc *desc,
Index: linux-tosa/arch/arm/mach-pxa/tosa_lcd.c
===================================================================
--- linux-tosa.orig/arch/arm/mach-pxa/tosa_lcd.c	2006-08-29 16:52:59.000000000 +0100
+++ linux-tosa/arch/arm/mach-pxa/tosa_lcd.c	2006-08-29 16:55:32.818664056 +0100
@@ -1,6 +1,7 @@
 /*
  *  LCD / Backlight control code for Sharp SL-6000x (tosa)
  *
+ *  Copyright (c) 2006      Wolfson Microelectronics PLC.
  *  Copyright (c) 2005		Dirk Opfer
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -59,6 +60,8 @@
 static struct ssp_dev tosa_nssp_dev;
 static struct ssp_state tosa_nssp_state;
 static spinlock_t tosa_nssp_lock;
+static int blanked;
+static unsigned long hsync_time;
 
 static unsigned short normal_i2c[] = {
 	DAC_BASE,
@@ -130,6 +133,17 @@
 	pxa_nssp_output(TG_GPOSR,0x02);		/* GPOS0=powercontrol, GPOS1=GPIO, GPOS2=TCTL */
 }
 
+static unsigned long calc_hsync_time(const struct fb_videomode *mode) {
+    /* The 25 and 44 'magic numbers' are from Sharp's 2.4 patches */
+    if (mode->yres == 640) {
+        return 25;
+    }
+    if (mode->yres == 320) {
+        return 44;
+    }
+    return 0;
+}
+
 static void tosa_lcd_tg_on(struct device *dev, const struct fb_videomode *mode)
 {
 	const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;
@@ -154,6 +168,8 @@
 		/* set common voltage */
 		i2c_smbus_write_byte_data(tosa_i2c_dac, DAC_CH1, comadj);
 
+    blanked = 0;
+    hsync_time = calc_hsync_time(mode);
 }
 
 static void tosa_lcd_tg_off(struct device *dev)
@@ -172,6 +188,8 @@
 	
 	/* L3V Off */
 	reset_scoop_gpio( &tosascoop_jc_device.dev,TOSA_SCOOP_JC_TC3693_L3V_ON); 
+
+    blanked = 1;
 }
 
 static int tosa_detect_client(struct i2c_adapter* adapter, int address, int kind) {
@@ -238,6 +256,23 @@
 	return 0;
 }
 
+unsigned long tosa_get_hsync_time(void)
+{
+/* This method should eventually contain the correct algorithm for calculating
+   the hsync_time */
+    if (blanked)
+        return 0;
+    else
+        return hsync_time;
+}
+
+void tosa_wait_hsync(void)
+{
+    /* Waits for a rising edge on the VGA line */
+    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) == 0);
+    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) != 0);
+}
+
 static struct i2c_driver tosa_driver={
 	.id		= TOSA_LCD_I2C_DEVICEID,
 	.attach_adapter	= tosa_attach_adapter,
Index: linux-tosa/include/asm-arm/arch-pxa/tosa.h
===================================================================
--- linux-tosa.orig/include/asm-arm/arch-pxa/tosa.h	2006-08-29 16:52:59.000000000 +0100
+++ linux-tosa/include/asm-arm/arch-pxa/tosa.h	2006-08-29 16:55:12.442761664 +0100
@@ -1,6 +1,7 @@
 /*
  * Hardware specific definitions for Sharp SL-C6000x series of PDAs
  *
+ * Copyright (c) 2006 Wolfson Microelectronics PLC.
  * Copyright (c) 2005 Dirk Opfer
  *
  * Based on Sharp's 2.4 kernel patches
@@ -187,4 +188,8 @@
 extern struct platform_device tosascoop_jc_device;
 extern struct platform_device tosascoop_device;
 extern struct platform_device tc6393_device;
+
+unsigned long tosa_get_hsync_time(void);
+void tosa_wait_hsync(void);
+
 #endif /* _ASM_ARCH_TOSA_H_ */
