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