blob: 3aecff62c731cb3f4f62330997baee3cdcbaeb63 [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
Gilad Avidovf58f1832013-01-09 17:31:28 -070026static struct gpiomux_setting gpio_spi_config = {
27 .func = GPIOMUX_FUNC_1,
28 .drv = GPIOMUX_DRV_6MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
32static struct gpiomux_setting gpio_spi_cs_config = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_6MA,
35 .pull = GPIOMUX_PULL_DOWN,
36};
37
Sameer Thalappil1fafd672013-04-03 12:31:04 -070038static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
39 .func = GPIOMUX_FUNC_GPIO,
40 .drv = GPIOMUX_DRV_2MA,
41 .pull = GPIOMUX_PULL_UP,
42};
43
44static struct gpiomux_setting wcnss_5wire_active_cfg = {
45 .func = GPIOMUX_FUNC_1,
46 .drv = GPIOMUX_DRV_6MA,
47 .pull = GPIOMUX_PULL_DOWN,
48};
49
Xiaoming Zhou17972262013-04-10 17:50:35 -040050static struct gpiomux_setting lcd_en_act_cfg = {
51 .func = GPIOMUX_FUNC_GPIO,
52 .drv = GPIOMUX_DRV_8MA,
53 .pull = GPIOMUX_PULL_NONE,
54 .dir = GPIOMUX_OUT_HIGH,
55};
56
57static struct gpiomux_setting lcd_en_sus_cfg = {
58 .func = GPIOMUX_FUNC_GPIO,
59 .drv = GPIOMUX_DRV_2MA,
60 .pull = GPIOMUX_PULL_DOWN,
61};
62
Amy Maloche19c386b2013-04-15 14:06:01 -070063static struct gpiomux_setting gpio_keys_active = {
64 .func = GPIOMUX_FUNC_GPIO,
65 .drv = GPIOMUX_DRV_2MA,
66 .pull = GPIOMUX_PULL_UP,
67};
68
69static struct gpiomux_setting gpio_keys_suspend = {
70 .func = GPIOMUX_FUNC_GPIO,
71 .drv = GPIOMUX_DRV_2MA,
72 .pull = GPIOMUX_PULL_NONE,
73};
74
Xiaoming Zhou17972262013-04-10 17:50:35 -040075static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
76 {
77 .gpio = 41,
78 .settings = {
79 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
80 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
81 },
82 },
83 {
84 .gpio = 7,
85 .settings = {
86 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
87 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
88 },
89 },
90};
91
Gilad Avidovf84f2792013-01-31 13:26:39 -070092static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
93 {
Gilad Avidovf58f1832013-01-09 17:31:28 -070094 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -070095 .settings = {
96 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
97 },
98 },
99 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700100 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700101 .settings = {
102 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
103 },
104 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700105 {
106 .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
107 .settings = {
108 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
109 },
110 },
111 {
112 .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
113 .settings = {
114 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
115 },
116 },
117 {
118 .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
119 .settings = {
120 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
121 },
122 },
123 {
124 .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
125 .settings = {
126 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
127 },
128 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700129};
130
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700131static struct msm_gpiomux_config wcnss_5wire_interface[] = {
132 {
133 .gpio = 23,
134 .settings = {
135 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
136 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
137 },
138 },
139 {
140 .gpio = 24,
141 .settings = {
142 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
143 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
144 },
145 },
146 {
147 .gpio = 25,
148 .settings = {
149 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
150 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
151 },
152 },
153 {
154 .gpio = 26,
155 .settings = {
156 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
157 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
158 },
159 },
160 {
161 .gpio = 27,
162 .settings = {
163 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
164 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
165 },
166 },
167};
168
Amy Maloche19c386b2013-04-15 14:06:01 -0700169static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
170 {
171 .gpio = 72,
172 .settings = {
173 [GPIOMUX_ACTIVE] = &gpio_keys_active,
174 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
175 },
176 },
177 {
178 .gpio = 73,
179 .settings = {
180 [GPIOMUX_ACTIVE] = &gpio_keys_active,
181 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
182 },
183 },
184 {
185 .gpio = 74,
186 .settings = {
187 [GPIOMUX_ACTIVE] = &gpio_keys_active,
188 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
189 },
190 },
191};
192
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800193void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800194{
195 int rc;
196
Rohit Vaswani341c2032012-11-08 18:49:29 -0800197 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800198 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800199 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800200 return;
201 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700202
203 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700204 msm_gpiomux_install(wcnss_5wire_interface,
205 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhou17972262013-04-10 17:50:35 -0400206 msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700207 msm_gpiomux_install(msm_keypad_configs,
208 ARRAY_SIZE(msm_keypad_configs));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800209}