blob: eada62cf08f2fdb978367fe96a7bc71b246eb6f5 [file] [log] [blame]
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Hanumant Singh55a1bb02012-11-06 10:01:15 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
19
Gilad Avidovf84f2792013-01-31 13:26:39 -070020static struct gpiomux_setting gpio_i2c_config = {
21 .func = GPIOMUX_FUNC_3,
22 .drv = GPIOMUX_DRV_2MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -060026static struct gpiomux_setting gpio_cam_i2c_config = {
27 .func = GPIOMUX_FUNC_1,
28 .drv = GPIOMUX_DRV_2MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
Gilad Avidovf58f1832013-01-09 17:31:28 -070032static struct gpiomux_setting gpio_spi_config = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_6MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
38static struct gpiomux_setting gpio_spi_cs_config = {
39 .func = GPIOMUX_FUNC_1,
40 .drv = GPIOMUX_DRV_6MA,
41 .pull = GPIOMUX_PULL_DOWN,
42};
43
Sameer Thalappil1fafd672013-04-03 12:31:04 -070044static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
45 .func = GPIOMUX_FUNC_GPIO,
46 .drv = GPIOMUX_DRV_2MA,
47 .pull = GPIOMUX_PULL_UP,
48};
49
50static struct gpiomux_setting wcnss_5wire_active_cfg = {
51 .func = GPIOMUX_FUNC_1,
52 .drv = GPIOMUX_DRV_6MA,
53 .pull = GPIOMUX_PULL_DOWN,
54};
55
Xiaoming Zhou17972262013-04-10 17:50:35 -040056static struct gpiomux_setting lcd_en_act_cfg = {
57 .func = GPIOMUX_FUNC_GPIO,
58 .drv = GPIOMUX_DRV_8MA,
59 .pull = GPIOMUX_PULL_NONE,
60 .dir = GPIOMUX_OUT_HIGH,
61};
62
63static struct gpiomux_setting lcd_en_sus_cfg = {
64 .func = GPIOMUX_FUNC_GPIO,
65 .drv = GPIOMUX_DRV_2MA,
66 .pull = GPIOMUX_PULL_DOWN,
67};
68
Amy Maloche19c386b2013-04-15 14:06:01 -070069static struct gpiomux_setting gpio_keys_active = {
70 .func = GPIOMUX_FUNC_GPIO,
71 .drv = GPIOMUX_DRV_2MA,
72 .pull = GPIOMUX_PULL_UP,
73};
74
75static struct gpiomux_setting gpio_keys_suspend = {
76 .func = GPIOMUX_FUNC_GPIO,
77 .drv = GPIOMUX_DRV_2MA,
78 .pull = GPIOMUX_PULL_NONE,
79};
80
Xiaoming Zhou17972262013-04-10 17:50:35 -040081static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
82 {
83 .gpio = 41,
84 .settings = {
85 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
86 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
87 },
88 },
89 {
90 .gpio = 7,
91 .settings = {
92 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
93 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
94 },
95 },
96};
97
Gilad Avidovf84f2792013-01-31 13:26:39 -070098static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
99 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700100 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700101 .settings = {
102 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
103 },
104 },
105 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700106 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700107 .settings = {
108 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
109 },
110 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700111 {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600112 .gpio = 16, /* BLSP1 QUP6 I2C_SDA */
113 .settings = {
114 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
115 },
116 },
117 {
118 .gpio = 17, /* BLSP1 QUP6 I2C_SCL */
119 .settings = {
120 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
121 },
122 },
123 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700124 .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
125 .settings = {
126 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
127 },
128 },
129 {
130 .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
131 .settings = {
132 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
133 },
134 },
135 {
136 .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
137 .settings = {
138 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
139 },
140 },
141 {
142 .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
143 .settings = {
144 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
145 },
146 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700147};
148
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700149static struct msm_gpiomux_config wcnss_5wire_interface[] = {
150 {
151 .gpio = 23,
152 .settings = {
153 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
154 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
155 },
156 },
157 {
158 .gpio = 24,
159 .settings = {
160 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
161 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
162 },
163 },
164 {
165 .gpio = 25,
166 .settings = {
167 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
168 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
169 },
170 },
171 {
172 .gpio = 26,
173 .settings = {
174 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
175 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
176 },
177 },
178 {
179 .gpio = 27,
180 .settings = {
181 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
182 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
183 },
184 },
185};
186
Amy Maloche19c386b2013-04-15 14:06:01 -0700187static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
188 {
189 .gpio = 72,
190 .settings = {
191 [GPIOMUX_ACTIVE] = &gpio_keys_active,
192 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
193 },
194 },
195 {
196 .gpio = 73,
197 .settings = {
198 [GPIOMUX_ACTIVE] = &gpio_keys_active,
199 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
200 },
201 },
202 {
203 .gpio = 74,
204 .settings = {
205 [GPIOMUX_ACTIVE] = &gpio_keys_active,
206 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
207 },
208 },
209};
210
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800211void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800212{
213 int rc;
214
Rohit Vaswani341c2032012-11-08 18:49:29 -0800215 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800216 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800217 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800218 return;
219 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700220
221 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700222 msm_gpiomux_install(wcnss_5wire_interface,
223 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhou17972262013-04-10 17:50:35 -0400224 msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700225 msm_gpiomux_install(msm_keypad_configs,
226 ARRAY_SIZE(msm_keypad_configs));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800227}