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> |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 27 | #include <linux/input/rmi_platformdata.h> |
| 28 | #include <linux/input/rmi_i2c.h> |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 29 | #include <linux/regulator/consumer.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 30 | #include <asm/mach/mmc.h> |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | #include <mach/board.h> |
| 34 | #include <mach/msm_iomap.h> |
| 35 | #include <mach/msm_hsusb.h> |
| 36 | #include <mach/rpc_hsusb.h> |
| 37 | #include <mach/rpc_pmapp.h> |
| 38 | #include <mach/usbdiag.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 39 | #include <mach/msm_memtypes.h> |
| 40 | #include <mach/msm_serial_hs.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 41 | #include <mach/pmic.h> |
| 42 | #include <mach/socinfo.h> |
| 43 | #include <mach/vreg.h> |
| 44 | #include <mach/rpc_pmapp.h> |
| 45 | #include <mach/msm_battery.h> |
| 46 | #include <mach/rpc_server_handset.h> |
| 47 | #include <mach/socinfo.h> |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 48 | #include "board-msm7x27a-regulator.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 49 | #include "devices.h" |
| 50 | #include "devices-msm7x2xa.h" |
| 51 | #include "pm.h" |
| 52 | #include "timer.h" |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 53 | #include "pm-boot.h" |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 54 | #include "board-msm7x27a-regulator.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 55 | #include "board-msm7627a.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 56 | |
| 57 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
| 58 | #define MSM_PMEM_AUDIO_SIZE 0x5B000 |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 59 | #define BAHAMA_SLAVE_ID_FM_REG 0x02 |
| 60 | #define FM_GPIO 83 |
Rahul Kashyap | 8b4a786 | 2011-12-13 18:40:54 +0530 | [diff] [blame] | 61 | #define BT_PCM_BCLK_MODE 0x88 |
| 62 | #define BT_PCM_DIN_MODE 0x89 |
| 63 | #define BT_PCM_DOUT_MODE 0x8A |
| 64 | #define BT_PCM_SYNC_MODE 0x8B |
| 65 | #define FM_I2S_SD_MODE 0x8E |
| 66 | #define FM_I2S_WS_MODE 0x8F |
| 67 | #define FM_I2S_SCK_MODE 0x90 |
| 68 | #define I2C_PIN_CTL 0x15 |
| 69 | #define I2C_NORMAL 0x40 |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 70 | |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 71 | enum { |
| 72 | GPIO_HOST_VBUS_EN = 107, |
| 73 | GPIO_BT_SYS_REST_EN = 114, |
| 74 | GPIO_WAKE_ON_WIRELESS, |
| 75 | GPIO_BACKLIGHT_EN, |
| 76 | GPIO_NC, |
| 77 | GPIO_CAM_3MP_PWDN, /* CAM_VGA */ |
| 78 | GPIO_WLAN_EN, |
| 79 | GPIO_CAM_5MP_SHDN_EN, |
| 80 | GPIO_CAM_5MP_RESET, |
| 81 | GPIO_TP, |
| 82 | GPIO_CAM_GP_CAMIF_RESET, |
| 83 | }; |
| 84 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 85 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 86 | .name = "wlan_ar6000_pm_dev", |
| 87 | .id = -1, |
| 88 | }; |
| 89 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 90 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 91 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 92 | "qup_scl" }, |
| 93 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 94 | "qup_sda" }, |
| 95 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 96 | "qup_scl" }, |
| 97 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 98 | "qup_sda" }, |
| 99 | }; |
| 100 | |
| 101 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 102 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 103 | "qup_scl" }, |
| 104 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 105 | "qup_sda" }, |
| 106 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 107 | "qup_scl" }, |
| 108 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 109 | "qup_sda" }, |
| 110 | }; |
| 111 | |
| 112 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 113 | { |
| 114 | int rc; |
| 115 | |
| 116 | if (adap_id < 0 || adap_id > 1) |
| 117 | return; |
| 118 | |
| 119 | /* Each adapter gets 2 lines from the table */ |
| 120 | if (config_type) |
| 121 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 122 | else |
| 123 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 124 | if (rc < 0) |
| 125 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 126 | } |
| 127 | |
| 128 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 129 | .clk_freq = 100000, |
| 130 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 131 | }; |
| 132 | |
| 133 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 134 | .clk_freq = 100000, |
| 135 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 136 | }; |
| 137 | |
| 138 | #ifdef CONFIG_ARCH_MSM7X27A |
| 139 | #define MSM_PMEM_MDP_SIZE 0x1DD1000 |
| 140 | #define MSM_PMEM_ADSP_SIZE 0x1000000 |
| 141 | |
| 142 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
| 143 | #define MSM_FB_SIZE 0x260000 |
| 144 | #else |
| 145 | #define MSM_FB_SIZE 0x195000 |
| 146 | #endif |
| 147 | |
| 148 | #endif |
| 149 | |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 150 | #if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \ |
| 151 | defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE) |
| 152 | |
| 153 | #ifndef CLEARPAD3000_ATTEN_GPIO |
| 154 | #define CLEARPAD3000_ATTEN_GPIO (48) |
| 155 | #endif |
| 156 | |
| 157 | #ifndef CLEARPAD3000_RESET_GPIO |
| 158 | #define CLEARPAD3000_RESET_GPIO (26) |
| 159 | #endif |
| 160 | |
| 161 | static int synaptics_touchpad_setup(void); |
| 162 | |
| 163 | static struct msm_gpio clearpad3000_cfg_data[] = { |
| 164 | {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT, |
| 165 | GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"}, |
| 166 | {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT, |
| 167 | GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"}, |
| 168 | }; |
| 169 | |
| 170 | static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0}; |
| 171 | static struct rmi_range rmi_clipx = {.min = 48, .max = 980}; |
| 172 | static struct rmi_range rmi_clipy = {.min = 7, .max = 1647}; |
| 173 | static struct rmi_f11_functiondata synaptics_f11_data = { |
| 174 | .swap_axes = false, |
| 175 | .flipX = false, |
| 176 | .flipY = false, |
| 177 | .offset = &rmi_offset, |
| 178 | .button_height = 113, |
| 179 | .clipX = &rmi_clipx, |
| 180 | .clipY = &rmi_clipy, |
| 181 | }; |
| 182 | |
| 183 | #define MAX_LEN 100 |
| 184 | |
| 185 | static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj, |
| 186 | struct kobj_attribute *attr, char *buf) |
| 187 | { |
| 188 | char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \ |
| 189 | ":60:830:120:60" ":" __stringify(EV_KEY) \ |
| 190 | ":" __stringify(KEY_HOME) ":180:830:120:60" \ |
| 191 | ":" __stringify(EV_KEY) ":" \ |
| 192 | __stringify(KEY_SEARCH) ":300:830:120:60" \ |
| 193 | ":" __stringify(EV_KEY) ":" \ |
| 194 | __stringify(KEY_BACK) ":420:830:120:60" "\n"; |
| 195 | |
| 196 | return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s", |
| 197 | virtual_keys); |
| 198 | } |
| 199 | |
| 200 | static struct kobj_attribute clearpad3000_virtual_keys_attr = { |
| 201 | .attr = { |
| 202 | .name = "virtualkeys.sensor00fn11", |
| 203 | .mode = S_IRUGO, |
| 204 | }, |
| 205 | .show = &clearpad3000_virtual_keys_register, |
| 206 | }; |
| 207 | |
| 208 | static struct attribute *virtual_key_properties_attrs[] = { |
| 209 | &clearpad3000_virtual_keys_attr.attr, |
| 210 | NULL |
| 211 | }; |
| 212 | |
| 213 | static struct attribute_group virtual_key_properties_attr_group = { |
| 214 | .attrs = virtual_key_properties_attrs, |
| 215 | }; |
| 216 | |
| 217 | struct kobject *virtual_key_properties_kobj; |
| 218 | |
| 219 | static struct rmi_functiondata synaptics_functiondata[] = { |
| 220 | { |
| 221 | .function_index = RMI_F11_INDEX, |
| 222 | .data = &synaptics_f11_data, |
| 223 | }, |
| 224 | }; |
| 225 | |
| 226 | static struct rmi_functiondata_list synaptics_perfunctiondata = { |
| 227 | .count = ARRAY_SIZE(synaptics_functiondata), |
| 228 | .functiondata = synaptics_functiondata, |
| 229 | }; |
| 230 | |
| 231 | static struct rmi_sensordata synaptics_sensordata = { |
| 232 | .perfunctiondata = &synaptics_perfunctiondata, |
| 233 | .rmi_sensor_setup = synaptics_touchpad_setup, |
| 234 | }; |
| 235 | |
| 236 | static struct rmi_i2c_platformdata synaptics_platformdata = { |
| 237 | .i2c_address = 0x2c, |
| 238 | .irq_type = IORESOURCE_IRQ_LOWLEVEL, |
| 239 | .sensordata = &synaptics_sensordata, |
| 240 | }; |
| 241 | |
| 242 | static struct i2c_board_info synaptic_i2c_clearpad3k[] = { |
| 243 | { |
| 244 | I2C_BOARD_INFO("rmi4_ts", 0x2c), |
| 245 | .platform_data = &synaptics_platformdata, |
| 246 | }, |
| 247 | }; |
| 248 | |
| 249 | static int synaptics_touchpad_setup(void) |
| 250 | { |
| 251 | int retval = 0; |
| 252 | |
| 253 | virtual_key_properties_kobj = |
| 254 | kobject_create_and_add("board_properties", NULL); |
| 255 | if (virtual_key_properties_kobj) |
| 256 | retval = sysfs_create_group(virtual_key_properties_kobj, |
| 257 | &virtual_key_properties_attr_group); |
| 258 | if (!virtual_key_properties_kobj || retval) |
| 259 | pr_err("failed to create ft5202 board_properties\n"); |
| 260 | |
| 261 | retval = msm_gpios_request_enable(clearpad3000_cfg_data, |
| 262 | sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio)); |
| 263 | if (retval) { |
| 264 | pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.", |
| 265 | __func__, CLEARPAD3000_ATTEN_GPIO, retval); |
| 266 | retval = 0; /* ignore the err */ |
| 267 | } |
| 268 | synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO); |
| 269 | |
| 270 | gpio_set_value(CLEARPAD3000_RESET_GPIO, 0); |
| 271 | usleep(10000); |
| 272 | gpio_set_value(CLEARPAD3000_RESET_GPIO, 1); |
| 273 | usleep(50000); |
| 274 | |
| 275 | return retval; |
| 276 | } |
| 277 | #endif |
| 278 | |
| 279 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 280 | static struct android_usb_platform_data android_usb_pdata = { |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 281 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 282 | }; |
| 283 | |
| 284 | static struct platform_device android_usb_device = { |
| 285 | .name = "android_usb", |
| 286 | .id = -1, |
| 287 | .dev = { |
| 288 | .platform_data = &android_usb_pdata, |
| 289 | }, |
| 290 | }; |
| 291 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 292 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 293 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 294 | { |
| 295 | int rc = 0; |
| 296 | unsigned gpio; |
| 297 | |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 298 | gpio = GPIO_HOST_VBUS_EN; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 299 | |
| 300 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 301 | if (rc < 0) { |
| 302 | pr_err("failed to request %d GPIO\n", gpio); |
| 303 | return; |
| 304 | } |
| 305 | gpio_direction_output(gpio, !!on); |
| 306 | gpio_set_value_cansleep(gpio, !!on); |
| 307 | gpio_free(gpio); |
| 308 | } |
| 309 | |
| 310 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 311 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 312 | }; |
| 313 | |
| 314 | static void __init msm7627a_init_host(void) |
| 315 | { |
| 316 | msm_add_host(0, &msm_usb_host_pdata); |
| 317 | } |
| 318 | #endif |
| 319 | |
| 320 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 321 | static int hsusb_rpc_connect(int connect) |
| 322 | { |
| 323 | if (connect) |
| 324 | return msm_hsusb_rpc_connect(); |
| 325 | else |
| 326 | return msm_hsusb_rpc_close(); |
| 327 | } |
| 328 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 329 | static struct regulator *reg_hsusb; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 330 | static int msm_hsusb_ldo_init(int init) |
| 331 | { |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 332 | int rc = 0; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 333 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 334 | if (init) { |
| 335 | reg_hsusb = regulator_get(NULL, "usb"); |
| 336 | if (IS_ERR(reg_hsusb)) { |
| 337 | rc = PTR_ERR(reg_hsusb); |
| 338 | pr_err("%s: could not get regulator: %d\n", |
| 339 | __func__, rc); |
| 340 | goto out; |
| 341 | } |
| 342 | |
| 343 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 344 | if (rc) { |
| 345 | pr_err("%s: could not set voltage: %d\n", |
| 346 | __func__, rc); |
| 347 | goto reg_free; |
| 348 | } |
| 349 | |
| 350 | return 0; |
| 351 | } |
| 352 | /* else fall through */ |
| 353 | reg_free: |
| 354 | regulator_put(reg_hsusb); |
| 355 | out: |
| 356 | reg_hsusb = NULL; |
| 357 | return rc; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | static int msm_hsusb_ldo_enable(int enable) |
| 361 | { |
| 362 | static int ldo_status; |
| 363 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 364 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 365 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 366 | |
| 367 | if (ldo_status == enable) |
| 368 | return 0; |
| 369 | |
| 370 | ldo_status = enable; |
| 371 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 372 | return enable ? |
| 373 | regulator_enable(reg_hsusb) : |
| 374 | regulator_disable(reg_hsusb); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 378 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 379 | { |
| 380 | int ret = 0; |
| 381 | |
| 382 | if (init) |
| 383 | ret = msm_pm_app_rpc_init(callback); |
| 384 | else |
| 385 | msm_pm_app_rpc_deinit(callback); |
| 386 | |
| 387 | return ret; |
| 388 | } |
| 389 | #endif |
| 390 | |
| 391 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 392 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 393 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 394 | #else |
| 395 | .vbus_power = msm_hsusb_vbus_power, |
| 396 | #endif |
| 397 | .rpc_connect = hsusb_rpc_connect, |
| 398 | .core_clk = 1, |
| 399 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 400 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 401 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 402 | .se1_gating = SE1_GATING_DISABLE, |
| 403 | .ldo_init = msm_hsusb_ldo_init, |
| 404 | .ldo_enable = msm_hsusb_ldo_enable, |
| 405 | .chg_init = hsusb_chg_init, |
| 406 | .chg_connected = hsusb_chg_connected, |
| 407 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 408 | }; |
| 409 | #endif |
| 410 | |
| 411 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 412 | .is_phy_status_timer_on = 1, |
| 413 | }; |
| 414 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 415 | #ifdef CONFIG_SERIAL_MSM_HS |
| 416 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 417 | .inject_rx_on_wakeup = 1, |
| 418 | .rx_to_inject = 0xFD, |
| 419 | }; |
| 420 | #endif |
| 421 | static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 422 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 423 | .idle_supported = 1, |
| 424 | .suspend_supported = 1, |
| 425 | .idle_enabled = 1, |
| 426 | .suspend_enabled = 1, |
| 427 | .latency = 16000, |
| 428 | .residency = 20000, |
| 429 | }, |
| 430 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 431 | .idle_supported = 1, |
| 432 | .suspend_supported = 1, |
| 433 | .idle_enabled = 1, |
| 434 | .suspend_enabled = 1, |
| 435 | .latency = 12000, |
| 436 | .residency = 20000, |
| 437 | }, |
| 438 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 439 | .idle_supported = 1, |
| 440 | .suspend_supported = 1, |
| 441 | .idle_enabled = 0, |
| 442 | .suspend_enabled = 1, |
| 443 | .latency = 2000, |
| 444 | .residency = 0, |
| 445 | }, |
| 446 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 447 | .idle_supported = 1, |
| 448 | .suspend_supported = 1, |
| 449 | .idle_enabled = 1, |
| 450 | .suspend_enabled = 1, |
| 451 | .latency = 2, |
| 452 | .residency = 0, |
| 453 | }, |
| 454 | }; |
| 455 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 456 | 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] | 457 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 458 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 459 | }; |
| 460 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 461 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 462 | .name = "pmem_adsp", |
| 463 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 464 | .cached = 1, |
| 465 | .memory_type = MEMTYPE_EBI1, |
| 466 | }; |
| 467 | |
| 468 | static struct platform_device android_pmem_adsp_device = { |
| 469 | .name = "android_pmem", |
| 470 | .id = 1, |
| 471 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 472 | }; |
| 473 | |
| 474 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 475 | static int __init pmem_mdp_size_setup(char *p) |
| 476 | { |
| 477 | pmem_mdp_size = memparse(p, NULL); |
| 478 | return 0; |
| 479 | } |
| 480 | |
| 481 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 482 | |
| 483 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 484 | static int __init pmem_adsp_size_setup(char *p) |
| 485 | { |
| 486 | pmem_adsp_size = memparse(p, NULL); |
| 487 | return 0; |
| 488 | } |
| 489 | |
| 490 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 491 | |
| 492 | static unsigned fb_size = MSM_FB_SIZE; |
| 493 | static int __init fb_size_setup(char *p) |
| 494 | { |
| 495 | fb_size = memparse(p, NULL); |
| 496 | return 0; |
| 497 | } |
| 498 | |
| 499 | early_param("fb_size", fb_size_setup); |
| 500 | |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 501 | static struct resource msm_fb_resources[] = { |
| 502 | { |
| 503 | .flags = IORESOURCE_DMA, |
| 504 | } |
| 505 | }; |
| 506 | |
| 507 | static int msm_fb_detect_panel(const char *name) |
| 508 | { |
| 509 | int ret; |
| 510 | |
| 511 | if (!strncmp(name, "mipi_video_truly_wvga", 21)) |
| 512 | ret = 0; |
| 513 | else |
| 514 | ret = -ENODEV; |
| 515 | |
| 516 | return ret; |
| 517 | } |
| 518 | |
| 519 | static int mipi_truly_set_bl(int on) |
| 520 | { |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 521 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 522 | |
| 523 | return 1; |
| 524 | } |
| 525 | |
| 526 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 527 | .detect_client = msm_fb_detect_panel, |
| 528 | }; |
| 529 | |
| 530 | static struct platform_device msm_fb_device = { |
| 531 | .name = "msm_fb", |
| 532 | .id = 0, |
| 533 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 534 | .resource = msm_fb_resources, |
| 535 | .dev = { |
| 536 | .platform_data = &msm_fb_pdata, |
| 537 | } |
| 538 | }; |
| 539 | |
| 540 | static struct msm_panel_common_pdata mipi_truly_pdata = { |
| 541 | .pmic_backlight = mipi_truly_set_bl, |
| 542 | }; |
| 543 | |
| 544 | static struct platform_device mipi_dsi_truly_panel_device = { |
| 545 | .name = "mipi_truly", |
| 546 | .id = 0, |
| 547 | .dev = { |
| 548 | .platform_data = &mipi_truly_pdata, |
| 549 | } |
| 550 | }; |
| 551 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 552 | #define SND(desc, num) { .name = #desc, .id = num } |
| 553 | static struct snd_endpoint snd_endpoints_list[] = { |
| 554 | SND(HANDSET, 0), |
| 555 | SND(MONO_HEADSET, 2), |
| 556 | SND(HEADSET, 3), |
| 557 | SND(SPEAKER, 6), |
| 558 | SND(TTY_HEADSET, 8), |
| 559 | SND(TTY_VCO, 9), |
| 560 | SND(TTY_HCO, 10), |
| 561 | SND(BT, 12), |
| 562 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 563 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 564 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 565 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 566 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
Shashi Kumar | 64e0760 | 2011-10-11 13:18:57 +0530 | [diff] [blame] | 567 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
Phani Kumar Allada | d697125 | 2011-10-19 10:50:15 +0530 | [diff] [blame] | 568 | SND(CURRENT, 0x7FFFFFFE), |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 569 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 570 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 571 | }; |
| 572 | #undef SND |
| 573 | |
| 574 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 575 | .endpoints = snd_endpoints_list, |
| 576 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 577 | }; |
| 578 | |
| 579 | static struct platform_device msm_device_snd = { |
| 580 | .name = "msm_snd", |
| 581 | .id = -1, |
| 582 | .dev = { |
| 583 | .platform_data = &msm_device_snd_endpoints |
| 584 | }, |
| 585 | }; |
| 586 | |
| 587 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 588 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 589 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 590 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 591 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 592 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 593 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 594 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 595 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 596 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 597 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 598 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 599 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 600 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 601 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 602 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 603 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 604 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 605 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 606 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 607 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 608 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 609 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 610 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 611 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 612 | |
| 613 | static unsigned int dec_concurrency_table[] = { |
| 614 | /* Audio LP */ |
| 615 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 616 | 0, 0, 0, |
| 617 | |
| 618 | /* Concurrency 1 */ |
| 619 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 620 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 621 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 622 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 623 | (DEC4_FORMAT), |
| 624 | |
| 625 | /* Concurrency 2 */ |
| 626 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 627 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 628 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 629 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 630 | (DEC4_FORMAT), |
| 631 | |
| 632 | /* Concurrency 3 */ |
| 633 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 634 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 635 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 636 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 637 | (DEC4_FORMAT), |
| 638 | |
| 639 | /* Concurrency 4 */ |
| 640 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 641 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 642 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 643 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 644 | (DEC4_FORMAT), |
| 645 | |
| 646 | /* Concurrency 5 */ |
| 647 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 648 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 649 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 650 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 651 | (DEC4_FORMAT), |
| 652 | |
| 653 | /* Concurrency 6 */ |
| 654 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 655 | 0, 0, 0, 0, |
| 656 | |
| 657 | /* Concurrency 7 */ |
| 658 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 659 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 660 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 661 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 662 | (DEC4_FORMAT), |
| 663 | }; |
| 664 | |
| 665 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 666 | .module_queueid = queueid, .module_decid = decid, \ |
| 667 | .nr_codec_support = nr_codec} |
| 668 | |
| 669 | static struct msm_adspdec_info dec_info_list[] = { |
| 670 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 671 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 672 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 673 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 674 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 675 | }; |
| 676 | |
| 677 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 678 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 679 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 680 | ARRAY_SIZE(dec_info_list)), |
| 681 | .dec_concurrency_table = dec_concurrency_table, |
| 682 | .dec_info_list = dec_info_list, |
| 683 | }; |
| 684 | |
| 685 | static struct platform_device msm_device_adspdec = { |
| 686 | .name = "msm_adspdec", |
| 687 | .id = -1, |
| 688 | .dev = { |
| 689 | .platform_data = &msm_device_adspdec_database |
| 690 | }, |
| 691 | }; |
| 692 | |
| 693 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 694 | .name = "pmem_audio", |
| 695 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 696 | .cached = 0, |
| 697 | .memory_type = MEMTYPE_EBI1, |
| 698 | }; |
| 699 | |
| 700 | static struct platform_device android_pmem_audio_device = { |
| 701 | .name = "android_pmem", |
| 702 | .id = 2, |
| 703 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 704 | }; |
| 705 | |
| 706 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 707 | .name = "pmem", |
| 708 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 709 | .cached = 1, |
| 710 | .memory_type = MEMTYPE_EBI1, |
| 711 | }; |
| 712 | static struct platform_device android_pmem_device = { |
| 713 | .name = "android_pmem", |
| 714 | .id = 0, |
| 715 | .dev = { .platform_data = &android_pmem_pdata }, |
| 716 | }; |
| 717 | |
| 718 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 719 | |
| 720 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 721 | .voltage_min_design = 2800, |
| 722 | .voltage_max_design = 4300, |
| 723 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 724 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 725 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 726 | }; |
| 727 | |
| 728 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 729 | { |
| 730 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 731 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 732 | |
| 733 | return (current_voltage - low_voltage) * 100 |
| 734 | / (high_voltage - low_voltage); |
| 735 | } |
| 736 | |
| 737 | static struct platform_device msm_batt_device = { |
| 738 | .name = "msm-battery", |
| 739 | .id = -1, |
| 740 | .dev.platform_data = &msm_psy_batt_data, |
| 741 | }; |
| 742 | |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 743 | #ifdef CONFIG_MSM_CAMERA |
| 744 | static uint32_t camera_off_gpio_table[] = { |
| 745 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 746 | }; |
| 747 | |
| 748 | static uint32_t camera_on_gpio_table[] = { |
| 749 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 750 | }; |
| 751 | |
| 752 | static void qrd1_camera_gpio_cfg(void) |
| 753 | { |
| 754 | |
| 755 | int rc = 0; |
| 756 | |
| 757 | rc = gpio_request(GPIO_CAM_5MP_SHDN_EN, "ov5640"); |
| 758 | if (rc < 0) |
| 759 | pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!", |
| 760 | __func__); |
| 761 | |
| 762 | |
| 763 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_SHDN_EN, 0, |
| 764 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 765 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 766 | if (rc < 0) { |
| 767 | pr_err("%s: unable to enable Power Down gpio for main" |
| 768 | "camera!\n", __func__); |
| 769 | gpio_free(GPIO_CAM_5MP_SHDN_EN); |
| 770 | } |
| 771 | |
| 772 | |
| 773 | rc = gpio_request(GPIO_CAM_5MP_RESET, "ov5640"); |
| 774 | if (rc < 0) { |
| 775 | pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!", |
| 776 | __func__); |
| 777 | gpio_free(GPIO_CAM_5MP_SHDN_EN); |
| 778 | } |
| 779 | |
| 780 | |
| 781 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_RESET, 0, |
| 782 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 783 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 784 | if (rc < 0) { |
| 785 | pr_err("%s: unable to enable reset gpio for main camera!\n", |
| 786 | __func__); |
| 787 | gpio_free(GPIO_CAM_5MP_RESET); |
| 788 | } |
| 789 | |
| 790 | rc = gpio_request(GPIO_CAM_3MP_PWDN, "ov7692"); |
| 791 | if (rc < 0) |
| 792 | pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!", |
| 793 | __func__); |
| 794 | |
| 795 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_3MP_PWDN, 0, |
| 796 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 797 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 798 | if (rc < 0) { |
| 799 | pr_err("%s: unable to enable Power Down gpio for front" |
| 800 | "camera!\n", __func__); |
| 801 | gpio_free(GPIO_CAM_3MP_PWDN); |
| 802 | } |
| 803 | |
| 804 | gpio_direction_output(GPIO_CAM_5MP_SHDN_EN, 1); |
| 805 | gpio_direction_output(GPIO_CAM_5MP_RESET, 1); |
| 806 | gpio_direction_output(GPIO_CAM_3MP_PWDN, 1); |
| 807 | } |
| 808 | |
| 809 | #endif |
| 810 | static struct regulator_bulk_data regs_camera[] = { |
| 811 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
| 812 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 813 | { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 }, |
| 814 | }; |
| 815 | |
| 816 | static void __init msm_camera_vreg_init(void) |
| 817 | { |
| 818 | int rc; |
| 819 | |
| 820 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera); |
| 821 | if (rc) { |
| 822 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 823 | return; |
| 824 | } |
| 825 | |
| 826 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera); |
| 827 | if (rc) { |
| 828 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 829 | return; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | static void msm_camera_vreg_config(int vreg_en) |
| 834 | { |
| 835 | int rc = vreg_en ? |
| 836 | regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) : |
| 837 | regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera); |
| 838 | |
| 839 | if (rc) |
| 840 | pr_err("%s: could not %sable regulators: %d\n", |
| 841 | __func__, vreg_en ? "en" : "dis", rc); |
| 842 | } |
| 843 | static int config_gpio_table(uint32_t *table, int len) |
| 844 | { |
| 845 | int rc = 0, i = 0; |
| 846 | |
| 847 | for (i = 0; i < len; i++) { |
| 848 | rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE); |
| 849 | if (rc) { |
| 850 | pr_err("%s not able to get gpio\n", __func__); |
| 851 | for (i--; i >= 0; i--) |
| 852 | gpio_tlmm_config(camera_off_gpio_table[i], |
| 853 | GPIO_CFG_ENABLE); |
| 854 | break; |
| 855 | } |
| 856 | } |
| 857 | return rc; |
| 858 | } |
| 859 | |
| 860 | static int config_camera_on_gpios_rear(void) |
| 861 | { |
| 862 | int rc = 0; |
| 863 | |
| 864 | msm_camera_vreg_config(1); |
| 865 | |
| 866 | rc = config_gpio_table(camera_on_gpio_table, |
| 867 | ARRAY_SIZE(camera_on_gpio_table)); |
| 868 | if (rc < 0) { |
| 869 | pr_err("%s: CAMSENSOR gpio table request" |
| 870 | "failed\n", __func__); |
| 871 | return rc; |
| 872 | } |
| 873 | |
| 874 | return rc; |
| 875 | } |
| 876 | |
| 877 | static void config_camera_off_gpios_rear(void) |
| 878 | { |
| 879 | msm_camera_vreg_config(0); |
| 880 | config_gpio_table(camera_off_gpio_table, |
| 881 | ARRAY_SIZE(camera_off_gpio_table)); |
| 882 | } |
| 883 | |
| 884 | static int config_camera_on_gpios_front(void) |
| 885 | { |
| 886 | int rc = 0; |
| 887 | |
| 888 | msm_camera_vreg_config(1); |
| 889 | |
| 890 | rc = config_gpio_table(camera_on_gpio_table, |
| 891 | ARRAY_SIZE(camera_on_gpio_table)); |
| 892 | if (rc < 0) { |
| 893 | pr_err("%s: CAMSENSOR gpio table request" |
| 894 | "failed\n", __func__); |
| 895 | return rc; |
| 896 | } |
| 897 | |
| 898 | return rc; |
| 899 | } |
| 900 | |
| 901 | static void config_camera_off_gpios_front(void) |
| 902 | { |
| 903 | msm_camera_vreg_config(0); |
| 904 | |
| 905 | config_gpio_table(camera_off_gpio_table, |
| 906 | ARRAY_SIZE(camera_off_gpio_table)); |
| 907 | } |
| 908 | |
| 909 | struct msm_camera_device_platform_data msm_camera_data_rear = { |
| 910 | .camera_gpio_on = config_camera_on_gpios_rear, |
| 911 | .camera_gpio_off = config_camera_off_gpios_rear, |
| 912 | .ioext.csiphy = 0xA1000000, |
| 913 | .ioext.csisz = 0x00100000, |
| 914 | .ioext.csiirq = INT_CSI_IRQ_1, |
| 915 | .ioclk.mclk_clk_rate = 24000000, |
| 916 | .ioclk.vfe_clk_rate = 192000000, |
| 917 | .ioext.appphy = MSM_CLK_CTL_PHYS, |
| 918 | .ioext.appsz = MSM_CLK_CTL_SIZE, |
| 919 | }; |
| 920 | |
| 921 | struct msm_camera_device_platform_data msm_camera_data_front = { |
| 922 | .camera_gpio_on = config_camera_on_gpios_front, |
| 923 | .camera_gpio_off = config_camera_off_gpios_front, |
| 924 | .ioext.csiphy = 0xA0F00000, |
| 925 | .ioext.csisz = 0x00100000, |
| 926 | .ioext.csiirq = INT_CSI_IRQ_0, |
| 927 | .ioclk.mclk_clk_rate = 24000000, |
| 928 | .ioclk.vfe_clk_rate = 192000000, |
| 929 | .ioext.appphy = MSM_CLK_CTL_PHYS, |
| 930 | .ioext.appsz = MSM_CLK_CTL_SIZE, |
| 931 | }; |
| 932 | |
| 933 | #ifdef CONFIG_OV5640 |
| 934 | static struct msm_camera_sensor_platform_info ov5640_sensor_info = { |
| 935 | .mount_angle = 90 |
| 936 | }; |
| 937 | |
| 938 | static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = { |
| 939 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED, |
| 940 | ._fsrc.led_src.led_name = "flashlight", |
| 941 | ._fsrc.led_src.led_name_len = 10, |
| 942 | }; |
| 943 | |
| 944 | static struct msm_camera_sensor_flash_data flash_ov5640 = { |
| 945 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 946 | .flash_src = &msm_flash_src_ov5640, |
| 947 | }; |
| 948 | |
| 949 | static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = { |
| 950 | .sensor_name = "ov5640", |
| 951 | .sensor_reset_enable = 1, |
| 952 | .sensor_reset = GPIO_CAM_5MP_RESET, |
| 953 | .sensor_pwd = GPIO_CAM_5MP_SHDN_EN, |
| 954 | .vcm_pwd = 0, |
| 955 | .vcm_enable = 0, |
| 956 | .pdata = &msm_camera_data_rear, |
| 957 | .flash_data = &flash_ov5640, |
| 958 | .sensor_platform_info = &ov5640_sensor_info, |
| 959 | .csi_if = 1, |
| 960 | }; |
| 961 | |
| 962 | static struct platform_device msm_camera_sensor_ov5640 = { |
| 963 | .name = "msm_camera_ov5640", |
| 964 | .dev = { |
| 965 | .platform_data = &msm_camera_sensor_ov5640_data, |
| 966 | }, |
| 967 | }; |
| 968 | #endif |
| 969 | |
| 970 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 971 | static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = { |
| 972 | .mount_angle = 90 |
| 973 | }; |
| 974 | |
| 975 | static struct msm_camera_sensor_flash_data flash_ov7692 = { |
| 976 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 977 | }; |
| 978 | |
| 979 | static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = { |
| 980 | .sensor_name = "ov7692", |
| 981 | .sensor_reset_enable = 0, |
| 982 | .sensor_reset = 0, |
| 983 | .sensor_pwd = GPIO_CAM_3MP_PWDN, |
| 984 | .vcm_pwd = 0, |
| 985 | .vcm_enable = 0, |
| 986 | .pdata = &msm_camera_data_front, |
| 987 | .flash_data = &flash_ov7692, |
| 988 | .sensor_platform_info = &ov7692_sensor_7627a_info, |
| 989 | .csi_if = 1, |
| 990 | }; |
| 991 | |
| 992 | static struct platform_device msm_camera_sensor_ov7692 = { |
| 993 | .name = "msm_camera_ov7692", |
| 994 | .dev = { |
| 995 | .platform_data = &msm_camera_sensor_ov7692_data, |
| 996 | }, |
| 997 | }; |
| 998 | #endif |
| 999 | |
| 1000 | static struct i2c_board_info i2c_camera_devices[] = { |
| 1001 | #ifdef CONFIG_OV5640 |
| 1002 | { |
| 1003 | I2C_BOARD_INFO("ov5640", 0x78 >> 1), |
| 1004 | }, |
| 1005 | #endif |
| 1006 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 1007 | { |
| 1008 | I2C_BOARD_INFO("ov7692", 0x78), |
| 1009 | }, |
| 1010 | #endif |
| 1011 | }; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1012 | static struct platform_device *qrd1_devices[] __initdata = { |
| 1013 | &msm_device_dmov, |
| 1014 | &msm_device_smd, |
| 1015 | &msm_device_uart1, |
| 1016 | &msm_device_uart_dm1, |
| 1017 | &msm_gsbi0_qup_i2c_device, |
| 1018 | &msm_gsbi1_qup_i2c_device, |
| 1019 | &msm_device_otg, |
| 1020 | &msm_device_gadget_peripheral, |
| 1021 | &android_usb_device, |
| 1022 | &android_pmem_device, |
| 1023 | &android_pmem_adsp_device, |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1024 | &msm_fb_device, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1025 | &android_pmem_audio_device, |
| 1026 | &msm_device_snd, |
| 1027 | &msm_device_adspdec, |
| 1028 | &msm_batt_device, |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1029 | #ifdef CONFIG_OV5640 |
| 1030 | &msm_camera_sensor_ov5640, |
| 1031 | #endif |
| 1032 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 1033 | &msm_camera_sensor_ov7692, |
| 1034 | #endif |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1035 | &msm_kgsl_3d0, |
| 1036 | #ifdef CONFIG_BT |
| 1037 | &msm_bt_power_device, |
| 1038 | #endif |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1039 | &mipi_dsi_truly_panel_device, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1040 | &msm_wlan_ar6000_pm_device, |
| 1041 | &asoc_msm_pcm, |
| 1042 | &asoc_msm_dai0, |
| 1043 | &asoc_msm_dai1, |
| 1044 | }; |
| 1045 | |
| 1046 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 1047 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 1048 | { |
| 1049 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 1050 | return 0; |
| 1051 | } |
| 1052 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 1053 | |
| 1054 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 1055 | static int __init pmem_audio_size_setup(char *p) |
| 1056 | { |
| 1057 | pmem_audio_size = memparse(p, NULL); |
| 1058 | return 0; |
| 1059 | } |
| 1060 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 1061 | |
| 1062 | static void __init msm_msm7627a_allocate_memory_regions(void) |
| 1063 | { |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1064 | void *addr; |
| 1065 | unsigned long size; |
| 1066 | |
| 1067 | size = fb_size ? : MSM_FB_SIZE; |
| 1068 | addr = alloc_bootmem_align(size, 0x1000); |
| 1069 | msm_fb_resources[0].start = __pa(addr); |
| 1070 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 1071 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", size, |
| 1072 | addr, __pa(addr)); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1073 | } |
| 1074 | |
| 1075 | static struct memtype_reserve msm7627a_reserve_table[] __initdata = { |
| 1076 | [MEMTYPE_SMI] = { |
| 1077 | }, |
| 1078 | [MEMTYPE_EBI0] = { |
| 1079 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 1080 | }, |
| 1081 | [MEMTYPE_EBI1] = { |
| 1082 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 1083 | }, |
| 1084 | }; |
| 1085 | |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1086 | static struct msm_panel_common_pdata mdp_pdata = { |
| 1087 | .gpio = 97, |
| 1088 | .mdp_rev = MDP_REV_303, |
| 1089 | }; |
| 1090 | |
| 1091 | #define GPIO_LCDC_BRDG_PD 128 |
| 1092 | #define GPIO_LCDC_BRDG_RESET_N 129 |
| 1093 | #define GPIO_LCD_DSI_SEL 125 |
| 1094 | |
| 1095 | static unsigned mipi_dsi_gpio[] = { |
| 1096 | GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, |
| 1097 | GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */ |
| 1098 | GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, |
| 1099 | GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_PD */ |
| 1100 | }; |
| 1101 | |
| 1102 | static unsigned lcd_dsi_sel_gpio[] = { |
| 1103 | GPIO_CFG(GPIO_LCD_DSI_SEL, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 1104 | GPIO_CFG_2MA), |
| 1105 | }; |
| 1106 | |
| 1107 | enum { |
| 1108 | DSI_SINGLE_LANE = 1, |
| 1109 | DSI_TWO_LANES, |
| 1110 | }; |
| 1111 | |
| 1112 | static int msm_fb_get_lane_config(void) |
| 1113 | { |
| 1114 | pr_info("DSI_TWO_LANES\n"); |
| 1115 | return DSI_TWO_LANES; |
| 1116 | } |
| 1117 | |
| 1118 | static int mipi_truly_sel_mode(int video_mode) |
| 1119 | { |
| 1120 | int rc = 0; |
| 1121 | |
| 1122 | rc = gpio_request(GPIO_LCD_DSI_SEL, "lcd_dsi_sel"); |
| 1123 | if (rc < 0) |
| 1124 | goto gpio_error; |
| 1125 | |
| 1126 | rc = gpio_tlmm_config(lcd_dsi_sel_gpio[0], GPIO_CFG_ENABLE); |
| 1127 | if (rc) |
| 1128 | goto gpio_error; |
| 1129 | |
| 1130 | rc = gpio_direction_output(GPIO_LCD_DSI_SEL, 1); |
| 1131 | if (!rc) { |
| 1132 | gpio_set_value_cansleep(GPIO_LCD_DSI_SEL, video_mode); |
| 1133 | return rc; |
| 1134 | } else { |
| 1135 | goto gpio_error; |
| 1136 | } |
| 1137 | |
| 1138 | gpio_error: |
| 1139 | pr_err("mipi_truly_sel_mode failed\n"); |
| 1140 | gpio_free(GPIO_LCD_DSI_SEL); |
| 1141 | return rc; |
| 1142 | } |
| 1143 | |
| 1144 | static int msm_fb_dsi_client_qrd1_reset(void) |
| 1145 | { |
| 1146 | int rc = 0; |
| 1147 | |
| 1148 | rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n"); |
| 1149 | if (rc < 0) { |
| 1150 | pr_err("failed to request lcd brdg reset_n\n"); |
| 1151 | return rc; |
| 1152 | } |
| 1153 | |
| 1154 | rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE); |
| 1155 | if (rc < 0) { |
| 1156 | pr_err("Failed to enable LCDC Bridge reset enable\n"); |
| 1157 | return rc; |
| 1158 | } |
| 1159 | |
| 1160 | rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1); |
| 1161 | if (rc < 0) { |
| 1162 | pr_err("Failed GPIO bridge pd\n"); |
| 1163 | gpio_free(GPIO_LCDC_BRDG_RESET_N); |
| 1164 | return rc; |
| 1165 | } |
| 1166 | |
| 1167 | mipi_truly_sel_mode(1); |
| 1168 | |
| 1169 | return rc; |
| 1170 | } |
| 1171 | |
| 1172 | static int msm_fb_dsi_client_reset(void) |
| 1173 | { |
| 1174 | int rc = 0; |
| 1175 | |
| 1176 | rc = msm_fb_dsi_client_qrd1_reset(); |
| 1177 | return rc; |
| 1178 | } |
| 1179 | |
| 1180 | static int dsi_gpio_initialized; |
| 1181 | |
| 1182 | static int mipi_dsi_panel_qrd1_power(int on) |
| 1183 | { |
| 1184 | int rc = 0; |
| 1185 | |
| 1186 | if (!dsi_gpio_initialized) { |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1187 | rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en"); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1188 | if (rc < 0) |
| 1189 | return rc; |
| 1190 | |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1191 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_BACKLIGHT_EN, 0, |
Jeevan Shriram | 72e4cc6 | 2011-11-10 14:57:22 +0530 | [diff] [blame] | 1192 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1193 | GPIO_CFG_ENABLE); |
| 1194 | if (rc < 0) { |
| 1195 | pr_err("failed GPIO_BACKLIGHT_EN tlmm config\n"); |
| 1196 | return rc; |
| 1197 | } |
| 1198 | |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1199 | rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1200 | if (rc < 0) { |
| 1201 | pr_err("failed to enable backlight\n"); |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1202 | gpio_free(GPIO_BACKLIGHT_EN); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1203 | return rc; |
| 1204 | } |
| 1205 | dsi_gpio_initialized = 1; |
| 1206 | } |
| 1207 | |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1208 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1209 | |
| 1210 | if (!on) { |
| 1211 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1); |
| 1212 | msleep(20); |
| 1213 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0); |
| 1214 | msleep(20); |
| 1215 | gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1); |
| 1216 | |
| 1217 | } |
| 1218 | |
| 1219 | return rc; |
| 1220 | } |
| 1221 | |
| 1222 | static int mipi_dsi_panel_power(int on) |
| 1223 | { |
| 1224 | int rc = 0; |
| 1225 | |
| 1226 | rc = mipi_dsi_panel_qrd1_power(on); |
| 1227 | return rc; |
| 1228 | } |
| 1229 | |
| 1230 | #define MDP_303_VSYNC_GPIO 97 |
| 1231 | |
| 1232 | #ifdef CONFIG_FB_MSM_MDP303 |
| 1233 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 1234 | .vsync_gpio = MDP_303_VSYNC_GPIO, |
| 1235 | .dsi_power_save = mipi_dsi_panel_power, |
| 1236 | .dsi_client_reset = msm_fb_dsi_client_reset, |
| 1237 | .get_lane_config = msm_fb_get_lane_config, |
| 1238 | }; |
| 1239 | #endif |
| 1240 | |
| 1241 | static void __init msm_fb_add_devices(void) |
| 1242 | { |
| 1243 | msm_fb_register_device("mdp", &mdp_pdata); |
| 1244 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
| 1245 | } |
| 1246 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1247 | static void __init size_pmem_devices(void) |
| 1248 | { |
| 1249 | #ifdef CONFIG_ANDROID_PMEM |
| 1250 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 1251 | android_pmem_pdata.size = pmem_mdp_size; |
| 1252 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 1253 | #endif |
| 1254 | } |
| 1255 | |
| 1256 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 1257 | { |
| 1258 | msm7627a_reserve_table[p->memory_type].size += p->size; |
| 1259 | } |
| 1260 | |
| 1261 | static void __init reserve_pmem_memory(void) |
| 1262 | { |
| 1263 | #ifdef CONFIG_ANDROID_PMEM |
| 1264 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 1265 | reserve_memory_for(&android_pmem_pdata); |
| 1266 | reserve_memory_for(&android_pmem_audio_pdata); |
| 1267 | msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 1268 | #endif |
| 1269 | } |
| 1270 | |
| 1271 | static void __init msm7627a_calculate_reserve_sizes(void) |
| 1272 | { |
| 1273 | size_pmem_devices(); |
| 1274 | reserve_pmem_memory(); |
| 1275 | } |
| 1276 | |
| 1277 | static int msm7627a_paddr_to_memtype(unsigned int paddr) |
| 1278 | { |
| 1279 | return MEMTYPE_EBI1; |
| 1280 | } |
| 1281 | |
| 1282 | static struct reserve_info msm7627a_reserve_info __initdata = { |
| 1283 | .memtype_reserve_table = msm7627a_reserve_table, |
| 1284 | .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes, |
| 1285 | .paddr_to_memtype = msm7627a_paddr_to_memtype, |
| 1286 | }; |
| 1287 | |
| 1288 | static void __init msm7627a_reserve(void) |
| 1289 | { |
| 1290 | reserve_info = &msm7627a_reserve_info; |
| 1291 | msm_reserve(); |
| 1292 | } |
| 1293 | |
| 1294 | static void __init msm_device_i2c_init(void) |
| 1295 | { |
| 1296 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 1297 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 1298 | } |
| 1299 | |
| 1300 | static struct msm_handset_platform_data hs_platform_data = { |
| 1301 | .hs_name = "7k_handset", |
| 1302 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ |
| 1303 | }; |
| 1304 | |
| 1305 | static struct platform_device hs_pdev = { |
| 1306 | .name = "msm-handset", |
| 1307 | .id = -1, |
| 1308 | .dev = { |
| 1309 | .platform_data = &hs_platform_data, |
| 1310 | }, |
| 1311 | }; |
| 1312 | |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 1313 | static struct platform_device msm_proccomm_regulator_dev = { |
| 1314 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 1315 | .id = -1, |
| 1316 | .dev = { |
| 1317 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 1318 | } |
| 1319 | }; |
| 1320 | |
| 1321 | static void __init msm7627a_init_regulators(void) |
| 1322 | { |
| 1323 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 1324 | if (rc) |
| 1325 | pr_err("%s: could not register regulator device: %d\n", |
| 1326 | __func__, rc); |
| 1327 | } |
| 1328 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1329 | #define UART1DM_RX_GPIO 45 |
| 1330 | static void __init msm_qrd1_init(void) |
| 1331 | { |
| 1332 | msm7x2x_misc_init(); |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 1333 | msm7627a_init_regulators(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1334 | msm_device_i2c_init(); |
Taniya Das | 7a22cdd | 2011-09-08 14:57:00 +0530 | [diff] [blame] | 1335 | qrd1_camera_gpio_cfg(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1336 | #ifdef CONFIG_SERIAL_MSM_HS |
| 1337 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 1338 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 1339 | #endif |
| 1340 | |
| 1341 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 1342 | msm_otg_pdata.swfi_latency = msm7627a_pm_data |
| 1343 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 1344 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 1345 | #endif |
| 1346 | msm_device_gadget_peripheral.dev.platform_data = |
Taniya Das | 7a22cdd | 2011-09-08 14:57:00 +0530 | [diff] [blame] | 1347 | &msm_gadget_pdata; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1348 | platform_add_devices(qrd1_devices, |
Taniya Das | 7a22cdd | 2011-09-08 14:57:00 +0530 | [diff] [blame] | 1349 | ARRAY_SIZE(qrd1_devices)); |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 1350 | msm7627a_init_mmc(); |
| 1351 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1352 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 1353 | msm7627a_init_host(); |
| 1354 | #endif |
| 1355 | msm_pm_set_platform_data(msm7627a_pm_data, |
| 1356 | ARRAY_SIZE(msm7627a_pm_data)); |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1357 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 1358 | |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1359 | msm_fb_add_devices(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1360 | |
| 1361 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
Chintan Pandya | 13490c0 | 2011-12-20 13:03:36 +0530 | [diff] [blame] | 1362 | msm7627a_bt_power_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1363 | #endif |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 1364 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 1365 | msm_camera_vreg_init(); |
Chintan Pandya | b429862 | 2012-01-04 00:06:07 +0530 | [diff] [blame^] | 1366 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, i2c_camera_devices, |
| 1367 | ARRAY_SIZE(i2c_camera_devices)); |
Taniya Das | 7a22cdd | 2011-09-08 14:57:00 +0530 | [diff] [blame] | 1368 | |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 1369 | #if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \ |
| 1370 | defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE) |
| 1371 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1372 | synaptic_i2c_clearpad3k, |
| 1373 | ARRAY_SIZE(synaptic_i2c_clearpad3k)); |
| 1374 | #endif |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1375 | platform_device_register(&hs_pdev); |
| 1376 | |
| 1377 | #ifdef CONFIG_MSM_RPC_VIBRATOR |
| 1378 | msm_init_pmic_vibrator(); |
| 1379 | #endif |
| 1380 | } |
| 1381 | |
| 1382 | static void __init qrd7627a_init_early(void) |
| 1383 | { |
| 1384 | msm_msm7627a_allocate_memory_regions(); |
| 1385 | } |
| 1386 | |
| 1387 | MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1") |
| 1388 | .boot_params = PHYS_OFFSET + 0x100, |
| 1389 | .map_io = msm_common_io_init, |
| 1390 | .reserve = msm7627a_reserve, |
| 1391 | .init_irq = msm_init_irq, |
| 1392 | .init_machine = msm_qrd1_init, |
| 1393 | .timer = &msm_timer, |
| 1394 | .init_early = qrd7627a_init_early, |
Pankaj Kumar | bf8a2a3 | 2011-10-21 11:47:21 +0530 | [diff] [blame] | 1395 | .handle_irq = vic_handle_irq, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1396 | MACHINE_END |