ar71xx: implement SoC specific phy interface setup
[openwrt.git] / target / linux / omap24xx / patches-3.1 / 330-n800-tsc2301-platform.patch
1 From f0bb9e67f0f13021e5033fed3dfe8ef78fe6a538 Mon Sep 17 00:00:00 2001
2 From: Marat Radchenko <marat@slonopotamus.org>
3 Date: Tue, 18 Oct 2011 21:52:56 +0400
4 Subject: [PATCH 2/2] N800: add TSC2301 board info
5
6 This patch adds TSC2301 init logic to N800 board file
7 ---
8 arch/arm/mach-omap2/board-n8x0.c | 141 ++++++++++++++++++++++++++++++++++++--
9 1 files changed, 135 insertions(+), 6 deletions(-)
10
11 Index: linux-3.1/arch/arm/mach-omap2/board-n8x0.c
12 ===================================================================
13 --- linux-3.1.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 19:32:22.288178756 +0100
14 +++ linux-3.1/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 19:32:26.840094004 +0100
15 @@ -27,6 +27,7 @@
16 #include <linux/spi/tsc2005.h>
17 #include <linux/input.h>
18 #include <linux/i2c/lm8323.h>
19 +#include <linux/spi/tsc2301.h>
20
21 #include <asm/mach/arch.h>
22 #include <asm/mach-types.h>
23 @@ -63,7 +64,75 @@ static struct omap2_mcspi_device_config
24 };
25 #endif
26
27 -static void __init tsc2005_set_config(void)
28 +#ifdef CONFIG_TOUCHSCREEN_TSC2301
29 +
30 +#define N800_KEYB_IRQ_GPIO 109
31 +
32 +static struct tsc2301_platform_data tsc2301_config = {
33 + .reset_gpio = 118,
34 + .keymap = {
35 + -1, /* Event for bit 0 */
36 + KEY_UP, /* Event for bit 1 (up) */
37 + KEY_F5, /* Event for bit 2 (home) */
38 + -1, /* Event for bit 3 */
39 + KEY_LEFT, /* Event for bit 4 (left) */
40 + KEY_ENTER, /* Event for bit 5 (enter) */
41 + KEY_RIGHT, /* Event for bit 6 (right) */
42 + -1, /* Event for bit 7 */
43 + KEY_ESC, /* Event for bit 8 (cycle) */
44 + KEY_DOWN, /* Event for bit 9 (down) */
45 + KEY_F4, /* Event for bit 10 (menu) */
46 + -1, /* Event for bit 11 */
47 + KEY_F8, /* Event for bit 12 (Zoom-) */
48 + KEY_F6, /* Event for bit 13 (FS) */
49 + KEY_F7, /* Event for bit 14 (Zoom+) */
50 + -1, /* Event for bit 15 */
51 + },
52 + .kp_rep = 0,
53 + .keyb_name = "Internal keypad",
54 +};
55 +
56 +static struct omap2_mcspi_device_config tsc2301_mcspi_config = {
57 + .turbo_mode = 0,
58 + .single_channel = 1,
59 +};
60 +
61 +/*
62 + TODO(Marat Radchenko): better pass GPIO to tsc2301 driver and let it
63 + allocate irq itself (as it is already done for touchscreen)
64 + */
65 +static void tsc2301_dev_init(void)
66 +{
67 + int r;
68 + int gpio = N800_KEYB_IRQ_GPIO;
69 +
70 + r = gpio_request(gpio, "tsc2301 KBD IRQ");
71 + if (r >= 0) {
72 + gpio_direction_input(gpio);
73 + tsc2301_config.keyb_int = gpio_to_irq(gpio);
74 + } else {
75 + printk(KERN_ERR "unable to get KBD GPIO");
76 + }
77 +
78 + gpio = 103;
79 + r = gpio_request(gpio, "tsc2301 DAV IRQ");
80 + if (r >= 0) {
81 + gpio_direction_input(gpio);
82 + tsc2301_config.dav_int = gpio_to_irq(gpio);
83 + } else {
84 + printk(KERN_ERR "unable to get DAV GPIO");
85 + }
86 +}
87 +
88 +#else
89 +
90 +static void __init tsc2301_dev_init(void)
91 +{
92 +}
93 +
94 +#endif
95 +
96 +static void __init n8x0_ts_set_config(void)
97 {
98 const struct omap_lcd_config *conf;
99
100 @@ -94,6 +163,37 @@ static void __init tsc2005_set_config(vo
101 tsc2005_config.ts_x_plate_ohm = 200;
102 }
103 #endif
104 +
105 +#ifdef CONFIG_TOUCHSCREEN_TSC2301
106 + if (strcmp(conf->panel_name, "lph8923") == 0) {
107 + tsc2301_config.ts_x_plate_ohm = 180;
108 + tsc2301_config.ts_hw_avg = 8;
109 + tsc2301_config.ts_max_pressure = 2048;
110 + tsc2301_config.ts_touch_pressure = 400;
111 + tsc2301_config.ts_stab_time = 100;
112 + tsc2301_config.ts_pressure_fudge = 2;
113 + tsc2301_config.ts_x_max = 4096;
114 + tsc2301_config.ts_x_fudge = 4;
115 + tsc2301_config.ts_y_max = 4096;
116 + tsc2301_config.ts_y_fudge = 7;
117 + } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
118 + tsc2301_config.ts_x_plate_ohm = 280;
119 + tsc2301_config.ts_hw_avg = 8;
120 + tsc2301_config.ts_touch_pressure = 400;
121 + tsc2301_config.ts_max_pressure = 2048;
122 + tsc2301_config.ts_stab_time = 1000;
123 + tsc2301_config.ts_pressure_fudge = 2;
124 + tsc2301_config.ts_x_max = 4096;
125 + tsc2301_config.ts_x_fudge = 4;
126 + tsc2301_config.ts_y_max = 4096;
127 + tsc2301_config.ts_y_fudge = 7;
128 + } else {
129 + printk(KERN_ERR "Unknown panel type, set default "
130 + "touchscreen configuration\n");
131 + tsc2301_config.ts_x_plate_ohm = 200;
132 + tsc2301_config.ts_stab_time = 100;
133 + }
134 +#endif
135 }
136 }
137
138 @@ -347,13 +447,12 @@ static void __init n8x0_usb_init(void) {
139
140 #endif /*CONFIG_USB_MUSB_TUSB6010 */
141
142 -
143 static struct omap2_mcspi_device_config p54spi_mcspi_config = {
144 .turbo_mode = 0,
145 .single_channel = 1,
146 };
147
148 -static struct spi_board_info n800_spi_board_info[] __initdata = {
149 +static struct spi_board_info n8x0_common_spi_board_info[] __initdata = {
150 {
151 .modalias = "lcd_mipid",
152 .bus_num = 1,
153 @@ -369,6 +468,10 @@ static struct spi_board_info n800_spi_bo
154 .max_speed_hz = 48000000,
155 .controller_data = &p54spi_mcspi_config,
156 },
157 +};
158 +
159 +static struct spi_board_info n810_spi_board_info[] __initdata = {
160 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
161 {
162 .modalias = "tsc2005",
163 .bus_num = 1,
164 @@ -378,6 +481,20 @@ static struct spi_board_info n800_spi_bo
165 .controller_data = &tsc2005_mcspi_config,
166 .platform_data = &tsc2005_config,
167 },
168 +#endif
169 +};
170 +
171 +static struct spi_board_info n800_spi_board_info[] __initdata = {
172 +#if defined(CONFIG_TOUCHSCREEN_TSC2301)
173 + {
174 + .modalias = "tsc2301",
175 + .bus_num = 1,
176 + .chip_select = 0,
177 + .max_speed_hz = 6000000,
178 + .controller_data = &tsc2301_mcspi_config,
179 + .platform_data = &tsc2301_config,
180 + },
181 +#endif
182 };
183
184 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
185 @@ -1023,9 +1140,17 @@ static void __init n8x0_init_machine(voi
186 n8x0_bt_init();
187
188 /* FIXME: add n810 spi devices */
189 - tsc2005_set_config();
190 - spi_register_board_info(n800_spi_board_info,
191 - ARRAY_SIZE(n800_spi_board_info));
192 + n8x0_ts_set_config();
193 +
194 + spi_register_board_info(n8x0_common_spi_board_info,
195 + ARRAY_SIZE(n8x0_common_spi_board_info));
196 + if (machine_is_nokia_n800())
197 + spi_register_board_info(n800_spi_board_info,
198 + ARRAY_SIZE(n800_spi_board_info));
199 + else
200 + spi_register_board_info(n810_spi_board_info,
201 + ARRAY_SIZE(n810_spi_board_info));
202 +
203 omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
204 ARRAY_SIZE(n8x0_i2c_board_info_1));
205 omap_register_i2c_bus(2, 400, NULL, 0);
206 @@ -1035,6 +1160,8 @@ static void __init n8x0_init_machine(voi
207 board_serial_init();
208 n8x0_mipid_init();
209 n8x0_blizzard_init();
210 + if (machine_is_nokia_n800())
211 + tsc2301_dev_init();
212 gpmc_onenand_init(board_onenand_data);
213 n8x0_mmc_init();
214 n8x0_usb_init();
This page took 0.177216 seconds and 5 git commands to generate.