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