summaryrefslogtreecommitdiff
path: root/packages/linux/linux-rp-2.6.19/tosa-lcdnoise-r1.patch
blob: 624098bc64fd9f020771c4aa3f95cc133e54d087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Index: linux-2.6.18/arch/arm/mach-pxa/tosa.c
===================================================================
--- linux-2.6.18.orig/arch/arm/mach-pxa/tosa.c	2006-09-20 17:14:14.000000000 +0200
+++ linux-2.6.18/arch/arm/mach-pxa/tosa.c	2006-09-20 17:14:43.000000000 +0200
@@ -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
@@ -47,6 +48,8 @@
 #include <asm/hardware/tmio.h>
 #include <asm/mach/sharpsl_param.h>
 
+#include <linux/wm97xx.h>
+
 #include "generic.h"
 
 /*
@@ -429,6 +432,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
  */
@@ -458,6 +471,7 @@
 	GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET);
 
 	mdelay(1000);
+	wm97xx_unset_machinfo();
 	arm_machine_restart('h');
 }
 
@@ -503,6 +517,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-2.6.18/arch/arm/mach-pxa/tosa_lcd.c
===================================================================
--- linux-2.6.18.orig/arch/arm/mach-pxa/tosa_lcd.c	2006-09-20 17:14:14.000000000 +0200
+++ linux-2.6.18/arch/arm/mach-pxa/tosa_lcd.c	2006-09-20 17:14:15.000000000 +0200
@@ -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-2.6.18/include/asm-arm/arch-pxa/tosa.h
===================================================================
--- linux-2.6.18.orig/include/asm-arm/arch-pxa/tosa.h	2006-09-20 17:14:13.000000000 +0200
+++ linux-2.6.18/include/asm-arm/arch-pxa/tosa.h	2006-09-20 17:14:15.000000000 +0200
@@ -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_ */