blob: 53432e133026bf2e9ddb2952128ecf287182af2d [file] [log] [blame]
Shantanu Jain55d277a2013-03-08 11:37:29 +05301/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -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
Steve Mucklef132c6c2012-06-06 18:30:57 -070014#include <linux/gpio.h>
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080015#include <asm/mach-types.h>
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080016#include <mach/gpiomux.h>
17#include <mach/socinfo.h>
18#include "devices.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080019#include "board-8930.h"
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080020
21/* The SPI configurations apply to GSBI 1*/
22static struct gpiomux_setting spi_active = {
23 .func = GPIOMUX_FUNC_1,
24 .drv = GPIOMUX_DRV_12MA,
25 .pull = GPIOMUX_PULL_NONE,
26};
27
28static struct gpiomux_setting spi_suspended_config = {
29 .func = GPIOMUX_FUNC_GPIO,
30 .drv = GPIOMUX_DRV_2MA,
31 .pull = GPIOMUX_PULL_DOWN,
32};
33
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080034static struct gpiomux_setting gsbi3_suspended_cfg = {
35 .func = GPIOMUX_FUNC_1,
36 .drv = GPIOMUX_DRV_2MA,
37 .pull = GPIOMUX_PULL_KEEPER,
38};
39
40static struct gpiomux_setting gsbi3_active_cfg = {
41 .func = GPIOMUX_FUNC_1,
42 .drv = GPIOMUX_DRV_8MA,
43 .pull = GPIOMUX_PULL_NONE,
44};
45
Taniya Das75596f92013-03-06 11:47:34 +053046static struct gpiomux_setting gsbi9_active_cfg = {
47 .func = GPIOMUX_FUNC_2,
48 .drv = GPIOMUX_DRV_8MA,
49 .pull = GPIOMUX_PULL_DOWN,
50};
51
52static struct gpiomux_setting gsbi9_suspended_cfg = {
53 .func = GPIOMUX_FUNC_2,
54 .drv = GPIOMUX_DRV_2MA,
55 .pull = GPIOMUX_PULL_DOWN,
56};
57
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080058static struct gpiomux_setting gsbi5 = {
59 .func = GPIOMUX_FUNC_1,
60 .drv = GPIOMUX_DRV_8MA,
61 .pull = GPIOMUX_PULL_NONE,
62};
63
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -060064static struct gpiomux_setting gsbi9 = {
65 .func = GPIOMUX_FUNC_2,
66 .drv = GPIOMUX_DRV_8MA,
67 .pull = GPIOMUX_PULL_NONE,
68};
69
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080070static struct gpiomux_setting gsbi10 = {
71 .func = GPIOMUX_FUNC_2,
72 .drv = GPIOMUX_DRV_8MA,
73 .pull = GPIOMUX_PULL_NONE,
74};
75
76static struct gpiomux_setting gsbi12 = {
77 .func = GPIOMUX_FUNC_1,
78 .drv = GPIOMUX_DRV_8MA,
79 .pull = GPIOMUX_PULL_NONE,
80};
81
Taniya Das75596f92013-03-06 11:47:34 +053082static struct gpiomux_setting external_vfr[] = {
83 /* Suspended state */
84 {
85 .func = GPIOMUX_FUNC_3,
86 .drv = GPIOMUX_DRV_2MA,
87 .pull = GPIOMUX_PULL_KEEPER,
88 },
89 /* Active state */
90 {
91 .func = GPIOMUX_FUNC_3,
92 .drv = GPIOMUX_DRV_2MA,
93 .pull = GPIOMUX_PULL_KEEPER,
94 },
95};
96
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080097static struct gpiomux_setting cdc_mclk = {
98 .func = GPIOMUX_FUNC_1,
Rohit Vaswani47e6c142012-09-19 16:11:06 -070099 .drv = GPIOMUX_DRV_2MA,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800100 .pull = GPIOMUX_PULL_NONE,
101};
102
103static struct gpiomux_setting audio_auxpcm[] = {
104 /* Suspended state */
105 {
106 .func = GPIOMUX_FUNC_GPIO,
107 .drv = GPIOMUX_DRV_2MA,
108 .pull = GPIOMUX_PULL_NONE,
109 },
110 /* Active state */
111 {
112 .func = GPIOMUX_FUNC_1,
113 .drv = GPIOMUX_DRV_2MA,
114 .pull = GPIOMUX_PULL_NONE,
115 },
116};
117
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700118static struct gpiomux_setting audio_mbhc = {
119 .func = GPIOMUX_FUNC_GPIO,
120 .drv = GPIOMUX_DRV_8MA,
121 .pull = GPIOMUX_PULL_NONE,
122};
123
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700124static struct gpiomux_setting audio_spkr_boost = {
125 .func = GPIOMUX_FUNC_GPIO,
126 .drv = GPIOMUX_DRV_8MA,
127 .pull = GPIOMUX_PULL_NONE,
128};
129
Laxminath Kasam46cf4b02013-03-20 23:28:26 +0530130static struct gpiomux_setting audio_useuro_switch = {
131 .func = GPIOMUX_FUNC_GPIO,
132 .drv = GPIOMUX_DRV_2MA,
133 .pull = GPIOMUX_PULL_NONE,
134};
135
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800136#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
137static struct gpiomux_setting gpio_eth_config = {
138 .pull = GPIOMUX_PULL_NONE,
139 .drv = GPIOMUX_DRV_8MA,
140 .func = GPIOMUX_FUNC_GPIO,
141};
142#endif
143
144static struct gpiomux_setting slimbus = {
145 .func = GPIOMUX_FUNC_1,
146 .drv = GPIOMUX_DRV_8MA,
147 .pull = GPIOMUX_PULL_KEEPER,
148};
149
150static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
151 .func = GPIOMUX_FUNC_GPIO,
152 .drv = GPIOMUX_DRV_2MA,
153 .pull = GPIOMUX_PULL_UP,
154};
155
156static struct gpiomux_setting wcnss_5wire_active_cfg = {
157 .func = GPIOMUX_FUNC_1,
158 .drv = GPIOMUX_DRV_6MA,
159 .pull = GPIOMUX_PULL_DOWN,
160};
161
Amy Malochef3c9db42011-12-08 15:17:35 -0800162static struct gpiomux_setting atmel_resout_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_6MA,
165 .pull = GPIOMUX_PULL_DOWN,
166};
167
Amy Malochef3c9db42011-12-08 15:17:35 -0800168static struct gpiomux_setting atmel_resout_act_cfg = {
169 .func = GPIOMUX_FUNC_GPIO,
170 .drv = GPIOMUX_DRV_6MA,
171 .pull = GPIOMUX_PULL_UP,
172};
173
174static struct gpiomux_setting atmel_ldo_en_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800175 .func = GPIOMUX_FUNC_GPIO,
176 .drv = GPIOMUX_DRV_6MA,
177 .pull = GPIOMUX_PULL_DOWN,
178};
179
Amy Malochef3c9db42011-12-08 15:17:35 -0800180static struct gpiomux_setting atmel_ldo_en_act_cfg = {
181 .func = GPIOMUX_FUNC_GPIO,
182 .drv = GPIOMUX_DRV_6MA,
183 .pull = GPIOMUX_PULL_DOWN,
184};
185
186static struct gpiomux_setting atmel_int_act_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800187 .func = GPIOMUX_FUNC_GPIO,
188 .drv = GPIOMUX_DRV_8MA,
189 .pull = GPIOMUX_PULL_UP,
190};
191
Amy Malochef3c9db42011-12-08 15:17:35 -0800192static struct gpiomux_setting atmel_int_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800193 .func = GPIOMUX_FUNC_GPIO,
194 .drv = GPIOMUX_DRV_2MA,
195 .pull = GPIOMUX_PULL_DOWN,
196};
Shantanu Jain55d277a2013-03-08 11:37:29 +0530197
198static struct gpiomux_setting synaptic_rmi4_resout_sus_cfg = {
199 .func = GPIOMUX_FUNC_GPIO,
200 .drv = GPIOMUX_DRV_6MA,
201 .pull = GPIOMUX_PULL_DOWN,
202};
203
204static struct gpiomux_setting synaptic_rmi4_resout_act_cfg = {
205 .func = GPIOMUX_FUNC_GPIO,
206 .drv = GPIOMUX_DRV_6MA,
207 .pull = GPIOMUX_PULL_UP,
208};
209
210static struct gpiomux_setting synaptic_rmi4_attn_act_cfg = {
211 .func = GPIOMUX_FUNC_GPIO,
212 .drv = GPIOMUX_DRV_8MA,
213 .pull = GPIOMUX_PULL_UP,
214};
215
216static struct gpiomux_setting synaptic_rmi4_attn_sus_cfg = {
217 .func = GPIOMUX_FUNC_GPIO,
218 .drv = GPIOMUX_DRV_2MA,
219 .pull = GPIOMUX_PULL_DOWN,
220};
221
Mayank Ranabf5084a2011-12-12 17:06:54 +0530222#ifdef MSM8930_PHASE_2
Mayank Ranabf5084a2011-12-12 17:06:54 +0530223static struct gpiomux_setting hsusb_sus_cfg = {
224 .func = GPIOMUX_FUNC_GPIO,
225 .drv = GPIOMUX_DRV_2MA,
David Keitelc72d8192012-01-09 11:33:55 -0800226 .pull = GPIOMUX_PULL_NONE,
227 .dir = GPIOMUX_OUT_LOW,
Mayank Ranabf5084a2011-12-12 17:06:54 +0530228};
229static struct msm_gpiomux_config msm8930_hsusb_configs[] = {
230 {
231 .gpio = 63, /* HSUSB_EXTERNAL_5V_LDO_EN */
232 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530233 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
234 },
235 },
236 {
237 .gpio = 97, /* HSUSB_5V_EN */
238 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530239 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
240 },
241 },
242};
243#endif
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800244
245static struct gpiomux_setting hap_lvl_shft_suspended_config = {
246 .func = GPIOMUX_FUNC_GPIO,
247 .drv = GPIOMUX_DRV_2MA,
248 .pull = GPIOMUX_PULL_DOWN,
249};
250
251static struct gpiomux_setting hap_lvl_shft_active_config = {
252 .func = GPIOMUX_FUNC_GPIO,
253 .drv = GPIOMUX_DRV_8MA,
254 .pull = GPIOMUX_PULL_UP,
255};
256
257static struct gpiomux_setting ap2mdm_cfg = {
258 .func = GPIOMUX_FUNC_GPIO,
259 .drv = GPIOMUX_DRV_8MA,
260 .pull = GPIOMUX_PULL_DOWN,
261};
262
263static struct gpiomux_setting mdm2ap_status_cfg = {
264 .func = GPIOMUX_FUNC_GPIO,
265 .drv = GPIOMUX_DRV_8MA,
266 .pull = GPIOMUX_PULL_NONE,
267};
268
269static struct gpiomux_setting mdm2ap_errfatal_cfg = {
270 .func = GPIOMUX_FUNC_GPIO,
271 .drv = GPIOMUX_DRV_16MA,
272 .pull = GPIOMUX_PULL_DOWN,
273};
274
275static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
276 .func = GPIOMUX_FUNC_GPIO,
277 .drv = GPIOMUX_DRV_8MA,
278 .pull = GPIOMUX_PULL_NONE,
279};
280
281static struct gpiomux_setting mdp_vsync_suspend_cfg = {
282 .func = GPIOMUX_FUNC_GPIO,
283 .drv = GPIOMUX_DRV_2MA,
284 .pull = GPIOMUX_PULL_DOWN,
285};
286
287static struct gpiomux_setting mdp_vsync_active_cfg = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_2MA,
290 .pull = GPIOMUX_PULL_DOWN,
291};
292
293#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
294static struct gpiomux_setting hdmi_suspend_cfg = {
295 .func = GPIOMUX_FUNC_GPIO,
296 .drv = GPIOMUX_DRV_2MA,
297 .pull = GPIOMUX_PULL_DOWN,
298};
299
300static struct gpiomux_setting hdmi_active_1_cfg = {
301 .func = GPIOMUX_FUNC_1,
302 .drv = GPIOMUX_DRV_2MA,
303 .pull = GPIOMUX_PULL_UP,
304};
305
306static struct gpiomux_setting hdmi_active_2_cfg = {
307 .func = GPIOMUX_FUNC_1,
308 .drv = GPIOMUX_DRV_2MA,
309 .pull = GPIOMUX_PULL_DOWN,
310};
Manoj Raoc6d904c2012-06-22 00:32:14 -0700311
312static struct gpiomux_setting hdmi_active_3_cfg = {
313 .func = GPIOMUX_FUNC_GPIO,
314 .drv = GPIOMUX_DRV_2MA,
315 .pull = GPIOMUX_PULL_UP,
316 .dir = GPIOMUX_IN,
317};
318
319static struct gpiomux_setting hdmi_active_4_cfg = {
320 .func = GPIOMUX_FUNC_GPIO,
321 .drv = GPIOMUX_DRV_2MA,
322 .pull = GPIOMUX_PULL_UP,
323 .dir = GPIOMUX_OUT_HIGH,
324};
325
326static struct gpiomux_setting hdmi_active_5_cfg = {
327 .func = GPIOMUX_FUNC_GPIO,
328 .drv = GPIOMUX_DRV_2MA,
329 .pull = GPIOMUX_PULL_UP,
330 .dir = GPIOMUX_OUT_HIGH,
331};
332
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800333#endif
334
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700335static struct gpiomux_setting sitar_reset = {
336 .func = GPIOMUX_FUNC_GPIO,
337 .drv = GPIOMUX_DRV_6MA,
338 .pull = GPIOMUX_PULL_NONE,
339 .dir = GPIOMUX_OUT_LOW,
340};
341
Taniya Das75596f92013-03-06 11:47:34 +0530342static struct gpiomux_setting usbsw_cfg = {
343 .func = GPIOMUX_FUNC_GPIO,
344 .drv = GPIOMUX_DRV_8MA,
345 .pull = GPIOMUX_PULL_DOWN,
346};
347
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800348#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
349static struct msm_gpiomux_config msm8960_ethernet_configs[] = {
350 {
351 .gpio = 90,
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
354 }
355 },
356 {
357 .gpio = 89,
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
360 }
361 },
362};
363#endif
364
365static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
366 {
367 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
368 .settings = {
369 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
370 [GPIOMUX_ACTIVE] = &spi_active,
371 },
372 },
373 {
374 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
375 .settings = {
376 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
377 [GPIOMUX_ACTIVE] = &spi_active,
378 },
379 },
380 {
381 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
384 [GPIOMUX_ACTIVE] = &spi_active,
385 },
386 },
387 {
388 .gpio = 9, /* GSBI1 QUP SPI_CLK */
389 .settings = {
390 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
391 [GPIOMUX_ACTIVE] = &spi_active,
392 },
393 },
394 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800395 .gpio = 16, /* GSBI3 I2C QUP SDA */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
398 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
399 },
400 },
401 {
402 .gpio = 17, /* GSBI3 I2C QUP SCL */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
405 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
406 },
407 },
408 {
409 .gpio = 22, /* GSBI5 UART2 */
410 .settings = {
411 [GPIOMUX_SUSPENDED] = &gsbi5,
412 },
413 },
414 {
415 .gpio = 23, /* GSBI5 UART2 */
416 .settings = {
417 [GPIOMUX_SUSPENDED] = &gsbi5,
418 },
419 },
420 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800421 .gpio = 44, /* GSBI12 I2C QUP SDA */
422 .settings = {
423 [GPIOMUX_SUSPENDED] = &gsbi12,
424 },
425 },
426 {
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -0600427 .gpio = 95, /* GSBI9 I2C QUP SDA */
428 .settings = {
429 [GPIOMUX_SUSPENDED] = &gsbi9,
430 },
431 },
432 {
433 .gpio = 96, /* GSBI12 I2C QUP SCL */
434 .settings = {
435 [GPIOMUX_SUSPENDED] = &gsbi9,
436 },
437 },
438 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800439 .gpio = 45, /* GSBI12 I2C QUP SCL */
440 .settings = {
441 [GPIOMUX_SUSPENDED] = &gsbi12,
442 },
443 },
444 {
445 .gpio = 73, /* GSBI10 I2C QUP SDA */
446 .settings = {
447 [GPIOMUX_SUSPENDED] = &gsbi10,
448 },
449 },
450 {
451 .gpio = 74, /* GSBI10 I2C QUP SCL */
452 .settings = {
453 [GPIOMUX_SUSPENDED] = &gsbi10,
454 },
455 },
456};
457
Kiran Gunda484442e2013-03-11 19:14:44 +0530458static struct msm_gpiomux_config msm8930_sglte_gsbi_configs[] __initdata = {
459 /* Add the I2C/SPI GPIOs Here */
460 {
461 .gpio = 6, /* GSBI1 TX */
462 .settings = {
463 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
464 [GPIOMUX_ACTIVE] = &spi_active,
465 },
466 },
467 {
468 .gpio = 7, /* GSBI1 RX */
469 .settings = {
470 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
471 [GPIOMUX_ACTIVE] = &spi_active,
472 },
473 },
474 {
475 .gpio = 8, /* GSBI1 CTS_N */
476 .settings = {
477 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
478 [GPIOMUX_ACTIVE] = &spi_active,
479 },
480 },
481 {
482 .gpio = 9, /* GSBI1 RFR_N */
483 .settings = {
484 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
485 [GPIOMUX_ACTIVE] = &spi_active,
486 },
487 },
488 {
489 .gpio = 16, /* GSBI3 I2C QUP SDA */
490 .settings = {
491 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
492 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
493 },
494 },
495 {
496 .gpio = 17, /* GSBI3 I2C QUP SCL */
497 .settings = {
498 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
499 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
500 },
501 },
502 {
503 .gpio = 44, /* GSBI12 I2C QUP SDA */
504 .settings = {
505 [GPIOMUX_SUSPENDED] = &gsbi12,
506 },
507 },
508 {
509 .gpio = 45, /* GSBI12 I2C QUP SCL */
510 .settings = {
511 [GPIOMUX_SUSPENDED] = &gsbi12,
512 },
513 },
514 {
515 .gpio = 73, /* GSBI10 I2C QUP SDA */
516 .settings = {
517 [GPIOMUX_SUSPENDED] = &gsbi10,
518 },
519 },
520 {
521 .gpio = 74, /* GSBI10 I2C QUP SCL */
522 .settings = {
523 [GPIOMUX_SUSPENDED] = &gsbi10,
524 },
525 },
526
527};
528
529
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800530static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
531 {
532 .gpio = 60, /* slimbus data */
533 .settings = {
534 [GPIOMUX_SUSPENDED] = &slimbus,
535 },
536 },
537 {
538 .gpio = 61, /* slimbus clk */
539 .settings = {
540 [GPIOMUX_SUSPENDED] = &slimbus,
541 },
542 },
543};
544
545static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
546 {
547 .gpio = 59,
548 .settings = {
549 [GPIOMUX_SUSPENDED] = &cdc_mclk,
550 },
551 },
552};
553
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700554static struct msm_gpiomux_config msm8960_audio_mbhc_configs[] __initdata = {
555 {
556 .gpio = 37,
557 .settings = {
558 [GPIOMUX_SUSPENDED] = &audio_mbhc,
559 },
560 },
Laxminath Kasam46cf4b02013-03-20 23:28:26 +0530561 {
562 .gpio = 80,
563 .settings = {
564 [GPIOMUX_SUSPENDED] = &audio_useuro_switch,
565 },
566 },
567};
568
569static struct msm_gpiomux_config msm8960_audio_mbhc_configs_sglte[] __initdata = {
570 {
571 .gpio = 50,
572 .settings = {
573 [GPIOMUX_SUSPENDED] = &audio_mbhc,
574 },
575 },
576 {
577 .gpio = 66,
578 .settings = {
579 [GPIOMUX_SUSPENDED] = &audio_useuro_switch,
580 },
581 },
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700582};
583
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700584static struct msm_gpiomux_config msm8960_audio_spkr_configs[] __initdata = {
585 {
586 .gpio = 15,
587 .settings = {
588 [GPIOMUX_SUSPENDED] = &audio_spkr_boost,
589 },
590 },
591};
592
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800593static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
594 {
595 .gpio = 63,
596 .settings = {
597 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
598 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
599 },
600 },
601 {
602 .gpio = 64,
603 .settings = {
604 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
605 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
606 },
607 },
608 {
609 .gpio = 65,
610 .settings = {
611 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
612 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
613 },
614 },
615 {
616 .gpio = 66,
617 .settings = {
618 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
619 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
620 },
621 },
622};
623
624static struct msm_gpiomux_config wcnss_5wire_interface[] = {
625 {
626 .gpio = 84,
627 .settings = {
628 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
629 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
630 },
631 },
632 {
633 .gpio = 85,
634 .settings = {
635 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
636 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
637 },
638 },
639 {
640 .gpio = 86,
641 .settings = {
642 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
643 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
644 },
645 },
646 {
647 .gpio = 87,
648 .settings = {
649 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
650 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
651 },
652 },
653 {
654 .gpio = 88,
655 .settings = {
656 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
657 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
658 },
659 },
660};
661
Amy Malochef3c9db42011-12-08 15:17:35 -0800662static struct msm_gpiomux_config msm8960_atmel_configs[] __initdata = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800663 { /* TS INTERRUPT */
664 .gpio = 11,
665 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800666 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
667 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800668 },
669 },
Amy Malochef3c9db42011-12-08 15:17:35 -0800670 { /* TS LDO ENABLE */
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800671 .gpio = 50,
672 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800673 [GPIOMUX_ACTIVE] = &atmel_ldo_en_act_cfg,
674 [GPIOMUX_SUSPENDED] = &atmel_ldo_en_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800675 },
676 },
677 { /* TS RESOUT */
678 .gpio = 52,
679 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800680 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
681 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800682 },
683 },
684};
685
Shantanu Jain55d277a2013-03-08 11:37:29 +0530686static struct msm_gpiomux_config msm8960_synaptic_rmi4_configs[] __initdata = {
687 { /* TS INTERRUPT */
688 .gpio = 11,
689 .settings = {
690 [GPIOMUX_ACTIVE] = &synaptic_rmi4_attn_act_cfg,
691 [GPIOMUX_SUSPENDED] = &synaptic_rmi4_attn_sus_cfg,
692 },
693 },
694 { /* TS RESOUT */
695 .gpio = 52,
696 .settings = {
697 [GPIOMUX_ACTIVE] = &synaptic_rmi4_resout_act_cfg,
698 [GPIOMUX_SUSPENDED] = &synaptic_rmi4_resout_sus_cfg,
699 },
700 },
701};
702
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800703static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
704 {
705 .gpio = 47,
706 .settings = {
707 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
708 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
709 },
710 },
711};
712
713static struct msm_gpiomux_config mdm_configs[] __initdata = {
714 /* AP2MDM_STATUS */
715 {
716 .gpio = 94,
717 .settings = {
718 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
719 }
720 },
721 /* MDM2AP_STATUS */
722 {
723 .gpio = 69,
724 .settings = {
725 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
726 }
727 },
728 /* MDM2AP_ERRFATAL */
729 {
730 .gpio = 70,
731 .settings = {
732 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
733 }
734 },
735 /* AP2MDM_ERRFATAL */
736 {
737 .gpio = 95,
738 .settings = {
739 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
740 }
741 },
742 /* AP2MDM_KPDPWR_N */
743 {
744 .gpio = 81,
745 .settings = {
746 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
747 }
748 },
749 /* AP2MDM_PMIC_RESET_N */
750 {
751 .gpio = 80,
752 .settings = {
753 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
754 }
755 }
756};
757
758static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
759 {
760 .gpio = 0,
761 .settings = {
762 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
763 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
764 },
765 }
766};
767
768#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
769static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
770 {
771 .gpio = 99,
772 .settings = {
773 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
774 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
775 },
776 },
777 {
778 .gpio = 100,
779 .settings = {
780 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
781 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
782 },
783 },
784 {
785 .gpio = 101,
786 .settings = {
787 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
788 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
789 },
790 },
791 {
792 .gpio = 102,
793 .settings = {
794 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
795 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
796 },
797 },
Manoj Raoc6d904c2012-06-22 00:32:14 -0700798
799};
800
801static struct msm_gpiomux_config msm8930_mhl_configs[] __initdata = {
802 {
803 .gpio = 72,
804 .settings = {
805 [GPIOMUX_ACTIVE] = &hdmi_active_3_cfg,
806 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
807 },
808 },
809 {
810 .gpio = 71,
811 .settings = {
812 [GPIOMUX_ACTIVE] = &hdmi_active_4_cfg,
813 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
814 },
815 },
816 {
817 .gpio = 73,
818 .settings = {
819 [GPIOMUX_ACTIVE] = &hdmi_active_5_cfg,
820 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
821 },
822 },
823
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800824};
825#endif
826
Amy Malochee8de95d2012-02-23 10:40:25 -0800827static struct gpiomux_setting haptics_active_cfg = {
828 .func = GPIOMUX_FUNC_GPIO,
829 .drv = GPIOMUX_DRV_8MA,
830 .pull = GPIOMUX_PULL_UP,
831};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530832static struct gpiomux_setting haptics_suspend_cfg = {
833 .func = GPIOMUX_FUNC_GPIO,
834 .drv = GPIOMUX_DRV_8MA,
835 .pull = GPIOMUX_PULL_DOWN,
836};
837
838static struct msm_gpiomux_config msm8930_haptics_configs[] __initdata = {
839 {
840 .gpio = 77,
841 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800842 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530843 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
844 },
845 },
846 {
847 .gpio = 78,
848 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800849 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530850 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
851 },
852 },
853};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530854
Krishna Konda41b6ab02012-05-16 15:08:03 -0700855static struct gpiomux_setting sd_det_line = {
856 .func = GPIOMUX_FUNC_GPIO,
857 .drv = GPIOMUX_DRV_2MA,
858 .pull = GPIOMUX_PULL_NONE,
859};
860
861static struct msm_gpiomux_config msm8930_sd_det_config[] __initdata = {
862 {
863 .gpio = 94, /* SD Card Detect Line */
864 .settings = {
865 [GPIOMUX_SUSPENDED] = &sd_det_line,
866 [GPIOMUX_ACTIVE] = &sd_det_line,
867 },
868 },
869};
870
Subhash Jadavaniaea501c2013-03-01 21:38:36 +0530871static struct msm_gpiomux_config msm8930_sd_det_config_evt[] __initdata = {
872 {
873 .gpio = 90, /* SD Card Detect Line */
874 .settings = {
875 [GPIOMUX_SUSPENDED] = &sd_det_line,
876 [GPIOMUX_ACTIVE] = &sd_det_line,
877 },
878 },
879};
880
Wentao Xuc7769c02012-08-03 15:06:41 -0400881static struct gpiomux_setting gyro_int_line = {
882 .func = GPIOMUX_FUNC_GPIO,
883 .drv = GPIOMUX_DRV_2MA,
884 .pull = GPIOMUX_PULL_NONE,
885};
886
887static struct msm_gpiomux_config msm8930_gyro_int_config[] __initdata = {
888 {
889 .gpio = 69, /* Gyro Interrupt Line */
890 .settings = {
891 [GPIOMUX_SUSPENDED] = &gyro_int_line,
892 [GPIOMUX_ACTIVE] = &gyro_int_line,
893 },
894 },
895};
896
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700897static struct msm_gpiomux_config msm_sitar_config[] __initdata = {
898 {
899 .gpio = 42, /* SYS_RST_N */
900 .settings = {
901 [GPIOMUX_SUSPENDED] = &sitar_reset,
902 },
903 }
904};
905
Taniya Das75596f92013-03-06 11:47:34 +0530906static struct msm_gpiomux_config sglte_8930_configs[] __initdata = {
907 /* AP2MDM_STATUS */
908 {
909 .gpio = 77,
910 .settings = {
911 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
912 }
913 },
914 /* MDM2AP_STATUS */
915 {
916 .gpio = 24,
917 .settings = {
918 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
919 }
920 },
921 /* MDM2AP_ERRFATAL */
922 {
923 .gpio = 40,
924 .settings = {
925 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
926 }
927 },
928 /* AP2MDM_ERRFATAL */
929 {
930 .gpio = 80,
931 .settings = {
932 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
933 }
934 },
935 /* AP2MDM_KPDPWR_N */
936 {
937 .gpio = 79,
938 .settings = {
939 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
940 }
941 },
942 /* AP2MDM_PMIC_PWR_EN */
943 {
944 .gpio = 22,
945 .settings = {
946 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
947 }
948 },
949 /* AP2MDM_SOFT_RESET */
950 {
951 .gpio = 78,
952 .settings = {
953 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
954 }
955 },
956 /* USB_SW */
957 {
958 .gpio = 25,
959 .settings = {
960 [GPIOMUX_SUSPENDED] = &usbsw_cfg,
961 }
962 }
963};
964
965static struct msm_gpiomux_config msm8930_fusion_gsbi_configs[] = {
966 {
967 .gpio = 93,
968 .settings = {
969 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
970 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
971 }
972 },
973 {
974 .gpio = 94,
975 .settings = {
976 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
977 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
978 }
979 },
980 {
981 .gpio = 95,
982 .settings = {
983 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
984 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
985 }
986 },
987 {
988 .gpio = 96,
989 .settings = {
990 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
991 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
992 }
993 },
994};
995
996static struct msm_gpiomux_config msm8930_external_vfr_configs[] __initdata = {
997 {
998 .gpio = 23, /* EXTERNAL VFR */
999 .settings = {
1000 [GPIOMUX_SUSPENDED] = &external_vfr[0],
1001 [GPIOMUX_ACTIVE] = &external_vfr[1],
1002 },
1003 },
1004};
1005
1006int __init sglte8930_init_gpiomux(void)
1007{
1008 /* For 8960 Fusion 2.2 Primary IPC */
1009 msm_gpiomux_install(msm8930_fusion_gsbi_configs,
1010 ARRAY_SIZE(msm8930_fusion_gsbi_configs));
1011 /* For SGLTE 8960 Fusion External VFR */
1012 msm_gpiomux_install(msm8930_external_vfr_configs,
1013 ARRAY_SIZE(msm8930_external_vfr_configs));
1014 msm_gpiomux_install(sglte_8930_configs,
1015 ARRAY_SIZE(sglte_8930_configs));
1016
Kiran Gunda484442e2013-03-11 19:14:44 +05301017 msm_gpiomux_install(msm8930_sglte_gsbi_configs,
1018 ARRAY_SIZE(msm8930_sglte_gsbi_configs));
1019
Taniya Das75596f92013-03-06 11:47:34 +05301020 msm_gpiomux_install(msm8960_slimbus_config,
1021 ARRAY_SIZE(msm8960_slimbus_config));
1022
1023 msm_gpiomux_install(msm8960_audio_codec_configs,
1024 ARRAY_SIZE(msm8960_audio_codec_configs));
1025
1026 msm_gpiomux_install(wcnss_5wire_interface,
1027 ARRAY_SIZE(wcnss_5wire_interface));
1028
1029 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1030 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1031
1032 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
1033
Shantanu Jain55d277a2013-03-08 11:37:29 +05301034 msm_gpiomux_install(msm8960_synaptic_rmi4_configs,
1035 ARRAY_SIZE(msm8960_synaptic_rmi4_configs));
1036
Subhash Jadavaniaea501c2013-03-01 21:38:36 +05301037 msm_gpiomux_install(msm8930_sd_det_config_evt,
1038 ARRAY_SIZE(msm8930_sd_det_config_evt));
1039
Laxminath Kasam46cf4b02013-03-20 23:28:26 +05301040 msm_gpiomux_install(msm8960_audio_mbhc_configs_sglte,
1041 ARRAY_SIZE(msm8960_audio_mbhc_configs_sglte));
1042
Taniya Das75596f92013-03-06 11:47:34 +05301043 return 0;
1044}
1045
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001046int __init msm8930_init_gpiomux(void)
1047{
1048 int rc = msm_gpiomux_init(NR_GPIO_IRQS);
1049 if (rc) {
1050 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1051 return rc;
1052 }
1053
Taniya Das75596f92013-03-06 11:47:34 +05301054 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1055 return sglte8930_init_gpiomux();
1056
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001057#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
1058 msm_gpiomux_install(msm8960_ethernet_configs,
1059 ARRAY_SIZE(msm8960_ethernet_configs));
1060#endif
1061
1062 msm_gpiomux_install(msm8960_gsbi_configs,
1063 ARRAY_SIZE(msm8960_gsbi_configs));
1064
Amy Malochef3c9db42011-12-08 15:17:35 -08001065 msm_gpiomux_install(msm8960_atmel_configs,
1066 ARRAY_SIZE(msm8960_atmel_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001067
1068 msm_gpiomux_install(msm8960_slimbus_config,
1069 ARRAY_SIZE(msm8960_slimbus_config));
1070
1071 msm_gpiomux_install(msm8960_audio_codec_configs,
1072 ARRAY_SIZE(msm8960_audio_codec_configs));
1073
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -07001074 msm_gpiomux_install(msm8960_audio_mbhc_configs,
1075 ARRAY_SIZE(msm8960_audio_mbhc_configs));
1076
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -07001077 msm_gpiomux_install(msm8960_audio_spkr_configs,
1078 ARRAY_SIZE(msm8960_audio_spkr_configs));
1079
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001080 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
1081 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
1082
1083 msm_gpiomux_install(wcnss_5wire_interface,
1084 ARRAY_SIZE(wcnss_5wire_interface));
1085
1086 if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
Mayank Ranabf5084a2011-12-12 17:06:54 +05301087 machine_is_msm8930_cdp()) {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001088 msm_gpiomux_install(hap_lvl_shft_config,
1089 ARRAY_SIZE(hap_lvl_shft_config));
Mayank Ranabf5084a2011-12-12 17:06:54 +05301090#ifdef MSM8930_PHASE_2
1091 msm_gpiomux_install(msm8930_hsusb_configs,
1092 ARRAY_SIZE(msm8930_hsusb_configs));
1093#endif
1094 }
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001095
1096 if (PLATFORM_IS_CHARM25())
1097 msm_gpiomux_install(mdm_configs,
1098 ARRAY_SIZE(mdm_configs));
1099
Amy Malochee8de95d2012-02-23 10:40:25 -08001100 if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
1101 || machine_is_msm8930_fluid())
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301102 msm_gpiomux_install(msm8930_haptics_configs,
1103 ARRAY_SIZE(msm8930_haptics_configs));
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301104
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001105#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1106 msm_gpiomux_install(msm8960_hdmi_configs,
1107 ARRAY_SIZE(msm8960_hdmi_configs));
Manoj Raoc6d904c2012-06-22 00:32:14 -07001108 if (machine_is_msm8930_fluid())
1109 msm_gpiomux_install(msm8930_mhl_configs,
1110 ARRAY_SIZE(msm8930_mhl_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001111#endif
1112
1113 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1114 ARRAY_SIZE(msm8960_mdp_vsync_configs));
Krishna Konda41b6ab02012-05-16 15:08:03 -07001115
1116 msm_gpiomux_install(msm8930_sd_det_config,
1117 ARRAY_SIZE(msm8930_sd_det_config));
1118
Wentao Xuc7769c02012-08-03 15:06:41 -04001119 if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
1120 msm_gpiomux_install(msm8930_gyro_int_config,
1121 ARRAY_SIZE(msm8930_gyro_int_config));
1122
Joonwoo Parkb0795e12012-08-24 22:47:53 -07001123 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
1124
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001125 return 0;
1126}