blob: 87794c4f9f734a6bb42bf63b12109f85ee4f3322 [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
Chun Zhangf39a0652013-05-01 15:57:54 -070044static struct gpiomux_setting atmel_int_act_cfg = {
45 .func = GPIOMUX_FUNC_GPIO,
46 .drv = GPIOMUX_DRV_8MA,
47 .pull = GPIOMUX_PULL_UP,
Gilad Avidovf58f1832013-01-09 17:31:28 -070048};
49
Chun Zhangf39a0652013-05-01 15:57:54 -070050static struct gpiomux_setting atmel_int_sus_cfg = {
51 .func = GPIOMUX_FUNC_GPIO,
52 .drv = GPIOMUX_DRV_2MA,
53 .pull = GPIOMUX_PULL_DOWN,
54};
55
56static struct gpiomux_setting atmel_reset_act_cfg = {
57 .func = GPIOMUX_FUNC_GPIO,
58 .drv = GPIOMUX_DRV_6MA,
59 .pull = GPIOMUX_PULL_UP,
60};
61
62static struct gpiomux_setting atmel_reset_sus_cfg = {
63 .func = GPIOMUX_FUNC_GPIO,
Gilad Avidovf58f1832013-01-09 17:31:28 -070064 .drv = GPIOMUX_DRV_6MA,
65 .pull = GPIOMUX_PULL_DOWN,
66};
67
Figo Wangb1510f82013-06-13 19:40:20 +080068static struct gpiomux_setting focaltech_int_act_cfg = {
69 .func = GPIOMUX_FUNC_GPIO,
70 .drv = GPIOMUX_DRV_8MA,
71 .pull = GPIOMUX_PULL_UP,
72};
73
74static struct gpiomux_setting focaltech_int_sus_cfg = {
75 .func = GPIOMUX_FUNC_GPIO,
76 .drv = GPIOMUX_DRV_2MA,
77 .pull = GPIOMUX_PULL_DOWN,
78};
79
80static struct gpiomux_setting focaltech_reset_act_cfg = {
81 .func = GPIOMUX_FUNC_GPIO,
82 .drv = GPIOMUX_DRV_6MA,
83 .pull = GPIOMUX_PULL_UP,
84};
85
86static struct gpiomux_setting focaltech_reset_sus_cfg = {
87 .func = GPIOMUX_FUNC_GPIO,
88 .drv = GPIOMUX_DRV_6MA,
89 .pull = GPIOMUX_PULL_UP,
90};
91
Sameer Thalappil1fafd672013-04-03 12:31:04 -070092static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
93 .func = GPIOMUX_FUNC_GPIO,
94 .drv = GPIOMUX_DRV_2MA,
95 .pull = GPIOMUX_PULL_UP,
96};
97
98static struct gpiomux_setting wcnss_5wire_active_cfg = {
99 .func = GPIOMUX_FUNC_1,
100 .drv = GPIOMUX_DRV_6MA,
101 .pull = GPIOMUX_PULL_DOWN,
102};
103
Xiaoming Zhou17972262013-04-10 17:50:35 -0400104static struct gpiomux_setting lcd_en_act_cfg = {
105 .func = GPIOMUX_FUNC_GPIO,
106 .drv = GPIOMUX_DRV_8MA,
107 .pull = GPIOMUX_PULL_NONE,
108 .dir = GPIOMUX_OUT_HIGH,
109};
110
111static struct gpiomux_setting lcd_en_sus_cfg = {
112 .func = GPIOMUX_FUNC_GPIO,
113 .drv = GPIOMUX_DRV_2MA,
114 .pull = GPIOMUX_PULL_DOWN,
115};
116
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400117static struct gpiomux_setting lcd_te_act_config = {
118 .func = GPIOMUX_FUNC_1,
119 .drv = GPIOMUX_DRV_2MA,
120 .pull = GPIOMUX_PULL_DOWN,
121 .dir = GPIOMUX_IN,
122};
123
124static struct gpiomux_setting lcd_te_sus_config = {
125 .func = GPIOMUX_FUNC_1,
126 .drv = GPIOMUX_DRV_2MA,
127 .pull = GPIOMUX_PULL_DOWN,
128 .dir = GPIOMUX_IN,
129};
130
Amy Maloche19c386b2013-04-15 14:06:01 -0700131static struct gpiomux_setting gpio_keys_active = {
132 .func = GPIOMUX_FUNC_GPIO,
133 .drv = GPIOMUX_DRV_2MA,
134 .pull = GPIOMUX_PULL_UP,
135};
136
137static struct gpiomux_setting gpio_keys_suspend = {
138 .func = GPIOMUX_FUNC_GPIO,
139 .drv = GPIOMUX_DRV_2MA,
140 .pull = GPIOMUX_PULL_NONE,
141};
142
Richard Liua1d406a2013-04-14 13:46:48 -0700143/* define gpio used as interrupt input */
144static struct gpiomux_setting gpio_int_act_cfg = {
145 .func = GPIOMUX_FUNC_GPIO,
146 .drv = GPIOMUX_DRV_2MA,
147 .pull = GPIOMUX_PULL_UP,
148 .dir = GPIOMUX_IN,
149};
150
151static struct gpiomux_setting gpio_int_sus_cfg = {
152 .func = GPIOMUX_FUNC_GPIO,
153 .drv = GPIOMUX_DRV_2MA,
154 .pull = GPIOMUX_PULL_UP,
155 .dir = GPIOMUX_IN,
156};
157
158static struct msm_gpiomux_config msm_gpio_int_configs[] __initdata = {
159 {
160 .gpio = 84,
161 .settings = {
162 [GPIOMUX_ACTIVE] = &gpio_int_act_cfg,
163 [GPIOMUX_SUSPENDED] = &gpio_int_sus_cfg,
164 },
165 },
166};
167
Xiaoming Zhou17972262013-04-10 17:50:35 -0400168static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
169 {
170 .gpio = 41,
171 .settings = {
172 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
173 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
174 },
175 },
176 {
177 .gpio = 7,
178 .settings = {
179 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
180 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
181 },
182 },
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400183 {
184 .gpio = 12,
185 .settings = {
186 [GPIOMUX_ACTIVE] = &lcd_te_act_config,
187 [GPIOMUX_SUSPENDED] = &lcd_te_sus_config,
188 },
189 },
Xiaoming Zhou17972262013-04-10 17:50:35 -0400190};
191
Gilad Avidovf84f2792013-01-31 13:26:39 -0700192static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
193 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700194 .gpio = 2, /* BLSP1 QUP1 I2C_SDA */
195 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800196 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Chun Zhangf39a0652013-05-01 15:57:54 -0700197 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
198 },
199 },
200 {
201 .gpio = 3, /* BLSP1 QUP1 I2C_SCL */
202 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800203 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Chun Zhangf39a0652013-05-01 15:57:54 -0700204 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
205 },
206 },
207 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700208 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700209 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800210 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidovf84f2792013-01-31 13:26:39 -0700211 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
212 },
213 },
214 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700215 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700216 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800217 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidovf84f2792013-01-31 13:26:39 -0700218 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
219 },
220 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700221 {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600222 .gpio = 16, /* BLSP1 QUP6 I2C_SDA */
223 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800224 [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config,
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600225 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
226 },
227 },
228 {
229 .gpio = 17, /* BLSP1 QUP6 I2C_SCL */
230 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800231 [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config,
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600232 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
233 },
234 },
Chun Zhangf39a0652013-05-01 15:57:54 -0700235};
236
237static struct msm_gpiomux_config msm_atmel_configs[] __initdata = {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600238 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700239 .gpio = 0, /* TOUCH RESET */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700240 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700241 [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg,
242 [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700243 },
244 },
245 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700246 .gpio = 1, /* TOUCH INT */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700247 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700248 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
249 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700250 },
251 },
Gilad Avidova460c472013-04-12 16:23:32 -0600252 {
253 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
254 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530255 [GPIOMUX_ACTIVE] = &gpio_spi_config,
256 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600257 },
258 },
259 {
260 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
261 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530262 [GPIOMUX_ACTIVE] = &gpio_spi_config,
263 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600264 },
265 },
266 {
267 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
268 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530269 [GPIOMUX_ACTIVE] = &gpio_spi_config,
270 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600271 },
272 },
273 {
274 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
275 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530276 [GPIOMUX_ACTIVE] = &gpio_spi_config,
277 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600278 },
279 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700280};
281
Figo Wangb1510f82013-06-13 19:40:20 +0800282static struct msm_gpiomux_config msm_focaltech_configs[] __initdata = {
283 {
284 .gpio = 0, /* TOUCH RESET */
285 .settings = {
286 [GPIOMUX_ACTIVE] = &focaltech_reset_act_cfg,
287 [GPIOMUX_SUSPENDED] = &focaltech_reset_sus_cfg,
288 },
289 },
290 {
291 .gpio = 1, /* TOUCH INT */
292 .settings = {
293 [GPIOMUX_ACTIVE] = &focaltech_int_act_cfg,
294 [GPIOMUX_SUSPENDED] = &focaltech_int_sus_cfg,
295 },
296 },
297 {
298 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
299 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530300 [GPIOMUX_ACTIVE] = &gpio_spi_config,
301 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800302 },
303 },
304 {
305 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
306 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530307 [GPIOMUX_ACTIVE] = &gpio_spi_config,
308 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800309 },
310 },
311 {
312 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
313 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530314 [GPIOMUX_ACTIVE] = &gpio_spi_config,
315 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800316 },
317 },
318 {
319 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
320 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530321 [GPIOMUX_ACTIVE] = &gpio_spi_config,
322 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800323 },
324 },
325};
326
327
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700328static struct msm_gpiomux_config wcnss_5wire_interface[] = {
329 {
330 .gpio = 23,
331 .settings = {
332 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
333 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
334 },
335 },
336 {
337 .gpio = 24,
338 .settings = {
339 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
340 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
341 },
342 },
343 {
344 .gpio = 25,
345 .settings = {
346 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
347 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
348 },
349 },
350 {
351 .gpio = 26,
352 .settings = {
353 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
354 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
355 },
356 },
357 {
358 .gpio = 27,
359 .settings = {
360 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
361 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
362 },
363 },
364};
365
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700366static struct gpiomux_setting gpio_suspend_config[] = {
367 {
368 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
369 .drv = GPIOMUX_DRV_2MA,
370 .pull = GPIOMUX_PULL_NONE,
371 },
372 {
373 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
374 .drv = GPIOMUX_DRV_2MA,
375 .pull = GPIOMUX_PULL_NONE,
376 .dir = GPIOMUX_OUT_LOW,
377 },
378};
379
380static struct gpiomux_setting cam_settings[] = {
381 {
382 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
383 .drv = GPIOMUX_DRV_2MA,
384 .pull = GPIOMUX_PULL_NONE,
385 },
386
387 {
388 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
389 .drv = GPIOMUX_DRV_2MA,
390 .pull = GPIOMUX_PULL_DOWN,
391 },
392
393 {
394 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
395 .drv = GPIOMUX_DRV_2MA,
396 .pull = GPIOMUX_PULL_KEEPER,
397 },
398
399 {
400 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
401 .drv = GPIOMUX_DRV_2MA,
402 .pull = GPIOMUX_PULL_NONE,
403 },
404
405 {
406 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
407 .drv = GPIOMUX_DRV_2MA,
408 .pull = GPIOMUX_PULL_DOWN,
409 },
410};
411
412static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
413 {
414 .gpio = 13, /* CAM_MCLK0 */
415 .settings = {
416 [GPIOMUX_ACTIVE] = &cam_settings[0],
417 [GPIOMUX_SUSPENDED] = &cam_settings[1],
418 },
419 },
420 {
421 .gpio = 14, /* CAM_MCLK1 */
422 .settings = {
423 [GPIOMUX_ACTIVE] = &cam_settings[0],
424 [GPIOMUX_SUSPENDED] = &cam_settings[1],
425 },
426 },
427 {
428 .gpio = 16, /* CCI_I2C_SDA */
429 .settings = {
430 [GPIOMUX_ACTIVE] = &cam_settings[0],
431 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
432 },
433 },
434 {
435 .gpio = 17, /* CCI_I2C_SCL */
436 .settings = {
437 [GPIOMUX_ACTIVE] = &cam_settings[0],
438 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
439 },
440 },
441 {
442 .gpio = 18, /* FLASH_LED_EN */
443 .settings = {
Lokesh Kumar Aakulu034626d2013-05-10 20:30:07 -0700444 [GPIOMUX_ACTIVE] = &cam_settings[3],
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700445 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
446 },
447 },
448 {
449 .gpio = 19, /* FLASH_LED_NOW */
450 .settings = {
Lokesh Kumar Aakulu034626d2013-05-10 20:30:07 -0700451 [GPIOMUX_ACTIVE] = &cam_settings[3],
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700452 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
453 },
454 },
455 {
456 .gpio = 8, /* CAM1_STANDBY_N */
457 .settings = {
458 [GPIOMUX_ACTIVE] = &cam_settings[3],
459 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
460 },
461 },
462 {
463 .gpio = 15, /* CAM1_RST_N */
464 .settings = {
465 [GPIOMUX_ACTIVE] = &cam_settings[3],
466 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
467 },
468 },
469 {
470 .gpio = 20, /* WEBCAM1_STANDBY */
471 .settings = {
472 [GPIOMUX_ACTIVE] = &cam_settings[3],
473 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
474 },
475 },
476 {
477 .gpio = 21, /* WEBCAM2_RESET_N */
478 .settings = {
479 [GPIOMUX_ACTIVE] = &cam_settings[3],
480 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
481 },
482 },
483};
484
Amy Maloche19c386b2013-04-15 14:06:01 -0700485static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
486 {
487 .gpio = 72,
488 .settings = {
489 [GPIOMUX_ACTIVE] = &gpio_keys_active,
490 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
491 },
492 },
493 {
494 .gpio = 73,
495 .settings = {
496 [GPIOMUX_ACTIVE] = &gpio_keys_active,
497 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
498 },
499 },
500 {
501 .gpio = 74,
502 .settings = {
503 [GPIOMUX_ACTIVE] = &gpio_keys_active,
504 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
505 },
506 },
507};
508
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700509static struct gpiomux_setting sd_card_det_active_config = {
510 .func = GPIOMUX_FUNC_GPIO,
511 .drv = GPIOMUX_DRV_2MA,
512 .pull = GPIOMUX_PULL_NONE,
513 .dir = GPIOMUX_IN,
514};
515
516static struct gpiomux_setting sd_card_det_suspend_config = {
517 .func = GPIOMUX_FUNC_GPIO,
518 .drv = GPIOMUX_DRV_2MA,
519 .pull = GPIOMUX_PULL_UP,
520 .dir = GPIOMUX_IN,
521};
522
523static struct msm_gpiomux_config sd_card_det[] __initdata = {
524 {
525 .gpio = 42,
526 .settings = {
527 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
528 [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config,
529 },
530 },
531};
532
Bingzhe Caife20b712013-07-15 16:48:49 +0800533static struct gpiomux_setting interrupt_gpio_active = {
534 .func = GPIOMUX_FUNC_GPIO,
535 .drv = GPIOMUX_DRV_6MA,
536 .pull = GPIOMUX_PULL_UP,
537};
538
539static struct gpiomux_setting interrupt_gpio_suspend_pullup = {
540 .func = GPIOMUX_FUNC_GPIO,
541 .drv = GPIOMUX_DRV_6MA,
542 .pull = GPIOMUX_PULL_UP,
543};
544
545static struct gpiomux_setting interrupt_gpio_suspend_pulldown = {
546 .func = GPIOMUX_FUNC_GPIO,
547 .drv = GPIOMUX_DRV_6MA,
548 .pull = GPIOMUX_PULL_UP,
549};
550
551static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = {
552 {
553 .gpio = 77, /* NFC_IRQ */
554 .settings = {
555 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
556 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
557 },
558 },
559 {
560 .gpio = 78, /*ETH_INT */
561 .settings = {
562 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
563 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
564 },
565 },
566 {
567 .gpio = 80, /*ALSP_INT */
568 .settings = {
569 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
570 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
571 },
572 },
573 {
574 .gpio = 81, /*ACCEL_INT1 */
575 .settings = {
576 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
577 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown,
578 },
579 },
580 {
581 .gpio = 82, /*ACCEL_INT2 */
582 .settings = {
583 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
584 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown,
585 },
586 },
587};
588
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800589void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800590{
591 int rc;
592
Rohit Vaswani341c2032012-11-08 18:49:29 -0800593 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800594 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800595 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800596 return;
597 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700598
599 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Figo Wangb1510f82013-06-13 19:40:20 +0800600 if (of_board_is_qrd()) {
601 msm_gpiomux_install(msm_focaltech_configs,
602 ARRAY_SIZE(msm_focaltech_configs));
603 } else {
604 msm_gpiomux_install(msm_atmel_configs,
Chun Zhangf39a0652013-05-01 15:57:54 -0700605 ARRAY_SIZE(msm_atmel_configs));
Figo Wangb1510f82013-06-13 19:40:20 +0800606 }
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700607 msm_gpiomux_install(wcnss_5wire_interface,
608 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhoua329c942013-07-10 10:32:20 -0400609 msm_gpiomux_install_nowrite(msm_lcd_configs,
610 ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700611 msm_gpiomux_install(msm_keypad_configs,
612 ARRAY_SIZE(msm_keypad_configs));
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700613 msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det));
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700614 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Richard Liua1d406a2013-04-14 13:46:48 -0700615 msm_gpiomux_install(msm_gpio_int_configs,
616 ARRAY_SIZE(msm_gpio_int_configs));
Bingzhe Caife20b712013-07-15 16:48:49 +0800617 if (of_board_is_qrd())
618 msm_gpiomux_install(msm_interrupt_configs,
619 ARRAY_SIZE(msm_interrupt_configs));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800620}