blob: 761a3c98e8f4f1640bf6f218c8a1eff918bd8d29 [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>
Trilok Sonib9410792012-04-07 15:37:13 +053027#include <linux/input/rmi_platformdata.h>
28#include <linux/input/rmi_i2c.h>
29#include <linux/i2c/atmel_mxt_ts.h>
Pankaj Kumar3cec0582011-11-18 11:13:29 +053030#include <linux/regulator/consumer.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053031#include <linux/memblock.h>
Mohan Pallaka5afe9852012-01-12 23:12:06 +053032#include <linux/input/ft5x06_ts.h>
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -070033#include <linux/msm_adc.h>
Taniya Das720c5c32012-05-18 14:08:14 +053034#include <linux/fmem.h>
Steve Muckle75c34ca2012-06-12 14:27:40 -070035#include <linux/regulator/msm-gpio-regulator.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053036#include <asm/mach/mmc.h>
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053039#include <asm/hardware/gic.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053040#include <mach/board.h>
41#include <mach/msm_iomap.h>
42#include <mach/msm_hsusb.h>
43#include <mach/rpc_hsusb.h>
44#include <mach/rpc_pmapp.h>
45#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053046#include <mach/msm_memtypes.h>
47#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053048#include <mach/pmic.h>
49#include <mach/socinfo.h>
50#include <mach/vreg.h>
51#include <mach/rpc_pmapp.h>
52#include <mach/msm_battery.h>
53#include <mach/rpc_server_handset.h>
54#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053055#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053056#include "devices.h"
57#include "devices-msm7x2xa.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080058#include "pm.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053059#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053060#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053061#include "board-msm7x27a-regulator.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053062#include "board-msm7627a.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053063
Trilok Sonib9410792012-04-07 15:37:13 +053064#define PMEM_KERNEL_EBI1_SIZE 0x3A000
Sidipotu Ashok4f1ddc92012-04-11 13:51:34 +053065#define MSM_PMEM_AUDIO_SIZE 0x1F4000
Trilok Sonib9410792012-04-07 15:37:13 +053066#define BAHAMA_SLAVE_ID_FM_REG 0x02
67#define FM_GPIO 83
68#define BT_PCM_BCLK_MODE 0x88
69#define BT_PCM_DIN_MODE 0x89
70#define BT_PCM_DOUT_MODE 0x8A
71#define BT_PCM_SYNC_MODE 0x8B
72#define FM_I2S_SD_MODE 0x8E
73#define FM_I2S_WS_MODE 0x8F
74#define FM_I2S_SCK_MODE 0x90
75#define I2C_PIN_CTL 0x15
76#define I2C_NORMAL 0x40
77
Taniya Dasc98bfbc2011-08-23 09:58:55 +053078static struct platform_device msm_wlan_ar6000_pm_device = {
79 .name = "wlan_ar6000_pm_dev",
80 .id = -1,
81};
82
Taniya Dasc98bfbc2011-08-23 09:58:55 +053083static struct msm_gpio qup_i2c_gpios_io[] = {
84 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
85 "qup_scl" },
86 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
87 "qup_sda" },
88 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
89 "qup_scl" },
90 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
91 "qup_sda" },
92};
93
94static struct msm_gpio qup_i2c_gpios_hw[] = {
95 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
96 "qup_scl" },
97 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
98 "qup_sda" },
99 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
100 "qup_scl" },
101 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
102 "qup_sda" },
103};
104
105static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
106{
107 int rc;
108
109 if (adap_id < 0 || adap_id > 1)
110 return;
111
112 /* Each adapter gets 2 lines from the table */
113 if (config_type)
114 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
115 else
116 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
117 if (rc < 0)
118 pr_err("QUP GPIO request/enable failed: %d\n", rc);
119}
120
121static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
122 .clk_freq = 100000,
123 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
124};
125
126static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
127 .clk_freq = 100000,
128 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
129};
130
Trilok Sonib9410792012-04-07 15:37:13 +0530131#ifdef CONFIG_ARCH_MSM7X27A
Sravan Kumar D.V.Nd0b59d62012-04-17 15:08:14 +0530132#define MSM_PMEM_MDP_SIZE 0x2300000
Trilok Sonib9410792012-04-07 15:37:13 +0530133#define MSM_PMEM_ADSP_SIZE 0x1100000
134#endif
135
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530136static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +0530137 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530138};
139
140static struct platform_device android_usb_device = {
141 .name = "android_usb",
142 .id = -1,
143 .dev = {
144 .platform_data = &android_usb_pdata,
145 },
146};
147
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530148#ifdef CONFIG_USB_EHCI_MSM_72K
149static void msm_hsusb_vbus_power(unsigned phy_info, int on)
150{
151 int rc = 0;
152 unsigned gpio;
153
Chintan Pandya40762702011-12-06 13:47:06 +0530154 gpio = QRD_GPIO_HOST_VBUS_EN;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530155
156 rc = gpio_request(gpio, "i2c_host_vbus_en");
157 if (rc < 0) {
158 pr_err("failed to request %d GPIO\n", gpio);
159 return;
160 }
161 gpio_direction_output(gpio, !!on);
162 gpio_set_value_cansleep(gpio, !!on);
163 gpio_free(gpio);
164}
165
166static struct msm_usb_host_platform_data msm_usb_host_pdata = {
167 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
168};
169
170static void __init msm7627a_init_host(void)
171{
172 msm_add_host(0, &msm_usb_host_pdata);
173}
174#endif
175
176#ifdef CONFIG_USB_MSM_OTG_72K
177static int hsusb_rpc_connect(int connect)
178{
179 if (connect)
180 return msm_hsusb_rpc_connect();
181 else
182 return msm_hsusb_rpc_close();
183}
184
Pankaj Kumar27c02642011-09-22 15:55:55 +0530185static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530186static int msm_hsusb_ldo_init(int init)
187{
Pankaj Kumar27c02642011-09-22 15:55:55 +0530188 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530189
Pankaj Kumar27c02642011-09-22 15:55:55 +0530190 if (init) {
191 reg_hsusb = regulator_get(NULL, "usb");
192 if (IS_ERR(reg_hsusb)) {
193 rc = PTR_ERR(reg_hsusb);
194 pr_err("%s: could not get regulator: %d\n",
195 __func__, rc);
196 goto out;
197 }
198
199 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
200 if (rc) {
201 pr_err("%s: could not set voltage: %d\n",
202 __func__, rc);
203 goto reg_free;
204 }
205
206 return 0;
207 }
208 /* else fall through */
209reg_free:
210 regulator_put(reg_hsusb);
211out:
212 reg_hsusb = NULL;
213 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530214}
215
216static int msm_hsusb_ldo_enable(int enable)
217{
218 static int ldo_status;
219
Pankaj Kumar27c02642011-09-22 15:55:55 +0530220 if (IS_ERR_OR_NULL(reg_hsusb))
221 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530222
223 if (ldo_status == enable)
224 return 0;
225
226 ldo_status = enable;
227
Pankaj Kumar27c02642011-09-22 15:55:55 +0530228 return enable ?
229 regulator_enable(reg_hsusb) :
230 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530231}
232
233#ifndef CONFIG_USB_EHCI_MSM_72K
234static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
235{
236 int ret = 0;
237
238 if (init)
239 ret = msm_pm_app_rpc_init(callback);
240 else
241 msm_pm_app_rpc_deinit(callback);
242
243 return ret;
244}
245#endif
246
247static struct msm_otg_platform_data msm_otg_pdata = {
248#ifndef CONFIG_USB_EHCI_MSM_72K
249 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
250#else
251 .vbus_power = msm_hsusb_vbus_power,
252#endif
253 .rpc_connect = hsusb_rpc_connect,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530254 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
255 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
256 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
257 .se1_gating = SE1_GATING_DISABLE,
258 .ldo_init = msm_hsusb_ldo_init,
259 .ldo_enable = msm_hsusb_ldo_enable,
260 .chg_init = hsusb_chg_init,
261 .chg_connected = hsusb_chg_connected,
262 .chg_vbus_draw = hsusb_chg_vbus_draw,
263};
264#endif
265
266static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
267 .is_phy_status_timer_on = 1,
268};
269
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530270#ifdef CONFIG_SERIAL_MSM_HS
271static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
272 .inject_rx_on_wakeup = 1,
273 .rx_to_inject = 0xFD,
274};
275#endif
276static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
277 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
278 .idle_supported = 1,
279 .suspend_supported = 1,
280 .idle_enabled = 1,
281 .suspend_enabled = 1,
282 .latency = 16000,
283 .residency = 20000,
284 },
285 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
286 .idle_supported = 1,
287 .suspend_supported = 1,
288 .idle_enabled = 1,
289 .suspend_enabled = 1,
290 .latency = 12000,
291 .residency = 20000,
292 },
293 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
294 .idle_supported = 1,
295 .suspend_supported = 1,
296 .idle_enabled = 0,
297 .suspend_enabled = 1,
298 .latency = 2000,
299 .residency = 0,
300 },
301 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
302 .idle_supported = 1,
303 .suspend_supported = 1,
304 .idle_enabled = 1,
305 .suspend_enabled = 1,
306 .latency = 2,
307 .residency = 0,
308 },
309};
310
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600311static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530312 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
313 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600314};
315
Murali Nalajala4c996be2012-03-12 17:05:41 +0530316/* 8625 PM platform data */
317static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
318 /* CORE0 entries */
319 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
320 .idle_supported = 1,
321 .suspend_supported = 1,
322 .idle_enabled = 0,
323 .suspend_enabled = 0,
324 .latency = 16000,
325 .residency = 20000,
326 },
327
328 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
329 .idle_supported = 1,
330 .suspend_supported = 1,
331 .idle_enabled = 0,
332 .suspend_enabled = 0,
333 .latency = 12000,
334 .residency = 20000,
335 },
336
337 /* picked latency & redisdency values from 7x30 */
338 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
339 .idle_supported = 1,
340 .suspend_supported = 1,
341 .idle_enabled = 0,
342 .suspend_enabled = 0,
343 .latency = 500,
344 .residency = 6000,
345 },
346
347 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
348 .idle_supported = 1,
349 .suspend_supported = 1,
350 .idle_enabled = 1,
351 .suspend_enabled = 1,
352 .latency = 2,
353 .residency = 10,
354 },
355
356 /* picked latency & redisdency values from 7x30 */
357 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
358 .idle_supported = 1,
359 .suspend_supported = 1,
360 .idle_enabled = 0,
361 .suspend_enabled = 0,
362 .latency = 500,
363 .residency = 6000,
364 },
365
366 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
367 .idle_supported = 1,
368 .suspend_supported = 1,
369 .idle_enabled = 1,
370 .suspend_enabled = 1,
371 .latency = 2,
372 .residency = 10,
373 },
374
375};
376
377static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = {
378 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
379 .v_addr = MSM_CFG_CTL_BASE,
380};
381
Trilok Sonib9410792012-04-07 15:37:13 +0530382static struct android_pmem_platform_data android_pmem_adsp_pdata = {
383 .name = "pmem_adsp",
384 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
385 .cached = 1,
386 .memory_type = MEMTYPE_EBI1,
Taniya Das720c5c32012-05-18 14:08:14 +0530387 .request_region = request_fmem_c_region,
388 .release_region = release_fmem_c_region,
389 .reusable = 1,
Trilok Sonib9410792012-04-07 15:37:13 +0530390};
391
392static struct platform_device android_pmem_adsp_device = {
393 .name = "android_pmem",
394 .id = 1,
395 .dev = { .platform_data = &android_pmem_adsp_pdata },
396};
397
398static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
399static int __init pmem_mdp_size_setup(char *p)
400{
401 pmem_mdp_size = memparse(p, NULL);
402 return 0;
403}
404
405early_param("pmem_mdp_size", pmem_mdp_size_setup);
406
407static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
408static int __init pmem_adsp_size_setup(char *p)
409{
410 pmem_adsp_size = memparse(p, NULL);
411 return 0;
412}
413
414early_param("pmem_adsp_size", pmem_adsp_size_setup);
415
416#define SND(desc, num) { .name = #desc, .id = num }
417static struct snd_endpoint snd_endpoints_list[] = {
418 SND(HANDSET, 0),
419 SND(MONO_HEADSET, 2),
420 SND(HEADSET, 3),
421 SND(SPEAKER, 6),
422 SND(TTY_HEADSET, 8),
423 SND(TTY_VCO, 9),
424 SND(TTY_HCO, 10),
425 SND(BT, 12),
426 SND(IN_S_SADC_OUT_HANDSET, 16),
427 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
428 SND(FM_DIGITAL_STEREO_HEADSET, 26),
429 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
430 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
431 SND(STEREO_HEADSET_AND_SPEAKER, 31),
432 SND(CURRENT, 0x7FFFFFFE),
433 SND(FM_ANALOG_STEREO_HEADSET, 35),
434 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
435};
436#undef SND
437
438static struct msm_snd_endpoints msm_device_snd_endpoints = {
439 .endpoints = snd_endpoints_list,
440 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
441};
442
443static struct platform_device msm_device_snd = {
444 .name = "msm_snd",
445 .id = -1,
446 .dev = {
447 .platform_data = &msm_device_snd_endpoints
448 },
449};
450
451#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
452 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
453 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
454 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
455 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
456 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
457#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
458 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
459 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
460 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
461 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
462 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
463#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
464 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
465 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
466 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
467 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
468 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
469#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
470 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
471 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
472 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
473 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
474 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
475#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
476
477static unsigned int dec_concurrency_table[] = {
478 /* Audio LP */
479 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
480 0, 0, 0,
481
482 /* Concurrency 1 */
483 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
484 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
485 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
486 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
487 (DEC4_FORMAT),
488
489 /* Concurrency 2 */
490 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
491 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
492 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
493 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
494 (DEC4_FORMAT),
495
496 /* Concurrency 3 */
497 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
498 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
499 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
500 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
501 (DEC4_FORMAT),
502
503 /* Concurrency 4 */
504 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
505 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
506 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
507 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
508 (DEC4_FORMAT),
509
510 /* Concurrency 5 */
511 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
512 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
513 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
514 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
515 (DEC4_FORMAT),
516
517 /* Concurrency 6 */
Chaithanya Krishna Bacharaju72ab89b2012-05-11 14:24:04 +0530518 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|
519 (1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
520 0, 0, 0, 0,
Trilok Sonib9410792012-04-07 15:37:13 +0530521
522 /* Concurrency 7 */
523 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
524 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
525 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
526 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
527 (DEC4_FORMAT),
528};
529
530#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
531 .module_queueid = queueid, .module_decid = decid, \
532 .nr_codec_support = nr_codec}
533
534static struct msm_adspdec_info dec_info_list[] = {
535 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
536 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
537 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
538 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
539 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
540};
541
542static struct msm_adspdec_database msm_device_adspdec_database = {
543 .num_dec = ARRAY_SIZE(dec_info_list),
544 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
545 ARRAY_SIZE(dec_info_list)),
546 .dec_concurrency_table = dec_concurrency_table,
547 .dec_info_list = dec_info_list,
548};
549
550static struct platform_device msm_device_adspdec = {
551 .name = "msm_adspdec",
552 .id = -1,
553 .dev = {
554 .platform_data = &msm_device_adspdec_database
555 },
556};
557
558static struct android_pmem_platform_data android_pmem_audio_pdata = {
559 .name = "pmem_audio",
560 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
561 .cached = 0,
562 .memory_type = MEMTYPE_EBI1,
563};
564
565static struct platform_device android_pmem_audio_device = {
566 .name = "android_pmem",
567 .id = 2,
568 .dev = { .platform_data = &android_pmem_audio_pdata },
569};
570
571static struct android_pmem_platform_data android_pmem_pdata = {
572 .name = "pmem",
573 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
574 .cached = 1,
575 .memory_type = MEMTYPE_EBI1,
576};
577static struct platform_device android_pmem_device = {
578 .name = "android_pmem",
579 .id = 0,
580 .dev = { .platform_data = &android_pmem_pdata },
581};
582
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530583static u32 msm_calculate_batt_capacity(u32 current_voltage);
584
585static struct msm_psy_batt_pdata msm_psy_batt_data = {
Krishna Vanka9a265e12012-06-04 23:24:26 +0530586 .voltage_min_design = 3200,
587 .voltage_max_design = 4200,
588 .voltage_fail_safe = 3340,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530589 .avail_chg_sources = AC_CHG | USB_CHG ,
590 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
591 .calculate_capacity = &msm_calculate_batt_capacity,
592};
593
594static u32 msm_calculate_batt_capacity(u32 current_voltage)
595{
596 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
597 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
598
599 return (current_voltage - low_voltage) * 100
600 / (high_voltage - low_voltage);
601}
602
603static struct platform_device msm_batt_device = {
604 .name = "msm-battery",
605 .id = -1,
606 .dev.platform_data = &msm_psy_batt_data,
607};
608
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700609static char *msm_adc_surf_device_names[] = {
610 "XO_ADC",
611};
612
613static struct msm_adc_platform_data msm_adc_pdata = {
614 .dev_names = msm_adc_surf_device_names,
615 .num_adc = ARRAY_SIZE(msm_adc_surf_device_names),
616 .target_hw = MSM_8x25,
617};
618
619static struct platform_device msm_adc_device = {
620 .name = "msm_adc",
621 .id = -1,
622 .dev = {
623 .platform_data = &msm_adc_pdata,
624 },
625};
626
Taniya Das720c5c32012-05-18 14:08:14 +0530627static struct fmem_platform_data fmem_pdata;
628
629static struct platform_device fmem_device = {
630 .name = "fmem",
631 .id = 1,
632 .dev = { .platform_data = &fmem_pdata },
633};
634
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530635#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio, _active_low) \
636 [GPIO_VREG_ID_##_id] = { \
637 .init_data = { \
638 .constraints = { \
639 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
640 }, \
641 .num_consumer_supplies = \
642 ARRAY_SIZE(vreg_consumers_##_id), \
643 .consumer_supplies = vreg_consumers_##_id, \
644 }, \
645 .regulator_name = _reg_name, \
646 .active_low = _active_low, \
647 .gpio_label = _gpio_label, \
648 .gpio = _gpio, \
649 }
650
651#define GPIO_VREG_ID_EXT_2P85V 0
652#define GPIO_VREG_ID_EXT_1P8V 1
653
654static struct regulator_consumer_supply vreg_consumers_EXT_2P85V[] = {
655 REGULATOR_SUPPLY("cam0_avdd", "0-006c"),
656 REGULATOR_SUPPLY("cam1_avdd", "0-0078"),
657 REGULATOR_SUPPLY("lcd_vdd", "mipi_dsi.1"),
658};
659
660static struct regulator_consumer_supply vreg_consumers_EXT_1P8V[] = {
661 REGULATOR_SUPPLY("cam0_vdd", "0-006c"),
662 REGULATOR_SUPPLY("cam1_vdd", "0-0078"),
663 REGULATOR_SUPPLY("lcd_vddi", "mipi_dsi.1"),
664};
665
666/* GPIO regulator constraints */
667static struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] = {
668 GPIO_VREG_INIT(EXT_2P85V, "ext_2p85v", "ext_2p85v_en", 35, 0),
669 GPIO_VREG_INIT(EXT_1P8V, "ext_1p8v", "ext_1p8v_en", 40, 0),
670};
671
672/* GPIO regulator */
673static struct platform_device qrd_msm8625_vreg_gpio_ext_2p85v __devinitdata = {
674 .name = GPIO_REGULATOR_DEV_NAME,
675 .id = 35,
676 .dev = {
677 .platform_data =
678 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P85V],
679 },
680};
681
682static struct platform_device qrd_msm8625_vreg_gpio_ext_1p8v __devinitdata = {
683 .name = GPIO_REGULATOR_DEV_NAME,
684 .id = 40,
685 .dev = {
686 .platform_data =
687 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_1P8V],
688 },
689};
690
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530691static struct platform_device *common_devices[] __initdata = {
692 &android_usb_device,
Trilok Sonib9410792012-04-07 15:37:13 +0530693 &android_pmem_device,
694 &android_pmem_adsp_device,
695 &android_pmem_audio_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530696 &msm_batt_device,
Trilok Sonib9410792012-04-07 15:37:13 +0530697 &msm_device_adspdec,
698 &msm_device_snd,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530699 &asoc_msm_pcm,
700 &asoc_msm_dai0,
701 &asoc_msm_dai1,
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700702 &msm_adc_device,
Taniya Das720c5c32012-05-18 14:08:14 +0530703 &fmem_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530704};
705
706static struct platform_device *qrd7627a_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530707 &msm_device_dmov,
708 &msm_device_smd,
709 &msm_device_uart1,
710 &msm_device_uart_dm1,
711 &msm_gsbi0_qup_i2c_device,
712 &msm_gsbi1_qup_i2c_device,
713 &msm_device_otg,
714 &msm_device_gadget_peripheral,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530715 &msm_kgsl_3d0,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530716};
717
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530718static struct platform_device *qrd3_devices[] __initdata = {
719 &msm_device_nand,
720};
721
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530722static struct platform_device *msm8625_evb_devices[] __initdata = {
723 &msm8625_device_dmov,
724 &msm8625_device_smd,
725 &msm8625_gsbi0_qup_i2c_device,
726 &msm8625_gsbi1_qup_i2c_device,
727 &msm8625_device_uart1,
Ram Mohan Korukonda5ee9fb82012-03-09 12:10:01 +0530728 &msm8625_device_uart_dm1,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530729 &msm8625_device_otg,
730 &msm8625_device_gadget_peripheral,
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +0530731 &msm8625_kgsl_3d0,
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530732 &qrd_msm8625_vreg_gpio_ext_2p85v,
733 &qrd_msm8625_vreg_gpio_ext_1p8v,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530734};
735
Trilok Sonib9410792012-04-07 15:37:13 +0530736static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
737static int __init pmem_kernel_ebi1_size_setup(char *p)
738{
739 pmem_kernel_ebi1_size = memparse(p, NULL);
740 return 0;
741}
742early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
743
744static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
745static int __init pmem_audio_size_setup(char *p)
746{
747 pmem_audio_size = memparse(p, NULL);
748 return 0;
749}
750early_param("pmem_audio_size", pmem_audio_size_setup);
751
752static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
753 [MEMTYPE_SMI] = {
754 },
755 [MEMTYPE_EBI0] = {
756 .flags = MEMTYPE_FLAGS_1M_ALIGN,
757 },
758 [MEMTYPE_EBI1] = {
759 .flags = MEMTYPE_FLAGS_1M_ALIGN,
760 },
761};
762
Taniya Das720c5c32012-05-18 14:08:14 +0530763#ifdef CONFIG_ANDROID_PMEM
764static struct android_pmem_platform_data *pmem_pdata_array[] __initdata = {
765 &android_pmem_adsp_pdata,
766 &android_pmem_audio_pdata,
767 &android_pmem_pdata,
768};
769#endif
770
Trilok Sonib9410792012-04-07 15:37:13 +0530771static void __init size_pmem_devices(void)
772{
773#ifdef CONFIG_ANDROID_PMEM
Taniya Das720c5c32012-05-18 14:08:14 +0530774 unsigned int i;
775 unsigned int reusable_count = 0;
776
Trilok Sonib9410792012-04-07 15:37:13 +0530777 android_pmem_adsp_pdata.size = pmem_adsp_size;
778 android_pmem_pdata.size = pmem_mdp_size;
779 android_pmem_audio_pdata.size = pmem_audio_size;
Taniya Das720c5c32012-05-18 14:08:14 +0530780
781 fmem_pdata.size = 0;
782 fmem_pdata.align = PAGE_SIZE;
783
784 /* Find pmem devices that should use FMEM (reusable) memory.
785 */
786 for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i) {
787 struct android_pmem_platform_data *pdata = pmem_pdata_array[i];
788
789 if (!reusable_count && pdata->reusable)
790 fmem_pdata.size += pdata->size;
791
792 reusable_count += (pdata->reusable) ? 1 : 0;
793
794 if (pdata->reusable && reusable_count > 1) {
795 pr_err("%s: Too many PMEM devices specified as reusable. PMEM device %s was not configured as reusable.\n",
796 __func__, pdata->name);
797 pdata->reusable = 0;
798 }
799 }
800
Trilok Sonib9410792012-04-07 15:37:13 +0530801#endif
802}
803
804static void __init reserve_memory_for(struct android_pmem_platform_data *p)
805{
806 msm7627a_reserve_table[p->memory_type].size += p->size;
807}
808
809static void __init reserve_pmem_memory(void)
810{
811#ifdef CONFIG_ANDROID_PMEM
Taniya Das720c5c32012-05-18 14:08:14 +0530812 unsigned int i;
813 for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i)
814 reserve_memory_for(pmem_pdata_array[i]);
815
Trilok Sonib9410792012-04-07 15:37:13 +0530816 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
817#endif
818}
819
820static void __init msm7627a_calculate_reserve_sizes(void)
821{
822 size_pmem_devices();
823 reserve_pmem_memory();
824}
825
826static int msm7627a_paddr_to_memtype(unsigned int paddr)
827{
828 return MEMTYPE_EBI1;
829}
830
831static struct reserve_info msm7627a_reserve_info __initdata = {
832 .memtype_reserve_table = msm7627a_reserve_table,
833 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
834 .paddr_to_memtype = msm7627a_paddr_to_memtype,
835};
836
837static void __init msm7627a_reserve(void)
838{
839 reserve_info = &msm7627a_reserve_info;
840 msm_reserve();
841 memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32);
842}
843
844static void __init msm8625_reserve(void)
845{
846 memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
847 msm7627a_reserve();
848}
849
850static void msmqrd_adsp_add_pdev(void)
851{
852 int rc = 0;
853 struct rpc_board_dev *rpc_adsp_pdev;
854
855 rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL);
856 if (rpc_adsp_pdev == NULL) {
857 pr_err("%s: Memory Allocation failure\n", __func__);
858 return;
859 }
860 rpc_adsp_pdev->prog = ADSP_RPC_PROG;
861
862 if (cpu_is_msm8625())
863 rpc_adsp_pdev->pdev = msm8625_device_adsp;
864 else
865 rpc_adsp_pdev->pdev = msm_adsp_device;
866 rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1);
867 if (rc < 0) {
868 pr_err("%s: return val: %d\n", __func__, rc);
869 kfree(rpc_adsp_pdev);
870 }
871}
872
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530873static void __init msm7627a_device_i2c_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530874{
875 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
876 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
877}
878
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530879static void __init msm8625_device_i2c_init(void)
880{
881 msm8625_gsbi0_qup_i2c_device.dev.platform_data
882 = &msm_gsbi0_qup_i2c_pdata;
883 msm8625_gsbi1_qup_i2c_device.dev.platform_data
884 = &msm_gsbi1_qup_i2c_pdata;
885}
886
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530887static struct platform_device msm_proccomm_regulator_dev = {
888 .name = PROCCOMM_REGULATOR_DEV_NAME,
889 .id = -1,
890 .dev = {
891 .platform_data = &msm7x27a_proccomm_regulator_data
892 }
893};
894
895static void __init msm7627a_init_regulators(void)
896{
897 int rc = platform_device_register(&msm_proccomm_regulator_dev);
898 if (rc)
899 pr_err("%s: could not register regulator device: %d\n",
900 __func__, rc);
901}
902
Santosh Sajjan374d6592012-01-19 23:16:46 +0530903static int __init msm_qrd_init_ar6000pm(void)
904{
905 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
906 return platform_device_register(&msm_wlan_ar6000_pm_device);
907}
908
Taniya Dase380a2d2012-03-09 13:02:41 +0530909static void __init msm_add_footswitch_devices(void)
910{
911 platform_add_devices(msm_footswitch_devices,
912 msm_num_footswitch_devices);
913}
914
Stephen Boyd668d7652012-04-25 11:31:01 -0700915static void __init add_platform_devices(void)
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530916{
Aparna Mallavarapu5a326242012-05-09 19:49:02 +0530917 if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()
918 || machine_is_msm8625_evt()) {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530919 platform_add_devices(msm8625_evb_devices,
920 ARRAY_SIZE(msm8625_evb_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +0530921 platform_add_devices(qrd3_devices,
Taniya Dasbd096542012-03-15 17:43:45 +0530922 ARRAY_SIZE(qrd3_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +0530923 } else {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530924 platform_add_devices(qrd7627a_devices,
925 ARRAY_SIZE(qrd7627a_devices));
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530926 }
Taniya Dasbd096542012-03-15 17:43:45 +0530927
Aparna Mallavarapu0b69ca22012-03-26 15:58:35 +0530928 if (machine_is_msm7627a_qrd3() || machine_is_msm7627a_evb())
Taniya Dasbd096542012-03-15 17:43:45 +0530929 platform_add_devices(qrd3_devices,
Aparna Mallavarapu0b69ca22012-03-26 15:58:35 +0530930 ARRAY_SIZE(qrd3_devices));
Taniya Dasbd096542012-03-15 17:43:45 +0530931
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530932 platform_add_devices(common_devices,
933 ARRAY_SIZE(common_devices));
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530934}
935
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530936#define UART1DM_RX_GPIO 45
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530937static void __init qrd7627a_uart1dm_config(void)
938{
939 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
940 if (cpu_is_msm8625())
941 msm8625_device_uart_dm1.dev.platform_data =
942 &msm_uart_dm1_pdata;
943 else
944 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
945}
946
947static void __init qrd7627a_otg_gadget(void)
948{
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530949 if (cpu_is_msm8625()) {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +0530950 msm_otg_pdata.swfi_latency = msm8625_pm_data
951 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530952 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
953 msm8625_device_gadget_peripheral.dev.platform_data =
954 &msm_gadget_pdata;
955
956 } else {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +0530957 msm_otg_pdata.swfi_latency = msm7627a_pm_data
958 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530959 msm_device_otg.dev.platform_data = &msm_otg_pdata;
960 msm_device_gadget_peripheral.dev.platform_data =
961 &msm_gadget_pdata;
962 }
963}
964
Taniya Dasbd096542012-03-15 17:43:45 +0530965static void __init msm_pm_init(void)
966{
Taniya Dasbd096542012-03-15 17:43:45 +0530967
Aparna Mallavarapu6d969eb2012-04-03 15:10:25 +0530968 if (!cpu_is_msm8625()) {
Taniya Dasbd096542012-03-15 17:43:45 +0530969 msm_pm_set_platform_data(msm7627a_pm_data,
970 ARRAY_SIZE(msm7627a_pm_data));
971 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
972 } else {
973 msm_pm_set_platform_data(msm8625_pm_data,
974 ARRAY_SIZE(msm8625_pm_data));
975 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
976 msm8x25_spm_device_init();
977 }
978}
979
Taniya Dasc868a2e2012-01-03 10:18:47 +0530980static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530981{
982 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530983 msm7627a_init_regulators();
Trilok Sonib9410792012-04-07 15:37:13 +0530984 msmqrd_adsp_add_pdev();
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530985
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530986 if (cpu_is_msm8625())
987 msm8625_device_i2c_init();
988 else
989 msm7627a_device_i2c_init();
990
991 /* uart1dm*/
992 qrd7627a_uart1dm_config();
993 /*OTG gadget*/
994 qrd7627a_otg_gadget();
Taniya Dasc868a2e2012-01-03 10:18:47 +0530995
Taniya Dase380a2d2012-03-09 13:02:41 +0530996 msm_add_footswitch_devices();
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530997 add_platform_devices();
Taniya Dasc868a2e2012-01-03 10:18:47 +0530998
Santosh Sajjan374d6592012-01-19 23:16:46 +0530999 /* Ensure ar6000pm device is registered before MMC/SDC */
1000 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301001 msm7627a_init_mmc();
1002
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301003#ifdef CONFIG_USB_EHCI_MSM_72K
1004 msm7627a_init_host();
1005#endif
Taniya Dasbd096542012-03-15 17:43:45 +05301006 msm_pm_init();
Murali Nalajalaa1827842011-11-13 14:12:39 +05301007
Murali Nalajala2a0bbda2012-03-28 12:12:54 +05301008 msm_pm_register_irqs();
Taniya Das0a5303a2011-08-23 18:47:48 +05301009 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301010
1011#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301012 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301013#endif
Taniya Dasda408822011-09-06 12:54:06 +05301014
Chintan Pandya40762702011-12-06 13:47:06 +05301015 msm7627a_camera_init();
Chintan Pandya0d453192012-03-09 13:20:33 +05301016 qrd7627a_add_io_devices();
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +05301017 msm7x25a_kgsl_3d0_init();
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -07001018 msm8x25_kgsl_3d0_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301019}
1020
1021static void __init qrd7627a_init_early(void)
1022{
1023 msm_msm7627a_allocate_memory_regions();
1024}
1025
1026MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001027 .atag_offset = 0x100,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301028 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301029 .reserve = msm7627a_reserve,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301030 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301031 .init_machine = msm_qrd_init,
1032 .timer = &msm_timer,
1033 .init_early = qrd7627a_init_early,
1034 .handle_irq = vic_handle_irq,
1035MACHINE_END
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301036MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001037 .atag_offset = 0x100,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301038 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301039 .reserve = msm7627a_reserve,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301040 .init_irq = msm_init_irq,
1041 .init_machine = msm_qrd_init,
1042 .timer = &msm_timer,
1043 .init_early = qrd7627a_init_early,
1044 .handle_irq = vic_handle_irq,
1045MACHINE_END
Taniya Dasc868a2e2012-01-03 10:18:47 +05301046MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001047 .atag_offset = 0x100,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301048 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301049 .reserve = msm7627a_reserve,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301050 .init_irq = msm_init_irq,
1051 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301052 .timer = &msm_timer,
1053 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301054 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301055MACHINE_END
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301056MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001057 .atag_offset = 0x100,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301058 .map_io = msm8625_map_io,
Trilok Sonib9410792012-04-07 15:37:13 +05301059 .reserve = msm8625_reserve,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301060 .init_irq = msm8625_init_irq,
1061 .init_machine = msm_qrd_init,
1062 .timer = &msm_timer,
1063 .init_early = qrd7627a_init_early,
1064 .handle_irq = gic_handle_irq,
1065MACHINE_END
Taniya Dasbd096542012-03-15 17:43:45 +05301066MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001067 .atag_offset = 0x100,
Taniya Dasbd096542012-03-15 17:43:45 +05301068 .map_io = msm8625_map_io,
Trilok Sonib9410792012-04-07 15:37:13 +05301069 .reserve = msm8625_reserve,
Taniya Dasbd096542012-03-15 17:43:45 +05301070 .init_irq = msm8625_init_irq,
1071 .init_machine = msm_qrd_init,
1072 .timer = &msm_timer,
1073 .init_early = qrd7627a_init_early,
1074 .handle_irq = gic_handle_irq,
1075MACHINE_END
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301076MACHINE_START(MSM8625_EVT, "QRD MSM8625 EVT")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001077 .atag_offset = 0x100,
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301078 .map_io = msm8625_map_io,
1079 .reserve = msm8625_reserve,
1080 .init_irq = msm8625_init_irq,
1081 .init_machine = msm_qrd_init,
1082 .timer = &msm_timer,
1083 .init_early = qrd7627a_init_early,
1084 .handle_irq = gic_handle_irq,
1085MACHINE_END