ar71xx: add support for TL-WR740N v1
[openwrt.git] / target / linux / xburst / patches-2.6.36 / 060-adc-touchscreen.patch
1 From 9e8c7624668261bd0b6ee751642ca2c60a8aaba9 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sun, 5 Sep 2010 20:36:59 +0200
4 Subject: [PATCH] MFD: jz4740-adc: Add support for the touchscreen part of the adc unit
5
6 ---
7 drivers/mfd/jz4740-adc.c | 39 ++++++++++++++++++++++++++++++++++++---
8 include/linux/jz4740-adc.h | 2 +-
9 2 files changed, 37 insertions(+), 4 deletions(-)
10
11 --- a/drivers/mfd/jz4740-adc.c
12 +++ b/drivers/mfd/jz4740-adc.c
13 @@ -46,9 +46,9 @@
14 enum {
15 JZ_ADC_IRQ_ADCIN = 0,
16 JZ_ADC_IRQ_BATTERY,
17 - JZ_ADC_IRQ_TOUCH,
18 - JZ_ADC_IRQ_PENUP,
19 - JZ_ADC_IRQ_PENDOWN,
20 + JZ_ADC_IRQ_TS_DATA_READY,
21 + JZ_ADC_IRQ_TS_PENUP,
22 + JZ_ADC_IRQ_TS_PENDOWN,
23 };
24
25 struct jz4740_adc {
26 @@ -101,6 +101,7 @@ static void jz4740_adc_irq_ack(unsigned
27 struct jz4740_adc *adc = get_irq_chip_data(irq);
28
29 irq -= adc->irq_base;
30 +
31 writeb(BIT(irq), adc->base + JZ_REG_ADC_STATUS);
32 }
33
34 @@ -227,6 +228,27 @@ static struct resource jz4740_battery_re
35 },
36 };
37
38 +static struct resource jz4740_ts_resources[] = {
39 + {
40 + .start = JZ_ADC_IRQ_TS_DATA_READY,
41 + .flags = IORESOURCE_IRQ,
42 + },
43 + {
44 + .start = JZ_ADC_IRQ_TS_PENUP,
45 + .flags = IORESOURCE_IRQ,
46 + },
47 + {
48 + .start = JZ_ADC_IRQ_TS_PENDOWN,
49 + .flags = IORESOURCE_IRQ,
50 + },
51 + {
52 + .start = JZ_REG_ADC_TOUCHSCREEN_BASE,
53 + .end = JZ_REG_ADC_TOUCHSCREEN_BASE + 0xb,
54 + .flags = IORESOURCE_MEM,
55 + },
56 +};
57 +
58 +
59 const struct mfd_cell jz4740_adc_cells[] = {
60 {
61 .id = 0,
62 @@ -250,6 +272,17 @@ const struct mfd_cell jz4740_adc_cells[]
63 .enable = jz4740_adc_cell_enable,
64 .disable = jz4740_adc_cell_disable,
65 },
66 + {
67 + .id = 2,
68 + .name = "jz4740-ts",
69 + .num_resources = ARRAY_SIZE(jz4740_ts_resources),
70 + .resources = jz4740_ts_resources,
71 + .platform_data = (void *)&jz4740_adc_cells[2],
72 + .data_size = sizeof(struct mfd_cell),
73 +
74 + .enable = jz4740_adc_cell_enable,
75 + .disable = jz4740_adc_cell_disable,
76 + },
77 };
78
79 static int __devinit jz4740_adc_probe(struct platform_device *pdev)
80 --- a/include/linux/jz4740-adc.h
81 +++ b/include/linux/jz4740-adc.h
82 @@ -25,7 +25,7 @@ int jz4740_adc_set_config(struct device
83 #define JZ_ADC_CONFIG_BAT_MB BIT(4)
84
85 #define JZ_ADC_CONFIG_DNUM(dnum) ((dnum) << 16)
86 -#define JZ_ADC_CONFIG_XYZ_OFFSET(dnum) ((xyz) << 13)
87 +#define JZ_ADC_CONFIG_XYZ_OFFSET(xyz) ((xyz) << 13)
88 #define JZ_ADC_CONFIG_SAMPLE_NUM(x) ((x) << 10)
89 #define JZ_ADC_CONFIG_CLKDIV(div) ((div) << 5)
90
This page took 0.043791 seconds and 5 git commands to generate.