blob: 78046d7ac23091015cc6ddec0ccdb390cabc2ecf [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2011-2012, 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
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800130#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
131static struct gpiomux_setting gpio_eth_config = {
132 .pull = GPIOMUX_PULL_NONE,
133 .drv = GPIOMUX_DRV_8MA,
134 .func = GPIOMUX_FUNC_GPIO,
135};
136#endif
137
138static struct gpiomux_setting slimbus = {
139 .func = GPIOMUX_FUNC_1,
140 .drv = GPIOMUX_DRV_8MA,
141 .pull = GPIOMUX_PULL_KEEPER,
142};
143
144static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
145 .func = GPIOMUX_FUNC_GPIO,
146 .drv = GPIOMUX_DRV_2MA,
147 .pull = GPIOMUX_PULL_UP,
148};
149
150static struct gpiomux_setting wcnss_5wire_active_cfg = {
151 .func = GPIOMUX_FUNC_1,
152 .drv = GPIOMUX_DRV_6MA,
153 .pull = GPIOMUX_PULL_DOWN,
154};
155
Amy Malochef3c9db42011-12-08 15:17:35 -0800156static struct gpiomux_setting atmel_resout_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800157 .func = GPIOMUX_FUNC_GPIO,
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_act_cfg = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_6MA,
165 .pull = GPIOMUX_PULL_UP,
166};
167
168static struct gpiomux_setting atmel_ldo_en_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800169 .func = GPIOMUX_FUNC_GPIO,
170 .drv = GPIOMUX_DRV_6MA,
171 .pull = GPIOMUX_PULL_DOWN,
172};
173
Amy Malochef3c9db42011-12-08 15:17:35 -0800174static struct gpiomux_setting atmel_ldo_en_act_cfg = {
175 .func = GPIOMUX_FUNC_GPIO,
176 .drv = GPIOMUX_DRV_6MA,
177 .pull = GPIOMUX_PULL_DOWN,
178};
179
180static struct gpiomux_setting atmel_int_act_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800181 .func = GPIOMUX_FUNC_GPIO,
182 .drv = GPIOMUX_DRV_8MA,
183 .pull = GPIOMUX_PULL_UP,
184};
185
Amy Malochef3c9db42011-12-08 15:17:35 -0800186static struct gpiomux_setting atmel_int_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800187 .func = GPIOMUX_FUNC_GPIO,
188 .drv = GPIOMUX_DRV_2MA,
189 .pull = GPIOMUX_PULL_DOWN,
190};
Mayank Ranabf5084a2011-12-12 17:06:54 +0530191#ifdef MSM8930_PHASE_2
Mayank Ranabf5084a2011-12-12 17:06:54 +0530192static struct gpiomux_setting hsusb_sus_cfg = {
193 .func = GPIOMUX_FUNC_GPIO,
194 .drv = GPIOMUX_DRV_2MA,
David Keitelc72d8192012-01-09 11:33:55 -0800195 .pull = GPIOMUX_PULL_NONE,
196 .dir = GPIOMUX_OUT_LOW,
Mayank Ranabf5084a2011-12-12 17:06:54 +0530197};
198static struct msm_gpiomux_config msm8930_hsusb_configs[] = {
199 {
200 .gpio = 63, /* HSUSB_EXTERNAL_5V_LDO_EN */
201 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530202 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
203 },
204 },
205 {
206 .gpio = 97, /* HSUSB_5V_EN */
207 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530208 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
209 },
210 },
211};
212#endif
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800213
214static struct gpiomux_setting hap_lvl_shft_suspended_config = {
215 .func = GPIOMUX_FUNC_GPIO,
216 .drv = GPIOMUX_DRV_2MA,
217 .pull = GPIOMUX_PULL_DOWN,
218};
219
220static struct gpiomux_setting hap_lvl_shft_active_config = {
221 .func = GPIOMUX_FUNC_GPIO,
222 .drv = GPIOMUX_DRV_8MA,
223 .pull = GPIOMUX_PULL_UP,
224};
225
226static struct gpiomux_setting ap2mdm_cfg = {
227 .func = GPIOMUX_FUNC_GPIO,
228 .drv = GPIOMUX_DRV_8MA,
229 .pull = GPIOMUX_PULL_DOWN,
230};
231
232static struct gpiomux_setting mdm2ap_status_cfg = {
233 .func = GPIOMUX_FUNC_GPIO,
234 .drv = GPIOMUX_DRV_8MA,
235 .pull = GPIOMUX_PULL_NONE,
236};
237
238static struct gpiomux_setting mdm2ap_errfatal_cfg = {
239 .func = GPIOMUX_FUNC_GPIO,
240 .drv = GPIOMUX_DRV_16MA,
241 .pull = GPIOMUX_PULL_DOWN,
242};
243
244static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
245 .func = GPIOMUX_FUNC_GPIO,
246 .drv = GPIOMUX_DRV_8MA,
247 .pull = GPIOMUX_PULL_NONE,
248};
249
250static struct gpiomux_setting mdp_vsync_suspend_cfg = {
251 .func = GPIOMUX_FUNC_GPIO,
252 .drv = GPIOMUX_DRV_2MA,
253 .pull = GPIOMUX_PULL_DOWN,
254};
255
256static struct gpiomux_setting mdp_vsync_active_cfg = {
257 .func = GPIOMUX_FUNC_1,
258 .drv = GPIOMUX_DRV_2MA,
259 .pull = GPIOMUX_PULL_DOWN,
260};
261
262#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
263static struct gpiomux_setting hdmi_suspend_cfg = {
264 .func = GPIOMUX_FUNC_GPIO,
265 .drv = GPIOMUX_DRV_2MA,
266 .pull = GPIOMUX_PULL_DOWN,
267};
268
269static struct gpiomux_setting hdmi_active_1_cfg = {
270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_2MA,
272 .pull = GPIOMUX_PULL_UP,
273};
274
275static struct gpiomux_setting hdmi_active_2_cfg = {
276 .func = GPIOMUX_FUNC_1,
277 .drv = GPIOMUX_DRV_2MA,
278 .pull = GPIOMUX_PULL_DOWN,
279};
Manoj Raoc6d904c2012-06-22 00:32:14 -0700280
281static struct gpiomux_setting hdmi_active_3_cfg = {
282 .func = GPIOMUX_FUNC_GPIO,
283 .drv = GPIOMUX_DRV_2MA,
284 .pull = GPIOMUX_PULL_UP,
285 .dir = GPIOMUX_IN,
286};
287
288static struct gpiomux_setting hdmi_active_4_cfg = {
289 .func = GPIOMUX_FUNC_GPIO,
290 .drv = GPIOMUX_DRV_2MA,
291 .pull = GPIOMUX_PULL_UP,
292 .dir = GPIOMUX_OUT_HIGH,
293};
294
295static struct gpiomux_setting hdmi_active_5_cfg = {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_UP,
299 .dir = GPIOMUX_OUT_HIGH,
300};
301
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800302#endif
303
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700304static struct gpiomux_setting sitar_reset = {
305 .func = GPIOMUX_FUNC_GPIO,
306 .drv = GPIOMUX_DRV_6MA,
307 .pull = GPIOMUX_PULL_NONE,
308 .dir = GPIOMUX_OUT_LOW,
309};
310
Taniya Das75596f92013-03-06 11:47:34 +0530311static struct gpiomux_setting usbsw_cfg = {
312 .func = GPIOMUX_FUNC_GPIO,
313 .drv = GPIOMUX_DRV_8MA,
314 .pull = GPIOMUX_PULL_DOWN,
315};
316
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800317#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
318static struct msm_gpiomux_config msm8960_ethernet_configs[] = {
319 {
320 .gpio = 90,
321 .settings = {
322 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
323 }
324 },
325 {
326 .gpio = 89,
327 .settings = {
328 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
329 }
330 },
331};
332#endif
333
334static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
335 {
336 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
337 .settings = {
338 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
339 [GPIOMUX_ACTIVE] = &spi_active,
340 },
341 },
342 {
343 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
344 .settings = {
345 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
346 [GPIOMUX_ACTIVE] = &spi_active,
347 },
348 },
349 {
350 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
351 .settings = {
352 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
353 [GPIOMUX_ACTIVE] = &spi_active,
354 },
355 },
356 {
357 .gpio = 9, /* GSBI1 QUP SPI_CLK */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
360 [GPIOMUX_ACTIVE] = &spi_active,
361 },
362 },
363 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800364 .gpio = 16, /* GSBI3 I2C QUP SDA */
365 .settings = {
366 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
367 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
368 },
369 },
370 {
371 .gpio = 17, /* GSBI3 I2C QUP SCL */
372 .settings = {
373 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
374 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
375 },
376 },
377 {
378 .gpio = 22, /* GSBI5 UART2 */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi5,
381 },
382 },
383 {
384 .gpio = 23, /* GSBI5 UART2 */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi5,
387 },
388 },
389 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800390 .gpio = 44, /* GSBI12 I2C QUP SDA */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi12,
393 },
394 },
395 {
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -0600396 .gpio = 95, /* GSBI9 I2C QUP SDA */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi9,
399 },
400 },
401 {
402 .gpio = 96, /* GSBI12 I2C QUP SCL */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi9,
405 },
406 },
407 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800408 .gpio = 45, /* GSBI12 I2C QUP SCL */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi12,
411 },
412 },
413 {
414 .gpio = 73, /* GSBI10 I2C QUP SDA */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi10,
417 },
418 },
419 {
420 .gpio = 74, /* GSBI10 I2C QUP SCL */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi10,
423 },
424 },
425};
426
Kiran Gunda484442e2013-03-11 19:14:44 +0530427static struct msm_gpiomux_config msm8930_sglte_gsbi_configs[] __initdata = {
428 /* Add the I2C/SPI GPIOs Here */
429 {
430 .gpio = 6, /* GSBI1 TX */
431 .settings = {
432 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
433 [GPIOMUX_ACTIVE] = &spi_active,
434 },
435 },
436 {
437 .gpio = 7, /* GSBI1 RX */
438 .settings = {
439 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
440 [GPIOMUX_ACTIVE] = &spi_active,
441 },
442 },
443 {
444 .gpio = 8, /* GSBI1 CTS_N */
445 .settings = {
446 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
447 [GPIOMUX_ACTIVE] = &spi_active,
448 },
449 },
450 {
451 .gpio = 9, /* GSBI1 RFR_N */
452 .settings = {
453 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
454 [GPIOMUX_ACTIVE] = &spi_active,
455 },
456 },
457 {
458 .gpio = 16, /* GSBI3 I2C QUP SDA */
459 .settings = {
460 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
461 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
462 },
463 },
464 {
465 .gpio = 17, /* GSBI3 I2C QUP SCL */
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
468 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
469 },
470 },
471 {
472 .gpio = 44, /* GSBI12 I2C QUP SDA */
473 .settings = {
474 [GPIOMUX_SUSPENDED] = &gsbi12,
475 },
476 },
477 {
478 .gpio = 45, /* GSBI12 I2C QUP SCL */
479 .settings = {
480 [GPIOMUX_SUSPENDED] = &gsbi12,
481 },
482 },
483 {
484 .gpio = 73, /* GSBI10 I2C QUP SDA */
485 .settings = {
486 [GPIOMUX_SUSPENDED] = &gsbi10,
487 },
488 },
489 {
490 .gpio = 74, /* GSBI10 I2C QUP SCL */
491 .settings = {
492 [GPIOMUX_SUSPENDED] = &gsbi10,
493 },
494 },
495
496};
497
498
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800499static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
500 {
501 .gpio = 60, /* slimbus data */
502 .settings = {
503 [GPIOMUX_SUSPENDED] = &slimbus,
504 },
505 },
506 {
507 .gpio = 61, /* slimbus clk */
508 .settings = {
509 [GPIOMUX_SUSPENDED] = &slimbus,
510 },
511 },
512};
513
514static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
515 {
516 .gpio = 59,
517 .settings = {
518 [GPIOMUX_SUSPENDED] = &cdc_mclk,
519 },
520 },
521};
522
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700523static struct msm_gpiomux_config msm8960_audio_mbhc_configs[] __initdata = {
524 {
525 .gpio = 37,
526 .settings = {
527 [GPIOMUX_SUSPENDED] = &audio_mbhc,
528 },
529 },
530};
531
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700532static struct msm_gpiomux_config msm8960_audio_spkr_configs[] __initdata = {
533 {
534 .gpio = 15,
535 .settings = {
536 [GPIOMUX_SUSPENDED] = &audio_spkr_boost,
537 },
538 },
539};
540
541
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800542static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
543 {
544 .gpio = 63,
545 .settings = {
546 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
547 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
548 },
549 },
550 {
551 .gpio = 64,
552 .settings = {
553 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
554 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
555 },
556 },
557 {
558 .gpio = 65,
559 .settings = {
560 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
561 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
562 },
563 },
564 {
565 .gpio = 66,
566 .settings = {
567 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
568 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
569 },
570 },
571};
572
573static struct msm_gpiomux_config wcnss_5wire_interface[] = {
574 {
575 .gpio = 84,
576 .settings = {
577 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
578 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
579 },
580 },
581 {
582 .gpio = 85,
583 .settings = {
584 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
585 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
586 },
587 },
588 {
589 .gpio = 86,
590 .settings = {
591 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
592 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
593 },
594 },
595 {
596 .gpio = 87,
597 .settings = {
598 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
599 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
600 },
601 },
602 {
603 .gpio = 88,
604 .settings = {
605 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
606 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
607 },
608 },
609};
610
Amy Malochef3c9db42011-12-08 15:17:35 -0800611static struct msm_gpiomux_config msm8960_atmel_configs[] __initdata = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800612 { /* TS INTERRUPT */
613 .gpio = 11,
614 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800615 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
616 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800617 },
618 },
Amy Malochef3c9db42011-12-08 15:17:35 -0800619 { /* TS LDO ENABLE */
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800620 .gpio = 50,
621 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800622 [GPIOMUX_ACTIVE] = &atmel_ldo_en_act_cfg,
623 [GPIOMUX_SUSPENDED] = &atmel_ldo_en_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800624 },
625 },
626 { /* TS RESOUT */
627 .gpio = 52,
628 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800629 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
630 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800631 },
632 },
633};
634
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800635static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
636 {
637 .gpio = 47,
638 .settings = {
639 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
640 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
641 },
642 },
643};
644
645static struct msm_gpiomux_config mdm_configs[] __initdata = {
646 /* AP2MDM_STATUS */
647 {
648 .gpio = 94,
649 .settings = {
650 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
651 }
652 },
653 /* MDM2AP_STATUS */
654 {
655 .gpio = 69,
656 .settings = {
657 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
658 }
659 },
660 /* MDM2AP_ERRFATAL */
661 {
662 .gpio = 70,
663 .settings = {
664 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
665 }
666 },
667 /* AP2MDM_ERRFATAL */
668 {
669 .gpio = 95,
670 .settings = {
671 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
672 }
673 },
674 /* AP2MDM_KPDPWR_N */
675 {
676 .gpio = 81,
677 .settings = {
678 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
679 }
680 },
681 /* AP2MDM_PMIC_RESET_N */
682 {
683 .gpio = 80,
684 .settings = {
685 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
686 }
687 }
688};
689
690static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
691 {
692 .gpio = 0,
693 .settings = {
694 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
695 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
696 },
697 }
698};
699
700#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
701static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
702 {
703 .gpio = 99,
704 .settings = {
705 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
706 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
707 },
708 },
709 {
710 .gpio = 100,
711 .settings = {
712 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
713 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
714 },
715 },
716 {
717 .gpio = 101,
718 .settings = {
719 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
720 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
721 },
722 },
723 {
724 .gpio = 102,
725 .settings = {
726 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
727 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
728 },
729 },
Manoj Raoc6d904c2012-06-22 00:32:14 -0700730
731};
732
733static struct msm_gpiomux_config msm8930_mhl_configs[] __initdata = {
734 {
735 .gpio = 72,
736 .settings = {
737 [GPIOMUX_ACTIVE] = &hdmi_active_3_cfg,
738 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
739 },
740 },
741 {
742 .gpio = 71,
743 .settings = {
744 [GPIOMUX_ACTIVE] = &hdmi_active_4_cfg,
745 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
746 },
747 },
748 {
749 .gpio = 73,
750 .settings = {
751 [GPIOMUX_ACTIVE] = &hdmi_active_5_cfg,
752 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
753 },
754 },
755
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800756};
757#endif
758
Amy Malochee8de95d2012-02-23 10:40:25 -0800759static struct gpiomux_setting haptics_active_cfg = {
760 .func = GPIOMUX_FUNC_GPIO,
761 .drv = GPIOMUX_DRV_8MA,
762 .pull = GPIOMUX_PULL_UP,
763};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530764static struct gpiomux_setting haptics_suspend_cfg = {
765 .func = GPIOMUX_FUNC_GPIO,
766 .drv = GPIOMUX_DRV_8MA,
767 .pull = GPIOMUX_PULL_DOWN,
768};
769
770static struct msm_gpiomux_config msm8930_haptics_configs[] __initdata = {
771 {
772 .gpio = 77,
773 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800774 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530775 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
776 },
777 },
778 {
779 .gpio = 78,
780 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800781 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530782 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
783 },
784 },
785};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530786
Krishna Konda41b6ab02012-05-16 15:08:03 -0700787static struct gpiomux_setting sd_det_line = {
788 .func = GPIOMUX_FUNC_GPIO,
789 .drv = GPIOMUX_DRV_2MA,
790 .pull = GPIOMUX_PULL_NONE,
791};
792
793static struct msm_gpiomux_config msm8930_sd_det_config[] __initdata = {
794 {
795 .gpio = 94, /* SD Card Detect Line */
796 .settings = {
797 [GPIOMUX_SUSPENDED] = &sd_det_line,
798 [GPIOMUX_ACTIVE] = &sd_det_line,
799 },
800 },
801};
802
Wentao Xuc7769c02012-08-03 15:06:41 -0400803static struct gpiomux_setting gyro_int_line = {
804 .func = GPIOMUX_FUNC_GPIO,
805 .drv = GPIOMUX_DRV_2MA,
806 .pull = GPIOMUX_PULL_NONE,
807};
808
809static struct msm_gpiomux_config msm8930_gyro_int_config[] __initdata = {
810 {
811 .gpio = 69, /* Gyro Interrupt Line */
812 .settings = {
813 [GPIOMUX_SUSPENDED] = &gyro_int_line,
814 [GPIOMUX_ACTIVE] = &gyro_int_line,
815 },
816 },
817};
818
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700819static struct msm_gpiomux_config msm_sitar_config[] __initdata = {
820 {
821 .gpio = 42, /* SYS_RST_N */
822 .settings = {
823 [GPIOMUX_SUSPENDED] = &sitar_reset,
824 },
825 }
826};
827
Taniya Das75596f92013-03-06 11:47:34 +0530828static struct msm_gpiomux_config sglte_8930_configs[] __initdata = {
829 /* AP2MDM_STATUS */
830 {
831 .gpio = 77,
832 .settings = {
833 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
834 }
835 },
836 /* MDM2AP_STATUS */
837 {
838 .gpio = 24,
839 .settings = {
840 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
841 }
842 },
843 /* MDM2AP_ERRFATAL */
844 {
845 .gpio = 40,
846 .settings = {
847 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
848 }
849 },
850 /* AP2MDM_ERRFATAL */
851 {
852 .gpio = 80,
853 .settings = {
854 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
855 }
856 },
857 /* AP2MDM_KPDPWR_N */
858 {
859 .gpio = 79,
860 .settings = {
861 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
862 }
863 },
864 /* AP2MDM_PMIC_PWR_EN */
865 {
866 .gpio = 22,
867 .settings = {
868 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
869 }
870 },
871 /* AP2MDM_SOFT_RESET */
872 {
873 .gpio = 78,
874 .settings = {
875 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
876 }
877 },
878 /* USB_SW */
879 {
880 .gpio = 25,
881 .settings = {
882 [GPIOMUX_SUSPENDED] = &usbsw_cfg,
883 }
884 }
885};
886
887static struct msm_gpiomux_config msm8930_fusion_gsbi_configs[] = {
888 {
889 .gpio = 93,
890 .settings = {
891 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
892 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
893 }
894 },
895 {
896 .gpio = 94,
897 .settings = {
898 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
899 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
900 }
901 },
902 {
903 .gpio = 95,
904 .settings = {
905 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
906 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
907 }
908 },
909 {
910 .gpio = 96,
911 .settings = {
912 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
913 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
914 }
915 },
916};
917
918static struct msm_gpiomux_config msm8930_external_vfr_configs[] __initdata = {
919 {
920 .gpio = 23, /* EXTERNAL VFR */
921 .settings = {
922 [GPIOMUX_SUSPENDED] = &external_vfr[0],
923 [GPIOMUX_ACTIVE] = &external_vfr[1],
924 },
925 },
926};
927
928int __init sglte8930_init_gpiomux(void)
929{
930 /* For 8960 Fusion 2.2 Primary IPC */
931 msm_gpiomux_install(msm8930_fusion_gsbi_configs,
932 ARRAY_SIZE(msm8930_fusion_gsbi_configs));
933 /* For SGLTE 8960 Fusion External VFR */
934 msm_gpiomux_install(msm8930_external_vfr_configs,
935 ARRAY_SIZE(msm8930_external_vfr_configs));
936 msm_gpiomux_install(sglte_8930_configs,
937 ARRAY_SIZE(sglte_8930_configs));
938
Kiran Gunda484442e2013-03-11 19:14:44 +0530939 msm_gpiomux_install(msm8930_sglte_gsbi_configs,
940 ARRAY_SIZE(msm8930_sglte_gsbi_configs));
941
Taniya Das75596f92013-03-06 11:47:34 +0530942 msm_gpiomux_install(msm8960_slimbus_config,
943 ARRAY_SIZE(msm8960_slimbus_config));
944
945 msm_gpiomux_install(msm8960_audio_codec_configs,
946 ARRAY_SIZE(msm8960_audio_codec_configs));
947
948 msm_gpiomux_install(wcnss_5wire_interface,
949 ARRAY_SIZE(wcnss_5wire_interface));
950
951 msm_gpiomux_install(msm8960_mdp_vsync_configs,
952 ARRAY_SIZE(msm8960_mdp_vsync_configs));
953
954 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
955
956 return 0;
957}
958
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800959int __init msm8930_init_gpiomux(void)
960{
961 int rc = msm_gpiomux_init(NR_GPIO_IRQS);
962 if (rc) {
963 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
964 return rc;
965 }
966
Taniya Das75596f92013-03-06 11:47:34 +0530967 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
968 return sglte8930_init_gpiomux();
969
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800970#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
971 msm_gpiomux_install(msm8960_ethernet_configs,
972 ARRAY_SIZE(msm8960_ethernet_configs));
973#endif
974
975 msm_gpiomux_install(msm8960_gsbi_configs,
976 ARRAY_SIZE(msm8960_gsbi_configs));
977
Amy Malochef3c9db42011-12-08 15:17:35 -0800978 msm_gpiomux_install(msm8960_atmel_configs,
979 ARRAY_SIZE(msm8960_atmel_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800980
981 msm_gpiomux_install(msm8960_slimbus_config,
982 ARRAY_SIZE(msm8960_slimbus_config));
983
984 msm_gpiomux_install(msm8960_audio_codec_configs,
985 ARRAY_SIZE(msm8960_audio_codec_configs));
986
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700987 msm_gpiomux_install(msm8960_audio_mbhc_configs,
988 ARRAY_SIZE(msm8960_audio_mbhc_configs));
989
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700990 msm_gpiomux_install(msm8960_audio_spkr_configs,
991 ARRAY_SIZE(msm8960_audio_spkr_configs));
992
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800993 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
994 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
995
996 msm_gpiomux_install(wcnss_5wire_interface,
997 ARRAY_SIZE(wcnss_5wire_interface));
998
999 if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
Mayank Ranabf5084a2011-12-12 17:06:54 +05301000 machine_is_msm8930_cdp()) {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001001 msm_gpiomux_install(hap_lvl_shft_config,
1002 ARRAY_SIZE(hap_lvl_shft_config));
Mayank Ranabf5084a2011-12-12 17:06:54 +05301003#ifdef MSM8930_PHASE_2
1004 msm_gpiomux_install(msm8930_hsusb_configs,
1005 ARRAY_SIZE(msm8930_hsusb_configs));
1006#endif
1007 }
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001008
1009 if (PLATFORM_IS_CHARM25())
1010 msm_gpiomux_install(mdm_configs,
1011 ARRAY_SIZE(mdm_configs));
1012
Amy Malochee8de95d2012-02-23 10:40:25 -08001013 if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
1014 || machine_is_msm8930_fluid())
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301015 msm_gpiomux_install(msm8930_haptics_configs,
1016 ARRAY_SIZE(msm8930_haptics_configs));
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301017
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001018#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1019 msm_gpiomux_install(msm8960_hdmi_configs,
1020 ARRAY_SIZE(msm8960_hdmi_configs));
Manoj Raoc6d904c2012-06-22 00:32:14 -07001021 if (machine_is_msm8930_fluid())
1022 msm_gpiomux_install(msm8930_mhl_configs,
1023 ARRAY_SIZE(msm8930_mhl_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001024#endif
1025
1026 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1027 ARRAY_SIZE(msm8960_mdp_vsync_configs));
Krishna Konda41b6ab02012-05-16 15:08:03 -07001028
1029 msm_gpiomux_install(msm8930_sd_det_config,
1030 ARRAY_SIZE(msm8930_sd_det_config));
1031
Wentao Xuc7769c02012-08-03 15:06:41 -04001032 if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
1033 msm_gpiomux_install(msm8930_gyro_int_config,
1034 ARRAY_SIZE(msm8930_gyro_int_config));
1035
Joonwoo Parkb0795e12012-08-24 22:47:53 -07001036 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
1037
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001038 return 0;
1039}