blob: eb99073dca4f170add6d9a02b5769c74553acf5d [file] [log] [blame]
Damir Didjusto93768d12013-01-17 11:30:47 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
Stepan Moskovchenko95108b82012-11-27 14:28:11 -080019#include <mach/socinfo.h>
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070020
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070021#define KS8851_IRQ_GPIO 94
Sathish Ambleye3154b42012-04-09 10:59:09 -070022
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070023static struct gpiomux_setting gpio_uart_config = {
24 .func = GPIOMUX_FUNC_2,
25 .drv = GPIOMUX_DRV_16MA,
26 .pull = GPIOMUX_PULL_NONE,
27 .dir = GPIOMUX_OUT_HIGH,
28};
29
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -060030static struct gpiomux_setting slimbus = {
31 .func = GPIOMUX_FUNC_1,
32 .drv = GPIOMUX_DRV_8MA,
33 .pull = GPIOMUX_PULL_KEEPER,
34};
35
Sathish Ambleye3154b42012-04-09 10:59:09 -070036#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
37static struct gpiomux_setting gpio_eth_config = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070038 .pull = GPIOMUX_PULL_UP,
39 .drv = GPIOMUX_DRV_2MA,
Sathish Ambleye3154b42012-04-09 10:59:09 -070040 .func = GPIOMUX_FUNC_GPIO,
41};
42
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070043static struct gpiomux_setting gpio_spi_cs2_config = {
Sathish Ambleye3154b42012-04-09 10:59:09 -070044 .func = GPIOMUX_FUNC_4,
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070045 .drv = GPIOMUX_DRV_6MA,
46 .pull = GPIOMUX_PULL_DOWN,
Sathish Ambleye3154b42012-04-09 10:59:09 -070047};
48
49static struct gpiomux_setting gpio_spi_config = {
50 .func = GPIOMUX_FUNC_1,
51 .drv = GPIOMUX_DRV_12MA,
52 .pull = GPIOMUX_PULL_NONE,
53};
54
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070055static struct gpiomux_setting gpio_spi_cs1_config = {
56 .func = GPIOMUX_FUNC_GPIO,
57 .drv = GPIOMUX_DRV_6MA,
58 .pull = GPIOMUX_PULL_UP,
59};
60
Sathish Ambleye3154b42012-04-09 10:59:09 -070061static struct msm_gpiomux_config msm_eth_configs[] = {
62 {
63 .gpio = KS8851_IRQ_GPIO,
64 .settings = {
65 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
66 }
67 },
68};
69#endif
Sameer Thalappil8d686d42012-08-24 10:07:31 -070070
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -080071static struct gpiomux_setting gpio_suspend_config[] = {
72 {
73 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
74 .drv = GPIOMUX_DRV_2MA,
75 .pull = GPIOMUX_PULL_NONE,
76 },
77 {
78 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
79 .drv = GPIOMUX_DRV_2MA,
80 .pull = GPIOMUX_PULL_NONE,
81 .dir = GPIOMUX_OUT_LOW,
82 },
83};
84
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -080085static struct gpiomux_setting gpio_epm_config = {
86 .func = GPIOMUX_FUNC_GPIO,
87 .drv = GPIOMUX_DRV_2MA,
88 .pull = GPIOMUX_PULL_DOWN,
89};
90
Sameer Thalappil8d686d42012-08-24 10:07:31 -070091static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
92 .func = GPIOMUX_FUNC_GPIO,
93 .drv = GPIOMUX_DRV_2MA,
94 .pull = GPIOMUX_PULL_UP,
95};
96
97static struct gpiomux_setting wcnss_5wire_active_cfg = {
98 .func = GPIOMUX_FUNC_1,
99 .drv = GPIOMUX_DRV_6MA,
100 .pull = GPIOMUX_PULL_DOWN,
101};
102
Jin Honga04caaa2012-05-23 10:28:27 -0700103static struct gpiomux_setting gpio_i2c_config = {
104 .func = GPIOMUX_FUNC_3,
Gilad Avidovb7d8bb12012-11-09 16:30:37 -0700105 /*
106 * Please keep I2C GPIOs drive-strength at minimum (2ma). It is a
107 * workaround for HW issue of glitches caused by rapid GPIO current-
108 * change.
109 */
110 .drv = GPIOMUX_DRV_2MA,
Jin Honga04caaa2012-05-23 10:28:27 -0700111 .pull = GPIOMUX_PULL_NONE,
112};
113
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700114static struct gpiomux_setting lcd_en_act_cfg = {
115 .func = GPIOMUX_FUNC_GPIO,
116 .drv = GPIOMUX_DRV_8MA,
117 .pull = GPIOMUX_PULL_NONE,
118};
119
120static struct gpiomux_setting lcd_en_sus_cfg = {
121 .func = GPIOMUX_FUNC_GPIO,
122 .drv = GPIOMUX_DRV_2MA,
123 .pull = GPIOMUX_PULL_DOWN,
124};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700125
Amy Maloche9e99a792012-08-15 23:27:51 -0700126static struct gpiomux_setting atmel_resout_sus_cfg = {
127 .func = GPIOMUX_FUNC_GPIO,
128 .drv = GPIOMUX_DRV_6MA,
129 .pull = GPIOMUX_PULL_DOWN,
130};
131
132static struct gpiomux_setting atmel_resout_act_cfg = {
133 .func = GPIOMUX_FUNC_GPIO,
134 .drv = GPIOMUX_DRV_6MA,
135 .pull = GPIOMUX_PULL_UP,
136};
137
138static struct gpiomux_setting atmel_int_act_cfg = {
139 .func = GPIOMUX_FUNC_GPIO,
140 .drv = GPIOMUX_DRV_8MA,
141 .pull = GPIOMUX_PULL_UP,
142};
143
144static struct gpiomux_setting atmel_int_sus_cfg = {
145 .func = GPIOMUX_FUNC_GPIO,
146 .drv = GPIOMUX_DRV_2MA,
147 .pull = GPIOMUX_PULL_DOWN,
148};
149
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700150static struct gpiomux_setting taiko_reset = {
151 .func = GPIOMUX_FUNC_GPIO,
152 .drv = GPIOMUX_DRV_6MA,
153 .pull = GPIOMUX_PULL_NONE,
154 .dir = GPIOMUX_OUT_LOW,
155};
156
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700157static struct gpiomux_setting taiko_int = {
158 .func = GPIOMUX_FUNC_GPIO,
159 .drv = GPIOMUX_DRV_2MA,
160 .pull = GPIOMUX_PULL_NONE,
161};
Amy Maloche527acc42012-12-07 18:40:54 -0800162static struct gpiomux_setting hap_lvl_shft_suspended_config = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_2MA,
165 .pull = GPIOMUX_PULL_DOWN,
166};
167
168static struct gpiomux_setting hap_lvl_shft_active_config = {
169 .func = GPIOMUX_FUNC_GPIO,
170 .drv = GPIOMUX_DRV_8MA,
171 .pull = GPIOMUX_PULL_UP,
172};
173static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
174 {
175 .gpio = 86,
176 .settings = {
177 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
178 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
179 },
180 },
181};
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700182
Amy Maloche9e99a792012-08-15 23:27:51 -0700183static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
184 {
185 .gpio = 60, /* TOUCH RESET */
186 .settings = {
187 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
188 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
189 },
190 },
191 {
192 .gpio = 61, /* TOUCH IRQ */
193 .settings = {
194 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
195 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
196 },
197 },
198
199};
Ujwal Patel74b5df42012-08-13 22:50:13 -0700200
Manu Gautamac7265b2012-11-21 11:49:15 +0530201static struct gpiomux_setting hsic_sus_cfg = {
202 .func = GPIOMUX_FUNC_GPIO,
203 .drv = GPIOMUX_DRV_2MA,
204 .pull = GPIOMUX_PULL_DOWN,
205 .dir = GPIOMUX_OUT_LOW,
206};
207
208static struct gpiomux_setting hsic_act_cfg = {
209 .func = GPIOMUX_FUNC_1,
210 .drv = GPIOMUX_DRV_12MA,
211 .pull = GPIOMUX_PULL_NONE,
212};
213
214static struct gpiomux_setting hsic_hub_act_cfg = {
215 .func = GPIOMUX_FUNC_GPIO,
216 .drv = GPIOMUX_DRV_2MA,
217 .pull = GPIOMUX_PULL_UP,
218 .dir = GPIOMUX_IN,
219};
220
221static struct msm_gpiomux_config msm_hsic_configs[] = {
222 {
223 .gpio = 144, /*HSIC_STROBE */
224 .settings = {
225 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
226 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
227 },
228 },
229 {
230 .gpio = 145, /* HSIC_DATA */
231 .settings = {
232 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
233 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
234 },
235 },
236};
237
238static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
239 {
240 .gpio = 50, /* HSIC_HUB_INT_N */
241 .settings = {
242 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
243 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
244 },
245 },
246};
247
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700248static struct gpiomux_setting mhl_suspend_config = {
249 .func = GPIOMUX_FUNC_GPIO,
250 .drv = GPIOMUX_DRV_2MA,
251 .pull = GPIOMUX_PULL_DOWN,
252};
253
254static struct gpiomux_setting mhl_active_1_cfg = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_2MA,
257 .pull = GPIOMUX_PULL_UP,
258 .dir = GPIOMUX_OUT_HIGH,
259};
260
261static struct gpiomux_setting mhl_active_2_cfg = {
262 .func = GPIOMUX_FUNC_1,
263 .drv = GPIOMUX_DRV_2MA,
264 .pull = GPIOMUX_PULL_UP,
265};
266
Ujwal Patel74b5df42012-08-13 22:50:13 -0700267static struct gpiomux_setting hdmi_suspend_cfg = {
268 .func = GPIOMUX_FUNC_GPIO,
269 .drv = GPIOMUX_DRV_2MA,
270 .pull = GPIOMUX_PULL_DOWN,
271};
272
273static struct gpiomux_setting hdmi_active_1_cfg = {
274 .func = GPIOMUX_FUNC_1,
275 .drv = GPIOMUX_DRV_2MA,
276 .pull = GPIOMUX_PULL_UP,
277};
278
279static struct gpiomux_setting hdmi_active_2_cfg = {
280 .func = GPIOMUX_FUNC_1,
281 .drv = GPIOMUX_DRV_16MA,
282 .pull = GPIOMUX_PULL_DOWN,
283};
284
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700285static struct msm_gpiomux_config msm_mhl_configs[] __initdata = {
286 {
287 /* mhl-sii8334 pwr */
288 .gpio = 12,
289 .settings = {
290 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
291 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
292 },
293 },
294 {
295 /* mhl-sii8334 intr */
296 .gpio = 82,
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
299 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
300 },
301 },
302 {
303 /* mhl-sii8334 reset */
304 .gpio = 8,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
307 [GPIOMUX_ACTIVE] = &mhl_active_2_cfg,
308 },
309 },
310};
311
312
Ujwal Patel74b5df42012-08-13 22:50:13 -0700313static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
314 {
315 .gpio = 31,
316 .settings = {
317 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
318 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
319 },
320 },
321 {
322 .gpio = 32,
323 .settings = {
324 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
325 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
326 },
327 },
328 {
329 .gpio = 33,
330 .settings = {
331 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
332 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
333 },
334 },
335 {
336 .gpio = 34,
337 .settings = {
338 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
339 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
340 },
341 },
342};
343
Saket Saurabheac58342013-02-05 12:20:18 +0530344static struct gpiomux_setting gpio_uart7_active_cfg = {
345 .func = GPIOMUX_FUNC_3,
346 .drv = GPIOMUX_DRV_8MA,
347 .pull = GPIOMUX_PULL_NONE,
348};
349
350static struct gpiomux_setting gpio_uart7_suspend_cfg = {
351 .func = GPIOMUX_FUNC_GPIO,
352 .drv = GPIOMUX_DRV_2MA,
353 .pull = GPIOMUX_PULL_DOWN,
354};
355
356static struct msm_gpiomux_config msm_blsp2_uart7_configs[] __initdata = {
357 {
358 .gpio = 41, /* BLSP2 UART7 TX */
359 .settings = {
360 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
361 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
362 },
363 },
364 {
365 .gpio = 42, /* BLSP2 UART7 RX */
366 .settings = {
367 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
368 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
369 },
370 },
371 {
372 .gpio = 43, /* BLSP2 UART7 CTS */
373 .settings = {
374 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
375 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
376 },
377 },
378 {
379 .gpio = 44, /* BLSP2 UART7 RFR */
380 .settings = {
381 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
382 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
383 },
384 },
385};
386
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800387static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
388 {
389 .gpio = 45, /* BLSP2 UART8 TX */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
392 },
393 },
394 {
395 .gpio = 46, /* BLSP2 UART8 RX */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
398 },
399 },
400};
401
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700402static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700403#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
404 {
405 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
406 .settings = {
407 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
408 },
409 },
410 {
411 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
414 },
415 },
416 {
417 .gpio = 3, /* BLSP1 QUP SPI_CLK */
418 .settings = {
419 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
420 },
421 },
422 {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700423 .gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
Sathish Ambleye3154b42012-04-09 10:59:09 -0700424 .settings = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700425 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
426 },
427 },
428 {
429 .gpio = 8, /* BLSP1 QUP SPI_CS1_N */
430 .settings = {
431 [GPIOMUX_SUSPENDED] = &gpio_spi_cs1_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700432 },
433 },
434#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700435 {
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700436 .gpio = 58,
437 .settings = {
438 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
439 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
440 },
441 },
442 {
Amy Malochebc7e9672012-08-15 10:30:40 -0700443 .gpio = 6, /* BLSP1 QUP2 I2C_DAT */
444 .settings = {
445 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
446 },
447 },
448 {
449 .gpio = 7, /* BLSP1 QUP2 I2C_CLK */
450 .settings = {
451 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
452 },
453 },
454 {
Jin Honga04caaa2012-05-23 10:28:27 -0700455 .gpio = 83, /* BLSP11 QUP I2C_DAT */
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
458 },
459 },
460 {
461 .gpio = 84, /* BLSP11 QUP I2C_CLK */
462 .settings = {
463 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
464 },
465 },
466 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700467 .gpio = 4, /* BLSP2 UART TX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700468 .settings = {
469 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
470 },
471 },
472 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700473 .gpio = 5, /* BLSP2 UART RX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700474 .settings = {
475 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
476 },
477 },
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600478 {
479 .gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
480 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800481 [GPIOMUX_ACTIVE] = &gpio_spi_config,
482 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600483 },
484 },
485 {
486 .gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
487 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800488 [GPIOMUX_ACTIVE] = &gpio_spi_config,
489 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600490 },
491 },
492 {
493 .gpio = 56, /* BLSP2 QUP4 SPI_CLK */
494 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800495 [GPIOMUX_ACTIVE] = &gpio_spi_config,
496 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600497 },
498 },
499 {
500 .gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
501 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800502 [GPIOMUX_ACTIVE] = &gpio_spi_config,
503 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600504 },
505 },
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800506 {
507 .gpio = 81, /* EPM enable */
508 .settings = {
509 [GPIOMUX_SUSPENDED] = &gpio_epm_config,
510 },
511 },
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700512};
513
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600514static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
515 {
516 .gpio = 70, /* slimbus clk */
517 .settings = {
518 [GPIOMUX_SUSPENDED] = &slimbus,
519 },
520 },
521 {
522 .gpio = 71, /* slimbus data */
523 .settings = {
524 [GPIOMUX_SUSPENDED] = &slimbus,
525 },
526 },
527};
528
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700529static struct gpiomux_setting cam_settings[] = {
530 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700531 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700532 .drv = GPIOMUX_DRV_2MA,
533 .pull = GPIOMUX_PULL_NONE,
534 },
535
536 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700537 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700538 .drv = GPIOMUX_DRV_2MA,
539 .pull = GPIOMUX_PULL_DOWN,
540 },
541
542 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700543 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700544 .drv = GPIOMUX_DRV_2MA,
545 .pull = GPIOMUX_PULL_KEEPER,
546 },
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700547
548 {
549 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
550 .drv = GPIOMUX_DRV_2MA,
551 .pull = GPIOMUX_PULL_NONE,
552 },
553
554 {
555 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
556 .drv = GPIOMUX_DRV_2MA,
557 .pull = GPIOMUX_PULL_DOWN,
558 },
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700559};
560
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530561static struct gpiomux_setting sd_card_det_active_config = {
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530562 .func = GPIOMUX_FUNC_GPIO,
563 .drv = GPIOMUX_DRV_2MA,
564 .pull = GPIOMUX_PULL_NONE,
565 .dir = GPIOMUX_IN,
566};
567
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530568static struct gpiomux_setting sd_card_det_sleep_config = {
569 .func = GPIOMUX_FUNC_GPIO,
570 .drv = GPIOMUX_DRV_2MA,
571 .pull = GPIOMUX_PULL_UP,
572 .dir = GPIOMUX_IN,
573};
574
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530575static struct msm_gpiomux_config sd_card_det __initdata = {
576 .gpio = 62,
577 .settings = {
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530578 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
579 [GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530580 },
581};
582
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700583static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
584 {
585 .gpio = 15, /* CAM_MCLK0 */
586 .settings = {
587 [GPIOMUX_ACTIVE] = &cam_settings[0],
588 [GPIOMUX_SUSPENDED] = &cam_settings[1],
589 },
590 },
591 {
592 .gpio = 16, /* CAM_MCLK1 */
593 .settings = {
594 [GPIOMUX_ACTIVE] = &cam_settings[0],
595 [GPIOMUX_SUSPENDED] = &cam_settings[1],
596 },
597 },
598 {
599 .gpio = 17, /* CAM_MCLK2 */
600 .settings = {
601 [GPIOMUX_ACTIVE] = &cam_settings[0],
602 [GPIOMUX_SUSPENDED] = &cam_settings[1],
603 },
604 },
605 {
606 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
607 .settings = {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700608 [GPIOMUX_ACTIVE] = &cam_settings[3],
609 [GPIOMUX_SUSPENDED] = &cam_settings[4],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700610 },
611 },
612 {
613 .gpio = 19, /* CCI_I2C_SDA0 */
614 .settings = {
615 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800616 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700617 },
618 },
619 {
620 .gpio = 20, /* CCI_I2C_SCL0 */
621 .settings = {
622 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800623 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700624 },
625 },
626 {
627 .gpio = 21, /* CCI_I2C_SDA1 */
628 .settings = {
629 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800630 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700631 },
632 },
633 {
634 .gpio = 22, /* CCI_I2C_SCL1 */
635 .settings = {
636 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800637 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700638 },
639 },
640 {
641 .gpio = 23, /* FLASH_LED_EN */
642 .settings = {
643 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800644 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700645 },
646 },
647 {
648 .gpio = 24, /* FLASH_LED_NOW */
649 .settings = {
650 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800651 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700652 },
653 },
654 {
655 .gpio = 25, /* WEBCAM2_RESET_N */
656 .settings = {
657 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800658 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700659 },
660 },
661 {
662 .gpio = 26, /* CAM_IRQ */
663 .settings = {
664 [GPIOMUX_ACTIVE] = &cam_settings[0],
665 [GPIOMUX_SUSPENDED] = &cam_settings[1],
666 },
667 },
668 {
669 .gpio = 27, /* OIS_SYNC */
670 .settings = {
671 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800672 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700673 },
674 },
675 {
676 .gpio = 28, /* WEBCAM1_STANDBY */
677 .settings = {
678 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800679 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700680 },
681 },
682 {
683 .gpio = 89, /* CAM1_STANDBY_N */
684 .settings = {
685 [GPIOMUX_ACTIVE] = &cam_settings[0],
686 [GPIOMUX_SUSPENDED] = &cam_settings[1],
687 },
688 },
689 {
690 .gpio = 90, /* CAM1_RST_N */
691 .settings = {
692 [GPIOMUX_ACTIVE] = &cam_settings[0],
693 [GPIOMUX_SUSPENDED] = &cam_settings[1],
694 },
695 },
696 {
697 .gpio = 91, /* CAM2_STANDBY_N */
698 .settings = {
699 [GPIOMUX_ACTIVE] = &cam_settings[0],
700 [GPIOMUX_SUSPENDED] = &cam_settings[1],
701 },
702 },
703 {
704 .gpio = 92, /* CAM2_RST_N */
705 .settings = {
706 [GPIOMUX_ACTIVE] = &cam_settings[0],
707 [GPIOMUX_SUSPENDED] = &cam_settings[1],
708 },
709 },
710};
Damir Didjusto04d3c362013-01-07 14:30:53 -0800711
712static struct gpiomux_setting pri_auxpcm_act_cfg = {
713 .func = GPIOMUX_FUNC_1,
714 .drv = GPIOMUX_DRV_8MA,
715 .pull = GPIOMUX_PULL_NONE,
716};
717
718
719static struct gpiomux_setting pri_auxpcm_sus_cfg = {
720 .func = GPIOMUX_FUNC_1,
721 .drv = GPIOMUX_DRV_2MA,
722 .pull = GPIOMUX_PULL_DOWN,
723};
724
725static struct msm_gpiomux_config msm8974_pri_auxpcm_configs[] __initdata = {
726 {
727 .gpio = 65,
728 .settings = {
729 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
730 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
731 },
732 },
733 {
734 .gpio = 66,
735 .settings = {
736 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
737 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
738 },
739 },
740 {
741 .gpio = 67,
742 .settings = {
743 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
744 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
745 },
746 },
747 {
748 .gpio = 68,
749 .settings = {
750 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
751 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
752 },
753 },
754};
755
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700756static struct msm_gpiomux_config wcnss_5wire_interface[] = {
757 {
758 .gpio = 36,
759 .settings = {
760 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
761 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
762 },
763 },
764 {
765 .gpio = 37,
766 .settings = {
767 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
768 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
769 },
770 },
771 {
772 .gpio = 38,
773 .settings = {
774 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
775 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
776 },
777 },
778 {
779 .gpio = 39,
780 .settings = {
781 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
782 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
783 },
784 },
785 {
786 .gpio = 40,
787 .settings = {
788 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
789 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
790 },
791 },
792};
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700793
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700794static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
795 {
796 .gpio = 63, /* SYS_RST_N */
797 .settings = {
798 [GPIOMUX_SUSPENDED] = &taiko_reset,
799 },
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700800 },
801 {
802 .gpio = 72, /* CDC_INT */
803 .settings = {
804 [GPIOMUX_SUSPENDED] = &taiko_int,
805 },
806 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700807};
808
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530809#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
810static struct gpiomux_setting sdc3_clk_actv_cfg = {
811 .func = GPIOMUX_FUNC_2,
812 .drv = GPIOMUX_DRV_8MA,
813 .pull = GPIOMUX_PULL_NONE,
814};
815
816static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
817 .func = GPIOMUX_FUNC_2,
818 .drv = GPIOMUX_DRV_8MA,
819 .pull = GPIOMUX_PULL_UP,
820};
821
822static struct gpiomux_setting sdc3_suspend_cfg = {
823 .func = GPIOMUX_FUNC_GPIO,
824 .drv = GPIOMUX_DRV_2MA,
825 .pull = GPIOMUX_PULL_DOWN,
826};
827
828static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
829 .func = GPIOMUX_FUNC_GPIO,
830 .drv = GPIOMUX_DRV_8MA,
831 .pull = GPIOMUX_PULL_UP,
832};
833
834static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
835 {
836 /* DAT3 */
837 .gpio = 35,
838 .settings = {
839 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
840 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
841 },
842 },
843 {
844 /* DAT2 */
845 .gpio = 36,
846 .settings = {
847 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
848 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
849 },
850 },
851 {
852 /* DAT1 */
853 .gpio = 37,
854 .settings = {
855 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
856 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
857 },
858 },
859 {
860 /* DAT0 */
861 .gpio = 38,
862 .settings = {
863 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
864 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
865 },
866 },
867 {
868 /* CMD */
869 .gpio = 39,
870 .settings = {
871 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
872 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
873 },
874 },
875 {
876 /* CLK */
877 .gpio = 40,
878 .settings = {
879 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
880 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
881 },
882 },
883};
884
885static void msm_gpiomux_sdc3_install(void)
886{
887 msm_gpiomux_install(msm8974_sdc3_configs,
888 ARRAY_SIZE(msm8974_sdc3_configs));
889}
890#else
891static void msm_gpiomux_sdc3_install(void) {}
892#endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
893
894#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
895static struct gpiomux_setting sdc4_clk_actv_cfg = {
896 .func = GPIOMUX_FUNC_2,
897 .drv = GPIOMUX_DRV_8MA,
898 .pull = GPIOMUX_PULL_NONE,
899};
900
901static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
902 .func = GPIOMUX_FUNC_2,
903 .drv = GPIOMUX_DRV_8MA,
904 .pull = GPIOMUX_PULL_UP,
905};
906
907static struct gpiomux_setting sdc4_suspend_cfg = {
908 .func = GPIOMUX_FUNC_GPIO,
909 .drv = GPIOMUX_DRV_2MA,
910 .pull = GPIOMUX_PULL_DOWN,
911};
912
913static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
914 .func = GPIOMUX_FUNC_GPIO,
915 .drv = GPIOMUX_DRV_8MA,
916 .pull = GPIOMUX_PULL_UP,
917};
918
919static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
920 {
921 /* DAT3 */
922 .gpio = 92,
923 .settings = {
924 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
925 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
926 },
927 },
928 {
929 /* DAT2 */
930 .gpio = 94,
931 .settings = {
932 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
933 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
934 },
935 },
936 {
937 /* DAT1 */
938 .gpio = 95,
939 .settings = {
940 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
941 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
942 },
943 },
944 {
945 /* DAT0 */
946 .gpio = 96,
947 .settings = {
948 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
949 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
950 },
951 },
952 {
953 /* CMD */
954 .gpio = 91,
955 .settings = {
956 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
957 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
958 },
959 },
960 {
961 /* CLK */
962 .gpio = 93,
963 .settings = {
964 [GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
965 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
966 },
967 },
968};
969
970static void msm_gpiomux_sdc4_install(void)
971{
972 msm_gpiomux_install(msm8974_sdc4_configs,
973 ARRAY_SIZE(msm8974_sdc4_configs));
974}
975#else
976static void msm_gpiomux_sdc4_install(void) {}
977#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
978
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700979void __init msm_8974_init_gpiomux(void)
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700980{
981 int rc;
982
Rohit Vaswani341c2032012-11-08 18:49:29 -0800983 rc = msm_gpiomux_init_dt();
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700984 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800985 pr_err("%s failed %d\n", __func__, rc);
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700986 return;
987 }
988
Sathish Ambleye3154b42012-04-09 10:59:09 -0700989#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
990 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
991#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700992 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Saket Saurabheac58342013-02-05 12:20:18 +0530993 msm_gpiomux_install(msm_blsp2_uart7_configs,
994 ARRAY_SIZE(msm_blsp2_uart7_configs));
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700995 msm_gpiomux_install(wcnss_5wire_interface,
996 ARRAY_SIZE(wcnss_5wire_interface));
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600997
998 msm_gpiomux_install(msm8974_slimbus_config,
999 ARRAY_SIZE(msm8974_slimbus_config));
1000
Amy Maloche9e99a792012-08-15 23:27:51 -07001001 msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
Amy Maloche527acc42012-12-07 18:40:54 -08001002 msm_gpiomux_install(hap_lvl_shft_config,
1003 ARRAY_SIZE(hap_lvl_shft_config));
Kevin Chanbdcf7ef2012-08-24 08:33:33 -07001004
1005 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001006
Subhash Jadavani76aa7de2012-10-10 09:58:17 +05301007 msm_gpiomux_install(&sd_card_det, 1);
Subhash Jadavani102f0ce2012-12-14 21:25:59 +05301008 msm_gpiomux_sdc3_install();
1009 msm_gpiomux_sdc4_install();
Subhash Jadavani76aa7de2012-10-10 09:58:17 +05301010
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001011 msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
Ujwal Patel74b5df42012-08-13 22:50:13 -07001012
Manu Gautamac7265b2012-11-21 11:49:15 +05301013 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
1014 msm_gpiomux_install(msm_hsic_hub_configs,
1015 ARRAY_SIZE(msm_hsic_hub_configs));
1016
Ujwal Patel74b5df42012-08-13 22:50:13 -07001017 msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
Stepan Moskovchenkoebd05412013-02-07 20:39:56 -08001018 if (machine_is_msm8974_fluid())
1019 msm_gpiomux_install(msm_mhl_configs,
1020 ARRAY_SIZE(msm_mhl_configs));
Stepan Moskovchenko95108b82012-11-27 14:28:11 -08001021
Damir Didjusto04d3c362013-01-07 14:30:53 -08001022 msm_gpiomux_install(msm8974_pri_auxpcm_configs,
1023 ARRAY_SIZE(msm8974_pri_auxpcm_configs));
1024
Stepan Moskovchenko95108b82012-11-27 14:28:11 -08001025 if (machine_is_msm8974_rumi())
1026 msm_gpiomux_install(msm_rumi_blsp_configs,
1027 ARRAY_SIZE(msm_rumi_blsp_configs));
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001028}