blob: 035dd9a774a9e571a8186667d0926e9a94e3d712 [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
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};
Shantanu Jain55d277a2013-03-08 11:37:29 +0530191
192static struct gpiomux_setting synaptic_rmi4_resout_sus_cfg = {
193 .func = GPIOMUX_FUNC_GPIO,
194 .drv = GPIOMUX_DRV_6MA,
195 .pull = GPIOMUX_PULL_DOWN,
196};
197
198static struct gpiomux_setting synaptic_rmi4_resout_act_cfg = {
199 .func = GPIOMUX_FUNC_GPIO,
200 .drv = GPIOMUX_DRV_6MA,
201 .pull = GPIOMUX_PULL_UP,
202};
203
204static struct gpiomux_setting synaptic_rmi4_attn_act_cfg = {
205 .func = GPIOMUX_FUNC_GPIO,
206 .drv = GPIOMUX_DRV_8MA,
207 .pull = GPIOMUX_PULL_UP,
208};
209
210static struct gpiomux_setting synaptic_rmi4_attn_sus_cfg = {
211 .func = GPIOMUX_FUNC_GPIO,
212 .drv = GPIOMUX_DRV_2MA,
213 .pull = GPIOMUX_PULL_DOWN,
214};
215
Mayank Ranabf5084a2011-12-12 17:06:54 +0530216#ifdef MSM8930_PHASE_2
Mayank Ranabf5084a2011-12-12 17:06:54 +0530217static struct gpiomux_setting hsusb_sus_cfg = {
218 .func = GPIOMUX_FUNC_GPIO,
219 .drv = GPIOMUX_DRV_2MA,
David Keitelc72d8192012-01-09 11:33:55 -0800220 .pull = GPIOMUX_PULL_NONE,
221 .dir = GPIOMUX_OUT_LOW,
Mayank Ranabf5084a2011-12-12 17:06:54 +0530222};
223static struct msm_gpiomux_config msm8930_hsusb_configs[] = {
224 {
225 .gpio = 63, /* HSUSB_EXTERNAL_5V_LDO_EN */
226 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530227 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
228 },
229 },
230 {
231 .gpio = 97, /* HSUSB_5V_EN */
232 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530233 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
234 },
235 },
236};
237#endif
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800238
239static struct gpiomux_setting hap_lvl_shft_suspended_config = {
240 .func = GPIOMUX_FUNC_GPIO,
241 .drv = GPIOMUX_DRV_2MA,
242 .pull = GPIOMUX_PULL_DOWN,
243};
244
245static struct gpiomux_setting hap_lvl_shft_active_config = {
246 .func = GPIOMUX_FUNC_GPIO,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_UP,
249};
250
251static struct gpiomux_setting ap2mdm_cfg = {
252 .func = GPIOMUX_FUNC_GPIO,
253 .drv = GPIOMUX_DRV_8MA,
254 .pull = GPIOMUX_PULL_DOWN,
255};
256
257static struct gpiomux_setting mdm2ap_status_cfg = {
258 .func = GPIOMUX_FUNC_GPIO,
259 .drv = GPIOMUX_DRV_8MA,
260 .pull = GPIOMUX_PULL_NONE,
261};
262
263static struct gpiomux_setting mdm2ap_errfatal_cfg = {
264 .func = GPIOMUX_FUNC_GPIO,
265 .drv = GPIOMUX_DRV_16MA,
266 .pull = GPIOMUX_PULL_DOWN,
267};
268
269static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
270 .func = GPIOMUX_FUNC_GPIO,
271 .drv = GPIOMUX_DRV_8MA,
272 .pull = GPIOMUX_PULL_NONE,
273};
274
275static struct gpiomux_setting mdp_vsync_suspend_cfg = {
276 .func = GPIOMUX_FUNC_GPIO,
277 .drv = GPIOMUX_DRV_2MA,
278 .pull = GPIOMUX_PULL_DOWN,
279};
280
281static struct gpiomux_setting mdp_vsync_active_cfg = {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_2MA,
284 .pull = GPIOMUX_PULL_DOWN,
285};
286
287#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
288static struct gpiomux_setting hdmi_suspend_cfg = {
289 .func = GPIOMUX_FUNC_GPIO,
290 .drv = GPIOMUX_DRV_2MA,
291 .pull = GPIOMUX_PULL_DOWN,
292};
293
294static struct gpiomux_setting hdmi_active_1_cfg = {
295 .func = GPIOMUX_FUNC_1,
296 .drv = GPIOMUX_DRV_2MA,
297 .pull = GPIOMUX_PULL_UP,
298};
299
300static struct gpiomux_setting hdmi_active_2_cfg = {
301 .func = GPIOMUX_FUNC_1,
302 .drv = GPIOMUX_DRV_2MA,
303 .pull = GPIOMUX_PULL_DOWN,
304};
Manoj Raoc6d904c2012-06-22 00:32:14 -0700305
306static struct gpiomux_setting hdmi_active_3_cfg = {
307 .func = GPIOMUX_FUNC_GPIO,
308 .drv = GPIOMUX_DRV_2MA,
309 .pull = GPIOMUX_PULL_UP,
310 .dir = GPIOMUX_IN,
311};
312
313static struct gpiomux_setting hdmi_active_4_cfg = {
314 .func = GPIOMUX_FUNC_GPIO,
315 .drv = GPIOMUX_DRV_2MA,
316 .pull = GPIOMUX_PULL_UP,
317 .dir = GPIOMUX_OUT_HIGH,
318};
319
320static struct gpiomux_setting hdmi_active_5_cfg = {
321 .func = GPIOMUX_FUNC_GPIO,
322 .drv = GPIOMUX_DRV_2MA,
323 .pull = GPIOMUX_PULL_UP,
324 .dir = GPIOMUX_OUT_HIGH,
325};
326
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800327#endif
328
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700329static struct gpiomux_setting sitar_reset = {
330 .func = GPIOMUX_FUNC_GPIO,
331 .drv = GPIOMUX_DRV_6MA,
332 .pull = GPIOMUX_PULL_NONE,
333 .dir = GPIOMUX_OUT_LOW,
334};
335
Taniya Das75596f92013-03-06 11:47:34 +0530336static struct gpiomux_setting usbsw_cfg = {
337 .func = GPIOMUX_FUNC_GPIO,
338 .drv = GPIOMUX_DRV_8MA,
339 .pull = GPIOMUX_PULL_DOWN,
340};
341
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800342#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
343static struct msm_gpiomux_config msm8960_ethernet_configs[] = {
344 {
345 .gpio = 90,
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
348 }
349 },
350 {
351 .gpio = 89,
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
354 }
355 },
356};
357#endif
358
359static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
360 {
361 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
362 .settings = {
363 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
364 [GPIOMUX_ACTIVE] = &spi_active,
365 },
366 },
367 {
368 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
371 [GPIOMUX_ACTIVE] = &spi_active,
372 },
373 },
374 {
375 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
378 [GPIOMUX_ACTIVE] = &spi_active,
379 },
380 },
381 {
382 .gpio = 9, /* GSBI1 QUP SPI_CLK */
383 .settings = {
384 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
385 [GPIOMUX_ACTIVE] = &spi_active,
386 },
387 },
388 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800389 .gpio = 16, /* GSBI3 I2C QUP SDA */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
392 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
393 },
394 },
395 {
396 .gpio = 17, /* GSBI3 I2C QUP SCL */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
399 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
400 },
401 },
402 {
403 .gpio = 22, /* GSBI5 UART2 */
404 .settings = {
405 [GPIOMUX_SUSPENDED] = &gsbi5,
406 },
407 },
408 {
409 .gpio = 23, /* GSBI5 UART2 */
410 .settings = {
411 [GPIOMUX_SUSPENDED] = &gsbi5,
412 },
413 },
414 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800415 .gpio = 44, /* GSBI12 I2C QUP SDA */
416 .settings = {
417 [GPIOMUX_SUSPENDED] = &gsbi12,
418 },
419 },
420 {
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -0600421 .gpio = 95, /* GSBI9 I2C QUP SDA */
422 .settings = {
423 [GPIOMUX_SUSPENDED] = &gsbi9,
424 },
425 },
426 {
427 .gpio = 96, /* GSBI12 I2C QUP SCL */
428 .settings = {
429 [GPIOMUX_SUSPENDED] = &gsbi9,
430 },
431 },
432 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800433 .gpio = 45, /* GSBI12 I2C QUP SCL */
434 .settings = {
435 [GPIOMUX_SUSPENDED] = &gsbi12,
436 },
437 },
438 {
439 .gpio = 73, /* GSBI10 I2C QUP SDA */
440 .settings = {
441 [GPIOMUX_SUSPENDED] = &gsbi10,
442 },
443 },
444 {
445 .gpio = 74, /* GSBI10 I2C QUP SCL */
446 .settings = {
447 [GPIOMUX_SUSPENDED] = &gsbi10,
448 },
449 },
450};
451
Kiran Gunda484442e2013-03-11 19:14:44 +0530452static struct msm_gpiomux_config msm8930_sglte_gsbi_configs[] __initdata = {
453 /* Add the I2C/SPI GPIOs Here */
454 {
455 .gpio = 6, /* GSBI1 TX */
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
458 [GPIOMUX_ACTIVE] = &spi_active,
459 },
460 },
461 {
462 .gpio = 7, /* GSBI1 RX */
463 .settings = {
464 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
465 [GPIOMUX_ACTIVE] = &spi_active,
466 },
467 },
468 {
469 .gpio = 8, /* GSBI1 CTS_N */
470 .settings = {
471 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
472 [GPIOMUX_ACTIVE] = &spi_active,
473 },
474 },
475 {
476 .gpio = 9, /* GSBI1 RFR_N */
477 .settings = {
478 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
479 [GPIOMUX_ACTIVE] = &spi_active,
480 },
481 },
482 {
483 .gpio = 16, /* GSBI3 I2C QUP SDA */
484 .settings = {
485 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
486 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
487 },
488 },
489 {
490 .gpio = 17, /* GSBI3 I2C QUP SCL */
491 .settings = {
492 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
493 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
494 },
495 },
496 {
497 .gpio = 44, /* GSBI12 I2C QUP SDA */
498 .settings = {
499 [GPIOMUX_SUSPENDED] = &gsbi12,
500 },
501 },
502 {
503 .gpio = 45, /* GSBI12 I2C QUP SCL */
504 .settings = {
505 [GPIOMUX_SUSPENDED] = &gsbi12,
506 },
507 },
508 {
509 .gpio = 73, /* GSBI10 I2C QUP SDA */
510 .settings = {
511 [GPIOMUX_SUSPENDED] = &gsbi10,
512 },
513 },
514 {
515 .gpio = 74, /* GSBI10 I2C QUP SCL */
516 .settings = {
517 [GPIOMUX_SUSPENDED] = &gsbi10,
518 },
519 },
520
521};
522
523
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800524static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
525 {
526 .gpio = 60, /* slimbus data */
527 .settings = {
528 [GPIOMUX_SUSPENDED] = &slimbus,
529 },
530 },
531 {
532 .gpio = 61, /* slimbus clk */
533 .settings = {
534 [GPIOMUX_SUSPENDED] = &slimbus,
535 },
536 },
537};
538
539static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
540 {
541 .gpio = 59,
542 .settings = {
543 [GPIOMUX_SUSPENDED] = &cdc_mclk,
544 },
545 },
546};
547
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700548static struct msm_gpiomux_config msm8960_audio_mbhc_configs[] __initdata = {
549 {
550 .gpio = 37,
551 .settings = {
552 [GPIOMUX_SUSPENDED] = &audio_mbhc,
553 },
554 },
555};
556
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700557static struct msm_gpiomux_config msm8960_audio_spkr_configs[] __initdata = {
558 {
559 .gpio = 15,
560 .settings = {
561 [GPIOMUX_SUSPENDED] = &audio_spkr_boost,
562 },
563 },
564};
565
566
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800567static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
568 {
569 .gpio = 63,
570 .settings = {
571 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
572 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
573 },
574 },
575 {
576 .gpio = 64,
577 .settings = {
578 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
579 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
580 },
581 },
582 {
583 .gpio = 65,
584 .settings = {
585 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
586 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
587 },
588 },
589 {
590 .gpio = 66,
591 .settings = {
592 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
593 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
594 },
595 },
596};
597
598static struct msm_gpiomux_config wcnss_5wire_interface[] = {
599 {
600 .gpio = 84,
601 .settings = {
602 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
603 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
604 },
605 },
606 {
607 .gpio = 85,
608 .settings = {
609 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
610 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
611 },
612 },
613 {
614 .gpio = 86,
615 .settings = {
616 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
617 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
618 },
619 },
620 {
621 .gpio = 87,
622 .settings = {
623 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
624 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
625 },
626 },
627 {
628 .gpio = 88,
629 .settings = {
630 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
631 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
632 },
633 },
634};
635
Amy Malochef3c9db42011-12-08 15:17:35 -0800636static struct msm_gpiomux_config msm8960_atmel_configs[] __initdata = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800637 { /* TS INTERRUPT */
638 .gpio = 11,
639 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800640 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
641 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800642 },
643 },
Amy Malochef3c9db42011-12-08 15:17:35 -0800644 { /* TS LDO ENABLE */
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800645 .gpio = 50,
646 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800647 [GPIOMUX_ACTIVE] = &atmel_ldo_en_act_cfg,
648 [GPIOMUX_SUSPENDED] = &atmel_ldo_en_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800649 },
650 },
651 { /* TS RESOUT */
652 .gpio = 52,
653 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800654 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
655 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800656 },
657 },
658};
659
Shantanu Jain55d277a2013-03-08 11:37:29 +0530660static struct msm_gpiomux_config msm8960_synaptic_rmi4_configs[] __initdata = {
661 { /* TS INTERRUPT */
662 .gpio = 11,
663 .settings = {
664 [GPIOMUX_ACTIVE] = &synaptic_rmi4_attn_act_cfg,
665 [GPIOMUX_SUSPENDED] = &synaptic_rmi4_attn_sus_cfg,
666 },
667 },
668 { /* TS RESOUT */
669 .gpio = 52,
670 .settings = {
671 [GPIOMUX_ACTIVE] = &synaptic_rmi4_resout_act_cfg,
672 [GPIOMUX_SUSPENDED] = &synaptic_rmi4_resout_sus_cfg,
673 },
674 },
675};
676
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800677static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
678 {
679 .gpio = 47,
680 .settings = {
681 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
682 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
683 },
684 },
685};
686
687static struct msm_gpiomux_config mdm_configs[] __initdata = {
688 /* AP2MDM_STATUS */
689 {
690 .gpio = 94,
691 .settings = {
692 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
693 }
694 },
695 /* MDM2AP_STATUS */
696 {
697 .gpio = 69,
698 .settings = {
699 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
700 }
701 },
702 /* MDM2AP_ERRFATAL */
703 {
704 .gpio = 70,
705 .settings = {
706 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
707 }
708 },
709 /* AP2MDM_ERRFATAL */
710 {
711 .gpio = 95,
712 .settings = {
713 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
714 }
715 },
716 /* AP2MDM_KPDPWR_N */
717 {
718 .gpio = 81,
719 .settings = {
720 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
721 }
722 },
723 /* AP2MDM_PMIC_RESET_N */
724 {
725 .gpio = 80,
726 .settings = {
727 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
728 }
729 }
730};
731
732static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
733 {
734 .gpio = 0,
735 .settings = {
736 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
737 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
738 },
739 }
740};
741
742#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
743static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
744 {
745 .gpio = 99,
746 .settings = {
747 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
748 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
749 },
750 },
751 {
752 .gpio = 100,
753 .settings = {
754 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
755 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
756 },
757 },
758 {
759 .gpio = 101,
760 .settings = {
761 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
762 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
763 },
764 },
765 {
766 .gpio = 102,
767 .settings = {
768 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
769 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
770 },
771 },
Manoj Raoc6d904c2012-06-22 00:32:14 -0700772
773};
774
775static struct msm_gpiomux_config msm8930_mhl_configs[] __initdata = {
776 {
777 .gpio = 72,
778 .settings = {
779 [GPIOMUX_ACTIVE] = &hdmi_active_3_cfg,
780 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
781 },
782 },
783 {
784 .gpio = 71,
785 .settings = {
786 [GPIOMUX_ACTIVE] = &hdmi_active_4_cfg,
787 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
788 },
789 },
790 {
791 .gpio = 73,
792 .settings = {
793 [GPIOMUX_ACTIVE] = &hdmi_active_5_cfg,
794 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
795 },
796 },
797
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800798};
799#endif
800
Amy Malochee8de95d2012-02-23 10:40:25 -0800801static struct gpiomux_setting haptics_active_cfg = {
802 .func = GPIOMUX_FUNC_GPIO,
803 .drv = GPIOMUX_DRV_8MA,
804 .pull = GPIOMUX_PULL_UP,
805};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530806static struct gpiomux_setting haptics_suspend_cfg = {
807 .func = GPIOMUX_FUNC_GPIO,
808 .drv = GPIOMUX_DRV_8MA,
809 .pull = GPIOMUX_PULL_DOWN,
810};
811
812static struct msm_gpiomux_config msm8930_haptics_configs[] __initdata = {
813 {
814 .gpio = 77,
815 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800816 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530817 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
818 },
819 },
820 {
821 .gpio = 78,
822 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800823 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530824 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
825 },
826 },
827};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530828
Krishna Konda41b6ab02012-05-16 15:08:03 -0700829static struct gpiomux_setting sd_det_line = {
830 .func = GPIOMUX_FUNC_GPIO,
831 .drv = GPIOMUX_DRV_2MA,
832 .pull = GPIOMUX_PULL_NONE,
833};
834
835static struct msm_gpiomux_config msm8930_sd_det_config[] __initdata = {
836 {
837 .gpio = 94, /* SD Card Detect Line */
838 .settings = {
839 [GPIOMUX_SUSPENDED] = &sd_det_line,
840 [GPIOMUX_ACTIVE] = &sd_det_line,
841 },
842 },
843};
844
Wentao Xuc7769c02012-08-03 15:06:41 -0400845static struct gpiomux_setting gyro_int_line = {
846 .func = GPIOMUX_FUNC_GPIO,
847 .drv = GPIOMUX_DRV_2MA,
848 .pull = GPIOMUX_PULL_NONE,
849};
850
851static struct msm_gpiomux_config msm8930_gyro_int_config[] __initdata = {
852 {
853 .gpio = 69, /* Gyro Interrupt Line */
854 .settings = {
855 [GPIOMUX_SUSPENDED] = &gyro_int_line,
856 [GPIOMUX_ACTIVE] = &gyro_int_line,
857 },
858 },
859};
860
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700861static struct msm_gpiomux_config msm_sitar_config[] __initdata = {
862 {
863 .gpio = 42, /* SYS_RST_N */
864 .settings = {
865 [GPIOMUX_SUSPENDED] = &sitar_reset,
866 },
867 }
868};
869
Taniya Das75596f92013-03-06 11:47:34 +0530870static struct msm_gpiomux_config sglte_8930_configs[] __initdata = {
871 /* AP2MDM_STATUS */
872 {
873 .gpio = 77,
874 .settings = {
875 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
876 }
877 },
878 /* MDM2AP_STATUS */
879 {
880 .gpio = 24,
881 .settings = {
882 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
883 }
884 },
885 /* MDM2AP_ERRFATAL */
886 {
887 .gpio = 40,
888 .settings = {
889 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
890 }
891 },
892 /* AP2MDM_ERRFATAL */
893 {
894 .gpio = 80,
895 .settings = {
896 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
897 }
898 },
899 /* AP2MDM_KPDPWR_N */
900 {
901 .gpio = 79,
902 .settings = {
903 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
904 }
905 },
906 /* AP2MDM_PMIC_PWR_EN */
907 {
908 .gpio = 22,
909 .settings = {
910 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
911 }
912 },
913 /* AP2MDM_SOFT_RESET */
914 {
915 .gpio = 78,
916 .settings = {
917 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
918 }
919 },
920 /* USB_SW */
921 {
922 .gpio = 25,
923 .settings = {
924 [GPIOMUX_SUSPENDED] = &usbsw_cfg,
925 }
926 }
927};
928
929static struct msm_gpiomux_config msm8930_fusion_gsbi_configs[] = {
930 {
931 .gpio = 93,
932 .settings = {
933 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
934 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
935 }
936 },
937 {
938 .gpio = 94,
939 .settings = {
940 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
941 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
942 }
943 },
944 {
945 .gpio = 95,
946 .settings = {
947 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
948 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
949 }
950 },
951 {
952 .gpio = 96,
953 .settings = {
954 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
955 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
956 }
957 },
958};
959
960static struct msm_gpiomux_config msm8930_external_vfr_configs[] __initdata = {
961 {
962 .gpio = 23, /* EXTERNAL VFR */
963 .settings = {
964 [GPIOMUX_SUSPENDED] = &external_vfr[0],
965 [GPIOMUX_ACTIVE] = &external_vfr[1],
966 },
967 },
968};
969
970int __init sglte8930_init_gpiomux(void)
971{
972 /* For 8960 Fusion 2.2 Primary IPC */
973 msm_gpiomux_install(msm8930_fusion_gsbi_configs,
974 ARRAY_SIZE(msm8930_fusion_gsbi_configs));
975 /* For SGLTE 8960 Fusion External VFR */
976 msm_gpiomux_install(msm8930_external_vfr_configs,
977 ARRAY_SIZE(msm8930_external_vfr_configs));
978 msm_gpiomux_install(sglte_8930_configs,
979 ARRAY_SIZE(sglte_8930_configs));
980
Kiran Gunda484442e2013-03-11 19:14:44 +0530981 msm_gpiomux_install(msm8930_sglte_gsbi_configs,
982 ARRAY_SIZE(msm8930_sglte_gsbi_configs));
983
Taniya Das75596f92013-03-06 11:47:34 +0530984 msm_gpiomux_install(msm8960_slimbus_config,
985 ARRAY_SIZE(msm8960_slimbus_config));
986
987 msm_gpiomux_install(msm8960_audio_codec_configs,
988 ARRAY_SIZE(msm8960_audio_codec_configs));
989
990 msm_gpiomux_install(wcnss_5wire_interface,
991 ARRAY_SIZE(wcnss_5wire_interface));
992
993 msm_gpiomux_install(msm8960_mdp_vsync_configs,
994 ARRAY_SIZE(msm8960_mdp_vsync_configs));
995
996 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
997
Shantanu Jain55d277a2013-03-08 11:37:29 +0530998 msm_gpiomux_install(msm8960_synaptic_rmi4_configs,
999 ARRAY_SIZE(msm8960_synaptic_rmi4_configs));
1000
Taniya Das75596f92013-03-06 11:47:34 +05301001 return 0;
1002}
1003
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001004int __init msm8930_init_gpiomux(void)
1005{
1006 int rc = msm_gpiomux_init(NR_GPIO_IRQS);
1007 if (rc) {
1008 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1009 return rc;
1010 }
1011
Taniya Das75596f92013-03-06 11:47:34 +05301012 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1013 return sglte8930_init_gpiomux();
1014
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001015#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
1016 msm_gpiomux_install(msm8960_ethernet_configs,
1017 ARRAY_SIZE(msm8960_ethernet_configs));
1018#endif
1019
1020 msm_gpiomux_install(msm8960_gsbi_configs,
1021 ARRAY_SIZE(msm8960_gsbi_configs));
1022
Amy Malochef3c9db42011-12-08 15:17:35 -08001023 msm_gpiomux_install(msm8960_atmel_configs,
1024 ARRAY_SIZE(msm8960_atmel_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001025
1026 msm_gpiomux_install(msm8960_slimbus_config,
1027 ARRAY_SIZE(msm8960_slimbus_config));
1028
1029 msm_gpiomux_install(msm8960_audio_codec_configs,
1030 ARRAY_SIZE(msm8960_audio_codec_configs));
1031
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -07001032 msm_gpiomux_install(msm8960_audio_mbhc_configs,
1033 ARRAY_SIZE(msm8960_audio_mbhc_configs));
1034
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -07001035 msm_gpiomux_install(msm8960_audio_spkr_configs,
1036 ARRAY_SIZE(msm8960_audio_spkr_configs));
1037
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001038 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
1039 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
1040
1041 msm_gpiomux_install(wcnss_5wire_interface,
1042 ARRAY_SIZE(wcnss_5wire_interface));
1043
1044 if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
Mayank Ranabf5084a2011-12-12 17:06:54 +05301045 machine_is_msm8930_cdp()) {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001046 msm_gpiomux_install(hap_lvl_shft_config,
1047 ARRAY_SIZE(hap_lvl_shft_config));
Mayank Ranabf5084a2011-12-12 17:06:54 +05301048#ifdef MSM8930_PHASE_2
1049 msm_gpiomux_install(msm8930_hsusb_configs,
1050 ARRAY_SIZE(msm8930_hsusb_configs));
1051#endif
1052 }
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001053
1054 if (PLATFORM_IS_CHARM25())
1055 msm_gpiomux_install(mdm_configs,
1056 ARRAY_SIZE(mdm_configs));
1057
Amy Malochee8de95d2012-02-23 10:40:25 -08001058 if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
1059 || machine_is_msm8930_fluid())
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301060 msm_gpiomux_install(msm8930_haptics_configs,
1061 ARRAY_SIZE(msm8930_haptics_configs));
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301062
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001063#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1064 msm_gpiomux_install(msm8960_hdmi_configs,
1065 ARRAY_SIZE(msm8960_hdmi_configs));
Manoj Raoc6d904c2012-06-22 00:32:14 -07001066 if (machine_is_msm8930_fluid())
1067 msm_gpiomux_install(msm8930_mhl_configs,
1068 ARRAY_SIZE(msm8930_mhl_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001069#endif
1070
1071 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1072 ARRAY_SIZE(msm8960_mdp_vsync_configs));
Krishna Konda41b6ab02012-05-16 15:08:03 -07001073
1074 msm_gpiomux_install(msm8930_sd_det_config,
1075 ARRAY_SIZE(msm8930_sd_det_config));
1076
Wentao Xuc7769c02012-08-03 15:06:41 -04001077 if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
1078 msm_gpiomux_install(msm8930_gyro_int_config,
1079 ARRAY_SIZE(msm8930_gyro_int_config));
1080
Joonwoo Parkb0795e12012-08-24 22:47:53 -07001081 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
1082
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001083 return 0;
1084}