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