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> |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 19 | #include <mach/socinfo.h> |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 20 | |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 21 | static struct gpiomux_setting gpio_spi_config = { |
| 22 | .func = GPIOMUX_FUNC_1, |
| 23 | .drv = GPIOMUX_DRV_6MA, |
| 24 | .pull = GPIOMUX_PULL_NONE, |
| 25 | }; |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 26 | static struct gpiomux_setting gpio_spi_susp_config = { |
| 27 | .func = GPIOMUX_FUNC_GPIO, |
| 28 | .drv = GPIOMUX_DRV_2MA, |
| 29 | .pull = GPIOMUX_PULL_DOWN, |
| 30 | }; |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 31 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 32 | static struct gpiomux_setting gpio_i2c_config = { |
| 33 | .func = GPIOMUX_FUNC_3, |
| 34 | .drv = GPIOMUX_DRV_2MA, |
| 35 | .pull = GPIOMUX_PULL_NONE, |
| 36 | }; |
| 37 | |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 38 | static struct gpiomux_setting gpio_cam_i2c_config = { |
| 39 | .func = GPIOMUX_FUNC_1, |
| 40 | .drv = GPIOMUX_DRV_2MA, |
| 41 | .pull = GPIOMUX_PULL_NONE, |
| 42 | }; |
| 43 | |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame] | 44 | static struct gpiomux_setting gpio_nfc_config = { |
| 45 | .func = GPIOMUX_FUNC_2, |
| 46 | .drv = GPIOMUX_DRV_2MA, |
| 47 | .pull = GPIOMUX_PULL_NONE, |
| 48 | }; |
| 49 | static struct gpiomux_setting gpio_nfc_sus_config = { |
| 50 | .func = GPIOMUX_FUNC_2, |
| 51 | .drv = GPIOMUX_DRV_2MA, |
| 52 | .pull = GPIOMUX_PULL_DOWN, |
| 53 | }; |
| 54 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 55 | static struct gpiomux_setting atmel_int_act_cfg = { |
| 56 | .func = GPIOMUX_FUNC_GPIO, |
| 57 | .drv = GPIOMUX_DRV_8MA, |
| 58 | .pull = GPIOMUX_PULL_UP, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 61 | static struct gpiomux_setting atmel_int_sus_cfg = { |
| 62 | .func = GPIOMUX_FUNC_GPIO, |
| 63 | .drv = GPIOMUX_DRV_2MA, |
| 64 | .pull = GPIOMUX_PULL_DOWN, |
| 65 | }; |
| 66 | |
| 67 | static struct gpiomux_setting atmel_reset_act_cfg = { |
| 68 | .func = GPIOMUX_FUNC_GPIO, |
| 69 | .drv = GPIOMUX_DRV_6MA, |
| 70 | .pull = GPIOMUX_PULL_UP, |
| 71 | }; |
| 72 | |
| 73 | static struct gpiomux_setting atmel_reset_sus_cfg = { |
| 74 | .func = GPIOMUX_FUNC_GPIO, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 75 | .drv = GPIOMUX_DRV_6MA, |
| 76 | .pull = GPIOMUX_PULL_DOWN, |
| 77 | }; |
| 78 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 79 | static struct gpiomux_setting focaltech_int_act_cfg = { |
| 80 | .func = GPIOMUX_FUNC_GPIO, |
| 81 | .drv = GPIOMUX_DRV_8MA, |
| 82 | .pull = GPIOMUX_PULL_UP, |
| 83 | }; |
| 84 | |
| 85 | static struct gpiomux_setting focaltech_int_sus_cfg = { |
| 86 | .func = GPIOMUX_FUNC_GPIO, |
| 87 | .drv = GPIOMUX_DRV_2MA, |
| 88 | .pull = GPIOMUX_PULL_DOWN, |
| 89 | }; |
| 90 | |
| 91 | static struct gpiomux_setting focaltech_reset_act_cfg = { |
| 92 | .func = GPIOMUX_FUNC_GPIO, |
| 93 | .drv = GPIOMUX_DRV_6MA, |
| 94 | .pull = GPIOMUX_PULL_UP, |
| 95 | }; |
| 96 | |
| 97 | static struct gpiomux_setting focaltech_reset_sus_cfg = { |
| 98 | .func = GPIOMUX_FUNC_GPIO, |
| 99 | .drv = GPIOMUX_DRV_6MA, |
| 100 | .pull = GPIOMUX_PULL_UP, |
| 101 | }; |
| 102 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 103 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 104 | .func = GPIOMUX_FUNC_GPIO, |
| 105 | .drv = GPIOMUX_DRV_2MA, |
| 106 | .pull = GPIOMUX_PULL_UP, |
| 107 | }; |
| 108 | |
| 109 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 110 | .func = GPIOMUX_FUNC_1, |
| 111 | .drv = GPIOMUX_DRV_6MA, |
| 112 | .pull = GPIOMUX_PULL_DOWN, |
| 113 | }; |
| 114 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 115 | static struct gpiomux_setting lcd_en_act_cfg = { |
| 116 | .func = GPIOMUX_FUNC_GPIO, |
| 117 | .drv = GPIOMUX_DRV_8MA, |
| 118 | .pull = GPIOMUX_PULL_NONE, |
| 119 | .dir = GPIOMUX_OUT_HIGH, |
| 120 | }; |
| 121 | |
| 122 | static struct gpiomux_setting lcd_en_sus_cfg = { |
| 123 | .func = GPIOMUX_FUNC_GPIO, |
| 124 | .drv = GPIOMUX_DRV_2MA, |
| 125 | .pull = GPIOMUX_PULL_DOWN, |
| 126 | }; |
| 127 | |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 128 | static struct gpiomux_setting lcd_te_act_config = { |
| 129 | .func = GPIOMUX_FUNC_1, |
| 130 | .drv = GPIOMUX_DRV_2MA, |
| 131 | .pull = GPIOMUX_PULL_DOWN, |
| 132 | .dir = GPIOMUX_IN, |
| 133 | }; |
| 134 | |
| 135 | static struct gpiomux_setting lcd_te_sus_config = { |
| 136 | .func = GPIOMUX_FUNC_1, |
| 137 | .drv = GPIOMUX_DRV_2MA, |
| 138 | .pull = GPIOMUX_PULL_DOWN, |
| 139 | .dir = GPIOMUX_IN, |
| 140 | }; |
| 141 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 142 | static struct gpiomux_setting gpio_keys_active = { |
| 143 | .func = GPIOMUX_FUNC_GPIO, |
| 144 | .drv = GPIOMUX_DRV_2MA, |
| 145 | .pull = GPIOMUX_PULL_UP, |
| 146 | }; |
| 147 | |
| 148 | static struct gpiomux_setting gpio_keys_suspend = { |
| 149 | .func = GPIOMUX_FUNC_GPIO, |
| 150 | .drv = GPIOMUX_DRV_2MA, |
| 151 | .pull = GPIOMUX_PULL_NONE, |
| 152 | }; |
| 153 | |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 154 | /* define gpio used as interrupt input */ |
| 155 | static struct gpiomux_setting gpio_int_act_cfg = { |
| 156 | .func = GPIOMUX_FUNC_GPIO, |
| 157 | .drv = GPIOMUX_DRV_2MA, |
| 158 | .pull = GPIOMUX_PULL_UP, |
| 159 | .dir = GPIOMUX_IN, |
| 160 | }; |
| 161 | |
| 162 | static struct gpiomux_setting gpio_int_sus_cfg = { |
| 163 | .func = GPIOMUX_FUNC_GPIO, |
| 164 | .drv = GPIOMUX_DRV_2MA, |
| 165 | .pull = GPIOMUX_PULL_UP, |
| 166 | .dir = GPIOMUX_IN, |
| 167 | }; |
| 168 | |
| 169 | static struct msm_gpiomux_config msm_gpio_int_configs[] __initdata = { |
| 170 | { |
| 171 | .gpio = 84, |
| 172 | .settings = { |
| 173 | [GPIOMUX_ACTIVE] = &gpio_int_act_cfg, |
| 174 | [GPIOMUX_SUSPENDED] = &gpio_int_sus_cfg, |
| 175 | }, |
| 176 | }, |
| 177 | }; |
| 178 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 179 | static struct msm_gpiomux_config msm_lcd_configs[] __initdata = { |
| 180 | { |
| 181 | .gpio = 41, |
| 182 | .settings = { |
| 183 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 184 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 185 | }, |
| 186 | }, |
| 187 | { |
| 188 | .gpio = 7, |
| 189 | .settings = { |
| 190 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 191 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 192 | }, |
| 193 | }, |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 194 | { |
| 195 | .gpio = 12, |
| 196 | .settings = { |
| 197 | [GPIOMUX_ACTIVE] = &lcd_te_act_config, |
| 198 | [GPIOMUX_SUSPENDED] = &lcd_te_sus_config, |
| 199 | }, |
| 200 | }, |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 201 | }; |
| 202 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 203 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 204 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 205 | .gpio = 2, /* BLSP1 QUP1 I2C_SDA */ |
| 206 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 207 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 208 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 209 | }, |
| 210 | }, |
| 211 | { |
| 212 | .gpio = 3, /* BLSP1 QUP1 I2C_SCL */ |
| 213 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 214 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 215 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 216 | }, |
| 217 | }, |
| 218 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 219 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 220 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 221 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 222 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 223 | }, |
| 224 | }, |
| 225 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 226 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 227 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 228 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 229 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 230 | }, |
| 231 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 232 | { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 233 | .gpio = 16, /* BLSP1 QUP6 I2C_SDA */ |
| 234 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 235 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 236 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 237 | }, |
| 238 | }, |
| 239 | { |
| 240 | .gpio = 17, /* BLSP1 QUP6 I2C_SCL */ |
| 241 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 242 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 243 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 244 | }, |
| 245 | }, |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame] | 246 | { |
| 247 | .gpio = 78, /* NFC CLK */ |
| 248 | .settings = { |
| 249 | [GPIOMUX_ACTIVE] = &gpio_nfc_config, |
| 250 | [GPIOMUX_SUSPENDED] = &gpio_nfc_sus_config, |
| 251 | }, |
| 252 | }, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 253 | }; |
| 254 | |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame^] | 255 | static struct gpiomux_setting gpio_i2c_nfc_pvt_config = { |
| 256 | .func = GPIOMUX_FUNC_5, /*active 1*/ /* 0 */ |
| 257 | .drv = GPIOMUX_DRV_2MA, |
| 258 | .pull = GPIOMUX_PULL_NONE, |
| 259 | }; |
| 260 | |
| 261 | static struct msm_gpiomux_config msm_nfc_configs[] __initdata = { |
| 262 | { |
| 263 | .gpio = 8, /* BLSP1 QUP2 I2C_SDA */ |
| 264 | .settings = { |
| 265 | [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config, |
| 266 | [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config, |
| 267 | }, |
| 268 | }, |
| 269 | { |
| 270 | .gpio = 9, /* BLSP1 QUP2 I2C_SCL */ |
| 271 | .settings = { |
| 272 | [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config, |
| 273 | [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config, |
| 274 | }, |
| 275 | }, |
| 276 | }; |
| 277 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 278 | static struct msm_gpiomux_config msm_atmel_configs[] __initdata = { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 279 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 280 | .gpio = 0, /* TOUCH RESET */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 281 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 282 | [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg, |
| 283 | [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 284 | }, |
| 285 | }, |
| 286 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 287 | .gpio = 1, /* TOUCH INT */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 288 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 289 | [GPIOMUX_ACTIVE] = &atmel_int_act_cfg, |
| 290 | [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 291 | }, |
| 292 | }, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 293 | { |
| 294 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 295 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 296 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 297 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 298 | }, |
| 299 | }, |
| 300 | { |
| 301 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 302 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 303 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 304 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 305 | }, |
| 306 | }, |
| 307 | { |
| 308 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 309 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 310 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 311 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 312 | }, |
| 313 | }, |
| 314 | { |
| 315 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 316 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 317 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 318 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 319 | }, |
| 320 | }, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 321 | }; |
| 322 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 323 | static struct msm_gpiomux_config msm_focaltech_configs[] __initdata = { |
| 324 | { |
| 325 | .gpio = 0, /* TOUCH RESET */ |
| 326 | .settings = { |
| 327 | [GPIOMUX_ACTIVE] = &focaltech_reset_act_cfg, |
| 328 | [GPIOMUX_SUSPENDED] = &focaltech_reset_sus_cfg, |
| 329 | }, |
| 330 | }, |
| 331 | { |
| 332 | .gpio = 1, /* TOUCH INT */ |
| 333 | .settings = { |
| 334 | [GPIOMUX_ACTIVE] = &focaltech_int_act_cfg, |
| 335 | [GPIOMUX_SUSPENDED] = &focaltech_int_sus_cfg, |
| 336 | }, |
| 337 | }, |
| 338 | { |
| 339 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 340 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 341 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 342 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 343 | }, |
| 344 | }, |
| 345 | { |
| 346 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 347 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 348 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 349 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 350 | }, |
| 351 | }, |
| 352 | { |
| 353 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 354 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 355 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 356 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 357 | }, |
| 358 | }, |
| 359 | { |
| 360 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 361 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 362 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 363 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 364 | }, |
| 365 | }, |
| 366 | }; |
| 367 | |
| 368 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 369 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 370 | { |
| 371 | .gpio = 23, |
| 372 | .settings = { |
| 373 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 374 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 375 | }, |
| 376 | }, |
| 377 | { |
| 378 | .gpio = 24, |
| 379 | .settings = { |
| 380 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 381 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 382 | }, |
| 383 | }, |
| 384 | { |
| 385 | .gpio = 25, |
| 386 | .settings = { |
| 387 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 388 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 389 | }, |
| 390 | }, |
| 391 | { |
| 392 | .gpio = 26, |
| 393 | .settings = { |
| 394 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 395 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 396 | }, |
| 397 | }, |
| 398 | { |
| 399 | .gpio = 27, |
| 400 | .settings = { |
| 401 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 402 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 403 | }, |
| 404 | }, |
| 405 | }; |
| 406 | |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 407 | static struct gpiomux_setting gpio_suspend_config[] = { |
| 408 | { |
| 409 | .func = GPIOMUX_FUNC_GPIO, /* IN-NP */ |
| 410 | .drv = GPIOMUX_DRV_2MA, |
| 411 | .pull = GPIOMUX_PULL_NONE, |
| 412 | }, |
| 413 | { |
| 414 | .func = GPIOMUX_FUNC_GPIO, /* O-LOW */ |
| 415 | .drv = GPIOMUX_DRV_2MA, |
| 416 | .pull = GPIOMUX_PULL_NONE, |
| 417 | .dir = GPIOMUX_OUT_LOW, |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct gpiomux_setting cam_settings[] = { |
| 422 | { |
| 423 | .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */ |
| 424 | .drv = GPIOMUX_DRV_2MA, |
| 425 | .pull = GPIOMUX_PULL_NONE, |
| 426 | }, |
| 427 | |
| 428 | { |
| 429 | .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */ |
| 430 | .drv = GPIOMUX_DRV_2MA, |
| 431 | .pull = GPIOMUX_PULL_DOWN, |
| 432 | }, |
| 433 | |
| 434 | { |
| 435 | .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */ |
| 436 | .drv = GPIOMUX_DRV_2MA, |
| 437 | .pull = GPIOMUX_PULL_KEEPER, |
| 438 | }, |
| 439 | |
| 440 | { |
| 441 | .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */ |
| 442 | .drv = GPIOMUX_DRV_2MA, |
| 443 | .pull = GPIOMUX_PULL_NONE, |
| 444 | }, |
| 445 | |
| 446 | { |
| 447 | .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */ |
| 448 | .drv = GPIOMUX_DRV_2MA, |
| 449 | .pull = GPIOMUX_PULL_DOWN, |
| 450 | }, |
| 451 | }; |
| 452 | |
| 453 | static struct msm_gpiomux_config msm_sensor_configs[] __initdata = { |
| 454 | { |
| 455 | .gpio = 13, /* CAM_MCLK0 */ |
| 456 | .settings = { |
| 457 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 458 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 459 | }, |
| 460 | }, |
| 461 | { |
| 462 | .gpio = 14, /* CAM_MCLK1 */ |
| 463 | .settings = { |
| 464 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 465 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 466 | }, |
| 467 | }, |
| 468 | { |
| 469 | .gpio = 16, /* CCI_I2C_SDA */ |
| 470 | .settings = { |
| 471 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 472 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 473 | }, |
| 474 | }, |
| 475 | { |
| 476 | .gpio = 17, /* CCI_I2C_SCL */ |
| 477 | .settings = { |
| 478 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 479 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 480 | }, |
| 481 | }, |
| 482 | { |
| 483 | .gpio = 18, /* FLASH_LED_EN */ |
| 484 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 485 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 486 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 487 | }, |
| 488 | }, |
| 489 | { |
| 490 | .gpio = 19, /* FLASH_LED_NOW */ |
| 491 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 492 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 493 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 494 | }, |
| 495 | }, |
| 496 | { |
| 497 | .gpio = 8, /* CAM1_STANDBY_N */ |
| 498 | .settings = { |
| 499 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 500 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 501 | }, |
| 502 | }, |
| 503 | { |
| 504 | .gpio = 15, /* CAM1_RST_N */ |
| 505 | .settings = { |
| 506 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 507 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 508 | }, |
| 509 | }, |
| 510 | { |
| 511 | .gpio = 20, /* WEBCAM1_STANDBY */ |
| 512 | .settings = { |
| 513 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 514 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 515 | }, |
| 516 | }, |
| 517 | { |
| 518 | .gpio = 21, /* WEBCAM2_RESET_N */ |
| 519 | .settings = { |
| 520 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 521 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 522 | }, |
| 523 | }, |
| 524 | }; |
| 525 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 526 | static struct msm_gpiomux_config msm_keypad_configs[] __initdata = { |
| 527 | { |
| 528 | .gpio = 72, |
| 529 | .settings = { |
| 530 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 531 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 532 | }, |
| 533 | }, |
| 534 | { |
| 535 | .gpio = 73, |
| 536 | .settings = { |
| 537 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 538 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 539 | }, |
| 540 | }, |
| 541 | { |
| 542 | .gpio = 74, |
| 543 | .settings = { |
| 544 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 545 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 546 | }, |
| 547 | }, |
| 548 | }; |
| 549 | |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 550 | static struct gpiomux_setting sd_card_det_active_config = { |
| 551 | .func = GPIOMUX_FUNC_GPIO, |
| 552 | .drv = GPIOMUX_DRV_2MA, |
| 553 | .pull = GPIOMUX_PULL_NONE, |
| 554 | .dir = GPIOMUX_IN, |
| 555 | }; |
| 556 | |
| 557 | static struct gpiomux_setting sd_card_det_suspend_config = { |
| 558 | .func = GPIOMUX_FUNC_GPIO, |
| 559 | .drv = GPIOMUX_DRV_2MA, |
| 560 | .pull = GPIOMUX_PULL_UP, |
| 561 | .dir = GPIOMUX_IN, |
| 562 | }; |
| 563 | |
| 564 | static struct msm_gpiomux_config sd_card_det[] __initdata = { |
| 565 | { |
| 566 | .gpio = 42, |
| 567 | .settings = { |
| 568 | [GPIOMUX_ACTIVE] = &sd_card_det_active_config, |
| 569 | [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config, |
| 570 | }, |
| 571 | }, |
| 572 | }; |
| 573 | |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 574 | static struct gpiomux_setting interrupt_gpio_active = { |
| 575 | .func = GPIOMUX_FUNC_GPIO, |
| 576 | .drv = GPIOMUX_DRV_6MA, |
| 577 | .pull = GPIOMUX_PULL_UP, |
| 578 | }; |
| 579 | |
| 580 | static struct gpiomux_setting interrupt_gpio_suspend_pullup = { |
| 581 | .func = GPIOMUX_FUNC_GPIO, |
| 582 | .drv = GPIOMUX_DRV_6MA, |
| 583 | .pull = GPIOMUX_PULL_UP, |
| 584 | }; |
| 585 | |
| 586 | static struct gpiomux_setting interrupt_gpio_suspend_pulldown = { |
| 587 | .func = GPIOMUX_FUNC_GPIO, |
| 588 | .drv = GPIOMUX_DRV_6MA, |
| 589 | .pull = GPIOMUX_PULL_UP, |
| 590 | }; |
| 591 | |
| 592 | static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = { |
| 593 | { |
| 594 | .gpio = 77, /* NFC_IRQ */ |
| 595 | .settings = { |
| 596 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 597 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 598 | }, |
| 599 | }, |
| 600 | { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 601 | .gpio = 80, /*ALSP_INT */ |
| 602 | .settings = { |
| 603 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 604 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 605 | }, |
| 606 | }, |
| 607 | { |
| 608 | .gpio = 81, /*ACCEL_INT1 */ |
| 609 | .settings = { |
| 610 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 611 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 612 | }, |
| 613 | }, |
| 614 | { |
| 615 | .gpio = 82, /*ACCEL_INT2 */ |
| 616 | .settings = { |
| 617 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 618 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 619 | }, |
| 620 | }, |
| 621 | }; |
| 622 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 623 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 624 | { |
| 625 | int rc; |
| 626 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 627 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 628 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 629 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 630 | return; |
| 631 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 632 | |
| 633 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 634 | if (of_board_is_qrd()) { |
| 635 | msm_gpiomux_install(msm_focaltech_configs, |
| 636 | ARRAY_SIZE(msm_focaltech_configs)); |
| 637 | } else { |
| 638 | msm_gpiomux_install(msm_atmel_configs, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 639 | ARRAY_SIZE(msm_atmel_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 640 | } |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 641 | msm_gpiomux_install(wcnss_5wire_interface, |
| 642 | ARRAY_SIZE(wcnss_5wire_interface)); |
Xiaoming Zhou | a329c94 | 2013-07-10 10:32:20 -0400 | [diff] [blame] | 643 | msm_gpiomux_install_nowrite(msm_lcd_configs, |
| 644 | ARRAY_SIZE(msm_lcd_configs)); |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 645 | msm_gpiomux_install(msm_keypad_configs, |
| 646 | ARRAY_SIZE(msm_keypad_configs)); |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 647 | msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det)); |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 648 | msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs)); |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 649 | msm_gpiomux_install(msm_gpio_int_configs, |
| 650 | ARRAY_SIZE(msm_gpio_int_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame^] | 651 | if (of_board_is_qrd()) { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 652 | msm_gpiomux_install(msm_interrupt_configs, |
| 653 | ARRAY_SIZE(msm_interrupt_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame^] | 654 | msm_gpiomux_install(msm_nfc_configs, |
| 655 | ARRAY_SIZE(msm_nfc_configs)); |
| 656 | } |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 657 | } |