Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 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 | #include <linux/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/gpio_event.h> |
| 15 | #include <asm/mach-types.h> |
| 16 | #include <asm/mach/arch.h> |
| 17 | #include <mach/board.h> |
| 18 | #include <mach/msm_iomap.h> |
| 19 | #include <mach/msm_hsusb.h> |
| 20 | #include <mach/rpc_hsusb.h> |
| 21 | #include <mach/rpc_pmapp.h> |
| 22 | #include <mach/usbdiag.h> |
| 23 | #include <mach/msm_memtypes.h> |
| 24 | #include <mach/msm_serial_hs.h> |
| 25 | #include <linux/usb/android.h> |
| 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/io.h> |
| 28 | #include <linux/gpio.h> |
| 29 | #include <mach/vreg.h> |
| 30 | #include <mach/pmic.h> |
| 31 | #include <mach/socinfo.h> |
| 32 | #include <linux/mtd/nand.h> |
| 33 | #include <linux/mtd/partitions.h> |
| 34 | #include <asm/mach/mmc.h> |
| 35 | #include <linux/i2c.h> |
| 36 | #include <linux/i2c/sx150x.h> |
| 37 | #include <linux/gpio.h> |
| 38 | #include <linux/android_pmem.h> |
| 39 | #include <linux/bootmem.h> |
| 40 | #include <linux/mfd/marimba.h> |
| 41 | #include <mach/vreg.h> |
| 42 | #include <linux/power_supply.h> |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 43 | #include <linux/regulator/consumer.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 44 | #include <mach/rpc_pmapp.h> |
| 45 | |
| 46 | #include <mach/msm_battery.h> |
| 47 | #include <linux/smsc911x.h> |
| 48 | #include <linux/atmel_maxtouch.h> |
| 49 | #include "devices.h" |
| 50 | #include "timer.h" |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 51 | #include "board-msm7x27a-regulator.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 52 | #include "devices-msm7x2xa.h" |
| 53 | #include "pm.h" |
| 54 | #include <mach/rpc_server_handset.h> |
| 55 | #include <mach/socinfo.h> |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 56 | #include "pm-boot.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | |
| 58 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
| 59 | #define MSM_PMEM_AUDIO_SIZE 0x5B000 |
| 60 | #define BAHAMA_SLAVE_ID_FM_ADDR 0x2A |
| 61 | #define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 62 | #define BAHAMA_SLAVE_ID_FM_REG 0x02 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 63 | #define FM_GPIO 83 |
| 64 | |
| 65 | enum { |
| 66 | GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS, |
| 67 | GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS, |
| 68 | /* SURF expander */ |
| 69 | GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE, |
| 70 | GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE, |
| 71 | GPIO_WLAN_EXT_POR_N, |
| 72 | GPIO_DISPLAY_PWR_EN, |
| 73 | GPIO_BACKLIGHT_EN, |
| 74 | GPIO_PRESSURE_XCLR, |
| 75 | GPIO_VREG_S3_EXP, |
| 76 | GPIO_UBM2M_PWRDWN, |
| 77 | GPIO_ETM_MODE_CS_N, |
| 78 | GPIO_HOST_VBUS_EN, |
| 79 | GPIO_SPI_MOSI, |
| 80 | GPIO_SPI_MISO, |
| 81 | GPIO_SPI_CLK, |
| 82 | GPIO_SPI_CS0_N, |
| 83 | GPIO_CORE_EXPANDER_IO13, |
| 84 | GPIO_CORE_EXPANDER_IO14, |
| 85 | GPIO_CORE_EXPANDER_IO15, |
| 86 | /* Camera expander */ |
| 87 | GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16, |
| 88 | GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE, |
| 89 | GPIO_CAM_GP_AFBUSY, |
| 90 | GPIO_CAM_GP_CAM_PWDN, |
| 91 | GPIO_CAM_GP_CAM1MP_XCLR, |
| 92 | GPIO_CAM_GP_CAMIF_RESET_N, |
| 93 | GPIO_CAM_GP_STROBE_CE, |
| 94 | GPIO_CAM_GP_LED_EN1, |
| 95 | GPIO_CAM_GP_LED_EN2, |
| 96 | }; |
| 97 | |
| 98 | #if defined(CONFIG_GPIO_SX150X) |
| 99 | enum { |
| 100 | SX150X_CORE, |
| 101 | SX150X_CAM, |
| 102 | }; |
| 103 | |
| 104 | static struct sx150x_platform_data sx150x_data[] __initdata = { |
| 105 | [SX150X_CORE] = { |
| 106 | .gpio_base = GPIO_CORE_EXPANDER_BASE, |
| 107 | .oscio_is_gpo = false, |
| 108 | .io_pullup_ena = 0, |
pankaj kumar | c5c0139 | 2011-08-12 13:44:05 +0530 | [diff] [blame] | 109 | .io_pulldn_ena = 0x02, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 110 | .io_open_drain_ena = 0xfef8, |
| 111 | .irq_summary = -1, |
| 112 | }, |
| 113 | [SX150X_CAM] = { |
| 114 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 115 | .oscio_is_gpo = false, |
| 116 | .io_pullup_ena = 0, |
| 117 | .io_pulldn_ena = 0, |
| 118 | .io_open_drain_ena = 0x23, |
| 119 | .irq_summary = -1, |
| 120 | }, |
| 121 | }; |
| 122 | #endif |
| 123 | |
| 124 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 125 | |
| 126 | /* FM Platform power and shutdown routines */ |
| 127 | #define FPGA_MSM_CNTRL_REG2 0x90008010 |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 128 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 129 | static void config_pcm_i2s_mode(int mode) |
| 130 | { |
| 131 | void __iomem *cfg_ptr; |
| 132 | u8 reg2; |
| 133 | |
| 134 | cfg_ptr = ioremap_nocache(FPGA_MSM_CNTRL_REG2, sizeof(char)); |
| 135 | |
| 136 | if (!cfg_ptr) |
| 137 | return; |
| 138 | if (mode) { |
| 139 | /*enable the pcm mode in FPGA*/ |
| 140 | reg2 = readb_relaxed(cfg_ptr); |
| 141 | if (reg2 == 0) { |
| 142 | reg2 = 1; |
| 143 | writeb_relaxed(reg2, cfg_ptr); |
| 144 | } |
| 145 | } else { |
| 146 | /*enable i2s mode in FPGA*/ |
| 147 | reg2 = readb_relaxed(cfg_ptr); |
| 148 | if (reg2 == 1) { |
| 149 | reg2 = 0; |
| 150 | writeb_relaxed(reg2, cfg_ptr); |
| 151 | } |
| 152 | } |
| 153 | iounmap(cfg_ptr); |
| 154 | } |
| 155 | |
| 156 | static unsigned fm_i2s_config_power_on[] = { |
| 157 | /*FM_I2S_SD*/ |
| 158 | GPIO_CFG(68, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 159 | /*FM_I2S_WS*/ |
| 160 | GPIO_CFG(70, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 161 | /*FM_I2S_SCK*/ |
| 162 | GPIO_CFG(71, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 163 | }; |
| 164 | |
| 165 | static unsigned fm_i2s_config_power_off[] = { |
| 166 | /*FM_I2S_SD*/ |
| 167 | GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 168 | /*FM_I2S_WS*/ |
| 169 | GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 170 | /*FM_I2S_SCK*/ |
| 171 | GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 172 | }; |
| 173 | |
| 174 | static unsigned bt_config_power_on[] = { |
| 175 | /*RFR*/ |
| 176 | GPIO_CFG(43, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 177 | /*CTS*/ |
| 178 | GPIO_CFG(44, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 179 | /*RX*/ |
| 180 | GPIO_CFG(45, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 181 | /*TX*/ |
| 182 | GPIO_CFG(46, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 183 | }; |
| 184 | static unsigned bt_config_pcm_on[] = { |
| 185 | /*PCM_DOUT*/ |
| 186 | GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 187 | /*PCM_DIN*/ |
| 188 | GPIO_CFG(69, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 189 | /*PCM_SYNC*/ |
| 190 | GPIO_CFG(70, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 191 | /*PCM_CLK*/ |
| 192 | GPIO_CFG(71, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 193 | }; |
| 194 | static unsigned bt_config_power_off[] = { |
| 195 | /*RFR*/ |
| 196 | GPIO_CFG(43, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 197 | /*CTS*/ |
| 198 | GPIO_CFG(44, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 199 | /*RX*/ |
| 200 | GPIO_CFG(45, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 201 | /*TX*/ |
| 202 | GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 203 | }; |
| 204 | static unsigned bt_config_pcm_off[] = { |
| 205 | /*PCM_DOUT*/ |
| 206 | GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 207 | /*PCM_DIN*/ |
| 208 | GPIO_CFG(69, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 209 | /*PCM_SYNC*/ |
| 210 | GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 211 | /*PCM_CLK*/ |
| 212 | GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 213 | }; |
| 214 | |
| 215 | static int config_i2s(int mode) |
| 216 | { |
| 217 | int pin, rc = 0; |
| 218 | |
| 219 | if (mode == FM_I2S_ON) { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 220 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 221 | config_pcm_i2s_mode(0); |
| 222 | pr_err("%s mode = FM_I2S_ON", __func__); |
| 223 | for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_on); |
| 224 | pin++) { |
| 225 | rc = gpio_tlmm_config( |
| 226 | fm_i2s_config_power_on[pin], |
| 227 | GPIO_CFG_ENABLE |
| 228 | ); |
| 229 | if (rc < 0) |
| 230 | return rc; |
| 231 | } |
| 232 | } else if (mode == FM_I2S_OFF) { |
| 233 | pr_err("%s mode = FM_I2S_OFF", __func__); |
| 234 | for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_off); |
| 235 | pin++) { |
| 236 | rc = gpio_tlmm_config( |
| 237 | fm_i2s_config_power_off[pin], |
| 238 | GPIO_CFG_ENABLE |
| 239 | ); |
| 240 | if (rc < 0) |
| 241 | return rc; |
| 242 | } |
| 243 | } |
| 244 | return rc; |
| 245 | } |
| 246 | static int config_pcm(int mode) |
| 247 | { |
| 248 | int pin, rc = 0; |
| 249 | |
| 250 | if (mode == BT_PCM_ON) { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 251 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 252 | config_pcm_i2s_mode(1); |
| 253 | pr_err("%s mode =BT_PCM_ON", __func__); |
| 254 | for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_on); |
| 255 | pin++) { |
| 256 | rc = gpio_tlmm_config(bt_config_pcm_on[pin], |
| 257 | GPIO_CFG_ENABLE); |
| 258 | if (rc < 0) |
| 259 | return rc; |
| 260 | } |
| 261 | } else if (mode == BT_PCM_OFF) { |
| 262 | pr_err("%s mode =BT_PCM_OFF", __func__); |
| 263 | for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_off); |
| 264 | pin++) { |
| 265 | rc = gpio_tlmm_config(bt_config_pcm_off[pin], |
| 266 | GPIO_CFG_ENABLE); |
| 267 | if (rc < 0) |
| 268 | return rc; |
| 269 | } |
| 270 | |
| 271 | } |
| 272 | |
| 273 | return rc; |
| 274 | } |
| 275 | |
| 276 | static int msm_bahama_setup_pcm_i2s(int mode) |
| 277 | { |
| 278 | int fm_state = 0, bt_state = 0; |
| 279 | int rc = 0; |
| 280 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA}; |
| 281 | |
| 282 | fm_state = marimba_get_fm_status(&config); |
| 283 | bt_state = marimba_get_bt_status(&config); |
| 284 | |
| 285 | switch (mode) { |
| 286 | case BT_PCM_ON: |
| 287 | case BT_PCM_OFF: |
| 288 | if (!fm_state) |
| 289 | rc = config_pcm(mode); |
| 290 | break; |
| 291 | case FM_I2S_ON: |
| 292 | rc = config_i2s(mode); |
| 293 | break; |
| 294 | case FM_I2S_OFF: |
| 295 | if (bt_state) |
| 296 | rc = config_pcm(BT_PCM_ON); |
| 297 | else |
| 298 | rc = config_i2s(mode); |
| 299 | break; |
| 300 | default: |
| 301 | rc = -EIO; |
| 302 | pr_err("%s:Unsupported mode", __func__); |
| 303 | } |
| 304 | return rc; |
| 305 | } |
| 306 | |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 307 | static int bt_set_gpio(int on) |
| 308 | { |
| 309 | int rc = 0; |
| 310 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA}; |
| 311 | |
| 312 | if (on) { |
| 313 | rc = gpio_direction_output(GPIO_BT_SYS_REST_EN, 1); |
| 314 | msleep(100); |
| 315 | } else { |
| 316 | if (!marimba_get_fm_status(&config) && |
| 317 | !marimba_get_bt_status(&config)) { |
| 318 | gpio_set_value_cansleep(GPIO_BT_SYS_REST_EN, 0); |
| 319 | rc = gpio_direction_input(GPIO_BT_SYS_REST_EN); |
| 320 | msleep(100); |
| 321 | } |
| 322 | } |
| 323 | if (rc) |
| 324 | pr_err("%s: BT sys_reset_en GPIO : Error", __func__); |
| 325 | |
| 326 | return rc; |
| 327 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 328 | static struct regulator *fm_regulator; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 329 | static int fm_radio_setup(struct marimba_fm_platform_data *pdata) |
| 330 | { |
| 331 | int rc = 0; |
| 332 | const char *id = "FMPW"; |
| 333 | uint32_t irqcfg; |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 334 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA}; |
| 335 | u8 value; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 336 | |
| 337 | /* Voting for 1.8V Regulator */ |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 338 | fm_regulator = regulator_get(NULL, "msme1"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 339 | if (IS_ERR(fm_regulator)) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 340 | rc = PTR_ERR(fm_regulator); |
| 341 | pr_err("%s: could not get regulator: %d\n", __func__, rc); |
| 342 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | /* Set the voltage level to 1.8V */ |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 346 | rc = regulator_set_voltage(fm_regulator, 1800000, 1800000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 347 | if (rc < 0) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 348 | pr_err("%s: could not set voltage: %d\n", __func__, rc); |
| 349 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | /* Enabling the 1.8V regulator */ |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 353 | rc = regulator_enable(fm_regulator); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 354 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 355 | pr_err("%s: could not enable regulator: %d\n", __func__, rc); |
| 356 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | /* Voting for 19.2MHz clock */ |
| 360 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1, |
| 361 | PMAPP_CLOCK_VOTE_ON); |
| 362 | if (rc < 0) { |
| 363 | pr_err("%s: clock vote failed with :(%d)\n", |
| 364 | __func__, rc); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 365 | goto reg_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 368 | rc = bt_set_gpio(1); |
| 369 | if (rc) { |
| 370 | pr_err("%s: bt_set_gpio = %d", __func__, rc); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 371 | goto gpio_deconfig; |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 372 | } |
| 373 | /*re-write FM Slave Id, after reset*/ |
| 374 | value = BAHAMA_SLAVE_ID_FM_ADDR; |
| 375 | rc = marimba_write_bit_mask(&config, |
| 376 | BAHAMA_SLAVE_ID_FM_REG, &value, 1, 0xFF); |
| 377 | if (rc < 0) { |
| 378 | pr_err("%s: FM Slave ID rewrite Failed = %d", __func__, rc); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 379 | goto gpio_deconfig; |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 380 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 381 | /* Configuring the FM GPIO */ |
| 382 | irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 383 | GPIO_CFG_2MA); |
| 384 | |
| 385 | rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE); |
| 386 | if (rc) { |
| 387 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 388 | __func__, irqcfg, rc); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 389 | goto gpio_deconfig; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | return 0; |
| 393 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 394 | gpio_deconfig: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 395 | pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1, |
| 396 | PMAPP_CLOCK_VOTE_OFF); |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 397 | bt_set_gpio(0); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 398 | reg_disable: |
| 399 | regulator_disable(fm_regulator); |
| 400 | reg_free: |
| 401 | regulator_put(fm_regulator); |
| 402 | fm_regulator = NULL; |
| 403 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 404 | return rc; |
| 405 | }; |
| 406 | |
| 407 | static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata) |
| 408 | { |
| 409 | int rc; |
| 410 | const char *id = "FMPW"; |
| 411 | |
| 412 | /* Releasing the GPIO line used by FM */ |
| 413 | uint32_t irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 414 | GPIO_CFG_2MA); |
| 415 | |
| 416 | rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE); |
| 417 | if (rc) |
| 418 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 419 | __func__, irqcfg, rc); |
| 420 | |
| 421 | /* Releasing the 1.8V Regulator */ |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 422 | if (!IS_ERR_OR_NULL(fm_regulator)) { |
| 423 | rc = regulator_disable(fm_regulator); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 424 | if (rc) |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 425 | pr_err("%s: could not disable regulator: %d\n", |
| 426 | __func__, rc); |
| 427 | regulator_put(fm_regulator); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 428 | fm_regulator = NULL; |
| 429 | } |
| 430 | |
| 431 | /* Voting off the clock */ |
| 432 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1, |
| 433 | PMAPP_CLOCK_VOTE_OFF); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 434 | if (rc < 0) |
| 435 | pr_err("%s: voting off failed with :(%d)\n", |
| 436 | __func__, rc); |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 437 | rc = bt_set_gpio(0); |
| 438 | if (rc) |
| 439 | pr_err("%s: bt_set_gpio = %d", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | static struct marimba_fm_platform_data marimba_fm_pdata = { |
| 443 | .fm_setup = fm_radio_setup, |
| 444 | .fm_shutdown = fm_radio_shutdown, |
| 445 | .irq = MSM_GPIO_TO_INT(FM_GPIO), |
| 446 | .vreg_s2 = NULL, |
| 447 | .vreg_xo_out = NULL, |
| 448 | /* Configuring the FM SoC as I2S Master */ |
| 449 | .is_fm_soc_i2s_master = true, |
| 450 | .config_i2s_gpio = msm_bahama_setup_pcm_i2s, |
| 451 | }; |
| 452 | |
Santosh Sajjan | 6822c68 | 2011-07-26 10:49:36 +0530 | [diff] [blame] | 453 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 454 | .name = "wlan_ar6000_pm_dev", |
| 455 | .id = -1, |
| 456 | }; |
| 457 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 458 | static struct platform_device msm_bt_power_device = { |
| 459 | .name = "bt_power", |
| 460 | }; |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 461 | struct bahama_config_register { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 462 | u8 reg; |
| 463 | u8 value; |
| 464 | u8 mask; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 465 | }; |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 466 | struct bt_vreg_info { |
| 467 | const char *name; |
| 468 | unsigned int pmapp_id; |
Pankaj Kumar | 6ac59af | 2011-10-12 12:45:40 +0530 | [diff] [blame] | 469 | unsigned int min_level; |
| 470 | unsigned int max_level; |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 471 | unsigned int is_pin_controlled; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 472 | struct regulator *reg; |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 473 | }; |
| 474 | static struct bt_vreg_info bt_vregs[] = { |
Pankaj Kumar | 6ac59af | 2011-10-12 12:45:40 +0530 | [diff] [blame] | 475 | {"msme1", 2, 1800000, 1800000, 0, NULL}, |
| 476 | {"bt", 21, 2900000, 3050000, 1, NULL} |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 477 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 478 | |
| 479 | static int bahama_bt(int on) |
| 480 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 481 | int rc = 0; |
| 482 | int i; |
| 483 | |
| 484 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA}; |
| 485 | |
| 486 | struct bahama_variant_register { |
| 487 | const size_t size; |
| 488 | const struct bahama_config_register *set; |
| 489 | }; |
| 490 | |
| 491 | const struct bahama_config_register *p; |
| 492 | |
| 493 | u8 version; |
| 494 | |
| 495 | const struct bahama_config_register v10_bt_on[] = { |
| 496 | { 0xE9, 0x00, 0xFF }, |
| 497 | { 0xF4, 0x80, 0xFF }, |
| 498 | { 0xE4, 0x00, 0xFF }, |
| 499 | { 0xE5, 0x00, 0x0F }, |
| 500 | #ifdef CONFIG_WLAN |
| 501 | { 0xE6, 0x38, 0x7F }, |
| 502 | { 0xE7, 0x06, 0xFF }, |
| 503 | #endif |
| 504 | { 0xE9, 0x21, 0xFF }, |
| 505 | { 0x01, 0x0C, 0x1F }, |
| 506 | { 0x01, 0x08, 0x1F }, |
| 507 | }; |
| 508 | |
| 509 | const struct bahama_config_register v20_bt_on_fm_off[] = { |
| 510 | { 0x11, 0x0C, 0xFF }, |
| 511 | { 0x13, 0x01, 0xFF }, |
| 512 | { 0xF4, 0x80, 0xFF }, |
| 513 | { 0xF0, 0x00, 0xFF }, |
| 514 | { 0xE9, 0x00, 0xFF }, |
| 515 | #ifdef CONFIG_WLAN |
| 516 | { 0x81, 0x00, 0x7F }, |
| 517 | { 0x82, 0x00, 0xFF }, |
| 518 | { 0xE6, 0x38, 0x7F }, |
| 519 | { 0xE7, 0x06, 0xFF }, |
| 520 | #endif |
| 521 | { 0x8E, 0x15, 0xFF }, |
| 522 | { 0x8F, 0x15, 0xFF }, |
| 523 | { 0x90, 0x15, 0xFF }, |
| 524 | |
| 525 | { 0xE9, 0x21, 0xFF }, |
| 526 | }; |
| 527 | |
| 528 | const struct bahama_config_register v20_bt_on_fm_on[] = { |
| 529 | { 0x11, 0x0C, 0xFF }, |
| 530 | { 0x13, 0x01, 0xFF }, |
| 531 | { 0xF4, 0x86, 0xFF }, |
| 532 | { 0xF0, 0x06, 0xFF }, |
| 533 | { 0xE9, 0x00, 0xFF }, |
| 534 | #ifdef CONFIG_WLAN |
| 535 | { 0x81, 0x00, 0x7F }, |
| 536 | { 0x82, 0x00, 0xFF }, |
| 537 | { 0xE6, 0x38, 0x7F }, |
| 538 | { 0xE7, 0x06, 0xFF }, |
| 539 | #endif |
| 540 | { 0xE9, 0x21, 0xFF }, |
| 541 | }; |
| 542 | |
| 543 | const struct bahama_config_register v10_bt_off[] = { |
| 544 | { 0xE9, 0x00, 0xFF }, |
| 545 | }; |
| 546 | |
| 547 | const struct bahama_config_register v20_bt_off_fm_off[] = { |
| 548 | { 0xF4, 0x84, 0xFF }, |
| 549 | { 0xF0, 0x04, 0xFF }, |
| 550 | { 0xE9, 0x00, 0xFF } |
| 551 | }; |
| 552 | |
| 553 | const struct bahama_config_register v20_bt_off_fm_on[] = { |
| 554 | { 0xF4, 0x86, 0xFF }, |
| 555 | { 0xF0, 0x06, 0xFF }, |
| 556 | { 0xE9, 0x00, 0xFF } |
| 557 | }; |
| 558 | const struct bahama_variant_register bt_bahama[2][3] = { |
| 559 | { |
| 560 | { ARRAY_SIZE(v10_bt_off), v10_bt_off }, |
| 561 | { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off }, |
| 562 | { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on } |
| 563 | }, |
| 564 | { |
| 565 | { ARRAY_SIZE(v10_bt_on), v10_bt_on }, |
| 566 | { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off }, |
| 567 | { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on } |
| 568 | } |
| 569 | }; |
| 570 | |
| 571 | u8 offset = 0; /* index into bahama configs */ |
| 572 | on = on ? 1 : 0; |
| 573 | version = marimba_read_bahama_ver(&config); |
Rahul Kashyap | 92497af | 2011-07-07 12:13:52 +0530 | [diff] [blame] | 574 | if ((int)version < 0 || version == BAHAMA_VER_UNSUPPORTED) { |
| 575 | dev_err(&msm_bt_power_device.dev, "%s: Bahama \ |
| 576 | version read Error, version = %d \n", |
| 577 | __func__, version); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 578 | return -EIO; |
| 579 | } |
| 580 | |
| 581 | if (version == BAHAMA_VER_2_0) { |
| 582 | if (marimba_get_fm_status(&config)) |
| 583 | offset = 0x01; |
| 584 | } |
| 585 | |
| 586 | p = bt_bahama[on][version + offset].set; |
| 587 | |
| 588 | dev_info(&msm_bt_power_device.dev, |
| 589 | "%s: found version %d\n", __func__, version); |
| 590 | |
| 591 | for (i = 0; i < bt_bahama[on][version + offset].size; i++) { |
| 592 | u8 value = (p+i)->value; |
| 593 | rc = marimba_write_bit_mask(&config, |
| 594 | (p+i)->reg, |
| 595 | &value, |
| 596 | sizeof((p+i)->value), |
| 597 | (p+i)->mask); |
| 598 | if (rc < 0) { |
| 599 | dev_err(&msm_bt_power_device.dev, |
| 600 | "%s: reg %x write failed: %d\n", |
| 601 | __func__, (p+i)->reg, rc); |
| 602 | return rc; |
| 603 | } |
Rahul Kashyap | 92497af | 2011-07-07 12:13:52 +0530 | [diff] [blame] | 604 | dev_dbg(&msm_bt_power_device.dev, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 605 | "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n", |
| 606 | __func__, (p+i)->reg, |
| 607 | value, (p+i)->mask); |
| 608 | value = 0; |
| 609 | rc = marimba_read_bit_mask(&config, |
| 610 | (p+i)->reg, &value, |
| 611 | sizeof((p+i)->value), (p+i)->mask); |
| 612 | if (rc < 0) |
| 613 | dev_err(&msm_bt_power_device.dev, "%s marimba_read_bit_mask- error", |
| 614 | __func__); |
Rahul Kashyap | 92497af | 2011-07-07 12:13:52 +0530 | [diff] [blame] | 615 | dev_dbg(&msm_bt_power_device.dev, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 616 | "%s: reg 0x%02x read value 0x%02x mask 0x%02x\n", |
| 617 | __func__, (p+i)->reg, |
| 618 | value, (p+i)->mask); |
| 619 | } |
| 620 | /* Update BT Status */ |
| 621 | if (on) |
| 622 | marimba_set_bt_status(&config, true); |
| 623 | else |
| 624 | marimba_set_bt_status(&config, false); |
| 625 | return rc; |
| 626 | } |
| 627 | static int bluetooth_switch_regulators(int on) |
| 628 | { |
| 629 | int i, rc = 0; |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 630 | const char *id = "BTPW"; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 631 | |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 632 | for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 633 | if (IS_ERR_OR_NULL(bt_vregs[i].reg)) { |
| 634 | rc = bt_vregs[i].reg ? |
| 635 | PTR_ERR(bt_vregs[i].reg) : |
| 636 | -ENODEV; |
| 637 | dev_err(&msm_bt_power_device.dev, |
| 638 | "%s: invalid regulator handle for %s: %d\n", |
| 639 | __func__, bt_vregs[i].name, rc); |
| 640 | goto reg_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 641 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 642 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 643 | rc = on ? regulator_set_voltage(bt_vregs[i].reg, |
Pankaj Kumar | 6ac59af | 2011-10-12 12:45:40 +0530 | [diff] [blame] | 644 | bt_vregs[i].min_level, |
| 645 | bt_vregs[i].max_level) : 0; |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 646 | if (rc) { |
| 647 | dev_err(&msm_bt_power_device.dev, |
| 648 | "%s: could not set voltage for %s: %d\n", |
| 649 | __func__, bt_vregs[i].name, rc); |
| 650 | goto reg_disable; |
| 651 | } |
| 652 | |
| 653 | rc = on ? regulator_enable(bt_vregs[i].reg) : 0; |
| 654 | if (rc) { |
| 655 | dev_err(&msm_bt_power_device.dev, |
| 656 | "%s: could not %sable regulator %s: %d\n", |
| 657 | __func__, "en", bt_vregs[i].name, rc); |
| 658 | goto reg_disable; |
| 659 | } |
| 660 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 661 | if (bt_vregs[i].is_pin_controlled) { |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 662 | rc = pmapp_vreg_lpm_pincntrl_vote(id, |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 663 | bt_vregs[i].pmapp_id, |
| 664 | PMAPP_CLOCK_ID_D1, |
| 665 | on ? PMAPP_CLOCK_VOTE_ON : |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 666 | PMAPP_CLOCK_VOTE_OFF); |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 667 | if (rc) { |
| 668 | dev_err(&msm_bt_power_device.dev, |
| 669 | "%s: pin control failed for %s: %d\n", |
| 670 | __func__, bt_vregs[i].name, rc); |
| 671 | goto pin_cnt_fail; |
| 672 | } |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 673 | } |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 674 | rc = on ? 0 : regulator_disable(bt_vregs[i].reg); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 675 | |
| 676 | if (rc) { |
| 677 | dev_err(&msm_bt_power_device.dev, |
| 678 | "%s: could not %sable regulator %s: %d\n", |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 679 | __func__, "dis", bt_vregs[i].name, rc); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 680 | goto reg_disable; |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 681 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 682 | } |
Rahul Kashyap | 6e66946 | 2011-07-23 16:42:56 +0530 | [diff] [blame] | 683 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 684 | return rc; |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 685 | pin_cnt_fail: |
| 686 | if (on) |
| 687 | regulator_disable(bt_vregs[i].reg); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 688 | reg_disable: |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 689 | while (i) { |
| 690 | if (on) { |
| 691 | i--; |
| 692 | regulator_disable(bt_vregs[i].reg); |
| 693 | regulator_put(bt_vregs[i].reg); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 694 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 695 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 696 | return rc; |
| 697 | } |
| 698 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 699 | static struct regulator *reg_s3; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 700 | static unsigned int msm_bahama_setup_power(void) |
| 701 | { |
| 702 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 703 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 704 | reg_s3 = regulator_get(NULL, "msme1"); |
| 705 | if (IS_ERR(reg_s3)) { |
| 706 | rc = PTR_ERR(reg_s3); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 707 | pr_err("%s: could not get regulator: %d\n", __func__, rc); |
| 708 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 709 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 710 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 711 | rc = regulator_set_voltage(reg_s3, 1800000, 1800000); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 712 | if (rc) { |
| 713 | pr_err("%s: could not set voltage: %d\n", __func__, rc); |
| 714 | goto reg_fail; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 715 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 716 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 717 | rc = regulator_enable(reg_s3); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 718 | if (rc < 0) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 719 | pr_err("%s: could not enable regulator: %d\n", __func__, rc); |
| 720 | goto reg_fail; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 721 | } |
| 722 | |
| 723 | /*setup Bahama_sys_reset_n*/ |
| 724 | rc = gpio_request(GPIO_BT_SYS_REST_EN, "bahama sys_rst_n"); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 725 | if (rc) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 726 | pr_err("%s: gpio_request %d = %d\n", __func__, |
| 727 | GPIO_BT_SYS_REST_EN, rc); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 728 | goto reg_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 729 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 730 | |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 731 | rc = bt_set_gpio(1); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 732 | if (rc) { |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 733 | pr_err("%s: bt_set_gpio %d = %d\n", __func__, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 734 | GPIO_BT_SYS_REST_EN, rc); |
| 735 | goto gpio_fail; |
| 736 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 737 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 738 | return rc; |
| 739 | |
| 740 | gpio_fail: |
| 741 | gpio_free(GPIO_BT_SYS_REST_EN); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 742 | reg_disable: |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 743 | regulator_disable(reg_s3); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 744 | reg_fail: |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 745 | regulator_put(reg_s3); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 746 | out: |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 747 | reg_s3 = NULL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 748 | return rc; |
| 749 | } |
| 750 | |
| 751 | static unsigned int msm_bahama_shutdown_power(int value) |
| 752 | { |
| 753 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 754 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 755 | if (IS_ERR_OR_NULL(reg_s3)) { |
| 756 | rc = reg_s3 ? PTR_ERR(reg_s3) : -ENODEV; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 757 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 758 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 759 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 760 | rc = regulator_disable(reg_s3); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 761 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 762 | pr_err("%s: could not disable regulator: %d\n", __func__, rc); |
| 763 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 764 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 765 | |
Rahul Kashyap | e8698c6 | 2011-07-20 20:43:05 +0530 | [diff] [blame] | 766 | if (value == BAHAMA_ID) { |
| 767 | rc = bt_set_gpio(0); |
| 768 | if (rc) { |
| 769 | pr_err("%s: bt_set_gpio = %d\n", |
| 770 | __func__, rc); |
| 771 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 772 | gpio_free(GPIO_BT_SYS_REST_EN); |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 773 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 774 | |
Pankaj Kumar | a9d576c | 2011-09-29 10:56:53 +0530 | [diff] [blame] | 775 | regulator_put(reg_s3); |
| 776 | reg_s3 = NULL; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 777 | |
| 778 | return 0; |
| 779 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 780 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 781 | return rc; |
| 782 | } |
| 783 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 784 | static unsigned int msm_bahama_core_config(int type) |
| 785 | { |
| 786 | int rc = 0; |
| 787 | |
| 788 | if (type == BAHAMA_ID) { |
| 789 | int i; |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 790 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA}; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 791 | const struct bahama_config_register v20_init[] = { |
| 792 | /* reg, value, mask */ |
| 793 | { 0xF4, 0x84, 0xFF }, /* AREG */ |
| 794 | { 0xF0, 0x04, 0xFF } /* DREG */ |
| 795 | }; |
| 796 | if (marimba_read_bahama_ver(&config) == BAHAMA_VER_2_0) { |
| 797 | for (i = 0; i < ARRAY_SIZE(v20_init); i++) { |
| 798 | u8 value = v20_init[i].value; |
| 799 | rc = marimba_write_bit_mask(&config, |
| 800 | v20_init[i].reg, |
| 801 | &value, |
| 802 | sizeof(v20_init[i].value), |
| 803 | v20_init[i].mask); |
| 804 | if (rc < 0) { |
| 805 | pr_err("%s: reg %d write failed: %d\n", |
| 806 | __func__, v20_init[i].reg, rc); |
| 807 | return rc; |
| 808 | } |
| 809 | pr_debug("%s: reg 0x%02x value 0x%02x" |
| 810 | " mask 0x%02x\n", |
| 811 | __func__, v20_init[i].reg, |
| 812 | v20_init[i].value, v20_init[i].mask); |
| 813 | } |
| 814 | } |
| 815 | } |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 816 | rc = bt_set_gpio(0); |
| 817 | if (rc) { |
| 818 | pr_err("%s: bt_set_gpio = %d\n", |
| 819 | __func__, rc); |
| 820 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 821 | pr_debug("core type: %d\n", type); |
| 822 | return rc; |
| 823 | } |
| 824 | |
| 825 | static int bluetooth_power(int on) |
| 826 | { |
| 827 | int pin, rc = 0; |
| 828 | const char *id = "BTPW"; |
| 829 | int cid = 0; |
| 830 | |
| 831 | cid = adie_get_detected_connectivity_type(); |
| 832 | if (cid != BAHAMA_ID) { |
| 833 | pr_err("%s: unexpected adie connectivity type: %d\n", |
| 834 | __func__, cid); |
| 835 | return -ENODEV; |
| 836 | } |
| 837 | if (on) { |
| 838 | /*setup power for BT SOC*/ |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 839 | rc = bt_set_gpio(on); |
| 840 | if (rc) { |
| 841 | pr_err("%s: bt_set_gpio = %d\n", |
| 842 | __func__, rc); |
| 843 | goto exit; |
| 844 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 845 | rc = bluetooth_switch_regulators(on); |
| 846 | if (rc < 0) { |
| 847 | pr_err("%s: bluetooth_switch_regulators rc = %d", |
| 848 | __func__, rc); |
| 849 | goto exit; |
| 850 | } |
| 851 | /*setup BT GPIO lines*/ |
| 852 | for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on); |
| 853 | pin++) { |
| 854 | rc = gpio_tlmm_config(bt_config_power_on[pin], |
| 855 | GPIO_CFG_ENABLE); |
| 856 | if (rc < 0) { |
| 857 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 858 | __func__, |
| 859 | bt_config_power_on[pin], |
| 860 | rc); |
| 861 | goto fail_power; |
| 862 | } |
| 863 | } |
| 864 | /*Setup BT clocks*/ |
| 865 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1, |
| 866 | PMAPP_CLOCK_VOTE_ON); |
| 867 | if (rc < 0) { |
| 868 | pr_err("Failed to vote for TCXO_D1 ON\n"); |
| 869 | goto fail_clock; |
| 870 | } |
| 871 | msleep(20); |
| 872 | |
| 873 | /*I2C config for Bahama*/ |
| 874 | rc = bahama_bt(1); |
| 875 | if (rc < 0) { |
| 876 | pr_err("%s: bahama_bt rc = %d", __func__, rc); |
| 877 | goto fail_i2c; |
| 878 | } |
| 879 | msleep(20); |
| 880 | |
| 881 | /*setup BT PCM lines*/ |
| 882 | rc = msm_bahama_setup_pcm_i2s(BT_PCM_ON); |
| 883 | if (rc < 0) { |
| 884 | pr_err("%s: msm_bahama_setup_pcm_i2s , rc =%d\n", |
| 885 | __func__, rc); |
| 886 | goto fail_power; |
| 887 | } |
| 888 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1, |
| 889 | PMAPP_CLOCK_VOTE_PIN_CTRL); |
| 890 | if (rc < 0) |
| 891 | pr_err("%s:Pin Control Failed, rc = %d", |
| 892 | __func__, rc); |
| 893 | |
| 894 | } else { |
| 895 | rc = bahama_bt(0); |
| 896 | if (rc < 0) |
| 897 | pr_err("%s: bahama_bt rc = %d", __func__, rc); |
Rahul Kashyap | 181d555 | 2011-07-07 10:39:23 +0530 | [diff] [blame] | 898 | |
| 899 | rc = bt_set_gpio(on); |
| 900 | if (rc) { |
| 901 | pr_err("%s: bt_set_gpio = %d\n", |
| 902 | __func__, rc); |
| 903 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 904 | fail_i2c: |
| 905 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1, |
| 906 | PMAPP_CLOCK_VOTE_OFF); |
| 907 | if (rc < 0) |
| 908 | pr_err("%s: Failed to vote Off D1\n", __func__); |
| 909 | fail_clock: |
| 910 | for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off); |
| 911 | pin++) { |
| 912 | rc = gpio_tlmm_config(bt_config_power_off[pin], |
| 913 | GPIO_CFG_ENABLE); |
| 914 | if (rc < 0) { |
| 915 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 916 | __func__, bt_config_power_off[pin], rc); |
| 917 | } |
| 918 | } |
| 919 | rc = msm_bahama_setup_pcm_i2s(BT_PCM_OFF); |
| 920 | if (rc < 0) { |
| 921 | pr_err("%s: msm_bahama_setup_pcm_i2s, rc =%d\n", |
| 922 | __func__, rc); |
| 923 | } |
| 924 | fail_power: |
| 925 | rc = bluetooth_switch_regulators(0); |
| 926 | if (rc < 0) { |
| 927 | pr_err("%s: switch_regulators : rc = %d",\ |
| 928 | __func__, rc); |
| 929 | goto exit; |
| 930 | } |
| 931 | } |
| 932 | return rc; |
| 933 | exit: |
| 934 | pr_err("%s: failed with rc = %d", __func__, rc); |
| 935 | return rc; |
| 936 | } |
| 937 | |
| 938 | static int __init bt_power_init(void) |
| 939 | { |
| 940 | int i, rc = 0; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 941 | struct device *dev = &msm_bt_power_device.dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 942 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 943 | for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) { |
| 944 | bt_vregs[i].reg = regulator_get(dev, bt_vregs[i].name); |
| 945 | if (IS_ERR(bt_vregs[i].reg)) { |
| 946 | rc = PTR_ERR(bt_vregs[i].reg); |
| 947 | dev_err(dev, "%s: could not get regulator %s: %d\n", |
| 948 | __func__, bt_vregs[i].name, rc); |
| 949 | goto reg_get_fail; |
| 950 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | dev->platform_data = &bluetooth_power; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 954 | |
| 955 | return rc; |
| 956 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 957 | reg_get_fail: |
| 958 | while (i--) { |
| 959 | regulator_put(bt_vregs[i].reg); |
| 960 | bt_vregs[i].reg = NULL; |
| 961 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 962 | return rc; |
| 963 | } |
| 964 | |
| 965 | static struct marimba_platform_data marimba_pdata = { |
| 966 | .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR, |
| 967 | .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR, |
| 968 | .bahama_setup = msm_bahama_setup_power, |
| 969 | .bahama_shutdown = msm_bahama_shutdown_power, |
| 970 | .bahama_core_config = msm_bahama_core_config, |
| 971 | .fm = &marimba_fm_pdata, |
| 972 | }; |
| 973 | |
| 974 | #endif |
| 975 | |
| 976 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 977 | static struct i2c_board_info core_exp_i2c_info[] __initdata = { |
| 978 | { |
| 979 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 980 | }, |
| 981 | }; |
| 982 | static struct i2c_board_info cam_exp_i2c_info[] __initdata = { |
| 983 | { |
| 984 | I2C_BOARD_INFO("sx1508q", 0x22), |
| 985 | .platform_data = &sx150x_data[SX150X_CAM], |
| 986 | }, |
| 987 | }; |
| 988 | #endif |
| 989 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 990 | static struct i2c_board_info bahama_devices[] = { |
| 991 | { |
| 992 | I2C_BOARD_INFO("marimba", 0xc), |
| 993 | .platform_data = &marimba_pdata, |
| 994 | }, |
| 995 | }; |
| 996 | #endif |
| 997 | |
| 998 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 999 | static void __init register_i2c_devices(void) |
| 1000 | { |
| 1001 | |
| 1002 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 1003 | cam_exp_i2c_info, |
| 1004 | ARRAY_SIZE(cam_exp_i2c_info)); |
| 1005 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1006 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1007 | sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0; |
| 1008 | |
| 1009 | core_exp_i2c_info[0].platform_data = |
| 1010 | &sx150x_data[SX150X_CORE]; |
| 1011 | |
| 1012 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1013 | core_exp_i2c_info, |
| 1014 | ARRAY_SIZE(core_exp_i2c_info)); |
| 1015 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 1016 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1017 | bahama_devices, |
| 1018 | ARRAY_SIZE(bahama_devices)); |
| 1019 | #endif |
| 1020 | } |
| 1021 | #endif |
| 1022 | |
| 1023 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 1024 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1025 | "qup_scl" }, |
| 1026 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1027 | "qup_sda" }, |
| 1028 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1029 | "qup_scl" }, |
| 1030 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1031 | "qup_sda" }, |
| 1032 | }; |
| 1033 | |
| 1034 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 1035 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1036 | "qup_scl" }, |
| 1037 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1038 | "qup_sda" }, |
| 1039 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1040 | "qup_scl" }, |
| 1041 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1042 | "qup_sda" }, |
| 1043 | }; |
| 1044 | |
| 1045 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 1046 | { |
| 1047 | int rc; |
| 1048 | |
| 1049 | if (adap_id < 0 || adap_id > 1) |
| 1050 | return; |
| 1051 | |
| 1052 | /* Each adapter gets 2 lines from the table */ |
| 1053 | if (config_type) |
| 1054 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 1055 | else |
| 1056 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 1057 | if (rc < 0) |
| 1058 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 1059 | } |
| 1060 | |
| 1061 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 1062 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1063 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1064 | }; |
| 1065 | |
| 1066 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 1067 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1068 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1069 | }; |
| 1070 | |
| 1071 | #ifdef CONFIG_ARCH_MSM7X27A |
Prabhanjan Kandula | 1d92074 | 2011-08-19 10:28:11 +0530 | [diff] [blame] | 1072 | #define MSM_PMEM_MDP_SIZE 0x1900000 |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 1073 | #define MSM7x25A_MSM_PMEM_MDP_SIZE 0x1000000 |
| 1074 | |
Roja Rani Yarubandi | 81c0ab2 | 2011-11-25 10:40:42 +0530 | [diff] [blame] | 1075 | #define MSM_PMEM_ADSP_SIZE 0x2000000 |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 1076 | #define MSM7x25A_MSM_PMEM_ADSP_SIZE 0xB91000 |
| 1077 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1078 | |
| 1079 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 1080 | #define MSM_FB_SIZE 0x260000 |
| 1081 | #define MSM7x25A_MSM_FB_SIZE 0xE1000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1082 | #else |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 1083 | #define MSM_FB_SIZE 0x195000 |
| 1084 | #define MSM7x25A_MSM_FB_SIZE 0xE1000 |
| 1085 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1086 | #endif |
| 1087 | |
| 1088 | #endif |
| 1089 | |
| 1090 | static struct android_usb_platform_data android_usb_pdata = { |
| 1091 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 1092 | }; |
| 1093 | |
| 1094 | static struct platform_device android_usb_device = { |
| 1095 | .name = "android_usb", |
| 1096 | .id = -1, |
| 1097 | .dev = { |
| 1098 | .platform_data = &android_usb_pdata, |
| 1099 | }, |
| 1100 | }; |
| 1101 | |
| 1102 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 1103 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 1104 | { |
| 1105 | int rc = 0; |
| 1106 | unsigned gpio; |
| 1107 | |
| 1108 | gpio = GPIO_HOST_VBUS_EN; |
| 1109 | |
| 1110 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 1111 | if (rc < 0) { |
| 1112 | pr_err("failed to request %d GPIO\n", gpio); |
| 1113 | return; |
| 1114 | } |
| 1115 | gpio_direction_output(gpio, !!on); |
| 1116 | gpio_set_value_cansleep(gpio, !!on); |
| 1117 | gpio_free(gpio); |
| 1118 | } |
| 1119 | |
| 1120 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 1121 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 1122 | }; |
| 1123 | |
| 1124 | static void __init msm7x2x_init_host(void) |
| 1125 | { |
| 1126 | msm_add_host(0, &msm_usb_host_pdata); |
| 1127 | } |
| 1128 | #endif |
| 1129 | |
| 1130 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 1131 | static int hsusb_rpc_connect(int connect) |
| 1132 | { |
| 1133 | if (connect) |
| 1134 | return msm_hsusb_rpc_connect(); |
| 1135 | else |
| 1136 | return msm_hsusb_rpc_close(); |
| 1137 | } |
| 1138 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1139 | static struct regulator *reg_hsusb; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1140 | static int msm_hsusb_ldo_init(int init) |
| 1141 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1142 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1143 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1144 | if (init) { |
| 1145 | reg_hsusb = regulator_get(NULL, "usb"); |
| 1146 | if (IS_ERR(reg_hsusb)) { |
| 1147 | rc = PTR_ERR(reg_hsusb); |
| 1148 | pr_err("%s: could not get regulator: %d\n", |
| 1149 | __func__, rc); |
| 1150 | goto out; |
| 1151 | } |
| 1152 | |
| 1153 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 1154 | if (rc) { |
| 1155 | pr_err("%s: could not set voltage: %d\n", |
| 1156 | __func__, rc); |
| 1157 | goto reg_free; |
| 1158 | } |
| 1159 | |
| 1160 | return 0; |
| 1161 | } |
| 1162 | /* else fall through */ |
| 1163 | reg_free: |
| 1164 | regulator_put(reg_hsusb); |
| 1165 | out: |
| 1166 | reg_hsusb = NULL; |
| 1167 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1168 | } |
| 1169 | |
| 1170 | static int msm_hsusb_ldo_enable(int enable) |
| 1171 | { |
| 1172 | static int ldo_status; |
| 1173 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1174 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 1175 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1176 | |
| 1177 | if (ldo_status == enable) |
| 1178 | return 0; |
| 1179 | |
| 1180 | ldo_status = enable; |
| 1181 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1182 | return enable ? |
| 1183 | regulator_enable(reg_hsusb) : |
| 1184 | regulator_disable(reg_hsusb); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1185 | } |
| 1186 | |
| 1187 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 1188 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 1189 | { |
| 1190 | int ret = 0; |
| 1191 | |
| 1192 | if (init) |
| 1193 | ret = msm_pm_app_rpc_init(callback); |
| 1194 | else |
| 1195 | msm_pm_app_rpc_deinit(callback); |
| 1196 | |
| 1197 | return ret; |
| 1198 | } |
| 1199 | #endif |
| 1200 | |
| 1201 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 1202 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 1203 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 1204 | #else |
| 1205 | .vbus_power = msm_hsusb_vbus_power, |
| 1206 | #endif |
| 1207 | .rpc_connect = hsusb_rpc_connect, |
| 1208 | .core_clk = 1, |
| 1209 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 1210 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 1211 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 1212 | .se1_gating = SE1_GATING_DISABLE, |
| 1213 | .ldo_init = msm_hsusb_ldo_init, |
| 1214 | .ldo_enable = msm_hsusb_ldo_enable, |
| 1215 | .chg_init = hsusb_chg_init, |
| 1216 | .chg_connected = hsusb_chg_connected, |
| 1217 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 1218 | }; |
| 1219 | #endif |
| 1220 | |
| 1221 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 1222 | .is_phy_status_timer_on = 1, |
| 1223 | }; |
| 1224 | |
| 1225 | static struct resource smc91x_resources[] = { |
| 1226 | [0] = { |
| 1227 | .start = 0x90000300, |
| 1228 | .end = 0x900003ff, |
| 1229 | .flags = IORESOURCE_MEM, |
| 1230 | }, |
| 1231 | [1] = { |
| 1232 | .start = MSM_GPIO_TO_INT(4), |
| 1233 | .end = MSM_GPIO_TO_INT(4), |
| 1234 | .flags = IORESOURCE_IRQ, |
| 1235 | }, |
| 1236 | }; |
| 1237 | |
| 1238 | static struct platform_device smc91x_device = { |
| 1239 | .name = "smc91x", |
| 1240 | .id = 0, |
| 1241 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 1242 | .resource = smc91x_resources, |
| 1243 | }; |
| 1244 | |
| 1245 | #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ |
| 1246 | || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\ |
| 1247 | || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\ |
| 1248 | || defined(CONFIG_MMC_MSM_SDC4_SUPPORT)) |
| 1249 | |
| 1250 | static unsigned long vreg_sts, gpio_sts; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1251 | |
| 1252 | struct sdcc_gpio { |
| 1253 | struct msm_gpio *cfg_data; |
| 1254 | uint32_t size; |
| 1255 | struct msm_gpio *sleep_cfg_data; |
| 1256 | }; |
| 1257 | |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1258 | /** |
| 1259 | * Due to insufficient drive strengths for SDC GPIO lines some old versioned |
| 1260 | * SD/MMC cards may cause data CRC errors. Hence, set optimal values |
| 1261 | * for SDC slots based on timing closure and marginality. SDC1 slot |
| 1262 | * require higher value since it should handle bad signal quality due |
| 1263 | * to size of T-flash adapters. |
| 1264 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1265 | static struct msm_gpio sdc1_cfg_data[] = { |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1266 | {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1267 | "sdc1_dat_3"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1268 | {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1269 | "sdc1_dat_2"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1270 | {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1271 | "sdc1_dat_1"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1272 | {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1273 | "sdc1_dat_0"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1274 | {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1275 | "sdc1_cmd"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1276 | {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_14MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1277 | "sdc1_clk"}, |
| 1278 | }; |
| 1279 | |
| 1280 | static struct msm_gpio sdc2_cfg_data[] = { |
| 1281 | {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1282 | "sdc2_clk"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1283 | {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1284 | "sdc2_cmd"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1285 | {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1286 | "sdc2_dat_3"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1287 | {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1288 | "sdc2_dat_2"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1289 | {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1290 | "sdc2_dat_1"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1291 | {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1292 | "sdc2_dat_0"}, |
| 1293 | }; |
| 1294 | |
| 1295 | static struct msm_gpio sdc2_sleep_cfg_data[] = { |
Sujith Reddy Thumma | f353567 | 2011-08-22 08:53:44 +0530 | [diff] [blame] | 1296 | {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1297 | "sdc2_clk"}, |
Sujith Reddy Thumma | f353567 | 2011-08-22 08:53:44 +0530 | [diff] [blame] | 1298 | {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1299 | "sdc2_cmd"}, |
Sujith Reddy Thumma | f353567 | 2011-08-22 08:53:44 +0530 | [diff] [blame] | 1300 | {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1301 | "sdc2_dat_3"}, |
Sujith Reddy Thumma | f353567 | 2011-08-22 08:53:44 +0530 | [diff] [blame] | 1302 | {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1303 | "sdc2_dat_2"}, |
Sujith Reddy Thumma | f353567 | 2011-08-22 08:53:44 +0530 | [diff] [blame] | 1304 | {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1305 | "sdc2_dat_1"}, |
Sujith Reddy Thumma | f353567 | 2011-08-22 08:53:44 +0530 | [diff] [blame] | 1306 | {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1307 | "sdc2_dat_0"}, |
| 1308 | }; |
| 1309 | static struct msm_gpio sdc3_cfg_data[] = { |
| 1310 | {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1311 | "sdc3_clk"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1312 | {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1313 | "sdc3_cmd"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1314 | {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1315 | "sdc3_dat_3"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1316 | {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1317 | "sdc3_dat_2"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1318 | {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1319 | "sdc3_dat_1"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1320 | {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1321 | "sdc3_dat_0"}, |
| 1322 | #ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1323 | {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1324 | "sdc3_dat_7"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1325 | {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1326 | "sdc3_dat_6"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1327 | {GPIO_CFG(21, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1328 | "sdc3_dat_5"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1329 | {GPIO_CFG(108, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1330 | "sdc3_dat_4"}, |
| 1331 | #endif |
| 1332 | }; |
| 1333 | |
| 1334 | static struct msm_gpio sdc4_cfg_data[] = { |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1335 | {GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1336 | "sdc4_dat_3"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1337 | {GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1338 | "sdc4_dat_2"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1339 | {GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1340 | "sdc4_dat_1"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1341 | {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1342 | "sdc4_cmd"}, |
Sujith Reddy Thumma | 70391a3 | 2011-08-01 10:33:21 +0530 | [diff] [blame] | 1343 | {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1344 | "sdc4_dat_0"}, |
| 1345 | {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 1346 | "sdc4_clk"}, |
| 1347 | }; |
| 1348 | |
| 1349 | static struct sdcc_gpio sdcc_cfg_data[] = { |
| 1350 | { |
| 1351 | .cfg_data = sdc1_cfg_data, |
| 1352 | .size = ARRAY_SIZE(sdc1_cfg_data), |
| 1353 | }, |
| 1354 | { |
| 1355 | .cfg_data = sdc2_cfg_data, |
| 1356 | .size = ARRAY_SIZE(sdc2_cfg_data), |
| 1357 | .sleep_cfg_data = sdc2_sleep_cfg_data, |
| 1358 | }, |
| 1359 | { |
| 1360 | .cfg_data = sdc3_cfg_data, |
| 1361 | .size = ARRAY_SIZE(sdc3_cfg_data), |
| 1362 | }, |
| 1363 | { |
| 1364 | .cfg_data = sdc4_cfg_data, |
| 1365 | .size = ARRAY_SIZE(sdc4_cfg_data), |
| 1366 | }, |
| 1367 | }; |
| 1368 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1369 | static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)]; |
| 1370 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1371 | static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable) |
| 1372 | { |
| 1373 | int rc = 0; |
| 1374 | struct sdcc_gpio *curr; |
| 1375 | |
| 1376 | curr = &sdcc_cfg_data[dev_id - 1]; |
| 1377 | if (!(test_bit(dev_id, &gpio_sts)^enable)) |
| 1378 | return rc; |
| 1379 | |
| 1380 | if (enable) { |
| 1381 | set_bit(dev_id, &gpio_sts); |
| 1382 | rc = msm_gpios_request_enable(curr->cfg_data, curr->size); |
| 1383 | if (rc) |
| 1384 | pr_err("%s: Failed to turn on GPIOs for slot %d\n", |
| 1385 | __func__, dev_id); |
| 1386 | } else { |
| 1387 | clear_bit(dev_id, &gpio_sts); |
| 1388 | if (curr->sleep_cfg_data) { |
| 1389 | rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size); |
| 1390 | msm_gpios_free(curr->sleep_cfg_data, curr->size); |
| 1391 | return rc; |
| 1392 | } |
| 1393 | msm_gpios_disable_free(curr->cfg_data, curr->size); |
| 1394 | } |
| 1395 | return rc; |
| 1396 | } |
| 1397 | |
| 1398 | static int msm_sdcc_setup_vreg(int dev_id, unsigned int enable) |
| 1399 | { |
| 1400 | int rc = 0; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1401 | struct regulator *curr = sdcc_vreg_data[dev_id - 1]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1402 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1403 | if (test_bit(dev_id, &vreg_sts) == enable) |
| 1404 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1405 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1406 | if (!curr) |
| 1407 | return -ENODEV; |
| 1408 | |
| 1409 | if (IS_ERR(curr)) |
| 1410 | return PTR_ERR(curr); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1411 | |
| 1412 | if (enable) { |
| 1413 | set_bit(dev_id, &vreg_sts); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1414 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1415 | rc = regulator_enable(curr); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1416 | if (rc) |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1417 | pr_err("%s: could not enable regulator: %d\n", |
| 1418 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1419 | } else { |
| 1420 | clear_bit(dev_id, &vreg_sts); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1421 | |
| 1422 | rc = regulator_disable(curr); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1423 | if (rc) |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1424 | pr_err("%s: could not disable regulator: %d\n", |
| 1425 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1426 | } |
| 1427 | return rc; |
| 1428 | } |
| 1429 | |
| 1430 | static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd) |
| 1431 | { |
| 1432 | int rc = 0; |
| 1433 | struct platform_device *pdev; |
| 1434 | |
| 1435 | pdev = container_of(dv, struct platform_device, dev); |
| 1436 | |
| 1437 | rc = msm_sdcc_setup_gpio(pdev->id, !!vdd); |
| 1438 | if (rc) |
| 1439 | goto out; |
| 1440 | |
| 1441 | rc = msm_sdcc_setup_vreg(pdev->id, !!vdd); |
| 1442 | out: |
| 1443 | return rc; |
| 1444 | } |
| 1445 | |
| 1446 | #define GPIO_SDC1_HW_DET 85 |
| 1447 | |
| 1448 | #if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) \ |
| 1449 | && defined(CONFIG_MMC_MSM_CARD_HW_DETECTION) |
| 1450 | static unsigned int msm7x2xa_sdcc_slot_status(struct device *dev) |
| 1451 | { |
| 1452 | int status; |
| 1453 | |
| 1454 | status = gpio_tlmm_config(GPIO_CFG(GPIO_SDC1_HW_DET, 2, GPIO_CFG_INPUT, |
| 1455 | GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 1456 | if (status) |
| 1457 | pr_err("%s:Failed to configure tlmm for GPIO %d\n", __func__, |
| 1458 | GPIO_SDC1_HW_DET); |
| 1459 | |
| 1460 | status = gpio_request(GPIO_SDC1_HW_DET, "SD_HW_Detect"); |
| 1461 | if (status) { |
| 1462 | pr_err("%s:Failed to request GPIO %d\n", __func__, |
| 1463 | GPIO_SDC1_HW_DET); |
| 1464 | } else { |
| 1465 | status = gpio_direction_input(GPIO_SDC1_HW_DET); |
| 1466 | if (!status) |
| 1467 | status = gpio_get_value(GPIO_SDC1_HW_DET); |
| 1468 | gpio_free(GPIO_SDC1_HW_DET); |
| 1469 | } |
| 1470 | return status; |
| 1471 | } |
| 1472 | #endif |
| 1473 | |
| 1474 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 1475 | static struct mmc_platform_data sdc1_plat_data = { |
| 1476 | .ocr_mask = MMC_VDD_28_29, |
| 1477 | .translate_vdd = msm_sdcc_setup_power, |
| 1478 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 1479 | .msmsdcc_fmin = 144000, |
| 1480 | .msmsdcc_fmid = 24576000, |
| 1481 | .msmsdcc_fmax = 49152000, |
| 1482 | #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
| 1483 | .status = msm7x2xa_sdcc_slot_status, |
| 1484 | .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET), |
| 1485 | .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| 1486 | #endif |
| 1487 | }; |
| 1488 | #endif |
| 1489 | |
| 1490 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 1491 | static struct mmc_platform_data sdc2_plat_data = { |
| 1492 | /* |
| 1493 | * SDC2 supports only 1.8V, claim for 2.85V range is just |
| 1494 | * for allowing buggy cards who advertise 2.8V even though |
| 1495 | * they can operate at 1.8V supply. |
| 1496 | */ |
| 1497 | .ocr_mask = MMC_VDD_28_29 | MMC_VDD_165_195, |
| 1498 | .translate_vdd = msm_sdcc_setup_power, |
| 1499 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 1500 | #ifdef CONFIG_MMC_MSM_SDIO_SUPPORT |
| 1501 | .sdiowakeup_irq = MSM_GPIO_TO_INT(66), |
| 1502 | #endif |
| 1503 | .msmsdcc_fmin = 144000, |
| 1504 | .msmsdcc_fmid = 24576000, |
| 1505 | .msmsdcc_fmax = 49152000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1506 | }; |
| 1507 | #endif |
| 1508 | |
| 1509 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 1510 | static struct mmc_platform_data sdc3_plat_data = { |
| 1511 | .ocr_mask = MMC_VDD_28_29, |
| 1512 | .translate_vdd = msm_sdcc_setup_power, |
| 1513 | #ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT |
| 1514 | .mmc_bus_width = MMC_CAP_8_BIT_DATA, |
| 1515 | #else |
| 1516 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 1517 | #endif |
| 1518 | .msmsdcc_fmin = 144000, |
| 1519 | .msmsdcc_fmid = 24576000, |
| 1520 | .msmsdcc_fmax = 49152000, |
| 1521 | .nonremovable = 1, |
| 1522 | }; |
| 1523 | #endif |
| 1524 | |
| 1525 | #if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\ |
| 1526 | && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT)) |
| 1527 | static struct mmc_platform_data sdc4_plat_data = { |
| 1528 | .ocr_mask = MMC_VDD_28_29, |
| 1529 | .translate_vdd = msm_sdcc_setup_power, |
| 1530 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 1531 | .msmsdcc_fmin = 144000, |
| 1532 | .msmsdcc_fmid = 24576000, |
| 1533 | .msmsdcc_fmax = 49152000, |
| 1534 | }; |
| 1535 | #endif |
Pankaj Kumar | b3e55c6 | 2011-09-26 11:59:39 +0530 | [diff] [blame] | 1536 | |
| 1537 | static int __init mmc_regulator_init(int sdcc_no, const char *supply, int uV) |
| 1538 | { |
| 1539 | int rc; |
| 1540 | |
| 1541 | BUG_ON(sdcc_no < 1 || sdcc_no > 4); |
| 1542 | |
| 1543 | sdcc_no--; |
| 1544 | |
| 1545 | sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply); |
| 1546 | |
| 1547 | if (IS_ERR(sdcc_vreg_data[sdcc_no])) { |
| 1548 | rc = PTR_ERR(sdcc_vreg_data[sdcc_no]); |
| 1549 | pr_err("%s: could not get regulator \"%s\": %d\n", |
| 1550 | __func__, supply, rc); |
| 1551 | goto out; |
| 1552 | } |
| 1553 | |
| 1554 | rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV); |
| 1555 | |
| 1556 | if (rc) { |
| 1557 | pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n", |
| 1558 | __func__, supply, uV, rc); |
| 1559 | goto reg_free; |
| 1560 | } |
| 1561 | |
| 1562 | return rc; |
| 1563 | |
| 1564 | reg_free: |
| 1565 | regulator_put(sdcc_vreg_data[sdcc_no]); |
| 1566 | out: |
| 1567 | sdcc_vreg_data[sdcc_no] = NULL; |
| 1568 | return rc; |
| 1569 | } |
| 1570 | |
| 1571 | static void __init msm7x27a_init_mmc(void) |
| 1572 | { |
| 1573 | /* eMMC slot */ |
| 1574 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 1575 | if (mmc_regulator_init(3, "emmc", 3000000)) |
| 1576 | return; |
| 1577 | msm_add_sdcc(3, &sdc3_plat_data); |
| 1578 | #endif |
| 1579 | /* Micro-SD slot */ |
| 1580 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 1581 | if (mmc_regulator_init(1, "mmc", 2850000)) |
| 1582 | return; |
| 1583 | msm_add_sdcc(1, &sdc1_plat_data); |
| 1584 | #endif |
| 1585 | /* SDIO WLAN slot */ |
| 1586 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 1587 | if (mmc_regulator_init(2, "mmc", 2850000)) |
| 1588 | return; |
| 1589 | msm_add_sdcc(2, &sdc2_plat_data); |
| 1590 | #endif |
| 1591 | /* Not Used */ |
| 1592 | #if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\ |
| 1593 | && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT)) |
| 1594 | if (mmc_regulator_init(4, "mmc", 2850000)) |
| 1595 | return; |
| 1596 | msm_add_sdcc(4, &sdc4_plat_data); |
| 1597 | #endif |
| 1598 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1599 | #endif |
| 1600 | |
| 1601 | #ifdef CONFIG_SERIAL_MSM_HS |
| 1602 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 1603 | .inject_rx_on_wakeup = 1, |
| 1604 | .rx_to_inject = 0xFD, |
| 1605 | }; |
| 1606 | #endif |
| 1607 | static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 1608 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 1609 | .idle_supported = 1, |
| 1610 | .suspend_supported = 1, |
| 1611 | .idle_enabled = 1, |
| 1612 | .suspend_enabled = 1, |
| 1613 | .latency = 16000, |
| 1614 | .residency = 20000, |
| 1615 | }, |
| 1616 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 1617 | .idle_supported = 1, |
| 1618 | .suspend_supported = 1, |
| 1619 | .idle_enabled = 1, |
| 1620 | .suspend_enabled = 1, |
| 1621 | .latency = 12000, |
| 1622 | .residency = 20000, |
| 1623 | }, |
| 1624 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 1625 | .idle_supported = 1, |
| 1626 | .suspend_supported = 1, |
| 1627 | .idle_enabled = 0, |
| 1628 | .suspend_enabled = 1, |
| 1629 | .latency = 2000, |
| 1630 | .residency = 0, |
| 1631 | }, |
| 1632 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 1633 | .idle_supported = 1, |
| 1634 | .suspend_supported = 1, |
| 1635 | .idle_enabled = 1, |
| 1636 | .suspend_enabled = 1, |
| 1637 | .latency = 2, |
| 1638 | .residency = 0, |
| 1639 | }, |
| 1640 | }; |
| 1641 | |
| 1642 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 1643 | .name = "pmem_adsp", |
| 1644 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
Mahesh Lanka | c6af7eb | 2011-08-02 18:00:35 +0530 | [diff] [blame] | 1645 | .cached = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1646 | .memory_type = MEMTYPE_EBI1, |
| 1647 | }; |
| 1648 | |
| 1649 | static struct platform_device android_pmem_adsp_device = { |
| 1650 | .name = "android_pmem", |
| 1651 | .id = 1, |
| 1652 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 1653 | }; |
| 1654 | |
| 1655 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 1656 | static int __init pmem_mdp_size_setup(char *p) |
| 1657 | { |
| 1658 | pmem_mdp_size = memparse(p, NULL); |
| 1659 | return 0; |
| 1660 | } |
| 1661 | |
| 1662 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 1663 | |
| 1664 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 1665 | static int __init pmem_adsp_size_setup(char *p) |
| 1666 | { |
| 1667 | pmem_adsp_size = memparse(p, NULL); |
| 1668 | return 0; |
| 1669 | } |
| 1670 | |
| 1671 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 1672 | |
| 1673 | static unsigned fb_size = MSM_FB_SIZE; |
| 1674 | static int __init fb_size_setup(char *p) |
| 1675 | { |
| 1676 | fb_size = memparse(p, NULL); |
| 1677 | return 0; |
| 1678 | } |
| 1679 | |
| 1680 | early_param("fb_size", fb_size_setup); |
| 1681 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1682 | static struct regulator_bulk_data regs_lcdc[] = { |
| 1683 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 1684 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1685 | }; |
| 1686 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1687 | static uint32_t lcdc_gpio_initialized; |
| 1688 | |
| 1689 | static void lcdc_toshiba_gpio_init(void) |
| 1690 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1691 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1692 | if (!lcdc_gpio_initialized) { |
| 1693 | if (gpio_request(GPIO_SPI_CLK, "spi_clk")) { |
| 1694 | pr_err("failed to request gpio spi_clk\n"); |
| 1695 | return; |
| 1696 | } |
| 1697 | if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) { |
| 1698 | pr_err("failed to request gpio spi_cs0_N\n"); |
| 1699 | goto fail_gpio6; |
| 1700 | } |
| 1701 | if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) { |
| 1702 | pr_err("failed to request gpio spi_mosi\n"); |
| 1703 | goto fail_gpio5; |
| 1704 | } |
| 1705 | if (gpio_request(GPIO_SPI_MISO, "spi_miso")) { |
| 1706 | pr_err("failed to request gpio spi_miso\n"); |
| 1707 | goto fail_gpio4; |
| 1708 | } |
| 1709 | if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) { |
| 1710 | pr_err("failed to request gpio_disp_pwr\n"); |
| 1711 | goto fail_gpio3; |
| 1712 | } |
| 1713 | if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) { |
| 1714 | pr_err("failed to request gpio_bkl_en\n"); |
| 1715 | goto fail_gpio2; |
| 1716 | } |
| 1717 | pmapp_disp_backlight_init(); |
| 1718 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1719 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc); |
| 1720 | if (rc) { |
| 1721 | pr_err("%s: could not get regulators: %d\n", |
| 1722 | __func__, rc); |
| 1723 | goto fail_gpio1; |
| 1724 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1725 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1726 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc), |
| 1727 | regs_lcdc); |
| 1728 | if (rc) { |
| 1729 | pr_err("%s: could not set voltages: %d\n", |
| 1730 | __func__, rc); |
| 1731 | goto fail_vreg; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1732 | } |
| 1733 | lcdc_gpio_initialized = 1; |
| 1734 | } |
| 1735 | return; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1736 | fail_vreg: |
| 1737 | regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1738 | fail_gpio1: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1739 | gpio_free(GPIO_BACKLIGHT_EN); |
| 1740 | fail_gpio2: |
| 1741 | gpio_free(GPIO_DISPLAY_PWR_EN); |
| 1742 | fail_gpio3: |
| 1743 | gpio_free(GPIO_SPI_MISO); |
| 1744 | fail_gpio4: |
| 1745 | gpio_free(GPIO_SPI_MOSI); |
| 1746 | fail_gpio5: |
| 1747 | gpio_free(GPIO_SPI_CS0_N); |
| 1748 | fail_gpio6: |
| 1749 | gpio_free(GPIO_SPI_CLK); |
| 1750 | lcdc_gpio_initialized = 0; |
| 1751 | } |
| 1752 | |
| 1753 | static uint32_t lcdc_gpio_table[] = { |
| 1754 | GPIO_SPI_CLK, |
| 1755 | GPIO_SPI_CS0_N, |
| 1756 | GPIO_SPI_MOSI, |
| 1757 | GPIO_DISPLAY_PWR_EN, |
| 1758 | GPIO_BACKLIGHT_EN, |
| 1759 | GPIO_SPI_MISO, |
| 1760 | }; |
| 1761 | |
| 1762 | static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable) |
| 1763 | { |
| 1764 | int n; |
| 1765 | |
| 1766 | if (lcdc_gpio_initialized) { |
| 1767 | /* All are IO Expander GPIOs */ |
| 1768 | for (n = 0; n < (len - 1); n++) |
| 1769 | gpio_direction_output(table[n], 1); |
| 1770 | } |
| 1771 | } |
| 1772 | |
| 1773 | static void lcdc_toshiba_config_gpios(int enable) |
| 1774 | { |
| 1775 | config_lcdc_gpio_table(lcdc_gpio_table, |
| 1776 | ARRAY_SIZE(lcdc_gpio_table), enable); |
| 1777 | } |
| 1778 | |
| 1779 | static int msm_fb_lcdc_power_save(int on) |
| 1780 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1781 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1782 | /* Doing the init of the LCDC GPIOs very late as they are from |
| 1783 | an I2C-controlled IO Expander */ |
| 1784 | lcdc_toshiba_gpio_init(); |
| 1785 | |
| 1786 | if (lcdc_gpio_initialized) { |
| 1787 | gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); |
| 1788 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); |
| 1789 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1790 | rc = on ? regulator_bulk_enable( |
| 1791 | ARRAY_SIZE(regs_lcdc), regs_lcdc) : |
| 1792 | regulator_bulk_disable( |
| 1793 | ARRAY_SIZE(regs_lcdc), regs_lcdc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1794 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1795 | if (rc) |
| 1796 | pr_err("%s: could not %sable regulators: %d\n", |
| 1797 | __func__, on ? "en" : "dis", rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1798 | } |
| 1799 | |
| 1800 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1801 | } |
| 1802 | |
| 1803 | |
| 1804 | static int lcdc_toshiba_set_bl(int level) |
| 1805 | { |
| 1806 | int ret; |
| 1807 | |
| 1808 | ret = pmapp_disp_backlight_set_brightness(level); |
| 1809 | if (ret) |
| 1810 | pr_err("%s: can't set lcd backlight!\n", __func__); |
| 1811 | |
| 1812 | return ret; |
| 1813 | } |
| 1814 | |
| 1815 | |
| 1816 | static struct lcdc_platform_data lcdc_pdata = { |
Jeevan Shriram | 15f2a5e | 2011-07-13 21:45:26 +0530 | [diff] [blame] | 1817 | .lcdc_gpio_config = NULL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1818 | .lcdc_power_save = msm_fb_lcdc_power_save, |
| 1819 | }; |
| 1820 | |
| 1821 | static int lcd_panel_spi_gpio_num[] = { |
| 1822 | GPIO_SPI_MOSI, /* spi_sdi */ |
| 1823 | GPIO_SPI_MISO, /* spi_sdoi */ |
| 1824 | GPIO_SPI_CLK, /* spi_clk */ |
| 1825 | GPIO_SPI_CS0_N, /* spi_cs */ |
| 1826 | }; |
| 1827 | |
| 1828 | static struct msm_panel_common_pdata lcdc_toshiba_panel_data = { |
| 1829 | .panel_config_gpio = lcdc_toshiba_config_gpios, |
| 1830 | .pmic_backlight = lcdc_toshiba_set_bl, |
| 1831 | .gpio_num = lcd_panel_spi_gpio_num, |
| 1832 | }; |
| 1833 | |
| 1834 | static struct platform_device lcdc_toshiba_panel_device = { |
| 1835 | .name = "lcdc_toshiba_fwvga_pt", |
| 1836 | .id = 0, |
| 1837 | .dev = { |
| 1838 | .platform_data = &lcdc_toshiba_panel_data, |
| 1839 | } |
| 1840 | }; |
| 1841 | |
| 1842 | static struct resource msm_fb_resources[] = { |
| 1843 | { |
| 1844 | .flags = IORESOURCE_DMA, |
| 1845 | } |
| 1846 | }; |
| 1847 | |
Ajay Singh Parmar | eede70e | 2011-08-24 17:36:08 +0530 | [diff] [blame] | 1848 | #define PANEL_NAME_MAX_LEN 30 |
| 1849 | #define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt" |
| 1850 | #define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga" |
| 1851 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1852 | static int msm_fb_detect_panel(const char *name) |
| 1853 | { |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1854 | int ret = -ENODEV; |
| 1855 | |
| 1856 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
| 1857 | if (!strncmp(name, "lcdc_toshiba_fwvga_pt", 21) || |
| 1858 | !strncmp(name, "mipi_cmd_renesas_fwvga", 22)) |
| 1859 | ret = 0; |
Jeevan Shriram | 29c9e95 | 2011-10-27 11:22:46 +0530 | [diff] [blame] | 1860 | } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) { |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1861 | if (!strncmp(name, "mipi_cmd_renesas_fwvga", 22)) |
| 1862 | ret = 0; |
| 1863 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1864 | |
Ajay Singh Parmar | eede70e | 2011-08-24 17:36:08 +0530 | [diff] [blame] | 1865 | #if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \ |
| 1866 | !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \ |
| 1867 | !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT) |
| 1868 | if (machine_is_msm7x27a_surf() || |
| 1869 | machine_is_msm7625a_surf()) { |
| 1870 | if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME, |
| 1871 | strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME, |
| 1872 | PANEL_NAME_MAX_LEN))) |
| 1873 | return 0; |
| 1874 | } |
| 1875 | #endif |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1876 | return ret; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1877 | } |
| 1878 | |
| 1879 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 1880 | .detect_client = msm_fb_detect_panel, |
| 1881 | }; |
| 1882 | |
| 1883 | static struct platform_device msm_fb_device = { |
| 1884 | .name = "msm_fb", |
| 1885 | .id = 0, |
| 1886 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 1887 | .resource = msm_fb_resources, |
| 1888 | .dev = { |
| 1889 | .platform_data = &msm_fb_pdata, |
| 1890 | } |
| 1891 | }; |
| 1892 | |
| 1893 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 1894 | static int mipi_renesas_set_bl(int level) |
| 1895 | { |
| 1896 | int ret; |
| 1897 | |
| 1898 | ret = pmapp_disp_backlight_set_brightness(level); |
| 1899 | |
| 1900 | if (ret) |
| 1901 | pr_err("%s: can't set lcd backlight!\n", __func__); |
| 1902 | |
| 1903 | return ret; |
| 1904 | } |
| 1905 | |
| 1906 | static struct msm_panel_common_pdata mipi_renesas_pdata = { |
| 1907 | .pmic_backlight = mipi_renesas_set_bl, |
| 1908 | }; |
| 1909 | |
| 1910 | |
| 1911 | static struct platform_device mipi_dsi_renesas_panel_device = { |
| 1912 | .name = "mipi_renesas", |
| 1913 | .id = 0, |
| 1914 | .dev = { |
| 1915 | .platform_data = &mipi_renesas_pdata, |
| 1916 | } |
| 1917 | }; |
| 1918 | #endif |
| 1919 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1920 | #define SND(desc, num) { .name = #desc, .id = num } |
| 1921 | static struct snd_endpoint snd_endpoints_list[] = { |
| 1922 | SND(HANDSET, 0), |
| 1923 | SND(MONO_HEADSET, 2), |
| 1924 | SND(HEADSET, 3), |
| 1925 | SND(SPEAKER, 6), |
| 1926 | SND(TTY_HEADSET, 8), |
| 1927 | SND(TTY_VCO, 9), |
| 1928 | SND(TTY_HCO, 10), |
| 1929 | SND(BT, 12), |
| 1930 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 1931 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 1932 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 1933 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 1934 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
Shashi Kumar | 64e0760 | 2011-10-11 13:18:57 +0530 | [diff] [blame] | 1935 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
Sidipotu Ashok | ab34ca4 | 2011-07-22 16:34:20 +0530 | [diff] [blame] | 1936 | SND(CURRENT, 0x7FFFFFFE), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1937 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 1938 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 1939 | }; |
| 1940 | #undef SND |
| 1941 | |
| 1942 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 1943 | .endpoints = snd_endpoints_list, |
| 1944 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 1945 | }; |
| 1946 | |
| 1947 | static struct platform_device msm_device_snd = { |
| 1948 | .name = "msm_snd", |
| 1949 | .id = -1, |
| 1950 | .dev = { |
| 1951 | .platform_data = &msm_device_snd_endpoints |
| 1952 | }, |
| 1953 | }; |
| 1954 | |
| 1955 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 1956 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 1957 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 1958 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 1959 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 1960 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 1961 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 1962 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 1963 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 1964 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 1965 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 1966 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 1967 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 1968 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 1969 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 1970 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 1971 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 1972 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 1973 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 1974 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 1975 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 1976 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 1977 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 1978 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 1979 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 1980 | |
| 1981 | static unsigned int dec_concurrency_table[] = { |
| 1982 | /* Audio LP */ |
| 1983 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 1984 | 0, 0, 0, |
| 1985 | |
| 1986 | /* Concurrency 1 */ |
| 1987 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1988 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1989 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1990 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1991 | (DEC4_FORMAT), |
| 1992 | |
| 1993 | /* Concurrency 2 */ |
| 1994 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1995 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1996 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1997 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 1998 | (DEC4_FORMAT), |
| 1999 | |
| 2000 | /* Concurrency 3 */ |
| 2001 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2002 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2003 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2004 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2005 | (DEC4_FORMAT), |
| 2006 | |
| 2007 | /* Concurrency 4 */ |
| 2008 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2009 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2010 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2011 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2012 | (DEC4_FORMAT), |
| 2013 | |
| 2014 | /* Concurrency 5 */ |
| 2015 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2016 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2017 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2018 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2019 | (DEC4_FORMAT), |
| 2020 | |
| 2021 | /* Concurrency 6 */ |
| 2022 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2023 | 0, 0, 0, 0, |
| 2024 | |
| 2025 | /* Concurrency 7 */ |
| 2026 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2027 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2028 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2029 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2030 | (DEC4_FORMAT), |
| 2031 | }; |
| 2032 | |
| 2033 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 2034 | .module_queueid = queueid, .module_decid = decid, \ |
| 2035 | .nr_codec_support = nr_codec} |
| 2036 | |
| 2037 | static struct msm_adspdec_info dec_info_list[] = { |
| 2038 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 2039 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 2040 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 2041 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 2042 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 2043 | }; |
| 2044 | |
| 2045 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 2046 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 2047 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 2048 | ARRAY_SIZE(dec_info_list)), |
| 2049 | .dec_concurrency_table = dec_concurrency_table, |
| 2050 | .dec_info_list = dec_info_list, |
| 2051 | }; |
| 2052 | |
| 2053 | static struct platform_device msm_device_adspdec = { |
| 2054 | .name = "msm_adspdec", |
| 2055 | .id = -1, |
| 2056 | .dev = { |
| 2057 | .platform_data = &msm_device_adspdec_database |
| 2058 | }, |
| 2059 | }; |
| 2060 | |
| 2061 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 2062 | .name = "pmem_audio", |
| 2063 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 2064 | .cached = 0, |
| 2065 | .memory_type = MEMTYPE_EBI1, |
| 2066 | }; |
| 2067 | |
| 2068 | static struct platform_device android_pmem_audio_device = { |
| 2069 | .name = "android_pmem", |
| 2070 | .id = 2, |
| 2071 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 2072 | }; |
| 2073 | |
| 2074 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 2075 | .name = "pmem", |
| 2076 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 2077 | .cached = 1, |
| 2078 | .memory_type = MEMTYPE_EBI1, |
| 2079 | }; |
| 2080 | static struct platform_device android_pmem_device = { |
| 2081 | .name = "android_pmem", |
| 2082 | .id = 0, |
| 2083 | .dev = { .platform_data = &android_pmem_pdata }, |
| 2084 | }; |
| 2085 | |
| 2086 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 2087 | |
| 2088 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 2089 | .voltage_min_design = 2800, |
| 2090 | .voltage_max_design = 4300, |
| 2091 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 2092 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 2093 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 2094 | }; |
| 2095 | |
| 2096 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 2097 | { |
| 2098 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 2099 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 2100 | |
| 2101 | return (current_voltage - low_voltage) * 100 |
| 2102 | / (high_voltage - low_voltage); |
| 2103 | } |
| 2104 | |
| 2105 | static struct platform_device msm_batt_device = { |
| 2106 | .name = "msm-battery", |
| 2107 | .id = -1, |
| 2108 | .dev.platform_data = &msm_psy_batt_data, |
| 2109 | }; |
| 2110 | |
| 2111 | static struct smsc911x_platform_config smsc911x_config = { |
| 2112 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 2113 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 2114 | .flags = SMSC911X_USE_16BIT, |
| 2115 | }; |
| 2116 | |
| 2117 | static struct resource smsc911x_resources[] = { |
| 2118 | [0] = { |
| 2119 | .start = 0x90000000, |
| 2120 | .end = 0x90007fff, |
| 2121 | .flags = IORESOURCE_MEM, |
| 2122 | }, |
| 2123 | [1] = { |
| 2124 | .start = MSM_GPIO_TO_INT(48), |
| 2125 | .end = MSM_GPIO_TO_INT(48), |
| 2126 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 2127 | }, |
| 2128 | }; |
| 2129 | |
| 2130 | static struct platform_device smsc911x_device = { |
| 2131 | .name = "smsc911x", |
| 2132 | .id = 0, |
| 2133 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 2134 | .resource = smsc911x_resources, |
| 2135 | .dev = { |
| 2136 | .platform_data = &smsc911x_config, |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
| 2140 | static struct msm_gpio smsc911x_gpios[] = { |
| 2141 | { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 2142 | "smsc911x_irq" }, |
| 2143 | { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 2144 | "eth_fifo_sel" }, |
| 2145 | }; |
| 2146 | |
| 2147 | #define ETH_FIFO_SEL_GPIO 49 |
| 2148 | static void msm7x27a_cfg_smsc911x(void) |
| 2149 | { |
| 2150 | int res; |
| 2151 | |
| 2152 | res = msm_gpios_request_enable(smsc911x_gpios, |
| 2153 | ARRAY_SIZE(smsc911x_gpios)); |
| 2154 | if (res) { |
| 2155 | pr_err("%s: unable to enable gpios for SMSC911x\n", __func__); |
| 2156 | return; |
| 2157 | } |
| 2158 | |
| 2159 | /* ETH_FIFO_SEL */ |
| 2160 | res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0); |
| 2161 | if (res) { |
| 2162 | pr_err("%s: unable to get direction for gpio %d\n", __func__, |
| 2163 | ETH_FIFO_SEL_GPIO); |
| 2164 | msm_gpios_disable_free(smsc911x_gpios, |
| 2165 | ARRAY_SIZE(smsc911x_gpios)); |
| 2166 | return; |
| 2167 | } |
| 2168 | gpio_set_value(ETH_FIFO_SEL_GPIO, 0); |
| 2169 | } |
| 2170 | |
| 2171 | #ifdef CONFIG_MSM_CAMERA |
| 2172 | static uint32_t camera_off_gpio_table[] = { |
| 2173 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 2174 | }; |
| 2175 | |
| 2176 | static uint32_t camera_on_gpio_table[] = { |
| 2177 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 2178 | }; |
| 2179 | |
| 2180 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 2181 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 2182 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT, |
| 2183 | ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1, |
| 2184 | ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2185 | }; |
| 2186 | #endif |
| 2187 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2188 | static struct regulator_bulk_data regs_camera[] = { |
| 2189 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2190 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 2191 | { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2192 | }; |
| 2193 | |
| 2194 | static void __init msm_camera_vreg_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2195 | { |
| 2196 | int rc; |
| 2197 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2198 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2199 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2200 | if (rc) { |
| 2201 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 2202 | return; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2203 | } |
| 2204 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2205 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2206 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2207 | if (rc) { |
| 2208 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 2209 | return; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2210 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2211 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2212 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2213 | static void msm_camera_vreg_config(int vreg_en) |
| 2214 | { |
| 2215 | int rc = vreg_en ? |
| 2216 | regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) : |
| 2217 | regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2218 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2219 | if (rc) |
| 2220 | pr_err("%s: could not %sable regulators: %d\n", |
| 2221 | __func__, vreg_en ? "en" : "dis", rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2222 | } |
| 2223 | |
| 2224 | static int config_gpio_table(uint32_t *table, int len) |
| 2225 | { |
| 2226 | int rc = 0, i = 0; |
| 2227 | |
| 2228 | for (i = 0; i < len; i++) { |
| 2229 | rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE); |
| 2230 | if (rc) { |
| 2231 | pr_err("%s not able to get gpio\n", __func__); |
| 2232 | for (i--; i >= 0; i--) |
| 2233 | gpio_tlmm_config(camera_off_gpio_table[i], |
| 2234 | GPIO_CFG_ENABLE); |
| 2235 | break; |
| 2236 | } |
| 2237 | } |
| 2238 | return rc; |
| 2239 | } |
| 2240 | |
| 2241 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data; |
| 2242 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data; |
| 2243 | static int config_camera_on_gpios_rear(void) |
| 2244 | { |
| 2245 | int rc = 0; |
| 2246 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2247 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2248 | msm_camera_vreg_config(1); |
| 2249 | |
| 2250 | rc = config_gpio_table(camera_on_gpio_table, |
| 2251 | ARRAY_SIZE(camera_on_gpio_table)); |
| 2252 | if (rc < 0) { |
| 2253 | pr_err("%s: CAMSENSOR gpio table request" |
| 2254 | "failed\n", __func__); |
| 2255 | return rc; |
| 2256 | } |
| 2257 | |
| 2258 | return rc; |
| 2259 | } |
| 2260 | |
| 2261 | static void config_camera_off_gpios_rear(void) |
| 2262 | { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2263 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2264 | msm_camera_vreg_config(0); |
| 2265 | |
| 2266 | config_gpio_table(camera_off_gpio_table, |
| 2267 | ARRAY_SIZE(camera_off_gpio_table)); |
| 2268 | } |
| 2269 | |
| 2270 | static int config_camera_on_gpios_front(void) |
| 2271 | { |
| 2272 | int rc = 0; |
| 2273 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2274 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2275 | msm_camera_vreg_config(1); |
| 2276 | |
| 2277 | rc = config_gpio_table(camera_on_gpio_table, |
| 2278 | ARRAY_SIZE(camera_on_gpio_table)); |
| 2279 | if (rc < 0) { |
| 2280 | pr_err("%s: CAMSENSOR gpio table request" |
| 2281 | "failed\n", __func__); |
| 2282 | return rc; |
| 2283 | } |
| 2284 | |
| 2285 | return rc; |
| 2286 | } |
| 2287 | |
| 2288 | static void config_camera_off_gpios_front(void) |
| 2289 | { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2290 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2291 | msm_camera_vreg_config(0); |
| 2292 | |
| 2293 | config_gpio_table(camera_off_gpio_table, |
| 2294 | ARRAY_SIZE(camera_off_gpio_table)); |
| 2295 | } |
| 2296 | |
| 2297 | struct msm_camera_device_platform_data msm_camera_device_data_rear = { |
| 2298 | .camera_gpio_on = config_camera_on_gpios_rear, |
| 2299 | .camera_gpio_off = config_camera_off_gpios_rear, |
| 2300 | .ioext.csiphy = 0xA1000000, |
| 2301 | .ioext.csisz = 0x00100000, |
| 2302 | .ioext.csiirq = INT_CSI_IRQ_1, |
| 2303 | .ioclk.mclk_clk_rate = 24000000, |
| 2304 | .ioclk.vfe_clk_rate = 192000000, |
| 2305 | .ioext.appphy = MSM_CLK_CTL_PHYS, |
| 2306 | .ioext.appsz = MSM_CLK_CTL_SIZE, |
| 2307 | }; |
| 2308 | |
| 2309 | struct msm_camera_device_platform_data msm_camera_device_data_front = { |
| 2310 | .camera_gpio_on = config_camera_on_gpios_front, |
| 2311 | .camera_gpio_off = config_camera_off_gpios_front, |
| 2312 | .ioext.csiphy = 0xA0F00000, |
| 2313 | .ioext.csisz = 0x00100000, |
| 2314 | .ioext.csiirq = INT_CSI_IRQ_0, |
| 2315 | .ioclk.mclk_clk_rate = 24000000, |
| 2316 | .ioclk.vfe_clk_rate = 192000000, |
| 2317 | .ioext.appphy = MSM_CLK_CTL_PHYS, |
| 2318 | .ioext.appsz = MSM_CLK_CTL_SIZE, |
| 2319 | }; |
| 2320 | |
| 2321 | #ifdef CONFIG_S5K4E1 |
| 2322 | static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = { |
| 2323 | .mount_angle = 90 |
| 2324 | }; |
| 2325 | |
| 2326 | static struct msm_camera_sensor_flash_data flash_s5k4e1 = { |
| 2327 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2328 | .flash_src = &msm_flash_src |
| 2329 | }; |
| 2330 | |
| 2331 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = { |
| 2332 | .sensor_name = "s5k4e1", |
| 2333 | .sensor_reset_enable = 1, |
| 2334 | .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, |
| 2335 | .sensor_pwd = 85, |
| 2336 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 2337 | .vcm_enable = 1, |
| 2338 | .pdata = &msm_camera_device_data_rear, |
| 2339 | .flash_data = &flash_s5k4e1, |
| 2340 | .sensor_platform_info = &s5k4e1_sensor_7627a_info, |
| 2341 | .csi_if = 1 |
| 2342 | }; |
| 2343 | |
| 2344 | static struct platform_device msm_camera_sensor_s5k4e1 = { |
| 2345 | .name = "msm_camera_s5k4e1", |
| 2346 | .dev = { |
| 2347 | .platform_data = &msm_camera_sensor_s5k4e1_data, |
| 2348 | }, |
| 2349 | }; |
| 2350 | #endif |
| 2351 | |
| 2352 | #ifdef CONFIG_IMX072 |
| 2353 | static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = { |
| 2354 | .mount_angle = 90 |
| 2355 | }; |
| 2356 | |
| 2357 | static struct msm_camera_sensor_flash_data flash_imx072 = { |
| 2358 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2359 | .flash_src = &msm_flash_src |
| 2360 | }; |
| 2361 | |
| 2362 | static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = { |
| 2363 | .sensor_name = "imx072", |
| 2364 | .sensor_reset_enable = 1, |
| 2365 | .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/ |
| 2366 | .sensor_pwd = 85, |
| 2367 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 2368 | .vcm_enable = 1, |
| 2369 | .pdata = &msm_camera_device_data_rear, |
| 2370 | .flash_data = &flash_imx072, |
| 2371 | .sensor_platform_info = &imx072_sensor_7627a_info, |
| 2372 | .csi_if = 1 |
| 2373 | }; |
| 2374 | |
| 2375 | static struct platform_device msm_camera_sensor_imx072 = { |
| 2376 | .name = "msm_camera_imx072", |
| 2377 | .dev = { |
| 2378 | .platform_data = &msm_camera_sensor_imx072_data, |
| 2379 | }, |
| 2380 | }; |
| 2381 | #endif |
| 2382 | |
| 2383 | #ifdef CONFIG_WEBCAM_OV9726 |
| 2384 | static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = { |
| 2385 | .mount_angle = 90 |
| 2386 | }; |
| 2387 | |
| 2388 | static struct msm_camera_sensor_flash_data flash_ov9726 = { |
| 2389 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 2390 | .flash_src = &msm_flash_src |
| 2391 | }; |
| 2392 | |
| 2393 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = { |
| 2394 | .sensor_name = "ov9726", |
| 2395 | .sensor_reset_enable = 0, |
| 2396 | .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR, |
| 2397 | .sensor_pwd = 85, |
| 2398 | .vcm_pwd = 1, |
| 2399 | .vcm_enable = 0, |
| 2400 | .pdata = &msm_camera_device_data_front, |
| 2401 | .flash_data = &flash_ov9726, |
| 2402 | .sensor_platform_info = &ov9726_sensor_7627a_info, |
| 2403 | .csi_if = 1 |
| 2404 | }; |
| 2405 | |
| 2406 | static struct platform_device msm_camera_sensor_ov9726 = { |
| 2407 | .name = "msm_camera_ov9726", |
| 2408 | .dev = { |
| 2409 | .platform_data = &msm_camera_sensor_ov9726_data, |
| 2410 | }, |
| 2411 | }; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2412 | #else |
| 2413 | static inline void msm_camera_vreg_init(void) { } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2414 | #endif |
| 2415 | |
| 2416 | #ifdef CONFIG_MT9E013 |
| 2417 | static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = { |
| 2418 | .mount_angle = 90 |
| 2419 | }; |
| 2420 | |
| 2421 | static struct msm_camera_sensor_flash_data flash_mt9e013 = { |
| 2422 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2423 | .flash_src = &msm_flash_src |
| 2424 | }; |
| 2425 | |
| 2426 | static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = { |
| 2427 | .sensor_name = "mt9e013", |
| 2428 | .sensor_reset = 0, |
| 2429 | .sensor_reset_enable = 1, |
| 2430 | .sensor_pwd = 85, |
| 2431 | .vcm_pwd = 1, |
| 2432 | .vcm_enable = 0, |
| 2433 | .pdata = &msm_camera_device_data_rear, |
| 2434 | .flash_data = &flash_mt9e013, |
| 2435 | .sensor_platform_info = &mt9e013_sensor_7627a_info, |
| 2436 | .csi_if = 1 |
| 2437 | }; |
| 2438 | |
| 2439 | static struct platform_device msm_camera_sensor_mt9e013 = { |
| 2440 | .name = "msm_camera_mt9e013", |
| 2441 | .dev = { |
| 2442 | .platform_data = &msm_camera_sensor_mt9e013_data, |
| 2443 | }, |
| 2444 | }; |
| 2445 | #endif |
| 2446 | |
| 2447 | static struct i2c_board_info i2c_camera_devices[] = { |
| 2448 | #ifdef CONFIG_S5K4E1 |
| 2449 | { |
| 2450 | I2C_BOARD_INFO("s5k4e1", 0x36), |
| 2451 | }, |
| 2452 | { |
| 2453 | I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1), |
| 2454 | }, |
| 2455 | #endif |
| 2456 | #ifdef CONFIG_WEBCAM_OV9726 |
| 2457 | { |
| 2458 | I2C_BOARD_INFO("ov9726", 0x10), |
| 2459 | }, |
| 2460 | #endif |
| 2461 | #ifdef CONFIG_IMX072 |
| 2462 | { |
| 2463 | I2C_BOARD_INFO("imx072", 0x34), |
| 2464 | }, |
| 2465 | #endif |
| 2466 | #ifdef CONFIG_MT9E013 |
| 2467 | { |
| 2468 | I2C_BOARD_INFO("mt9e013", 0x6C >> 2), |
| 2469 | }, |
| 2470 | #endif |
| 2471 | { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 2472 | I2C_BOARD_INFO("sc628a", 0x6E), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2473 | }, |
| 2474 | }; |
| 2475 | #endif |
| 2476 | #if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \ |
| 2477 | && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM) |
| 2478 | static struct msm_gpio uart2dm_gpios[] = { |
| 2479 | {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2480 | "uart2dm_rfr_n" }, |
| 2481 | {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2482 | "uart2dm_cts_n" }, |
| 2483 | {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2484 | "uart2dm_rx" }, |
| 2485 | {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2486 | "uart2dm_tx" }, |
| 2487 | }; |
| 2488 | |
| 2489 | static void msm7x27a_cfg_uart2dm_serial(void) |
| 2490 | { |
| 2491 | int ret; |
| 2492 | ret = msm_gpios_request_enable(uart2dm_gpios, |
| 2493 | ARRAY_SIZE(uart2dm_gpios)); |
| 2494 | if (ret) |
| 2495 | pr_err("%s: unable to enable gpios for uart2dm\n", __func__); |
| 2496 | } |
| 2497 | #else |
| 2498 | static void msm7x27a_cfg_uart2dm_serial(void) { } |
| 2499 | #endif |
| 2500 | |
| 2501 | static struct platform_device *rumi_sim_devices[] __initdata = { |
| 2502 | &msm_device_dmov, |
| 2503 | &msm_device_smd, |
| 2504 | &smc91x_device, |
| 2505 | &msm_device_uart1, |
| 2506 | &msm_device_nand, |
| 2507 | &msm_device_uart_dm1, |
| 2508 | &msm_gsbi0_qup_i2c_device, |
| 2509 | &msm_gsbi1_qup_i2c_device, |
| 2510 | }; |
| 2511 | |
| 2512 | static struct platform_device *surf_ffa_devices[] __initdata = { |
| 2513 | &msm_device_dmov, |
| 2514 | &msm_device_smd, |
| 2515 | &msm_device_uart1, |
| 2516 | &msm_device_uart_dm1, |
| 2517 | &msm_device_uart_dm2, |
| 2518 | &msm_device_nand, |
| 2519 | &msm_gsbi0_qup_i2c_device, |
| 2520 | &msm_gsbi1_qup_i2c_device, |
| 2521 | &msm_device_otg, |
| 2522 | &msm_device_gadget_peripheral, |
| 2523 | &android_usb_device, |
| 2524 | &android_pmem_device, |
| 2525 | &android_pmem_adsp_device, |
| 2526 | &android_pmem_audio_device, |
| 2527 | &msm_device_snd, |
| 2528 | &msm_device_adspdec, |
| 2529 | &msm_fb_device, |
| 2530 | &lcdc_toshiba_panel_device, |
| 2531 | &msm_batt_device, |
| 2532 | &smsc911x_device, |
| 2533 | #ifdef CONFIG_S5K4E1 |
| 2534 | &msm_camera_sensor_s5k4e1, |
| 2535 | #endif |
| 2536 | #ifdef CONFIG_IMX072 |
| 2537 | &msm_camera_sensor_imx072, |
| 2538 | #endif |
| 2539 | #ifdef CONFIG_WEBCAM_OV9726 |
| 2540 | &msm_camera_sensor_ov9726, |
| 2541 | #endif |
| 2542 | #ifdef CONFIG_MT9E013 |
| 2543 | &msm_camera_sensor_mt9e013, |
| 2544 | #endif |
| 2545 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 2546 | &mipi_dsi_renesas_panel_device, |
| 2547 | #endif |
| 2548 | &msm_kgsl_3d0, |
| 2549 | #ifdef CONFIG_BT |
| 2550 | &msm_bt_power_device, |
| 2551 | #endif |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 2552 | &asoc_msm_pcm, |
| 2553 | &asoc_msm_dai0, |
| 2554 | &asoc_msm_dai1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2555 | }; |
| 2556 | |
| 2557 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 2558 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 2559 | { |
| 2560 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 2561 | return 0; |
| 2562 | } |
| 2563 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 2564 | |
| 2565 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 2566 | static int __init pmem_audio_size_setup(char *p) |
| 2567 | { |
| 2568 | pmem_audio_size = memparse(p, NULL); |
| 2569 | return 0; |
| 2570 | } |
| 2571 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 2572 | |
| 2573 | static void __init msm_msm7x2x_allocate_memory_regions(void) |
| 2574 | { |
| 2575 | void *addr; |
| 2576 | unsigned long size; |
| 2577 | |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 2578 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) |
| 2579 | fb_size = MSM7x25A_MSM_FB_SIZE; |
| 2580 | else |
| 2581 | fb_size = MSM_FB_SIZE; |
| 2582 | |
| 2583 | size = fb_size; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2584 | addr = alloc_bootmem_align(size, 0x1000); |
| 2585 | msm_fb_resources[0].start = __pa(addr); |
| 2586 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 2587 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 2588 | size, addr, __pa(addr)); |
| 2589 | } |
| 2590 | |
| 2591 | static struct memtype_reserve msm7x27a_reserve_table[] __initdata = { |
| 2592 | [MEMTYPE_SMI] = { |
| 2593 | }, |
| 2594 | [MEMTYPE_EBI0] = { |
| 2595 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 2596 | }, |
| 2597 | [MEMTYPE_EBI1] = { |
| 2598 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 2599 | }, |
| 2600 | }; |
| 2601 | |
| 2602 | static void __init size_pmem_devices(void) |
| 2603 | { |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 2604 | |
| 2605 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
| 2606 | pmem_mdp_size = MSM7x25A_MSM_PMEM_MDP_SIZE; |
| 2607 | pmem_adsp_size = MSM7x25A_MSM_PMEM_ADSP_SIZE; |
| 2608 | } else { |
| 2609 | pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 2610 | pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 2611 | } |
| 2612 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2613 | #ifdef CONFIG_ANDROID_PMEM |
| 2614 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 2615 | android_pmem_pdata.size = pmem_mdp_size; |
| 2616 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 2617 | #endif |
| 2618 | } |
| 2619 | |
| 2620 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 2621 | { |
| 2622 | msm7x27a_reserve_table[p->memory_type].size += p->size; |
| 2623 | } |
| 2624 | |
| 2625 | static void __init reserve_pmem_memory(void) |
| 2626 | { |
| 2627 | #ifdef CONFIG_ANDROID_PMEM |
| 2628 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 2629 | reserve_memory_for(&android_pmem_pdata); |
| 2630 | reserve_memory_for(&android_pmem_audio_pdata); |
| 2631 | msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 2632 | #endif |
| 2633 | } |
| 2634 | |
| 2635 | static void __init msm7x27a_calculate_reserve_sizes(void) |
| 2636 | { |
| 2637 | size_pmem_devices(); |
| 2638 | reserve_pmem_memory(); |
| 2639 | } |
| 2640 | |
| 2641 | static int msm7x27a_paddr_to_memtype(unsigned int paddr) |
| 2642 | { |
| 2643 | return MEMTYPE_EBI1; |
| 2644 | } |
| 2645 | |
| 2646 | static struct reserve_info msm7x27a_reserve_info __initdata = { |
| 2647 | .memtype_reserve_table = msm7x27a_reserve_table, |
| 2648 | .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes, |
| 2649 | .paddr_to_memtype = msm7x27a_paddr_to_memtype, |
| 2650 | }; |
| 2651 | |
| 2652 | static void __init msm7x27a_reserve(void) |
| 2653 | { |
| 2654 | reserve_info = &msm7x27a_reserve_info; |
| 2655 | msm_reserve(); |
| 2656 | } |
| 2657 | |
| 2658 | static void __init msm_device_i2c_init(void) |
| 2659 | { |
| 2660 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 2661 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 2662 | } |
| 2663 | |
| 2664 | static struct msm_panel_common_pdata mdp_pdata = { |
| 2665 | .gpio = 97, |
| 2666 | .mdp_rev = MDP_REV_303, |
| 2667 | }; |
| 2668 | |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 2669 | |
| 2670 | #ifdef CONFIG_FB_MSM |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2671 | #define GPIO_LCDC_BRDG_PD 128 |
| 2672 | #define GPIO_LCDC_BRDG_RESET_N 129 |
| 2673 | |
| 2674 | #define LCDC_RESET_PHYS 0x90008014 |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 2675 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2676 | static void __iomem *lcdc_reset_ptr; |
| 2677 | |
| 2678 | static unsigned mipi_dsi_gpio[] = { |
| 2679 | GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 2680 | GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */ |
| 2681 | GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 2682 | GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */ |
| 2683 | }; |
| 2684 | |
| 2685 | enum { |
| 2686 | DSI_SINGLE_LANE = 1, |
| 2687 | DSI_TWO_LANES, |
| 2688 | }; |
| 2689 | |
| 2690 | static int msm_fb_get_lane_config(void) |
| 2691 | { |
| 2692 | int rc = DSI_TWO_LANES; |
| 2693 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2694 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2695 | rc = DSI_SINGLE_LANE; |
| 2696 | pr_info("DSI Single Lane\n"); |
| 2697 | } else { |
| 2698 | pr_info("DSI Two Lanes\n"); |
| 2699 | } |
| 2700 | return rc; |
| 2701 | } |
| 2702 | |
| 2703 | static int msm_fb_dsi_client_reset(void) |
| 2704 | { |
| 2705 | int rc = 0; |
| 2706 | |
| 2707 | rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n"); |
| 2708 | if (rc < 0) { |
| 2709 | pr_err("failed to request lcd brdg reset_n\n"); |
| 2710 | return rc; |
| 2711 | } |
| 2712 | |
| 2713 | rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd"); |
| 2714 | if (rc < 0) { |
| 2715 | pr_err("failed to request lcd brdg pd\n"); |
| 2716 | return rc; |
| 2717 | } |
| 2718 | |
| 2719 | rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE); |
| 2720 | if (rc) { |
| 2721 | pr_err("Failed to enable LCDC Bridge reset enable\n"); |
| 2722 | goto gpio_error; |
| 2723 | } |
| 2724 | |
| 2725 | rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE); |
| 2726 | if (rc) { |
| 2727 | pr_err("Failed to enable LCDC Bridge pd enable\n"); |
| 2728 | goto gpio_error2; |
| 2729 | } |
| 2730 | |
| 2731 | rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1); |
| 2732 | rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1); |
| 2733 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0); |
| 2734 | |
| 2735 | if (!rc) { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2736 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2737 | lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS, |
| 2738 | sizeof(uint32_t)); |
| 2739 | |
| 2740 | if (!lcdc_reset_ptr) |
| 2741 | return 0; |
| 2742 | } |
| 2743 | return rc; |
| 2744 | } else { |
| 2745 | goto gpio_error; |
| 2746 | } |
| 2747 | |
| 2748 | gpio_error2: |
| 2749 | pr_err("Failed GPIO bridge pd\n"); |
| 2750 | gpio_free(GPIO_LCDC_BRDG_PD); |
| 2751 | |
| 2752 | gpio_error: |
| 2753 | pr_err("Failed GPIO bridge reset\n"); |
| 2754 | gpio_free(GPIO_LCDC_BRDG_RESET_N); |
| 2755 | return rc; |
| 2756 | } |
| 2757 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2758 | static struct regulator_bulk_data regs_dsi[] = { |
| 2759 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 2760 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2761 | }; |
| 2762 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2763 | static int dsi_gpio_initialized; |
| 2764 | |
| 2765 | static int mipi_dsi_panel_power(int on) |
| 2766 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2767 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2768 | uint32_t lcdc_reset_cfg; |
| 2769 | |
| 2770 | /* I2C-controlled GPIO Expander -init of the GPIOs very late */ |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2771 | if (unlikely(!dsi_gpio_initialized)) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2772 | pmapp_disp_backlight_init(); |
| 2773 | |
| 2774 | rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr"); |
| 2775 | if (rc < 0) { |
| 2776 | pr_err("failed to request gpio_disp_pwr\n"); |
| 2777 | return rc; |
| 2778 | } |
| 2779 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2780 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2781 | rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1); |
| 2782 | if (rc < 0) { |
| 2783 | pr_err("failed to enable display pwr\n"); |
| 2784 | goto fail_gpio1; |
| 2785 | } |
| 2786 | |
| 2787 | rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en"); |
| 2788 | if (rc < 0) { |
| 2789 | pr_err("failed to request gpio_bkl_en\n"); |
| 2790 | goto fail_gpio1; |
| 2791 | } |
| 2792 | |
| 2793 | rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1); |
| 2794 | if (rc < 0) { |
| 2795 | pr_err("failed to enable backlight\n"); |
| 2796 | goto fail_gpio2; |
| 2797 | } |
| 2798 | } |
| 2799 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2800 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi); |
| 2801 | if (rc) { |
| 2802 | pr_err("%s: could not get regulators: %d\n", |
| 2803 | __func__, rc); |
| 2804 | goto fail_gpio2; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2805 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2806 | |
| 2807 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi); |
| 2808 | if (rc) { |
| 2809 | pr_err("%s: could not set voltages: %d\n", |
| 2810 | __func__, rc); |
| 2811 | goto fail_vreg; |
| 2812 | } |
| 2813 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2814 | dsi_gpio_initialized = 1; |
| 2815 | } |
| 2816 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2817 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2818 | gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); |
| 2819 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2820 | } else if (machine_is_msm7x27a_ffa() || |
| 2821 | machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2822 | if (on) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2823 | /* This line drives an active low pin on FFA */ |
| 2824 | rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on); |
| 2825 | if (rc < 0) |
| 2826 | pr_err("failed to set direction for " |
| 2827 | "display pwr\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2828 | } else { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2829 | gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on); |
| 2830 | rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN); |
| 2831 | if (rc < 0) |
| 2832 | pr_err("failed to set direction for " |
| 2833 | "display pwr\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2834 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2835 | } |
| 2836 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2837 | if (on) { |
| 2838 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0); |
| 2839 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2840 | if (machine_is_msm7x27a_surf() || |
| 2841 | machine_is_msm7625a_surf()) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2842 | lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr); |
| 2843 | rmb(); |
| 2844 | lcdc_reset_cfg &= ~1; |
| 2845 | |
| 2846 | writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); |
| 2847 | msleep(20); |
| 2848 | wmb(); |
| 2849 | lcdc_reset_cfg |= 1; |
| 2850 | writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); |
| 2851 | } else { |
| 2852 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0); |
| 2853 | msleep(20); |
| 2854 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1); |
| 2855 | } |
| 2856 | |
| 2857 | if (pmapp_disp_backlight_set_brightness(100)) |
| 2858 | pr_err("backlight set brightness failed\n"); |
| 2859 | } else { |
| 2860 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1); |
| 2861 | |
| 2862 | if (pmapp_disp_backlight_set_brightness(0)) |
| 2863 | pr_err("backlight set brightness failed\n"); |
| 2864 | } |
| 2865 | |
| 2866 | rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) : |
| 2867 | regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi); |
| 2868 | |
| 2869 | if (rc) |
| 2870 | pr_err("%s: could not %sable regulators: %d\n", |
| 2871 | __func__, on ? "en" : "dis", rc); |
| 2872 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2873 | return rc; |
| 2874 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2875 | fail_vreg: |
| 2876 | regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2877 | fail_gpio2: |
| 2878 | gpio_free(GPIO_BACKLIGHT_EN); |
| 2879 | fail_gpio1: |
| 2880 | gpio_free(GPIO_DISPLAY_PWR_EN); |
| 2881 | dsi_gpio_initialized = 0; |
| 2882 | return rc; |
| 2883 | } |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 2884 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2885 | |
| 2886 | #define MDP_303_VSYNC_GPIO 97 |
| 2887 | |
| 2888 | #ifdef CONFIG_FB_MSM_MDP303 |
| 2889 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 2890 | .vsync_gpio = MDP_303_VSYNC_GPIO, |
| 2891 | .dsi_power_save = mipi_dsi_panel_power, |
| 2892 | .dsi_client_reset = msm_fb_dsi_client_reset, |
| 2893 | .get_lane_config = msm_fb_get_lane_config, |
| 2894 | }; |
| 2895 | #endif |
| 2896 | |
| 2897 | static void __init msm_fb_add_devices(void) |
| 2898 | { |
| 2899 | msm_fb_register_device("mdp", &mdp_pdata); |
| 2900 | msm_fb_register_device("lcdc", &lcdc_pdata); |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 2901 | #ifdef CONFIG_FB_MSM_MDP303 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2902 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 2903 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2904 | } |
| 2905 | |
| 2906 | #define MSM_EBI2_PHYS 0xa0d00000 |
| 2907 | #define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030 |
| 2908 | |
| 2909 | static void __init msm7x27a_init_ebi2(void) |
| 2910 | { |
| 2911 | uint32_t ebi2_cfg; |
| 2912 | void __iomem *ebi2_cfg_ptr; |
| 2913 | |
| 2914 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t)); |
| 2915 | if (!ebi2_cfg_ptr) |
| 2916 | return; |
| 2917 | |
| 2918 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2919 | if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() || |
| 2920 | machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2921 | ebi2_cfg |= (1 << 4); /* CS2 */ |
| 2922 | |
| 2923 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 2924 | iounmap(ebi2_cfg_ptr); |
| 2925 | |
| 2926 | /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */ |
| 2927 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1, |
| 2928 | sizeof(uint32_t)); |
| 2929 | if (!ebi2_cfg_ptr) |
| 2930 | return; |
| 2931 | |
| 2932 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2933 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2934 | ebi2_cfg |= (1 << 31); |
| 2935 | |
| 2936 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 2937 | iounmap(ebi2_cfg_ptr); |
| 2938 | } |
| 2939 | |
| 2940 | #define ATMEL_TS_I2C_NAME "maXTouch" |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2941 | |
| 2942 | static struct regulator_bulk_data regs_atmel[] = { |
| 2943 | { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 2944 | { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2945 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2946 | |
| 2947 | #define ATMEL_TS_GPIO_IRQ 82 |
| 2948 | |
| 2949 | static int atmel_ts_power_on(bool on) |
| 2950 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2951 | int rc = on ? |
| 2952 | regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) : |
| 2953 | regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2954 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2955 | if (rc) |
| 2956 | pr_err("%s: could not %sable regulators: %d\n", |
| 2957 | __func__, on ? "en" : "dis", rc); |
| 2958 | else |
| 2959 | msleep(50); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2960 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2961 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2962 | } |
| 2963 | |
| 2964 | static int atmel_ts_platform_init(struct i2c_client *client) |
| 2965 | { |
| 2966 | int rc; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2967 | struct device *dev = &client->dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2968 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2969 | rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2970 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2971 | dev_err(dev, "%s: could not get regulators: %d\n", |
| 2972 | __func__, rc); |
| 2973 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2974 | } |
| 2975 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2976 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2977 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2978 | dev_err(dev, "%s: could not set voltages: %d\n", |
| 2979 | __func__, rc); |
| 2980 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2981 | } |
| 2982 | |
| 2983 | rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 2984 | GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 2985 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 2986 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2987 | dev_err(dev, "%s: gpio_tlmm_config for %d failed\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2988 | __func__, ATMEL_TS_GPIO_IRQ); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2989 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2990 | } |
| 2991 | |
| 2992 | /* configure touchscreen interrupt gpio */ |
| 2993 | rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio"); |
| 2994 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2995 | dev_err(dev, "%s: unable to request gpio %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2996 | __func__, ATMEL_TS_GPIO_IRQ); |
| 2997 | goto ts_gpio_tlmm_unconfig; |
| 2998 | } |
| 2999 | |
| 3000 | rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ); |
| 3001 | if (rc < 0) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 3002 | dev_err(dev, "%s: unable to set the direction of gpio %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3003 | __func__, ATMEL_TS_GPIO_IRQ); |
| 3004 | goto free_ts_gpio; |
| 3005 | } |
| 3006 | return 0; |
| 3007 | |
| 3008 | free_ts_gpio: |
| 3009 | gpio_free(ATMEL_TS_GPIO_IRQ); |
| 3010 | ts_gpio_tlmm_unconfig: |
| 3011 | gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 3012 | GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 3013 | GPIO_CFG_2MA), GPIO_CFG_DISABLE); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 3014 | reg_free: |
| 3015 | regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel); |
| 3016 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3017 | return rc; |
| 3018 | } |
| 3019 | |
| 3020 | static int atmel_ts_platform_exit(struct i2c_client *client) |
| 3021 | { |
| 3022 | gpio_free(ATMEL_TS_GPIO_IRQ); |
| 3023 | gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 3024 | GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 3025 | GPIO_CFG_2MA), GPIO_CFG_DISABLE); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 3026 | regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel); |
| 3027 | regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3028 | return 0; |
| 3029 | } |
| 3030 | |
| 3031 | static u8 atmel_ts_read_chg(void) |
| 3032 | { |
| 3033 | return gpio_get_value(ATMEL_TS_GPIO_IRQ); |
| 3034 | } |
| 3035 | |
| 3036 | static u8 atmel_ts_valid_interrupt(void) |
| 3037 | { |
| 3038 | return !atmel_ts_read_chg(); |
| 3039 | } |
| 3040 | |
| 3041 | #define ATMEL_X_OFFSET 13 |
| 3042 | #define ATMEL_Y_OFFSET 0 |
| 3043 | |
Mohan Pallaka | 4e9a94e | 2011-11-23 16:34:21 +0530 | [diff] [blame] | 3044 | static struct maxtouch_platform_data atmel_ts_pdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3045 | .numtouch = 4, |
| 3046 | .init_platform_hw = atmel_ts_platform_init, |
| 3047 | .exit_platform_hw = atmel_ts_platform_exit, |
| 3048 | .power_on = atmel_ts_power_on, |
| 3049 | .display_res_x = 480, |
| 3050 | .display_res_y = 864, |
| 3051 | .min_x = ATMEL_X_OFFSET, |
| 3052 | .max_x = (505 - ATMEL_X_OFFSET), |
| 3053 | .min_y = ATMEL_Y_OFFSET, |
| 3054 | .max_y = (863 - ATMEL_Y_OFFSET), |
| 3055 | .valid_interrupt = atmel_ts_valid_interrupt, |
| 3056 | .read_chg = atmel_ts_read_chg, |
| 3057 | }; |
| 3058 | |
| 3059 | static struct i2c_board_info atmel_ts_i2c_info[] __initdata = { |
| 3060 | { |
| 3061 | I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a), |
| 3062 | .platform_data = &atmel_ts_pdata, |
| 3063 | .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ), |
| 3064 | }, |
| 3065 | }; |
| 3066 | |
| 3067 | #define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col)) |
| 3068 | |
| 3069 | static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35}; |
| 3070 | static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40}; |
| 3071 | |
| 3072 | static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) * |
| 3073 | ARRAY_SIZE(kp_row_gpios)] = { |
| 3074 | [KP_INDEX(0, 0)] = KEY_7, |
| 3075 | [KP_INDEX(0, 1)] = KEY_DOWN, |
| 3076 | [KP_INDEX(0, 2)] = KEY_UP, |
| 3077 | [KP_INDEX(0, 3)] = KEY_RIGHT, |
| 3078 | [KP_INDEX(0, 4)] = KEY_ENTER, |
| 3079 | |
| 3080 | [KP_INDEX(1, 0)] = KEY_LEFT, |
| 3081 | [KP_INDEX(1, 1)] = KEY_SEND, |
| 3082 | [KP_INDEX(1, 2)] = KEY_1, |
| 3083 | [KP_INDEX(1, 3)] = KEY_4, |
| 3084 | [KP_INDEX(1, 4)] = KEY_CLEAR, |
| 3085 | |
| 3086 | [KP_INDEX(2, 0)] = KEY_6, |
| 3087 | [KP_INDEX(2, 1)] = KEY_5, |
| 3088 | [KP_INDEX(2, 2)] = KEY_8, |
| 3089 | [KP_INDEX(2, 3)] = KEY_3, |
| 3090 | [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR, |
| 3091 | |
| 3092 | [KP_INDEX(3, 0)] = KEY_9, |
| 3093 | [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND, |
| 3094 | [KP_INDEX(3, 2)] = KEY_0, |
| 3095 | [KP_INDEX(3, 3)] = KEY_2, |
| 3096 | [KP_INDEX(3, 4)] = KEY_SLEEP, |
| 3097 | |
| 3098 | [KP_INDEX(4, 0)] = KEY_BACK, |
| 3099 | [KP_INDEX(4, 1)] = KEY_HOME, |
| 3100 | [KP_INDEX(4, 2)] = KEY_MENU, |
| 3101 | [KP_INDEX(4, 3)] = KEY_VOLUMEUP, |
| 3102 | [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN, |
| 3103 | }; |
| 3104 | |
| 3105 | /* SURF keypad platform device information */ |
| 3106 | static struct gpio_event_matrix_info kp_matrix_info = { |
| 3107 | .info.func = gpio_event_matrix_func, |
| 3108 | .keymap = keymap, |
| 3109 | .output_gpios = kp_row_gpios, |
| 3110 | .input_gpios = kp_col_gpios, |
| 3111 | .noutputs = ARRAY_SIZE(kp_row_gpios), |
| 3112 | .ninputs = ARRAY_SIZE(kp_col_gpios), |
| 3113 | .settle_time.tv_nsec = 40 * NSEC_PER_USEC, |
| 3114 | .poll_time.tv_nsec = 20 * NSEC_PER_MSEC, |
| 3115 | .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | |
| 3116 | GPIOKPF_PRINT_UNMAPPED_KEYS, |
| 3117 | }; |
| 3118 | |
| 3119 | static struct gpio_event_info *kp_info[] = { |
| 3120 | &kp_matrix_info.info |
| 3121 | }; |
| 3122 | |
| 3123 | static struct gpio_event_platform_data kp_pdata = { |
| 3124 | .name = "7x27a_kp", |
| 3125 | .info = kp_info, |
| 3126 | .info_count = ARRAY_SIZE(kp_info) |
| 3127 | }; |
| 3128 | |
| 3129 | static struct platform_device kp_pdev = { |
| 3130 | .name = GPIO_EVENT_DEV_NAME, |
| 3131 | .id = -1, |
| 3132 | .dev = { |
| 3133 | .platform_data = &kp_pdata, |
| 3134 | }, |
| 3135 | }; |
| 3136 | |
| 3137 | static struct msm_handset_platform_data hs_platform_data = { |
| 3138 | .hs_name = "7k_handset", |
| 3139 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ |
| 3140 | }; |
| 3141 | |
| 3142 | static struct platform_device hs_pdev = { |
| 3143 | .name = "msm-handset", |
| 3144 | .id = -1, |
| 3145 | .dev = { |
| 3146 | .platform_data = &hs_platform_data, |
| 3147 | }, |
| 3148 | }; |
| 3149 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 3150 | static struct platform_device msm_proccomm_regulator_dev = { |
| 3151 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 3152 | .id = -1, |
| 3153 | .dev = { |
| 3154 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 3155 | } |
| 3156 | }; |
| 3157 | |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3158 | static void __init msm7627a_rumi3_init(void) |
| 3159 | { |
| 3160 | msm7x27a_init_ebi2(); |
| 3161 | platform_add_devices(rumi_sim_devices, |
| 3162 | ARRAY_SIZE(rumi_sim_devices)); |
| 3163 | } |
| 3164 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3165 | #define LED_GPIO_PDM 96 |
| 3166 | #define UART1DM_RX_GPIO 45 |
Santosh Sajjan | b479f0f | 2011-08-18 21:00:44 +0530 | [diff] [blame] | 3167 | |
| 3168 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 3169 | static int __init msm7x27a_init_ar6000pm(void) |
| 3170 | { |
| 3171 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 3172 | } |
| 3173 | #else |
| 3174 | static int __init msm7x27a_init_ar6000pm(void) { return 0; } |
| 3175 | #endif |
| 3176 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 3177 | static void __init msm7x27a_init_regulators(void) |
| 3178 | { |
| 3179 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 3180 | if (rc) |
| 3181 | pr_err("%s: could not register regulator device: %d\n", |
| 3182 | __func__, rc); |
| 3183 | } |
| 3184 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3185 | static void __init msm7x2x_init(void) |
| 3186 | { |
Trilok Soni | a416c49 | 2011-07-22 20:20:23 +0530 | [diff] [blame] | 3187 | msm7x2x_misc_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3188 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 3189 | /* Initialize regulators first so that other devices can use them */ |
| 3190 | msm7x27a_init_regulators(); |
| 3191 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3192 | /* Common functions for SURF/FFA/RUMI3 */ |
| 3193 | msm_device_i2c_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3194 | msm7x27a_init_ebi2(); |
| 3195 | msm7x27a_cfg_uart2dm_serial(); |
| 3196 | #ifdef CONFIG_SERIAL_MSM_HS |
| 3197 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 3198 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 3199 | #endif |
| 3200 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3201 | #ifdef CONFIG_USB_MSM_OTG_72K |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3202 | msm_otg_pdata.swfi_latency = |
| 3203 | msm7x27a_pm_data |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3204 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3205 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3206 | #endif |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3207 | msm_device_gadget_peripheral.dev.platform_data = |
| 3208 | &msm_gadget_pdata; |
| 3209 | msm7x27a_cfg_smsc911x(); |
| 3210 | platform_add_devices(msm_footswitch_devices, |
| 3211 | msm_num_footswitch_devices); |
| 3212 | platform_add_devices(surf_ffa_devices, |
| 3213 | ARRAY_SIZE(surf_ffa_devices)); |
Sujith Reddy Thumma | ad7c9a8 | 2011-09-30 20:54:38 +0530 | [diff] [blame] | 3214 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 3215 | msm7x27a_init_ar6000pm(); |
| 3216 | #ifdef CONFIG_MMC_MSM |
| 3217 | msm7x27a_init_mmc(); |
| 3218 | #endif |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3219 | msm_fb_add_devices(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3220 | #ifdef CONFIG_USB_EHCI_MSM_72K |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3221 | msm7x2x_init_host(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3222 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3223 | |
| 3224 | msm_pm_set_platform_data(msm7x27a_pm_data, |
| 3225 | ARRAY_SIZE(msm7x27a_pm_data)); |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 3226 | BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_RESET_VECTOR, |
| 3227 | ioremap(0, PAGE_SIZE))); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3228 | |
| 3229 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 3230 | register_i2c_devices(); |
| 3231 | #endif |
| 3232 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 3233 | bt_power_init(); |
| 3234 | #endif |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3235 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3236 | atmel_ts_pdata.min_x = 0; |
| 3237 | atmel_ts_pdata.max_x = 480; |
| 3238 | atmel_ts_pdata.min_y = 0; |
| 3239 | atmel_ts_pdata.max_y = 320; |
| 3240 | } |
| 3241 | |
| 3242 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 3243 | atmel_ts_i2c_info, |
| 3244 | ARRAY_SIZE(atmel_ts_i2c_info)); |
| 3245 | |
Pankaj Kumar | 5be2a3e | 2011-09-26 11:45:02 +0530 | [diff] [blame] | 3246 | #if defined(CONFIG_MSM_CAMERA) |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 3247 | msm_camera_vreg_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3248 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 3249 | i2c_camera_devices, |
| 3250 | ARRAY_SIZE(i2c_camera_devices)); |
Pankaj Kumar | 5be2a3e | 2011-09-26 11:45:02 +0530 | [diff] [blame] | 3251 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3252 | platform_device_register(&kp_pdev); |
| 3253 | platform_device_register(&hs_pdev); |
| 3254 | |
| 3255 | /* configure it as a pdm function*/ |
| 3256 | if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3, |
| 3257 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 3258 | GPIO_CFG_8MA), GPIO_CFG_ENABLE)) |
| 3259 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 3260 | __func__, LED_GPIO_PDM); |
| 3261 | else |
| 3262 | platform_device_register(&led_pdev); |
| 3263 | |
| 3264 | #ifdef CONFIG_MSM_RPC_VIBRATOR |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3265 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3266 | msm_init_pmic_vibrator(); |
| 3267 | #endif |
| 3268 | /*7x25a kgsl initializations*/ |
| 3269 | msm7x25a_kgsl_3d0_init(); |
| 3270 | } |
| 3271 | |
| 3272 | static void __init msm7x2x_init_early(void) |
| 3273 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3274 | msm_msm7x2x_allocate_memory_regions(); |
| 3275 | } |
| 3276 | |
| 3277 | MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3") |
| 3278 | .boot_params = PHYS_OFFSET + 0x100, |
| 3279 | .map_io = msm_common_io_init, |
| 3280 | .reserve = msm7x27a_reserve, |
| 3281 | .init_irq = msm_init_irq, |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3282 | .init_machine = msm7627a_rumi3_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3283 | .timer = &msm_timer, |
| 3284 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 3285 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3286 | MACHINE_END |
| 3287 | MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF") |
| 3288 | .boot_params = PHYS_OFFSET + 0x100, |
| 3289 | .map_io = msm_common_io_init, |
| 3290 | .reserve = msm7x27a_reserve, |
| 3291 | .init_irq = msm_init_irq, |
| 3292 | .init_machine = msm7x2x_init, |
| 3293 | .timer = &msm_timer, |
| 3294 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 3295 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3296 | MACHINE_END |
| 3297 | MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA") |
| 3298 | .boot_params = PHYS_OFFSET + 0x100, |
| 3299 | .map_io = msm_common_io_init, |
| 3300 | .reserve = msm7x27a_reserve, |
| 3301 | .init_irq = msm_init_irq, |
| 3302 | .init_machine = msm7x2x_init, |
| 3303 | .timer = &msm_timer, |
| 3304 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 3305 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3306 | MACHINE_END |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3307 | MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF") |
| 3308 | .boot_params = PHYS_OFFSET + 0x100, |
| 3309 | .map_io = msm_common_io_init, |
| 3310 | .reserve = msm7x27a_reserve, |
| 3311 | .init_irq = msm_init_irq, |
| 3312 | .init_machine = msm7x2x_init, |
| 3313 | .timer = &msm_timer, |
| 3314 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 3315 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3316 | MACHINE_END |
| 3317 | MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA") |
| 3318 | .boot_params = PHYS_OFFSET + 0x100, |
| 3319 | .map_io = msm_common_io_init, |
| 3320 | .reserve = msm7x27a_reserve, |
| 3321 | .init_irq = msm_init_irq, |
| 3322 | .init_machine = msm7x2x_init, |
| 3323 | .timer = &msm_timer, |
| 3324 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 3325 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 3326 | MACHINE_END |