blob: 4dcbc3a35722aba0428e7f64d8868fb61bbb1757 [file] [log] [blame]
Gilad Avidov28e18eb2012-11-21 18:13:25 -07001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -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>
David Collins091bb242013-05-23 11:08:24 -070019#include <mach/socinfo.h>
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -070020
Pavankumar Kondeti45eb66f2013-09-24 15:43:25 +053021#ifdef CONFIG_USB_EHCI_MSM_HSIC
22static struct gpiomux_setting hsic_sus_cfg = {
23 .func = GPIOMUX_FUNC_GPIO,
24 .drv = GPIOMUX_DRV_2MA,
25 .pull = GPIOMUX_PULL_DOWN,
26 .dir = GPIOMUX_OUT_LOW,
27};
28
29static struct gpiomux_setting hsic_act_cfg = {
30 .func = GPIOMUX_FUNC_1,
31 .drv = GPIOMUX_DRV_16MA,
32 .pull = GPIOMUX_PULL_NONE,
33};
34
35static struct msm_gpiomux_config msm_hsic_configs[] = {
36 {
37 .gpio = 115, /* HSIC_STROBE */
38 .settings = {
39 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
40 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
41 },
42 },
43 {
44 .gpio = 116, /* HSIC_DATA */
45 .settings = {
46 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
47 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
48 },
49 },
50};
51#endif
52
aiquny76b46082013-03-13 15:58:08 -070053#define KS8851_IRQ_GPIO 115
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080054
55#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
56static struct gpiomux_setting gpio_eth_config = {
57 .pull = GPIOMUX_PULL_UP,
58 .drv = GPIOMUX_DRV_2MA,
59 .func = GPIOMUX_FUNC_GPIO,
60};
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080061
62static struct msm_gpiomux_config msm_eth_configs[] = {
63 {
64 .gpio = KS8851_IRQ_GPIO,
65 .settings = {
66 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
67 }
68 },
69};
Gilad Avidov28e18eb2012-11-21 18:13:25 -070070#endif
71
Amy Maloche41708ba2013-03-03 15:19:27 -080072static struct gpiomux_setting synaptics_int_act_cfg = {
73 .func = GPIOMUX_FUNC_GPIO,
74 .drv = GPIOMUX_DRV_8MA,
75 .pull = GPIOMUX_PULL_UP,
76};
77
78static struct gpiomux_setting synaptics_int_sus_cfg = {
79 .func = GPIOMUX_FUNC_GPIO,
80 .drv = GPIOMUX_DRV_2MA,
81 .pull = GPIOMUX_PULL_DOWN,
82};
83
84static struct gpiomux_setting synaptics_reset_act_cfg = {
85 .func = GPIOMUX_FUNC_GPIO,
86 .drv = GPIOMUX_DRV_6MA,
87 .pull = GPIOMUX_PULL_DOWN,
88};
89
90static struct gpiomux_setting synaptics_reset_sus_cfg = {
91 .func = GPIOMUX_FUNC_GPIO,
Amy Malochebf346092013-07-31 12:57:28 -070092 .drv = GPIOMUX_DRV_2MA,
Amy Maloche41708ba2013-03-03 15:19:27 -080093 .pull = GPIOMUX_PULL_DOWN,
94};
95
Amy Maloche24c59dd2013-03-05 11:43:55 -080096static struct gpiomux_setting gpio_keys_active = {
97 .func = GPIOMUX_FUNC_GPIO,
98 .drv = GPIOMUX_DRV_2MA,
99 .pull = GPIOMUX_PULL_UP,
100};
101
102static struct gpiomux_setting gpio_keys_suspend = {
103 .func = GPIOMUX_FUNC_GPIO,
104 .drv = GPIOMUX_DRV_2MA,
105 .pull = GPIOMUX_PULL_NONE,
106};
107
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530108static struct gpiomux_setting gpio_spi_act_config = {
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700109 .func = GPIOMUX_FUNC_1,
110 .drv = GPIOMUX_DRV_8MA,
111 .pull = GPIOMUX_PULL_NONE,
112};
113
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530114static struct gpiomux_setting gpio_spi_cs_act_config = {
Gilad Avidovd59217c2013-02-01 13:45:59 -0700115 .func = GPIOMUX_FUNC_1,
116 .drv = GPIOMUX_DRV_6MA,
117 .pull = GPIOMUX_PULL_DOWN,
118};
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530119static struct gpiomux_setting gpio_spi_susp_config = {
120 .func = GPIOMUX_FUNC_GPIO,
121 .drv = GPIOMUX_DRV_2MA,
122 .pull = GPIOMUX_PULL_DOWN,
123};
Gilad Avidovd59217c2013-02-01 13:45:59 -0700124
Su Liuec9f6f52013-08-30 17:33:32 +0800125static struct gpiomux_setting gpio_spi_cs_eth_config = {
126 .func = GPIOMUX_FUNC_4,
127 .drv = GPIOMUX_DRV_6MA,
128 .pull = GPIOMUX_PULL_DOWN,
129};
130
Sheng Fang6746c3f2013-03-19 08:37:13 +0800131static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
132 .func = GPIOMUX_FUNC_GPIO,
133 .drv = GPIOMUX_DRV_2MA,
134 .pull = GPIOMUX_PULL_UP,
135};
136
137static struct gpiomux_setting wcnss_5wire_active_cfg = {
138 .func = GPIOMUX_FUNC_1,
139 .drv = GPIOMUX_DRV_6MA,
140 .pull = GPIOMUX_PULL_DOWN,
141};
142
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700143static struct gpiomux_setting gpio_i2c_config = {
144 .func = GPIOMUX_FUNC_3,
145 .drv = GPIOMUX_DRV_2MA,
146 .pull = GPIOMUX_PULL_NONE,
147};
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800148
Amy Maloche24c59dd2013-03-05 11:43:55 -0800149static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
150 {
151 .gpio = 106,
152 .settings = {
153 [GPIOMUX_ACTIVE] = &gpio_keys_active,
154 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
155 },
156 },
157 {
158 .gpio = 107,
159 .settings = {
160 [GPIOMUX_ACTIVE] = &gpio_keys_active,
161 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
162 },
163 },
164 {
165 .gpio = 108,
166 .settings = {
167 [GPIOMUX_ACTIVE] = &gpio_keys_active,
168 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
169 },
170 },
171};
172
Aravind Venkateswaranf60fb212013-03-08 13:57:06 -0800173static struct gpiomux_setting lcd_rst_act_cfg = {
174 .func = GPIOMUX_FUNC_GPIO,
175 .drv = GPIOMUX_DRV_8MA,
Aravind Venkateswarand11ac092013-06-18 12:30:20 -0700176 .pull = GPIOMUX_PULL_UP,
177 .dir = GPIOMUX_OUT_HIGH,
Aravind Venkateswaranf60fb212013-03-08 13:57:06 -0800178};
179
180static struct gpiomux_setting lcd_rst_sus_cfg = {
181 .func = GPIOMUX_FUNC_GPIO,
182 .drv = GPIOMUX_DRV_2MA,
183 .pull = GPIOMUX_PULL_DOWN,
184};
185
186static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
187 {
188 .gpio = 25,
189 .settings = {
190 [GPIOMUX_ACTIVE] = &lcd_rst_act_cfg,
191 [GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
192 },
193 }
194};
195
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800196static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
197 {
Gilad Avidovd59217c2013-02-01 13:45:59 -0700198 .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800199 .settings = {
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530200 [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
201 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800202 },
203 },
204 {
Gilad Avidovd59217c2013-02-01 13:45:59 -0700205 .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800206 .settings = {
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530207 [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
208 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800209 },
210 },
211 {
Gilad Avidovd59217c2013-02-01 13:45:59 -0700212 .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
213 .settings = {
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530214 [GPIOMUX_ACTIVE] = &gpio_spi_cs_act_config,
215 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidovd59217c2013-02-01 13:45:59 -0700216 },
217 },
218 {
219 .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800220 .settings = {
Venkat Raju Sana6d4e9c72013-09-06 19:23:49 +0530221 [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
222 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800223 },
224 },
225 {
Gilad Avidovd59217c2013-02-01 13:45:59 -0700226 .gpio = 14, /* BLSP1 QUP4 I2C_SDA */
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700227 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800228 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700229 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
230 },
231 },
232 {
Gilad Avidovd59217c2013-02-01 13:45:59 -0700233 .gpio = 15, /* BLSP1 QUP4 I2C_SCL */
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700234 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800235 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700236 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
237 },
238 },
Amy Maloche41708ba2013-03-03 15:19:27 -0800239 {
240 .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
241 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800242 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Amy Maloche41708ba2013-03-03 15:19:27 -0800243 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
244 },
245 },
246 {
247 .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
248 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800249 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Amy Maloche41708ba2013-03-03 15:19:27 -0800250 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
251 },
252 },
Su Liuec9f6f52013-08-30 17:33:32 +0800253 {
254 .gpio = 22, /* BLSP1 QUP1 SPI_CS_ETH */
255 .settings = {
256 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_eth_config,
257 },
258 },
Madan Mohan Koyyalamudiddfbd632013-06-19 17:40:39 -0700259 { /* NFC */
260 .gpio = 10, /* BLSP1 QUP3 I2C_DAT */
261 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800262 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Madan Mohan Koyyalamudiddfbd632013-06-19 17:40:39 -0700263 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
264 },
265 },
266 { /* NFC */
267 .gpio = 11, /* BLSP1 QUP3 I2C_CLK */
268 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800269 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Madan Mohan Koyyalamudiddfbd632013-06-19 17:40:39 -0700270 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
271 },
272 },
Amy Maloche41708ba2013-03-03 15:19:27 -0800273};
274
275static struct msm_gpiomux_config msm_synaptics_configs[] __initdata = {
276 {
277 .gpio = 16,
278 .settings = {
279 [GPIOMUX_ACTIVE] = &synaptics_reset_act_cfg,
280 [GPIOMUX_SUSPENDED] = &synaptics_reset_sus_cfg,
281 },
282 },
283 {
284 .gpio = 17,
285 .settings = {
286 [GPIOMUX_ACTIVE] = &synaptics_int_act_cfg,
287 [GPIOMUX_SUSPENDED] = &synaptics_int_sus_cfg,
288 },
289 },
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800290};
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800291
Bingzhe Cai38869af2013-07-29 11:36:40 +0800292static struct gpiomux_setting gpio_nc_cfg = {
293 .func = GPIOMUX_FUNC_GPIO,
294 .drv = GPIOMUX_DRV_2MA,
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800295 .pull = GPIOMUX_PULL_NONE,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800296};
297
298static struct gpiomux_setting goodix_ldo_en_act_cfg = {
299 .func = GPIOMUX_FUNC_GPIO,
300 .drv = GPIOMUX_DRV_6MA,
301 .pull = GPIOMUX_PULL_UP,
302};
303
304static struct gpiomux_setting goodix_ldo_en_sus_cfg = {
305 .func = GPIOMUX_FUNC_GPIO,
306 .drv = GPIOMUX_DRV_6MA,
307 .pull = GPIOMUX_PULL_UP,
308};
309
310static struct gpiomux_setting goodix_int_act_cfg = {
311 .func = GPIOMUX_FUNC_GPIO,
312 .drv = GPIOMUX_DRV_8MA,
313 .pull = GPIOMUX_PULL_UP,
314};
315
316static struct gpiomux_setting goodix_int_sus_cfg = {
317 .func = GPIOMUX_FUNC_GPIO,
318 .drv = GPIOMUX_DRV_2MA,
319 .pull = GPIOMUX_PULL_DOWN,
320};
321
322static struct gpiomux_setting goodix_reset_act_cfg = {
323 .func = GPIOMUX_FUNC_GPIO,
324 .drv = GPIOMUX_DRV_8MA,
325 .pull = GPIOMUX_PULL_UP,
326};
327
328static struct gpiomux_setting goodix_reset_sus_cfg = {
329 .func = GPIOMUX_FUNC_GPIO,
330 .drv = GPIOMUX_DRV_8MA,
331 .pull = GPIOMUX_PULL_UP,
332};
333
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800334static struct msm_gpiomux_config msm_skuf_blsp_configs[] __initdata = {
Bingzhe Cai38869af2013-07-29 11:36:40 +0800335 {
336 .gpio = 2, /* NC */
337 .settings = {
338 [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
339 },
340 },
341 {
342 .gpio = 3, /* NC */
343 .settings = {
344 [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
345 },
346 },
347 {
348 .gpio = 4, /* NC */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
351 },
352 },
353 {
354 .gpio = 14, /* NC */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
357 },
358 },
359};
360
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800361static struct msm_gpiomux_config msm_skuf_goodix_configs[] __initdata = {
Bingzhe Cai38869af2013-07-29 11:36:40 +0800362 {
363 .gpio = 15, /* LDO EN */
364 .settings = {
365 [GPIOMUX_ACTIVE] = &goodix_ldo_en_act_cfg,
366 [GPIOMUX_SUSPENDED] = &goodix_ldo_en_sus_cfg,
367 },
368 },
369 {
370 .gpio = 16, /* RESET */
371 .settings = {
372 [GPIOMUX_ACTIVE] = &goodix_reset_act_cfg,
373 [GPIOMUX_SUSPENDED] = &goodix_reset_sus_cfg,
374 },
375 },
376 {
377 .gpio = 17, /* INT */
378 .settings = {
379 [GPIOMUX_ACTIVE] = &goodix_int_act_cfg,
380 [GPIOMUX_SUSPENDED] = &goodix_int_sus_cfg,
381 },
382 },
383 {
384 .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
385 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800386 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800387 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
388 },
389 },
390 {
391 .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
392 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800393 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800394 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
395 },
396 },
397};
398
399static struct gpiomux_setting nfc_ldo_act_cfg = {
400 .func = GPIOMUX_FUNC_GPIO,
401 .drv = GPIOMUX_DRV_6MA,
402 .pull = GPIOMUX_PULL_UP,
403};
404
405static struct gpiomux_setting nfc_ldo_sus_cfg = {
406 .func = GPIOMUX_FUNC_GPIO,
407 .drv = GPIOMUX_DRV_6MA,
408 .pull = GPIOMUX_PULL_UP,
409};
410
411static struct gpiomux_setting nfc_regc_act_cfg = {
412 .func = GPIOMUX_FUNC_GPIO,
413 .drv = GPIOMUX_DRV_6MA,
414 .pull = GPIOMUX_PULL_UP,
415};
416
417static struct gpiomux_setting nfc_regc_sus_cfg = {
418 .func = GPIOMUX_FUNC_GPIO,
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800419 .drv = GPIOMUX_DRV_2MA,
420 .pull = GPIOMUX_PULL_NONE,
421 .dir = GPIOMUX_OUT_LOW,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800422};
423
424static struct gpiomux_setting nfc_wake_act_cfg = {
425 .func = GPIOMUX_FUNC_GPIO,
426 .drv = GPIOMUX_DRV_6MA,
427 .pull = GPIOMUX_PULL_UP,
428};
429
430static struct gpiomux_setting nfc_wake_sus_cfg = {
431 .func = GPIOMUX_FUNC_GPIO,
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800432 .drv = GPIOMUX_DRV_2MA,
433 .pull = GPIOMUX_PULL_NONE,
434 .dir = GPIOMUX_OUT_LOW,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800435};
436
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800437static struct msm_gpiomux_config msm_skuf_nfc_configs[] __initdata = {
Bingzhe Cai38869af2013-07-29 11:36:40 +0800438 { /* NFC LDO EN */
439 .gpio = 0,
440 .settings = {
441 [GPIOMUX_ACTIVE] = &nfc_ldo_act_cfg,
442 [GPIOMUX_SUSPENDED] = &nfc_ldo_sus_cfg,
443 },
444 },
445 { /* NFC REGC*/
446 .gpio = 1,
447 .settings = {
448 [GPIOMUX_ACTIVE] = &nfc_regc_act_cfg,
449 [GPIOMUX_SUSPENDED] = &nfc_regc_sus_cfg,
450 },
451 },
452 { /* NFC WAKE */
453 .gpio = 5,
454 .settings = {
455 [GPIOMUX_ACTIVE] = &nfc_wake_act_cfg,
456 [GPIOMUX_SUSPENDED] = &nfc_wake_sus_cfg,
457 },
458 },
459 { /* NFC */
460 .gpio = 10, /* BLSP1 QUP3 I2C_DAT */
461 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800462 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800463 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
464 },
465 },
466 { /* NFC */
467 .gpio = 11, /* BLSP1 QUP3 I2C_CLK */
468 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800469 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Bingzhe Cai38869af2013-07-29 11:36:40 +0800470 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
471 },
472 },
473};
474
Krishna Konda7af5df92013-03-06 20:35:30 -0800475static struct gpiomux_setting sd_card_det_active_config = {
476 .func = GPIOMUX_FUNC_GPIO,
477 .drv = GPIOMUX_DRV_2MA,
478 .pull = GPIOMUX_PULL_NONE,
479 .dir = GPIOMUX_IN,
480};
481
482static struct gpiomux_setting sd_card_det_sleep_config = {
483 .func = GPIOMUX_FUNC_GPIO,
484 .drv = GPIOMUX_DRV_2MA,
485 .pull = GPIOMUX_PULL_UP,
486 .dir = GPIOMUX_IN,
487};
488
489static struct msm_gpiomux_config sd_card_det __initdata = {
490 .gpio = 38,
491 .settings = {
492 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
493 [GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
494 },
495};
496
Sheng Fang6746c3f2013-03-19 08:37:13 +0800497static struct msm_gpiomux_config wcnss_5wire_interface[] = {
498 {
499 .gpio = 40,
500 .settings = {
501 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
502 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
503 },
504 },
505 {
506 .gpio = 41,
507 .settings = {
508 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
509 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
510 },
511 },
512 {
513 .gpio = 42,
514 .settings = {
515 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
516 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
517 },
518 },
519 {
520 .gpio = 43,
521 .settings = {
522 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
523 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
524 },
525 },
526 {
527 .gpio = 44,
528 .settings = {
529 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
530 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
531 },
532 },
533};
Su Liud1c66ee2013-03-22 15:29:48 -0700534
535static struct gpiomux_setting gpio_suspend_config[] = {
536 {
537 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
538 .drv = GPIOMUX_DRV_2MA,
539 .pull = GPIOMUX_PULL_NONE,
540 },
541 {
542 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
543 .drv = GPIOMUX_DRV_2MA,
544 .pull = GPIOMUX_PULL_NONE,
545 .dir = GPIOMUX_OUT_LOW,
546 },
547};
548
549static struct gpiomux_setting cam_settings[] = {
550 {
551 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_NONE,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
558 .drv = GPIOMUX_DRV_2MA,
559 .pull = GPIOMUX_PULL_DOWN,
560 },
561
562 {
563 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
564 .drv = GPIOMUX_DRV_2MA,
565 .pull = GPIOMUX_PULL_KEEPER,
566 },
567
568 {
569 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
570 .drv = GPIOMUX_DRV_2MA,
571 .pull = GPIOMUX_PULL_NONE,
572 },
573
574 {
575 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
576 .drv = GPIOMUX_DRV_2MA,
577 .pull = GPIOMUX_PULL_DOWN,
578 },
579};
580
581
582static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
583 {
584 .gpio = 26, /* CAM_MCLK0 */
585 .settings = {
586 [GPIOMUX_ACTIVE] = &cam_settings[0],
587 [GPIOMUX_SUSPENDED] = &cam_settings[1],
588 },
589 },
590 {
591 .gpio = 27, /* CAM_MCLK1 */
592 .settings = {
593 [GPIOMUX_ACTIVE] = &cam_settings[0],
594 [GPIOMUX_SUSPENDED] = &cam_settings[1],
595 },
596
597 },
598 {
599 .gpio = 29, /* CCI_I2C_SDA0 */
600 .settings = {
601 [GPIOMUX_ACTIVE] = &cam_settings[0],
602 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
603 },
604 },
605 {
606 .gpio = 30, /* CCI_I2C_SCL0 */
607 .settings = {
608 [GPIOMUX_ACTIVE] = &cam_settings[0],
609 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
610 },
611 },
612 {
613 .gpio = 36, /* CAM1_STANDBY_N */
614 .settings = {
615 [GPIOMUX_ACTIVE] = &cam_settings[3],
616 [GPIOMUX_SUSPENDED] = &cam_settings[4],
617 },
618 },
619 {
620 .gpio = 37, /* CAM1_RST_N */
621 .settings = {
622 [GPIOMUX_ACTIVE] = &cam_settings[3],
623 [GPIOMUX_SUSPENDED] = &cam_settings[4],
624 },
625 },
626 {
627 .gpio = 35, /* CAM2_STANDBY_N */
628 .settings = {
629 [GPIOMUX_ACTIVE] = &cam_settings[3],
630 [GPIOMUX_SUSPENDED] = &cam_settings[4],
631 },
632 },
633 {
634 .gpio = 28, /* CAM2_RST_N */
635 .settings = {
636 [GPIOMUX_ACTIVE] = &cam_settings[3],
637 [GPIOMUX_SUSPENDED] = &cam_settings[4],
638 },
639 },
640
641};
642
Su Liudc549392013-08-30 19:05:39 +0800643static struct msm_gpiomux_config msm_sensor_configs_skuf_plus[] __initdata = {
644 {
645 .gpio = 22, /* CAM1_VDD */
646 .settings = {
647 [GPIOMUX_ACTIVE] = &cam_settings[3],
648 [GPIOMUX_SUSPENDED] = &cam_settings[4],
649 },
650 },
651 {
652 .gpio = 34, /* CAM1 VCM_PWDN */
653 .settings = {
654 [GPIOMUX_ACTIVE] = &cam_settings[3],
655 [GPIOMUX_SUSPENDED] = &cam_settings[4],
656 },
657 },
658};
659
660
Banajit Goswami25715c52013-05-10 11:45:47 -0700661static struct gpiomux_setting auxpcm_act_cfg = {
662 .func = GPIOMUX_FUNC_1,
663 .drv = GPIOMUX_DRV_8MA,
664 .pull = GPIOMUX_PULL_NONE,
665};
666
667static struct gpiomux_setting auxpcm_sus_cfg = {
668 .func = GPIOMUX_FUNC_1,
669 .drv = GPIOMUX_DRV_2MA,
670 .pull = GPIOMUX_PULL_DOWN,
671};
672
673static struct msm_gpiomux_config msm_auxpcm_configs[] __initdata = {
674 {
675 .gpio = 63,
676 .settings = {
677 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
678 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
679 },
680 },
681 {
682 .gpio = 64,
683 .settings = {
684 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
685 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
686 },
687 },
688 {
689 .gpio = 65,
690 .settings = {
691 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
692 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
693 },
694 },
695 {
696 .gpio = 66,
697 .settings = {
698 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
699 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
700 },
701 },
702};
703
David Collins091bb242013-05-23 11:08:24 -0700704static struct gpiomux_setting usb_otg_sw_cfg = {
705 .func = GPIOMUX_FUNC_GPIO,
706 .drv = GPIOMUX_DRV_2MA,
707 .dir = GPIOMUX_OUT_LOW,
708};
709
710static struct msm_gpiomux_config usb_otg_sw_configs[] __initdata = {
711 {
712 .gpio = 67,
713 .settings = {
714 [GPIOMUX_SUSPENDED] = &usb_otg_sw_cfg,
715 },
716 },
717};
718
Krishna Kondafdd71d82013-07-08 16:30:16 -0700719#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
720static struct gpiomux_setting sdc3_clk_actv_cfg = {
721 .func = GPIOMUX_FUNC_2,
722 .drv = GPIOMUX_DRV_8MA,
723 .pull = GPIOMUX_PULL_NONE,
724};
725
726static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
727 .func = GPIOMUX_FUNC_2,
728 .drv = GPIOMUX_DRV_8MA,
729 .pull = GPIOMUX_PULL_UP,
730};
731
732static struct gpiomux_setting sdc3_suspend_cfg = {
733 .func = GPIOMUX_FUNC_GPIO,
734 .drv = GPIOMUX_DRV_2MA,
735 .pull = GPIOMUX_PULL_DOWN,
736};
737
738static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
739 .func = GPIOMUX_FUNC_GPIO,
740 .drv = GPIOMUX_DRV_2MA,
741 .pull = GPIOMUX_PULL_UP,
742};
743
744static struct msm_gpiomux_config msm8226_sdc3_configs[] __initdata = {
745 {
746 /* DAT3 */
747 .gpio = 39,
748 .settings = {
749 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
750 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
751 },
752 },
753 {
754 /* DAT2 */
755 .gpio = 40,
756 .settings = {
757 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
758 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
759 },
760 },
761 {
762 /* DAT1 */
763 .gpio = 41,
764 .settings = {
765 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
766 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
767 },
768 },
769 {
770 /* DAT0 */
771 .gpio = 42,
772 .settings = {
773 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
774 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
775 },
776 },
777 {
778 /* CMD */
779 .gpio = 43,
780 .settings = {
781 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
782 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
783 },
784 },
785 {
786 /* CLK */
787 .gpio = 44,
788 .settings = {
789 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
790 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
791 },
792 },
793};
794
795static void msm_gpiomux_sdc3_install(void)
796{
797 msm_gpiomux_install(msm8226_sdc3_configs,
798 ARRAY_SIZE(msm8226_sdc3_configs));
799}
800#else
801static void msm_gpiomux_sdc3_install(void) {}
802#endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
803
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700804void __init msm8226_init_gpiomux(void)
805{
806 int rc;
807
Rohit Vaswani341c2032012-11-08 18:49:29 -0800808 rc = msm_gpiomux_init_dt();
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700809 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800810 pr_err("%s failed %d\n", __func__, rc);
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700811 return;
812 }
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700813
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800814#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
815 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800816#endif
Amy Maloche24c59dd2013-03-05 11:43:55 -0800817 msm_gpiomux_install(msm_keypad_configs,
818 ARRAY_SIZE(msm_keypad_configs));
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700819
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800820 if (of_board_is_skuf())
821 msm_gpiomux_install(msm_skuf_blsp_configs,
822 ARRAY_SIZE(msm_skuf_blsp_configs));
Bingzhe Cai38869af2013-07-29 11:36:40 +0800823 else
824 msm_gpiomux_install(msm_blsp_configs,
825 ARRAY_SIZE(msm_blsp_configs));
826
Sheng Fang6746c3f2013-03-19 08:37:13 +0800827 msm_gpiomux_install(wcnss_5wire_interface,
828 ARRAY_SIZE(wcnss_5wire_interface));
Krishna Konda7af5df92013-03-06 20:35:30 -0800829
830 msm_gpiomux_install(&sd_card_det, 1);
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800831 if (of_board_is_skuf())
832 msm_gpiomux_install(msm_skuf_goodix_configs,
833 ARRAY_SIZE(msm_skuf_goodix_configs));
Bingzhe Cai38869af2013-07-29 11:36:40 +0800834 else
835 msm_gpiomux_install(msm_synaptics_configs,
836 ARRAY_SIZE(msm_synaptics_configs));
837
Xiaocheng Li44e68fe2013-09-02 16:55:04 +0800838 if (of_board_is_skuf())
839 msm_gpiomux_install(msm_skuf_nfc_configs,
840 ARRAY_SIZE(msm_skuf_nfc_configs));
Bingzhe Cai38869af2013-07-29 11:36:40 +0800841
Aravind Venkateswaranf60fb212013-03-08 13:57:06 -0800842 msm_gpiomux_install_nowrite(msm_lcd_configs,
843 ARRAY_SIZE(msm_lcd_configs));
Su Liudc549392013-08-30 19:05:39 +0800844
Su Liud1c66ee2013-03-22 15:29:48 -0700845 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Su Liudc549392013-08-30 19:05:39 +0800846
847 if (of_board_is_skuf())
848 msm_gpiomux_install(msm_sensor_configs_skuf_plus,
849 ARRAY_SIZE(msm_sensor_configs_skuf_plus));
850
Banajit Goswami25715c52013-05-10 11:45:47 -0700851 msm_gpiomux_install(msm_auxpcm_configs,
852 ARRAY_SIZE(msm_auxpcm_configs));
David Collins091bb242013-05-23 11:08:24 -0700853
Syed Rameez Mustafa7ef61582013-06-07 16:14:58 -0700854 if (of_board_is_cdp() || of_board_is_mtp() || of_board_is_xpm())
David Collins091bb242013-05-23 11:08:24 -0700855 msm_gpiomux_install(usb_otg_sw_configs,
856 ARRAY_SIZE(usb_otg_sw_configs));
Krishna Kondafdd71d82013-07-08 16:30:16 -0700857
858 msm_gpiomux_sdc3_install();
Pavankumar Kondeti45eb66f2013-09-24 15:43:25 +0530859
860 /*
861 * HSIC STROBE gpio is also used by the ethernet. Install HSIC
862 * gpio mux config only when HSIC is enabled. HSIC config will
863 * be disabled when ethernet config is enabled.
864 */
865#ifdef CONFIG_USB_EHCI_MSM_HSIC
Pavankumar Kondeti0d6ed962013-09-25 14:25:52 +0530866 if (machine_is_msm8926()) {
867 msm_hsic_configs[0].gpio = 119; /* STROBE */
868 msm_hsic_configs[1].gpio = 120; /* DATA */
869 }
Pavankumar Kondeti45eb66f2013-09-24 15:43:25 +0530870 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
871#endif
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700872}