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