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> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 45 | #include <mach/msm_battery.h> |
| 46 | #include <linux/smsc911x.h> |
| 47 | #include <linux/atmel_maxtouch.h> |
| 48 | #include "devices.h" |
| 49 | #include "timer.h" |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 50 | #include "board-msm7x27a-regulator.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 51 | #include "devices-msm7x2xa.h" |
| 52 | #include "pm.h" |
| 53 | #include <mach/rpc_server_handset.h> |
| 54 | #include <mach/socinfo.h> |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 55 | #include "pm-boot.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 56 | #include "board-msm7627a.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | |
| 58 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
| 59 | #define MSM_PMEM_AUDIO_SIZE 0x5B000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 60 | |
| 61 | enum { |
| 62 | GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS, |
| 63 | GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS, |
| 64 | /* SURF expander */ |
| 65 | GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE, |
| 66 | GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE, |
| 67 | GPIO_WLAN_EXT_POR_N, |
| 68 | GPIO_DISPLAY_PWR_EN, |
| 69 | GPIO_BACKLIGHT_EN, |
| 70 | GPIO_PRESSURE_XCLR, |
| 71 | GPIO_VREG_S3_EXP, |
| 72 | GPIO_UBM2M_PWRDWN, |
| 73 | GPIO_ETM_MODE_CS_N, |
| 74 | GPIO_HOST_VBUS_EN, |
| 75 | GPIO_SPI_MOSI, |
| 76 | GPIO_SPI_MISO, |
| 77 | GPIO_SPI_CLK, |
| 78 | GPIO_SPI_CS0_N, |
| 79 | GPIO_CORE_EXPANDER_IO13, |
| 80 | GPIO_CORE_EXPANDER_IO14, |
| 81 | GPIO_CORE_EXPANDER_IO15, |
| 82 | /* Camera expander */ |
| 83 | GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16, |
| 84 | GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE, |
| 85 | GPIO_CAM_GP_AFBUSY, |
| 86 | GPIO_CAM_GP_CAM_PWDN, |
| 87 | GPIO_CAM_GP_CAM1MP_XCLR, |
| 88 | GPIO_CAM_GP_CAMIF_RESET_N, |
| 89 | GPIO_CAM_GP_STROBE_CE, |
| 90 | GPIO_CAM_GP_LED_EN1, |
| 91 | GPIO_CAM_GP_LED_EN2, |
| 92 | }; |
| 93 | |
| 94 | #if defined(CONFIG_GPIO_SX150X) |
| 95 | enum { |
| 96 | SX150X_CORE, |
| 97 | SX150X_CAM, |
| 98 | }; |
| 99 | |
| 100 | static struct sx150x_platform_data sx150x_data[] __initdata = { |
| 101 | [SX150X_CORE] = { |
| 102 | .gpio_base = GPIO_CORE_EXPANDER_BASE, |
| 103 | .oscio_is_gpo = false, |
| 104 | .io_pullup_ena = 0, |
pankaj kumar | c5c0139 | 2011-08-12 13:44:05 +0530 | [diff] [blame] | 105 | .io_pulldn_ena = 0x02, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 106 | .io_open_drain_ena = 0xfef8, |
| 107 | .irq_summary = -1, |
| 108 | }, |
| 109 | [SX150X_CAM] = { |
| 110 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 111 | .oscio_is_gpo = false, |
| 112 | .io_pullup_ena = 0, |
| 113 | .io_pulldn_ena = 0, |
| 114 | .io_open_drain_ena = 0x23, |
| 115 | .irq_summary = -1, |
| 116 | }, |
| 117 | }; |
| 118 | #endif |
| 119 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 120 | |
Santosh Sajjan | 6822c68 | 2011-07-26 10:49:36 +0530 | [diff] [blame] | 121 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 122 | .name = "wlan_ar6000_pm_dev", |
| 123 | .id = -1, |
| 124 | }; |
| 125 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 126 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 127 | static struct i2c_board_info core_exp_i2c_info[] __initdata = { |
| 128 | { |
| 129 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 130 | }, |
| 131 | }; |
| 132 | static struct i2c_board_info cam_exp_i2c_info[] __initdata = { |
| 133 | { |
| 134 | I2C_BOARD_INFO("sx1508q", 0x22), |
| 135 | .platform_data = &sx150x_data[SX150X_CAM], |
| 136 | }, |
| 137 | }; |
| 138 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 139 | |
| 140 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 141 | static void __init register_i2c_devices(void) |
| 142 | { |
| 143 | |
| 144 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 145 | cam_exp_i2c_info, |
| 146 | ARRAY_SIZE(cam_exp_i2c_info)); |
| 147 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 148 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 149 | sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0; |
| 150 | |
| 151 | core_exp_i2c_info[0].platform_data = |
| 152 | &sx150x_data[SX150X_CORE]; |
| 153 | |
| 154 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 155 | core_exp_i2c_info, |
| 156 | ARRAY_SIZE(core_exp_i2c_info)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 157 | } |
| 158 | #endif |
| 159 | |
| 160 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 161 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 162 | "qup_scl" }, |
| 163 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 164 | "qup_sda" }, |
| 165 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 166 | "qup_scl" }, |
| 167 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 168 | "qup_sda" }, |
| 169 | }; |
| 170 | |
| 171 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 172 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 173 | "qup_scl" }, |
| 174 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 175 | "qup_sda" }, |
| 176 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 177 | "qup_scl" }, |
| 178 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 179 | "qup_sda" }, |
| 180 | }; |
| 181 | |
| 182 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 183 | { |
| 184 | int rc; |
| 185 | |
| 186 | if (adap_id < 0 || adap_id > 1) |
| 187 | return; |
| 188 | |
| 189 | /* Each adapter gets 2 lines from the table */ |
| 190 | if (config_type) |
| 191 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 192 | else |
| 193 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 194 | if (rc < 0) |
| 195 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 196 | } |
| 197 | |
| 198 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 199 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 200 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 201 | }; |
| 202 | |
| 203 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 204 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 205 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 206 | }; |
| 207 | |
| 208 | #ifdef CONFIG_ARCH_MSM7X27A |
Neti Ravi Kumar | 061726e | 2011-12-08 15:14:57 +0530 | [diff] [blame] | 209 | #define MSM_PMEM_MDP_SIZE 0x2300000 |
| 210 | #define MSM7x25A_MSM_PMEM_MDP_SIZE 0x1500000 |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 211 | |
Roja Rani Yarubandi | 0998656 | 2011-12-06 18:54:47 +0530 | [diff] [blame] | 212 | #define MSM_PMEM_ADSP_SIZE 0x1000000 |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 213 | #define MSM7x25A_MSM_PMEM_ADSP_SIZE 0xB91000 |
| 214 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 215 | |
| 216 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 217 | #define MSM_FB_SIZE 0x260000 |
| 218 | #define MSM7x25A_MSM_FB_SIZE 0xE1000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 219 | #else |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 220 | #define MSM_FB_SIZE 0x195000 |
| 221 | #define MSM7x25A_MSM_FB_SIZE 0xE1000 |
| 222 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 223 | #endif |
| 224 | |
| 225 | #endif |
| 226 | |
| 227 | static struct android_usb_platform_data android_usb_pdata = { |
| 228 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 229 | }; |
| 230 | |
| 231 | static struct platform_device android_usb_device = { |
| 232 | .name = "android_usb", |
| 233 | .id = -1, |
| 234 | .dev = { |
| 235 | .platform_data = &android_usb_pdata, |
| 236 | }, |
| 237 | }; |
| 238 | |
| 239 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 240 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 241 | { |
| 242 | int rc = 0; |
| 243 | unsigned gpio; |
| 244 | |
| 245 | gpio = GPIO_HOST_VBUS_EN; |
| 246 | |
| 247 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 248 | if (rc < 0) { |
| 249 | pr_err("failed to request %d GPIO\n", gpio); |
| 250 | return; |
| 251 | } |
| 252 | gpio_direction_output(gpio, !!on); |
| 253 | gpio_set_value_cansleep(gpio, !!on); |
| 254 | gpio_free(gpio); |
| 255 | } |
| 256 | |
| 257 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 258 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 259 | }; |
| 260 | |
| 261 | static void __init msm7x2x_init_host(void) |
| 262 | { |
| 263 | msm_add_host(0, &msm_usb_host_pdata); |
| 264 | } |
| 265 | #endif |
| 266 | |
| 267 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 268 | static int hsusb_rpc_connect(int connect) |
| 269 | { |
| 270 | if (connect) |
| 271 | return msm_hsusb_rpc_connect(); |
| 272 | else |
| 273 | return msm_hsusb_rpc_close(); |
| 274 | } |
| 275 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 276 | static struct regulator *reg_hsusb; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 277 | static int msm_hsusb_ldo_init(int init) |
| 278 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 279 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 280 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 281 | if (init) { |
| 282 | reg_hsusb = regulator_get(NULL, "usb"); |
| 283 | if (IS_ERR(reg_hsusb)) { |
| 284 | rc = PTR_ERR(reg_hsusb); |
| 285 | pr_err("%s: could not get regulator: %d\n", |
| 286 | __func__, rc); |
| 287 | goto out; |
| 288 | } |
| 289 | |
| 290 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 291 | if (rc) { |
| 292 | pr_err("%s: could not set voltage: %d\n", |
| 293 | __func__, rc); |
| 294 | goto reg_free; |
| 295 | } |
| 296 | |
| 297 | return 0; |
| 298 | } |
| 299 | /* else fall through */ |
| 300 | reg_free: |
| 301 | regulator_put(reg_hsusb); |
| 302 | out: |
| 303 | reg_hsusb = NULL; |
| 304 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | static int msm_hsusb_ldo_enable(int enable) |
| 308 | { |
| 309 | static int ldo_status; |
| 310 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 311 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 312 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 313 | |
| 314 | if (ldo_status == enable) |
| 315 | return 0; |
| 316 | |
| 317 | ldo_status = enable; |
| 318 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 319 | return enable ? |
| 320 | regulator_enable(reg_hsusb) : |
| 321 | regulator_disable(reg_hsusb); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 325 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 326 | { |
| 327 | int ret = 0; |
| 328 | |
| 329 | if (init) |
| 330 | ret = msm_pm_app_rpc_init(callback); |
| 331 | else |
| 332 | msm_pm_app_rpc_deinit(callback); |
| 333 | |
| 334 | return ret; |
| 335 | } |
| 336 | #endif |
| 337 | |
| 338 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 339 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 340 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 341 | #else |
| 342 | .vbus_power = msm_hsusb_vbus_power, |
| 343 | #endif |
| 344 | .rpc_connect = hsusb_rpc_connect, |
| 345 | .core_clk = 1, |
| 346 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 347 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 348 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 349 | .se1_gating = SE1_GATING_DISABLE, |
| 350 | .ldo_init = msm_hsusb_ldo_init, |
| 351 | .ldo_enable = msm_hsusb_ldo_enable, |
| 352 | .chg_init = hsusb_chg_init, |
| 353 | .chg_connected = hsusb_chg_connected, |
| 354 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 355 | }; |
| 356 | #endif |
| 357 | |
| 358 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 359 | .is_phy_status_timer_on = 1, |
| 360 | }; |
| 361 | |
| 362 | static struct resource smc91x_resources[] = { |
| 363 | [0] = { |
| 364 | .start = 0x90000300, |
| 365 | .end = 0x900003ff, |
| 366 | .flags = IORESOURCE_MEM, |
| 367 | }, |
| 368 | [1] = { |
| 369 | .start = MSM_GPIO_TO_INT(4), |
| 370 | .end = MSM_GPIO_TO_INT(4), |
| 371 | .flags = IORESOURCE_IRQ, |
| 372 | }, |
| 373 | }; |
| 374 | |
| 375 | static struct platform_device smc91x_device = { |
| 376 | .name = "smc91x", |
| 377 | .id = 0, |
| 378 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 379 | .resource = smc91x_resources, |
| 380 | }; |
| 381 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 382 | #ifdef CONFIG_SERIAL_MSM_HS |
| 383 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 384 | .inject_rx_on_wakeup = 1, |
| 385 | .rx_to_inject = 0xFD, |
| 386 | }; |
| 387 | #endif |
| 388 | static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 389 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 390 | .idle_supported = 1, |
| 391 | .suspend_supported = 1, |
| 392 | .idle_enabled = 1, |
| 393 | .suspend_enabled = 1, |
| 394 | .latency = 16000, |
| 395 | .residency = 20000, |
| 396 | }, |
| 397 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 398 | .idle_supported = 1, |
| 399 | .suspend_supported = 1, |
| 400 | .idle_enabled = 1, |
| 401 | .suspend_enabled = 1, |
| 402 | .latency = 12000, |
| 403 | .residency = 20000, |
| 404 | }, |
| 405 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 406 | .idle_supported = 1, |
| 407 | .suspend_supported = 1, |
| 408 | .idle_enabled = 0, |
| 409 | .suspend_enabled = 1, |
| 410 | .latency = 2000, |
| 411 | .residency = 0, |
| 412 | }, |
| 413 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 414 | .idle_supported = 1, |
| 415 | .suspend_supported = 1, |
| 416 | .idle_enabled = 1, |
| 417 | .suspend_enabled = 1, |
| 418 | .latency = 2, |
| 419 | .residency = 0, |
| 420 | }, |
| 421 | }; |
| 422 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 423 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 424 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_VIRT, |
| 425 | .v_addr = (uint32_t *)PAGE_OFFSET, |
| 426 | }; |
| 427 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 428 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 429 | .name = "pmem_adsp", |
| 430 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
Mahesh Lanka | c6af7eb | 2011-08-02 18:00:35 +0530 | [diff] [blame] | 431 | .cached = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 432 | .memory_type = MEMTYPE_EBI1, |
| 433 | }; |
| 434 | |
| 435 | static struct platform_device android_pmem_adsp_device = { |
| 436 | .name = "android_pmem", |
| 437 | .id = 1, |
| 438 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 439 | }; |
| 440 | |
| 441 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 442 | static int __init pmem_mdp_size_setup(char *p) |
| 443 | { |
| 444 | pmem_mdp_size = memparse(p, NULL); |
| 445 | return 0; |
| 446 | } |
| 447 | |
| 448 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 449 | |
| 450 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 451 | static int __init pmem_adsp_size_setup(char *p) |
| 452 | { |
| 453 | pmem_adsp_size = memparse(p, NULL); |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 458 | |
| 459 | static unsigned fb_size = MSM_FB_SIZE; |
| 460 | static int __init fb_size_setup(char *p) |
| 461 | { |
| 462 | fb_size = memparse(p, NULL); |
| 463 | return 0; |
| 464 | } |
| 465 | |
| 466 | early_param("fb_size", fb_size_setup); |
| 467 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 468 | static struct regulator_bulk_data regs_lcdc[] = { |
| 469 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 470 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 471 | }; |
| 472 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 473 | static uint32_t lcdc_gpio_initialized; |
| 474 | |
| 475 | static void lcdc_toshiba_gpio_init(void) |
| 476 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 477 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 478 | if (!lcdc_gpio_initialized) { |
| 479 | if (gpio_request(GPIO_SPI_CLK, "spi_clk")) { |
| 480 | pr_err("failed to request gpio spi_clk\n"); |
| 481 | return; |
| 482 | } |
| 483 | if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) { |
| 484 | pr_err("failed to request gpio spi_cs0_N\n"); |
| 485 | goto fail_gpio6; |
| 486 | } |
| 487 | if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) { |
| 488 | pr_err("failed to request gpio spi_mosi\n"); |
| 489 | goto fail_gpio5; |
| 490 | } |
| 491 | if (gpio_request(GPIO_SPI_MISO, "spi_miso")) { |
| 492 | pr_err("failed to request gpio spi_miso\n"); |
| 493 | goto fail_gpio4; |
| 494 | } |
| 495 | if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) { |
| 496 | pr_err("failed to request gpio_disp_pwr\n"); |
| 497 | goto fail_gpio3; |
| 498 | } |
| 499 | if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) { |
| 500 | pr_err("failed to request gpio_bkl_en\n"); |
| 501 | goto fail_gpio2; |
| 502 | } |
| 503 | pmapp_disp_backlight_init(); |
| 504 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 505 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc); |
| 506 | if (rc) { |
| 507 | pr_err("%s: could not get regulators: %d\n", |
| 508 | __func__, rc); |
| 509 | goto fail_gpio1; |
| 510 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 511 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 512 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc), |
| 513 | regs_lcdc); |
| 514 | if (rc) { |
| 515 | pr_err("%s: could not set voltages: %d\n", |
| 516 | __func__, rc); |
| 517 | goto fail_vreg; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 518 | } |
| 519 | lcdc_gpio_initialized = 1; |
| 520 | } |
| 521 | return; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 522 | fail_vreg: |
| 523 | regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 524 | fail_gpio1: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 525 | gpio_free(GPIO_BACKLIGHT_EN); |
| 526 | fail_gpio2: |
| 527 | gpio_free(GPIO_DISPLAY_PWR_EN); |
| 528 | fail_gpio3: |
| 529 | gpio_free(GPIO_SPI_MISO); |
| 530 | fail_gpio4: |
| 531 | gpio_free(GPIO_SPI_MOSI); |
| 532 | fail_gpio5: |
| 533 | gpio_free(GPIO_SPI_CS0_N); |
| 534 | fail_gpio6: |
| 535 | gpio_free(GPIO_SPI_CLK); |
| 536 | lcdc_gpio_initialized = 0; |
| 537 | } |
| 538 | |
| 539 | static uint32_t lcdc_gpio_table[] = { |
| 540 | GPIO_SPI_CLK, |
| 541 | GPIO_SPI_CS0_N, |
| 542 | GPIO_SPI_MOSI, |
| 543 | GPIO_DISPLAY_PWR_EN, |
| 544 | GPIO_BACKLIGHT_EN, |
| 545 | GPIO_SPI_MISO, |
| 546 | }; |
| 547 | |
| 548 | static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable) |
| 549 | { |
| 550 | int n; |
| 551 | |
| 552 | if (lcdc_gpio_initialized) { |
| 553 | /* All are IO Expander GPIOs */ |
| 554 | for (n = 0; n < (len - 1); n++) |
| 555 | gpio_direction_output(table[n], 1); |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | static void lcdc_toshiba_config_gpios(int enable) |
| 560 | { |
| 561 | config_lcdc_gpio_table(lcdc_gpio_table, |
| 562 | ARRAY_SIZE(lcdc_gpio_table), enable); |
| 563 | } |
| 564 | |
| 565 | static int msm_fb_lcdc_power_save(int on) |
| 566 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 567 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 568 | /* Doing the init of the LCDC GPIOs very late as they are from |
| 569 | an I2C-controlled IO Expander */ |
| 570 | lcdc_toshiba_gpio_init(); |
| 571 | |
| 572 | if (lcdc_gpio_initialized) { |
| 573 | gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); |
| 574 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); |
| 575 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 576 | rc = on ? regulator_bulk_enable( |
| 577 | ARRAY_SIZE(regs_lcdc), regs_lcdc) : |
| 578 | regulator_bulk_disable( |
| 579 | ARRAY_SIZE(regs_lcdc), regs_lcdc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 580 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 581 | if (rc) |
| 582 | pr_err("%s: could not %sable regulators: %d\n", |
| 583 | __func__, on ? "en" : "dis", rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | |
| 590 | static int lcdc_toshiba_set_bl(int level) |
| 591 | { |
| 592 | int ret; |
| 593 | |
| 594 | ret = pmapp_disp_backlight_set_brightness(level); |
| 595 | if (ret) |
| 596 | pr_err("%s: can't set lcd backlight!\n", __func__); |
| 597 | |
| 598 | return ret; |
| 599 | } |
| 600 | |
| 601 | |
| 602 | static struct lcdc_platform_data lcdc_pdata = { |
Jeevan Shriram | 15f2a5e | 2011-07-13 21:45:26 +0530 | [diff] [blame] | 603 | .lcdc_gpio_config = NULL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 604 | .lcdc_power_save = msm_fb_lcdc_power_save, |
| 605 | }; |
| 606 | |
| 607 | static int lcd_panel_spi_gpio_num[] = { |
| 608 | GPIO_SPI_MOSI, /* spi_sdi */ |
| 609 | GPIO_SPI_MISO, /* spi_sdoi */ |
| 610 | GPIO_SPI_CLK, /* spi_clk */ |
| 611 | GPIO_SPI_CS0_N, /* spi_cs */ |
| 612 | }; |
| 613 | |
| 614 | static struct msm_panel_common_pdata lcdc_toshiba_panel_data = { |
| 615 | .panel_config_gpio = lcdc_toshiba_config_gpios, |
| 616 | .pmic_backlight = lcdc_toshiba_set_bl, |
| 617 | .gpio_num = lcd_panel_spi_gpio_num, |
| 618 | }; |
| 619 | |
| 620 | static struct platform_device lcdc_toshiba_panel_device = { |
| 621 | .name = "lcdc_toshiba_fwvga_pt", |
| 622 | .id = 0, |
| 623 | .dev = { |
| 624 | .platform_data = &lcdc_toshiba_panel_data, |
| 625 | } |
| 626 | }; |
| 627 | |
| 628 | static struct resource msm_fb_resources[] = { |
| 629 | { |
| 630 | .flags = IORESOURCE_DMA, |
| 631 | } |
| 632 | }; |
| 633 | |
Ajay Singh Parmar | eede70e | 2011-08-24 17:36:08 +0530 | [diff] [blame] | 634 | #define PANEL_NAME_MAX_LEN 30 |
| 635 | #define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt" |
| 636 | #define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga" |
| 637 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 638 | static int msm_fb_detect_panel(const char *name) |
| 639 | { |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 640 | int ret = -ENODEV; |
| 641 | |
| 642 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
| 643 | if (!strncmp(name, "lcdc_toshiba_fwvga_pt", 21) || |
| 644 | !strncmp(name, "mipi_cmd_renesas_fwvga", 22)) |
| 645 | ret = 0; |
Jeevan Shriram | 29c9e95 | 2011-10-27 11:22:46 +0530 | [diff] [blame] | 646 | } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) { |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 647 | if (!strncmp(name, "mipi_cmd_renesas_fwvga", 22)) |
| 648 | ret = 0; |
| 649 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 650 | |
Ajay Singh Parmar | eede70e | 2011-08-24 17:36:08 +0530 | [diff] [blame] | 651 | #if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \ |
| 652 | !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \ |
| 653 | !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT) |
| 654 | if (machine_is_msm7x27a_surf() || |
| 655 | machine_is_msm7625a_surf()) { |
| 656 | if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME, |
| 657 | strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME, |
| 658 | PANEL_NAME_MAX_LEN))) |
| 659 | return 0; |
| 660 | } |
| 661 | #endif |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 662 | return ret; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 666 | .detect_client = msm_fb_detect_panel, |
| 667 | }; |
| 668 | |
| 669 | static struct platform_device msm_fb_device = { |
| 670 | .name = "msm_fb", |
| 671 | .id = 0, |
| 672 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 673 | .resource = msm_fb_resources, |
| 674 | .dev = { |
| 675 | .platform_data = &msm_fb_pdata, |
| 676 | } |
| 677 | }; |
| 678 | |
| 679 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 680 | static int mipi_renesas_set_bl(int level) |
| 681 | { |
| 682 | int ret; |
| 683 | |
| 684 | ret = pmapp_disp_backlight_set_brightness(level); |
| 685 | |
| 686 | if (ret) |
| 687 | pr_err("%s: can't set lcd backlight!\n", __func__); |
| 688 | |
| 689 | return ret; |
| 690 | } |
| 691 | |
| 692 | static struct msm_panel_common_pdata mipi_renesas_pdata = { |
| 693 | .pmic_backlight = mipi_renesas_set_bl, |
| 694 | }; |
| 695 | |
| 696 | |
| 697 | static struct platform_device mipi_dsi_renesas_panel_device = { |
| 698 | .name = "mipi_renesas", |
| 699 | .id = 0, |
| 700 | .dev = { |
| 701 | .platform_data = &mipi_renesas_pdata, |
| 702 | } |
| 703 | }; |
| 704 | #endif |
| 705 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 706 | #define SND(desc, num) { .name = #desc, .id = num } |
| 707 | static struct snd_endpoint snd_endpoints_list[] = { |
| 708 | SND(HANDSET, 0), |
| 709 | SND(MONO_HEADSET, 2), |
| 710 | SND(HEADSET, 3), |
| 711 | SND(SPEAKER, 6), |
| 712 | SND(TTY_HEADSET, 8), |
| 713 | SND(TTY_VCO, 9), |
| 714 | SND(TTY_HCO, 10), |
| 715 | SND(BT, 12), |
| 716 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 717 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 718 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 719 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 720 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
Shashi Kumar | 64e0760 | 2011-10-11 13:18:57 +0530 | [diff] [blame] | 721 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
Sidipotu Ashok | ab34ca4 | 2011-07-22 16:34:20 +0530 | [diff] [blame] | 722 | SND(CURRENT, 0x7FFFFFFE), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 723 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 724 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 725 | }; |
| 726 | #undef SND |
| 727 | |
| 728 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 729 | .endpoints = snd_endpoints_list, |
| 730 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 731 | }; |
| 732 | |
| 733 | static struct platform_device msm_device_snd = { |
| 734 | .name = "msm_snd", |
| 735 | .id = -1, |
| 736 | .dev = { |
| 737 | .platform_data = &msm_device_snd_endpoints |
| 738 | }, |
| 739 | }; |
| 740 | |
| 741 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 742 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 743 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 744 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 745 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 746 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 747 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 748 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 749 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 750 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 751 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 752 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 753 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 754 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 755 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 756 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 757 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 758 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 759 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 760 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 761 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 762 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 763 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 764 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 765 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 766 | |
| 767 | static unsigned int dec_concurrency_table[] = { |
| 768 | /* Audio LP */ |
| 769 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 770 | 0, 0, 0, |
| 771 | |
| 772 | /* Concurrency 1 */ |
| 773 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 774 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 775 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 776 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 777 | (DEC4_FORMAT), |
| 778 | |
| 779 | /* Concurrency 2 */ |
| 780 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 781 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 782 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 783 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 784 | (DEC4_FORMAT), |
| 785 | |
| 786 | /* Concurrency 3 */ |
| 787 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 788 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 789 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 790 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 791 | (DEC4_FORMAT), |
| 792 | |
| 793 | /* Concurrency 4 */ |
| 794 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 795 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 796 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 797 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 798 | (DEC4_FORMAT), |
| 799 | |
| 800 | /* Concurrency 5 */ |
| 801 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 802 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 803 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 804 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 805 | (DEC4_FORMAT), |
| 806 | |
| 807 | /* Concurrency 6 */ |
| 808 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 809 | 0, 0, 0, 0, |
| 810 | |
| 811 | /* Concurrency 7 */ |
| 812 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 813 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 814 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 815 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 816 | (DEC4_FORMAT), |
| 817 | }; |
| 818 | |
| 819 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 820 | .module_queueid = queueid, .module_decid = decid, \ |
| 821 | .nr_codec_support = nr_codec} |
| 822 | |
| 823 | static struct msm_adspdec_info dec_info_list[] = { |
| 824 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 825 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 826 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 827 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 828 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 829 | }; |
| 830 | |
| 831 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 832 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 833 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 834 | ARRAY_SIZE(dec_info_list)), |
| 835 | .dec_concurrency_table = dec_concurrency_table, |
| 836 | .dec_info_list = dec_info_list, |
| 837 | }; |
| 838 | |
| 839 | static struct platform_device msm_device_adspdec = { |
| 840 | .name = "msm_adspdec", |
| 841 | .id = -1, |
| 842 | .dev = { |
| 843 | .platform_data = &msm_device_adspdec_database |
| 844 | }, |
| 845 | }; |
| 846 | |
| 847 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 848 | .name = "pmem_audio", |
| 849 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 850 | .cached = 0, |
| 851 | .memory_type = MEMTYPE_EBI1, |
| 852 | }; |
| 853 | |
| 854 | static struct platform_device android_pmem_audio_device = { |
| 855 | .name = "android_pmem", |
| 856 | .id = 2, |
| 857 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 858 | }; |
| 859 | |
| 860 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 861 | .name = "pmem", |
| 862 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 863 | .cached = 1, |
| 864 | .memory_type = MEMTYPE_EBI1, |
| 865 | }; |
| 866 | static struct platform_device android_pmem_device = { |
| 867 | .name = "android_pmem", |
| 868 | .id = 0, |
| 869 | .dev = { .platform_data = &android_pmem_pdata }, |
| 870 | }; |
| 871 | |
| 872 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 873 | |
| 874 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 875 | .voltage_min_design = 2800, |
| 876 | .voltage_max_design = 4300, |
| 877 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 878 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 879 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 880 | }; |
| 881 | |
| 882 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 883 | { |
| 884 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 885 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 886 | |
| 887 | return (current_voltage - low_voltage) * 100 |
| 888 | / (high_voltage - low_voltage); |
| 889 | } |
| 890 | |
| 891 | static struct platform_device msm_batt_device = { |
| 892 | .name = "msm-battery", |
| 893 | .id = -1, |
| 894 | .dev.platform_data = &msm_psy_batt_data, |
| 895 | }; |
| 896 | |
| 897 | static struct smsc911x_platform_config smsc911x_config = { |
| 898 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 899 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 900 | .flags = SMSC911X_USE_16BIT, |
| 901 | }; |
| 902 | |
| 903 | static struct resource smsc911x_resources[] = { |
| 904 | [0] = { |
| 905 | .start = 0x90000000, |
| 906 | .end = 0x90007fff, |
| 907 | .flags = IORESOURCE_MEM, |
| 908 | }, |
| 909 | [1] = { |
| 910 | .start = MSM_GPIO_TO_INT(48), |
| 911 | .end = MSM_GPIO_TO_INT(48), |
| 912 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 913 | }, |
| 914 | }; |
| 915 | |
| 916 | static struct platform_device smsc911x_device = { |
| 917 | .name = "smsc911x", |
| 918 | .id = 0, |
| 919 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 920 | .resource = smsc911x_resources, |
| 921 | .dev = { |
| 922 | .platform_data = &smsc911x_config, |
| 923 | }, |
| 924 | }; |
| 925 | |
| 926 | static struct msm_gpio smsc911x_gpios[] = { |
| 927 | { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 928 | "smsc911x_irq" }, |
| 929 | { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 930 | "eth_fifo_sel" }, |
| 931 | }; |
| 932 | |
| 933 | #define ETH_FIFO_SEL_GPIO 49 |
| 934 | static void msm7x27a_cfg_smsc911x(void) |
| 935 | { |
| 936 | int res; |
| 937 | |
| 938 | res = msm_gpios_request_enable(smsc911x_gpios, |
| 939 | ARRAY_SIZE(smsc911x_gpios)); |
| 940 | if (res) { |
| 941 | pr_err("%s: unable to enable gpios for SMSC911x\n", __func__); |
| 942 | return; |
| 943 | } |
| 944 | |
| 945 | /* ETH_FIFO_SEL */ |
| 946 | res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0); |
| 947 | if (res) { |
| 948 | pr_err("%s: unable to get direction for gpio %d\n", __func__, |
| 949 | ETH_FIFO_SEL_GPIO); |
| 950 | msm_gpios_disable_free(smsc911x_gpios, |
| 951 | ARRAY_SIZE(smsc911x_gpios)); |
| 952 | return; |
| 953 | } |
| 954 | gpio_set_value(ETH_FIFO_SEL_GPIO, 0); |
| 955 | } |
| 956 | |
| 957 | #ifdef CONFIG_MSM_CAMERA |
| 958 | static uint32_t camera_off_gpio_table[] = { |
| 959 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 960 | }; |
| 961 | |
| 962 | static uint32_t camera_on_gpio_table[] = { |
| 963 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 964 | }; |
| 965 | |
| 966 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 967 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 968 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT, |
| 969 | ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1, |
| 970 | ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 971 | }; |
| 972 | #endif |
| 973 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 974 | static struct regulator_bulk_data regs_camera[] = { |
| 975 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
| 976 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 977 | { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 }, |
| 978 | }; |
| 979 | |
| 980 | static void __init msm_camera_vreg_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 981 | { |
| 982 | int rc; |
| 983 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 984 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 985 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 986 | if (rc) { |
| 987 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 988 | return; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 989 | } |
| 990 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 991 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 992 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 993 | if (rc) { |
| 994 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 995 | return; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 996 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 997 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 998 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 999 | static void msm_camera_vreg_config(int vreg_en) |
| 1000 | { |
| 1001 | int rc = vreg_en ? |
| 1002 | regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) : |
| 1003 | regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1004 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1005 | if (rc) |
| 1006 | pr_err("%s: could not %sable regulators: %d\n", |
| 1007 | __func__, vreg_en ? "en" : "dis", rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1008 | } |
| 1009 | |
| 1010 | static int config_gpio_table(uint32_t *table, int len) |
| 1011 | { |
| 1012 | int rc = 0, i = 0; |
| 1013 | |
| 1014 | for (i = 0; i < len; i++) { |
| 1015 | rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE); |
| 1016 | if (rc) { |
| 1017 | pr_err("%s not able to get gpio\n", __func__); |
| 1018 | for (i--; i >= 0; i--) |
| 1019 | gpio_tlmm_config(camera_off_gpio_table[i], |
| 1020 | GPIO_CFG_ENABLE); |
| 1021 | break; |
| 1022 | } |
| 1023 | } |
| 1024 | return rc; |
| 1025 | } |
| 1026 | |
| 1027 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data; |
| 1028 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data; |
| 1029 | static int config_camera_on_gpios_rear(void) |
| 1030 | { |
| 1031 | int rc = 0; |
| 1032 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1033 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1034 | msm_camera_vreg_config(1); |
| 1035 | |
| 1036 | rc = config_gpio_table(camera_on_gpio_table, |
| 1037 | ARRAY_SIZE(camera_on_gpio_table)); |
| 1038 | if (rc < 0) { |
| 1039 | pr_err("%s: CAMSENSOR gpio table request" |
| 1040 | "failed\n", __func__); |
| 1041 | return rc; |
| 1042 | } |
| 1043 | |
| 1044 | return rc; |
| 1045 | } |
| 1046 | |
| 1047 | static void config_camera_off_gpios_rear(void) |
| 1048 | { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1049 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1050 | msm_camera_vreg_config(0); |
| 1051 | |
| 1052 | config_gpio_table(camera_off_gpio_table, |
| 1053 | ARRAY_SIZE(camera_off_gpio_table)); |
| 1054 | } |
| 1055 | |
| 1056 | static int config_camera_on_gpios_front(void) |
| 1057 | { |
| 1058 | int rc = 0; |
| 1059 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1060 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1061 | msm_camera_vreg_config(1); |
| 1062 | |
| 1063 | rc = config_gpio_table(camera_on_gpio_table, |
| 1064 | ARRAY_SIZE(camera_on_gpio_table)); |
| 1065 | if (rc < 0) { |
| 1066 | pr_err("%s: CAMSENSOR gpio table request" |
| 1067 | "failed\n", __func__); |
| 1068 | return rc; |
| 1069 | } |
| 1070 | |
| 1071 | return rc; |
| 1072 | } |
| 1073 | |
| 1074 | static void config_camera_off_gpios_front(void) |
| 1075 | { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1076 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1077 | msm_camera_vreg_config(0); |
| 1078 | |
| 1079 | config_gpio_table(camera_off_gpio_table, |
| 1080 | ARRAY_SIZE(camera_off_gpio_table)); |
| 1081 | } |
| 1082 | |
| 1083 | struct msm_camera_device_platform_data msm_camera_device_data_rear = { |
| 1084 | .camera_gpio_on = config_camera_on_gpios_rear, |
| 1085 | .camera_gpio_off = config_camera_off_gpios_rear, |
| 1086 | .ioext.csiphy = 0xA1000000, |
| 1087 | .ioext.csisz = 0x00100000, |
| 1088 | .ioext.csiirq = INT_CSI_IRQ_1, |
| 1089 | .ioclk.mclk_clk_rate = 24000000, |
| 1090 | .ioclk.vfe_clk_rate = 192000000, |
| 1091 | .ioext.appphy = MSM_CLK_CTL_PHYS, |
| 1092 | .ioext.appsz = MSM_CLK_CTL_SIZE, |
| 1093 | }; |
| 1094 | |
| 1095 | struct msm_camera_device_platform_data msm_camera_device_data_front = { |
| 1096 | .camera_gpio_on = config_camera_on_gpios_front, |
| 1097 | .camera_gpio_off = config_camera_off_gpios_front, |
| 1098 | .ioext.csiphy = 0xA0F00000, |
| 1099 | .ioext.csisz = 0x00100000, |
| 1100 | .ioext.csiirq = INT_CSI_IRQ_0, |
| 1101 | .ioclk.mclk_clk_rate = 24000000, |
| 1102 | .ioclk.vfe_clk_rate = 192000000, |
| 1103 | .ioext.appphy = MSM_CLK_CTL_PHYS, |
| 1104 | .ioext.appsz = MSM_CLK_CTL_SIZE, |
| 1105 | }; |
| 1106 | |
| 1107 | #ifdef CONFIG_S5K4E1 |
| 1108 | static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = { |
| 1109 | .mount_angle = 90 |
| 1110 | }; |
| 1111 | |
| 1112 | static struct msm_camera_sensor_flash_data flash_s5k4e1 = { |
| 1113 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1114 | .flash_src = &msm_flash_src |
| 1115 | }; |
| 1116 | |
| 1117 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = { |
| 1118 | .sensor_name = "s5k4e1", |
| 1119 | .sensor_reset_enable = 1, |
| 1120 | .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, |
| 1121 | .sensor_pwd = 85, |
| 1122 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 1123 | .vcm_enable = 1, |
| 1124 | .pdata = &msm_camera_device_data_rear, |
| 1125 | .flash_data = &flash_s5k4e1, |
| 1126 | .sensor_platform_info = &s5k4e1_sensor_7627a_info, |
| 1127 | .csi_if = 1 |
| 1128 | }; |
| 1129 | |
| 1130 | static struct platform_device msm_camera_sensor_s5k4e1 = { |
| 1131 | .name = "msm_camera_s5k4e1", |
| 1132 | .dev = { |
| 1133 | .platform_data = &msm_camera_sensor_s5k4e1_data, |
| 1134 | }, |
| 1135 | }; |
| 1136 | #endif |
| 1137 | |
| 1138 | #ifdef CONFIG_IMX072 |
| 1139 | static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = { |
| 1140 | .mount_angle = 90 |
| 1141 | }; |
| 1142 | |
| 1143 | static struct msm_camera_sensor_flash_data flash_imx072 = { |
| 1144 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1145 | .flash_src = &msm_flash_src |
| 1146 | }; |
| 1147 | |
| 1148 | static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = { |
| 1149 | .sensor_name = "imx072", |
| 1150 | .sensor_reset_enable = 1, |
| 1151 | .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/ |
| 1152 | .sensor_pwd = 85, |
| 1153 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 1154 | .vcm_enable = 1, |
| 1155 | .pdata = &msm_camera_device_data_rear, |
| 1156 | .flash_data = &flash_imx072, |
| 1157 | .sensor_platform_info = &imx072_sensor_7627a_info, |
| 1158 | .csi_if = 1 |
| 1159 | }; |
| 1160 | |
| 1161 | static struct platform_device msm_camera_sensor_imx072 = { |
| 1162 | .name = "msm_camera_imx072", |
| 1163 | .dev = { |
| 1164 | .platform_data = &msm_camera_sensor_imx072_data, |
| 1165 | }, |
| 1166 | }; |
| 1167 | #endif |
| 1168 | |
| 1169 | #ifdef CONFIG_WEBCAM_OV9726 |
| 1170 | static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = { |
| 1171 | .mount_angle = 90 |
| 1172 | }; |
| 1173 | |
| 1174 | static struct msm_camera_sensor_flash_data flash_ov9726 = { |
| 1175 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 1176 | .flash_src = &msm_flash_src |
| 1177 | }; |
| 1178 | |
| 1179 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = { |
| 1180 | .sensor_name = "ov9726", |
| 1181 | .sensor_reset_enable = 0, |
| 1182 | .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR, |
| 1183 | .sensor_pwd = 85, |
| 1184 | .vcm_pwd = 1, |
| 1185 | .vcm_enable = 0, |
| 1186 | .pdata = &msm_camera_device_data_front, |
| 1187 | .flash_data = &flash_ov9726, |
| 1188 | .sensor_platform_info = &ov9726_sensor_7627a_info, |
| 1189 | .csi_if = 1 |
| 1190 | }; |
| 1191 | |
| 1192 | static struct platform_device msm_camera_sensor_ov9726 = { |
| 1193 | .name = "msm_camera_ov9726", |
| 1194 | .dev = { |
| 1195 | .platform_data = &msm_camera_sensor_ov9726_data, |
| 1196 | }, |
| 1197 | }; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1198 | #else |
| 1199 | static inline void msm_camera_vreg_init(void) { } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1200 | #endif |
| 1201 | |
| 1202 | #ifdef CONFIG_MT9E013 |
| 1203 | static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = { |
| 1204 | .mount_angle = 90 |
| 1205 | }; |
| 1206 | |
| 1207 | static struct msm_camera_sensor_flash_data flash_mt9e013 = { |
| 1208 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1209 | .flash_src = &msm_flash_src |
| 1210 | }; |
| 1211 | |
| 1212 | static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = { |
| 1213 | .sensor_name = "mt9e013", |
| 1214 | .sensor_reset = 0, |
| 1215 | .sensor_reset_enable = 1, |
| 1216 | .sensor_pwd = 85, |
| 1217 | .vcm_pwd = 1, |
| 1218 | .vcm_enable = 0, |
| 1219 | .pdata = &msm_camera_device_data_rear, |
| 1220 | .flash_data = &flash_mt9e013, |
| 1221 | .sensor_platform_info = &mt9e013_sensor_7627a_info, |
| 1222 | .csi_if = 1 |
| 1223 | }; |
| 1224 | |
| 1225 | static struct platform_device msm_camera_sensor_mt9e013 = { |
| 1226 | .name = "msm_camera_mt9e013", |
| 1227 | .dev = { |
| 1228 | .platform_data = &msm_camera_sensor_mt9e013_data, |
| 1229 | }, |
| 1230 | }; |
| 1231 | #endif |
| 1232 | |
| 1233 | static struct i2c_board_info i2c_camera_devices[] = { |
| 1234 | #ifdef CONFIG_S5K4E1 |
| 1235 | { |
| 1236 | I2C_BOARD_INFO("s5k4e1", 0x36), |
| 1237 | }, |
| 1238 | { |
| 1239 | I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1), |
| 1240 | }, |
| 1241 | #endif |
| 1242 | #ifdef CONFIG_WEBCAM_OV9726 |
| 1243 | { |
| 1244 | I2C_BOARD_INFO("ov9726", 0x10), |
| 1245 | }, |
| 1246 | #endif |
| 1247 | #ifdef CONFIG_IMX072 |
| 1248 | { |
| 1249 | I2C_BOARD_INFO("imx072", 0x34), |
| 1250 | }, |
| 1251 | #endif |
| 1252 | #ifdef CONFIG_MT9E013 |
| 1253 | { |
| 1254 | I2C_BOARD_INFO("mt9e013", 0x6C >> 2), |
| 1255 | }, |
| 1256 | #endif |
| 1257 | { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 1258 | I2C_BOARD_INFO("sc628a", 0x6E), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1259 | }, |
| 1260 | }; |
| 1261 | #endif |
| 1262 | #if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \ |
| 1263 | && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM) |
| 1264 | static struct msm_gpio uart2dm_gpios[] = { |
| 1265 | {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1266 | "uart2dm_rfr_n" }, |
| 1267 | {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1268 | "uart2dm_cts_n" }, |
| 1269 | {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1270 | "uart2dm_rx" }, |
| 1271 | {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1272 | "uart2dm_tx" }, |
| 1273 | }; |
| 1274 | |
| 1275 | static void msm7x27a_cfg_uart2dm_serial(void) |
| 1276 | { |
| 1277 | int ret; |
| 1278 | ret = msm_gpios_request_enable(uart2dm_gpios, |
| 1279 | ARRAY_SIZE(uart2dm_gpios)); |
| 1280 | if (ret) |
| 1281 | pr_err("%s: unable to enable gpios for uart2dm\n", __func__); |
| 1282 | } |
| 1283 | #else |
| 1284 | static void msm7x27a_cfg_uart2dm_serial(void) { } |
| 1285 | #endif |
| 1286 | |
| 1287 | static struct platform_device *rumi_sim_devices[] __initdata = { |
| 1288 | &msm_device_dmov, |
| 1289 | &msm_device_smd, |
| 1290 | &smc91x_device, |
| 1291 | &msm_device_uart1, |
| 1292 | &msm_device_nand, |
| 1293 | &msm_device_uart_dm1, |
| 1294 | &msm_gsbi0_qup_i2c_device, |
| 1295 | &msm_gsbi1_qup_i2c_device, |
| 1296 | }; |
| 1297 | |
| 1298 | static struct platform_device *surf_ffa_devices[] __initdata = { |
| 1299 | &msm_device_dmov, |
| 1300 | &msm_device_smd, |
| 1301 | &msm_device_uart1, |
| 1302 | &msm_device_uart_dm1, |
| 1303 | &msm_device_uart_dm2, |
| 1304 | &msm_device_nand, |
| 1305 | &msm_gsbi0_qup_i2c_device, |
| 1306 | &msm_gsbi1_qup_i2c_device, |
| 1307 | &msm_device_otg, |
| 1308 | &msm_device_gadget_peripheral, |
| 1309 | &android_usb_device, |
| 1310 | &android_pmem_device, |
| 1311 | &android_pmem_adsp_device, |
| 1312 | &android_pmem_audio_device, |
| 1313 | &msm_device_snd, |
| 1314 | &msm_device_adspdec, |
| 1315 | &msm_fb_device, |
| 1316 | &lcdc_toshiba_panel_device, |
| 1317 | &msm_batt_device, |
| 1318 | &smsc911x_device, |
| 1319 | #ifdef CONFIG_S5K4E1 |
| 1320 | &msm_camera_sensor_s5k4e1, |
| 1321 | #endif |
| 1322 | #ifdef CONFIG_IMX072 |
| 1323 | &msm_camera_sensor_imx072, |
| 1324 | #endif |
| 1325 | #ifdef CONFIG_WEBCAM_OV9726 |
| 1326 | &msm_camera_sensor_ov9726, |
| 1327 | #endif |
| 1328 | #ifdef CONFIG_MT9E013 |
| 1329 | &msm_camera_sensor_mt9e013, |
| 1330 | #endif |
| 1331 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 1332 | &mipi_dsi_renesas_panel_device, |
| 1333 | #endif |
| 1334 | &msm_kgsl_3d0, |
| 1335 | #ifdef CONFIG_BT |
| 1336 | &msm_bt_power_device, |
| 1337 | #endif |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 1338 | &asoc_msm_pcm, |
| 1339 | &asoc_msm_dai0, |
| 1340 | &asoc_msm_dai1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1341 | }; |
| 1342 | |
| 1343 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 1344 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 1345 | { |
| 1346 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 1347 | return 0; |
| 1348 | } |
| 1349 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 1350 | |
| 1351 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 1352 | static int __init pmem_audio_size_setup(char *p) |
| 1353 | { |
| 1354 | pmem_audio_size = memparse(p, NULL); |
| 1355 | return 0; |
| 1356 | } |
| 1357 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 1358 | |
| 1359 | static void __init msm_msm7x2x_allocate_memory_regions(void) |
| 1360 | { |
| 1361 | void *addr; |
| 1362 | unsigned long size; |
| 1363 | |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 1364 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) |
| 1365 | fb_size = MSM7x25A_MSM_FB_SIZE; |
| 1366 | else |
| 1367 | fb_size = MSM_FB_SIZE; |
| 1368 | |
| 1369 | size = fb_size; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1370 | addr = alloc_bootmem_align(size, 0x1000); |
| 1371 | msm_fb_resources[0].start = __pa(addr); |
| 1372 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 1373 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 1374 | size, addr, __pa(addr)); |
| 1375 | } |
| 1376 | |
| 1377 | static struct memtype_reserve msm7x27a_reserve_table[] __initdata = { |
| 1378 | [MEMTYPE_SMI] = { |
| 1379 | }, |
| 1380 | [MEMTYPE_EBI0] = { |
| 1381 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 1382 | }, |
| 1383 | [MEMTYPE_EBI1] = { |
| 1384 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 1385 | }, |
| 1386 | }; |
| 1387 | |
| 1388 | static void __init size_pmem_devices(void) |
| 1389 | { |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 1390 | |
| 1391 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
| 1392 | pmem_mdp_size = MSM7x25A_MSM_PMEM_MDP_SIZE; |
| 1393 | pmem_adsp_size = MSM7x25A_MSM_PMEM_ADSP_SIZE; |
| 1394 | } else { |
| 1395 | pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 1396 | pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 1397 | } |
| 1398 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1399 | #ifdef CONFIG_ANDROID_PMEM |
| 1400 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 1401 | android_pmem_pdata.size = pmem_mdp_size; |
| 1402 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 1403 | #endif |
| 1404 | } |
| 1405 | |
| 1406 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 1407 | { |
| 1408 | msm7x27a_reserve_table[p->memory_type].size += p->size; |
| 1409 | } |
| 1410 | |
| 1411 | static void __init reserve_pmem_memory(void) |
| 1412 | { |
| 1413 | #ifdef CONFIG_ANDROID_PMEM |
| 1414 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 1415 | reserve_memory_for(&android_pmem_pdata); |
| 1416 | reserve_memory_for(&android_pmem_audio_pdata); |
| 1417 | msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 1418 | #endif |
| 1419 | } |
| 1420 | |
| 1421 | static void __init msm7x27a_calculate_reserve_sizes(void) |
| 1422 | { |
| 1423 | size_pmem_devices(); |
| 1424 | reserve_pmem_memory(); |
| 1425 | } |
| 1426 | |
| 1427 | static int msm7x27a_paddr_to_memtype(unsigned int paddr) |
| 1428 | { |
| 1429 | return MEMTYPE_EBI1; |
| 1430 | } |
| 1431 | |
| 1432 | static struct reserve_info msm7x27a_reserve_info __initdata = { |
| 1433 | .memtype_reserve_table = msm7x27a_reserve_table, |
| 1434 | .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes, |
| 1435 | .paddr_to_memtype = msm7x27a_paddr_to_memtype, |
| 1436 | }; |
| 1437 | |
| 1438 | static void __init msm7x27a_reserve(void) |
| 1439 | { |
| 1440 | reserve_info = &msm7x27a_reserve_info; |
| 1441 | msm_reserve(); |
| 1442 | } |
| 1443 | |
| 1444 | static void __init msm_device_i2c_init(void) |
| 1445 | { |
| 1446 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 1447 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 1448 | } |
| 1449 | |
| 1450 | static struct msm_panel_common_pdata mdp_pdata = { |
| 1451 | .gpio = 97, |
| 1452 | .mdp_rev = MDP_REV_303, |
| 1453 | }; |
| 1454 | |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 1455 | |
| 1456 | #ifdef CONFIG_FB_MSM |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1457 | #define GPIO_LCDC_BRDG_PD 128 |
| 1458 | #define GPIO_LCDC_BRDG_RESET_N 129 |
| 1459 | |
| 1460 | #define LCDC_RESET_PHYS 0x90008014 |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 1461 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1462 | static void __iomem *lcdc_reset_ptr; |
| 1463 | |
| 1464 | static unsigned mipi_dsi_gpio[] = { |
| 1465 | GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 1466 | GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */ |
| 1467 | GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 1468 | GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */ |
| 1469 | }; |
| 1470 | |
| 1471 | enum { |
| 1472 | DSI_SINGLE_LANE = 1, |
| 1473 | DSI_TWO_LANES, |
| 1474 | }; |
| 1475 | |
| 1476 | static int msm_fb_get_lane_config(void) |
| 1477 | { |
| 1478 | int rc = DSI_TWO_LANES; |
| 1479 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1480 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1481 | rc = DSI_SINGLE_LANE; |
| 1482 | pr_info("DSI Single Lane\n"); |
| 1483 | } else { |
| 1484 | pr_info("DSI Two Lanes\n"); |
| 1485 | } |
| 1486 | return rc; |
| 1487 | } |
| 1488 | |
| 1489 | static int msm_fb_dsi_client_reset(void) |
| 1490 | { |
| 1491 | int rc = 0; |
| 1492 | |
| 1493 | rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n"); |
| 1494 | if (rc < 0) { |
| 1495 | pr_err("failed to request lcd brdg reset_n\n"); |
| 1496 | return rc; |
| 1497 | } |
| 1498 | |
| 1499 | rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd"); |
| 1500 | if (rc < 0) { |
| 1501 | pr_err("failed to request lcd brdg pd\n"); |
| 1502 | return rc; |
| 1503 | } |
| 1504 | |
| 1505 | rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE); |
| 1506 | if (rc) { |
| 1507 | pr_err("Failed to enable LCDC Bridge reset enable\n"); |
| 1508 | goto gpio_error; |
| 1509 | } |
| 1510 | |
| 1511 | rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE); |
| 1512 | if (rc) { |
| 1513 | pr_err("Failed to enable LCDC Bridge pd enable\n"); |
| 1514 | goto gpio_error2; |
| 1515 | } |
| 1516 | |
| 1517 | rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1); |
| 1518 | rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1); |
| 1519 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0); |
| 1520 | |
| 1521 | if (!rc) { |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1522 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1523 | lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS, |
| 1524 | sizeof(uint32_t)); |
| 1525 | |
| 1526 | if (!lcdc_reset_ptr) |
| 1527 | return 0; |
| 1528 | } |
| 1529 | return rc; |
| 1530 | } else { |
| 1531 | goto gpio_error; |
| 1532 | } |
| 1533 | |
| 1534 | gpio_error2: |
| 1535 | pr_err("Failed GPIO bridge pd\n"); |
| 1536 | gpio_free(GPIO_LCDC_BRDG_PD); |
| 1537 | |
| 1538 | gpio_error: |
| 1539 | pr_err("Failed GPIO bridge reset\n"); |
| 1540 | gpio_free(GPIO_LCDC_BRDG_RESET_N); |
| 1541 | return rc; |
| 1542 | } |
| 1543 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1544 | static struct regulator_bulk_data regs_dsi[] = { |
| 1545 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 1546 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1547 | }; |
| 1548 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1549 | static int dsi_gpio_initialized; |
| 1550 | |
| 1551 | static int mipi_dsi_panel_power(int on) |
| 1552 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1553 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1554 | uint32_t lcdc_reset_cfg; |
| 1555 | |
| 1556 | /* I2C-controlled GPIO Expander -init of the GPIOs very late */ |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1557 | if (unlikely(!dsi_gpio_initialized)) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1558 | pmapp_disp_backlight_init(); |
| 1559 | |
| 1560 | rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr"); |
| 1561 | if (rc < 0) { |
| 1562 | pr_err("failed to request gpio_disp_pwr\n"); |
| 1563 | return rc; |
| 1564 | } |
| 1565 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1566 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1567 | rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1); |
| 1568 | if (rc < 0) { |
| 1569 | pr_err("failed to enable display pwr\n"); |
| 1570 | goto fail_gpio1; |
| 1571 | } |
| 1572 | |
| 1573 | rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en"); |
| 1574 | if (rc < 0) { |
| 1575 | pr_err("failed to request gpio_bkl_en\n"); |
| 1576 | goto fail_gpio1; |
| 1577 | } |
| 1578 | |
| 1579 | rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1); |
| 1580 | if (rc < 0) { |
| 1581 | pr_err("failed to enable backlight\n"); |
| 1582 | goto fail_gpio2; |
| 1583 | } |
| 1584 | } |
| 1585 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1586 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi); |
| 1587 | if (rc) { |
| 1588 | pr_err("%s: could not get regulators: %d\n", |
| 1589 | __func__, rc); |
| 1590 | goto fail_gpio2; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1591 | } |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1592 | |
| 1593 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi); |
| 1594 | if (rc) { |
| 1595 | pr_err("%s: could not set voltages: %d\n", |
| 1596 | __func__, rc); |
| 1597 | goto fail_vreg; |
| 1598 | } |
| 1599 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1600 | dsi_gpio_initialized = 1; |
| 1601 | } |
| 1602 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1603 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1604 | gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); |
| 1605 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1606 | } else if (machine_is_msm7x27a_ffa() || |
| 1607 | machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1608 | if (on) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1609 | /* This line drives an active low pin on FFA */ |
| 1610 | rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on); |
| 1611 | if (rc < 0) |
| 1612 | pr_err("failed to set direction for " |
| 1613 | "display pwr\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1614 | } else { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1615 | gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on); |
| 1616 | rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN); |
| 1617 | if (rc < 0) |
| 1618 | pr_err("failed to set direction for " |
| 1619 | "display pwr\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1620 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1621 | } |
| 1622 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1623 | if (on) { |
| 1624 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0); |
| 1625 | |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1626 | if (machine_is_msm7x27a_surf() || |
| 1627 | machine_is_msm7625a_surf()) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1628 | lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr); |
| 1629 | rmb(); |
| 1630 | lcdc_reset_cfg &= ~1; |
| 1631 | |
| 1632 | writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); |
| 1633 | msleep(20); |
| 1634 | wmb(); |
| 1635 | lcdc_reset_cfg |= 1; |
| 1636 | writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); |
| 1637 | } else { |
| 1638 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0); |
| 1639 | msleep(20); |
| 1640 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1); |
| 1641 | } |
| 1642 | |
| 1643 | if (pmapp_disp_backlight_set_brightness(100)) |
| 1644 | pr_err("backlight set brightness failed\n"); |
| 1645 | } else { |
| 1646 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1); |
| 1647 | |
| 1648 | if (pmapp_disp_backlight_set_brightness(0)) |
| 1649 | pr_err("backlight set brightness failed\n"); |
| 1650 | } |
| 1651 | |
| 1652 | rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) : |
| 1653 | regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi); |
| 1654 | |
| 1655 | if (rc) |
| 1656 | pr_err("%s: could not %sable regulators: %d\n", |
| 1657 | __func__, on ? "en" : "dis", rc); |
| 1658 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1659 | return rc; |
| 1660 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1661 | fail_vreg: |
| 1662 | regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1663 | fail_gpio2: |
| 1664 | gpio_free(GPIO_BACKLIGHT_EN); |
| 1665 | fail_gpio1: |
| 1666 | gpio_free(GPIO_DISPLAY_PWR_EN); |
| 1667 | dsi_gpio_initialized = 0; |
| 1668 | return rc; |
| 1669 | } |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 1670 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1671 | |
| 1672 | #define MDP_303_VSYNC_GPIO 97 |
| 1673 | |
| 1674 | #ifdef CONFIG_FB_MSM_MDP303 |
| 1675 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 1676 | .vsync_gpio = MDP_303_VSYNC_GPIO, |
| 1677 | .dsi_power_save = mipi_dsi_panel_power, |
| 1678 | .dsi_client_reset = msm_fb_dsi_client_reset, |
| 1679 | .get_lane_config = msm_fb_get_lane_config, |
| 1680 | }; |
| 1681 | #endif |
| 1682 | |
| 1683 | static void __init msm_fb_add_devices(void) |
| 1684 | { |
| 1685 | msm_fb_register_device("mdp", &mdp_pdata); |
| 1686 | msm_fb_register_device("lcdc", &lcdc_pdata); |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 1687 | #ifdef CONFIG_FB_MSM_MDP303 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1688 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
Pankaj Kumar | ffdaec8 | 2011-09-26 12:24:45 +0530 | [diff] [blame] | 1689 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1690 | } |
| 1691 | |
| 1692 | #define MSM_EBI2_PHYS 0xa0d00000 |
| 1693 | #define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030 |
| 1694 | |
| 1695 | static void __init msm7x27a_init_ebi2(void) |
| 1696 | { |
| 1697 | uint32_t ebi2_cfg; |
| 1698 | void __iomem *ebi2_cfg_ptr; |
| 1699 | |
| 1700 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t)); |
| 1701 | if (!ebi2_cfg_ptr) |
| 1702 | return; |
| 1703 | |
| 1704 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1705 | if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() || |
| 1706 | machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1707 | ebi2_cfg |= (1 << 4); /* CS2 */ |
| 1708 | |
| 1709 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 1710 | iounmap(ebi2_cfg_ptr); |
| 1711 | |
| 1712 | /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */ |
| 1713 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1, |
| 1714 | sizeof(uint32_t)); |
| 1715 | if (!ebi2_cfg_ptr) |
| 1716 | return; |
| 1717 | |
| 1718 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1719 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1720 | ebi2_cfg |= (1 << 31); |
| 1721 | |
| 1722 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 1723 | iounmap(ebi2_cfg_ptr); |
| 1724 | } |
| 1725 | |
| 1726 | #define ATMEL_TS_I2C_NAME "maXTouch" |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1727 | |
| 1728 | static struct regulator_bulk_data regs_atmel[] = { |
| 1729 | { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 1730 | { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 1731 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1732 | |
| 1733 | #define ATMEL_TS_GPIO_IRQ 82 |
| 1734 | |
| 1735 | static int atmel_ts_power_on(bool on) |
| 1736 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1737 | int rc = on ? |
| 1738 | regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) : |
| 1739 | regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1740 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1741 | if (rc) |
| 1742 | pr_err("%s: could not %sable regulators: %d\n", |
| 1743 | __func__, on ? "en" : "dis", rc); |
| 1744 | else |
| 1745 | msleep(50); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1746 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1747 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1748 | } |
| 1749 | |
| 1750 | static int atmel_ts_platform_init(struct i2c_client *client) |
| 1751 | { |
| 1752 | int rc; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1753 | struct device *dev = &client->dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1754 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1755 | rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1756 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1757 | dev_err(dev, "%s: could not get regulators: %d\n", |
| 1758 | __func__, rc); |
| 1759 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1760 | } |
| 1761 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1762 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1763 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1764 | dev_err(dev, "%s: could not set voltages: %d\n", |
| 1765 | __func__, rc); |
| 1766 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1767 | } |
| 1768 | |
| 1769 | rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 1770 | GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 1771 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 1772 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1773 | dev_err(dev, "%s: gpio_tlmm_config for %d failed\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1774 | __func__, ATMEL_TS_GPIO_IRQ); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1775 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1776 | } |
| 1777 | |
| 1778 | /* configure touchscreen interrupt gpio */ |
| 1779 | rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio"); |
| 1780 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1781 | dev_err(dev, "%s: unable to request gpio %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1782 | __func__, ATMEL_TS_GPIO_IRQ); |
| 1783 | goto ts_gpio_tlmm_unconfig; |
| 1784 | } |
| 1785 | |
| 1786 | rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ); |
| 1787 | if (rc < 0) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1788 | 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] | 1789 | __func__, ATMEL_TS_GPIO_IRQ); |
| 1790 | goto free_ts_gpio; |
| 1791 | } |
| 1792 | return 0; |
| 1793 | |
| 1794 | free_ts_gpio: |
| 1795 | gpio_free(ATMEL_TS_GPIO_IRQ); |
| 1796 | ts_gpio_tlmm_unconfig: |
| 1797 | gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 1798 | GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 1799 | GPIO_CFG_2MA), GPIO_CFG_DISABLE); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1800 | reg_free: |
| 1801 | regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel); |
| 1802 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1803 | return rc; |
| 1804 | } |
| 1805 | |
| 1806 | static int atmel_ts_platform_exit(struct i2c_client *client) |
| 1807 | { |
| 1808 | gpio_free(ATMEL_TS_GPIO_IRQ); |
| 1809 | gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 1810 | GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 1811 | GPIO_CFG_2MA), GPIO_CFG_DISABLE); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1812 | regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1813 | return 0; |
| 1814 | } |
| 1815 | |
| 1816 | static u8 atmel_ts_read_chg(void) |
| 1817 | { |
| 1818 | return gpio_get_value(ATMEL_TS_GPIO_IRQ); |
| 1819 | } |
| 1820 | |
| 1821 | static u8 atmel_ts_valid_interrupt(void) |
| 1822 | { |
| 1823 | return !atmel_ts_read_chg(); |
| 1824 | } |
| 1825 | |
| 1826 | #define ATMEL_X_OFFSET 13 |
| 1827 | #define ATMEL_Y_OFFSET 0 |
| 1828 | |
Mohan Pallaka | 4e9a94e | 2011-11-23 16:34:21 +0530 | [diff] [blame] | 1829 | static struct maxtouch_platform_data atmel_ts_pdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1830 | .numtouch = 4, |
| 1831 | .init_platform_hw = atmel_ts_platform_init, |
| 1832 | .exit_platform_hw = atmel_ts_platform_exit, |
| 1833 | .power_on = atmel_ts_power_on, |
| 1834 | .display_res_x = 480, |
| 1835 | .display_res_y = 864, |
| 1836 | .min_x = ATMEL_X_OFFSET, |
| 1837 | .max_x = (505 - ATMEL_X_OFFSET), |
| 1838 | .min_y = ATMEL_Y_OFFSET, |
| 1839 | .max_y = (863 - ATMEL_Y_OFFSET), |
| 1840 | .valid_interrupt = atmel_ts_valid_interrupt, |
| 1841 | .read_chg = atmel_ts_read_chg, |
| 1842 | }; |
| 1843 | |
| 1844 | static struct i2c_board_info atmel_ts_i2c_info[] __initdata = { |
| 1845 | { |
| 1846 | I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a), |
| 1847 | .platform_data = &atmel_ts_pdata, |
| 1848 | .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ), |
| 1849 | }, |
| 1850 | }; |
| 1851 | |
| 1852 | #define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col)) |
| 1853 | |
| 1854 | static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35}; |
| 1855 | static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40}; |
| 1856 | |
| 1857 | static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) * |
| 1858 | ARRAY_SIZE(kp_row_gpios)] = { |
| 1859 | [KP_INDEX(0, 0)] = KEY_7, |
| 1860 | [KP_INDEX(0, 1)] = KEY_DOWN, |
| 1861 | [KP_INDEX(0, 2)] = KEY_UP, |
| 1862 | [KP_INDEX(0, 3)] = KEY_RIGHT, |
| 1863 | [KP_INDEX(0, 4)] = KEY_ENTER, |
| 1864 | |
| 1865 | [KP_INDEX(1, 0)] = KEY_LEFT, |
| 1866 | [KP_INDEX(1, 1)] = KEY_SEND, |
| 1867 | [KP_INDEX(1, 2)] = KEY_1, |
| 1868 | [KP_INDEX(1, 3)] = KEY_4, |
| 1869 | [KP_INDEX(1, 4)] = KEY_CLEAR, |
| 1870 | |
| 1871 | [KP_INDEX(2, 0)] = KEY_6, |
| 1872 | [KP_INDEX(2, 1)] = KEY_5, |
| 1873 | [KP_INDEX(2, 2)] = KEY_8, |
| 1874 | [KP_INDEX(2, 3)] = KEY_3, |
| 1875 | [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR, |
| 1876 | |
| 1877 | [KP_INDEX(3, 0)] = KEY_9, |
| 1878 | [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND, |
| 1879 | [KP_INDEX(3, 2)] = KEY_0, |
| 1880 | [KP_INDEX(3, 3)] = KEY_2, |
| 1881 | [KP_INDEX(3, 4)] = KEY_SLEEP, |
| 1882 | |
| 1883 | [KP_INDEX(4, 0)] = KEY_BACK, |
| 1884 | [KP_INDEX(4, 1)] = KEY_HOME, |
| 1885 | [KP_INDEX(4, 2)] = KEY_MENU, |
| 1886 | [KP_INDEX(4, 3)] = KEY_VOLUMEUP, |
| 1887 | [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN, |
| 1888 | }; |
| 1889 | |
| 1890 | /* SURF keypad platform device information */ |
| 1891 | static struct gpio_event_matrix_info kp_matrix_info = { |
| 1892 | .info.func = gpio_event_matrix_func, |
| 1893 | .keymap = keymap, |
| 1894 | .output_gpios = kp_row_gpios, |
| 1895 | .input_gpios = kp_col_gpios, |
| 1896 | .noutputs = ARRAY_SIZE(kp_row_gpios), |
| 1897 | .ninputs = ARRAY_SIZE(kp_col_gpios), |
| 1898 | .settle_time.tv_nsec = 40 * NSEC_PER_USEC, |
| 1899 | .poll_time.tv_nsec = 20 * NSEC_PER_MSEC, |
| 1900 | .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | |
| 1901 | GPIOKPF_PRINT_UNMAPPED_KEYS, |
| 1902 | }; |
| 1903 | |
| 1904 | static struct gpio_event_info *kp_info[] = { |
| 1905 | &kp_matrix_info.info |
| 1906 | }; |
| 1907 | |
| 1908 | static struct gpio_event_platform_data kp_pdata = { |
| 1909 | .name = "7x27a_kp", |
| 1910 | .info = kp_info, |
| 1911 | .info_count = ARRAY_SIZE(kp_info) |
| 1912 | }; |
| 1913 | |
| 1914 | static struct platform_device kp_pdev = { |
| 1915 | .name = GPIO_EVENT_DEV_NAME, |
| 1916 | .id = -1, |
| 1917 | .dev = { |
| 1918 | .platform_data = &kp_pdata, |
| 1919 | }, |
| 1920 | }; |
| 1921 | |
| 1922 | static struct msm_handset_platform_data hs_platform_data = { |
| 1923 | .hs_name = "7k_handset", |
| 1924 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ |
| 1925 | }; |
| 1926 | |
| 1927 | static struct platform_device hs_pdev = { |
| 1928 | .name = "msm-handset", |
| 1929 | .id = -1, |
| 1930 | .dev = { |
| 1931 | .platform_data = &hs_platform_data, |
| 1932 | }, |
| 1933 | }; |
| 1934 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 1935 | static struct platform_device msm_proccomm_regulator_dev = { |
| 1936 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 1937 | .id = -1, |
| 1938 | .dev = { |
| 1939 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 1940 | } |
| 1941 | }; |
| 1942 | |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1943 | static void __init msm7627a_rumi3_init(void) |
| 1944 | { |
| 1945 | msm7x27a_init_ebi2(); |
| 1946 | platform_add_devices(rumi_sim_devices, |
| 1947 | ARRAY_SIZE(rumi_sim_devices)); |
| 1948 | } |
| 1949 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1950 | #define LED_GPIO_PDM 96 |
| 1951 | #define UART1DM_RX_GPIO 45 |
Santosh Sajjan | b479f0f | 2011-08-18 21:00:44 +0530 | [diff] [blame] | 1952 | |
| 1953 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 1954 | static int __init msm7x27a_init_ar6000pm(void) |
| 1955 | { |
| 1956 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 1957 | } |
| 1958 | #else |
| 1959 | static int __init msm7x27a_init_ar6000pm(void) { return 0; } |
| 1960 | #endif |
| 1961 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 1962 | static void __init msm7x27a_init_regulators(void) |
| 1963 | { |
| 1964 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 1965 | if (rc) |
| 1966 | pr_err("%s: could not register regulator device: %d\n", |
| 1967 | __func__, rc); |
| 1968 | } |
| 1969 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1970 | static void __init msm7x2x_init(void) |
| 1971 | { |
Trilok Soni | a416c49 | 2011-07-22 20:20:23 +0530 | [diff] [blame] | 1972 | msm7x2x_misc_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1973 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 1974 | /* Initialize regulators first so that other devices can use them */ |
| 1975 | msm7x27a_init_regulators(); |
| 1976 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1977 | /* Common functions for SURF/FFA/RUMI3 */ |
| 1978 | msm_device_i2c_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1979 | msm7x27a_init_ebi2(); |
| 1980 | msm7x27a_cfg_uart2dm_serial(); |
| 1981 | #ifdef CONFIG_SERIAL_MSM_HS |
| 1982 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 1983 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 1984 | #endif |
| 1985 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1986 | #ifdef CONFIG_USB_MSM_OTG_72K |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1987 | msm_otg_pdata.swfi_latency = |
| 1988 | msm7x27a_pm_data |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1989 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1990 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1991 | #endif |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1992 | msm_device_gadget_peripheral.dev.platform_data = |
| 1993 | &msm_gadget_pdata; |
| 1994 | msm7x27a_cfg_smsc911x(); |
| 1995 | platform_add_devices(msm_footswitch_devices, |
| 1996 | msm_num_footswitch_devices); |
| 1997 | platform_add_devices(surf_ffa_devices, |
| 1998 | ARRAY_SIZE(surf_ffa_devices)); |
Sujith Reddy Thumma | ad7c9a8 | 2011-09-30 20:54:38 +0530 | [diff] [blame] | 1999 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 2000 | msm7x27a_init_ar6000pm(); |
| 2001 | #ifdef CONFIG_MMC_MSM |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 2002 | msm7627a_init_mmc(); |
Sujith Reddy Thumma | ad7c9a8 | 2011-09-30 20:54:38 +0530 | [diff] [blame] | 2003 | #endif |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2004 | msm_fb_add_devices(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2005 | #ifdef CONFIG_USB_EHCI_MSM_72K |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2006 | msm7x2x_init_host(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2007 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2008 | |
| 2009 | msm_pm_set_platform_data(msm7x27a_pm_data, |
| 2010 | ARRAY_SIZE(msm7x27a_pm_data)); |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 2011 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2012 | |
| 2013 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 2014 | register_i2c_devices(); |
| 2015 | #endif |
| 2016 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
Chintan Pandya | 13490c0 | 2011-12-20 13:03:36 +0530 | [diff] [blame^] | 2017 | msm7627a_bt_power_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2018 | #endif |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2019 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2020 | atmel_ts_pdata.min_x = 0; |
| 2021 | atmel_ts_pdata.max_x = 480; |
| 2022 | atmel_ts_pdata.min_y = 0; |
| 2023 | atmel_ts_pdata.max_y = 320; |
| 2024 | } |
| 2025 | |
| 2026 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 2027 | atmel_ts_i2c_info, |
| 2028 | ARRAY_SIZE(atmel_ts_i2c_info)); |
| 2029 | |
Pankaj Kumar | 5be2a3e | 2011-09-26 11:45:02 +0530 | [diff] [blame] | 2030 | #if defined(CONFIG_MSM_CAMERA) |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 2031 | msm_camera_vreg_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2032 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 2033 | i2c_camera_devices, |
| 2034 | ARRAY_SIZE(i2c_camera_devices)); |
Pankaj Kumar | 5be2a3e | 2011-09-26 11:45:02 +0530 | [diff] [blame] | 2035 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2036 | platform_device_register(&kp_pdev); |
| 2037 | platform_device_register(&hs_pdev); |
| 2038 | |
| 2039 | /* configure it as a pdm function*/ |
| 2040 | if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3, |
| 2041 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 2042 | GPIO_CFG_8MA), GPIO_CFG_ENABLE)) |
| 2043 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 2044 | __func__, LED_GPIO_PDM); |
| 2045 | else |
| 2046 | platform_device_register(&led_pdev); |
| 2047 | |
| 2048 | #ifdef CONFIG_MSM_RPC_VIBRATOR |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2049 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2050 | msm_init_pmic_vibrator(); |
| 2051 | #endif |
| 2052 | /*7x25a kgsl initializations*/ |
| 2053 | msm7x25a_kgsl_3d0_init(); |
| 2054 | } |
| 2055 | |
| 2056 | static void __init msm7x2x_init_early(void) |
| 2057 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2058 | msm_msm7x2x_allocate_memory_regions(); |
| 2059 | } |
| 2060 | |
| 2061 | MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3") |
| 2062 | .boot_params = PHYS_OFFSET + 0x100, |
| 2063 | .map_io = msm_common_io_init, |
| 2064 | .reserve = msm7x27a_reserve, |
| 2065 | .init_irq = msm_init_irq, |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2066 | .init_machine = msm7627a_rumi3_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2067 | .timer = &msm_timer, |
| 2068 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 2069 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2070 | MACHINE_END |
| 2071 | MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF") |
| 2072 | .boot_params = PHYS_OFFSET + 0x100, |
| 2073 | .map_io = msm_common_io_init, |
| 2074 | .reserve = msm7x27a_reserve, |
| 2075 | .init_irq = msm_init_irq, |
| 2076 | .init_machine = msm7x2x_init, |
| 2077 | .timer = &msm_timer, |
| 2078 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 2079 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2080 | MACHINE_END |
| 2081 | MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA") |
| 2082 | .boot_params = PHYS_OFFSET + 0x100, |
| 2083 | .map_io = msm_common_io_init, |
| 2084 | .reserve = msm7x27a_reserve, |
| 2085 | .init_irq = msm_init_irq, |
| 2086 | .init_machine = msm7x2x_init, |
| 2087 | .timer = &msm_timer, |
| 2088 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 2089 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2090 | MACHINE_END |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2091 | MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF") |
| 2092 | .boot_params = PHYS_OFFSET + 0x100, |
| 2093 | .map_io = msm_common_io_init, |
| 2094 | .reserve = msm7x27a_reserve, |
| 2095 | .init_irq = msm_init_irq, |
| 2096 | .init_machine = msm7x2x_init, |
| 2097 | .timer = &msm_timer, |
| 2098 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 2099 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2100 | MACHINE_END |
| 2101 | MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA") |
| 2102 | .boot_params = PHYS_OFFSET + 0x100, |
| 2103 | .map_io = msm_common_io_init, |
| 2104 | .reserve = msm7x27a_reserve, |
| 2105 | .init_irq = msm_init_irq, |
| 2106 | .init_machine = msm7x2x_init, |
| 2107 | .timer = &msm_timer, |
| 2108 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 2109 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 2110 | MACHINE_END |