blob: 41eee63a3020c049fe44336591002bd785f3a7c7 [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Stepan Moskovchenko2327a952011-12-14 16:31:28 -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 <linux/platform_device.h>
17#include <linux/bootmem.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070018#include <linux/gpio.h>
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080019#include <asm/mach-types.h>
20#include <asm/mach/mmc.h>
21#include <mach/msm_bus_board.h>
22#include <mach/board.h>
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080023#include <mach/gpiomux.h>
Joel Kingdacbc822012-01-25 13:30:57 -080024#include <mach/socinfo.h>
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080025#include "devices.h"
26#include "board-8064.h"
27
28#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
29static struct gpiomux_setting gpio_eth_config = {
30 .pull = GPIOMUX_PULL_NONE,
31 .drv = GPIOMUX_DRV_8MA,
32 .func = GPIOMUX_FUNC_GPIO,
33};
34
35/* The SPI configurations apply to GSBI 5*/
36static struct gpiomux_setting gpio_spi_config = {
37 .func = GPIOMUX_FUNC_2,
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -080038 .drv = GPIOMUX_DRV_12MA,
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080039 .pull = GPIOMUX_PULL_NONE,
40};
41
42/* The SPI configurations apply to GSBI 5 chip select 2*/
43static struct gpiomux_setting gpio_spi_cs2_config = {
44 .func = GPIOMUX_FUNC_3,
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -080045 .drv = GPIOMUX_DRV_12MA,
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080046 .pull = GPIOMUX_PULL_NONE,
47};
48
Hanumant Singh9a361192013-01-03 15:08:39 -080049
50struct msm_gpiomux_config apq8064_ethernet_configs[] = {
51 {
52 .gpio = 43,
53 .settings = {
54 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
55 [GPIOMUX_ACTIVE] = &gpio_eth_config,
56 }
57 },
58};
59#endif
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -080060/* Chip selects for SPI clients */
61static struct gpiomux_setting gpio_spi_cs_config = {
62 .func = GPIOMUX_FUNC_GPIO,
63 .drv = GPIOMUX_DRV_12MA,
64 .pull = GPIOMUX_PULL_UP,
65};
66
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080067/* Chip selects for EPM SPI clients */
68static struct gpiomux_setting gpio_epm_spi_cs_config = {
Siddartha Mohanadoss52015a52012-05-09 21:44:58 -070069 .func = GPIOMUX_FUNC_6,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080070 .drv = GPIOMUX_DRV_12MA,
71 .pull = GPIOMUX_PULL_UP,
72};
73
Terence Hampson2e1705f2012-04-11 19:55:29 -040074#ifdef CONFIG_MSM_VCAP
75static struct gpiomux_setting gpio_vcap_config[] = {
76 {
77 .func = GPIOMUX_FUNC_GPIO,
78 .drv = GPIOMUX_DRV_2MA,
79 .pull = GPIOMUX_PULL_DOWN,
80 },
81 {
82 .func = GPIOMUX_FUNC_1,
83 .drv = GPIOMUX_DRV_2MA,
84 .pull = GPIOMUX_PULL_DOWN,
85 },
86 {
87 .func = GPIOMUX_FUNC_2,
88 .drv = GPIOMUX_DRV_2MA,
89 .pull = GPIOMUX_PULL_DOWN,
90 },
91 {
92 .func = GPIOMUX_FUNC_3,
93 .drv = GPIOMUX_DRV_2MA,
94 .pull = GPIOMUX_PULL_DOWN,
95 },
96 {
97 .func = GPIOMUX_FUNC_4,
98 .drv = GPIOMUX_DRV_2MA,
99 .pull = GPIOMUX_PULL_DOWN,
100 },
101 {
102 .func = GPIOMUX_FUNC_5,
103 .drv = GPIOMUX_DRV_2MA,
104 .pull = GPIOMUX_PULL_DOWN,
105 },
106 {
107 .func = GPIOMUX_FUNC_6,
108 .drv = GPIOMUX_DRV_2MA,
109 .pull = GPIOMUX_PULL_DOWN,
110 },
111 {
112 .func = GPIOMUX_FUNC_7,
113 .drv = GPIOMUX_DRV_2MA,
114 .pull = GPIOMUX_PULL_DOWN,
115 },
116 {
117 .func = GPIOMUX_FUNC_8,
118 .drv = GPIOMUX_DRV_2MA,
119 .pull = GPIOMUX_PULL_DOWN,
120 },
121 {
122 .func = GPIOMUX_FUNC_9,
123 .drv = GPIOMUX_DRV_2MA,
124 .pull = GPIOMUX_PULL_DOWN,
125 },
126 {
127 .func = GPIOMUX_FUNC_A,
128 .drv = GPIOMUX_DRV_2MA,
129 .pull = GPIOMUX_PULL_DOWN,
130 },
131};
132
133struct msm_gpiomux_config vcap_configs[] = {
134 {
135 .gpio = 20,
136 .settings = {
137 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
138 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
139 }
140 },
141 {
142 .gpio = 25,
143 .settings = {
144 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
145 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
146 }
147 },
148 {
149 .gpio = 24,
150 .settings = {
151 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[1],
152 [GPIOMUX_ACTIVE] = &gpio_vcap_config[1],
153 }
154 },
155 {
156 .gpio = 23,
157 .settings = {
158 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
159 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
160 }
161 },
162 {
163 .gpio = 19,
164 .settings = {
165 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[8],
166 [GPIOMUX_ACTIVE] = &gpio_vcap_config[8],
167 }
168 },
169 {
170 .gpio = 22,
171 .settings = {
172 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
173 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
174 }
175 },
176 {
177 .gpio = 21,
178 .settings = {
179 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
180 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
181 }
182 },
183 {
184 .gpio = 12,
185 .settings = {
186 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[6],
187 [GPIOMUX_ACTIVE] = &gpio_vcap_config[6],
188 }
189 },
190 {
191 .gpio = 18,
192 .settings = {
193 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[9],
194 [GPIOMUX_ACTIVE] = &gpio_vcap_config[9],
195 }
196 },
197 {
198 .gpio = 11,
199 .settings = {
200 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[10],
201 [GPIOMUX_ACTIVE] = &gpio_vcap_config[10],
202 }
203 },
204 {
205 .gpio = 10,
206 .settings = {
207 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[9],
208 [GPIOMUX_ACTIVE] = &gpio_vcap_config[9],
209 }
210 },
211 {
212 .gpio = 9,
213 .settings = {
214 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
215 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
216 }
217 },
218 {
219 .gpio = 26,
220 .settings = {
221 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[1],
222 [GPIOMUX_ACTIVE] = &gpio_vcap_config[1],
223 }
224 },
225 {
226 .gpio = 8,
227 .settings = {
228 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[3],
229 [GPIOMUX_ACTIVE] = &gpio_vcap_config[3],
230 }
231 },
232 {
233 .gpio = 7,
234 .settings = {
235 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
236 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
237 }
238 },
239 {
240 .gpio = 6,
241 .settings = {
242 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
243 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
244 }
245 },
246 {
247 .gpio = 80,
248 .settings = {
249 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
250 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
251 }
252 },
253 {
254 .gpio = 86,
255 .settings = {
256 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[1],
257 [GPIOMUX_ACTIVE] = &gpio_vcap_config[1],
258 }
259 },
260 {
261 .gpio = 85,
262 .settings = {
263 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[4],
264 [GPIOMUX_ACTIVE] = &gpio_vcap_config[4],
265 }
266 },
267 {
268 .gpio = 84,
269 .settings = {
270 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[3],
271 [GPIOMUX_ACTIVE] = &gpio_vcap_config[3],
272 }
273 },
274 {
275 .gpio = 5,
276 .settings = {
277 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
278 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
279 }
280 },
281 {
282 .gpio = 4,
283 .settings = {
284 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[3],
285 [GPIOMUX_ACTIVE] = &gpio_vcap_config[3],
286 }
287 },
288 {
289 .gpio = 3,
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[6],
292 [GPIOMUX_ACTIVE] = &gpio_vcap_config[6],
293 }
294 },
295 {
296 .gpio = 2,
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[5],
299 [GPIOMUX_ACTIVE] = &gpio_vcap_config[5],
300 }
301 },
302 {
303 .gpio = 82,
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[4],
306 [GPIOMUX_ACTIVE] = &gpio_vcap_config[4],
307 }
308 },
309 {
310 .gpio = 83,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[4],
313 [GPIOMUX_ACTIVE] = &gpio_vcap_config[4],
314 }
315 },
316 {
317 .gpio = 87,
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
320 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
321 }
322 },
323 {
324 .gpio = 13,
325 .settings = {
326 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[6],
327 [GPIOMUX_ACTIVE] = &gpio_vcap_config[6],
328 }
329 },
330};
331#endif
332
David Keitel3c40fc52012-02-09 17:53:52 -0800333static struct gpiomux_setting gpio_i2c_config = {
334 .func = GPIOMUX_FUNC_1,
335 .drv = GPIOMUX_DRV_8MA,
336 .pull = GPIOMUX_PULL_NONE,
337};
338
339static struct gpiomux_setting gpio_i2c_config_sus = {
340 .func = GPIOMUX_FUNC_1,
341 .drv = GPIOMUX_DRV_2MA,
342 .pull = GPIOMUX_PULL_KEEPER,
343};
344
Joonwoo Parkca1516f2012-05-08 13:59:37 -0700345static struct gpiomux_setting mbhc_hs_detect = {
346 .func = GPIOMUX_FUNC_1,
347 .drv = GPIOMUX_DRV_2MA,
348 .pull = GPIOMUX_PULL_NONE,
349};
350
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800351static struct gpiomux_setting cdc_mclk = {
352 .func = GPIOMUX_FUNC_1,
353 .drv = GPIOMUX_DRV_8MA,
354 .pull = GPIOMUX_PULL_NONE,
355};
356
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800357static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
358 .func = GPIOMUX_FUNC_GPIO,
359 .drv = GPIOMUX_DRV_2MA,
360 .pull = GPIOMUX_PULL_UP,
361};
362
363static struct gpiomux_setting wcnss_5wire_active_cfg = {
364 .func = GPIOMUX_FUNC_1,
365 .drv = GPIOMUX_DRV_6MA,
366 .pull = GPIOMUX_PULL_DOWN,
367};
368
369
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800370static struct gpiomux_setting slimbus = {
371 .func = GPIOMUX_FUNC_1,
372 .drv = GPIOMUX_DRV_8MA,
373 .pull = GPIOMUX_PULL_KEEPER,
374};
375
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -0800376static struct gpiomux_setting gsbi1_uart_config = {
377 .func = GPIOMUX_FUNC_1,
378 .drv = GPIOMUX_DRV_16MA,
379 .pull = GPIOMUX_PULL_NONE,
380};
381
David Collinsf0d00732012-01-25 15:46:50 -0800382static struct gpiomux_setting ext_regulator_config = {
383 .func = GPIOMUX_FUNC_GPIO,
384 .drv = GPIOMUX_DRV_8MA,
385 .pull = GPIOMUX_PULL_NONE,
386 .dir = GPIOMUX_OUT_LOW,
387};
388
Jin Hong4bbbfba2012-02-02 21:48:07 -0800389static struct gpiomux_setting gsbi7_func1_cfg = {
390 .func = GPIOMUX_FUNC_1,
391 .drv = GPIOMUX_DRV_8MA,
392 .pull = GPIOMUX_PULL_NONE,
393};
394
395static struct gpiomux_setting gsbi7_func2_cfg = {
396 .func = GPIOMUX_FUNC_2,
397 .drv = GPIOMUX_DRV_8MA,
398 .pull = GPIOMUX_PULL_NONE,
399};
400
Jing Lin04601f92012-02-05 15:36:07 -0800401static struct gpiomux_setting gsbi3_suspended_cfg = {
402 .func = GPIOMUX_FUNC_1,
403 .drv = GPIOMUX_DRV_2MA,
404 .pull = GPIOMUX_PULL_KEEPER,
405};
406
407static struct gpiomux_setting gsbi3_active_cfg = {
408 .func = GPIOMUX_FUNC_1,
409 .drv = GPIOMUX_DRV_8MA,
410 .pull = GPIOMUX_PULL_NONE,
411};
412
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -0800413static struct gpiomux_setting hdmi_suspend_cfg = {
414 .func = GPIOMUX_FUNC_GPIO,
415 .drv = GPIOMUX_DRV_2MA,
416 .pull = GPIOMUX_PULL_DOWN,
417};
418
419static struct gpiomux_setting hdmi_active_1_cfg = {
420 .func = GPIOMUX_FUNC_1,
421 .drv = GPIOMUX_DRV_2MA,
422 .pull = GPIOMUX_PULL_UP,
423};
424
425static struct gpiomux_setting hdmi_active_2_cfg = {
426 .func = GPIOMUX_FUNC_1,
427 .drv = GPIOMUX_DRV_16MA,
428 .pull = GPIOMUX_PULL_DOWN,
429};
430
Joel King8f839b92012-04-01 14:37:46 -0700431static struct gpiomux_setting gsbi5_suspended_cfg = {
432 .func = GPIOMUX_FUNC_2,
433 .drv = GPIOMUX_DRV_12MA,
434 .pull = GPIOMUX_PULL_NONE,
435};
436
437static struct gpiomux_setting gsbi5_active_cfg = {
438 .func = GPIOMUX_FUNC_2,
439 .drv = GPIOMUX_DRV_12MA,
440 .pull = GPIOMUX_PULL_NONE,
441};
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +0530442
443static struct gpiomux_setting sx150x_suspended_cfg = {
444 .func = GPIOMUX_FUNC_GPIO,
445 .drv = GPIOMUX_DRV_8MA,
446 .pull = GPIOMUX_PULL_NONE,
447};
448
449static struct gpiomux_setting sx150x_active_cfg = {
450 .func = GPIOMUX_FUNC_GPIO,
451 .drv = GPIOMUX_DRV_8MA,
452 .pull = GPIOMUX_PULL_NONE,
453};
454
Steve Mucklef132c6c2012-06-06 18:30:57 -0700455#ifdef CONFIG_USB_EHCI_MSM_HSIC
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800456static struct gpiomux_setting cyts_sleep_sus_cfg = {
457 .func = GPIOMUX_FUNC_GPIO,
458 .drv = GPIOMUX_DRV_6MA,
459 .pull = GPIOMUX_PULL_DOWN,
460};
461
462static struct gpiomux_setting cyts_sleep_act_cfg = {
463 .func = GPIOMUX_FUNC_GPIO,
464 .drv = GPIOMUX_DRV_6MA,
465 .pull = GPIOMUX_PULL_DOWN,
466};
467
468static struct gpiomux_setting cyts_int_act_cfg = {
469 .func = GPIOMUX_FUNC_GPIO,
470 .drv = GPIOMUX_DRV_8MA,
471 .pull = GPIOMUX_PULL_UP,
472};
473
474static struct gpiomux_setting cyts_int_sus_cfg = {
475 .func = GPIOMUX_FUNC_GPIO,
476 .drv = GPIOMUX_DRV_2MA,
477 .pull = GPIOMUX_PULL_DOWN,
478};
479
480static struct msm_gpiomux_config cyts_gpio_configs[] __initdata = {
481 { /* TS INTERRUPT */
482 .gpio = 6,
483 .settings = {
484 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
485 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
486 },
487 },
488 { /* TS SLEEP */
489 .gpio = 33,
490 .settings = {
491 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
492 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
493 },
494 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800495};
Amy Maloche609bb5e2012-08-03 09:41:42 -0700496static struct msm_gpiomux_config cyts_gpio_alt_config[] __initdata = {
497 { /* TS INTERRUPT */
498 .gpio = 6,
499 .settings = {
500 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
501 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
502 },
503 },
504 { /* TS SLEEP */
505 .gpio = 12,
506 .settings = {
507 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
508 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
509 },
510 },
511};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800512
Amy Maloche9ba3ffe2012-04-26 10:31:20 -0700513static struct gpiomux_setting hsic_act_cfg = {
514 .func = GPIOMUX_FUNC_1,
515 .drv = GPIOMUX_DRV_8MA,
516 .pull = GPIOMUX_PULL_NONE,
517};
518
519static struct gpiomux_setting hsic_sus_cfg = {
520 .func = GPIOMUX_FUNC_GPIO,
521 .drv = GPIOMUX_DRV_2MA,
522 .pull = GPIOMUX_PULL_DOWN,
523 .dir = GPIOMUX_OUT_LOW,
524};
525
Hemant Kumar6fd65032012-05-23 13:02:24 -0700526static struct gpiomux_setting hsic_wakeup_act_cfg = {
527 .func = GPIOMUX_FUNC_GPIO,
528 .drv = GPIOMUX_DRV_8MA,
529 .pull = GPIOMUX_PULL_DOWN,
530 .dir = GPIOMUX_IN,
531};
532
533static struct gpiomux_setting hsic_wakeup_sus_cfg = {
534 .func = GPIOMUX_FUNC_GPIO,
535 .drv = GPIOMUX_DRV_2MA,
536 .pull = GPIOMUX_PULL_DOWN,
537 .dir = GPIOMUX_IN,
538};
Amy Maloche9ba3ffe2012-04-26 10:31:20 -0700539
Hemant Kumara945b472012-01-25 15:08:06 -0800540static struct msm_gpiomux_config apq8064_hsic_configs[] = {
541 {
542 .gpio = 88, /*HSIC_STROBE */
543 .settings = {
544 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
545 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
546 },
547 },
548 {
549 .gpio = 89, /* HSIC_DATA */
550 .settings = {
551 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
552 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
553 },
554 },
Hemant Kumar6fd65032012-05-23 13:02:24 -0700555 {
556 .gpio = 47, /* wake up */
557 .settings = {
558 [GPIOMUX_ACTIVE] = &hsic_wakeup_act_cfg,
559 [GPIOMUX_SUSPENDED] = &hsic_wakeup_sus_cfg,
560 },
561 },
Hemant Kumara945b472012-01-25 15:08:06 -0800562};
563#endif
564
Jing Lin21ed4de2012-02-05 15:53:28 -0800565static struct gpiomux_setting mxt_reset_sus_cfg = {
566 .func = GPIOMUX_FUNC_GPIO,
567 .drv = GPIOMUX_DRV_6MA,
568 .pull = GPIOMUX_PULL_DOWN,
569};
570
571static struct gpiomux_setting mxt_reset_act_cfg = {
572 .func = GPIOMUX_FUNC_GPIO,
573 .drv = GPIOMUX_DRV_6MA,
574 .pull = GPIOMUX_PULL_UP,
575};
576
577static struct gpiomux_setting mxt_int_sus_cfg = {
578 .func = GPIOMUX_FUNC_GPIO,
579 .drv = GPIOMUX_DRV_2MA,
580 .pull = GPIOMUX_PULL_DOWN,
581};
582
583static struct gpiomux_setting mxt_int_act_cfg = {
584 .func = GPIOMUX_FUNC_GPIO,
585 .drv = GPIOMUX_DRV_8MA,
586 .pull = GPIOMUX_PULL_UP,
587};
588
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -0800589static struct msm_gpiomux_config apq8064_hdmi_configs[] __initdata = {
590 {
591 .gpio = 69,
592 .settings = {
593 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
594 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
595 },
596 },
597 {
598 .gpio = 70,
599 .settings = {
600 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
601 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
602 },
603 },
604 {
605 .gpio = 71,
606 .settings = {
607 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
608 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
609 },
610 },
611 {
612 .gpio = 72,
613 .settings = {
614 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
615 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
616 },
617 },
618};
619
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800620static struct msm_gpiomux_config apq8064_gsbi_configs[] __initdata = {
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -0800621 {
Jing Lin04601f92012-02-05 15:36:07 -0800622 .gpio = 8, /* GSBI3 I2C QUP SDA */
623 .settings = {
624 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
625 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
626 },
627 },
628 {
629 .gpio = 9, /* GSBI3 I2C QUP SCL */
630 .settings = {
631 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
632 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
633 },
634 },
635 {
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -0800636 .gpio = 18, /* GSBI1 UART TX */
637 .settings = {
638 [GPIOMUX_SUSPENDED] = &gsbi1_uart_config,
639 },
640 },
641 {
642 .gpio = 19, /* GSBI1 UART RX */
643 .settings = {
644 [GPIOMUX_SUSPENDED] = &gsbi1_uart_config,
645 },
646 },
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800647#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
648 {
649 .gpio = 51, /* GSBI5 QUP SPI_DATA_MOSI */
650 .settings = {
651 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
652 },
653 },
654 {
655 .gpio = 52, /* GSBI5 QUP SPI_DATA_MISO */
656 .settings = {
657 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
658 },
659 },
660 {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -0800661 .gpio = 53, /* Funny CS0 */
662 .settings = {
663 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
664 },
665 },
666 {
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800667 .gpio = 31, /* GSBI5 QUP SPI_CS2_N */
668 .settings = {
669 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
670 },
671 },
672 {
673 .gpio = 54, /* GSBI5 QUP SPI_CLK */
674 .settings = {
675 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
676 },
677 },
678#endif
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -0800679 {
680 .gpio = 30, /* FP CS */
681 .settings = {
682 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
683 },
684 },
685 {
686 .gpio = 32, /* EPM CS */
687 .settings = {
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800688 [GPIOMUX_SUSPENDED] = &gpio_epm_spi_cs_config,
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -0800689 },
690 },
691 {
692 .gpio = 53, /* NOR CS */
693 .settings = {
694 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
695 },
696 },
Jin Hong4bbbfba2012-02-02 21:48:07 -0800697 {
698 .gpio = 82, /* GSBI7 UART2 TX */
699 .settings = {
700 [GPIOMUX_SUSPENDED] = &gsbi7_func2_cfg,
701 },
702 },
703 {
704 .gpio = 83, /* GSBI7 UART2 RX */
705 .settings = {
706 [GPIOMUX_SUSPENDED] = &gsbi7_func1_cfg,
707 },
708 },
David Keitel3c40fc52012-02-09 17:53:52 -0800709 {
710 .gpio = 21, /* GSBI1 QUP I2C_CLK */
711 .settings = {
712 [GPIOMUX_SUSPENDED] = &gpio_i2c_config_sus,
713 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
714 },
715 },
716 {
717 .gpio = 20, /* GSBI1 QUP I2C_DATA */
718 .settings = {
719 [GPIOMUX_SUSPENDED] = &gpio_i2c_config_sus,
720 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
721 },
722 },
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800723};
724
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800725static struct msm_gpiomux_config apq8064_slimbus_config[] __initdata = {
726 {
727 .gpio = 40, /* slimbus clk */
728 .settings = {
729 [GPIOMUX_SUSPENDED] = &slimbus,
730 },
731 },
732 {
733 .gpio = 41, /* slimbus data */
734 .settings = {
735 [GPIOMUX_SUSPENDED] = &slimbus,
736 },
737 },
738};
739
Santosh Mardieff9a742012-04-09 23:23:39 +0530740static struct gpiomux_setting spkr_i2c = {
741 .func = GPIOMUX_FUNC_1,
742 .drv = GPIOMUX_DRV_8MA,
743 .pull = GPIOMUX_PULL_KEEPER,
744};
745
746static struct msm_gpiomux_config mpq8064_spkr_i2s_config[] __initdata = {
747 {
748 .gpio = 47, /* spkr i2c sck */
749 .settings = {
750 [GPIOMUX_SUSPENDED] = &spkr_i2c,
751 },
752 },
753 {
754 .gpio = 48, /* spkr_i2s_ws */
755 .settings = {
756 [GPIOMUX_SUSPENDED] = &spkr_i2c,
757 },
758 },
759 {
760 .gpio = 49, /* spkr_i2s_dout */
761 .settings = {
762 [GPIOMUX_SUSPENDED] = &spkr_i2c,
763 },
764 },
765 {
766 .gpio = 50, /* spkr_i2s_mclk */
767 .settings = {
768 [GPIOMUX_SUSPENDED] = &spkr_i2c,
769 },
770 },
771};
772
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800773static struct msm_gpiomux_config apq8064_audio_codec_configs[] __initdata = {
774 {
Joonwoo Parkca1516f2012-05-08 13:59:37 -0700775 .gpio = 38,
776 .settings = {
777 [GPIOMUX_SUSPENDED] = &mbhc_hs_detect,
778 },
779 },
780 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800781 .gpio = 39,
782 .settings = {
783 [GPIOMUX_SUSPENDED] = &cdc_mclk,
784 },
785 },
786};
787
David Collinsf0d00732012-01-25 15:46:50 -0800788/* External 3.3 V regulator enable */
789static struct msm_gpiomux_config apq8064_ext_regulator_configs[] __initdata = {
790 {
791 .gpio = APQ8064_EXT_3P3V_REG_EN_GPIO,
792 .settings = {
793 [GPIOMUX_SUSPENDED] = &ext_regulator_config,
794 },
795 },
796};
797
Joel Kingdacbc822012-01-25 13:30:57 -0800798static struct gpiomux_setting ap2mdm_cfg = {
799 .func = GPIOMUX_FUNC_GPIO,
Taniya Das389853a2012-12-27 17:26:27 +0530800 .drv = GPIOMUX_DRV_4MA,
Joel Kingdacbc822012-01-25 13:30:57 -0800801 .pull = GPIOMUX_PULL_DOWN,
802};
803
804static struct gpiomux_setting mdm2ap_status_cfg = {
805 .func = GPIOMUX_FUNC_GPIO,
Taniya Das389853a2012-12-27 17:26:27 +0530806 .drv = GPIOMUX_DRV_2MA,
Joel King269aa602012-07-23 08:07:35 -0700807 .pull = GPIOMUX_PULL_DOWN,
Joel Kingdacbc822012-01-25 13:30:57 -0800808};
809
810static struct gpiomux_setting mdm2ap_errfatal_cfg = {
811 .func = GPIOMUX_FUNC_GPIO,
Taniya Das389853a2012-12-27 17:26:27 +0530812 .drv = GPIOMUX_DRV_2MA,
Joel Kingdacbc822012-01-25 13:30:57 -0800813 .pull = GPIOMUX_PULL_DOWN,
814};
815
Vamsi Krishnac6dcd5e2012-05-09 15:38:01 -0700816static struct gpiomux_setting mdm2ap_pblrdy = {
817 .func = GPIOMUX_FUNC_GPIO,
Taniya Das389853a2012-12-27 17:26:27 +0530818 .drv = GPIOMUX_DRV_2MA,
Vamsi Krishnac6dcd5e2012-05-09 15:38:01 -0700819 .pull = GPIOMUX_PULL_DOWN,
820};
821
822
Joel King14fe7fa2012-05-27 14:26:11 -0700823static struct gpiomux_setting ap2mdm_soft_reset_cfg = {
Joel Kingdacbc822012-01-25 13:30:57 -0800824 .func = GPIOMUX_FUNC_GPIO,
Taniya Das389853a2012-12-27 17:26:27 +0530825 .drv = GPIOMUX_DRV_4MA,
Joel Kingdacbc822012-01-25 13:30:57 -0800826 .pull = GPIOMUX_PULL_DOWN,
827};
828
Vamsi Krishna9e307cd2012-04-11 13:15:36 -0700829static struct gpiomux_setting ap2mdm_wakeup = {
830 .func = GPIOMUX_FUNC_GPIO,
Taniya Das389853a2012-12-27 17:26:27 +0530831 .drv = GPIOMUX_DRV_4MA,
Vamsi Krishna9e307cd2012-04-11 13:15:36 -0700832 .pull = GPIOMUX_PULL_DOWN,
833};
834
Joel Kingdacbc822012-01-25 13:30:57 -0800835static struct msm_gpiomux_config mdm_configs[] __initdata = {
836 /* AP2MDM_STATUS */
837 {
838 .gpio = 48,
839 .settings = {
840 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
841 }
842 },
843 /* MDM2AP_STATUS */
844 {
845 .gpio = 49,
846 .settings = {
Joel King269aa602012-07-23 08:07:35 -0700847 [GPIOMUX_ACTIVE] = &mdm2ap_status_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -0800848 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
849 }
850 },
851 /* MDM2AP_ERRFATAL */
852 {
853 .gpio = 19,
854 .settings = {
855 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
856 }
857 },
858 /* AP2MDM_ERRFATAL */
859 {
860 .gpio = 18,
861 .settings = {
862 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
863 }
864 },
Joel King14fe7fa2012-05-27 14:26:11 -0700865 /* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
Joel Kingdacbc822012-01-25 13:30:57 -0800866 {
867 .gpio = 27,
868 .settings = {
Joel King14fe7fa2012-05-27 14:26:11 -0700869 [GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -0800870 }
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530871 },
Vamsi Krishna9e307cd2012-04-11 13:15:36 -0700872 /* AP2MDM_WAKEUP */
873 {
874 .gpio = 35,
875 .settings = {
876 [GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
877 }
878 },
Vamsi Krishnac6dcd5e2012-05-09 15:38:01 -0700879 /* MDM2AP_PBL_READY*/
880 {
881 .gpio = 46,
882 .settings = {
883 [GPIOMUX_SUSPENDED] = &mdm2ap_pblrdy,
884 }
885 },
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530886};
887
Ameya Thakur2702baf2013-01-30 11:55:25 -0800888static struct msm_gpiomux_config amdm_configs[] __initdata = {
889 /* AP2MDM_STATUS */
890 {
891 .gpio = 48,
892 .settings = {
893 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
894 }
895 },
896 /* MDM2AP_STATUS */
897 {
898 .gpio = 49,
899 .settings = {
900 [GPIOMUX_ACTIVE] = &mdm2ap_status_cfg,
901 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
902 }
903 },
904 /* MDM2AP_ERRFATAL */
905 {
906 .gpio = 19,
907 .settings = {
908 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
909 }
910 },
911 /* AP2MDM_ERRFATAL */
912 {
913 .gpio = 18,
914 .settings = {
915 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
916 }
917 },
918 /* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
919 {
920 .gpio = 27,
921 .settings = {
922 [GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
923 }
924 },
925 /* AP2MDM_WAKEUP */
926 {
927 .gpio = 35,
928 .settings = {
929 [GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
930 }
931 },
932 /* MDM2AP_PBL_READY*/
933 {
934 .gpio = 31,
935 .settings = {
936 [GPIOMUX_SUSPENDED] = &mdm2ap_pblrdy,
937 }
938 },
939};
940
941static struct msm_gpiomux_config bmdm_configs[] __initdata = {
942 /* AP2MDM_STATUS */
943 {
944 .gpio = 56,
945 .settings = {
946 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
947 }
948 },
949 /* MDM2AP_STATUS */
950 {
951 .gpio = 32,
952 .settings = {
953 [GPIOMUX_ACTIVE] = &mdm2ap_status_cfg,
954 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
955 }
956 },
957 /* MDM2AP_ERRFATAL */
958 {
959 .gpio = 81,
960 .settings = {
961 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
962 }
963 },
964 /* AP2MDM_ERRFATAL */
965 {
966 .gpio = 18,
967 .settings = {
968 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
969 }
970 },
971 /* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
972 {
973 .gpio = 3,
974 .settings = {
975 [GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
976 }
977 },
978 /* AP2MDM_WAKEUP */
979 {
980 .gpio = 29,
981 .settings = {
982 [GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
983 }
984 },
985};
986
Ameya Thakure155ece2012-07-09 12:08:37 -0700987static struct msm_gpiomux_config mdm_i2s_configs[] __initdata = {
988 /* AP2MDM_STATUS */
989 {
990 .gpio = 48,
991 .settings = {
992 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
993 }
994 },
995 /* MDM2AP_STATUS */
996 {
997 .gpio = 49,
998 .settings = {
999 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
1000 }
1001 },
1002 /* MDM2AP_ERRFATAL */
1003 {
1004 .gpio = 19,
1005 .settings = {
1006 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
1007 }
1008 },
1009 /* AP2MDM_ERRFATAL */
1010 {
1011 .gpio = 18,
1012 .settings = {
1013 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
1014 }
1015 },
1016 /* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
1017 {
1018 .gpio = 0,
1019 .settings = {
1020 [GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
1021 }
1022 },
1023 /* AP2MDM_WAKEUP */
1024 {
1025 .gpio = 44,
1026 .settings = {
1027 [GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
1028 }
1029 },
1030 /* MDM2AP_PBL_READY*/
1031 {
1032 .gpio = 81,
1033 .settings = {
1034 [GPIOMUX_SUSPENDED] = &mdm2ap_pblrdy,
1035 }
1036 },
1037};
1038
Kuirong Wangf23f8c52012-03-31 12:34:51 -07001039static struct gpiomux_setting mi2s_act_cfg = {
1040 .func = GPIOMUX_FUNC_1,
1041 .drv = GPIOMUX_DRV_8MA,
1042 .pull = GPIOMUX_PULL_NONE,
1043};
1044
1045static struct gpiomux_setting mi2s_sus_cfg = {
1046 .func = GPIOMUX_FUNC_GPIO,
1047 .drv = GPIOMUX_DRV_2MA,
1048 .pull = GPIOMUX_PULL_DOWN,
1049};
1050
1051static struct msm_gpiomux_config mpq8064_mi2s_configs[] __initdata = {
1052 {
1053 .gpio = 27, /* mi2s ws */
1054 .settings = {
1055 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1056 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1057 },
1058 },
1059 {
1060 .gpio = 28, /* mi2s sclk */
1061 .settings = {
1062 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1063 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1064 },
1065 },
1066 {
1067 .gpio = 29, /* mi2s dout3 */
1068 .settings = {
1069 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1070 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1071 },
1072 },
1073 {
1074 .gpio = 30, /* mi2s dout2 */
1075 .settings = {
1076 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1077 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1078 },
1079 },
1080
1081 {
1082 .gpio = 31, /* mi2s dout1 */
1083 .settings = {
1084 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1085 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1086 },
1087 },
1088 {
1089 .gpio = 32, /* mi2s dout0 */
1090 .settings = {
1091 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1092 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1093 },
1094 },
1095
1096 {
1097 .gpio = 33, /* mi2s mclk */
1098 .settings = {
1099 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
1100 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
1101 },
1102 },
1103};
Jing Lin21ed4de2012-02-05 15:53:28 -08001104static struct msm_gpiomux_config apq8064_mxt_configs[] __initdata = {
1105 { /* TS INTERRUPT */
1106 .gpio = 6,
1107 .settings = {
1108 [GPIOMUX_ACTIVE] = &mxt_int_act_cfg,
1109 [GPIOMUX_SUSPENDED] = &mxt_int_sus_cfg,
1110 },
1111 },
1112 { /* TS RESET */
1113 .gpio = 33,
1114 .settings = {
1115 [GPIOMUX_ACTIVE] = &mxt_reset_act_cfg,
1116 [GPIOMUX_SUSPENDED] = &mxt_reset_sus_cfg,
1117 },
1118 },
1119};
1120
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001121static struct msm_gpiomux_config wcnss_5wire_interface[] = {
1122 {
1123 .gpio = 64,
1124 .settings = {
1125 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1126 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1127 },
1128 },
1129 {
1130 .gpio = 65,
1131 .settings = {
1132 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1133 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1134 },
1135 },
1136 {
1137 .gpio = 66,
1138 .settings = {
1139 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1140 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1141 },
1142 },
1143 {
1144 .gpio = 67,
1145 .settings = {
1146 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1147 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1148 },
1149 },
1150 {
1151 .gpio = 68,
1152 .settings = {
1153 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1154 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1155 },
1156 },
1157};
1158
Joel King8f839b92012-04-01 14:37:46 -07001159static struct msm_gpiomux_config mpq8064_gsbi5_i2c_configs[] __initdata = {
1160 {
1161 .gpio = 53, /* GSBI5 I2C QUP SDA */
1162 .settings = {
1163 [GPIOMUX_SUSPENDED] = &gsbi5_suspended_cfg,
1164 [GPIOMUX_ACTIVE] = &gsbi5_active_cfg,
1165 },
1166 },
1167 {
1168 .gpio = 54, /* GSBI5 I2C QUP SCL */
1169 .settings = {
1170 [GPIOMUX_SUSPENDED] = &gsbi5_suspended_cfg,
1171 [GPIOMUX_ACTIVE] = &gsbi5_active_cfg,
1172 },
1173 },
1174};
1175
Ravi Kumar V05931a22012-04-04 17:09:37 +05301176static struct gpiomux_setting ir_suspended_cfg = {
1177 .func = GPIOMUX_FUNC_GPIO,
1178 .drv = GPIOMUX_DRV_2MA,
1179 .pull = GPIOMUX_PULL_UP,
1180};
1181
1182static struct gpiomux_setting ir_active_cfg = {
1183 .func = GPIOMUX_FUNC_GPIO,
1184 .drv = GPIOMUX_DRV_8MA,
1185 .pull = GPIOMUX_PULL_UP,
1186};
1187
1188static struct msm_gpiomux_config mpq8064_ir_configs[] __initdata = {
1189 {
1190 .gpio = 88, /* GPIO IR */
1191 .settings = {
1192 [GPIOMUX_SUSPENDED] = &ir_suspended_cfg,
1193 [GPIOMUX_ACTIVE] = &ir_active_cfg,
1194 },
1195 },
1196};
1197
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05301198static struct msm_gpiomux_config sx150x_int_configs[] __initdata = {
1199 {
1200 .gpio = 81,
1201 .settings = {
1202 [GPIOMUX_SUSPENDED] = &sx150x_suspended_cfg,
1203 [GPIOMUX_ACTIVE] = &sx150x_active_cfg,
1204 },
1205 },
1206};
1207
Oluwafemi Adeyemia46d0322012-05-16 18:27:44 -07001208#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1209static struct gpiomux_setting sdc2_clk_active_cfg = {
1210 .func = GPIOMUX_FUNC_2,
1211 .drv = GPIOMUX_DRV_8MA,
1212 .pull = GPIOMUX_PULL_NONE,
1213};
1214
1215static struct gpiomux_setting sdc2_cmd_data_0_3_active_cfg = {
1216 .func = GPIOMUX_FUNC_2,
1217 .drv = GPIOMUX_DRV_8MA,
1218 .pull = GPIOMUX_PULL_UP,
1219};
1220
1221static struct gpiomux_setting sdc2_suspended_cfg = {
1222 .func = GPIOMUX_FUNC_GPIO,
1223 .drv = GPIOMUX_DRV_2MA,
1224 .pull = GPIOMUX_PULL_DOWN,
1225};
1226
1227static struct gpiomux_setting sdc2_data_1_suspended_cfg = {
1228 .func = GPIOMUX_FUNC_GPIO,
1229 .drv = GPIOMUX_DRV_2MA,
1230 .pull = GPIOMUX_PULL_UP,
1231};
1232
1233static struct msm_gpiomux_config apq8064_sdc2_configs[] __initdata = {
1234 {
1235 .gpio = 59,
1236 .settings = {
1237 [GPIOMUX_ACTIVE] = &sdc2_clk_active_cfg,
1238 [GPIOMUX_SUSPENDED] = &sdc2_suspended_cfg,
1239 },
1240 },
1241 {
1242 .gpio = 57,
1243 .settings = {
1244 [GPIOMUX_ACTIVE] = &sdc2_cmd_data_0_3_active_cfg,
1245 [GPIOMUX_SUSPENDED] = &sdc2_suspended_cfg,
1246 },
1247
1248 },
1249 {
1250 .gpio = 62,
1251 .settings = {
1252 [GPIOMUX_ACTIVE] = &sdc2_cmd_data_0_3_active_cfg,
1253 [GPIOMUX_SUSPENDED] = &sdc2_suspended_cfg,
1254 },
1255 },
1256 {
1257 .gpio = 61,
1258 .settings = {
1259 [GPIOMUX_ACTIVE] = &sdc2_cmd_data_0_3_active_cfg,
1260 [GPIOMUX_SUSPENDED] = &sdc2_data_1_suspended_cfg,
1261 },
1262 },
1263 {
1264 .gpio = 60,
1265 .settings = {
1266 [GPIOMUX_ACTIVE] = &sdc2_cmd_data_0_3_active_cfg,
1267 [GPIOMUX_SUSPENDED] = &sdc2_suspended_cfg,
1268 },
1269 },
1270 {
1271 .gpio = 58,
1272 .settings = {
1273 [GPIOMUX_ACTIVE] = &sdc2_cmd_data_0_3_active_cfg,
1274 [GPIOMUX_SUSPENDED] = &sdc2_suspended_cfg,
1275 },
1276 },
1277};
1278#endif
1279
1280
1281#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
1282static struct gpiomux_setting sdc4_clk_active_cfg = {
1283 .func = GPIOMUX_FUNC_2,
1284 .drv = GPIOMUX_DRV_8MA,
1285 .pull = GPIOMUX_PULL_NONE,
1286};
1287
1288static struct gpiomux_setting sdc4_cmd_data_0_3_active_cfg = {
1289 .func = GPIOMUX_FUNC_2,
1290 .drv = GPIOMUX_DRV_8MA,
1291 .pull = GPIOMUX_PULL_UP,
1292};
1293
1294static struct gpiomux_setting sdc4_suspended_cfg = {
1295 .func = GPIOMUX_FUNC_GPIO,
1296 .drv = GPIOMUX_DRV_2MA,
1297 .pull = GPIOMUX_PULL_DOWN,
1298};
1299
1300static struct gpiomux_setting sdc4_data_1_suspended_cfg = {
1301 .func = GPIOMUX_FUNC_GPIO,
1302 .drv = GPIOMUX_DRV_2MA,
1303 .pull = GPIOMUX_PULL_UP,
1304};
1305
1306static struct msm_gpiomux_config apq8064_sdc4_configs[] __initdata = {
1307 {
1308 .gpio = 68,
1309 .settings = {
1310 [GPIOMUX_ACTIVE] = &sdc4_clk_active_cfg,
1311 [GPIOMUX_SUSPENDED] = &sdc4_suspended_cfg,
1312 },
1313 },
1314 {
1315 .gpio = 67,
1316 .settings = {
1317 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_active_cfg,
1318 [GPIOMUX_SUSPENDED] = &sdc4_suspended_cfg,
1319 },
1320
1321 },
1322 {
1323 .gpio = 66,
1324 .settings = {
1325 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_active_cfg,
1326 [GPIOMUX_SUSPENDED] = &sdc4_suspended_cfg,
1327 },
1328 },
1329 {
1330 .gpio = 65,
1331 .settings = {
1332 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_active_cfg,
1333 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspended_cfg,
1334 },
1335 },
1336 {
1337 .gpio = 64,
1338 .settings = {
1339 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_active_cfg,
1340 [GPIOMUX_SUSPENDED] = &sdc4_suspended_cfg,
1341 },
1342 },
1343 {
1344 .gpio = 63,
1345 .settings = {
1346 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_active_cfg,
1347 [GPIOMUX_SUSPENDED] = &sdc4_suspended_cfg,
1348 },
1349 },
1350};
1351#endif
1352
Oluwafemi Adeyemi9aff26c2012-06-26 17:28:21 -07001353static struct gpiomux_setting apq8064_sdc3_card_det_cfg = {
1354 .func = GPIOMUX_FUNC_GPIO,
1355 .drv = GPIOMUX_DRV_2MA,
1356 .pull = GPIOMUX_PULL_UP,
1357};
1358
1359static struct msm_gpiomux_config apq8064_sdc3_configs[] __initdata = {
1360 {
1361 .gpio = 26,
1362 .settings = {
1363 [GPIOMUX_SUSPENDED] = &apq8064_sdc3_card_det_cfg,
1364 [GPIOMUX_ACTIVE] = &apq8064_sdc3_card_det_cfg,
1365 },
1366 },
1367};
1368
Joel King3166e892013-02-26 11:16:08 -08001369static struct msm_gpiomux_config sglte2_qsc_configs[] __initdata = {
1370 /* MDM2AP_STATUS */
1371 {
1372 .gpio = 51,
1373 .settings = {
1374 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
1375 }
1376 },
1377 /* MDM2AP_ERRFATAL */
1378 {
1379 .gpio = 52,
1380 .settings = {
1381 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
1382 }
1383 },
1384};
1385
Mayank Ranae98f1e42013-02-22 19:58:59 +05301386static struct gpiomux_setting gsbi4_uartdm_active = {
1387 .func = GPIOMUX_FUNC_1,
1388 .drv = GPIOMUX_DRV_8MA,
1389 .pull = GPIOMUX_PULL_NONE,
1390};
1391
1392static struct gpiomux_setting gsbi4_uartdm_suspended = {
1393 .func = GPIOMUX_FUNC_GPIO,
1394 .drv = GPIOMUX_DRV_2MA,
1395 .pull = GPIOMUX_PULL_DOWN,
1396};
1397
Mayank Rana33681af2012-05-10 15:14:00 -07001398static struct gpiomux_setting gsbi6_uartdm_active = {
1399 .func = GPIOMUX_FUNC_2,
1400 .drv = GPIOMUX_DRV_8MA,
1401 .pull = GPIOMUX_PULL_NONE,
1402};
1403
1404static struct gpiomux_setting gsbi6_uartdm_suspended = {
1405 .func = GPIOMUX_FUNC_GPIO,
1406 .drv = GPIOMUX_DRV_2MA,
1407 .pull = GPIOMUX_PULL_DOWN,
1408};
1409
Mayank Ranae98f1e42013-02-22 19:58:59 +05301410static struct msm_gpiomux_config apq8064_uartdm_gsbi4_configs[] __initdata = {
1411 {
1412 .gpio = 11, /* GSBI4 UARTDM RX */
1413 .settings = {
1414 [GPIOMUX_ACTIVE] = &gsbi4_uartdm_active,
1415 [GPIOMUX_SUSPENDED] = &gsbi4_uartdm_suspended,
1416 },
1417 },
1418 {
1419 .gpio = 10, /* GSBI4 UARTDM TX */
1420 .settings = {
1421 [GPIOMUX_ACTIVE] = &gsbi4_uartdm_active,
1422 [GPIOMUX_SUSPENDED] = &gsbi4_uartdm_suspended,
1423 },
1424 },
1425 {
1426 .gpio = 13, /* GSBI4 UARTDM RFR */
1427 .settings = {
1428 [GPIOMUX_ACTIVE] = &gsbi4_uartdm_active,
1429 [GPIOMUX_SUSPENDED] = &gsbi4_uartdm_suspended,
1430 },
1431 },
1432 {
1433 .gpio = 12, /* GSBI4 UARTDM CTS */
1434 .settings = {
1435 [GPIOMUX_ACTIVE] = &gsbi4_uartdm_active,
1436 [GPIOMUX_SUSPENDED] = &gsbi4_uartdm_suspended,
1437 },
1438 },
1439};
1440
Mayank Rana33681af2012-05-10 15:14:00 -07001441static struct msm_gpiomux_config mpq8064_uartdm_configs[] __initdata = {
1442 { /* UARTDM_TX */
1443 .gpio = 14,
1444 .settings = {
1445 [GPIOMUX_ACTIVE] = &gsbi6_uartdm_active,
1446 [GPIOMUX_SUSPENDED] = &gsbi6_uartdm_suspended,
1447 },
1448 },
1449 { /* UARTDM_RX */
1450 .gpio = 15,
1451 .settings = {
1452 [GPIOMUX_ACTIVE] = &gsbi6_uartdm_active,
1453 [GPIOMUX_SUSPENDED] = &gsbi6_uartdm_suspended,
1454 },
1455 },
1456 { /* UARTDM_CTS */
1457 .gpio = 16,
1458 .settings = {
1459 [GPIOMUX_ACTIVE] = &gsbi6_uartdm_active,
1460 [GPIOMUX_SUSPENDED] = &gsbi6_uartdm_suspended,
1461 },
1462 },
1463 { /* UARTDM_RFR */
1464 .gpio = 17,
1465 .settings = {
1466 [GPIOMUX_ACTIVE] = &gsbi6_uartdm_active,
1467 [GPIOMUX_SUSPENDED] = &gsbi6_uartdm_suspended,
1468 },
1469 },
1470};
1471
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001472void __init apq8064_init_gpiomux(void)
1473{
1474 int rc;
Amy Maloche609bb5e2012-08-03 09:41:42 -07001475 int platform_version = socinfo_get_platform_version();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001476
1477 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1478 if (rc) {
1479 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1480 return;
1481 }
1482
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001483 msm_gpiomux_install(wcnss_5wire_interface,
1484 ARRAY_SIZE(wcnss_5wire_interface));
1485
Joel King8f839b92012-04-01 14:37:46 -07001486 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
1487 machine_is_mpq8064_dtv()) {
1488 msm_gpiomux_install(mpq8064_gsbi5_i2c_configs,
1489 ARRAY_SIZE(mpq8064_gsbi5_i2c_configs));
Terence Hampson2e1705f2012-04-11 19:55:29 -04001490#ifdef CONFIG_MSM_VCAP
1491 msm_gpiomux_install(vcap_configs,
1492 ARRAY_SIZE(vcap_configs));
1493#endif
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05301494 msm_gpiomux_install(sx150x_int_configs,
1495 ARRAY_SIZE(sx150x_int_configs));
Joel King8f839b92012-04-01 14:37:46 -07001496 } else {
1497 #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
1498 msm_gpiomux_install(apq8064_ethernet_configs,
1499 ARRAY_SIZE(apq8064_ethernet_configs));
1500 #endif
1501
1502 msm_gpiomux_install(apq8064_gsbi_configs,
1503 ARRAY_SIZE(apq8064_gsbi_configs));
1504 }
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001505
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001506 msm_gpiomux_install(apq8064_slimbus_config,
1507 ARRAY_SIZE(apq8064_slimbus_config));
1508
1509 msm_gpiomux_install(apq8064_audio_codec_configs,
1510 ARRAY_SIZE(apq8064_audio_codec_configs));
1511
Santosh Mardieff9a742012-04-09 23:23:39 +05301512 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
1513 machine_is_mpq8064_dtv()) {
1514 msm_gpiomux_install(mpq8064_spkr_i2s_config,
1515 ARRAY_SIZE(mpq8064_spkr_i2s_config));
1516 }
1517
Swaminathan Sathappan9e07aa92012-02-29 12:07:27 -08001518 pr_debug("%s(): audio-auxpcm: Include GPIO configs"
1519 " as audio is not the primary user"
1520 " for these GPIO Pins\n", __func__);
David Collinsf0d00732012-01-25 15:46:50 -08001521
Kuirong Wangf23f8c52012-03-31 12:34:51 -07001522 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
1523 machine_is_mpq8064_dtv())
1524 msm_gpiomux_install(mpq8064_mi2s_configs,
1525 ARRAY_SIZE(mpq8064_mi2s_configs));
1526
David Collinsf0d00732012-01-25 15:46:50 -08001527 msm_gpiomux_install(apq8064_ext_regulator_configs,
1528 ARRAY_SIZE(apq8064_ext_regulator_configs));
Joel Kingdacbc822012-01-25 13:30:57 -08001529
Ameya Thakure155ece2012-07-09 12:08:37 -07001530 if (machine_is_apq8064_mtp()) {
Ameya Thakur2702baf2013-01-30 11:55:25 -08001531 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_DSDA2) {
1532 msm_gpiomux_install(amdm_configs,
1533 ARRAY_SIZE(amdm_configs));
1534 msm_gpiomux_install(bmdm_configs,
1535 ARRAY_SIZE(bmdm_configs));
Joel King3166e892013-02-26 11:16:08 -08001536 } else if (socinfo_get_platform_subtype() ==
1537 PLATFORM_SUBTYPE_SGLTE2) {
Ameya Thakure155ece2012-07-09 12:08:37 -07001538 msm_gpiomux_install(mdm_configs,
1539 ARRAY_SIZE(mdm_configs));
Joel King3166e892013-02-26 11:16:08 -08001540 msm_gpiomux_install(sglte2_qsc_configs,
1541 ARRAY_SIZE(sglte2_qsc_configs));
Mayank Ranae98f1e42013-02-22 19:58:59 +05301542
1543 /* GSBI4 UART GPIOs for Primary IPC */
1544 msm_gpiomux_install(apq8064_uartdm_gsbi4_configs,
1545 ARRAY_SIZE(apq8064_uartdm_gsbi4_configs));
Joel King3166e892013-02-26 11:16:08 -08001546 } else if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
1547 msm_gpiomux_install(mdm_i2s_configs,
1548 ARRAY_SIZE(mdm_i2s_configs));
1549 } else {
1550 msm_gpiomux_install(mdm_configs,
1551 ARRAY_SIZE(mdm_configs));
1552 }
Ameya Thakure155ece2012-07-09 12:08:37 -07001553 }
Hemant Kumara945b472012-01-25 15:08:06 -08001554
Amy Maloche609bb5e2012-08-03 09:41:42 -07001555 if (machine_is_apq8064_mtp()) {
1556 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
1557 msm_gpiomux_install(cyts_gpio_alt_config,
1558 ARRAY_SIZE(cyts_gpio_alt_config));
1559 } else {
1560 msm_gpiomux_install(cyts_gpio_configs,
1561 ARRAY_SIZE(cyts_gpio_configs));
1562 }
1563 }
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001564
Amy Maloche609bb5e2012-08-03 09:41:42 -07001565#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumarf1ca9192012-02-07 18:59:33 -08001566 if (machine_is_apq8064_mtp())
1567 msm_gpiomux_install(apq8064_hsic_configs,
1568 ARRAY_SIZE(apq8064_hsic_configs));
Hemant Kumara945b472012-01-25 15:08:06 -08001569#endif
Jing Lin21ed4de2012-02-05 15:53:28 -08001570
1571 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
1572 msm_gpiomux_install(apq8064_mxt_configs,
1573 ARRAY_SIZE(apq8064_mxt_configs));
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08001574
1575 msm_gpiomux_install(apq8064_hdmi_configs,
1576 ARRAY_SIZE(apq8064_hdmi_configs));
Ravi Kumar V05931a22012-04-04 17:09:37 +05301577
1578 if (machine_is_mpq8064_cdp())
1579 msm_gpiomux_install(mpq8064_ir_configs,
1580 ARRAY_SIZE(mpq8064_ir_configs));
Oluwafemi Adeyemia46d0322012-05-16 18:27:44 -07001581
1582#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1583 msm_gpiomux_install(apq8064_sdc2_configs,
1584 ARRAY_SIZE(apq8064_sdc2_configs));
1585#endif
1586
1587#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
1588 msm_gpiomux_install(apq8064_sdc4_configs,
1589 ARRAY_SIZE(apq8064_sdc4_configs));
1590#endif
Oluwafemi Adeyemi9aff26c2012-06-26 17:28:21 -07001591
1592 msm_gpiomux_install(apq8064_sdc3_configs,
1593 ARRAY_SIZE(apq8064_sdc3_configs));
Mayank Rana33681af2012-05-10 15:14:00 -07001594 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv())
1595 msm_gpiomux_install(mpq8064_uartdm_configs,
1596 ARRAY_SIZE(mpq8064_uartdm_configs));
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001597}