blob: 5240f380a9d70c8d95ba35cf71bed111c2d3d392 [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,
Siddhartha Agrawal6ab3e1c2013-02-22 18:30:37 -0800118 .dir = GPIOMUX_OUT_HIGH,
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700119};
120
121static struct gpiomux_setting lcd_en_sus_cfg = {
122 .func = GPIOMUX_FUNC_GPIO,
123 .drv = GPIOMUX_DRV_2MA,
124 .pull = GPIOMUX_PULL_DOWN,
125};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700126
Amy Maloche9e99a792012-08-15 23:27:51 -0700127static struct gpiomux_setting atmel_resout_sus_cfg = {
128 .func = GPIOMUX_FUNC_GPIO,
129 .drv = GPIOMUX_DRV_6MA,
130 .pull = GPIOMUX_PULL_DOWN,
131};
132
133static struct gpiomux_setting atmel_resout_act_cfg = {
134 .func = GPIOMUX_FUNC_GPIO,
135 .drv = GPIOMUX_DRV_6MA,
136 .pull = GPIOMUX_PULL_UP,
137};
138
139static struct gpiomux_setting atmel_int_act_cfg = {
140 .func = GPIOMUX_FUNC_GPIO,
141 .drv = GPIOMUX_DRV_8MA,
142 .pull = GPIOMUX_PULL_UP,
143};
144
145static struct gpiomux_setting atmel_int_sus_cfg = {
146 .func = GPIOMUX_FUNC_GPIO,
147 .drv = GPIOMUX_DRV_2MA,
148 .pull = GPIOMUX_PULL_DOWN,
149};
150
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700151static struct gpiomux_setting taiko_reset = {
152 .func = GPIOMUX_FUNC_GPIO,
153 .drv = GPIOMUX_DRV_6MA,
154 .pull = GPIOMUX_PULL_NONE,
155 .dir = GPIOMUX_OUT_LOW,
156};
157
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700158static struct gpiomux_setting taiko_int = {
159 .func = GPIOMUX_FUNC_GPIO,
160 .drv = GPIOMUX_DRV_2MA,
161 .pull = GPIOMUX_PULL_NONE,
162};
Amy Maloche527acc42012-12-07 18:40:54 -0800163static struct gpiomux_setting hap_lvl_shft_suspended_config = {
164 .func = GPIOMUX_FUNC_GPIO,
165 .drv = GPIOMUX_DRV_2MA,
166 .pull = GPIOMUX_PULL_DOWN,
167};
168
169static struct gpiomux_setting hap_lvl_shft_active_config = {
170 .func = GPIOMUX_FUNC_GPIO,
171 .drv = GPIOMUX_DRV_8MA,
172 .pull = GPIOMUX_PULL_UP,
173};
174static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
175 {
176 .gpio = 86,
177 .settings = {
178 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
179 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
180 },
181 },
182};
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700183
Amy Maloche9e99a792012-08-15 23:27:51 -0700184static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
185 {
186 .gpio = 60, /* TOUCH RESET */
187 .settings = {
188 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
189 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
190 },
191 },
192 {
193 .gpio = 61, /* TOUCH IRQ */
194 .settings = {
195 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
196 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
197 },
198 },
199
200};
Ujwal Patel74b5df42012-08-13 22:50:13 -0700201
Manu Gautamac7265b2012-11-21 11:49:15 +0530202static struct gpiomux_setting hsic_sus_cfg = {
203 .func = GPIOMUX_FUNC_GPIO,
204 .drv = GPIOMUX_DRV_2MA,
205 .pull = GPIOMUX_PULL_DOWN,
206 .dir = GPIOMUX_OUT_LOW,
207};
208
209static struct gpiomux_setting hsic_act_cfg = {
210 .func = GPIOMUX_FUNC_1,
211 .drv = GPIOMUX_DRV_12MA,
212 .pull = GPIOMUX_PULL_NONE,
213};
214
215static struct gpiomux_setting hsic_hub_act_cfg = {
216 .func = GPIOMUX_FUNC_GPIO,
217 .drv = GPIOMUX_DRV_2MA,
218 .pull = GPIOMUX_PULL_UP,
219 .dir = GPIOMUX_IN,
220};
221
222static struct msm_gpiomux_config msm_hsic_configs[] = {
223 {
224 .gpio = 144, /*HSIC_STROBE */
225 .settings = {
226 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
227 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
228 },
229 },
230 {
231 .gpio = 145, /* HSIC_DATA */
232 .settings = {
233 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
234 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
235 },
236 },
237};
238
239static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
240 {
241 .gpio = 50, /* HSIC_HUB_INT_N */
242 .settings = {
243 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
244 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
245 },
246 },
247};
248
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700249static struct gpiomux_setting mhl_suspend_config = {
250 .func = GPIOMUX_FUNC_GPIO,
251 .drv = GPIOMUX_DRV_2MA,
252 .pull = GPIOMUX_PULL_DOWN,
253};
254
255static struct gpiomux_setting mhl_active_1_cfg = {
256 .func = GPIOMUX_FUNC_1,
257 .drv = GPIOMUX_DRV_2MA,
258 .pull = GPIOMUX_PULL_UP,
259 .dir = GPIOMUX_OUT_HIGH,
260};
261
Ujwal Patel74b5df42012-08-13 22:50:13 -0700262static struct gpiomux_setting hdmi_suspend_cfg = {
263 .func = GPIOMUX_FUNC_GPIO,
264 .drv = GPIOMUX_DRV_2MA,
265 .pull = GPIOMUX_PULL_DOWN,
266};
267
268static struct gpiomux_setting hdmi_active_1_cfg = {
269 .func = GPIOMUX_FUNC_1,
270 .drv = GPIOMUX_DRV_2MA,
271 .pull = GPIOMUX_PULL_UP,
272};
273
274static struct gpiomux_setting hdmi_active_2_cfg = {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_16MA,
277 .pull = GPIOMUX_PULL_DOWN,
278};
279
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700280static struct msm_gpiomux_config msm_mhl_configs[] __initdata = {
281 {
282 /* mhl-sii8334 pwr */
283 .gpio = 12,
284 .settings = {
285 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
286 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
287 },
288 },
289 {
290 /* mhl-sii8334 intr */
291 .gpio = 82,
292 .settings = {
293 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
294 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
295 },
296 },
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700297};
298
299
Ujwal Patel74b5df42012-08-13 22:50:13 -0700300static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
301 {
302 .gpio = 31,
303 .settings = {
304 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
305 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
306 },
307 },
308 {
309 .gpio = 32,
310 .settings = {
311 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
312 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
313 },
314 },
315 {
316 .gpio = 33,
317 .settings = {
318 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
319 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
320 },
321 },
322 {
323 .gpio = 34,
324 .settings = {
325 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
326 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
327 },
328 },
329};
330
Saket Saurabheac58342013-02-05 12:20:18 +0530331static struct gpiomux_setting gpio_uart7_active_cfg = {
332 .func = GPIOMUX_FUNC_3,
333 .drv = GPIOMUX_DRV_8MA,
334 .pull = GPIOMUX_PULL_NONE,
335};
336
337static struct gpiomux_setting gpio_uart7_suspend_cfg = {
338 .func = GPIOMUX_FUNC_GPIO,
339 .drv = GPIOMUX_DRV_2MA,
340 .pull = GPIOMUX_PULL_DOWN,
341};
342
343static struct msm_gpiomux_config msm_blsp2_uart7_configs[] __initdata = {
344 {
345 .gpio = 41, /* BLSP2 UART7 TX */
346 .settings = {
347 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
348 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
349 },
350 },
351 {
352 .gpio = 42, /* BLSP2 UART7 RX */
353 .settings = {
354 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
355 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
356 },
357 },
358 {
359 .gpio = 43, /* BLSP2 UART7 CTS */
360 .settings = {
361 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
362 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
363 },
364 },
365 {
366 .gpio = 44, /* BLSP2 UART7 RFR */
367 .settings = {
368 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
369 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
370 },
371 },
372};
373
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800374static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
375 {
376 .gpio = 45, /* BLSP2 UART8 TX */
377 .settings = {
378 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
379 },
380 },
381 {
382 .gpio = 46, /* BLSP2 UART8 RX */
383 .settings = {
384 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
385 },
386 },
387};
388
Siddhartha Agrawal6ab3e1c2013-02-22 18:30:37 -0800389static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
390 {
391 .gpio = 58,
392 .settings = {
393 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
394 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
395 },
396 },
397};
398
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700399static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700400#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
401 {
402 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
405 },
406 },
407 {
408 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
411 },
412 },
413 {
414 .gpio = 3, /* BLSP1 QUP SPI_CLK */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
417 },
418 },
419 {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700420 .gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
Sathish Ambleye3154b42012-04-09 10:59:09 -0700421 .settings = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700422 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
423 },
424 },
425 {
426 .gpio = 8, /* BLSP1 QUP SPI_CS1_N */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &gpio_spi_cs1_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700429 },
430 },
431#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700432 {
Amy Malochebc7e9672012-08-15 10:30:40 -0700433 .gpio = 6, /* BLSP1 QUP2 I2C_DAT */
434 .settings = {
435 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
436 },
437 },
438 {
439 .gpio = 7, /* BLSP1 QUP2 I2C_CLK */
440 .settings = {
441 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
442 },
443 },
444 {
Jin Honga04caaa2012-05-23 10:28:27 -0700445 .gpio = 83, /* BLSP11 QUP I2C_DAT */
446 .settings = {
447 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
448 },
449 },
450 {
451 .gpio = 84, /* BLSP11 QUP I2C_CLK */
452 .settings = {
453 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
454 },
455 },
456 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700457 .gpio = 4, /* BLSP2 UART TX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700458 .settings = {
459 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
460 },
461 },
462 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700463 .gpio = 5, /* BLSP2 UART RX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700464 .settings = {
465 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
466 },
467 },
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600468 {
469 .gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
470 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800471 [GPIOMUX_ACTIVE] = &gpio_spi_config,
472 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600473 },
474 },
475 {
476 .gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
477 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800478 [GPIOMUX_ACTIVE] = &gpio_spi_config,
479 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600480 },
481 },
482 {
483 .gpio = 56, /* BLSP2 QUP4 SPI_CLK */
484 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800485 [GPIOMUX_ACTIVE] = &gpio_spi_config,
486 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600487 },
488 },
489 {
490 .gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
491 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800492 [GPIOMUX_ACTIVE] = &gpio_spi_config,
493 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600494 },
495 },
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800496 {
497 .gpio = 81, /* EPM enable */
498 .settings = {
499 [GPIOMUX_SUSPENDED] = &gpio_epm_config,
500 },
501 },
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700502};
503
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600504static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
505 {
506 .gpio = 70, /* slimbus clk */
507 .settings = {
508 [GPIOMUX_SUSPENDED] = &slimbus,
509 },
510 },
511 {
512 .gpio = 71, /* slimbus data */
513 .settings = {
514 [GPIOMUX_SUSPENDED] = &slimbus,
515 },
516 },
517};
518
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700519static struct gpiomux_setting cam_settings[] = {
520 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700521 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700522 .drv = GPIOMUX_DRV_2MA,
523 .pull = GPIOMUX_PULL_NONE,
524 },
525
526 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700527 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700528 .drv = GPIOMUX_DRV_2MA,
529 .pull = GPIOMUX_PULL_DOWN,
530 },
531
532 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700533 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700534 .drv = GPIOMUX_DRV_2MA,
535 .pull = GPIOMUX_PULL_KEEPER,
536 },
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700537
538 {
539 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
540 .drv = GPIOMUX_DRV_2MA,
541 .pull = GPIOMUX_PULL_NONE,
542 },
543
544 {
545 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
546 .drv = GPIOMUX_DRV_2MA,
547 .pull = GPIOMUX_PULL_DOWN,
548 },
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700549};
550
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530551static struct gpiomux_setting sd_card_det_active_config = {
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530552 .func = GPIOMUX_FUNC_GPIO,
553 .drv = GPIOMUX_DRV_2MA,
554 .pull = GPIOMUX_PULL_NONE,
555 .dir = GPIOMUX_IN,
556};
557
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530558static struct gpiomux_setting sd_card_det_sleep_config = {
559 .func = GPIOMUX_FUNC_GPIO,
560 .drv = GPIOMUX_DRV_2MA,
561 .pull = GPIOMUX_PULL_UP,
562 .dir = GPIOMUX_IN,
563};
564
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530565static struct msm_gpiomux_config sd_card_det __initdata = {
566 .gpio = 62,
567 .settings = {
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530568 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
569 [GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530570 },
571};
572
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700573static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
574 {
575 .gpio = 15, /* CAM_MCLK0 */
576 .settings = {
577 [GPIOMUX_ACTIVE] = &cam_settings[0],
578 [GPIOMUX_SUSPENDED] = &cam_settings[1],
579 },
580 },
581 {
582 .gpio = 16, /* CAM_MCLK1 */
583 .settings = {
584 [GPIOMUX_ACTIVE] = &cam_settings[0],
585 [GPIOMUX_SUSPENDED] = &cam_settings[1],
586 },
587 },
588 {
589 .gpio = 17, /* CAM_MCLK2 */
590 .settings = {
591 [GPIOMUX_ACTIVE] = &cam_settings[0],
592 [GPIOMUX_SUSPENDED] = &cam_settings[1],
593 },
594 },
595 {
596 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
597 .settings = {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700598 [GPIOMUX_ACTIVE] = &cam_settings[3],
599 [GPIOMUX_SUSPENDED] = &cam_settings[4],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700600 },
601 },
602 {
603 .gpio = 19, /* CCI_I2C_SDA0 */
604 .settings = {
605 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800606 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700607 },
608 },
609 {
610 .gpio = 20, /* CCI_I2C_SCL0 */
611 .settings = {
612 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800613 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700614 },
615 },
616 {
617 .gpio = 21, /* CCI_I2C_SDA1 */
618 .settings = {
619 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800620 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700621 },
622 },
623 {
624 .gpio = 22, /* CCI_I2C_SCL1 */
625 .settings = {
626 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800627 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700628 },
629 },
630 {
631 .gpio = 23, /* FLASH_LED_EN */
632 .settings = {
633 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800634 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700635 },
636 },
637 {
638 .gpio = 24, /* FLASH_LED_NOW */
639 .settings = {
640 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800641 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700642 },
643 },
644 {
645 .gpio = 25, /* WEBCAM2_RESET_N */
646 .settings = {
647 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800648 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700649 },
650 },
651 {
652 .gpio = 26, /* CAM_IRQ */
653 .settings = {
654 [GPIOMUX_ACTIVE] = &cam_settings[0],
655 [GPIOMUX_SUSPENDED] = &cam_settings[1],
656 },
657 },
658 {
659 .gpio = 27, /* OIS_SYNC */
660 .settings = {
661 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800662 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700663 },
664 },
665 {
666 .gpio = 28, /* WEBCAM1_STANDBY */
667 .settings = {
668 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800669 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700670 },
671 },
672 {
673 .gpio = 89, /* CAM1_STANDBY_N */
674 .settings = {
675 [GPIOMUX_ACTIVE] = &cam_settings[0],
676 [GPIOMUX_SUSPENDED] = &cam_settings[1],
677 },
678 },
679 {
680 .gpio = 90, /* CAM1_RST_N */
681 .settings = {
682 [GPIOMUX_ACTIVE] = &cam_settings[0],
683 [GPIOMUX_SUSPENDED] = &cam_settings[1],
684 },
685 },
686 {
687 .gpio = 91, /* CAM2_STANDBY_N */
688 .settings = {
689 [GPIOMUX_ACTIVE] = &cam_settings[0],
690 [GPIOMUX_SUSPENDED] = &cam_settings[1],
691 },
692 },
693 {
694 .gpio = 92, /* CAM2_RST_N */
695 .settings = {
696 [GPIOMUX_ACTIVE] = &cam_settings[0],
697 [GPIOMUX_SUSPENDED] = &cam_settings[1],
698 },
699 },
700};
Damir Didjusto04d3c362013-01-07 14:30:53 -0800701
702static struct gpiomux_setting pri_auxpcm_act_cfg = {
703 .func = GPIOMUX_FUNC_1,
704 .drv = GPIOMUX_DRV_8MA,
705 .pull = GPIOMUX_PULL_NONE,
706};
707
708
709static struct gpiomux_setting pri_auxpcm_sus_cfg = {
710 .func = GPIOMUX_FUNC_1,
711 .drv = GPIOMUX_DRV_2MA,
712 .pull = GPIOMUX_PULL_DOWN,
713};
714
715static struct msm_gpiomux_config msm8974_pri_auxpcm_configs[] __initdata = {
716 {
717 .gpio = 65,
718 .settings = {
719 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
720 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
721 },
722 },
723 {
724 .gpio = 66,
725 .settings = {
726 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
727 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
728 },
729 },
730 {
731 .gpio = 67,
732 .settings = {
733 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
734 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
735 },
736 },
737 {
738 .gpio = 68,
739 .settings = {
740 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
741 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
742 },
743 },
744};
745
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700746static struct msm_gpiomux_config wcnss_5wire_interface[] = {
747 {
748 .gpio = 36,
749 .settings = {
750 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
751 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
752 },
753 },
754 {
755 .gpio = 37,
756 .settings = {
757 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
758 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
759 },
760 },
761 {
762 .gpio = 38,
763 .settings = {
764 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
765 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
766 },
767 },
768 {
769 .gpio = 39,
770 .settings = {
771 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
772 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
773 },
774 },
775 {
776 .gpio = 40,
777 .settings = {
778 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
779 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
780 },
781 },
782};
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700783
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700784static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
785 {
786 .gpio = 63, /* SYS_RST_N */
787 .settings = {
788 [GPIOMUX_SUSPENDED] = &taiko_reset,
789 },
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700790 },
791 {
792 .gpio = 72, /* CDC_INT */
793 .settings = {
794 [GPIOMUX_SUSPENDED] = &taiko_int,
795 },
796 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700797};
798
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530799#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
800static struct gpiomux_setting sdc3_clk_actv_cfg = {
801 .func = GPIOMUX_FUNC_2,
802 .drv = GPIOMUX_DRV_8MA,
803 .pull = GPIOMUX_PULL_NONE,
804};
805
806static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
807 .func = GPIOMUX_FUNC_2,
808 .drv = GPIOMUX_DRV_8MA,
809 .pull = GPIOMUX_PULL_UP,
810};
811
812static struct gpiomux_setting sdc3_suspend_cfg = {
813 .func = GPIOMUX_FUNC_GPIO,
814 .drv = GPIOMUX_DRV_2MA,
815 .pull = GPIOMUX_PULL_DOWN,
816};
817
818static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
819 .func = GPIOMUX_FUNC_GPIO,
820 .drv = GPIOMUX_DRV_8MA,
821 .pull = GPIOMUX_PULL_UP,
822};
823
824static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
825 {
826 /* DAT3 */
827 .gpio = 35,
828 .settings = {
829 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
830 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
831 },
832 },
833 {
834 /* DAT2 */
835 .gpio = 36,
836 .settings = {
837 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
838 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
839 },
840 },
841 {
842 /* DAT1 */
843 .gpio = 37,
844 .settings = {
845 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
846 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
847 },
848 },
849 {
850 /* DAT0 */
851 .gpio = 38,
852 .settings = {
853 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
854 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
855 },
856 },
857 {
858 /* CMD */
859 .gpio = 39,
860 .settings = {
861 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
862 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
863 },
864 },
865 {
866 /* CLK */
867 .gpio = 40,
868 .settings = {
869 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
870 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
871 },
872 },
873};
874
875static void msm_gpiomux_sdc3_install(void)
876{
877 msm_gpiomux_install(msm8974_sdc3_configs,
878 ARRAY_SIZE(msm8974_sdc3_configs));
879}
880#else
881static void msm_gpiomux_sdc3_install(void) {}
882#endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
883
884#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
885static struct gpiomux_setting sdc4_clk_actv_cfg = {
886 .func = GPIOMUX_FUNC_2,
887 .drv = GPIOMUX_DRV_8MA,
888 .pull = GPIOMUX_PULL_NONE,
889};
890
891static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
892 .func = GPIOMUX_FUNC_2,
893 .drv = GPIOMUX_DRV_8MA,
894 .pull = GPIOMUX_PULL_UP,
895};
896
897static struct gpiomux_setting sdc4_suspend_cfg = {
898 .func = GPIOMUX_FUNC_GPIO,
899 .drv = GPIOMUX_DRV_2MA,
900 .pull = GPIOMUX_PULL_DOWN,
901};
902
903static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
904 .func = GPIOMUX_FUNC_GPIO,
905 .drv = GPIOMUX_DRV_8MA,
906 .pull = GPIOMUX_PULL_UP,
907};
908
909static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
910 {
911 /* DAT3 */
912 .gpio = 92,
913 .settings = {
914 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
915 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
916 },
917 },
918 {
919 /* DAT2 */
920 .gpio = 94,
921 .settings = {
922 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
923 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
924 },
925 },
926 {
927 /* DAT1 */
928 .gpio = 95,
929 .settings = {
930 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
931 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
932 },
933 },
934 {
935 /* DAT0 */
936 .gpio = 96,
937 .settings = {
938 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
939 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
940 },
941 },
942 {
943 /* CMD */
944 .gpio = 91,
945 .settings = {
946 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
947 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
948 },
949 },
950 {
951 /* CLK */
952 .gpio = 93,
953 .settings = {
954 [GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
955 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
956 },
957 },
958};
959
960static void msm_gpiomux_sdc4_install(void)
961{
962 msm_gpiomux_install(msm8974_sdc4_configs,
963 ARRAY_SIZE(msm8974_sdc4_configs));
964}
965#else
966static void msm_gpiomux_sdc4_install(void) {}
967#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
968
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700969void __init msm_8974_init_gpiomux(void)
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700970{
971 int rc;
972
Rohit Vaswani341c2032012-11-08 18:49:29 -0800973 rc = msm_gpiomux_init_dt();
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700974 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800975 pr_err("%s failed %d\n", __func__, rc);
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700976 return;
977 }
978
Sathish Ambleye3154b42012-04-09 10:59:09 -0700979#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
980 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
981#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700982 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Saket Saurabheac58342013-02-05 12:20:18 +0530983 msm_gpiomux_install(msm_blsp2_uart7_configs,
984 ARRAY_SIZE(msm_blsp2_uart7_configs));
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700985 msm_gpiomux_install(wcnss_5wire_interface,
986 ARRAY_SIZE(wcnss_5wire_interface));
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600987
988 msm_gpiomux_install(msm8974_slimbus_config,
989 ARRAY_SIZE(msm8974_slimbus_config));
990
Amy Maloche9e99a792012-08-15 23:27:51 -0700991 msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
Amy Maloche527acc42012-12-07 18:40:54 -0800992 msm_gpiomux_install(hap_lvl_shft_config,
993 ARRAY_SIZE(hap_lvl_shft_config));
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700994
995 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700996
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530997 msm_gpiomux_install(&sd_card_det, 1);
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530998 msm_gpiomux_sdc3_install();
999 msm_gpiomux_sdc4_install();
Subhash Jadavani76aa7de2012-10-10 09:58:17 +05301000
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001001 msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
Ujwal Patel74b5df42012-08-13 22:50:13 -07001002
Manu Gautamac7265b2012-11-21 11:49:15 +05301003 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
1004 msm_gpiomux_install(msm_hsic_hub_configs,
1005 ARRAY_SIZE(msm_hsic_hub_configs));
1006
Ujwal Patel74b5df42012-08-13 22:50:13 -07001007 msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
Stepan Moskovchenkoebd05412013-02-07 20:39:56 -08001008 if (machine_is_msm8974_fluid())
1009 msm_gpiomux_install(msm_mhl_configs,
1010 ARRAY_SIZE(msm_mhl_configs));
Stepan Moskovchenko95108b82012-11-27 14:28:11 -08001011
Damir Didjusto04d3c362013-01-07 14:30:53 -08001012 msm_gpiomux_install(msm8974_pri_auxpcm_configs,
1013 ARRAY_SIZE(msm8974_pri_auxpcm_configs));
1014
Siddhartha Agrawal6ab3e1c2013-02-22 18:30:37 -08001015 msm_gpiomux_install_nowrite(msm_lcd_configs,
1016 ARRAY_SIZE(msm_lcd_configs));
1017
Stepan Moskovchenko95108b82012-11-27 14:28:11 -08001018 if (machine_is_msm8974_rumi())
1019 msm_gpiomux_install(msm_rumi_blsp_configs,
1020 ARRAY_SIZE(msm_rumi_blsp_configs));
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001021}