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