blob: 9c80c8bb465dfff88826654d63be764b55a0c71f [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
Rajeshwar Kurapaty20d7ad12012-06-22 16:11:06 +0530133#define MSM_PMEM_ADSP_SIZE 0x1200000
Trilok Sonib9410792012-04-07 15:37:13 +0530134#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
Krishna Vankab3494692012-06-12 15:06:43 +0530599 if (current_voltage <= low_voltage)
600 return 0;
601 else if (current_voltage >= high_voltage)
602 return 100;
603 else
604 return (current_voltage - low_voltage) * 100
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530605 / (high_voltage - low_voltage);
606}
607
608static struct platform_device msm_batt_device = {
609 .name = "msm-battery",
610 .id = -1,
611 .dev.platform_data = &msm_psy_batt_data,
612};
613
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700614static char *msm_adc_surf_device_names[] = {
615 "XO_ADC",
616};
617
618static struct msm_adc_platform_data msm_adc_pdata = {
619 .dev_names = msm_adc_surf_device_names,
620 .num_adc = ARRAY_SIZE(msm_adc_surf_device_names),
621 .target_hw = MSM_8x25,
622};
623
624static struct platform_device msm_adc_device = {
625 .name = "msm_adc",
626 .id = -1,
627 .dev = {
628 .platform_data = &msm_adc_pdata,
629 },
630};
631
Taniya Das720c5c32012-05-18 14:08:14 +0530632static struct fmem_platform_data fmem_pdata;
633
634static struct platform_device fmem_device = {
635 .name = "fmem",
636 .id = 1,
637 .dev = { .platform_data = &fmem_pdata },
638};
639
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530640#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio, _active_low) \
641 [GPIO_VREG_ID_##_id] = { \
642 .init_data = { \
643 .constraints = { \
644 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
645 }, \
646 .num_consumer_supplies = \
647 ARRAY_SIZE(vreg_consumers_##_id), \
648 .consumer_supplies = vreg_consumers_##_id, \
649 }, \
650 .regulator_name = _reg_name, \
651 .active_low = _active_low, \
652 .gpio_label = _gpio_label, \
653 .gpio = _gpio, \
654 }
655
656#define GPIO_VREG_ID_EXT_2P85V 0
657#define GPIO_VREG_ID_EXT_1P8V 1
658
659static struct regulator_consumer_supply vreg_consumers_EXT_2P85V[] = {
Raju P.L.S.S.S.N4d01b2c2012-06-13 20:13:27 +0530660 REGULATOR_SUPPLY("cam_ov5647_avdd", "0-006c"),
661 REGULATOR_SUPPLY("cam_ov7692_avdd", "0-0078"),
662 REGULATOR_SUPPLY("cam_ov8825_avdd", "0-000d"),
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530663 REGULATOR_SUPPLY("lcd_vdd", "mipi_dsi.1"),
664};
665
666static struct regulator_consumer_supply vreg_consumers_EXT_1P8V[] = {
Raju P.L.S.S.S.N4d01b2c2012-06-13 20:13:27 +0530667 REGULATOR_SUPPLY("cam_ov5647_vdd", "0-006c"),
668 REGULATOR_SUPPLY("cam_ov7692_vdd", "0-0078"),
669 REGULATOR_SUPPLY("cam_ov8825_vdd", "0-000d"),
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530670 REGULATOR_SUPPLY("lcd_vddi", "mipi_dsi.1"),
671};
672
673/* GPIO regulator constraints */
674static struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] = {
675 GPIO_VREG_INIT(EXT_2P85V, "ext_2p85v", "ext_2p85v_en", 35, 0),
676 GPIO_VREG_INIT(EXT_1P8V, "ext_1p8v", "ext_1p8v_en", 40, 0),
677};
678
679/* GPIO regulator */
680static struct platform_device qrd_msm8625_vreg_gpio_ext_2p85v __devinitdata = {
681 .name = GPIO_REGULATOR_DEV_NAME,
682 .id = 35,
683 .dev = {
684 .platform_data =
685 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P85V],
686 },
687};
688
689static struct platform_device qrd_msm8625_vreg_gpio_ext_1p8v __devinitdata = {
690 .name = GPIO_REGULATOR_DEV_NAME,
691 .id = 40,
692 .dev = {
693 .platform_data =
694 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_1P8V],
695 },
696};
697
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530698static struct platform_device *common_devices[] __initdata = {
699 &android_usb_device,
Trilok Sonib9410792012-04-07 15:37:13 +0530700 &android_pmem_device,
701 &android_pmem_adsp_device,
702 &android_pmem_audio_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530703 &msm_batt_device,
Trilok Sonib9410792012-04-07 15:37:13 +0530704 &msm_device_adspdec,
705 &msm_device_snd,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530706 &asoc_msm_pcm,
707 &asoc_msm_dai0,
708 &asoc_msm_dai1,
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700709 &msm_adc_device,
Taniya Das720c5c32012-05-18 14:08:14 +0530710 &fmem_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530711};
712
713static struct platform_device *qrd7627a_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530714 &msm_device_dmov,
715 &msm_device_smd,
716 &msm_device_uart1,
717 &msm_device_uart_dm1,
718 &msm_gsbi0_qup_i2c_device,
719 &msm_gsbi1_qup_i2c_device,
720 &msm_device_otg,
721 &msm_device_gadget_peripheral,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530722 &msm_kgsl_3d0,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530723};
724
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530725static struct platform_device *qrd3_devices[] __initdata = {
726 &msm_device_nand,
727};
728
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530729static struct platform_device *msm8625_evb_devices[] __initdata = {
730 &msm8625_device_dmov,
731 &msm8625_device_smd,
732 &msm8625_gsbi0_qup_i2c_device,
733 &msm8625_gsbi1_qup_i2c_device,
734 &msm8625_device_uart1,
Ram Mohan Korukonda5ee9fb82012-03-09 12:10:01 +0530735 &msm8625_device_uart_dm1,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530736 &msm8625_device_otg,
737 &msm8625_device_gadget_peripheral,
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +0530738 &msm8625_kgsl_3d0,
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530739 &qrd_msm8625_vreg_gpio_ext_2p85v,
740 &qrd_msm8625_vreg_gpio_ext_1p8v,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530741};
742
Trilok Sonib9410792012-04-07 15:37:13 +0530743static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
744static int __init pmem_kernel_ebi1_size_setup(char *p)
745{
746 pmem_kernel_ebi1_size = memparse(p, NULL);
747 return 0;
748}
749early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
750
751static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
752static int __init pmem_audio_size_setup(char *p)
753{
754 pmem_audio_size = memparse(p, NULL);
755 return 0;
756}
757early_param("pmem_audio_size", pmem_audio_size_setup);
758
759static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
760 [MEMTYPE_SMI] = {
761 },
762 [MEMTYPE_EBI0] = {
763 .flags = MEMTYPE_FLAGS_1M_ALIGN,
764 },
765 [MEMTYPE_EBI1] = {
766 .flags = MEMTYPE_FLAGS_1M_ALIGN,
767 },
768};
769
Taniya Das720c5c32012-05-18 14:08:14 +0530770#ifdef CONFIG_ANDROID_PMEM
771static struct android_pmem_platform_data *pmem_pdata_array[] __initdata = {
772 &android_pmem_adsp_pdata,
773 &android_pmem_audio_pdata,
774 &android_pmem_pdata,
775};
776#endif
777
Trilok Sonib9410792012-04-07 15:37:13 +0530778static void __init size_pmem_devices(void)
779{
780#ifdef CONFIG_ANDROID_PMEM
Taniya Das720c5c32012-05-18 14:08:14 +0530781 unsigned int i;
782 unsigned int reusable_count = 0;
783
Trilok Sonib9410792012-04-07 15:37:13 +0530784 android_pmem_adsp_pdata.size = pmem_adsp_size;
785 android_pmem_pdata.size = pmem_mdp_size;
786 android_pmem_audio_pdata.size = pmem_audio_size;
Taniya Das720c5c32012-05-18 14:08:14 +0530787
788 fmem_pdata.size = 0;
789 fmem_pdata.align = PAGE_SIZE;
790
791 /* Find pmem devices that should use FMEM (reusable) memory.
792 */
793 for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i) {
794 struct android_pmem_platform_data *pdata = pmem_pdata_array[i];
795
796 if (!reusable_count && pdata->reusable)
797 fmem_pdata.size += pdata->size;
798
799 reusable_count += (pdata->reusable) ? 1 : 0;
800
801 if (pdata->reusable && reusable_count > 1) {
802 pr_err("%s: Too many PMEM devices specified as reusable. PMEM device %s was not configured as reusable.\n",
803 __func__, pdata->name);
804 pdata->reusable = 0;
805 }
806 }
807
Trilok Sonib9410792012-04-07 15:37:13 +0530808#endif
809}
810
811static void __init reserve_memory_for(struct android_pmem_platform_data *p)
812{
813 msm7627a_reserve_table[p->memory_type].size += p->size;
814}
815
816static void __init reserve_pmem_memory(void)
817{
818#ifdef CONFIG_ANDROID_PMEM
Taniya Das720c5c32012-05-18 14:08:14 +0530819 unsigned int i;
820 for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i)
821 reserve_memory_for(pmem_pdata_array[i]);
822
Trilok Sonib9410792012-04-07 15:37:13 +0530823 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
824#endif
825}
826
827static void __init msm7627a_calculate_reserve_sizes(void)
828{
829 size_pmem_devices();
830 reserve_pmem_memory();
831}
832
833static int msm7627a_paddr_to_memtype(unsigned int paddr)
834{
835 return MEMTYPE_EBI1;
836}
837
838static struct reserve_info msm7627a_reserve_info __initdata = {
839 .memtype_reserve_table = msm7627a_reserve_table,
840 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
841 .paddr_to_memtype = msm7627a_paddr_to_memtype,
842};
843
844static void __init msm7627a_reserve(void)
845{
846 reserve_info = &msm7627a_reserve_info;
847 msm_reserve();
848 memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32);
849}
850
851static void __init msm8625_reserve(void)
852{
853 memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
854 msm7627a_reserve();
855}
856
857static void msmqrd_adsp_add_pdev(void)
858{
859 int rc = 0;
860 struct rpc_board_dev *rpc_adsp_pdev;
861
862 rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL);
863 if (rpc_adsp_pdev == NULL) {
864 pr_err("%s: Memory Allocation failure\n", __func__);
865 return;
866 }
867 rpc_adsp_pdev->prog = ADSP_RPC_PROG;
868
869 if (cpu_is_msm8625())
870 rpc_adsp_pdev->pdev = msm8625_device_adsp;
871 else
872 rpc_adsp_pdev->pdev = msm_adsp_device;
873 rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1);
874 if (rc < 0) {
875 pr_err("%s: return val: %d\n", __func__, rc);
876 kfree(rpc_adsp_pdev);
877 }
878}
879
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530880static void __init msm7627a_device_i2c_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530881{
882 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
883 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
884}
885
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530886static void __init msm8625_device_i2c_init(void)
887{
888 msm8625_gsbi0_qup_i2c_device.dev.platform_data
889 = &msm_gsbi0_qup_i2c_pdata;
890 msm8625_gsbi1_qup_i2c_device.dev.platform_data
891 = &msm_gsbi1_qup_i2c_pdata;
892}
893
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530894static struct platform_device msm_proccomm_regulator_dev = {
895 .name = PROCCOMM_REGULATOR_DEV_NAME,
896 .id = -1,
897 .dev = {
898 .platform_data = &msm7x27a_proccomm_regulator_data
899 }
900};
901
902static void __init msm7627a_init_regulators(void)
903{
904 int rc = platform_device_register(&msm_proccomm_regulator_dev);
905 if (rc)
906 pr_err("%s: could not register regulator device: %d\n",
907 __func__, rc);
908}
909
Santosh Sajjan374d6592012-01-19 23:16:46 +0530910static int __init msm_qrd_init_ar6000pm(void)
911{
912 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
913 return platform_device_register(&msm_wlan_ar6000_pm_device);
914}
915
Taniya Dase380a2d2012-03-09 13:02:41 +0530916static void __init msm_add_footswitch_devices(void)
917{
918 platform_add_devices(msm_footswitch_devices,
919 msm_num_footswitch_devices);
920}
921
Stephen Boyd668d7652012-04-25 11:31:01 -0700922static void __init add_platform_devices(void)
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530923{
Aparna Mallavarapu5a326242012-05-09 19:49:02 +0530924 if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()
925 || machine_is_msm8625_evt()) {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530926 platform_add_devices(msm8625_evb_devices,
927 ARRAY_SIZE(msm8625_evb_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +0530928 platform_add_devices(qrd3_devices,
Taniya Dasbd096542012-03-15 17:43:45 +0530929 ARRAY_SIZE(qrd3_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +0530930 } else {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530931 platform_add_devices(qrd7627a_devices,
932 ARRAY_SIZE(qrd7627a_devices));
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530933 }
Taniya Dasbd096542012-03-15 17:43:45 +0530934
Aparna Mallavarapu0b69ca22012-03-26 15:58:35 +0530935 if (machine_is_msm7627a_qrd3() || machine_is_msm7627a_evb())
Taniya Dasbd096542012-03-15 17:43:45 +0530936 platform_add_devices(qrd3_devices,
Aparna Mallavarapu0b69ca22012-03-26 15:58:35 +0530937 ARRAY_SIZE(qrd3_devices));
Taniya Dasbd096542012-03-15 17:43:45 +0530938
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530939 platform_add_devices(common_devices,
940 ARRAY_SIZE(common_devices));
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530941}
942
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530943#define UART1DM_RX_GPIO 45
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530944static void __init qrd7627a_uart1dm_config(void)
945{
946 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
947 if (cpu_is_msm8625())
948 msm8625_device_uart_dm1.dev.platform_data =
949 &msm_uart_dm1_pdata;
950 else
951 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
952}
953
954static void __init qrd7627a_otg_gadget(void)
955{
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530956 if (cpu_is_msm8625()) {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +0530957 msm_otg_pdata.swfi_latency = msm8625_pm_data
958 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530959 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
960 msm8625_device_gadget_peripheral.dev.platform_data =
961 &msm_gadget_pdata;
962
963 } else {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +0530964 msm_otg_pdata.swfi_latency = msm7627a_pm_data
965 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530966 msm_device_otg.dev.platform_data = &msm_otg_pdata;
967 msm_device_gadget_peripheral.dev.platform_data =
968 &msm_gadget_pdata;
969 }
970}
971
Taniya Dasbd096542012-03-15 17:43:45 +0530972static void __init msm_pm_init(void)
973{
Taniya Dasbd096542012-03-15 17:43:45 +0530974
Aparna Mallavarapu6d969eb2012-04-03 15:10:25 +0530975 if (!cpu_is_msm8625()) {
Taniya Dasbd096542012-03-15 17:43:45 +0530976 msm_pm_set_platform_data(msm7627a_pm_data,
977 ARRAY_SIZE(msm7627a_pm_data));
978 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
979 } else {
980 msm_pm_set_platform_data(msm8625_pm_data,
981 ARRAY_SIZE(msm8625_pm_data));
982 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
983 msm8x25_spm_device_init();
984 }
985}
986
Taniya Dasc868a2e2012-01-03 10:18:47 +0530987static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530988{
989 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530990 msm7627a_init_regulators();
Trilok Sonib9410792012-04-07 15:37:13 +0530991 msmqrd_adsp_add_pdev();
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530992
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530993 if (cpu_is_msm8625())
994 msm8625_device_i2c_init();
995 else
996 msm7627a_device_i2c_init();
997
998 /* uart1dm*/
999 qrd7627a_uart1dm_config();
1000 /*OTG gadget*/
1001 qrd7627a_otg_gadget();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301002
Taniya Dase380a2d2012-03-09 13:02:41 +05301003 msm_add_footswitch_devices();
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301004 add_platform_devices();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301005
Santosh Sajjan374d6592012-01-19 23:16:46 +05301006 /* Ensure ar6000pm device is registered before MMC/SDC */
1007 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301008 msm7627a_init_mmc();
1009
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301010#ifdef CONFIG_USB_EHCI_MSM_72K
1011 msm7627a_init_host();
1012#endif
Taniya Dasbd096542012-03-15 17:43:45 +05301013 msm_pm_init();
Murali Nalajalaa1827842011-11-13 14:12:39 +05301014
Murali Nalajala2a0bbda2012-03-28 12:12:54 +05301015 msm_pm_register_irqs();
Taniya Das0a5303a2011-08-23 18:47:48 +05301016 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301017
1018#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301019 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301020#endif
Taniya Dasda408822011-09-06 12:54:06 +05301021
Chintan Pandya40762702011-12-06 13:47:06 +05301022 msm7627a_camera_init();
Chintan Pandya0d453192012-03-09 13:20:33 +05301023 qrd7627a_add_io_devices();
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +05301024 msm7x25a_kgsl_3d0_init();
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -07001025 msm8x25_kgsl_3d0_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301026}
1027
1028static void __init qrd7627a_init_early(void)
1029{
1030 msm_msm7627a_allocate_memory_regions();
1031}
1032
1033MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001034 .atag_offset = 0x100,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301035 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301036 .reserve = msm7627a_reserve,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301037 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301038 .init_machine = msm_qrd_init,
1039 .timer = &msm_timer,
1040 .init_early = qrd7627a_init_early,
1041 .handle_irq = vic_handle_irq,
1042MACHINE_END
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301043MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001044 .atag_offset = 0x100,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301045 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301046 .reserve = msm7627a_reserve,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301047 .init_irq = msm_init_irq,
1048 .init_machine = msm_qrd_init,
1049 .timer = &msm_timer,
1050 .init_early = qrd7627a_init_early,
1051 .handle_irq = vic_handle_irq,
1052MACHINE_END
Taniya Dasc868a2e2012-01-03 10:18:47 +05301053MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001054 .atag_offset = 0x100,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301055 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301056 .reserve = msm7627a_reserve,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301057 .init_irq = msm_init_irq,
1058 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301059 .timer = &msm_timer,
1060 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301061 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301062MACHINE_END
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301063MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001064 .atag_offset = 0x100,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301065 .map_io = msm8625_map_io,
Trilok Sonib9410792012-04-07 15:37:13 +05301066 .reserve = msm8625_reserve,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301067 .init_irq = msm8625_init_irq,
1068 .init_machine = msm_qrd_init,
1069 .timer = &msm_timer,
1070 .init_early = qrd7627a_init_early,
1071 .handle_irq = gic_handle_irq,
1072MACHINE_END
Taniya Dasbd096542012-03-15 17:43:45 +05301073MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001074 .atag_offset = 0x100,
Taniya Dasbd096542012-03-15 17:43:45 +05301075 .map_io = msm8625_map_io,
Trilok Sonib9410792012-04-07 15:37:13 +05301076 .reserve = msm8625_reserve,
Taniya Dasbd096542012-03-15 17:43:45 +05301077 .init_irq = msm8625_init_irq,
1078 .init_machine = msm_qrd_init,
1079 .timer = &msm_timer,
1080 .init_early = qrd7627a_init_early,
1081 .handle_irq = gic_handle_irq,
1082MACHINE_END
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301083MACHINE_START(MSM8625_EVT, "QRD MSM8625 EVT")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001084 .atag_offset = 0x100,
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301085 .map_io = msm8625_map_io,
1086 .reserve = msm8625_reserve,
1087 .init_irq = msm8625_init_irq,
1088 .init_machine = msm_qrd_init,
1089 .timer = &msm_timer,
1090 .init_early = qrd7627a_init_early,
1091 .handle_irq = gic_handle_irq,
1092MACHINE_END