blob: f7e908b0336eeef81a293dd9835f4e2ea8cf90de [file] [log] [blame]
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302 *
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 Kumar6f841742011-10-10 15:52:14 +053016#include <linux/usb/android.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053017#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 Dasda408822011-09-06 12:54:06 +053027#include <linux/input/rmi_platformdata.h>
28#include <linux/input/rmi_i2c.h>
Mohan Pallaka4c5bb922011-11-23 15:54:51 +053029#include <linux/i2c/atmel_mxt_ts.h>
Pankaj Kumar3cec0582011-11-18 11:13:29 +053030#include <linux/regulator/consumer.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053031#include <asm/mach/mmc.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/board.h>
35#include <mach/msm_iomap.h>
36#include <mach/msm_hsusb.h>
37#include <mach/rpc_hsusb.h>
38#include <mach/rpc_pmapp.h>
39#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053040#include <mach/msm_memtypes.h>
41#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053042#include <mach/pmic.h>
43#include <mach/socinfo.h>
44#include <mach/vreg.h>
45#include <mach/rpc_pmapp.h>
46#include <mach/msm_battery.h>
47#include <mach/rpc_server_handset.h>
48#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053049#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053050#include "devices.h"
51#include "devices-msm7x2xa.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080052#include <mach/pm.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053053#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053054#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053055#include "board-msm7x27a-regulator.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053056#include "board-msm7627a.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053057
58#define PMEM_KERNEL_EBI1_SIZE 0x3A000
59#define MSM_PMEM_AUDIO_SIZE 0x5B000
Taniya Dasc98bfbc2011-08-23 09:58:55 +053060#define BAHAMA_SLAVE_ID_FM_REG 0x02
61#define FM_GPIO 83
Rahul Kashyap8b4a7862011-12-13 18:40:54 +053062#define BT_PCM_BCLK_MODE 0x88
63#define BT_PCM_DIN_MODE 0x89
64#define BT_PCM_DOUT_MODE 0x8A
65#define BT_PCM_SYNC_MODE 0x8B
66#define FM_I2S_SD_MODE 0x8E
67#define FM_I2S_WS_MODE 0x8F
68#define FM_I2S_SCK_MODE 0x90
69#define I2C_PIN_CTL 0x15
70#define I2C_NORMAL 0x40
Taniya Dasc98bfbc2011-08-23 09:58:55 +053071
Taniya Dasc98bfbc2011-08-23 09:58:55 +053072static struct platform_device msm_wlan_ar6000_pm_device = {
73 .name = "wlan_ar6000_pm_dev",
74 .id = -1,
75};
76
Taniya Dasc98bfbc2011-08-23 09:58:55 +053077static struct msm_gpio qup_i2c_gpios_io[] = {
78 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
79 "qup_scl" },
80 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
81 "qup_sda" },
82 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
83 "qup_scl" },
84 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
85 "qup_sda" },
86};
87
88static struct msm_gpio qup_i2c_gpios_hw[] = {
89 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
90 "qup_scl" },
91 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
92 "qup_sda" },
93 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
94 "qup_scl" },
95 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
96 "qup_sda" },
97};
98
99static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
100{
101 int rc;
102
103 if (adap_id < 0 || adap_id > 1)
104 return;
105
106 /* Each adapter gets 2 lines from the table */
107 if (config_type)
108 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
109 else
110 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
111 if (rc < 0)
112 pr_err("QUP GPIO request/enable failed: %d\n", rc);
113}
114
115static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
116 .clk_freq = 100000,
117 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
118};
119
120static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
121 .clk_freq = 100000,
122 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
123};
124
125#ifdef CONFIG_ARCH_MSM7X27A
126#define MSM_PMEM_MDP_SIZE 0x1DD1000
127#define MSM_PMEM_ADSP_SIZE 0x1000000
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530128#endif
129
Taniya Dasda408822011-09-06 12:54:06 +0530130#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
131defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
132
133#ifndef CLEARPAD3000_ATTEN_GPIO
134#define CLEARPAD3000_ATTEN_GPIO (48)
135#endif
136
137#ifndef CLEARPAD3000_RESET_GPIO
138#define CLEARPAD3000_RESET_GPIO (26)
139#endif
140
141static int synaptics_touchpad_setup(void);
142
143static struct msm_gpio clearpad3000_cfg_data[] = {
144 {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT,
145 GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"},
146 {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT,
147 GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"},
148};
149
150static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0};
151static struct rmi_range rmi_clipx = {.min = 48, .max = 980};
152static struct rmi_range rmi_clipy = {.min = 7, .max = 1647};
153static struct rmi_f11_functiondata synaptics_f11_data = {
154 .swap_axes = false,
155 .flipX = false,
156 .flipY = false,
157 .offset = &rmi_offset,
158 .button_height = 113,
159 .clipX = &rmi_clipx,
160 .clipY = &rmi_clipy,
161};
162
163#define MAX_LEN 100
164
165static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj,
166 struct kobj_attribute *attr, char *buf)
167{
168 char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \
169 ":60:830:120:60" ":" __stringify(EV_KEY) \
170 ":" __stringify(KEY_HOME) ":180:830:120:60" \
171 ":" __stringify(EV_KEY) ":" \
172 __stringify(KEY_SEARCH) ":300:830:120:60" \
173 ":" __stringify(EV_KEY) ":" \
174 __stringify(KEY_BACK) ":420:830:120:60" "\n";
175
176 return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s",
177 virtual_keys);
178}
179
180static struct kobj_attribute clearpad3000_virtual_keys_attr = {
181 .attr = {
182 .name = "virtualkeys.sensor00fn11",
183 .mode = S_IRUGO,
184 },
185 .show = &clearpad3000_virtual_keys_register,
186};
187
188static struct attribute *virtual_key_properties_attrs[] = {
189 &clearpad3000_virtual_keys_attr.attr,
190 NULL
191};
192
193static struct attribute_group virtual_key_properties_attr_group = {
194 .attrs = virtual_key_properties_attrs,
195};
196
197struct kobject *virtual_key_properties_kobj;
198
199static struct rmi_functiondata synaptics_functiondata[] = {
200 {
201 .function_index = RMI_F11_INDEX,
202 .data = &synaptics_f11_data,
203 },
204};
205
206static struct rmi_functiondata_list synaptics_perfunctiondata = {
207 .count = ARRAY_SIZE(synaptics_functiondata),
208 .functiondata = synaptics_functiondata,
209};
210
211static struct rmi_sensordata synaptics_sensordata = {
212 .perfunctiondata = &synaptics_perfunctiondata,
213 .rmi_sensor_setup = synaptics_touchpad_setup,
214};
215
216static struct rmi_i2c_platformdata synaptics_platformdata = {
217 .i2c_address = 0x2c,
218 .irq_type = IORESOURCE_IRQ_LOWLEVEL,
219 .sensordata = &synaptics_sensordata,
220};
221
222static struct i2c_board_info synaptic_i2c_clearpad3k[] = {
223 {
224 I2C_BOARD_INFO("rmi4_ts", 0x2c),
225 .platform_data = &synaptics_platformdata,
226 },
227};
228
229static int synaptics_touchpad_setup(void)
230{
231 int retval = 0;
232
233 virtual_key_properties_kobj =
234 kobject_create_and_add("board_properties", NULL);
235 if (virtual_key_properties_kobj)
236 retval = sysfs_create_group(virtual_key_properties_kobj,
237 &virtual_key_properties_attr_group);
238 if (!virtual_key_properties_kobj || retval)
239 pr_err("failed to create ft5202 board_properties\n");
240
241 retval = msm_gpios_request_enable(clearpad3000_cfg_data,
242 sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio));
243 if (retval) {
244 pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.",
245 __func__, CLEARPAD3000_ATTEN_GPIO, retval);
246 retval = 0; /* ignore the err */
247 }
248 synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO);
249
250 gpio_set_value(CLEARPAD3000_RESET_GPIO, 0);
251 usleep(10000);
252 gpio_set_value(CLEARPAD3000_RESET_GPIO, 1);
253 usleep(50000);
254
255 return retval;
256}
257#endif
258
259
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530260static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +0530261 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530262};
263
264static struct platform_device android_usb_device = {
265 .name = "android_usb",
266 .id = -1,
267 .dev = {
268 .platform_data = &android_usb_pdata,
269 },
270};
271
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530272#ifdef CONFIG_USB_EHCI_MSM_72K
273static void msm_hsusb_vbus_power(unsigned phy_info, int on)
274{
275 int rc = 0;
276 unsigned gpio;
277
Chintan Pandya40762702011-12-06 13:47:06 +0530278 gpio = QRD_GPIO_HOST_VBUS_EN;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530279
280 rc = gpio_request(gpio, "i2c_host_vbus_en");
281 if (rc < 0) {
282 pr_err("failed to request %d GPIO\n", gpio);
283 return;
284 }
285 gpio_direction_output(gpio, !!on);
286 gpio_set_value_cansleep(gpio, !!on);
287 gpio_free(gpio);
288}
289
290static struct msm_usb_host_platform_data msm_usb_host_pdata = {
291 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
292};
293
294static void __init msm7627a_init_host(void)
295{
296 msm_add_host(0, &msm_usb_host_pdata);
297}
298#endif
299
300#ifdef CONFIG_USB_MSM_OTG_72K
301static int hsusb_rpc_connect(int connect)
302{
303 if (connect)
304 return msm_hsusb_rpc_connect();
305 else
306 return msm_hsusb_rpc_close();
307}
308
Pankaj Kumar27c02642011-09-22 15:55:55 +0530309static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530310static int msm_hsusb_ldo_init(int init)
311{
Pankaj Kumar27c02642011-09-22 15:55:55 +0530312 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530313
Pankaj Kumar27c02642011-09-22 15:55:55 +0530314 if (init) {
315 reg_hsusb = regulator_get(NULL, "usb");
316 if (IS_ERR(reg_hsusb)) {
317 rc = PTR_ERR(reg_hsusb);
318 pr_err("%s: could not get regulator: %d\n",
319 __func__, rc);
320 goto out;
321 }
322
323 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
324 if (rc) {
325 pr_err("%s: could not set voltage: %d\n",
326 __func__, rc);
327 goto reg_free;
328 }
329
330 return 0;
331 }
332 /* else fall through */
333reg_free:
334 regulator_put(reg_hsusb);
335out:
336 reg_hsusb = NULL;
337 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530338}
339
340static int msm_hsusb_ldo_enable(int enable)
341{
342 static int ldo_status;
343
Pankaj Kumar27c02642011-09-22 15:55:55 +0530344 if (IS_ERR_OR_NULL(reg_hsusb))
345 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530346
347 if (ldo_status == enable)
348 return 0;
349
350 ldo_status = enable;
351
Pankaj Kumar27c02642011-09-22 15:55:55 +0530352 return enable ?
353 regulator_enable(reg_hsusb) :
354 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530355}
356
357#ifndef CONFIG_USB_EHCI_MSM_72K
358static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
359{
360 int ret = 0;
361
362 if (init)
363 ret = msm_pm_app_rpc_init(callback);
364 else
365 msm_pm_app_rpc_deinit(callback);
366
367 return ret;
368}
369#endif
370
371static struct msm_otg_platform_data msm_otg_pdata = {
372#ifndef CONFIG_USB_EHCI_MSM_72K
373 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
374#else
375 .vbus_power = msm_hsusb_vbus_power,
376#endif
377 .rpc_connect = hsusb_rpc_connect,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530378 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
379 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
380 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
381 .se1_gating = SE1_GATING_DISABLE,
382 .ldo_init = msm_hsusb_ldo_init,
383 .ldo_enable = msm_hsusb_ldo_enable,
384 .chg_init = hsusb_chg_init,
385 .chg_connected = hsusb_chg_connected,
386 .chg_vbus_draw = hsusb_chg_vbus_draw,
387};
388#endif
389
390static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
391 .is_phy_status_timer_on = 1,
392};
393
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530394#ifdef CONFIG_SERIAL_MSM_HS
395static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
396 .inject_rx_on_wakeup = 1,
397 .rx_to_inject = 0xFD,
398};
399#endif
400static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
401 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
402 .idle_supported = 1,
403 .suspend_supported = 1,
404 .idle_enabled = 1,
405 .suspend_enabled = 1,
406 .latency = 16000,
407 .residency = 20000,
408 },
409 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
410 .idle_supported = 1,
411 .suspend_supported = 1,
412 .idle_enabled = 1,
413 .suspend_enabled = 1,
414 .latency = 12000,
415 .residency = 20000,
416 },
417 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
418 .idle_supported = 1,
419 .suspend_supported = 1,
420 .idle_enabled = 0,
421 .suspend_enabled = 1,
422 .latency = 2000,
423 .residency = 0,
424 },
425 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
426 .idle_supported = 1,
427 .suspend_supported = 1,
428 .idle_enabled = 1,
429 .suspend_enabled = 1,
430 .latency = 2,
431 .residency = 0,
432 },
433};
434
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600435static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530436 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
437 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600438};
439
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530440static struct android_pmem_platform_data android_pmem_adsp_pdata = {
441 .name = "pmem_adsp",
442 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
443 .cached = 1,
444 .memory_type = MEMTYPE_EBI1,
445};
446
447static struct platform_device android_pmem_adsp_device = {
448 .name = "android_pmem",
449 .id = 1,
450 .dev = { .platform_data = &android_pmem_adsp_pdata },
451};
452
453static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
454static int __init pmem_mdp_size_setup(char *p)
455{
456 pmem_mdp_size = memparse(p, NULL);
457 return 0;
458}
459
460early_param("pmem_mdp_size", pmem_mdp_size_setup);
461
462static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
463static int __init pmem_adsp_size_setup(char *p)
464{
465 pmem_adsp_size = memparse(p, NULL);
466 return 0;
467}
468
469early_param("pmem_adsp_size", pmem_adsp_size_setup);
470
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530471#define SND(desc, num) { .name = #desc, .id = num }
472static struct snd_endpoint snd_endpoints_list[] = {
473 SND(HANDSET, 0),
474 SND(MONO_HEADSET, 2),
475 SND(HEADSET, 3),
476 SND(SPEAKER, 6),
477 SND(TTY_HEADSET, 8),
478 SND(TTY_VCO, 9),
479 SND(TTY_HCO, 10),
480 SND(BT, 12),
481 SND(IN_S_SADC_OUT_HANDSET, 16),
482 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
483 SND(FM_DIGITAL_STEREO_HEADSET, 26),
484 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
485 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +0530486 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Phani Kumar Alladad6971252011-10-19 10:50:15 +0530487 SND(CURRENT, 0x7FFFFFFE),
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530488 SND(FM_ANALOG_STEREO_HEADSET, 35),
489 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
490};
491#undef SND
492
493static struct msm_snd_endpoints msm_device_snd_endpoints = {
494 .endpoints = snd_endpoints_list,
495 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
496};
497
498static struct platform_device msm_device_snd = {
499 .name = "msm_snd",
500 .id = -1,
501 .dev = {
502 .platform_data = &msm_device_snd_endpoints
503 },
504};
505
506#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
507 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
508 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
509 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
510 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
511 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
512#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
513 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
514 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
515 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
516 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
517 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
518#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
519 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
520 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
521 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
522 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
523 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
524#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
525 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
526 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
527 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
528 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
529 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
530#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
531
532static unsigned int dec_concurrency_table[] = {
533 /* Audio LP */
534 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
535 0, 0, 0,
536
537 /* Concurrency 1 */
538 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
539 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
540 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
541 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
542 (DEC4_FORMAT),
543
544 /* Concurrency 2 */
545 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
546 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
547 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
548 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
549 (DEC4_FORMAT),
550
551 /* Concurrency 3 */
552 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
553 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
554 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
555 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
556 (DEC4_FORMAT),
557
558 /* Concurrency 4 */
559 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
560 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
561 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
562 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
563 (DEC4_FORMAT),
564
565 /* Concurrency 5 */
566 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
567 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
568 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
569 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
570 (DEC4_FORMAT),
571
572 /* Concurrency 6 */
573 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
574 0, 0, 0, 0,
575
576 /* Concurrency 7 */
577 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
578 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
579 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
580 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
581 (DEC4_FORMAT),
582};
583
584#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
585 .module_queueid = queueid, .module_decid = decid, \
586 .nr_codec_support = nr_codec}
587
588static struct msm_adspdec_info dec_info_list[] = {
589 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
590 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
591 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
592 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
593 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
594};
595
596static struct msm_adspdec_database msm_device_adspdec_database = {
597 .num_dec = ARRAY_SIZE(dec_info_list),
598 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
599 ARRAY_SIZE(dec_info_list)),
600 .dec_concurrency_table = dec_concurrency_table,
601 .dec_info_list = dec_info_list,
602};
603
604static struct platform_device msm_device_adspdec = {
605 .name = "msm_adspdec",
606 .id = -1,
607 .dev = {
608 .platform_data = &msm_device_adspdec_database
609 },
610};
611
612static struct android_pmem_platform_data android_pmem_audio_pdata = {
613 .name = "pmem_audio",
614 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
615 .cached = 0,
616 .memory_type = MEMTYPE_EBI1,
617};
618
619static struct platform_device android_pmem_audio_device = {
620 .name = "android_pmem",
621 .id = 2,
622 .dev = { .platform_data = &android_pmem_audio_pdata },
623};
624
625static struct android_pmem_platform_data android_pmem_pdata = {
626 .name = "pmem",
627 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
628 .cached = 1,
629 .memory_type = MEMTYPE_EBI1,
630};
631static struct platform_device android_pmem_device = {
632 .name = "android_pmem",
633 .id = 0,
634 .dev = { .platform_data = &android_pmem_pdata },
635};
636
637static u32 msm_calculate_batt_capacity(u32 current_voltage);
638
639static struct msm_psy_batt_pdata msm_psy_batt_data = {
640 .voltage_min_design = 2800,
641 .voltage_max_design = 4300,
642 .avail_chg_sources = AC_CHG | USB_CHG ,
643 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
644 .calculate_capacity = &msm_calculate_batt_capacity,
645};
646
647static u32 msm_calculate_batt_capacity(u32 current_voltage)
648{
649 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
650 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
651
652 return (current_voltage - low_voltage) * 100
653 / (high_voltage - low_voltage);
654}
655
656static struct platform_device msm_batt_device = {
657 .name = "msm-battery",
658 .id = -1,
659 .dev.platform_data = &msm_psy_batt_data,
660};
661
Taniya Dasc868a2e2012-01-03 10:18:47 +0530662static struct platform_device *qrd_common_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530663 &msm_device_dmov,
664 &msm_device_smd,
665 &msm_device_uart1,
666 &msm_device_uart_dm1,
667 &msm_gsbi0_qup_i2c_device,
668 &msm_gsbi1_qup_i2c_device,
669 &msm_device_otg,
670 &msm_device_gadget_peripheral,
671 &android_usb_device,
672 &android_pmem_device,
673 &android_pmem_adsp_device,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530674 &android_pmem_audio_device,
675 &msm_device_snd,
676 &msm_device_adspdec,
677 &msm_batt_device,
678 &msm_kgsl_3d0,
679#ifdef CONFIG_BT
680 &msm_bt_power_device,
681#endif
682 &msm_wlan_ar6000_pm_device,
683 &asoc_msm_pcm,
684 &asoc_msm_dai0,
685 &asoc_msm_dai1,
686};
687
688static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
689static int __init pmem_kernel_ebi1_size_setup(char *p)
690{
691 pmem_kernel_ebi1_size = memparse(p, NULL);
692 return 0;
693}
694early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
695
696static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
697static int __init pmem_audio_size_setup(char *p)
698{
699 pmem_audio_size = memparse(p, NULL);
700 return 0;
701}
702early_param("pmem_audio_size", pmem_audio_size_setup);
703
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530704static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
705 [MEMTYPE_SMI] = {
706 },
707 [MEMTYPE_EBI0] = {
708 .flags = MEMTYPE_FLAGS_1M_ALIGN,
709 },
710 [MEMTYPE_EBI1] = {
711 .flags = MEMTYPE_FLAGS_1M_ALIGN,
712 },
713};
714
715static void __init size_pmem_devices(void)
716{
717#ifdef CONFIG_ANDROID_PMEM
718 android_pmem_adsp_pdata.size = pmem_adsp_size;
719 android_pmem_pdata.size = pmem_mdp_size;
720 android_pmem_audio_pdata.size = pmem_audio_size;
721#endif
722}
723
724static void __init reserve_memory_for(struct android_pmem_platform_data *p)
725{
726 msm7627a_reserve_table[p->memory_type].size += p->size;
727}
728
729static void __init reserve_pmem_memory(void)
730{
731#ifdef CONFIG_ANDROID_PMEM
732 reserve_memory_for(&android_pmem_adsp_pdata);
733 reserve_memory_for(&android_pmem_pdata);
734 reserve_memory_for(&android_pmem_audio_pdata);
735 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
736#endif
737}
738
739static void __init msm7627a_calculate_reserve_sizes(void)
740{
741 size_pmem_devices();
742 reserve_pmem_memory();
743}
744
745static int msm7627a_paddr_to_memtype(unsigned int paddr)
746{
747 return MEMTYPE_EBI1;
748}
749
750static struct reserve_info msm7627a_reserve_info __initdata = {
751 .memtype_reserve_table = msm7627a_reserve_table,
752 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
753 .paddr_to_memtype = msm7627a_paddr_to_memtype,
754};
755
756static void __init msm7627a_reserve(void)
757{
758 reserve_info = &msm7627a_reserve_info;
759 msm_reserve();
760}
761
762static void __init msm_device_i2c_init(void)
763{
764 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
765 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
766}
767
768static struct msm_handset_platform_data hs_platform_data = {
769 .hs_name = "7k_handset",
770 .pwr_key_delay_ms = 500, /* 0 will disable end key */
771};
772
773static struct platform_device hs_pdev = {
774 .name = "msm-handset",
775 .id = -1,
776 .dev = {
777 .platform_data = &hs_platform_data,
778 },
779};
780
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530781static struct platform_device msm_proccomm_regulator_dev = {
782 .name = PROCCOMM_REGULATOR_DEV_NAME,
783 .id = -1,
784 .dev = {
785 .platform_data = &msm7x27a_proccomm_regulator_data
786 }
787};
788
789static void __init msm7627a_init_regulators(void)
790{
791 int rc = platform_device_register(&msm_proccomm_regulator_dev);
792 if (rc)
793 pr_err("%s: could not register regulator device: %d\n",
794 __func__, rc);
795}
796
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530797/* 8625 keypad device information */
798static unsigned int kp_row_gpios_8625[] = {31};
799static unsigned int kp_col_gpios_8625[] = {36, 37};
800
801static const unsigned short keymap_8625[] = {
802 KEY_VOLUMEUP,
803 KEY_VOLUMEDOWN,
804};
805
806static struct gpio_event_matrix_info kp_matrix_info_8625 = {
807 .info.func = gpio_event_matrix_func,
808 .keymap = keymap_8625,
809 .output_gpios = kp_row_gpios_8625,
810 .input_gpios = kp_col_gpios_8625,
811 .noutputs = ARRAY_SIZE(kp_row_gpios_8625),
812 .ninputs = ARRAY_SIZE(kp_col_gpios_8625),
813 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
814 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
815 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
816 GPIOKPF_PRINT_UNMAPPED_KEYS,
817};
818
819static struct gpio_event_info *kp_info_8625[] = {
820 &kp_matrix_info_8625.info,
821};
822static struct gpio_event_platform_data kp_pdata_8625 = {
823 .name = "8625_kp",
824 .info = kp_info_8625,
825 .info_count = ARRAY_SIZE(kp_info_8625)
826};
827
828static struct platform_device kp_pdev_8625 = {
829 .name = GPIO_EVENT_DEV_NAME,
830 .id = -1,
831 .dev = {
832 .platform_data = &kp_pdata_8625,
833 },
834};
835
Mohan Pallakaad78af82011-11-23 15:30:07 +0530836#define LED_RED_GPIO_8625 49
837#define LED_GREEN_GPIO_8625 34
838
839static struct gpio_led gpio_leds_config_8625[] = {
840 {
841 .name = "green",
842 .gpio = LED_GREEN_GPIO_8625,
843 },
844 {
845 .name = "red",
846 .gpio = LED_RED_GPIO_8625,
847 },
848};
849
850static struct gpio_led_platform_data gpio_leds_pdata_8625 = {
851 .num_leds = ARRAY_SIZE(gpio_leds_config_8625),
852 .leds = gpio_leds_config_8625,
853};
854
855static struct platform_device gpio_leds_8625 = {
856 .name = "leds-gpio",
857 .id = -1,
858 .dev = {
859 .platform_data = &gpio_leds_pdata_8625,
860 },
861};
862
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530863#define MXT_TS_IRQ_GPIO 48
864#define MXT_TS_RESET_GPIO 26
865
866static const u8 mxt_config_data[] = {
867 /* T6 Object */
868 0, 0, 0, 0, 0, 0,
869 /* T38 Object */
870 16, 0, 0, 0, 0, 0, 0, 0,
871 /* T7 Object */
872 255, 255, 10,
873 /* T8 Object */
874 30, 0, 20, 20, 0, 0, 20, 0, 50, 0,
875 /* T9 Object */
876 3, 0, 0, 18, 11, 0, 32, 75, 3, 3,
877 0, 1, 1, 0, 10, 10, 10, 10, 31, 3,
878 223, 1, 11, 11, 15, 15, 151, 43, 145, 80,
879 100, 15, 0, 0, 0,
880 /* T15 Object */
881 131, 0, 11, 11, 1, 1, 0, 45, 3, 0,
882 0,
883 /* T18 Object */
884 0, 0,
885 /* T19 Object */
886 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
887 0, 0, 0, 0, 0, 0,
888 /* T23 Object */
889 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
890 0, 0, 0, 0, 0,
891 /* T25 Object */
892 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
893 0, 0, 0, 0,
894 /* T40 Object */
895 0, 0, 0, 0, 0,
896 /* T42 Object */
897 0, 0, 0, 0, 0, 0, 0, 0,
898 /* T46 Object */
899 0, 2, 32, 48, 0, 0, 0, 0, 0,
900 /* T47 Object */
901 1, 20, 60, 5, 2, 50, 40, 0, 0, 40,
902 /* T48 Object */
903 1, 12, 80, 0, 0, 0, 0, 0, 0, 0,
904 0, 0, 0, 6, 6, 0, 0, 100, 4, 64,
905 10, 0, 20, 5, 0, 38, 0, 20, 0, 0,
906 0, 0, 0, 0, 16, 65, 3, 1, 1, 0,
907 10, 10, 10, 0, 0, 15, 15, 154, 58, 145,
908 80, 100, 15, 3,
909};
910
911static struct mxt_config_info mxt_config_array[] = {
912 {
913 .config = mxt_config_data,
914 .config_length = ARRAY_SIZE(mxt_config_data),
915 .family_id = 0x81,
916 .variant_id = 0x01,
917 .version = 0x10,
918 .build = 0xAA,
919 },
920};
921
922static int mxt_key_codes[MXT_KEYARRAY_MAX_KEYS] = {
923 [0] = KEY_HOME,
924 [1] = KEY_MENU,
925 [9] = KEY_BACK,
926 [10] = KEY_SEARCH,
927};
928
929static struct mxt_platform_data mxt_platform_data = {
930 .config_array = mxt_config_array,
931 .config_array_size = ARRAY_SIZE(mxt_config_array),
932 .x_size = 479,
933 .y_size = 799,
934 .irqflags = IRQF_TRIGGER_FALLING,
935 .i2c_pull_up = true,
936 .reset_gpio = MXT_TS_RESET_GPIO,
937 .irq_gpio = MXT_TS_IRQ_GPIO,
938 .key_codes = mxt_key_codes,
939};
940
941static struct i2c_board_info mxt_device_info[] __initdata = {
942 {
943 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
944 .platform_data = &mxt_platform_data,
945 .irq = MSM_GPIO_TO_INT(MXT_TS_IRQ_GPIO),
946 },
947};
948
Taniya Dasc868a2e2012-01-03 10:18:47 +0530949static void msm7627a_add_io_devices(void)
950{
Mohan Pallakaad78af82011-11-23 15:30:07 +0530951 int rc;
952
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530953 /* touchscreen */
954 if (machine_is_msm7627a_qrd1()) {
955 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
956 synaptic_i2c_clearpad3k,
957 ARRAY_SIZE(synaptic_i2c_clearpad3k));
958 } else if (machine_is_msm7627a_evb()) {
959 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_IRQ_GPIO, 0,
960 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
961 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
962 if (rc) {
963 pr_err("%s: gpio_tlmm_config for %d failed\n",
964 __func__, MXT_TS_IRQ_GPIO);
965 }
966
967 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_RESET_GPIO, 0,
968 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
969 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
970 if (rc) {
971 pr_err("%s: gpio_tlmm_config for %d failed\n",
972 __func__, MXT_TS_RESET_GPIO);
973 }
974
975 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
976 mxt_device_info,
977 ARRAY_SIZE(mxt_device_info));
978 }
979
980 /* headset */
Taniya Dasc868a2e2012-01-03 10:18:47 +0530981 platform_device_register(&hs_pdev);
982
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530983 /* vibrator */
Taniya Dasc868a2e2012-01-03 10:18:47 +0530984#ifdef CONFIG_MSM_RPC_VIBRATOR
985 msm_init_pmic_vibrator();
986#endif
987
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530988 /* keypad */
989 if (machine_is_msm7627a_evb())
990 platform_device_register(&kp_pdev_8625);
Mohan Pallakaad78af82011-11-23 15:30:07 +0530991
992 /* leds */
993 if (machine_is_msm7627a_evb()) {
994 rc = gpio_tlmm_config(GPIO_CFG(LED_RED_GPIO_8625, 0,
995 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
996 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
997 if (rc) {
998 pr_err("%s: gpio_tlmm_config for %d failed\n",
999 __func__, LED_RED_GPIO_8625);
1000 }
1001
1002 rc = gpio_tlmm_config(GPIO_CFG(LED_GREEN_GPIO_8625, 0,
1003 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1004 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
1005 if (rc) {
1006 pr_err("%s: gpio_tlmm_config for %d failed\n",
1007 __func__, LED_GREEN_GPIO_8625);
1008 }
1009
1010 platform_device_register(&gpio_leds_8625);
1011 }
Taniya Dasc868a2e2012-01-03 10:18:47 +05301012}
1013
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301014#define UART1DM_RX_GPIO 45
Taniya Dasc868a2e2012-01-03 10:18:47 +05301015static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301016{
1017 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05301018 msm7627a_init_regulators();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301019 msm_device_i2c_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301020#ifdef CONFIG_SERIAL_MSM_HS
1021 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1022 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1023#endif
1024
1025#ifdef CONFIG_USB_MSM_OTG_72K
1026 msm_otg_pdata.swfi_latency = msm7627a_pm_data
1027 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
1028 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1029#endif
1030 msm_device_gadget_peripheral.dev.platform_data =
Taniya Das7a22cdd2011-09-08 14:57:00 +05301031 &msm_gadget_pdata;
Taniya Dasc868a2e2012-01-03 10:18:47 +05301032
1033 platform_add_devices(qrd_common_devices,
1034 ARRAY_SIZE(qrd_common_devices));
1035
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301036 msm7627a_init_mmc();
1037
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301038#ifdef CONFIG_USB_EHCI_MSM_72K
1039 msm7627a_init_host();
1040#endif
1041 msm_pm_set_platform_data(msm7627a_pm_data,
1042 ARRAY_SIZE(msm7627a_pm_data));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001043 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Murali Nalajalaa1827842011-11-13 14:12:39 +05301044
Taniya Das0a5303a2011-08-23 18:47:48 +05301045 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301046
1047#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301048 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301049#endif
Taniya Dasda408822011-09-06 12:54:06 +05301050
Chintan Pandya40762702011-12-06 13:47:06 +05301051 msm7627a_camera_init();
Taniya Das7a22cdd2011-09-08 14:57:00 +05301052
Taniya Dasc868a2e2012-01-03 10:18:47 +05301053 msm7627a_add_io_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301054}
1055
1056static void __init qrd7627a_init_early(void)
1057{
1058 msm_msm7627a_allocate_memory_regions();
1059}
1060
1061MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
1062 .boot_params = PHYS_OFFSET + 0x100,
1063 .map_io = msm_common_io_init,
1064 .reserve = msm7627a_reserve,
1065 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301066 .init_machine = msm_qrd_init,
1067 .timer = &msm_timer,
1068 .init_early = qrd7627a_init_early,
1069 .handle_irq = vic_handle_irq,
1070MACHINE_END
1071MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
1072 .boot_params = PHYS_OFFSET + 0x100,
1073 .map_io = msm_common_io_init,
1074 .reserve = msm7627a_reserve,
1075 .init_irq = msm_init_irq,
1076 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301077 .timer = &msm_timer,
1078 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301079 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301080MACHINE_END