blob: f70b4a3aeeebb9f6d8a96b5be7df1bb1735d3ad0 [file] [log] [blame]
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Hanumant Singh55a1bb02012-11-06 10:01:15 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
Figo Wangb1510f82013-06-13 19:40:20 +080019#include <mach/socinfo.h>
Hanumant Singh55a1bb02012-11-06 10:01:15 -080020
Gilad Avidova460c472013-04-12 16:23:32 -060021static struct gpiomux_setting gpio_spi_config = {
22 .func = GPIOMUX_FUNC_1,
23 .drv = GPIOMUX_DRV_6MA,
24 .pull = GPIOMUX_PULL_NONE,
25};
Sana Venkat Rajue53161a2013-09-17 16:33:26 +053026static struct gpiomux_setting gpio_spi_susp_config = {
27 .func = GPIOMUX_FUNC_GPIO,
28 .drv = GPIOMUX_DRV_2MA,
29 .pull = GPIOMUX_PULL_DOWN,
30};
Gilad Avidova460c472013-04-12 16:23:32 -060031
Gilad Avidovf84f2792013-01-31 13:26:39 -070032static struct gpiomux_setting gpio_i2c_config = {
33 .func = GPIOMUX_FUNC_3,
34 .drv = GPIOMUX_DRV_2MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -060038static struct gpiomux_setting gpio_cam_i2c_config = {
39 .func = GPIOMUX_FUNC_1,
40 .drv = GPIOMUX_DRV_2MA,
41 .pull = GPIOMUX_PULL_NONE,
42};
43
Bansidhar Gopalacharie331f372013-09-25 19:50:43 +010044static struct gpiomux_setting gpio_nfc_config = {
45 .func = GPIOMUX_FUNC_2,
46 .drv = GPIOMUX_DRV_2MA,
47 .pull = GPIOMUX_PULL_NONE,
48};
49static struct gpiomux_setting gpio_nfc_sus_config = {
50 .func = GPIOMUX_FUNC_2,
51 .drv = GPIOMUX_DRV_2MA,
52 .pull = GPIOMUX_PULL_DOWN,
53};
54
Chun Zhangf39a0652013-05-01 15:57:54 -070055static struct gpiomux_setting atmel_int_act_cfg = {
56 .func = GPIOMUX_FUNC_GPIO,
57 .drv = GPIOMUX_DRV_8MA,
58 .pull = GPIOMUX_PULL_UP,
Gilad Avidovf58f1832013-01-09 17:31:28 -070059};
60
Chun Zhangf39a0652013-05-01 15:57:54 -070061static struct gpiomux_setting atmel_int_sus_cfg = {
62 .func = GPIOMUX_FUNC_GPIO,
63 .drv = GPIOMUX_DRV_2MA,
64 .pull = GPIOMUX_PULL_DOWN,
65};
66
67static struct gpiomux_setting atmel_reset_act_cfg = {
68 .func = GPIOMUX_FUNC_GPIO,
69 .drv = GPIOMUX_DRV_6MA,
70 .pull = GPIOMUX_PULL_UP,
71};
72
73static struct gpiomux_setting atmel_reset_sus_cfg = {
74 .func = GPIOMUX_FUNC_GPIO,
Gilad Avidovf58f1832013-01-09 17:31:28 -070075 .drv = GPIOMUX_DRV_6MA,
76 .pull = GPIOMUX_PULL_DOWN,
77};
78
Figo Wangb1510f82013-06-13 19:40:20 +080079static struct gpiomux_setting focaltech_int_act_cfg = {
80 .func = GPIOMUX_FUNC_GPIO,
81 .drv = GPIOMUX_DRV_8MA,
82 .pull = GPIOMUX_PULL_UP,
83};
84
85static struct gpiomux_setting focaltech_int_sus_cfg = {
86 .func = GPIOMUX_FUNC_GPIO,
87 .drv = GPIOMUX_DRV_2MA,
88 .pull = GPIOMUX_PULL_DOWN,
89};
90
91static struct gpiomux_setting focaltech_reset_act_cfg = {
92 .func = GPIOMUX_FUNC_GPIO,
93 .drv = GPIOMUX_DRV_6MA,
94 .pull = GPIOMUX_PULL_UP,
95};
96
97static struct gpiomux_setting focaltech_reset_sus_cfg = {
98 .func = GPIOMUX_FUNC_GPIO,
99 .drv = GPIOMUX_DRV_6MA,
100 .pull = GPIOMUX_PULL_UP,
101};
102
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700103static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
104 .func = GPIOMUX_FUNC_GPIO,
105 .drv = GPIOMUX_DRV_2MA,
106 .pull = GPIOMUX_PULL_UP,
107};
108
109static struct gpiomux_setting wcnss_5wire_active_cfg = {
110 .func = GPIOMUX_FUNC_1,
111 .drv = GPIOMUX_DRV_6MA,
112 .pull = GPIOMUX_PULL_DOWN,
113};
114
Xiaoming Zhou17972262013-04-10 17:50:35 -0400115static struct gpiomux_setting lcd_en_act_cfg = {
116 .func = GPIOMUX_FUNC_GPIO,
117 .drv = GPIOMUX_DRV_8MA,
118 .pull = GPIOMUX_PULL_NONE,
119 .dir = GPIOMUX_OUT_HIGH,
120};
121
122static struct gpiomux_setting lcd_en_sus_cfg = {
123 .func = GPIOMUX_FUNC_GPIO,
124 .drv = GPIOMUX_DRV_2MA,
125 .pull = GPIOMUX_PULL_DOWN,
126};
127
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400128static struct gpiomux_setting lcd_te_act_config = {
129 .func = GPIOMUX_FUNC_1,
130 .drv = GPIOMUX_DRV_2MA,
131 .pull = GPIOMUX_PULL_DOWN,
132 .dir = GPIOMUX_IN,
133};
134
135static struct gpiomux_setting lcd_te_sus_config = {
136 .func = GPIOMUX_FUNC_1,
137 .drv = GPIOMUX_DRV_2MA,
138 .pull = GPIOMUX_PULL_DOWN,
139 .dir = GPIOMUX_IN,
140};
141
Amy Maloche19c386b2013-04-15 14:06:01 -0700142static struct gpiomux_setting gpio_keys_active = {
143 .func = GPIOMUX_FUNC_GPIO,
144 .drv = GPIOMUX_DRV_2MA,
145 .pull = GPIOMUX_PULL_UP,
146};
147
148static struct gpiomux_setting gpio_keys_suspend = {
149 .func = GPIOMUX_FUNC_GPIO,
150 .drv = GPIOMUX_DRV_2MA,
151 .pull = GPIOMUX_PULL_NONE,
152};
153
Richard Liua1d406a2013-04-14 13:46:48 -0700154/* define gpio used as interrupt input */
155static struct gpiomux_setting gpio_int_act_cfg = {
156 .func = GPIOMUX_FUNC_GPIO,
157 .drv = GPIOMUX_DRV_2MA,
158 .pull = GPIOMUX_PULL_UP,
159 .dir = GPIOMUX_IN,
160};
161
162static struct gpiomux_setting gpio_int_sus_cfg = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_2MA,
165 .pull = GPIOMUX_PULL_UP,
166 .dir = GPIOMUX_IN,
167};
168
169static struct msm_gpiomux_config msm_gpio_int_configs[] __initdata = {
170 {
171 .gpio = 84,
172 .settings = {
173 [GPIOMUX_ACTIVE] = &gpio_int_act_cfg,
174 [GPIOMUX_SUSPENDED] = &gpio_int_sus_cfg,
175 },
176 },
177};
178
Xiaoming Zhou17972262013-04-10 17:50:35 -0400179static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
180 {
181 .gpio = 41,
182 .settings = {
183 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
184 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
185 },
186 },
187 {
188 .gpio = 7,
189 .settings = {
190 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
191 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
192 },
193 },
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400194 {
195 .gpio = 12,
196 .settings = {
197 [GPIOMUX_ACTIVE] = &lcd_te_act_config,
198 [GPIOMUX_SUSPENDED] = &lcd_te_sus_config,
199 },
200 },
Xiaoming Zhou17972262013-04-10 17:50:35 -0400201};
202
Gilad Avidovf84f2792013-01-31 13:26:39 -0700203static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
204 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700205 .gpio = 2, /* BLSP1 QUP1 I2C_SDA */
206 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800207 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Chun Zhangf39a0652013-05-01 15:57:54 -0700208 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
209 },
210 },
211 {
212 .gpio = 3, /* BLSP1 QUP1 I2C_SCL */
213 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800214 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Chun Zhangf39a0652013-05-01 15:57:54 -0700215 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
216 },
217 },
218 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700219 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700220 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800221 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidovf84f2792013-01-31 13:26:39 -0700222 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
223 },
224 },
225 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700226 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700227 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800228 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidovf84f2792013-01-31 13:26:39 -0700229 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
230 },
231 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700232 {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600233 .gpio = 16, /* BLSP1 QUP6 I2C_SDA */
234 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800235 [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config,
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600236 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
237 },
238 },
239 {
240 .gpio = 17, /* BLSP1 QUP6 I2C_SCL */
241 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800242 [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config,
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600243 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
244 },
245 },
Bansidhar Gopalacharie331f372013-09-25 19:50:43 +0100246 {
247 .gpio = 78, /* NFC CLK */
248 .settings = {
249 [GPIOMUX_ACTIVE] = &gpio_nfc_config,
250 [GPIOMUX_SUSPENDED] = &gpio_nfc_sus_config,
251 },
252 },
Chun Zhangf39a0652013-05-01 15:57:54 -0700253};
254
Houston Hoffman53421b42013-11-26 16:12:16 -0800255static struct gpiomux_setting gpio_i2c_nfc_pvt_config = {
256 .func = GPIOMUX_FUNC_5, /*active 1*/ /* 0 */
257 .drv = GPIOMUX_DRV_2MA,
258 .pull = GPIOMUX_PULL_NONE,
259 };
260
261static struct msm_gpiomux_config msm_nfc_configs[] __initdata = {
262 {
263 .gpio = 8, /* BLSP1 QUP2 I2C_SDA */
264 .settings = {
265 [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config,
266 [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config,
267 },
268 },
269 {
270 .gpio = 9, /* BLSP1 QUP2 I2C_SCL */
271 .settings = {
272 [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config,
273 [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config,
274 },
275 },
276};
277
Chun Zhangf39a0652013-05-01 15:57:54 -0700278static struct msm_gpiomux_config msm_atmel_configs[] __initdata = {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600279 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700280 .gpio = 0, /* TOUCH RESET */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700281 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700282 [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg,
283 [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700284 },
285 },
286 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700287 .gpio = 1, /* TOUCH INT */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700288 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700289 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
290 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700291 },
292 },
Gilad Avidova460c472013-04-12 16:23:32 -0600293 {
294 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
295 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530296 [GPIOMUX_ACTIVE] = &gpio_spi_config,
297 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600298 },
299 },
300 {
301 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
302 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530303 [GPIOMUX_ACTIVE] = &gpio_spi_config,
304 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600305 },
306 },
307 {
308 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
309 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530310 [GPIOMUX_ACTIVE] = &gpio_spi_config,
311 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600312 },
313 },
314 {
315 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
316 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530317 [GPIOMUX_ACTIVE] = &gpio_spi_config,
318 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600319 },
320 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700321};
322
Figo Wangb1510f82013-06-13 19:40:20 +0800323static struct msm_gpiomux_config msm_focaltech_configs[] __initdata = {
324 {
325 .gpio = 0, /* TOUCH RESET */
326 .settings = {
327 [GPIOMUX_ACTIVE] = &focaltech_reset_act_cfg,
328 [GPIOMUX_SUSPENDED] = &focaltech_reset_sus_cfg,
329 },
330 },
331 {
332 .gpio = 1, /* TOUCH INT */
333 .settings = {
334 [GPIOMUX_ACTIVE] = &focaltech_int_act_cfg,
335 [GPIOMUX_SUSPENDED] = &focaltech_int_sus_cfg,
336 },
337 },
338 {
339 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
340 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530341 [GPIOMUX_ACTIVE] = &gpio_spi_config,
342 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800343 },
344 },
345 {
346 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
347 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530348 [GPIOMUX_ACTIVE] = &gpio_spi_config,
349 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800350 },
351 },
352 {
353 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
354 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530355 [GPIOMUX_ACTIVE] = &gpio_spi_config,
356 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800357 },
358 },
359 {
360 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
361 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530362 [GPIOMUX_ACTIVE] = &gpio_spi_config,
363 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800364 },
365 },
366};
367
368
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700369static struct msm_gpiomux_config wcnss_5wire_interface[] = {
370 {
371 .gpio = 23,
372 .settings = {
373 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
374 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
375 },
376 },
377 {
378 .gpio = 24,
379 .settings = {
380 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
381 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
382 },
383 },
384 {
385 .gpio = 25,
386 .settings = {
387 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
388 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
389 },
390 },
391 {
392 .gpio = 26,
393 .settings = {
394 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
395 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
396 },
397 },
398 {
399 .gpio = 27,
400 .settings = {
401 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
402 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
403 },
404 },
405};
406
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700407static struct gpiomux_setting gpio_suspend_config[] = {
408 {
409 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
410 .drv = GPIOMUX_DRV_2MA,
411 .pull = GPIOMUX_PULL_NONE,
412 },
413 {
414 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
415 .drv = GPIOMUX_DRV_2MA,
416 .pull = GPIOMUX_PULL_NONE,
417 .dir = GPIOMUX_OUT_LOW,
418 },
419};
420
421static struct gpiomux_setting cam_settings[] = {
422 {
423 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
424 .drv = GPIOMUX_DRV_2MA,
425 .pull = GPIOMUX_PULL_NONE,
426 },
427
428 {
429 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
430 .drv = GPIOMUX_DRV_2MA,
431 .pull = GPIOMUX_PULL_DOWN,
432 },
433
434 {
435 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
436 .drv = GPIOMUX_DRV_2MA,
437 .pull = GPIOMUX_PULL_KEEPER,
438 },
439
440 {
441 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
442 .drv = GPIOMUX_DRV_2MA,
443 .pull = GPIOMUX_PULL_NONE,
444 },
445
446 {
447 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
448 .drv = GPIOMUX_DRV_2MA,
449 .pull = GPIOMUX_PULL_DOWN,
450 },
451};
452
453static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
454 {
455 .gpio = 13, /* CAM_MCLK0 */
456 .settings = {
457 [GPIOMUX_ACTIVE] = &cam_settings[0],
458 [GPIOMUX_SUSPENDED] = &cam_settings[1],
459 },
460 },
461 {
462 .gpio = 14, /* CAM_MCLK1 */
463 .settings = {
464 [GPIOMUX_ACTIVE] = &cam_settings[0],
465 [GPIOMUX_SUSPENDED] = &cam_settings[1],
466 },
467 },
468 {
469 .gpio = 16, /* CCI_I2C_SDA */
470 .settings = {
471 [GPIOMUX_ACTIVE] = &cam_settings[0],
472 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
473 },
474 },
475 {
476 .gpio = 17, /* CCI_I2C_SCL */
477 .settings = {
478 [GPIOMUX_ACTIVE] = &cam_settings[0],
479 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
480 },
481 },
482 {
483 .gpio = 18, /* FLASH_LED_EN */
484 .settings = {
Lokesh Kumar Aakulu034626d2013-05-10 20:30:07 -0700485 [GPIOMUX_ACTIVE] = &cam_settings[3],
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700486 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
487 },
488 },
489 {
490 .gpio = 19, /* FLASH_LED_NOW */
491 .settings = {
Lokesh Kumar Aakulu034626d2013-05-10 20:30:07 -0700492 [GPIOMUX_ACTIVE] = &cam_settings[3],
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700493 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
494 },
495 },
496 {
497 .gpio = 8, /* CAM1_STANDBY_N */
498 .settings = {
499 [GPIOMUX_ACTIVE] = &cam_settings[3],
500 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
501 },
502 },
503 {
504 .gpio = 15, /* CAM1_RST_N */
505 .settings = {
506 [GPIOMUX_ACTIVE] = &cam_settings[3],
507 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
508 },
509 },
510 {
511 .gpio = 20, /* WEBCAM1_STANDBY */
512 .settings = {
513 [GPIOMUX_ACTIVE] = &cam_settings[3],
514 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
515 },
516 },
517 {
518 .gpio = 21, /* WEBCAM2_RESET_N */
519 .settings = {
520 [GPIOMUX_ACTIVE] = &cam_settings[3],
521 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
522 },
523 },
524};
525
Amy Maloche19c386b2013-04-15 14:06:01 -0700526static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
527 {
528 .gpio = 72,
529 .settings = {
530 [GPIOMUX_ACTIVE] = &gpio_keys_active,
531 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
532 },
533 },
534 {
535 .gpio = 73,
536 .settings = {
537 [GPIOMUX_ACTIVE] = &gpio_keys_active,
538 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
539 },
540 },
541 {
542 .gpio = 74,
543 .settings = {
544 [GPIOMUX_ACTIVE] = &gpio_keys_active,
545 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
546 },
547 },
548};
549
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700550static struct gpiomux_setting sd_card_det_active_config = {
551 .func = GPIOMUX_FUNC_GPIO,
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_NONE,
554 .dir = GPIOMUX_IN,
555};
556
557static struct gpiomux_setting sd_card_det_suspend_config = {
558 .func = GPIOMUX_FUNC_GPIO,
559 .drv = GPIOMUX_DRV_2MA,
560 .pull = GPIOMUX_PULL_UP,
561 .dir = GPIOMUX_IN,
562};
563
564static struct msm_gpiomux_config sd_card_det[] __initdata = {
565 {
566 .gpio = 42,
567 .settings = {
568 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
569 [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config,
570 },
571 },
572};
573
Bingzhe Caife20b712013-07-15 16:48:49 +0800574static struct gpiomux_setting interrupt_gpio_active = {
575 .func = GPIOMUX_FUNC_GPIO,
576 .drv = GPIOMUX_DRV_6MA,
577 .pull = GPIOMUX_PULL_UP,
578};
579
580static struct gpiomux_setting interrupt_gpio_suspend_pullup = {
581 .func = GPIOMUX_FUNC_GPIO,
582 .drv = GPIOMUX_DRV_6MA,
583 .pull = GPIOMUX_PULL_UP,
584};
585
586static struct gpiomux_setting interrupt_gpio_suspend_pulldown = {
587 .func = GPIOMUX_FUNC_GPIO,
588 .drv = GPIOMUX_DRV_6MA,
589 .pull = GPIOMUX_PULL_UP,
590};
591
592static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = {
593 {
594 .gpio = 77, /* NFC_IRQ */
595 .settings = {
596 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
597 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
598 },
599 },
600 {
Bingzhe Caife20b712013-07-15 16:48:49 +0800601 .gpio = 80, /*ALSP_INT */
602 .settings = {
603 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
604 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
605 },
606 },
607 {
608 .gpio = 81, /*ACCEL_INT1 */
609 .settings = {
610 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
611 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown,
612 },
613 },
614 {
615 .gpio = 82, /*ACCEL_INT2 */
616 .settings = {
617 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
618 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown,
619 },
620 },
621};
622
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800623void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800624{
625 int rc;
626
Rohit Vaswani341c2032012-11-08 18:49:29 -0800627 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800628 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800629 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800630 return;
631 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700632
633 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Figo Wangb1510f82013-06-13 19:40:20 +0800634 if (of_board_is_qrd()) {
635 msm_gpiomux_install(msm_focaltech_configs,
636 ARRAY_SIZE(msm_focaltech_configs));
637 } else {
638 msm_gpiomux_install(msm_atmel_configs,
Chun Zhangf39a0652013-05-01 15:57:54 -0700639 ARRAY_SIZE(msm_atmel_configs));
Figo Wangb1510f82013-06-13 19:40:20 +0800640 }
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700641 msm_gpiomux_install(wcnss_5wire_interface,
642 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhoua329c942013-07-10 10:32:20 -0400643 msm_gpiomux_install_nowrite(msm_lcd_configs,
644 ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700645 msm_gpiomux_install(msm_keypad_configs,
646 ARRAY_SIZE(msm_keypad_configs));
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700647 msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det));
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700648 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Richard Liua1d406a2013-04-14 13:46:48 -0700649 msm_gpiomux_install(msm_gpio_int_configs,
650 ARRAY_SIZE(msm_gpio_int_configs));
Houston Hoffman53421b42013-11-26 16:12:16 -0800651 if (of_board_is_qrd()) {
Bingzhe Caife20b712013-07-15 16:48:49 +0800652 msm_gpiomux_install(msm_interrupt_configs,
653 ARRAY_SIZE(msm_interrupt_configs));
Houston Hoffman53421b42013-11-26 16:12:16 -0800654 msm_gpiomux_install(msm_nfc_configs,
655 ARRAY_SIZE(msm_nfc_configs));
656 }
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800657}