1 Index: linux-2.6.21/drivers/input/touchscreen/pcap_ts.c
2 ===================================================================
3 --- linux-2.6.21.orig/drivers/input/touchscreen/pcap_ts.c 2007-05-01 16:28:00.000000000 +0200
4 +++ linux-2.6.21/drivers/input/touchscreen/pcap_ts.c 2007-05-01 16:28:03.000000000 +0200
6 #include <linux/string.h>
8 #include <linux/timer.h>
9 -#include <linux/config.h>
10 +//#include <linux/config.h>
11 #include <linux/interrupt.h>
12 #include <linux/platform_device.h>
13 #include <linux/input.h>
15 #include <asm/arch/hardware.h>
16 #include <asm/arch/pxa-regs.h>
18 -#include "../../misc/ezx/ssp_pcap.h"
19 +#include <asm/arch/ezx-pcap.h>
22 #define DEBUGP(x, args ...) printk(KERN_DEBUG "%s: " x, __FUNCTION__, ## args)
24 #define PRESSURE_MAX X_AXIS_MAX
25 #define PRESSURE_MIN X_AXIS_MIN
27 +#define SAMPLE_INTERVAL (HZ/100)
30 static int pcap_ts_mode(u_int32_t mode)
34 pcap_ts->x, pcap_ts->y, pcap_ts->pressure);
36 if (pcap_ts->read_state == PRESSURE) {
37 - input_report_abs(pcap_ts->input, ABS_PRESSURE,
39 if ((pcap_ts->pressure >= PRESSURE_MAX ||
40 pcap_ts->pressure <= PRESSURE_MIN ) &&
41 pcap_ts->pressure == pcap_ts->pressure_last) {
43 input_report_key(pcap_ts->input, BTN_TOUCH, 0);
44 input_sync(pcap_ts->input);
46 + input_report_abs(pcap_ts->input, ABS_PRESSURE, 0);
48 pcap_ts->x = pcap_ts->y = 0;
50 /* ask PCAP2 to interrupt us if touch event happens
52 input_report_key(pcap_ts->input, BTN_TOUCH, 1);
53 /* don't input_sync(), we don't know position yet */
55 + if (pcap_ts->pressure == 0)
56 + pcap_ts->pressure = pcap_ts->pressure_last;
58 + input_report_abs(pcap_ts->input, ABS_PRESSURE,
61 /* switch state machine into coordinate read mode */
62 pcap_ts->read_state = COORDINATE;
63 pcap_ts_mode(PCAP_TS_POSITION_XY_MEASUREMENT);
64 pcap_ts_start_xy_read(pcap_ts);
66 - mod_timer(&pcap_ts->timer, jiffies + HZ/20);
69 /* we are in coordinate mode */
70 if (pcap_ts->x <= X_AXIS_MIN || pcap_ts->x >= X_AXIS_MAX ||
71 pcap_ts->y <= Y_AXIS_MIN || pcap_ts->y >= Y_AXIS_MAX) {
72 DEBUGP("invalid x/y coordinate position: PEN_UP?\n");
74 + pcap_ts->pressure = 0;
76 input_report_key(pcap_ts->input, BTN_TOUCH, 0);
77 pcap_ts->x = pcap_ts->y = 0;
80 /* switch back to pressure read mode */
81 pcap_ts->read_state = PRESSURE;
82 - pcap_ts_mode(PCAP_TS_STANDBY_MODE);
83 - ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_MSR_TSM, 0);
84 + pcap_ts_mode(PCAP_TS_PRESSURE_MEASUREMENT);
85 + mod_timer(&pcap_ts->timer, jiffies + SAMPLE_INTERVAL);
91 struct pcap_ts *pcap_ts = (struct pcap_ts *) data;
93 - ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_MSR_TSM, 1);
94 - pcap_ts_mode(PCAP_TS_PRESSURE_MEASUREMENT);
95 - pcap_ts->read_state = PRESSURE;
96 pcap_ts_start_xy_read(pcap_ts);
99 static int __init ezxts_probe(struct platform_device *pdev)
103 struct pcap_ts *pcap_ts;
104 struct input_dev *input_dev;
107 + printk(KERN_DEBUG "Start probing TS!\n");
109 pcap_ts = kzalloc(sizeof(*pcap_ts), GFP_KERNEL);
110 input_dev = input_allocate_device();
111 if (!pcap_ts || !input_dev)
116 - ssp_pcap_open(SSP_PCAP_TS_OPEN);
117 + // Some initialization before done in ssp_pcap_open()
118 + //ssp_pcap_open(SSP_PCAP_TS_OPEN);
119 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_TS_REFENB, 0);
120 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ISR_ADCDONE2I, 1);
121 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ISR_TSI, 1);
122 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_MSR_TSM, 0);
123 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_MSR_ADCDONE2M, 0);
124 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC2_ADINC1, 0);
125 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC2_ADINC2, 0);
126 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_ATO0, 0);
127 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_ATO1, 0);
128 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_ATO2, 0);
129 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_ATO3, 0);
130 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_ATOX, 0);
131 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_MTR1, 0);
132 + ezx_pcap_bit_set( SSP_PCAP_ADJ_BIT_ADC1_MTR2, 0);
134 + //SSP_PCAP_TSI_mode_set(PCAP_TS_STANDBY_MODE);
135 + ret = ezx_pcap_read(SSP_PCAP_ADJ_ADC1_REGISTER, &tmp);
139 + tmp &= (~SSP_PCAP_TOUCH_PANEL_POSITION_DETECT_MODE_MASK);
140 + tmp |= PCAP_TS_STANDBY_MODE;
142 + ret = ezx_pcap_write(SSP_PCAP_ADJ_ADC1_REGISTER, tmp);
146 + /* send the usb accessory infomation to PM */
148 + if((ACCESSORY_TYPE) sspUsbAccessoryInfo.type == ACCESSORY_DEVICE_USB_PORT)
150 + if( (ACCESSORY_DEVICE_STATUS )sspUsbAccessoryInfo.status == ACCESSORY_DEVICE_STATUS_ATTACHED )
151 + apm_queue_event(KRNL_ACCS_ATTACH);
153 + apm_queue_event(KRNL_ACCS_DETACH);
158 err = request_irq(pcap_ts->irq_xy, pcap_ts_irq_xy, SA_INTERRUPT,
159 "PCAP Touchscreen XY", pcap_ts);
160 @@ -343,10 +391,11 @@
161 //.resume = ezxts_resume,
164 + .owner = THIS_MODULE,
168 -static int __devinit ezxts_init(void)
169 +static int __init ezxts_init(void)
171 return platform_driver_register(&ezxts_driver);
173 Index: linux-2.6.21/drivers/input/touchscreen/Kconfig
174 ===================================================================
175 --- linux-2.6.21.orig/drivers/input/touchscreen/Kconfig 2007-05-01 16:28:00.000000000 +0200
176 +++ linux-2.6.21/drivers/input/touchscreen/Kconfig 2007-05-01 16:28:03.000000000 +0200
179 config TOUCHSCREEN_PCAP
180 tristate "Motorola PCAP touchscreen"
181 - depends on PXA_EZX_PCAP
184 Say Y here if you have a Motorola EZX (E680, A780) telephone
185 and want to support the built-in touchscreen.
189 To compile this driver as a module, choose M here: the
190 - module will be called hp680_ts_input.
191 + module will be called pcap_ts.
194 Index: linux-2.6.21/arch/arm/mach-pxa/ezx.c
195 ===================================================================
196 --- linux-2.6.21.orig/arch/arm/mach-pxa/ezx.c 2007-05-01 16:28:00.000000000 +0200
197 +++ linux-2.6.21/arch/arm/mach-pxa/ezx.c 2007-05-01 16:28:03.000000000 +0200
199 .resource = ezxemu_resources,
203 +struct resource pcap_ts_resources[] = {
205 + .start = EZX_IRQ_ADCDONE2,
206 + .end = EZX_IRQ_ADCDONE2,
207 + .flags = IORESOURCE_IRQ,
210 + .start = EZX_IRQ_TS,
212 + .flags = IORESOURCE_IRQ,
216 +struct platform_device pcap_ts_device = {
220 + .parent = &ezxpcap_device.dev,
222 + .num_resources = ARRAY_SIZE(pcap_ts_resources),
223 + .resource = pcap_ts_resources,
227 /* OHCI Controller */
229 static int ezx_ohci_init(struct device *dev)
237 static void __init a780_init(void)