blob: 624cf5e2b22066ed48f64294416f5d9f56e1a2c9 [file] [log] [blame]
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Rohit Vaswania6815892011-12-15 20:20:39 -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 <mach/gpiomux.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include "board-9615.h"
19
20static struct gpiomux_setting ps_hold = {
21 .func = GPIOMUX_FUNC_1,
22 .drv = GPIOMUX_DRV_8MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Sagar Dharia2a5378d2011-12-01 20:00:11 -070026static struct gpiomux_setting slimbus = {
27 .func = GPIOMUX_FUNC_2,
28 .drv = GPIOMUX_DRV_8MA,
29 .pull = GPIOMUX_PULL_KEEPER,
30};
31
Rohit Vaswania6815892011-12-15 20:20:39 -080032static struct gpiomux_setting gsbi4 = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_8MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
38static struct gpiomux_setting gsbi5 = {
39 .func = GPIOMUX_FUNC_1,
40 .drv = GPIOMUX_DRV_8MA,
41 .pull = GPIOMUX_PULL_NONE,
42};
43
44static struct gpiomux_setting gsbi3 = {
45 .func = GPIOMUX_FUNC_1,
46 .drv = GPIOMUX_DRV_8MA,
47 .pull = GPIOMUX_PULL_NONE,
48};
49
50static struct gpiomux_setting gsbi3_cs1_config = {
51 .func = GPIOMUX_FUNC_4,
52 .drv = GPIOMUX_DRV_8MA,
53 .pull = GPIOMUX_PULL_NONE,
54};
55
56#ifdef CONFIG_LTC4088_CHARGER
57static struct gpiomux_setting ltc4088_chg_cfg = {
58 .func = GPIOMUX_FUNC_GPIO,
59 .drv = GPIOMUX_DRV_8MA,
60 .pull = GPIOMUX_PULL_NONE,
61};
62#endif
63
64static struct gpiomux_setting sdcc2_clk_actv_cfg = {
65 .func = GPIOMUX_FUNC_1,
66 .drv = GPIOMUX_DRV_16MA,
67 .pull = GPIOMUX_PULL_NONE,
68};
69
70static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
71 .func = GPIOMUX_FUNC_1,
72 .drv = GPIOMUX_DRV_8MA,
73 .pull = GPIOMUX_PULL_UP,
74};
75
76static struct gpiomux_setting sdcc2_suspend_cfg = {
77 .func = GPIOMUX_FUNC_1,
78 .drv = GPIOMUX_DRV_2MA,
79 .pull = GPIOMUX_PULL_DOWN,
80};
81
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080082static struct gpiomux_setting cdc_mclk = {
83 .func = GPIOMUX_FUNC_1,
84 .drv = GPIOMUX_DRV_8MA,
85 .pull = GPIOMUX_PULL_NONE,
86};
87
Zhang Chang Kena48794b2012-03-31 17:45:21 -040088#ifdef CONFIG_FB_MSM_EBI2
89static struct gpiomux_setting ebi2_lcdc_a_d = {
90 .func = GPIOMUX_FUNC_2,
91 .drv = GPIOMUX_DRV_12MA,
92 .pull = GPIOMUX_PULL_DOWN,
93};
94
95static struct gpiomux_setting ebi2_lcdc_cs = {
96 .func = GPIOMUX_FUNC_2,
97 .drv = GPIOMUX_DRV_12MA,
98 .pull = GPIOMUX_PULL_UP,
99};
100
101static struct gpiomux_setting ebi2_lcdc_rs = {
102 .func = GPIOMUX_FUNC_3,
103 .drv = GPIOMUX_DRV_12MA,
104 .pull = GPIOMUX_PULL_DOWN,
105};
106#endif
107
Pavan Kumar27556502012-05-21 18:38:01 -0700108static struct gpiomux_setting wlan_active_config = {
109 .func = GPIOMUX_FUNC_GPIO,
110 .drv = GPIOMUX_DRV_2MA,
111 .pull = GPIOMUX_PULL_NONE,
112 .dir = GPIOMUX_OUT_LOW,
113};
114
115static struct gpiomux_setting wlan_suspend_config = {
116 .func = GPIOMUX_FUNC_GPIO,
117 .drv = GPIOMUX_DRV_2MA,
118 .pull = GPIOMUX_PULL_NONE,
119 .dir = GPIOMUX_IN,
120};
121
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800122static struct msm_gpiomux_config msm9615_audio_codec_configs[] __initdata = {
123 {
124 .gpio = 24,
125 .settings = {
126 [GPIOMUX_SUSPENDED] = &cdc_mclk,
127 },
128 },
129};
130
Rohit Vaswania6815892011-12-15 20:20:39 -0800131static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
132 {
133 /* SDC2_DATA_0 */
134 .gpio = 25,
135 .settings = {
136 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
137 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
138 },
139 },
140 {
141 /* SDC2_DATA_1 */
142 .gpio = 26,
143 .settings = {
144 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
145 [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg,
146 },
147 },
148 {
149 /* SDC2_DATA_2 */
150 .gpio = 27,
151 .settings = {
152 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
153 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
154 },
155 },
156 {
157 /* SDC2_DATA_3 */
158 .gpio = 28,
159 .settings = {
160 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
161 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
162 },
163 },
164 {
165 /* SDC2_CMD */
166 .gpio = 29,
167 .settings = {
168 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
169 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
170 },
171 },
172 {
173 /* SDC2_CLK */
174 .gpio = 30,
175 .settings = {
176 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
177 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
178 },
179 },
180};
181
182struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
183 {
184 .gpio = 83,
185 .settings = {
186 [GPIOMUX_SUSPENDED] = &ps_hold,
187 },
188 },
189};
190
191#ifdef CONFIG_LTC4088_CHARGER
192static struct msm_gpiomux_config
193 msm9615_ltc4088_charger_config[] __initdata = {
194 {
195 .gpio = 4,
196 .settings = {
197 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
198 },
199 },
200 {
201 .gpio = 6,
202 .settings = {
203 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
204 },
205 },
206 {
207 .gpio = 7,
208 .settings = {
209 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
210 },
211 },
212};
213#endif
214
215struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
216 {
217 .gpio = 8, /* GSBI3 QUP SPI_CLK */
218 .settings = {
219 [GPIOMUX_SUSPENDED] = &gsbi3,
220 },
221 },
222 {
223 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
224 .settings = {
225 [GPIOMUX_SUSPENDED] = &gsbi3,
226 },
227 },
228 {
229 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
230 .settings = {
231 [GPIOMUX_SUSPENDED] = &gsbi3,
232 },
233 },
234 {
235 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
236 .settings = {
237 [GPIOMUX_SUSPENDED] = &gsbi3,
238 },
239 },
240 {
241 .gpio = 12, /* GSBI4 UART */
242 .settings = {
243 [GPIOMUX_SUSPENDED] = &gsbi4,
244 },
245 },
246 {
247 .gpio = 13, /* GSBI4 UART */
248 .settings = {
249 [GPIOMUX_SUSPENDED] = &gsbi4,
250 },
251 },
252 {
253 .gpio = 14, /* GSBI4 UART */
254 .settings = {
255 [GPIOMUX_SUSPENDED] = &gsbi4,
256 },
257 },
258 {
259 .gpio = 15, /* GSBI4 UART */
260 .settings = {
261 [GPIOMUX_SUSPENDED] = &gsbi4,
262 },
263 },
264 {
265 .gpio = 16, /* GSBI5 I2C QUP SCL */
266 .settings = {
267 [GPIOMUX_SUSPENDED] = &gsbi5,
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700268 [GPIOMUX_ACTIVE] = &gsbi5,
Rohit Vaswania6815892011-12-15 20:20:39 -0800269 },
270 },
271 {
272 .gpio = 17, /* GSBI5 I2C QUP SDA */
273 .settings = {
274 [GPIOMUX_SUSPENDED] = &gsbi5,
275 },
276 },
277 {
278 /* GPIO 19 can be used for I2C/UART on GSBI5 */
279 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
280 .settings = {
281 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
282 },
283 },
284};
285
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700286static struct msm_gpiomux_config msm9615_slimbus_configs[] __initdata = {
287 {
288 .gpio = 20, /* Slimbus data */
289 .settings = {
290 [GPIOMUX_SUSPENDED] = &slimbus,
291 },
292 },
293 {
294 .gpio = 23, /* Slimbus clk */
295 .settings = {
296 [GPIOMUX_SUSPENDED] = &slimbus,
297 },
298 },
299};
300
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400301#ifdef CONFIG_FB_MSM_EBI2
302static struct msm_gpiomux_config msm9615_ebi2_lcdc_configs[] __initdata = {
303 {
304 .gpio = 21, /* a_d */
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_a_d,
307 },
308 },
309 {
310 .gpio = 22, /* cs */
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_cs,
313 },
314 },
315 {
316 .gpio = 24, /* rs */
317 .settings = {
318 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_rs,
319 },
320 },
321};
322#endif
323
Pavan Kumar27556502012-05-21 18:38:01 -0700324static struct msm_gpiomux_config msm9615_wlan_configs[] __initdata = {
325 {
326 .gpio = 21,/* WLAN_RESET_N */
327 .settings = {
328 [GPIOMUX_ACTIVE] = &wlan_active_config,
329 [GPIOMUX_SUSPENDED] = &wlan_suspend_config,
330 },
331 },
332};
333
334
Rohit Vaswania6815892011-12-15 20:20:39 -0800335int __init msm9615_init_gpiomux(void)
336{
337 int rc;
338
339 rc = msm_gpiomux_init(NR_GPIO_IRQS);
340 if (rc) {
341 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
342 return rc;
343 }
344 msm_gpiomux_install(msm9615_gsbi_configs,
345 ARRAY_SIZE(msm9615_gsbi_configs));
346
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700347 msm_gpiomux_install(msm9615_slimbus_configs,
348 ARRAY_SIZE(msm9615_slimbus_configs));
349
Rohit Vaswania6815892011-12-15 20:20:39 -0800350 msm_gpiomux_install(msm9615_ps_hold_config,
351 ARRAY_SIZE(msm9615_ps_hold_config));
352 msm_gpiomux_install(msm9615_sdcc2_configs,
353 ARRAY_SIZE(msm9615_sdcc2_configs));
354#ifdef CONFIG_LTC4088_CHARGER
355 msm_gpiomux_install(msm9615_ltc4088_charger_config,
356 ARRAY_SIZE(msm9615_ltc4088_charger_config));
357#endif
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800358 msm_gpiomux_install(msm9615_audio_codec_configs,
359 ARRAY_SIZE(msm9615_audio_codec_configs));
Rohit Vaswania6815892011-12-15 20:20:39 -0800360
Pavan Kumar27556502012-05-21 18:38:01 -0700361 msm_gpiomux_install(msm9615_wlan_configs,
362 ARRAY_SIZE(msm9615_wlan_configs));
363
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400364#ifdef CONFIG_FB_MSM_EBI2
365 msm_gpiomux_install(msm9615_ebi2_lcdc_configs,
366 ARRAY_SIZE(msm9615_ebi2_lcdc_configs));
367#endif
368
Rohit Vaswania6815892011-12-15 20:20:39 -0800369 return 0;
370}