blob: de423717275d80394ccd10d388cc8dc7d39c7bc8 [file] [log] [blame]
Harini Jayaramana9873ab2011-12-20 17:29:48 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
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 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070047#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050
51#include <mach/board.h>
52#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#include <mach/msm_spi.h>
54#ifdef CONFIG_USB_MSM_OTG_72K
55#include <mach/msm_hsusb.h>
56#else
57#include <linux/usb/msm_hsusb.h>
58#endif
59#include <linux/usb/android.h>
60#include <mach/usbdiag.h>
61#include <mach/socinfo.h>
62#include <mach/rpm.h>
63#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070064#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065#include <mach/msm_bus_board.h>
66#include <mach/msm_memtypes.h>
67#include <mach/dma.h>
68#include <mach/msm_dsps.h>
69#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070070#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080071
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053073#include <linux/mfd/wcd9xxx/core.h>
74#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#endif
76
Laura Abbottd6183792011-08-19 13:42:24 -070077#include <linux/ion.h>
78#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080079#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080080#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080081#include <mach/msm_rtb.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082
Larry Bassel41a055b2011-12-06 16:15:14 -080083#include <linux/fmem.h>
84
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080086#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080089#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080090#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080091#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "rpm_resources.h"
93#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070094#include "acpuclock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070095#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060096#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070097#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080098
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099static struct platform_device msm_fm_platform_init = {
100 .name = "iris_fm",
101 .id = -1,
102};
103
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104#define KS8851_RST_GPIO 89
105#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530106#define HAP_SHIFT_LVL_OE_GPIO 47
107
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700108#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700109
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800110struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700111 [SX150X_CAM] = {
112 .gpio_base = GPIO_CAM_EXPANDER_BASE,
113 .oscio_is_gpo = false,
114 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530115 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700116 .io_open_drain_ena = 0x0,
117 .irq_summary = -1,
118 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200119 [SX150X_LIQUID] = {
120 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
121 .oscio_is_gpo = false,
122 .io_pullup_ena = 0x0c08,
123 .io_pulldn_ena = 0x4060,
124 .io_open_drain_ena = 0x000c,
125 .io_polarity = 0,
126 .irq_summary = -1,
127 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700128};
Nishant Pandit474f2252011-07-23 23:17:56 +0530129
130#endif
131
Olav Haugana21169d2012-01-04 09:17:06 -0800132#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800133#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800134#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800135#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800136#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700137
138#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -0800139#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Hauganb88eef12012-01-15 10:59:26 -0800140#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan42ebe712012-01-10 16:30:58 -0800141#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb88eef12012-01-15 10:59:26 -0800142#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -0800143#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800144#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800145#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
146#define MSM_ION_HEAP_NUM 8
Olav Hauganb5be7992011-11-18 14:29:02 -0800147#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800148#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
149#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
150static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700152#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800153#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700154#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700155
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700156#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
157static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
158static int __init pmem_kernel_ebi1_size_setup(char *p)
159{
160 pmem_kernel_ebi1_size = memparse(p, NULL);
161 return 0;
162}
163early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
164#endif
165
166#ifdef CONFIG_ANDROID_PMEM
167static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800168static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169static int __init pmem_size_setup(char *p)
170{
171 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800172 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 return 0;
174}
175early_param("pmem_size", pmem_size_setup);
176
177static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
178
179static int __init pmem_adsp_size_setup(char *p)
180{
181 pmem_adsp_size = memparse(p, NULL);
182 return 0;
183}
184early_param("pmem_adsp_size", pmem_adsp_size_setup);
185
186static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
187
188static int __init pmem_audio_size_setup(char *p)
189{
190 pmem_audio_size = memparse(p, NULL);
191 return 0;
192}
193early_param("pmem_audio_size", pmem_audio_size_setup);
194#endif
195
196#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700197#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198static struct android_pmem_platform_data android_pmem_pdata = {
199 .name = "pmem",
200 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
201 .cached = 1,
202 .memory_type = MEMTYPE_EBI1,
203};
204
205static struct platform_device android_pmem_device = {
206 .name = "android_pmem",
207 .id = 0,
208 .dev = {.platform_data = &android_pmem_pdata},
209};
210
211static struct android_pmem_platform_data android_pmem_adsp_pdata = {
212 .name = "pmem_adsp",
213 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
214 .cached = 0,
215 .memory_type = MEMTYPE_EBI1,
216};
217static struct platform_device android_pmem_adsp_device = {
218 .name = "android_pmem",
219 .id = 2,
220 .dev = { .platform_data = &android_pmem_adsp_pdata },
221};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700222#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223
224static struct android_pmem_platform_data android_pmem_audio_pdata = {
225 .name = "pmem_audio",
226 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
227 .cached = 0,
228 .memory_type = MEMTYPE_EBI1,
229};
230
231static struct platform_device android_pmem_audio_device = {
232 .name = "android_pmem",
233 .id = 4,
234 .dev = { .platform_data = &android_pmem_audio_pdata },
235};
236#endif
237
Larry Bassel41a055b2011-12-06 16:15:14 -0800238struct fmem_platform_data fmem_pdata = {
239};
240
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700241#define DSP_RAM_BASE_8960 0x8da00000
242#define DSP_RAM_SIZE_8960 0x1800000
243static int dspcrashd_pdata_8960 = 0xDEADDEAD;
244
245static struct resource resources_dspcrashd_8960[] = {
246 {
247 .name = "msm_dspcrashd",
248 .start = DSP_RAM_BASE_8960,
249 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
250 .flags = IORESOURCE_DMA,
251 },
252};
253
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800254static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700255 .name = "msm_dspcrashd",
256 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
257 .resource = resources_dspcrashd_8960,
258 .dev = { .platform_data = &dspcrashd_pdata_8960 },
259};
260
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261static struct memtype_reserve msm8960_reserve_table[] __initdata = {
262 [MEMTYPE_SMI] = {
263 },
264 [MEMTYPE_EBI0] = {
265 .flags = MEMTYPE_FLAGS_1M_ALIGN,
266 },
267 [MEMTYPE_EBI1] = {
268 .flags = MEMTYPE_FLAGS_1M_ALIGN,
269 },
270};
271
Laura Abbottf8c03b92012-02-16 14:57:58 -0800272#if defined(CONFIG_MSM_RTB)
273static struct msm_rtb_platform_data msm_rtb_pdata = {
274 .size = SZ_1M,
275};
276
277static int __init msm_rtb_set_buffer_size(char *p)
278{
279 int s;
280
281 s = memparse(p, NULL);
282 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
283 return 0;
284}
285early_param("msm_rtb_size", msm_rtb_set_buffer_size);
286
287
288static struct platform_device msm_rtb_device = {
289 .name = "msm_rtb",
290 .id = -1,
291 .dev = {
292 .platform_data = &msm_rtb_pdata,
293 },
294};
295#endif
296
297static void __init reserve_rtb_memory(void)
298{
299#if defined(CONFIG_MSM_RTB)
300 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
301#endif
302}
303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700304static void __init size_pmem_devices(void)
305{
306#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700307#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800309
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800310 if (!pmem_param_set) {
311 if (machine_is_msm8960_liquid())
312 pmem_size = MSM_LIQUID_PMEM_SIZE;
313 if (hdmi_is_primary)
314 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
315 }
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700318#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700319 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
320#endif
321}
322
323static void __init reserve_memory_for(struct android_pmem_platform_data *p)
324{
325 msm8960_reserve_table[p->memory_type].size += p->size;
326}
327
328static void __init reserve_pmem_memory(void)
329{
330#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700331#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332 reserve_memory_for(&android_pmem_adsp_pdata);
333 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700334#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335 reserve_memory_for(&android_pmem_audio_pdata);
336 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
337#endif
338}
339
Larry Basselb4126da2011-07-18 14:31:33 -0700340static int msm8960_paddr_to_memtype(unsigned int paddr)
341{
342 return MEMTYPE_EBI1;
343}
344
Olav Hauganf6dc7742012-02-15 09:11:55 -0800345#define FMEM_ENABLED 1
346
Laura Abbottd6183792011-08-19 13:42:24 -0700347#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800348#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
349static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
350 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800351 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800352 .reusable = FMEM_ENABLED,
353 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800354};
355
356static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
357 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800358 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800359 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800360 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800361};
362
363static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800364 .adjacent_mem_id = INVALID_HEAP_ID,
365 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800366 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800367};
368
369static struct ion_co_heap_pdata fw_co_ion_pdata = {
370 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
371 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800372 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800373};
374#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800375
376/**
377 * These heaps are listed in the order they will be allocated. Due to
378 * video hardware restrictions and content protection the FW heap has to
379 * be allocated adjacent (below) the MM heap and the MFC heap has to be
380 * allocated after the MM heap to ensure MFC heap is not more than 256MB
381 * away from the base address of the FW heap.
382 * However, the order of FW heap and MM heap doesn't matter since these
383 * two heaps are taken care of by separate code to ensure they are adjacent
384 * to each other.
385 * Don't swap the order unless you know what you are doing!
386 */
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800387static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700388 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700389 .heaps = {
390 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800391 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700392 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700393 .name = ION_VMALLOC_HEAP_NAME,
394 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700395#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700396 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800397 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800398 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800399 .name = ION_MM_HEAP_NAME,
400 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700401 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800402 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700403 },
Laura Abbott8c017362011-09-22 20:59:12 -0700404 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800405 .id = ION_MM_FIRMWARE_HEAP_ID,
406 .type = ION_HEAP_TYPE_CARVEOUT,
407 .name = ION_MM_FIRMWARE_HEAP_NAME,
408 .size = MSM_ION_MM_FW_SIZE,
409 .memory_type = ION_EBI_TYPE,
410 .extra_data = (void *) &fw_co_ion_pdata,
411 },
412 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800413 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800414 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800415 .name = ION_MFC_HEAP_NAME,
416 .size = MSM_ION_MFC_SIZE,
417 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800418 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800419 },
420 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800421 .id = ION_SF_HEAP_ID,
422 .type = ION_HEAP_TYPE_CARVEOUT,
423 .name = ION_SF_HEAP_NAME,
424 .size = MSM_ION_SF_SIZE,
425 .memory_type = ION_EBI_TYPE,
426 .extra_data = (void *) &co_ion_pdata,
427 },
428 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800429 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700430 .type = ION_HEAP_TYPE_IOMMU,
431 .name = ION_IOMMU_HEAP_NAME,
432 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800433 {
434 .id = ION_QSECOM_HEAP_ID,
435 .type = ION_HEAP_TYPE_CARVEOUT,
436 .name = ION_QSECOM_HEAP_NAME,
437 .size = MSM_ION_QSECOM_SIZE,
438 .memory_type = ION_EBI_TYPE,
439 .extra_data = (void *) &co_ion_pdata,
440 },
Olav Haugan7355db02012-01-13 16:59:13 -0800441 {
442 .id = ION_AUDIO_HEAP_ID,
443 .type = ION_HEAP_TYPE_CARVEOUT,
444 .name = ION_AUDIO_HEAP_NAME,
445 .size = MSM_ION_AUDIO_SIZE,
446 .memory_type = ION_EBI_TYPE,
447 .extra_data = (void *) &co_ion_pdata,
448 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700449#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700450 }
451};
452
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800453static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700454 .name = "ion-msm",
455 .id = 1,
456 .dev = { .platform_data = &ion_pdata },
457};
458#endif
459
Larry Bassel41a055b2011-12-06 16:15:14 -0800460struct platform_device fmem_device = {
461 .name = "fmem",
462 .id = 1,
463 .dev = { .platform_data = &fmem_pdata },
464};
465
Olav Haugan65f4bd82011-12-13 11:50:08 -0800466static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700467{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800468 unsigned int i;
469
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800470 if (!pmem_param_set) {
471 if (machine_is_msm8960_liquid())
472 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
473
474 if (hdmi_is_primary)
475 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
476
477 if (machine_is_msm8960_liquid() || hdmi_is_primary) {
478 for (i = 0; i < ion_pdata.nr; i++) {
479 if (ion_pdata.heaps[i].id == ION_SF_HEAP_ID) {
480 ion_pdata.heaps[i].size =
481 msm_ion_sf_size;
482 pr_debug("msm_ion_sf_size 0x%x\n",
483 msm_ion_sf_size);
484 break;
485 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800486 }
487 }
488 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800489}
490
491static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
492 unsigned long size)
493{
494 msm8960_reserve_table[mem_type].size += size;
495}
496
Olav Haugan65f4bd82011-12-13 11:50:08 -0800497/**
498 * Reserve memory for ION and calculate amount of reusable memory for fmem.
499 * We only reserve memory for heaps that are not reusable. However, we only
500 * support one reusable heap at the moment so we ignore the reusable flag for
501 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800502 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
503 * at a higher address than FW in addition to not more than 256MB away from the
504 * base address of the firmware. This means that if MM is reusable the other
505 * two heaps must be allocated in the same region as FW. This is handled by the
506 * mem_is_fmem flag in the platform data. In addition the MM heap must be
507 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800508 */
509static void __init reserve_ion_memory(void)
510{
511#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
512 unsigned int i;
513 unsigned int reusable_count = 0;
514
515 adjust_mem_for_liquid();
516 fmem_pdata.size = 0;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800517 fmem_pdata.reserved_size_low = 0;
518 fmem_pdata.reserved_size_high = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800519
520 /* We only support 1 reusable heap. Check if more than one heap
521 * is specified as reusable and set as non-reusable if found.
522 */
523 for (i = 0; i < ion_pdata.nr; ++i) {
524 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
525
526 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
527 struct ion_cp_heap_pdata *data = heap->extra_data;
528
529 reusable_count += (data->reusable) ? 1 : 0;
530
531 if (data->reusable && reusable_count > 1) {
532 pr_err("%s: Too many heaps specified as "
533 "reusable. Heap %s was not configured "
534 "as reusable.\n", __func__, heap->name);
535 data->reusable = 0;
536 }
537 }
538 }
539
540 for (i = 0; i < ion_pdata.nr; ++i) {
541 int reusable = 0;
542 int adjacent_heap_id = INVALID_HEAP_ID;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800543 int mem_is_fmem = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800544 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
545
546 if (heap->extra_data) {
547 switch (heap->type) {
548 case ION_HEAP_TYPE_CP:
549 reusable = ((struct ion_cp_heap_pdata *)
550 heap->extra_data)->reusable;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800551 mem_is_fmem = ((struct ion_cp_heap_pdata *)
552 heap->extra_data)->mem_is_fmem;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800553 break;
554 case ION_HEAP_TYPE_CARVEOUT:
555 adjacent_heap_id = ((struct ion_co_heap_pdata *)
556 heap->extra_data)->adjacent_mem_id;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800557 mem_is_fmem = ((struct ion_co_heap_pdata *)
558 heap->extra_data)->mem_is_fmem;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800559 break;
560 default:
561 break;
562 }
563 }
564
Olav Hauganf6dc7742012-02-15 09:11:55 -0800565 if (mem_is_fmem && !reusable) {
566 if (adjacent_heap_id != INVALID_HEAP_ID)
567 fmem_pdata.reserved_size_low += heap->size;
568 else
569 fmem_pdata.reserved_size_high += heap->size;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800570 }
Olav Hauganf6dc7742012-02-15 09:11:55 -0800571 if (mem_is_fmem)
Olav Haugan65f4bd82011-12-13 11:50:08 -0800572 fmem_pdata.size += heap->size;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800573 else
574 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800575 }
Laura Abbottd6183792011-08-19 13:42:24 -0700576#endif
577}
Huaibin Yanga5419422011-12-08 23:52:10 -0800578
579static void __init reserve_mdp_memory(void)
580{
581 msm8960_mdp_writeback(msm8960_reserve_table);
582}
583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584static void __init msm8960_calculate_reserve_sizes(void)
585{
586 size_pmem_devices();
587 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700588 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800589 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800590 reserve_rtb_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591}
592
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700593static struct reserve_info msm8960_reserve_info __initdata = {
594 .memtype_reserve_table = msm8960_reserve_table,
595 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
596 .paddr_to_memtype = msm8960_paddr_to_memtype,
597};
598
Larry Basselb4126da2011-07-18 14:31:33 -0700599static int msm8960_memory_bank_size(void)
600{
601 return 1<<29;
602}
603
604static void __init locate_unstable_memory(void)
605{
606 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
607 unsigned long bank_size;
608 unsigned long low, high;
609
610 bank_size = msm8960_memory_bank_size();
611 low = meminfo.bank[0].start;
612 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700613
614 /* Check if 32 bit overflow occured */
615 if (high < mb->start)
616 high = ~0UL;
617
Larry Basselb4126da2011-07-18 14:31:33 -0700618 low &= ~(bank_size - 1);
619
620 if (high - low <= bank_size)
621 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800622
623 msm8960_reserve_info.bank_size = bank_size;
624#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800625 msm8960_reserve_info.low_unstable_address = mb->start -
626 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800627 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700628 pr_info("low unstable address %lx max size %lx bank size %lx\n",
629 msm8960_reserve_info.low_unstable_address,
630 msm8960_reserve_info.max_unstable_size,
631 msm8960_reserve_info.bank_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800632#else
633 msm8960_reserve_info.low_unstable_address = 0;
634 msm8960_reserve_info.max_unstable_size = 0;
635#endif
Larry Basselb4126da2011-07-18 14:31:33 -0700636}
637
Larry Basselb830e182011-10-14 10:46:55 -0700638static void __init place_movable_zone(void)
639{
Larry Basselb8d61022012-02-24 10:49:45 -0800640#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700641 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
642 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
643 pr_info("movable zone start %lx size %lx\n",
644 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800645#endif
Larry Basselb830e182011-10-14 10:46:55 -0700646}
647
648static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700649{
650 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700651 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700652 place_movable_zone();
653}
654
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800655static char prim_panel_name[PANEL_NAME_MAX_LEN];
656static char ext_panel_name[PANEL_NAME_MAX_LEN];
657static int __init prim_display_setup(char *param)
658{
659 if (strnlen(param, PANEL_NAME_MAX_LEN))
660 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
661 return 0;
662}
663early_param("prim_display", prim_display_setup);
664
665static int __init ext_display_setup(char *param)
666{
667 if (strnlen(param, PANEL_NAME_MAX_LEN))
668 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
669 return 0;
670}
671early_param("ext_display", ext_display_setup);
672
Larry Basselb830e182011-10-14 10:46:55 -0700673static void __init msm8960_reserve(void)
674{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800675 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700676 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800677 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678}
679
Larry Bassela4414b12011-08-04 11:11:02 -0700680static int msm8960_change_memory_power(u64 start, u64 size,
681 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700682{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700683 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700684}
685
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700686static void __init msm8960_allocate_memory_regions(void)
687{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800688 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700689}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800690
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691#ifdef CONFIG_WCD9310_CODEC
692
693#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
694
Patrick Lai3043fba2011-08-01 14:15:57 -0700695/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
696 * 4 micbiases are used to power various analog and digital
697 * microphones operating at 1800 mV. Technically, all micbiases
698 * can source from single cfilter since all microphones operate
699 * at the same voltage level. The arrangement below is to make
700 * sure all cfilters are exercised. LDO_H regulator ouput level
701 * does not need to be as high as 2.85V. It is choosen for
702 * microphone sensitivity purpose.
703 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530704static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700705 .slimbus_slave_device = {
706 .name = "tabla-slave",
707 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
708 },
709 .irq = MSM_GPIO_TO_INT(62),
710 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530711 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700713 .micbias = {
714 .ldoh_v = TABLA_LDOH_2P85_V,
715 .cfilt1_mv = 1800,
716 .cfilt2_mv = 1800,
717 .cfilt3_mv = 1800,
718 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
719 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
720 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
721 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530722 },
723 .regulator = {
724 {
725 .name = "CDC_VDD_CP",
726 .min_uV = 1800000,
727 .max_uV = 1800000,
728 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
729 },
730 {
731 .name = "CDC_VDDA_RX",
732 .min_uV = 1800000,
733 .max_uV = 1800000,
734 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
735 },
736 {
737 .name = "CDC_VDDA_TX",
738 .min_uV = 1800000,
739 .max_uV = 1800000,
740 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
741 },
742 {
743 .name = "VDDIO_CDC",
744 .min_uV = 1800000,
745 .max_uV = 1800000,
746 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
747 },
748 {
749 .name = "VDDD_CDC_D",
750 .min_uV = 1225000,
751 .max_uV = 1225000,
752 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
753 },
754 {
755 .name = "CDC_VDDA_A_1P2V",
756 .min_uV = 1225000,
757 .max_uV = 1225000,
758 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
759 },
760 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761};
762
763static struct slim_device msm_slim_tabla = {
764 .name = "tabla-slim",
765 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
766 .dev = {
767 .platform_data = &tabla_platform_data,
768 },
769};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530770
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530771static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530772 .slimbus_slave_device = {
773 .name = "tabla-slave",
774 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
775 },
776 .irq = MSM_GPIO_TO_INT(62),
777 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530778 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530779 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
780 .micbias = {
781 .ldoh_v = TABLA_LDOH_2P85_V,
782 .cfilt1_mv = 1800,
783 .cfilt2_mv = 1800,
784 .cfilt3_mv = 1800,
785 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
786 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
787 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
788 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530789 },
790 .regulator = {
791 {
792 .name = "CDC_VDD_CP",
793 .min_uV = 1800000,
794 .max_uV = 1800000,
795 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
796 },
797 {
798 .name = "CDC_VDDA_RX",
799 .min_uV = 1800000,
800 .max_uV = 1800000,
801 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
802 },
803 {
804 .name = "CDC_VDDA_TX",
805 .min_uV = 1800000,
806 .max_uV = 1800000,
807 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
808 },
809 {
810 .name = "VDDIO_CDC",
811 .min_uV = 1800000,
812 .max_uV = 1800000,
813 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
814 },
815 {
816 .name = "VDDD_CDC_D",
817 .min_uV = 1225000,
818 .max_uV = 1225000,
819 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
820 },
821 {
822 .name = "CDC_VDDA_A_1P2V",
823 .min_uV = 1225000,
824 .max_uV = 1225000,
825 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
826 },
827 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530828};
829
830static struct slim_device msm_slim_tabla20 = {
831 .name = "tabla2x-slim",
832 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
833 .dev = {
834 .platform_data = &tabla20_platform_data,
835 },
836};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700837#endif
838
839static struct slim_boardinfo msm_slim_devices[] = {
840#ifdef CONFIG_WCD9310_CODEC
841 {
842 .bus_num = 1,
843 .slim_slave = &msm_slim_tabla,
844 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530845 {
846 .bus_num = 1,
847 .slim_slave = &msm_slim_tabla20,
848 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700849#endif
850 /* add more slimbus slaves as needed */
851};
852
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700853#define MSM_WCNSS_PHYS 0x03000000
854#define MSM_WCNSS_SIZE 0x280000
855
856static struct resource resources_wcnss_wlan[] = {
857 {
858 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
859 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
860 .name = "wcnss_wlanrx_irq",
861 .flags = IORESOURCE_IRQ,
862 },
863 {
864 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
865 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
866 .name = "wcnss_wlantx_irq",
867 .flags = IORESOURCE_IRQ,
868 },
869 {
870 .start = MSM_WCNSS_PHYS,
871 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
872 .name = "wcnss_mmio",
873 .flags = IORESOURCE_MEM,
874 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700875 {
876 .start = 84,
877 .end = 88,
878 .name = "wcnss_gpios_5wire",
879 .flags = IORESOURCE_IO,
880 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700881};
882
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700883static struct qcom_wcnss_opts qcom_wcnss_pdata = {
884 .has_48mhz_xo = 1,
885};
886
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700887static struct platform_device msm_device_wcnss_wlan = {
888 .name = "wcnss_wlan",
889 .id = 0,
890 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
891 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700892 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700893};
894
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700895#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
896 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
897 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
898 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
899
900#define QCE_SIZE 0x10000
901#define QCE_0_BASE 0x18500000
902
903#define QCE_HW_KEY_SUPPORT 0
904#define QCE_SHA_HMAC_SUPPORT 1
905#define QCE_SHARE_CE_RESOURCE 1
906#define QCE_CE_SHARED 0
907
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800908/* Begin Bus scaling definitions */
909static struct msm_bus_vectors crypto_hw_init_vectors[] = {
910 {
911 .src = MSM_BUS_MASTER_ADM_PORT0,
912 .dst = MSM_BUS_SLAVE_EBI_CH0,
913 .ab = 0,
914 .ib = 0,
915 },
916 {
917 .src = MSM_BUS_MASTER_ADM_PORT1,
918 .dst = MSM_BUS_SLAVE_GSBI1_UART,
919 .ab = 0,
920 .ib = 0,
921 },
922};
923
924static struct msm_bus_vectors crypto_hw_active_vectors[] = {
925 {
926 .src = MSM_BUS_MASTER_ADM_PORT0,
927 .dst = MSM_BUS_SLAVE_EBI_CH0,
928 .ab = 70000000UL,
929 .ib = 70000000UL,
930 },
931 {
932 .src = MSM_BUS_MASTER_ADM_PORT1,
933 .dst = MSM_BUS_SLAVE_GSBI1_UART,
934 .ab = 2480000000UL,
935 .ib = 2480000000UL,
936 },
937};
938
939static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
940 {
941 ARRAY_SIZE(crypto_hw_init_vectors),
942 crypto_hw_init_vectors,
943 },
944 {
945 ARRAY_SIZE(crypto_hw_active_vectors),
946 crypto_hw_active_vectors,
947 },
948};
949
950static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
951 crypto_hw_bus_scale_usecases,
952 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
953 .name = "cryptohw",
954};
955/* End Bus Scaling Definitions*/
956
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700957static struct resource qcrypto_resources[] = {
958 [0] = {
959 .start = QCE_0_BASE,
960 .end = QCE_0_BASE + QCE_SIZE - 1,
961 .flags = IORESOURCE_MEM,
962 },
963 [1] = {
964 .name = "crypto_channels",
965 .start = DMOV_CE_IN_CHAN,
966 .end = DMOV_CE_OUT_CHAN,
967 .flags = IORESOURCE_DMA,
968 },
969 [2] = {
970 .name = "crypto_crci_in",
971 .start = DMOV_CE_IN_CRCI,
972 .end = DMOV_CE_IN_CRCI,
973 .flags = IORESOURCE_DMA,
974 },
975 [3] = {
976 .name = "crypto_crci_out",
977 .start = DMOV_CE_OUT_CRCI,
978 .end = DMOV_CE_OUT_CRCI,
979 .flags = IORESOURCE_DMA,
980 },
981};
982
983static struct resource qcedev_resources[] = {
984 [0] = {
985 .start = QCE_0_BASE,
986 .end = QCE_0_BASE + QCE_SIZE - 1,
987 .flags = IORESOURCE_MEM,
988 },
989 [1] = {
990 .name = "crypto_channels",
991 .start = DMOV_CE_IN_CHAN,
992 .end = DMOV_CE_OUT_CHAN,
993 .flags = IORESOURCE_DMA,
994 },
995 [2] = {
996 .name = "crypto_crci_in",
997 .start = DMOV_CE_IN_CRCI,
998 .end = DMOV_CE_IN_CRCI,
999 .flags = IORESOURCE_DMA,
1000 },
1001 [3] = {
1002 .name = "crypto_crci_out",
1003 .start = DMOV_CE_OUT_CRCI,
1004 .end = DMOV_CE_OUT_CRCI,
1005 .flags = IORESOURCE_DMA,
1006 },
1007};
1008
1009#endif
1010
1011#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1012 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1013
1014static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1015 .ce_shared = QCE_CE_SHARED,
1016 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1017 .hw_key_support = QCE_HW_KEY_SUPPORT,
1018 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001019 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001020};
1021
1022static struct platform_device qcrypto_device = {
1023 .name = "qcrypto",
1024 .id = 0,
1025 .num_resources = ARRAY_SIZE(qcrypto_resources),
1026 .resource = qcrypto_resources,
1027 .dev = {
1028 .coherent_dma_mask = DMA_BIT_MASK(32),
1029 .platform_data = &qcrypto_ce_hw_suppport,
1030 },
1031};
1032#endif
1033
1034#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1035 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1036
1037static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1038 .ce_shared = QCE_CE_SHARED,
1039 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1040 .hw_key_support = QCE_HW_KEY_SUPPORT,
1041 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001042 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001043};
1044
1045static struct platform_device qcedev_device = {
1046 .name = "qce",
1047 .id = 0,
1048 .num_resources = ARRAY_SIZE(qcedev_resources),
1049 .resource = qcedev_resources,
1050 .dev = {
1051 .coherent_dma_mask = DMA_BIT_MASK(32),
1052 .platform_data = &qcedev_ce_hw_suppport,
1053 },
1054};
1055#endif
1056
Joel Kingb8352a12011-11-15 18:46:24 -08001057#define MDM2AP_ERRFATAL 70
1058#define AP2MDM_ERRFATAL 95
1059#define MDM2AP_STATUS 69
1060#define AP2MDM_STATUS 94
1061#define AP2MDM_PMIC_RESET_N 80
1062#define AP2MDM_KPDPWR_N 81
1063
Joel Kingb8352a12011-11-15 18:46:24 -08001064static struct resource mdm_resources[] = {
1065 {
1066 .start = MDM2AP_ERRFATAL,
1067 .end = MDM2AP_ERRFATAL,
1068 .name = "MDM2AP_ERRFATAL",
1069 .flags = IORESOURCE_IO,
1070 },
1071 {
1072 .start = AP2MDM_ERRFATAL,
1073 .end = AP2MDM_ERRFATAL,
1074 .name = "AP2MDM_ERRFATAL",
1075 .flags = IORESOURCE_IO,
1076 },
1077 {
1078 .start = MDM2AP_STATUS,
1079 .end = MDM2AP_STATUS,
1080 .name = "MDM2AP_STATUS",
1081 .flags = IORESOURCE_IO,
1082 },
1083 {
1084 .start = AP2MDM_STATUS,
1085 .end = AP2MDM_STATUS,
1086 .name = "AP2MDM_STATUS",
1087 .flags = IORESOURCE_IO,
1088 },
1089 {
1090 .start = AP2MDM_PMIC_RESET_N,
1091 .end = AP2MDM_PMIC_RESET_N,
1092 .name = "AP2MDM_PMIC_RESET_N",
1093 .flags = IORESOURCE_IO,
1094 },
1095 {
1096 .start = AP2MDM_KPDPWR_N,
1097 .end = AP2MDM_KPDPWR_N,
1098 .name = "AP2MDM_KPDPWR_N",
1099 .flags = IORESOURCE_IO,
1100 },
1101};
1102
1103static struct mdm_platform_data mdm_platform_data = {
1104 .mdm_version = "2.5",
1105};
1106
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001107static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -08001108 .name = "mdm2_modem",
1109 .id = -1,
1110 .num_resources = ARRAY_SIZE(mdm_resources),
1111 .resource = mdm_resources,
1112 .dev = {
1113 .platform_data = &mdm_platform_data,
1114 },
1115};
1116
1117static struct platform_device *mdm_devices[] __initdata = {
1118 &mdm_device,
1119};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001121#define MSM_SHARED_RAM_PHYS 0x80000000
1122
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001123static void __init msm8960_map_io(void)
1124{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001125 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001126 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001127
1128 if (socinfo_init() < 0)
1129 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001130}
1131
1132static void __init msm8960_init_irq(void)
1133{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001134 struct msm_mpm_device_data *data = NULL;
1135
1136#ifdef CONFIG_MSM_MPM
1137 data = &msm8960_mpm_dev_data;
1138#endif
1139
1140 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001141 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001142 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001143}
1144
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001145static void __init msm8960_init_buses(void)
1146{
1147#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001148 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001149 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1150 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1151 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1152 msm_bus_apps_fabric.dev.platform_data =
1153 &msm_bus_8960_apps_fabric_pdata;
1154 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1155 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1156 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1157 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001158#endif
1159}
1160
1161static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1162 .max_clock_speed = 15060000,
1163};
1164
1165#ifdef CONFIG_USB_MSM_OTG_72K
1166static struct msm_otg_platform_data msm_otg_pdata;
1167#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301168static int wr_phy_init_seq[] = {
1169 0x44, 0x80, /* set VBUS valid threshold
1170 and disconnect valid threshold */
1171 0x38, 0x81, /* update DC voltage level */
1172 0x14, 0x82, /* set preemphasis and rise/fall time */
1173 0x13, 0x83, /* set source impedance adjusment */
1174 -1};
1175
1176static int liquid_v1_phy_init_seq[] = {
1177 0x44, 0x80,/* set VBUS valid threshold
1178 and disconnect valid threshold */
1179 0x3C, 0x81,/* update DC voltage level */
1180 0x18, 0x82,/* set preemphasis and rise/fall time */
1181 0x23, 0x83,/* set source impedance sdjusment */
1182 -1};
1183
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301184#ifdef CONFIG_MSM_BUS_SCALING
1185/* Bandwidth requests (zero) if no vote placed */
1186static struct msm_bus_vectors usb_init_vectors[] = {
1187 {
1188 .src = MSM_BUS_MASTER_SPS,
1189 .dst = MSM_BUS_SLAVE_EBI_CH0,
1190 .ab = 0,
1191 .ib = 0,
1192 },
1193};
1194
1195/* Bus bandwidth requests in Bytes/sec */
1196static struct msm_bus_vectors usb_max_vectors[] = {
1197 {
1198 .src = MSM_BUS_MASTER_SPS,
1199 .dst = MSM_BUS_SLAVE_EBI_CH0,
1200 .ab = 60000000, /* At least 480Mbps on bus. */
1201 .ib = 960000000, /* MAX bursts rate */
1202 },
1203};
1204
1205static struct msm_bus_paths usb_bus_scale_usecases[] = {
1206 {
1207 ARRAY_SIZE(usb_init_vectors),
1208 usb_init_vectors,
1209 },
1210 {
1211 ARRAY_SIZE(usb_max_vectors),
1212 usb_max_vectors,
1213 },
1214};
1215
1216static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1217 usb_bus_scale_usecases,
1218 ARRAY_SIZE(usb_bus_scale_usecases),
1219 .name = "usb",
1220};
1221#endif
1222
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001223static struct msm_otg_platform_data msm_otg_pdata = {
1224 .mode = USB_OTG,
1225 .otg_control = OTG_PMIC_CONTROL,
1226 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001227 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301228 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301229#ifdef CONFIG_MSM_BUS_SCALING
1230 .bus_scale_table = &usb_bus_scale_pdata,
1231#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001232};
1233#endif
1234
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301235#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301236#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301237static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1238 .strobe = 150,
1239 .data = 151,
1240};
1241#else
1242static struct msm_hsic_host_platform_data msm_hsic_pdata;
1243#endif
1244
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001245#define PID_MAGIC_ID 0x71432909
1246#define SERIAL_NUM_MAGIC_ID 0x61945374
1247#define SERIAL_NUMBER_LENGTH 127
1248#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1249
1250struct magic_num_struct {
1251 uint32_t pid;
1252 uint32_t serial_num;
1253};
1254
1255struct dload_struct {
1256 uint32_t reserved1;
1257 uint32_t reserved2;
1258 uint32_t reserved3;
1259 uint16_t reserved4;
1260 uint16_t pid;
1261 char serial_number[SERIAL_NUMBER_LENGTH];
1262 uint16_t reserved5;
1263 struct magic_num_struct magic_struct;
1264};
1265
1266static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1267{
1268 struct dload_struct __iomem *dload = 0;
1269
1270 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1271 if (!dload) {
1272 pr_err("%s: cannot remap I/O memory region: %08x\n",
1273 __func__, DLOAD_USB_BASE_ADD);
1274 return -ENXIO;
1275 }
1276
1277 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1278 __func__, dload, pid, snum);
1279 /* update pid */
1280 dload->magic_struct.pid = PID_MAGIC_ID;
1281 dload->pid = pid;
1282
1283 /* update serial number */
1284 dload->magic_struct.serial_num = 0;
1285 if (!snum) {
1286 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1287 goto out;
1288 }
1289
1290 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001291 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292out:
1293 iounmap(dload);
1294 return 0;
1295}
1296
1297static struct android_usb_platform_data android_usb_pdata = {
1298 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1299};
1300
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001301static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302 .name = "android_usb",
1303 .id = -1,
1304 .dev = {
1305 .platform_data = &android_usb_pdata,
1306 },
1307};
1308
1309static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1310 0x03, 0x0f,
1311};
1312
1313static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1314 0x00, 0x24, 0x54, 0x10,
1315 0x09, 0x03, 0x01,
1316 0x10, 0x54, 0x30, 0x0C,
1317 0x24, 0x30, 0x0f,
1318};
1319
1320static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1321 0x00, 0x24, 0x54, 0x10,
1322 0x09, 0x07, 0x01, 0x0B,
1323 0x10, 0x54, 0x30, 0x0C,
1324 0x24, 0x30, 0x0f,
1325};
1326
1327static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1328 [0] = {
1329 .mode = MSM_SPM_MODE_CLOCK_GATING,
1330 .notify_rpm = false,
1331 .cmd = spm_wfi_cmd_sequence,
1332 },
1333 [1] = {
1334 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1335 .notify_rpm = false,
1336 .cmd = spm_power_collapse_without_rpm,
1337 },
1338 [2] = {
1339 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1340 .notify_rpm = true,
1341 .cmd = spm_power_collapse_with_rpm,
1342 },
1343};
1344
1345static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1346 [0] = {
1347 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001348 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349#if defined(CONFIG_MSM_AVS_HW)
1350 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1351 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1352#endif
1353 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001354 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001355 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1356 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1357 .vctl_timeout_us = 50,
1358 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1359 .modes = msm_spm_seq_list,
1360 },
1361 [1] = {
1362 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001363 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364#if defined(CONFIG_MSM_AVS_HW)
1365 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1366 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1367#endif
1368 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001369 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001370 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1371 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1372 .vctl_timeout_us = 50,
1373 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1374 .modes = msm_spm_seq_list,
1375 },
1376};
1377
1378static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1379 0x00, 0x20, 0x03, 0x20,
1380 0x00, 0x0f,
1381};
1382
1383static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1384 0x00, 0x20, 0x34, 0x64,
1385 0x48, 0x07, 0x48, 0x20,
1386 0x50, 0x64, 0x04, 0x34,
1387 0x50, 0x0f,
1388};
1389static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1390 0x00, 0x10, 0x34, 0x64,
1391 0x48, 0x07, 0x48, 0x10,
1392 0x50, 0x64, 0x04, 0x34,
1393 0x50, 0x0F,
1394};
1395
1396static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1397 [0] = {
1398 .mode = MSM_SPM_L2_MODE_RETENTION,
1399 .notify_rpm = false,
1400 .cmd = l2_spm_wfi_cmd_sequence,
1401 },
1402 [1] = {
1403 .mode = MSM_SPM_L2_MODE_GDHS,
1404 .notify_rpm = true,
1405 .cmd = l2_spm_gdhs_cmd_sequence,
1406 },
1407 [2] = {
1408 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1409 .notify_rpm = true,
1410 .cmd = l2_spm_power_off_cmd_sequence,
1411 },
1412};
1413
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001414static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1415 [0] = {
1416 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001417 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001418 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001419 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1420 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1421 .modes = msm_spm_l2_seq_list,
1422 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1423 },
1424};
1425
Mohan Pallaka5e490392011-09-09 15:18:41 +05301426#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1427#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1428
1429static struct msm_xo_voter *xo_handle_d1;
1430
1431static int isa1200_power(int on)
1432{
1433 int rc = 0;
1434
1435 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1436
1437 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1438 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1439 if (rc < 0) {
1440 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1441 __func__, on ? "" : "de-", rc);
1442 goto err_xo_vote;
1443 }
1444
1445 return 0;
1446
1447err_xo_vote:
1448 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1449 return rc;
1450}
1451
1452static int isa1200_dev_setup(bool enable)
1453{
1454 int rc = 0;
1455
1456 struct pm_gpio hap_gpio_config = {
1457 .direction = PM_GPIO_DIR_OUT,
1458 .pull = PM_GPIO_PULL_NO,
1459 .out_strength = PM_GPIO_STRENGTH_HIGH,
1460 .function = PM_GPIO_FUNC_NORMAL,
1461 .inv_int_pol = 0,
1462 .vin_sel = 2,
1463 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1464 .output_value = 0,
1465 };
1466
1467 if (enable == true) {
1468 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1469 if (rc) {
1470 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1471 __func__, PM_HAP_EN_GPIO, rc);
1472 return rc;
1473 }
1474
1475 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1476 if (rc) {
1477 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1478 __func__, PM_HAP_LEN_GPIO, rc);
1479 return rc;
1480 }
1481
1482 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1483 if (rc) {
1484 pr_err("%s: unable to request gpio %d (%d)\n",
1485 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1486 return rc;
1487 }
1488
1489 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1490 if (rc) {
1491 pr_err("%s: Unable to set direction\n", __func__);
1492 goto free_gpio;
1493 }
1494
1495 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1496 if (IS_ERR(xo_handle_d1)) {
1497 rc = PTR_ERR(xo_handle_d1);
1498 pr_err("%s: failed to get the handle for D1(%d)\n",
1499 __func__, rc);
1500 goto gpio_set_dir;
1501 }
1502 } else {
1503 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1504
1505 msm_xo_put(xo_handle_d1);
1506 }
1507
1508 return 0;
1509
1510gpio_set_dir:
1511 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1512free_gpio:
1513 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1514 return rc;
1515}
1516
1517static struct isa1200_regulator isa1200_reg_data[] = {
1518 {
1519 .name = "vcc_i2c",
1520 .min_uV = ISA_I2C_VTG_MIN_UV,
1521 .max_uV = ISA_I2C_VTG_MAX_UV,
1522 .load_uA = ISA_I2C_CURR_UA,
1523 },
1524};
1525
1526static struct isa1200_platform_data isa1200_1_pdata = {
1527 .name = "vibrator",
1528 .dev_setup = isa1200_dev_setup,
1529 .power_on = isa1200_power,
1530 .hap_en_gpio = PM_HAP_EN_GPIO,
1531 .hap_len_gpio = PM_HAP_LEN_GPIO,
1532 .max_timeout = 15000,
1533 .mode_ctrl = PWM_GEN_MODE,
1534 .pwm_fd = {
1535 .pwm_div = 256,
1536 },
1537 .is_erm = false,
1538 .smart_en = true,
1539 .ext_clk_en = true,
1540 .chip_en = 1,
1541 .regulator_info = isa1200_reg_data,
1542 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1543};
1544
1545static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1546 {
1547 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301548 },
1549};
1550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551#define CYTTSP_TS_GPIO_IRQ 11
1552#define CYTTSP_TS_SLEEP_GPIO 50
1553#define CYTTSP_TS_RESOUT_N_GPIO 52
1554
1555/*virtual key support */
1556static ssize_t tma340_vkeys_show(struct kobject *kobj,
1557 struct kobj_attribute *attr, char *buf)
1558{
1559 return snprintf(buf, 200,
1560 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1561 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1562 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1563 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1564 "\n");
1565}
1566
1567static struct kobj_attribute tma340_vkeys_attr = {
1568 .attr = {
1569 .mode = S_IRUGO,
1570 },
1571 .show = &tma340_vkeys_show,
1572};
1573
1574static struct attribute *tma340_properties_attrs[] = {
1575 &tma340_vkeys_attr.attr,
1576 NULL
1577};
1578
1579static struct attribute_group tma340_properties_attr_group = {
1580 .attrs = tma340_properties_attrs,
1581};
1582
1583
1584static int cyttsp_platform_init(struct i2c_client *client)
1585{
1586 int rc = 0;
1587 static struct kobject *tma340_properties_kobj;
1588
1589 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1590 tma340_properties_kobj = kobject_create_and_add("board_properties",
1591 NULL);
1592 if (tma340_properties_kobj)
1593 rc = sysfs_create_group(tma340_properties_kobj,
1594 &tma340_properties_attr_group);
1595 if (!tma340_properties_kobj || rc)
1596 pr_err("%s: failed to create board_properties\n",
1597 __func__);
1598
1599 return 0;
1600}
1601
1602static struct cyttsp_regulator regulator_data[] = {
1603 {
1604 .name = "vdd",
1605 .min_uV = CY_TMA300_VTG_MIN_UV,
1606 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301607 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1608 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001609 },
1610 /* TODO: Remove after runtime PM is enabled in I2C driver */
1611 {
1612 .name = "vcc_i2c",
1613 .min_uV = CY_I2C_VTG_MIN_UV,
1614 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301615 .hpm_load_uA = CY_I2C_CURR_UA,
1616 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001617 },
1618};
1619
1620static struct cyttsp_platform_data cyttsp_pdata = {
1621 .panel_maxx = 634,
1622 .panel_maxy = 1166,
1623 .disp_maxx = 616,
1624 .disp_maxy = 1023,
1625 .disp_minx = 0,
1626 .disp_miny = 16,
1627 .flags = 0x01,
1628 .gen = CY_GEN3, /* or */
1629 .use_st = CY_USE_ST,
1630 .use_mt = CY_USE_MT,
1631 .use_hndshk = CY_SEND_HNDSHK,
1632 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301633 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001634 .use_gestures = CY_USE_GESTURES,
1635 .fw_fname = "cyttsp_8960_cdp.hex",
1636 /* activate up to 4 groups
1637 * and set active distance
1638 */
1639 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1640 CY_GEST_GRP3 | CY_GEST_GRP4 |
1641 CY_ACT_DIST,
1642 /* change act_intrvl to customize the Active power state
1643 * scanning/processing refresh interval for Operating mode
1644 */
1645 .act_intrvl = CY_ACT_INTRVL_DFLT,
1646 /* change tch_tmout to customize the touch timeout for the
1647 * Active power state for Operating mode
1648 */
1649 .tch_tmout = CY_TCH_TMOUT_DFLT,
1650 /* change lp_intrvl to customize the Low Power power state
1651 * scanning/processing refresh interval for Operating mode
1652 */
1653 .lp_intrvl = CY_LP_INTRVL_DFLT,
1654 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1655 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1656 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1657 .regulator_info = regulator_data,
1658 .num_regulators = ARRAY_SIZE(regulator_data),
1659 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301660 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001661};
1662
1663static struct i2c_board_info cyttsp_info[] __initdata = {
1664 {
1665 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1666 .platform_data = &cyttsp_pdata,
1667#ifndef CY_USE_TIMER
1668 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1669#endif /* CY_USE_TIMER */
1670 },
1671};
1672
Jing Lindc4413c2012-01-16 15:22:52 -08001673/* configuration data for mxt1386 */
1674static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301675 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001676 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301677 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001678 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001679 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1680 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1681 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1682 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1683 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1684 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301685 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001686 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301687 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001688 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301689 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001690 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1691 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1692 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1693 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301694 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001695 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1696 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301697 /* T18 Object */
1698 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301699 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001700 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1701 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301702 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001703 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1704 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301705 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001706 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1707 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301708 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001709 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301710 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001711 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301712 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001713 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301714 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001715 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301716 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001717 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301718};
1719
Jing Lin33b007d2011-12-21 17:40:23 -08001720/* configuration data for mxt1386e using V1.0 firmware */
1721static const u8 mxt1386e_config_data_v1_0[] = {
1722 /* T6 Object */
1723 0, 0, 0, 0, 0, 0,
1724 /* T38 Object */
1725 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1726 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1727 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1728 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1729 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1730 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1731 0, 0, 0, 0,
1732 /* T7 Object */
1733 100, 16, 50,
1734 /* T8 Object */
1735 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1736 /* T9 Object */
1737 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1738 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1739 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1740 10, 5, 0, 0, 0,
1741 /* T18 Object */
1742 0, 0,
1743 /* T24 Object */
1744 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1745 0, 0, 0, 0, 0, 0, 0, 0, 0,
1746 /* T25 Object */
1747 3, 0, 60, 115, 156, 99,
1748 /* T27 Object */
1749 0, 0, 0, 0, 0, 0, 0,
1750 /* T40 Object */
1751 0, 0, 0, 0, 0,
1752 /* T42 Object */
1753 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1754 /* T43 Object */
1755 0, 0, 0, 0, 0, 0, 0,
1756 /* T46 Object */
1757 64, 0, 20, 20, 0, 0, 0, 0, 0,
1758 /* T47 Object */
1759 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1760 /* T48 Object */
1761 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1762 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1763 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1764 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1765 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1766 0, 0, 0, 0,
1767 /* T56 Object */
1768 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1769 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1770 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1771 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1772 2, 99, 33,
1773};
1774
1775/* configuration data for mxt1386e using V2.1 firmware */
1776static const u8 mxt1386e_config_data_v2_1[] = {
1777 /* T6 Object */
1778 0, 0, 0, 0, 0, 0,
1779 /* T38 Object */
1780 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
1781 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1782 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1783 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1784 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1785 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1786 0, 0, 0, 0,
1787 /* T7 Object */
1788 100, 16, 50,
1789 /* T8 Object */
1790 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1791 /* T9 Object */
1792 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1793 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1794 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1795 10, 5, 0, 0, 0,
1796 /* T18 Object */
1797 0, 0,
1798 /* T24 Object */
1799 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1800 0, 0, 0, 0, 0, 0, 0, 0, 0,
1801 /* T25 Object */
1802 3, 0, 60, 115, 156, 99,
1803 /* T27 Object */
1804 0, 0, 0, 0, 0, 0, 0,
1805 /* T40 Object */
1806 0, 0, 0, 0, 0,
1807 /* T42 Object */
1808 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1809 /* T43 Object */
1810 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1811 16,
1812 /* T46 Object */
1813 64, 0, 20, 20, 0, 0, 0, 0, 0,
1814 /* T47 Object */
1815 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1816 /* T48 Object */
1817 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1818 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1819 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1820 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1821 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1822 0, 0, 0, 0,
1823 /* T56 Object */
1824 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1825 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1826 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1827 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1828 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
1829 255,
1830};
1831
Jing Lineec88ca2012-02-08 11:18:30 -08001832/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
1833static const u8 mxt1386e_config_data_3d[] = {
1834 /* T6 Object */
1835 0, 0, 0, 0, 0, 0,
1836 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001837 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1839 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1840 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1841 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1842 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1843 0, 0, 0, 0,
1844 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001845 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08001846 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001847 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001848 /* T9 Object */
1849 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1850 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08001851 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
1852 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001853 /* T18 Object */
1854 0, 0,
1855 /* T24 Object */
1856 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1857 0, 0, 0, 0, 0, 0, 0, 0, 0,
1858 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001859 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08001860 /* T27 Object */
1861 0, 0, 0, 0, 0, 0, 0,
1862 /* T40 Object */
1863 0, 0, 0, 0, 0,
1864 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001865 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001866 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001867 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1868 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001869 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001870 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001871 /* T47 Object */
1872 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1873 /* T48 Object */
1874 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08001875 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
1876 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
1877 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001878 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1879 0, 0, 0, 0,
1880 /* T56 Object */
1881 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1882 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1883 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1884 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08001885 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1886 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001887};
1888
Amy Maloche08266db2011-11-04 11:07:16 -07001889#define MXT_TS_GPIO_IRQ 11
1890#define MXT_TS_LDO_EN_GPIO 50
1891#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301892
1893static void mxt_init_hw_liquid(void)
1894{
1895 int rc;
1896
Mohan Pallaka50837382011-09-07 11:00:57 +05301897 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1898 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001899 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1900 __func__, MXT_TS_LDO_EN_GPIO);
1901 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301902 }
1903
1904 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1905 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001906 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1907 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301908 goto err_ldo_gpio_req;
1909 }
1910
Mohan Pallaka50837382011-09-07 11:00:57 +05301911 return;
1912
Mohan Pallaka50837382011-09-07 11:00:57 +05301913err_ldo_gpio_req:
1914 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301915}
1916
Jing Lineec88ca2012-02-08 11:18:30 -08001917static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08001918 {
1919 .config = mxt1386_config_data,
1920 .config_length = ARRAY_SIZE(mxt1386_config_data),
1921 .family_id = 0xA0,
1922 .variant_id = 0x0,
1923 .version = 0x10,
1924 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08001925 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08001926 },
Jing Lin33b007d2011-12-21 17:40:23 -08001927 {
1928 .config = mxt1386e_config_data_v1_0,
1929 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
1930 .family_id = 0xA0,
1931 .variant_id = 0x2,
1932 .version = 0x10,
1933 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08001934 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Anirudh Ghayal3432d7f2012-02-17 14:59:53 -08001935 .fw_name = "atmel_8960_liquid_v2_1_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08001936 },
1937 {
1938 .config = mxt1386e_config_data_v2_1,
1939 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1940 .family_id = 0xA0,
1941 .variant_id = 0x7,
1942 .version = 0x21,
1943 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08001944 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08001945 },
Jing Lindc4413c2012-01-16 15:22:52 -08001946};
1947
Jing Lineec88ca2012-02-08 11:18:30 -08001948static struct mxt_platform_data mxt_platform_data_2d = {
1949 .config_array = mxt_config_array_2d,
1950 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Jing Lin2f863172011-10-17 10:56:58 -07001951 .x_size = 1365,
1952 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301953 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001954 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001955 .reset_gpio = MXT_TS_RESET_GPIO,
1956 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301957};
1958
Jing Lineec88ca2012-02-08 11:18:30 -08001959static struct mxt_config_info mxt_config_array_3d[] = {
1960 {
1961 .config = mxt1386e_config_data_3d,
1962 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
1963 .family_id = 0xA0,
1964 .variant_id = 0x7,
1965 .version = 0x21,
1966 .build = 0xAA,
1967 },
1968};
1969
1970static struct mxt_platform_data mxt_platform_data_3d = {
1971 .config_array = mxt_config_array_3d,
1972 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
1973 .x_size = 1919,
1974 .y_size = 1199,
1975 .irqflags = IRQF_TRIGGER_FALLING,
1976 .i2c_pull_up = true,
1977 .reset_gpio = MXT_TS_RESET_GPIO,
1978 .irq_gpio = MXT_TS_GPIO_IRQ,
1979};
1980
Mohan Pallaka50837382011-09-07 11:00:57 +05301981static struct i2c_board_info mxt_device_info[] __initdata = {
1982 {
1983 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05301984 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1985 },
1986};
1987
Eugene Yasmand2316b82011-12-07 18:23:48 +02001988static struct i2c_board_info sii_device_info[] __initdata = {
1989 {
1990 I2C_BOARD_INFO("Sil-9244", 0x39),
1991 .flags = I2C_CLIENT_WAKE,
1992 .irq = MSM_GPIO_TO_INT(15),
1993 },
1994};
1995
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001996static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1997 .clk_freq = 100000,
1998 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001999};
2000
2001static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2002 .clk_freq = 100000,
2003 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002004};
2005
2006static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2007 .clk_freq = 100000,
2008 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002009};
2010
2011static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2012 .clk_freq = 100000,
2013 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002014};
2015
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002016static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2017 .base_addr = MSM_ACC0_BASE + 0x08,
2018 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2019 .mask = 1UL << 13,
2020};
2021
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002022static struct ks8851_pdata spi_eth_pdata = {
2023 .irq_gpio = KS8851_IRQ_GPIO,
2024 .rst_gpio = KS8851_RST_GPIO,
2025};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002026
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002027static struct spi_board_info spi_board_info[] __initdata = {
2028 {
2029 .modalias = "ks8851",
2030 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2031 .max_speed_hz = 19200000,
2032 .bus_num = 0,
2033 .chip_select = 0,
2034 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002035 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002036 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002037 {
2038 .modalias = "dsi_novatek_3d_panel_spi",
2039 .max_speed_hz = 10800000,
2040 .bus_num = 0,
2041 .chip_select = 1,
2042 .mode = SPI_MODE_0,
2043 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002044};
2045
2046static struct platform_device msm_device_saw_core0 = {
2047 .name = "saw-regulator",
2048 .id = 0,
2049 .dev = {
2050 .platform_data = &msm_saw_regulator_pdata_s5,
2051 },
2052};
2053
2054static struct platform_device msm_device_saw_core1 = {
2055 .name = "saw-regulator",
2056 .id = 1,
2057 .dev = {
2058 .platform_data = &msm_saw_regulator_pdata_s6,
2059 },
2060};
2061
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002062static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002063 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002064 .tsens_factor = 1000,
2065 .hw_type = MSM_8960,
2066 .tsens_num_sensor = 5,
2067};
2068
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002069#ifdef CONFIG_MSM_FAKE_BATTERY
2070static struct platform_device fish_battery_device = {
2071 .name = "fish_battery",
2072};
2073#endif
2074
David Collins26f05562011-06-20 09:56:28 -07002075static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002076 .name = GPIO_REGULATOR_DEV_NAME,
2077 .id = PM8921_MPP_PM_TO_SYS(7),
2078 .dev = {
2079 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2080 },
2081};
2082
David Collins26f05562011-06-20 09:56:28 -07002083static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002084 .name = GPIO_REGULATOR_DEV_NAME,
2085 .id = 91,
2086 .dev = {
2087 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2088 },
2089};
2090
David Collinsb10be1d2011-09-02 10:29:31 -07002091static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2092 .name = GPIO_REGULATOR_DEV_NAME,
2093 .id = PM8921_GPIO_PM_TO_SYS(17),
2094 .dev = {
2095 .platform_data =
2096 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2097 },
2098};
2099
David Collins35a78f52011-12-14 15:54:25 -08002100static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2101 .name = GPIO_REGULATOR_DEV_NAME,
2102 .id = PM8921_GPIO_PM_TO_SYS(42),
2103 .dev = {
2104 .platform_data =
2105 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2106 },
2107};
2108
David Collins26f05562011-06-20 09:56:28 -07002109static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2110 .name = "rpm-regulator",
2111 .id = -1,
2112 .dev = {
2113 .platform_data = &msm_rpm_regulator_pdata,
2114 },
2115};
2116
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002117static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002118 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002119 &msm_device_smd,
2120 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302121 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122 &msm_device_saw_core0,
2123 &msm_device_saw_core1,
2124 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002125 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002126 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002127 &msm8960_device_qup_spi_gsbi1,
2128 &msm8960_device_qup_i2c_gsbi3,
2129 &msm8960_device_qup_i2c_gsbi4,
2130 &msm8960_device_qup_i2c_gsbi10,
2131#ifndef CONFIG_MSM_DSPS
2132 &msm8960_device_qup_i2c_gsbi12,
2133#endif
2134 &msm_slim_ctrl,
2135 &msm_device_wcnss_wlan,
2136#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2137 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2138 &qcrypto_device,
2139#endif
2140
2141#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2142 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2143 &qcedev_device,
2144#endif
2145#ifdef CONFIG_MSM_ROTATOR
2146 &msm_rotator_device,
2147#endif
2148 &msm_device_sps,
2149#ifdef CONFIG_MSM_FAKE_BATTERY
2150 &fish_battery_device,
2151#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08002152 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002153#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002154#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002155 &android_pmem_device,
2156 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07002157#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002158 &android_pmem_audio_device,
2159#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002160 &msm_device_vidc,
2161 &msm_device_bam_dmux,
2162 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002163
Joel Nidera1261942011-09-12 16:30:09 +03002164#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2165#ifdef CONFIG_MSM_USE_TSIF1
2166 &msm_device_tsif[1],
2167#else
2168 &msm_device_tsif[0],
2169#endif
2170#endif
2171
Mona Hossain9c430e32011-07-27 11:04:47 -07002172#ifdef CONFIG_HW_RANDOM_MSM
2173 &msm_device_rng,
2174#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002175#ifdef CONFIG_ION_MSM
2176 &ion_dev,
2177#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002178 &msm8960_rpm_device,
2179 &msm8960_rpm_log_device,
2180 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002181 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002182#ifdef CONFIG_MSM_QDSS
2183 &msm_etb_device,
2184 &msm_tpiu_device,
2185 &msm_funnel_device,
2186 &msm_ptm_device,
2187#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002188 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002189 &msm8960_device_watchdog,
Laura Abbottf8c03b92012-02-16 14:57:58 -08002190#ifdef CONFIG_MSM_RTB
2191 &msm_rtb_device,
2192#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002193};
2194
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002195static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002196 &msm8960_device_otg,
2197 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002198 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302199 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002200 &android_usb_device,
2201 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002202 &msm_bus_apps_fabric,
2203 &msm_bus_sys_fabric,
2204 &msm_bus_mm_fabric,
2205 &msm_bus_sys_fpb,
2206 &msm_bus_cpss_fpb,
2207 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002208 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002209 &msm_pcm_routing,
2210 &msm_cpudai0,
2211 &msm_cpudai1,
2212 &msm_cpudai_hdmi_rx,
2213 &msm_cpudai_bt_rx,
2214 &msm_cpudai_bt_tx,
2215 &msm_cpudai_fm_rx,
2216 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002217 &msm_cpudai_auxpcm_rx,
2218 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002219 &msm_cpu_fe,
2220 &msm_stub_codec,
2221 &msm_voice,
2222 &msm_voip,
2223 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302224 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002225 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002226 &msm_cpudai_incall_record_rx,
2227 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002228
2229#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2230 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2231 &qcrypto_device,
2232#endif
2233
2234#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2235 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2236 &qcedev_device,
2237#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002238};
2239
2240static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002241 &msm_kgsl_3d0,
2242 &msm_kgsl_2d0,
2243 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002244#ifdef CONFIG_MSM_GEMINI
2245 &msm8960_gemini_device,
2246#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002247};
2248
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002249static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002250 &msm_8960_q6_lpass,
2251 &msm_8960_q6_mss_fw,
2252 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002253 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002254 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002255 &msm8960_device_otg,
2256 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002257 &msm_device_hsusb_host,
2258 &android_usb_device,
2259 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002260 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002261 &msm_pcm_routing,
2262 &msm_cpudai0,
2263 &msm_cpudai1,
2264 &msm_cpudai_hdmi_rx,
2265 &msm_cpudai_bt_rx,
2266 &msm_cpudai_bt_tx,
2267 &msm_cpudai_fm_rx,
2268 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002269 &msm_cpudai_auxpcm_rx,
2270 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271 &msm_cpu_fe,
2272 &msm_stub_codec,
2273 &msm_kgsl_3d0,
2274#ifdef CONFIG_MSM_KGSL_2D
2275 &msm_kgsl_2d0,
2276 &msm_kgsl_2d1,
2277#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002278#ifdef CONFIG_MSM_GEMINI
2279 &msm8960_gemini_device,
2280#endif
2281 &msm_voice,
2282 &msm_voip,
2283 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302284 &msm_cpudai_afe_01_rx,
2285 &msm_cpudai_afe_01_tx,
2286 &msm_cpudai_afe_02_rx,
2287 &msm_cpudai_afe_02_tx,
2288 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302289 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002290 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002291 &msm_cpudai_incall_record_rx,
2292 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 &msm_pcm_hostless,
2294 &msm_bus_apps_fabric,
2295 &msm_bus_sys_fabric,
2296 &msm_bus_mm_fabric,
2297 &msm_bus_sys_fpb,
2298 &msm_bus_cpss_fpb,
2299};
2300
2301static void __init msm8960_i2c_init(void)
2302{
2303 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2304 &msm8960_i2c_qup_gsbi4_pdata;
2305
2306 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2307 &msm8960_i2c_qup_gsbi3_pdata;
2308
2309 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2310 &msm8960_i2c_qup_gsbi10_pdata;
2311
2312 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2313 &msm8960_i2c_qup_gsbi12_pdata;
2314}
2315
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002316static void __init msm8960_gfx_init(void)
2317{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002318 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002319 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2320 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2321 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002322 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2323 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002324 }
2325}
2326
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002327static struct msm_cpuidle_state msm_cstates[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002328
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329 {0, 0, "C0", "WFI",
2330 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2331
2332 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2333 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2334
2335 {0, 2, "C2", "POWER_COLLAPSE",
2336 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
2337
2338 {1, 0, "C0", "WFI",
2339 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2340
2341 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2342 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2343};
2344
2345static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
2346 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2347 .idle_supported = 1,
2348 .suspend_supported = 1,
2349 .idle_enabled = 0,
2350 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002351 },
2352
2353 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2354 .idle_supported = 1,
2355 .suspend_supported = 1,
2356 .idle_enabled = 0,
2357 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358 },
2359
2360 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2361 .idle_supported = 1,
2362 .suspend_supported = 1,
2363 .idle_enabled = 1,
2364 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002365 },
2366
2367 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2368 .idle_supported = 0,
2369 .suspend_supported = 1,
2370 .idle_enabled = 0,
2371 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002372 },
2373
2374 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2375 .idle_supported = 1,
2376 .suspend_supported = 1,
2377 .idle_enabled = 0,
2378 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002379 },
2380
2381 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2382 .idle_supported = 1,
2383 .suspend_supported = 0,
2384 .idle_enabled = 1,
2385 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002386 },
2387};
2388
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302389static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002390 {
2391 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2392 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2393 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002394 100, 650, 801, 200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002395 },
2396
2397 {
2398 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2399 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2400 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002401 2000, 200, 576000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002402 },
2403
2404 {
2405 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2406 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2407 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002408 8500, 51, 1122000, 8500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002409 },
2410
2411 {
2412 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2413 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2414 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002415 9000, 51, 1130300, 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002416 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002417 {
2418 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2419 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2420 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002421 10000, 51, 1130300, 10000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002422 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002423
2424 {
2425 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2426 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2427 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002428 12000, 14, 2205900, 12000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002429 },
2430
2431 {
2432 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2433 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2434 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002435 18000, 12, 2364250, 18000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002436 },
2437
2438 {
2439 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2440 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2441 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002442 23500, 10, 2667000, 23500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002443 },
2444
2445 {
2446 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2447 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2448 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002449 29700, 5, 2867000, 30000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002450 },
2451};
2452
Praveen Chidambaram78499012011-11-01 17:15:17 -06002453static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2454 .levels = &msm_rpmrs_levels[0],
2455 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2456 .vdd_mem_levels = {
2457 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2458 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2459 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2460 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2461 },
2462 .vdd_dig_levels = {
2463 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2464 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2465 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2466 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2467 },
2468 .vdd_mask = 0x7FFFFF,
2469 .rpmrs_target_id = {
2470 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2471 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2472 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2473 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2474 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2475 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2476 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2477 },
2478};
2479
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002480static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2481 .mode = MSM_PM_BOOT_CONFIG_TZ,
2482};
2483
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302484uint32_t msm_rpm_get_swfi_latency(void)
2485{
2486 int i;
2487
2488 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
2489 if (msm_rpmrs_levels[i].sleep_mode ==
2490 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
2491 return msm_rpmrs_levels[i].latency_us;
2492 }
2493
2494 return 0;
2495}
2496
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002497#ifdef CONFIG_I2C
2498#define I2C_SURF 1
2499#define I2C_FFA (1 << 1)
2500#define I2C_RUMI (1 << 2)
2501#define I2C_SIM (1 << 3)
2502#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002503#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002504
2505struct i2c_registry {
2506 u8 machs;
2507 int bus;
2508 struct i2c_board_info *info;
2509 int len;
2510};
2511
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002512/* Sensors DSPS platform data */
2513#ifdef CONFIG_MSM_DSPS
2514#define DSPS_PIL_GENERIC_NAME "dsps"
2515#endif /* CONFIG_MSM_DSPS */
2516
2517static void __init msm8960_init_dsps(void)
2518{
2519#ifdef CONFIG_MSM_DSPS
2520 struct msm_dsps_platform_data *pdata =
2521 msm_dsps_device.dev.platform_data;
2522 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2523 pdata->gpios = NULL;
2524 pdata->gpios_num = 0;
2525
2526 platform_device_register(&msm_dsps_device);
2527#endif /* CONFIG_MSM_DSPS */
2528}
2529
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002530static int hsic_peripheral_status = 1;
2531static DEFINE_MUTEX(hsic_status_lock);
2532
2533void peripheral_connect()
2534{
2535 mutex_lock(&hsic_status_lock);
2536 if (hsic_peripheral_status)
2537 goto out;
2538 platform_device_add(&msm_device_hsic_host);
2539 hsic_peripheral_status = 1;
2540out:
2541 mutex_unlock(&hsic_status_lock);
2542}
2543EXPORT_SYMBOL(peripheral_connect);
2544
2545void peripheral_disconnect()
2546{
2547 mutex_lock(&hsic_status_lock);
2548 if (!hsic_peripheral_status)
2549 goto out;
2550 platform_device_del(&msm_device_hsic_host);
2551 hsic_peripheral_status = 0;
2552out:
2553 mutex_unlock(&hsic_status_lock);
2554}
2555EXPORT_SYMBOL(peripheral_disconnect);
2556
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002557static void __init msm8960_init_hsic(void)
2558{
2559#ifdef CONFIG_USB_EHCI_MSM_HSIC
2560 uint32_t version = socinfo_get_version();
2561
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002562 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002563 return;
2564
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002565 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002566 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002567#endif
2568}
2569
Amir Samuelov5137e392011-09-21 17:31:25 +03002570#ifdef CONFIG_ISL9519_CHARGER
2571static struct isl_platform_data isl_data __initdata = {
2572 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2573 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2574 .max_system_voltage = 4200,
2575 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002576 .chgcurrent = 1900,
2577 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002578 .input_current = 2048,
2579};
2580
2581static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2582 {
2583 I2C_BOARD_INFO("isl9519q", 0x9),
2584 .irq = 0, /* Not required when notify-by-pmic */
2585 .platform_data = &isl_data,
2586 },
2587};
2588#endif /* CONFIG_ISL9519_CHARGER */
2589
Amir Samuelov755616d2011-12-13 16:34:46 +02002590static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2591 {
2592 I2C_BOARD_INFO("sx1508q", 0x20),
2593 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2594 },
2595};
2596
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002598#ifdef CONFIG_ISL9519_CHARGER
2599 {
2600 I2C_LIQUID,
2601 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2602 isl_charger_i2c_info,
2603 ARRAY_SIZE(isl_charger_i2c_info),
2604 },
2605#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002606 {
2607 I2C_SURF | I2C_FFA | I2C_FLUID,
2608 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2609 cyttsp_info,
2610 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002611 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302612 {
2613 I2C_LIQUID,
2614 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2615 mxt_device_info,
2616 ARRAY_SIZE(mxt_device_info),
2617 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302618 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302619 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302620 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002621 sii_device_info,
2622 ARRAY_SIZE(sii_device_info),
2623 },
2624 {
2625 I2C_LIQUID,
2626 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302627 msm_isa1200_board_info,
2628 ARRAY_SIZE(msm_isa1200_board_info),
2629 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002630 {
2631 I2C_LIQUID,
2632 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2633 liquid_io_expander_i2c_info,
2634 ARRAY_SIZE(liquid_io_expander_i2c_info),
2635 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002636};
2637#endif /* CONFIG_I2C */
2638
2639static void __init register_i2c_devices(void)
2640{
2641#ifdef CONFIG_I2C
2642 u8 mach_mask = 0;
2643 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002644#ifdef CONFIG_MSM_CAMERA
2645 struct i2c_registry msm8960_camera_i2c_devices = {
2646 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2647 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2648 msm8960_camera_board_info.board_info,
2649 msm8960_camera_board_info.num_i2c_board_info,
2650 };
2651#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002652
2653 /* Build the matching 'supported_machs' bitmask */
2654 if (machine_is_msm8960_cdp())
2655 mach_mask = I2C_SURF;
2656 else if (machine_is_msm8960_rumi3())
2657 mach_mask = I2C_RUMI;
2658 else if (machine_is_msm8960_sim())
2659 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002660 else if (machine_is_msm8960_fluid())
2661 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002662 else if (machine_is_msm8960_liquid())
2663 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002664 else if (machine_is_msm8960_mtp())
2665 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666 else
2667 pr_err("unmatched machine ID in register_i2c_devices\n");
2668
Jing Lineec88ca2012-02-08 11:18:30 -08002669 if (machine_is_msm8960_liquid()) {
2670 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
2671 mxt_device_info[0].platform_data =
2672 &mxt_platform_data_3d;
2673 else
2674 mxt_device_info[0].platform_data =
2675 &mxt_platform_data_2d;
2676 }
2677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002678 /* Run the array and install devices as appropriate */
2679 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2680 if (msm8960_i2c_devices[i].machs & mach_mask)
2681 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2682 msm8960_i2c_devices[i].info,
2683 msm8960_i2c_devices[i].len);
2684 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002685#ifdef CONFIG_MSM_CAMERA
2686 if (msm8960_camera_i2c_devices.machs & mach_mask)
2687 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2688 msm8960_camera_i2c_devices.info,
2689 msm8960_camera_i2c_devices.len);
2690#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691#endif
2692}
2693
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002694static void __init msm8960_sim_init(void)
2695{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002696 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2697 &msm8960_device_watchdog.dev.platform_data;
2698
2699 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002700 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002701 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2702 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002703 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002704 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002705 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002706 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002707
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002708 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002709 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002710 msm8960_i2c_init();
2711 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2712 msm_spm_l2_init(msm_spm_l2_data);
2713 msm8960_init_buses();
2714 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002715 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002716 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002717 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002718
2719 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2720 &msm8960_qup_spi_gsbi1_pdata;
2721 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2722
2723 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002724 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002725 slim_register_board_info(msm_slim_devices,
2726 ARRAY_SIZE(msm_slim_devices));
2727 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2728 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2729 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2730 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002731 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002732 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002733}
2734
2735static void __init msm8960_rumi3_init(void)
2736{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002737 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002738 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2739 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002741 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002742 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002743 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002744 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002745 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2746 &msm8960_qup_spi_gsbi1_pdata;
2747 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2748 msm8960_i2c_init();
2749 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2750 msm_spm_l2_init(msm_spm_l2_data);
2751 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002752 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002753 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002754 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002755 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002756 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002757 slim_register_board_info(msm_slim_devices,
2758 ARRAY_SIZE(msm_slim_devices));
2759 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2760 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2761 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2762 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002763 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002764 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002765}
2766
2767static void __init msm8960_cdp_init(void)
2768{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002769 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2770 pr_err("meminfo_init() failed!\n");
2771
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002772 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002773 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2774 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002775
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776 regulator_suppress_info_printing();
2777 if (msm_xo_init())
2778 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002779 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002780 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302781 if (machine_is_msm8960_liquid())
2782 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002783 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302784 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2785 machine_is_msm8960_cdp()) {
2786 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2787 } else if (machine_is_msm8960_liquid()) {
2788 msm_otg_pdata.phy_init_seq =
2789 liquid_v1_phy_init_seq;
2790 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302791 msm_otg_pdata.swfi_latency =
2792 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302793#ifdef CONFIG_USB_EHCI_MSM_HSIC
2794 if (machine_is_msm8960_liquid()) {
2795 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2796 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2797 }
2798#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302799 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002800 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002801 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2802 &msm8960_qup_spi_gsbi1_pdata;
2803 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002804
2805 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302806 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2807 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2808 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002809 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002810 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2812 msm_spm_l2_init(msm_spm_l2_data);
2813 msm8960_init_buses();
2814 platform_add_devices(msm_footswitch_devices,
2815 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002816 if (machine_is_msm8960_liquid())
2817 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002818 if (machine_is_msm8960_cdp())
2819 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002820 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002821 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002822 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002823 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 msm8960_init_cam();
2825 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002826 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302827 if (machine_is_msm8960_liquid())
2828 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002830 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002831 slim_register_board_info(msm_slim_devices,
2832 ARRAY_SIZE(msm_slim_devices));
2833 msm8960_init_dsps();
2834 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2835 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2836 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2837 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002838 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002839 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002840 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002841 if (PLATFORM_IS_CHARM25())
2842 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002843}
2844
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002845MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2846 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002847 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002848 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302849 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002850 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002851 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002852 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002853 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002854MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002855
2856MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2857 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002858 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002859 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302860 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002861 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002862 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002863 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002864 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002865MACHINE_END
2866
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2868 .map_io = msm8960_map_io,
2869 .reserve = msm8960_reserve,
2870 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302871 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002872 .timer = &msm_timer,
2873 .init_machine = msm8960_cdp_init,
2874 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002875 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002876MACHINE_END
2877
2878MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2879 .map_io = msm8960_map_io,
2880 .reserve = msm8960_reserve,
2881 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302882 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883 .timer = &msm_timer,
2884 .init_machine = msm8960_cdp_init,
2885 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002886 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002887MACHINE_END
2888
2889MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2890 .map_io = msm8960_map_io,
2891 .reserve = msm8960_reserve,
2892 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302893 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002894 .timer = &msm_timer,
2895 .init_machine = msm8960_cdp_init,
2896 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002897 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002898MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002899
2900MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2901 .map_io = msm8960_map_io,
2902 .reserve = msm8960_reserve,
2903 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302904 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002905 .timer = &msm_timer,
2906 .init_machine = msm8960_cdp_init,
2907 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002908 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002909MACHINE_END