Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/gpio_event.h> |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 16 | #include <linux/usb/android.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <linux/gpio.h> |
| 20 | #include <linux/mtd/nand.h> |
| 21 | #include <linux/mtd/partitions.h> |
| 22 | #include <linux/i2c.h> |
| 23 | #include <linux/android_pmem.h> |
| 24 | #include <linux/bootmem.h> |
| 25 | #include <linux/mfd/marimba.h> |
| 26 | #include <linux/power_supply.h> |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 27 | #include <linux/input/rmi_platformdata.h> |
| 28 | #include <linux/input/rmi_i2c.h> |
| 29 | #include <linux/i2c/atmel_mxt_ts.h> |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 30 | #include <linux/regulator/consumer.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 31 | #include <linux/memblock.h> |
Mohan Pallaka | 5afe985 | 2012-01-12 23:12:06 +0530 | [diff] [blame] | 32 | #include <linux/input/ft5x06_ts.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 33 | #include <asm/mach/mmc.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 36 | #include <asm/hardware/gic.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 37 | #include <mach/board.h> |
| 38 | #include <mach/msm_iomap.h> |
| 39 | #include <mach/msm_hsusb.h> |
| 40 | #include <mach/rpc_hsusb.h> |
| 41 | #include <mach/rpc_pmapp.h> |
| 42 | #include <mach/usbdiag.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 43 | #include <mach/msm_memtypes.h> |
| 44 | #include <mach/msm_serial_hs.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 45 | #include <mach/pmic.h> |
| 46 | #include <mach/socinfo.h> |
| 47 | #include <mach/vreg.h> |
| 48 | #include <mach/rpc_pmapp.h> |
| 49 | #include <mach/msm_battery.h> |
| 50 | #include <mach/rpc_server_handset.h> |
| 51 | #include <mach/socinfo.h> |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 52 | #include "board-msm7x27a-regulator.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 53 | #include "devices.h" |
| 54 | #include "devices-msm7x2xa.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 55 | #include "pm.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 56 | #include "timer.h" |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 57 | #include "pm-boot.h" |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 58 | #include "board-msm7x27a-regulator.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 59 | #include "board-msm7627a.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 60 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 61 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
Sidipotu Ashok | 4f1ddc9 | 2012-04-11 13:51:34 +0530 | [diff] [blame^] | 62 | #define MSM_PMEM_AUDIO_SIZE 0x1F4000 |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 63 | #define BAHAMA_SLAVE_ID_FM_REG 0x02 |
| 64 | #define FM_GPIO 83 |
| 65 | #define BT_PCM_BCLK_MODE 0x88 |
| 66 | #define BT_PCM_DIN_MODE 0x89 |
| 67 | #define BT_PCM_DOUT_MODE 0x8A |
| 68 | #define BT_PCM_SYNC_MODE 0x8B |
| 69 | #define FM_I2S_SD_MODE 0x8E |
| 70 | #define FM_I2S_WS_MODE 0x8F |
| 71 | #define FM_I2S_SCK_MODE 0x90 |
| 72 | #define I2C_PIN_CTL 0x15 |
| 73 | #define I2C_NORMAL 0x40 |
| 74 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 75 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 76 | .name = "wlan_ar6000_pm_dev", |
| 77 | .id = -1, |
| 78 | }; |
| 79 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 80 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 81 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 82 | "qup_scl" }, |
| 83 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 84 | "qup_sda" }, |
| 85 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 86 | "qup_scl" }, |
| 87 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 88 | "qup_sda" }, |
| 89 | }; |
| 90 | |
| 91 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 92 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 93 | "qup_scl" }, |
| 94 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 95 | "qup_sda" }, |
| 96 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 97 | "qup_scl" }, |
| 98 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 99 | "qup_sda" }, |
| 100 | }; |
| 101 | |
| 102 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 103 | { |
| 104 | int rc; |
| 105 | |
| 106 | if (adap_id < 0 || adap_id > 1) |
| 107 | return; |
| 108 | |
| 109 | /* Each adapter gets 2 lines from the table */ |
| 110 | if (config_type) |
| 111 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 112 | else |
| 113 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 114 | if (rc < 0) |
| 115 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 116 | } |
| 117 | |
| 118 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 119 | .clk_freq = 100000, |
| 120 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 121 | }; |
| 122 | |
| 123 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 124 | .clk_freq = 100000, |
| 125 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 126 | }; |
| 127 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 128 | #ifdef CONFIG_ARCH_MSM7X27A |
| 129 | #define MSM_PMEM_MDP_SIZE 0x1DD1000 |
| 130 | #define MSM_PMEM_ADSP_SIZE 0x1100000 |
| 131 | #endif |
| 132 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 133 | static struct android_usb_platform_data android_usb_pdata = { |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 134 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 135 | }; |
| 136 | |
| 137 | static struct platform_device android_usb_device = { |
| 138 | .name = "android_usb", |
| 139 | .id = -1, |
| 140 | .dev = { |
| 141 | .platform_data = &android_usb_pdata, |
| 142 | }, |
| 143 | }; |
| 144 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 145 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 146 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 147 | { |
| 148 | int rc = 0; |
| 149 | unsigned gpio; |
| 150 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 151 | gpio = QRD_GPIO_HOST_VBUS_EN; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 152 | |
| 153 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 154 | if (rc < 0) { |
| 155 | pr_err("failed to request %d GPIO\n", gpio); |
| 156 | return; |
| 157 | } |
| 158 | gpio_direction_output(gpio, !!on); |
| 159 | gpio_set_value_cansleep(gpio, !!on); |
| 160 | gpio_free(gpio); |
| 161 | } |
| 162 | |
| 163 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 164 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 165 | }; |
| 166 | |
| 167 | static void __init msm7627a_init_host(void) |
| 168 | { |
| 169 | msm_add_host(0, &msm_usb_host_pdata); |
| 170 | } |
| 171 | #endif |
| 172 | |
| 173 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 174 | static int hsusb_rpc_connect(int connect) |
| 175 | { |
| 176 | if (connect) |
| 177 | return msm_hsusb_rpc_connect(); |
| 178 | else |
| 179 | return msm_hsusb_rpc_close(); |
| 180 | } |
| 181 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 182 | static struct regulator *reg_hsusb; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 183 | static int msm_hsusb_ldo_init(int init) |
| 184 | { |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 185 | int rc = 0; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 186 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 187 | if (init) { |
| 188 | reg_hsusb = regulator_get(NULL, "usb"); |
| 189 | if (IS_ERR(reg_hsusb)) { |
| 190 | rc = PTR_ERR(reg_hsusb); |
| 191 | pr_err("%s: could not get regulator: %d\n", |
| 192 | __func__, rc); |
| 193 | goto out; |
| 194 | } |
| 195 | |
| 196 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 197 | if (rc) { |
| 198 | pr_err("%s: could not set voltage: %d\n", |
| 199 | __func__, rc); |
| 200 | goto reg_free; |
| 201 | } |
| 202 | |
| 203 | return 0; |
| 204 | } |
| 205 | /* else fall through */ |
| 206 | reg_free: |
| 207 | regulator_put(reg_hsusb); |
| 208 | out: |
| 209 | reg_hsusb = NULL; |
| 210 | return rc; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | static int msm_hsusb_ldo_enable(int enable) |
| 214 | { |
| 215 | static int ldo_status; |
| 216 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 217 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 218 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 219 | |
| 220 | if (ldo_status == enable) |
| 221 | return 0; |
| 222 | |
| 223 | ldo_status = enable; |
| 224 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 225 | return enable ? |
| 226 | regulator_enable(reg_hsusb) : |
| 227 | regulator_disable(reg_hsusb); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 231 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 232 | { |
| 233 | int ret = 0; |
| 234 | |
| 235 | if (init) |
| 236 | ret = msm_pm_app_rpc_init(callback); |
| 237 | else |
| 238 | msm_pm_app_rpc_deinit(callback); |
| 239 | |
| 240 | return ret; |
| 241 | } |
| 242 | #endif |
| 243 | |
| 244 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 245 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 246 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 247 | #else |
| 248 | .vbus_power = msm_hsusb_vbus_power, |
| 249 | #endif |
| 250 | .rpc_connect = hsusb_rpc_connect, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 251 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 252 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 253 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 254 | .se1_gating = SE1_GATING_DISABLE, |
| 255 | .ldo_init = msm_hsusb_ldo_init, |
| 256 | .ldo_enable = msm_hsusb_ldo_enable, |
| 257 | .chg_init = hsusb_chg_init, |
| 258 | .chg_connected = hsusb_chg_connected, |
| 259 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 260 | }; |
| 261 | #endif |
| 262 | |
| 263 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 264 | .is_phy_status_timer_on = 1, |
| 265 | }; |
| 266 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 267 | #ifdef CONFIG_SERIAL_MSM_HS |
| 268 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 269 | .inject_rx_on_wakeup = 1, |
| 270 | .rx_to_inject = 0xFD, |
| 271 | }; |
| 272 | #endif |
| 273 | static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 274 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 275 | .idle_supported = 1, |
| 276 | .suspend_supported = 1, |
| 277 | .idle_enabled = 1, |
| 278 | .suspend_enabled = 1, |
| 279 | .latency = 16000, |
| 280 | .residency = 20000, |
| 281 | }, |
| 282 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 283 | .idle_supported = 1, |
| 284 | .suspend_supported = 1, |
| 285 | .idle_enabled = 1, |
| 286 | .suspend_enabled = 1, |
| 287 | .latency = 12000, |
| 288 | .residency = 20000, |
| 289 | }, |
| 290 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 291 | .idle_supported = 1, |
| 292 | .suspend_supported = 1, |
| 293 | .idle_enabled = 0, |
| 294 | .suspend_enabled = 1, |
| 295 | .latency = 2000, |
| 296 | .residency = 0, |
| 297 | }, |
| 298 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 299 | .idle_supported = 1, |
| 300 | .suspend_supported = 1, |
| 301 | .idle_enabled = 1, |
| 302 | .suspend_enabled = 1, |
| 303 | .latency = 2, |
| 304 | .residency = 0, |
| 305 | }, |
| 306 | }; |
| 307 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 308 | 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] | 309 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 310 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 311 | }; |
| 312 | |
Murali Nalajala | 4c996be | 2012-03-12 17:05:41 +0530 | [diff] [blame] | 313 | /* 8625 PM platform data */ |
| 314 | static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 315 | /* CORE0 entries */ |
| 316 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 317 | .idle_supported = 1, |
| 318 | .suspend_supported = 1, |
| 319 | .idle_enabled = 0, |
| 320 | .suspend_enabled = 0, |
| 321 | .latency = 16000, |
| 322 | .residency = 20000, |
| 323 | }, |
| 324 | |
| 325 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
| 326 | .idle_supported = 1, |
| 327 | .suspend_supported = 1, |
| 328 | .idle_enabled = 0, |
| 329 | .suspend_enabled = 0, |
| 330 | .latency = 12000, |
| 331 | .residency = 20000, |
| 332 | }, |
| 333 | |
| 334 | /* picked latency & redisdency values from 7x30 */ |
| 335 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 336 | .idle_supported = 1, |
| 337 | .suspend_supported = 1, |
| 338 | .idle_enabled = 0, |
| 339 | .suspend_enabled = 0, |
| 340 | .latency = 500, |
| 341 | .residency = 6000, |
| 342 | }, |
| 343 | |
| 344 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 345 | .idle_supported = 1, |
| 346 | .suspend_supported = 1, |
| 347 | .idle_enabled = 1, |
| 348 | .suspend_enabled = 1, |
| 349 | .latency = 2, |
| 350 | .residency = 10, |
| 351 | }, |
| 352 | |
| 353 | /* picked latency & redisdency values from 7x30 */ |
| 354 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 355 | .idle_supported = 1, |
| 356 | .suspend_supported = 1, |
| 357 | .idle_enabled = 0, |
| 358 | .suspend_enabled = 0, |
| 359 | .latency = 500, |
| 360 | .residency = 6000, |
| 361 | }, |
| 362 | |
| 363 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 364 | .idle_supported = 1, |
| 365 | .suspend_supported = 1, |
| 366 | .idle_enabled = 1, |
| 367 | .suspend_enabled = 1, |
| 368 | .latency = 2, |
| 369 | .residency = 10, |
| 370 | }, |
| 371 | |
| 372 | }; |
| 373 | |
| 374 | static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = { |
| 375 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 376 | .v_addr = MSM_CFG_CTL_BASE, |
| 377 | }; |
| 378 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 379 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 380 | .name = "pmem_adsp", |
| 381 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 382 | .cached = 1, |
| 383 | .memory_type = MEMTYPE_EBI1, |
| 384 | }; |
| 385 | |
| 386 | static struct platform_device android_pmem_adsp_device = { |
| 387 | .name = "android_pmem", |
| 388 | .id = 1, |
| 389 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 390 | }; |
| 391 | |
| 392 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 393 | static int __init pmem_mdp_size_setup(char *p) |
| 394 | { |
| 395 | pmem_mdp_size = memparse(p, NULL); |
| 396 | return 0; |
| 397 | } |
| 398 | |
| 399 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 400 | |
| 401 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 402 | static int __init pmem_adsp_size_setup(char *p) |
| 403 | { |
| 404 | pmem_adsp_size = memparse(p, NULL); |
| 405 | return 0; |
| 406 | } |
| 407 | |
| 408 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 409 | |
| 410 | #define SND(desc, num) { .name = #desc, .id = num } |
| 411 | static struct snd_endpoint snd_endpoints_list[] = { |
| 412 | SND(HANDSET, 0), |
| 413 | SND(MONO_HEADSET, 2), |
| 414 | SND(HEADSET, 3), |
| 415 | SND(SPEAKER, 6), |
| 416 | SND(TTY_HEADSET, 8), |
| 417 | SND(TTY_VCO, 9), |
| 418 | SND(TTY_HCO, 10), |
| 419 | SND(BT, 12), |
| 420 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 421 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 422 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 423 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 424 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
| 425 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
| 426 | SND(CURRENT, 0x7FFFFFFE), |
| 427 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 428 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 429 | }; |
| 430 | #undef SND |
| 431 | |
| 432 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 433 | .endpoints = snd_endpoints_list, |
| 434 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 435 | }; |
| 436 | |
| 437 | static struct platform_device msm_device_snd = { |
| 438 | .name = "msm_snd", |
| 439 | .id = -1, |
| 440 | .dev = { |
| 441 | .platform_data = &msm_device_snd_endpoints |
| 442 | }, |
| 443 | }; |
| 444 | |
| 445 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 446 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 447 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 448 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 449 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 450 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 451 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 452 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 453 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 454 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 455 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 456 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 457 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 458 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 459 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 460 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 461 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 462 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 463 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 464 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 465 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 466 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 467 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 468 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 469 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 470 | |
| 471 | static unsigned int dec_concurrency_table[] = { |
| 472 | /* Audio LP */ |
| 473 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 474 | 0, 0, 0, |
| 475 | |
| 476 | /* Concurrency 1 */ |
| 477 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 478 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 479 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 480 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 481 | (DEC4_FORMAT), |
| 482 | |
| 483 | /* Concurrency 2 */ |
| 484 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 485 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 486 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 487 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 488 | (DEC4_FORMAT), |
| 489 | |
| 490 | /* Concurrency 3 */ |
| 491 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 492 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 493 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 494 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 495 | (DEC4_FORMAT), |
| 496 | |
| 497 | /* Concurrency 4 */ |
| 498 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 499 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 500 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 501 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 502 | (DEC4_FORMAT), |
| 503 | |
| 504 | /* Concurrency 5 */ |
| 505 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 506 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 507 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 508 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 509 | (DEC4_FORMAT), |
| 510 | |
| 511 | /* Concurrency 6 */ |
| 512 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
Sidipotu Ashok | 4f1ddc9 | 2012-04-11 13:51:34 +0530 | [diff] [blame^] | 513 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 514 | 0, 0, 0, 0, |
| 515 | |
| 516 | /* Concurrency 7 */ |
| 517 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 518 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 519 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 520 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 521 | (DEC4_FORMAT), |
| 522 | }; |
| 523 | |
| 524 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 525 | .module_queueid = queueid, .module_decid = decid, \ |
| 526 | .nr_codec_support = nr_codec} |
| 527 | |
| 528 | static struct msm_adspdec_info dec_info_list[] = { |
| 529 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 530 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 531 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 532 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 533 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 534 | }; |
| 535 | |
| 536 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 537 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 538 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 539 | ARRAY_SIZE(dec_info_list)), |
| 540 | .dec_concurrency_table = dec_concurrency_table, |
| 541 | .dec_info_list = dec_info_list, |
| 542 | }; |
| 543 | |
| 544 | static struct platform_device msm_device_adspdec = { |
| 545 | .name = "msm_adspdec", |
| 546 | .id = -1, |
| 547 | .dev = { |
| 548 | .platform_data = &msm_device_adspdec_database |
| 549 | }, |
| 550 | }; |
| 551 | |
| 552 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 553 | .name = "pmem_audio", |
| 554 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 555 | .cached = 0, |
| 556 | .memory_type = MEMTYPE_EBI1, |
| 557 | }; |
| 558 | |
| 559 | static struct platform_device android_pmem_audio_device = { |
| 560 | .name = "android_pmem", |
| 561 | .id = 2, |
| 562 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 563 | }; |
| 564 | |
| 565 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 566 | .name = "pmem", |
| 567 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 568 | .cached = 1, |
| 569 | .memory_type = MEMTYPE_EBI1, |
| 570 | }; |
| 571 | static struct platform_device android_pmem_device = { |
| 572 | .name = "android_pmem", |
| 573 | .id = 0, |
| 574 | .dev = { .platform_data = &android_pmem_pdata }, |
| 575 | }; |
| 576 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 577 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 578 | |
| 579 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 580 | .voltage_min_design = 2800, |
| 581 | .voltage_max_design = 4300, |
| 582 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 583 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 584 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 585 | }; |
| 586 | |
| 587 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 588 | { |
| 589 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 590 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 591 | |
| 592 | return (current_voltage - low_voltage) * 100 |
| 593 | / (high_voltage - low_voltage); |
| 594 | } |
| 595 | |
| 596 | static struct platform_device msm_batt_device = { |
| 597 | .name = "msm-battery", |
| 598 | .id = -1, |
| 599 | .dev.platform_data = &msm_psy_batt_data, |
| 600 | }; |
| 601 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 602 | static struct platform_device *common_devices[] __initdata = { |
| 603 | &android_usb_device, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 604 | &android_pmem_device, |
| 605 | &android_pmem_adsp_device, |
| 606 | &android_pmem_audio_device, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 607 | &msm_batt_device, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 608 | &msm_device_adspdec, |
| 609 | &msm_device_snd, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 610 | &asoc_msm_pcm, |
| 611 | &asoc_msm_dai0, |
| 612 | &asoc_msm_dai1, |
| 613 | }; |
| 614 | |
| 615 | static struct platform_device *qrd7627a_devices[] __initdata = { |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 616 | &msm_device_dmov, |
| 617 | &msm_device_smd, |
| 618 | &msm_device_uart1, |
| 619 | &msm_device_uart_dm1, |
| 620 | &msm_gsbi0_qup_i2c_device, |
| 621 | &msm_gsbi1_qup_i2c_device, |
| 622 | &msm_device_otg, |
| 623 | &msm_device_gadget_peripheral, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 624 | &msm_kgsl_3d0, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 625 | }; |
| 626 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 627 | static struct platform_device *qrd3_devices[] __initdata = { |
| 628 | &msm_device_nand, |
| 629 | }; |
| 630 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 631 | static struct platform_device *msm8625_evb_devices[] __initdata = { |
| 632 | &msm8625_device_dmov, |
| 633 | &msm8625_device_smd, |
| 634 | &msm8625_gsbi0_qup_i2c_device, |
| 635 | &msm8625_gsbi1_qup_i2c_device, |
| 636 | &msm8625_device_uart1, |
Ram Mohan Korukonda | 5ee9fb8 | 2012-03-09 12:10:01 +0530 | [diff] [blame] | 637 | &msm8625_device_uart_dm1, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 638 | &msm8625_device_otg, |
| 639 | &msm8625_device_gadget_peripheral, |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 640 | &msm8625_kgsl_3d0, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 641 | }; |
| 642 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 643 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 644 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 645 | { |
| 646 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 647 | return 0; |
| 648 | } |
| 649 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 650 | |
| 651 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 652 | static int __init pmem_audio_size_setup(char *p) |
| 653 | { |
| 654 | pmem_audio_size = memparse(p, NULL); |
| 655 | return 0; |
| 656 | } |
| 657 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 658 | |
| 659 | static struct memtype_reserve msm7627a_reserve_table[] __initdata = { |
| 660 | [MEMTYPE_SMI] = { |
| 661 | }, |
| 662 | [MEMTYPE_EBI0] = { |
| 663 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 664 | }, |
| 665 | [MEMTYPE_EBI1] = { |
| 666 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 667 | }, |
| 668 | }; |
| 669 | |
| 670 | static void __init size_pmem_devices(void) |
| 671 | { |
| 672 | #ifdef CONFIG_ANDROID_PMEM |
| 673 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 674 | android_pmem_pdata.size = pmem_mdp_size; |
| 675 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 676 | #endif |
| 677 | } |
| 678 | |
| 679 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 680 | { |
| 681 | msm7627a_reserve_table[p->memory_type].size += p->size; |
| 682 | } |
| 683 | |
| 684 | static void __init reserve_pmem_memory(void) |
| 685 | { |
| 686 | #ifdef CONFIG_ANDROID_PMEM |
| 687 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 688 | reserve_memory_for(&android_pmem_pdata); |
| 689 | reserve_memory_for(&android_pmem_audio_pdata); |
| 690 | msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 691 | #endif |
| 692 | } |
| 693 | |
| 694 | static void __init msm7627a_calculate_reserve_sizes(void) |
| 695 | { |
| 696 | size_pmem_devices(); |
| 697 | reserve_pmem_memory(); |
| 698 | } |
| 699 | |
| 700 | static int msm7627a_paddr_to_memtype(unsigned int paddr) |
| 701 | { |
| 702 | return MEMTYPE_EBI1; |
| 703 | } |
| 704 | |
| 705 | static struct reserve_info msm7627a_reserve_info __initdata = { |
| 706 | .memtype_reserve_table = msm7627a_reserve_table, |
| 707 | .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes, |
| 708 | .paddr_to_memtype = msm7627a_paddr_to_memtype, |
| 709 | }; |
| 710 | |
| 711 | static void __init msm7627a_reserve(void) |
| 712 | { |
| 713 | reserve_info = &msm7627a_reserve_info; |
| 714 | msm_reserve(); |
| 715 | memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32); |
| 716 | } |
| 717 | |
| 718 | static void __init msm8625_reserve(void) |
| 719 | { |
| 720 | memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8); |
| 721 | msm7627a_reserve(); |
| 722 | } |
| 723 | |
| 724 | static void msmqrd_adsp_add_pdev(void) |
| 725 | { |
| 726 | int rc = 0; |
| 727 | struct rpc_board_dev *rpc_adsp_pdev; |
| 728 | |
| 729 | rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL); |
| 730 | if (rpc_adsp_pdev == NULL) { |
| 731 | pr_err("%s: Memory Allocation failure\n", __func__); |
| 732 | return; |
| 733 | } |
| 734 | rpc_adsp_pdev->prog = ADSP_RPC_PROG; |
| 735 | |
| 736 | if (cpu_is_msm8625()) |
| 737 | rpc_adsp_pdev->pdev = msm8625_device_adsp; |
| 738 | else |
| 739 | rpc_adsp_pdev->pdev = msm_adsp_device; |
| 740 | rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1); |
| 741 | if (rc < 0) { |
| 742 | pr_err("%s: return val: %d\n", __func__, rc); |
| 743 | kfree(rpc_adsp_pdev); |
| 744 | } |
| 745 | } |
| 746 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 747 | static void __init msm7627a_device_i2c_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 748 | { |
| 749 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 750 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 751 | } |
| 752 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 753 | static void __init msm8625_device_i2c_init(void) |
| 754 | { |
| 755 | msm8625_gsbi0_qup_i2c_device.dev.platform_data |
| 756 | = &msm_gsbi0_qup_i2c_pdata; |
| 757 | msm8625_gsbi1_qup_i2c_device.dev.platform_data |
| 758 | = &msm_gsbi1_qup_i2c_pdata; |
| 759 | } |
| 760 | |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 761 | static struct platform_device msm_proccomm_regulator_dev = { |
| 762 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 763 | .id = -1, |
| 764 | .dev = { |
| 765 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 766 | } |
| 767 | }; |
| 768 | |
| 769 | static void __init msm7627a_init_regulators(void) |
| 770 | { |
| 771 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 772 | if (rc) |
| 773 | pr_err("%s: could not register regulator device: %d\n", |
| 774 | __func__, rc); |
| 775 | } |
| 776 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 777 | static int __init msm_qrd_init_ar6000pm(void) |
| 778 | { |
| 779 | msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power; |
| 780 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 781 | } |
| 782 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 783 | static void __init msm_add_footswitch_devices(void) |
| 784 | { |
| 785 | platform_add_devices(msm_footswitch_devices, |
| 786 | msm_num_footswitch_devices); |
| 787 | } |
| 788 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 789 | static void add_platform_devices(void) |
| 790 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 791 | if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()) { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 792 | platform_add_devices(msm8625_evb_devices, |
| 793 | ARRAY_SIZE(msm8625_evb_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 794 | platform_add_devices(qrd3_devices, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 795 | ARRAY_SIZE(qrd3_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 796 | } else { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 797 | platform_add_devices(qrd7627a_devices, |
| 798 | ARRAY_SIZE(qrd7627a_devices)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 799 | } |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 800 | |
Aparna Mallavarapu | 0b69ca2 | 2012-03-26 15:58:35 +0530 | [diff] [blame] | 801 | if (machine_is_msm7627a_qrd3() || machine_is_msm7627a_evb()) |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 802 | platform_add_devices(qrd3_devices, |
Aparna Mallavarapu | 0b69ca2 | 2012-03-26 15:58:35 +0530 | [diff] [blame] | 803 | ARRAY_SIZE(qrd3_devices)); |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 804 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 805 | platform_add_devices(common_devices, |
| 806 | ARRAY_SIZE(common_devices)); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 807 | } |
| 808 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 809 | #define UART1DM_RX_GPIO 45 |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 810 | static void __init qrd7627a_uart1dm_config(void) |
| 811 | { |
| 812 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 813 | if (cpu_is_msm8625()) |
| 814 | msm8625_device_uart_dm1.dev.platform_data = |
| 815 | &msm_uart_dm1_pdata; |
| 816 | else |
| 817 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 818 | } |
| 819 | |
| 820 | static void __init qrd7627a_otg_gadget(void) |
| 821 | { |
| 822 | msm_otg_pdata.swfi_latency = msm7627a_pm_data |
| 823 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 824 | |
| 825 | if (cpu_is_msm8625()) { |
| 826 | msm8625_device_otg.dev.platform_data = &msm_otg_pdata; |
| 827 | msm8625_device_gadget_peripheral.dev.platform_data = |
| 828 | &msm_gadget_pdata; |
| 829 | |
| 830 | } else { |
| 831 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 832 | msm_device_gadget_peripheral.dev.platform_data = |
| 833 | &msm_gadget_pdata; |
| 834 | } |
| 835 | } |
| 836 | |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 837 | static void __init msm_pm_init(void) |
| 838 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 839 | |
Aparna Mallavarapu | 6d969eb | 2012-04-03 15:10:25 +0530 | [diff] [blame] | 840 | if (!cpu_is_msm8625()) { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 841 | msm_pm_set_platform_data(msm7627a_pm_data, |
| 842 | ARRAY_SIZE(msm7627a_pm_data)); |
| 843 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
| 844 | } else { |
| 845 | msm_pm_set_platform_data(msm8625_pm_data, |
| 846 | ARRAY_SIZE(msm8625_pm_data)); |
| 847 | BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata)); |
| 848 | msm8x25_spm_device_init(); |
| 849 | } |
| 850 | } |
| 851 | |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 852 | static void __init msm_qrd_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 853 | { |
| 854 | msm7x2x_misc_init(); |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 855 | msm7627a_init_regulators(); |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 856 | msmqrd_adsp_add_pdev(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 857 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 858 | if (cpu_is_msm8625()) |
| 859 | msm8625_device_i2c_init(); |
| 860 | else |
| 861 | msm7627a_device_i2c_init(); |
| 862 | |
| 863 | /* uart1dm*/ |
| 864 | qrd7627a_uart1dm_config(); |
| 865 | /*OTG gadget*/ |
| 866 | qrd7627a_otg_gadget(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 867 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 868 | msm_add_footswitch_devices(); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 869 | add_platform_devices(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 870 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 871 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 872 | msm_qrd_init_ar6000pm(); |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 873 | msm7627a_init_mmc(); |
| 874 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 875 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 876 | msm7627a_init_host(); |
| 877 | #endif |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 878 | msm_pm_init(); |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 879 | |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 880 | msm_pm_register_irqs(); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 881 | msm_fb_add_devices(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 882 | |
| 883 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
Chintan Pandya | 13490c0 | 2011-12-20 13:03:36 +0530 | [diff] [blame] | 884 | msm7627a_bt_power_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 885 | #endif |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 886 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 887 | msm7627a_camera_init(); |
Chintan Pandya | 0d45319 | 2012-03-09 13:20:33 +0530 | [diff] [blame] | 888 | qrd7627a_add_io_devices(); |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 889 | msm7x25a_kgsl_3d0_init(); |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 890 | msm8x25_kgsl_3d0_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 891 | } |
| 892 | |
| 893 | static void __init qrd7627a_init_early(void) |
| 894 | { |
| 895 | msm_msm7627a_allocate_memory_regions(); |
| 896 | } |
| 897 | |
| 898 | MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1") |
| 899 | .boot_params = PHYS_OFFSET + 0x100, |
| 900 | .map_io = msm_common_io_init, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 901 | .reserve = msm7627a_reserve, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 902 | .init_irq = msm_init_irq, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 903 | .init_machine = msm_qrd_init, |
| 904 | .timer = &msm_timer, |
| 905 | .init_early = qrd7627a_init_early, |
| 906 | .handle_irq = vic_handle_irq, |
| 907 | MACHINE_END |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 908 | MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3") |
| 909 | .boot_params = PHYS_OFFSET + 0x100, |
| 910 | .map_io = msm_common_io_init, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 911 | .reserve = msm7627a_reserve, |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 912 | .init_irq = msm_init_irq, |
| 913 | .init_machine = msm_qrd_init, |
| 914 | .timer = &msm_timer, |
| 915 | .init_early = qrd7627a_init_early, |
| 916 | .handle_irq = vic_handle_irq, |
| 917 | MACHINE_END |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 918 | MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB") |
| 919 | .boot_params = PHYS_OFFSET + 0x100, |
| 920 | .map_io = msm_common_io_init, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 921 | .reserve = msm7627a_reserve, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 922 | .init_irq = msm_init_irq, |
| 923 | .init_machine = msm_qrd_init, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 924 | .timer = &msm_timer, |
| 925 | .init_early = qrd7627a_init_early, |
Pankaj Kumar | bf8a2a3 | 2011-10-21 11:47:21 +0530 | [diff] [blame] | 926 | .handle_irq = vic_handle_irq, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 927 | MACHINE_END |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 928 | MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB") |
| 929 | .boot_params = PHYS_OFFSET + 0x100, |
| 930 | .map_io = msm8625_map_io, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 931 | .reserve = msm8625_reserve, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 932 | .init_irq = msm8625_init_irq, |
| 933 | .init_machine = msm_qrd_init, |
| 934 | .timer = &msm_timer, |
| 935 | .init_early = qrd7627a_init_early, |
| 936 | .handle_irq = gic_handle_irq, |
| 937 | MACHINE_END |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 938 | MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7") |
| 939 | .boot_params = PHYS_OFFSET + 0x100, |
| 940 | .map_io = msm8625_map_io, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 941 | .reserve = msm8625_reserve, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 942 | .init_irq = msm8625_init_irq, |
| 943 | .init_machine = msm_qrd_init, |
| 944 | .timer = &msm_timer, |
| 945 | .init_early = qrd7627a_init_early, |
| 946 | .handle_irq = gic_handle_irq, |
| 947 | MACHINE_END |