Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 2 | * |
| 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 Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 20 | static struct gpiomux_setting gpio_spi_config = { |
| 21 | .func = GPIOMUX_FUNC_1, |
| 22 | .drv = GPIOMUX_DRV_6MA, |
| 23 | .pull = GPIOMUX_PULL_NONE, |
| 24 | }; |
| 25 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 26 | static struct gpiomux_setting gpio_i2c_config = { |
| 27 | .func = GPIOMUX_FUNC_3, |
| 28 | .drv = GPIOMUX_DRV_2MA, |
| 29 | .pull = GPIOMUX_PULL_NONE, |
| 30 | }; |
| 31 | |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 32 | static struct gpiomux_setting gpio_cam_i2c_config = { |
| 33 | .func = GPIOMUX_FUNC_1, |
| 34 | .drv = GPIOMUX_DRV_2MA, |
| 35 | .pull = GPIOMUX_PULL_NONE, |
| 36 | }; |
| 37 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 38 | static struct gpiomux_setting atmel_int_act_cfg = { |
| 39 | .func = GPIOMUX_FUNC_GPIO, |
| 40 | .drv = GPIOMUX_DRV_8MA, |
| 41 | .pull = GPIOMUX_PULL_UP, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 44 | static struct gpiomux_setting atmel_int_sus_cfg = { |
| 45 | .func = GPIOMUX_FUNC_GPIO, |
| 46 | .drv = GPIOMUX_DRV_2MA, |
| 47 | .pull = GPIOMUX_PULL_DOWN, |
| 48 | }; |
| 49 | |
| 50 | static struct gpiomux_setting atmel_reset_act_cfg = { |
| 51 | .func = GPIOMUX_FUNC_GPIO, |
| 52 | .drv = GPIOMUX_DRV_6MA, |
| 53 | .pull = GPIOMUX_PULL_UP, |
| 54 | }; |
| 55 | |
| 56 | static struct gpiomux_setting atmel_reset_sus_cfg = { |
| 57 | .func = GPIOMUX_FUNC_GPIO, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 58 | .drv = GPIOMUX_DRV_6MA, |
| 59 | .pull = GPIOMUX_PULL_DOWN, |
| 60 | }; |
| 61 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 62 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 63 | .func = GPIOMUX_FUNC_GPIO, |
| 64 | .drv = GPIOMUX_DRV_2MA, |
| 65 | .pull = GPIOMUX_PULL_UP, |
| 66 | }; |
| 67 | |
| 68 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 69 | .func = GPIOMUX_FUNC_1, |
| 70 | .drv = GPIOMUX_DRV_6MA, |
| 71 | .pull = GPIOMUX_PULL_DOWN, |
| 72 | }; |
| 73 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 74 | static struct gpiomux_setting lcd_en_act_cfg = { |
| 75 | .func = GPIOMUX_FUNC_GPIO, |
| 76 | .drv = GPIOMUX_DRV_8MA, |
| 77 | .pull = GPIOMUX_PULL_NONE, |
| 78 | .dir = GPIOMUX_OUT_HIGH, |
| 79 | }; |
| 80 | |
| 81 | static struct gpiomux_setting lcd_en_sus_cfg = { |
| 82 | .func = GPIOMUX_FUNC_GPIO, |
| 83 | .drv = GPIOMUX_DRV_2MA, |
| 84 | .pull = GPIOMUX_PULL_DOWN, |
| 85 | }; |
| 86 | |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame^] | 87 | static struct gpiomux_setting lcd_te_act_config = { |
| 88 | .func = GPIOMUX_FUNC_1, |
| 89 | .drv = GPIOMUX_DRV_2MA, |
| 90 | .pull = GPIOMUX_PULL_DOWN, |
| 91 | .dir = GPIOMUX_IN, |
| 92 | }; |
| 93 | |
| 94 | static struct gpiomux_setting lcd_te_sus_config = { |
| 95 | .func = GPIOMUX_FUNC_1, |
| 96 | .drv = GPIOMUX_DRV_2MA, |
| 97 | .pull = GPIOMUX_PULL_DOWN, |
| 98 | .dir = GPIOMUX_IN, |
| 99 | }; |
| 100 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 101 | static struct gpiomux_setting gpio_keys_active = { |
| 102 | .func = GPIOMUX_FUNC_GPIO, |
| 103 | .drv = GPIOMUX_DRV_2MA, |
| 104 | .pull = GPIOMUX_PULL_UP, |
| 105 | }; |
| 106 | |
| 107 | static struct gpiomux_setting gpio_keys_suspend = { |
| 108 | .func = GPIOMUX_FUNC_GPIO, |
| 109 | .drv = GPIOMUX_DRV_2MA, |
| 110 | .pull = GPIOMUX_PULL_NONE, |
| 111 | }; |
| 112 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 113 | static struct msm_gpiomux_config msm_lcd_configs[] __initdata = { |
| 114 | { |
| 115 | .gpio = 41, |
| 116 | .settings = { |
| 117 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 118 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 119 | }, |
| 120 | }, |
| 121 | { |
| 122 | .gpio = 7, |
| 123 | .settings = { |
| 124 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 125 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 126 | }, |
| 127 | }, |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame^] | 128 | { |
| 129 | .gpio = 12, |
| 130 | .settings = { |
| 131 | [GPIOMUX_ACTIVE] = &lcd_te_act_config, |
| 132 | [GPIOMUX_SUSPENDED] = &lcd_te_sus_config, |
| 133 | }, |
| 134 | }, |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 135 | }; |
| 136 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 137 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 138 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 139 | .gpio = 2, /* BLSP1 QUP1 I2C_SDA */ |
| 140 | .settings = { |
| 141 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 142 | }, |
| 143 | }, |
| 144 | { |
| 145 | .gpio = 3, /* BLSP1 QUP1 I2C_SCL */ |
| 146 | .settings = { |
| 147 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 148 | }, |
| 149 | }, |
| 150 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 151 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 152 | .settings = { |
| 153 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 154 | }, |
| 155 | }, |
| 156 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 157 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 158 | .settings = { |
| 159 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 160 | }, |
| 161 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 162 | { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 163 | .gpio = 16, /* BLSP1 QUP6 I2C_SDA */ |
| 164 | .settings = { |
| 165 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 166 | }, |
| 167 | }, |
| 168 | { |
| 169 | .gpio = 17, /* BLSP1 QUP6 I2C_SCL */ |
| 170 | .settings = { |
| 171 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 172 | }, |
| 173 | }, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | static struct msm_gpiomux_config msm_atmel_configs[] __initdata = { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 177 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 178 | .gpio = 0, /* TOUCH RESET */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 179 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 180 | [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg, |
| 181 | [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 182 | }, |
| 183 | }, |
| 184 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 185 | .gpio = 1, /* TOUCH INT */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 186 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 187 | [GPIOMUX_ACTIVE] = &atmel_int_act_cfg, |
| 188 | [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 189 | }, |
| 190 | }, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 191 | { |
| 192 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 193 | .settings = { |
| 194 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 195 | }, |
| 196 | }, |
| 197 | { |
| 198 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 199 | .settings = { |
| 200 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 201 | }, |
| 202 | }, |
| 203 | { |
| 204 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 205 | .settings = { |
| 206 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 207 | }, |
| 208 | }, |
| 209 | { |
| 210 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 211 | .settings = { |
| 212 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 213 | }, |
| 214 | }, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 215 | }; |
| 216 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 217 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 218 | { |
| 219 | .gpio = 23, |
| 220 | .settings = { |
| 221 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 222 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 223 | }, |
| 224 | }, |
| 225 | { |
| 226 | .gpio = 24, |
| 227 | .settings = { |
| 228 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 229 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 230 | }, |
| 231 | }, |
| 232 | { |
| 233 | .gpio = 25, |
| 234 | .settings = { |
| 235 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 236 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 237 | }, |
| 238 | }, |
| 239 | { |
| 240 | .gpio = 26, |
| 241 | .settings = { |
| 242 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 243 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 244 | }, |
| 245 | }, |
| 246 | { |
| 247 | .gpio = 27, |
| 248 | .settings = { |
| 249 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 250 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 251 | }, |
| 252 | }, |
| 253 | }; |
| 254 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 255 | static struct msm_gpiomux_config msm_keypad_configs[] __initdata = { |
| 256 | { |
| 257 | .gpio = 72, |
| 258 | .settings = { |
| 259 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 260 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 261 | }, |
| 262 | }, |
| 263 | { |
| 264 | .gpio = 73, |
| 265 | .settings = { |
| 266 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 267 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 268 | }, |
| 269 | }, |
| 270 | { |
| 271 | .gpio = 74, |
| 272 | .settings = { |
| 273 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 274 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 275 | }, |
| 276 | }, |
| 277 | }; |
| 278 | |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 279 | static struct gpiomux_setting sd_card_det_active_config = { |
| 280 | .func = GPIOMUX_FUNC_GPIO, |
| 281 | .drv = GPIOMUX_DRV_2MA, |
| 282 | .pull = GPIOMUX_PULL_NONE, |
| 283 | .dir = GPIOMUX_IN, |
| 284 | }; |
| 285 | |
| 286 | static struct gpiomux_setting sd_card_det_suspend_config = { |
| 287 | .func = GPIOMUX_FUNC_GPIO, |
| 288 | .drv = GPIOMUX_DRV_2MA, |
| 289 | .pull = GPIOMUX_PULL_UP, |
| 290 | .dir = GPIOMUX_IN, |
| 291 | }; |
| 292 | |
| 293 | static struct msm_gpiomux_config sd_card_det[] __initdata = { |
| 294 | { |
| 295 | .gpio = 42, |
| 296 | .settings = { |
| 297 | [GPIOMUX_ACTIVE] = &sd_card_det_active_config, |
| 298 | [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config, |
| 299 | }, |
| 300 | }, |
| 301 | }; |
| 302 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 303 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 304 | { |
| 305 | int rc; |
| 306 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 307 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 308 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 309 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 310 | return; |
| 311 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 312 | |
| 313 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 314 | msm_gpiomux_install(msm_atmel_configs, |
| 315 | ARRAY_SIZE(msm_atmel_configs)); |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 316 | msm_gpiomux_install(wcnss_5wire_interface, |
| 317 | ARRAY_SIZE(wcnss_5wire_interface)); |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 318 | msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs)); |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 319 | msm_gpiomux_install(msm_keypad_configs, |
| 320 | ARRAY_SIZE(msm_keypad_configs)); |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 321 | msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det)); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 322 | } |