summaryrefslogtreecommitdiff
path: root/target/linux/xburst/patches-2.6.37/060-adc-touchscreen.patch
blob: 85697aa990e632e0069bb9dd76fbcf57663ee2fb (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
From 424b737e5a1858dafc8138fd59d154f0493b21d0 Mon Sep 17 00:00:00 2001
From: Lars-Peter Clausen <lars@metafoo.de>
Date: Sun, 5 Sep 2010 20:36:59 +0200
Subject: [PATCH 13/23] MFD: jz4740-adc: Add support for the touchscreen part of the adc unit

---
 drivers/mfd/jz4740-adc.c   |   39 ++++++++++++++++++++++++++++++++++++---
 include/linux/jz4740-adc.h |    2 +-
 2 files changed, 37 insertions(+), 4 deletions(-)

--- a/drivers/mfd/jz4740-adc.c
+++ b/drivers/mfd/jz4740-adc.c
@@ -46,9 +46,9 @@
 enum {
 	JZ_ADC_IRQ_ADCIN = 0,
 	JZ_ADC_IRQ_BATTERY,
-	JZ_ADC_IRQ_TOUCH,
-	JZ_ADC_IRQ_PENUP,
-	JZ_ADC_IRQ_PENDOWN,
+	JZ_ADC_IRQ_TS_DATA_READY,
+	JZ_ADC_IRQ_TS_PENUP,
+	JZ_ADC_IRQ_TS_PENDOWN,
 };
 
 struct jz4740_adc {
@@ -101,6 +101,7 @@ static void jz4740_adc_irq_ack(unsigned
 	struct jz4740_adc *adc = get_irq_chip_data(irq);
 
 	irq -= adc->irq_base;
+
 	writeb(BIT(irq), adc->base + JZ_REG_ADC_STATUS);
 }
 
@@ -227,6 +228,27 @@ static struct resource jz4740_battery_re
 	},
 };
 
+static struct resource jz4740_ts_resources[] = {
+	{
+		.start = JZ_ADC_IRQ_TS_DATA_READY,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = JZ_ADC_IRQ_TS_PENUP,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = JZ_ADC_IRQ_TS_PENDOWN,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start	= JZ_REG_ADC_TOUCHSCREEN_BASE,
+		.end	= JZ_REG_ADC_TOUCHSCREEN_BASE + 0xb,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+
 const struct mfd_cell jz4740_adc_cells[] = {
 	{
 		.id = 0,
@@ -248,6 +270,17 @@ const struct mfd_cell jz4740_adc_cells[]
 		.data_size = sizeof(struct mfd_cell),
 
 		.enable = jz4740_adc_cell_enable,
+		.disable = jz4740_adc_cell_disable,
+	},
+	{
+		.id = 2,
+		.name = "jz4740-ts",
+		.num_resources = ARRAY_SIZE(jz4740_ts_resources),
+		.resources = jz4740_ts_resources,
+		.platform_data = (void *)&jz4740_adc_cells[2],
+		.data_size = sizeof(struct mfd_cell),
+
+		.enable = jz4740_adc_cell_enable,
 		.disable = jz4740_adc_cell_disable,
 	},
 };
--- a/include/linux/jz4740-adc.h
+++ b/include/linux/jz4740-adc.h
@@ -25,7 +25,7 @@ int jz4740_adc_set_config(struct device
 #define JZ_ADC_CONFIG_BAT_MB		BIT(4)
 
 #define JZ_ADC_CONFIG_DNUM(dnum)	((dnum) << 16)
-#define JZ_ADC_CONFIG_XYZ_OFFSET(dnum)	((xyz) << 13)
+#define JZ_ADC_CONFIG_XYZ_OFFSET(xyz)	((xyz) << 13)
 #define JZ_ADC_CONFIG_SAMPLE_NUM(x)	((x) << 10)
 #define JZ_ADC_CONFIG_CLKDIV(div)	((div) << 5)