blob: 724dd80f593290b25ab5d59156b1b02b98835d7c [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 Abbott306bcc22012-03-08 11:24:53 -080082#include <mach/msm_cache_dump.h>
83#include <mach/scm.h>
Laura Abbottd6183792011-08-19 13:42:24 -070084
Larry Bassel41a055b2011-12-06 16:15:14 -080085#include <linux/fmem.h>
86
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080088#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080091#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080092#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080093#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#include "rpm_resources.h"
95#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070096#include "acpuclock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070097#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060098#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070099#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700101static struct platform_device msm_fm_platform_init = {
102 .name = "iris_fm",
103 .id = -1,
104};
105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700106#define KS8851_RST_GPIO 89
107#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530108#define HAP_SHIFT_LVL_OE_GPIO 47
109
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700110#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700111
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800112struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700113 [SX150X_CAM] = {
114 .gpio_base = GPIO_CAM_EXPANDER_BASE,
115 .oscio_is_gpo = false,
116 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530117 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700118 .io_open_drain_ena = 0x0,
119 .irq_summary = -1,
120 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200121 [SX150X_LIQUID] = {
122 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
123 .oscio_is_gpo = false,
124 .io_pullup_ena = 0x0c08,
125 .io_pulldn_ena = 0x4060,
126 .io_open_drain_ena = 0x000c,
127 .io_polarity = 0,
128 .irq_summary = -1,
129 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700130};
Nishant Pandit474f2252011-07-23 23:17:56 +0530131
132#endif
133
Olav Haugana21169d2012-01-04 09:17:06 -0800134#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700135#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800136#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800137#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800138#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700139
140#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700141#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700142#ifdef CONFIG_MSM_IOMMU
143#define MSM_ION_MM_SIZE 0x3800000
144#define MSM_ION_SF_SIZE 0x0
145#define MSM_ION_HEAP_NUM 7
146#else
147#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
148#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
149#define MSM_ION_HEAP_NUM 8
150#endif
Olav Haugan42ebe712012-01-10 16:30:58 -0800151#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan424ff492012-03-13 11:41:23 -0700152#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800153#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800154#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700155
Olav Hauganb5be7992011-11-18 14:29:02 -0800156#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800157#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
158#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
159static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700160#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700161#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800162#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700163#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
166static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
167static int __init pmem_kernel_ebi1_size_setup(char *p)
168{
169 pmem_kernel_ebi1_size = memparse(p, NULL);
170 return 0;
171}
172early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
173#endif
174
175#ifdef CONFIG_ANDROID_PMEM
176static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800177static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178static int __init pmem_size_setup(char *p)
179{
180 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800181 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700182 return 0;
183}
184early_param("pmem_size", pmem_size_setup);
185
186static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
187
188static int __init pmem_adsp_size_setup(char *p)
189{
190 pmem_adsp_size = memparse(p, NULL);
191 return 0;
192}
193early_param("pmem_adsp_size", pmem_adsp_size_setup);
194
195static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
196
197static int __init pmem_audio_size_setup(char *p)
198{
199 pmem_audio_size = memparse(p, NULL);
200 return 0;
201}
202early_param("pmem_audio_size", pmem_audio_size_setup);
203#endif
204
205#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700206#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700207static struct android_pmem_platform_data android_pmem_pdata = {
208 .name = "pmem",
209 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
210 .cached = 1,
211 .memory_type = MEMTYPE_EBI1,
212};
213
214static struct platform_device android_pmem_device = {
215 .name = "android_pmem",
216 .id = 0,
217 .dev = {.platform_data = &android_pmem_pdata},
218};
219
220static struct android_pmem_platform_data android_pmem_adsp_pdata = {
221 .name = "pmem_adsp",
222 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
223 .cached = 0,
224 .memory_type = MEMTYPE_EBI1,
225};
226static struct platform_device android_pmem_adsp_device = {
227 .name = "android_pmem",
228 .id = 2,
229 .dev = { .platform_data = &android_pmem_adsp_pdata },
230};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700231#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700232
233static struct android_pmem_platform_data android_pmem_audio_pdata = {
234 .name = "pmem_audio",
235 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
236 .cached = 0,
237 .memory_type = MEMTYPE_EBI1,
238};
239
240static struct platform_device android_pmem_audio_device = {
241 .name = "android_pmem",
242 .id = 4,
243 .dev = { .platform_data = &android_pmem_audio_pdata },
244};
245#endif
246
Larry Bassel41a055b2011-12-06 16:15:14 -0800247struct fmem_platform_data fmem_pdata = {
248};
249
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700250#define DSP_RAM_BASE_8960 0x8da00000
251#define DSP_RAM_SIZE_8960 0x1800000
252static int dspcrashd_pdata_8960 = 0xDEADDEAD;
253
254static struct resource resources_dspcrashd_8960[] = {
255 {
256 .name = "msm_dspcrashd",
257 .start = DSP_RAM_BASE_8960,
258 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
259 .flags = IORESOURCE_DMA,
260 },
261};
262
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800263static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700264 .name = "msm_dspcrashd",
265 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
266 .resource = resources_dspcrashd_8960,
267 .dev = { .platform_data = &dspcrashd_pdata_8960 },
268};
269
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700270static struct memtype_reserve msm8960_reserve_table[] __initdata = {
271 [MEMTYPE_SMI] = {
272 },
273 [MEMTYPE_EBI0] = {
274 .flags = MEMTYPE_FLAGS_1M_ALIGN,
275 },
276 [MEMTYPE_EBI1] = {
277 .flags = MEMTYPE_FLAGS_1M_ALIGN,
278 },
279};
280
Laura Abbottf8c03b92012-02-16 14:57:58 -0800281#if defined(CONFIG_MSM_RTB)
282static struct msm_rtb_platform_data msm_rtb_pdata = {
283 .size = SZ_1M,
284};
285
286static int __init msm_rtb_set_buffer_size(char *p)
287{
288 int s;
289
290 s = memparse(p, NULL);
291 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
292 return 0;
293}
294early_param("msm_rtb_size", msm_rtb_set_buffer_size);
295
296
297static struct platform_device msm_rtb_device = {
298 .name = "msm_rtb",
299 .id = -1,
300 .dev = {
301 .platform_data = &msm_rtb_pdata,
302 },
303};
304#endif
305
306static void __init reserve_rtb_memory(void)
307{
308#if defined(CONFIG_MSM_RTB)
309 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
310#endif
311}
312
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313static void __init size_pmem_devices(void)
314{
315#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700316#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800318
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800319 if (!pmem_param_set) {
320 if (machine_is_msm8960_liquid())
321 pmem_size = MSM_LIQUID_PMEM_SIZE;
322 if (hdmi_is_primary)
323 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
324 }
325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700327#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700328 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
329#endif
330}
331
332static void __init reserve_memory_for(struct android_pmem_platform_data *p)
333{
334 msm8960_reserve_table[p->memory_type].size += p->size;
335}
336
337static void __init reserve_pmem_memory(void)
338{
339#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700340#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 reserve_memory_for(&android_pmem_adsp_pdata);
342 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700343#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344 reserve_memory_for(&android_pmem_audio_pdata);
345 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
346#endif
347}
348
Larry Basselb4126da2011-07-18 14:31:33 -0700349static int msm8960_paddr_to_memtype(unsigned int paddr)
350{
351 return MEMTYPE_EBI1;
352}
353
Olav Hauganf6dc7742012-02-15 09:11:55 -0800354#define FMEM_ENABLED 1
355
Laura Abbottd6183792011-08-19 13:42:24 -0700356#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800357#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
358static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
359 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800360 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800361 .reusable = FMEM_ENABLED,
362 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800363};
364
365static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
366 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800367 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800368 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800369 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800370};
371
372static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800373 .adjacent_mem_id = INVALID_HEAP_ID,
374 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800375 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800376};
377
378static struct ion_co_heap_pdata fw_co_ion_pdata = {
379 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
380 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800381 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800382};
383#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800384
385/**
386 * These heaps are listed in the order they will be allocated. Due to
387 * video hardware restrictions and content protection the FW heap has to
388 * be allocated adjacent (below) the MM heap and the MFC heap has to be
389 * allocated after the MM heap to ensure MFC heap is not more than 256MB
390 * away from the base address of the FW heap.
391 * However, the order of FW heap and MM heap doesn't matter since these
392 * two heaps are taken care of by separate code to ensure they are adjacent
393 * to each other.
394 * Don't swap the order unless you know what you are doing!
395 */
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800396static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700397 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700398 .heaps = {
399 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800400 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700401 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700402 .name = ION_VMALLOC_HEAP_NAME,
403 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700404#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700405 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800407 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 .name = ION_MM_HEAP_NAME,
409 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700410 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800411 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700412 },
Laura Abbott8c017362011-09-22 20:59:12 -0700413 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800414 .id = ION_MM_FIRMWARE_HEAP_ID,
415 .type = ION_HEAP_TYPE_CARVEOUT,
416 .name = ION_MM_FIRMWARE_HEAP_NAME,
417 .size = MSM_ION_MM_FW_SIZE,
418 .memory_type = ION_EBI_TYPE,
419 .extra_data = (void *) &fw_co_ion_pdata,
420 },
421 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800423 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 .name = ION_MFC_HEAP_NAME,
425 .size = MSM_ION_MFC_SIZE,
426 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800427 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800428 },
Olav Haugan32594552012-03-13 11:40:05 -0700429#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800430 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800431 .id = ION_SF_HEAP_ID,
432 .type = ION_HEAP_TYPE_CARVEOUT,
433 .name = ION_SF_HEAP_NAME,
434 .size = MSM_ION_SF_SIZE,
435 .memory_type = ION_EBI_TYPE,
436 .extra_data = (void *) &co_ion_pdata,
437 },
Olav Haugan32594552012-03-13 11:40:05 -0700438#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800439 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800440 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700441 .type = ION_HEAP_TYPE_IOMMU,
442 .name = ION_IOMMU_HEAP_NAME,
443 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800444 {
445 .id = ION_QSECOM_HEAP_ID,
446 .type = ION_HEAP_TYPE_CARVEOUT,
447 .name = ION_QSECOM_HEAP_NAME,
448 .size = MSM_ION_QSECOM_SIZE,
449 .memory_type = ION_EBI_TYPE,
450 .extra_data = (void *) &co_ion_pdata,
451 },
Olav Haugan7355db02012-01-13 16:59:13 -0800452 {
453 .id = ION_AUDIO_HEAP_ID,
454 .type = ION_HEAP_TYPE_CARVEOUT,
455 .name = ION_AUDIO_HEAP_NAME,
456 .size = MSM_ION_AUDIO_SIZE,
457 .memory_type = ION_EBI_TYPE,
458 .extra_data = (void *) &co_ion_pdata,
459 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700460#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700461 }
462};
463
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800464static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700465 .name = "ion-msm",
466 .id = 1,
467 .dev = { .platform_data = &ion_pdata },
468};
469#endif
470
Larry Bassel41a055b2011-12-06 16:15:14 -0800471struct platform_device fmem_device = {
472 .name = "fmem",
473 .id = 1,
474 .dev = { .platform_data = &fmem_pdata },
475};
476
Olav Haugan65f4bd82011-12-13 11:50:08 -0800477static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700478{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800479 unsigned int i;
480
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800481 if (!pmem_param_set) {
482 if (machine_is_msm8960_liquid())
483 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
484
485 if (hdmi_is_primary)
486 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
487
488 if (machine_is_msm8960_liquid() || hdmi_is_primary) {
489 for (i = 0; i < ion_pdata.nr; i++) {
490 if (ion_pdata.heaps[i].id == ION_SF_HEAP_ID) {
491 ion_pdata.heaps[i].size =
492 msm_ion_sf_size;
493 pr_debug("msm_ion_sf_size 0x%x\n",
494 msm_ion_sf_size);
495 break;
496 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800497 }
498 }
499 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800500}
501
502static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
503 unsigned long size)
504{
505 msm8960_reserve_table[mem_type].size += size;
506}
507
Olav Haugan65f4bd82011-12-13 11:50:08 -0800508/**
509 * Reserve memory for ION and calculate amount of reusable memory for fmem.
510 * We only reserve memory for heaps that are not reusable. However, we only
511 * support one reusable heap at the moment so we ignore the reusable flag for
512 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800513 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
514 * at a higher address than FW in addition to not more than 256MB away from the
515 * base address of the firmware. This means that if MM is reusable the other
516 * two heaps must be allocated in the same region as FW. This is handled by the
517 * mem_is_fmem flag in the platform data. In addition the MM heap must be
518 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800519 */
520static void __init reserve_ion_memory(void)
521{
522#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
523 unsigned int i;
524 unsigned int reusable_count = 0;
525
526 adjust_mem_for_liquid();
527 fmem_pdata.size = 0;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800528 fmem_pdata.reserved_size_low = 0;
529 fmem_pdata.reserved_size_high = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800530
531 /* We only support 1 reusable heap. Check if more than one heap
532 * is specified as reusable and set as non-reusable if found.
533 */
534 for (i = 0; i < ion_pdata.nr; ++i) {
535 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
536
537 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
538 struct ion_cp_heap_pdata *data = heap->extra_data;
539
540 reusable_count += (data->reusable) ? 1 : 0;
541
542 if (data->reusable && reusable_count > 1) {
543 pr_err("%s: Too many heaps specified as "
544 "reusable. Heap %s was not configured "
545 "as reusable.\n", __func__, heap->name);
546 data->reusable = 0;
547 }
548 }
549 }
550
551 for (i = 0; i < ion_pdata.nr; ++i) {
552 int reusable = 0;
553 int adjacent_heap_id = INVALID_HEAP_ID;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800554 int mem_is_fmem = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800555 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
556
557 if (heap->extra_data) {
558 switch (heap->type) {
559 case ION_HEAP_TYPE_CP:
560 reusable = ((struct ion_cp_heap_pdata *)
561 heap->extra_data)->reusable;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800562 mem_is_fmem = ((struct ion_cp_heap_pdata *)
563 heap->extra_data)->mem_is_fmem;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800564 break;
565 case ION_HEAP_TYPE_CARVEOUT:
566 adjacent_heap_id = ((struct ion_co_heap_pdata *)
567 heap->extra_data)->adjacent_mem_id;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800568 mem_is_fmem = ((struct ion_co_heap_pdata *)
569 heap->extra_data)->mem_is_fmem;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800570 break;
571 default:
572 break;
573 }
574 }
575
Olav Hauganf6dc7742012-02-15 09:11:55 -0800576 if (mem_is_fmem && !reusable) {
577 if (adjacent_heap_id != INVALID_HEAP_ID)
578 fmem_pdata.reserved_size_low += heap->size;
579 else
580 fmem_pdata.reserved_size_high += heap->size;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800581 }
Olav Hauganf6dc7742012-02-15 09:11:55 -0800582 if (mem_is_fmem)
Olav Haugan65f4bd82011-12-13 11:50:08 -0800583 fmem_pdata.size += heap->size;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800584 else
585 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800586 }
Laura Abbottd6183792011-08-19 13:42:24 -0700587#endif
588}
Huaibin Yanga5419422011-12-08 23:52:10 -0800589
590static void __init reserve_mdp_memory(void)
591{
592 msm8960_mdp_writeback(msm8960_reserve_table);
593}
594
Laura Abbott306bcc22012-03-08 11:24:53 -0800595#if defined(CONFIG_MSM_CACHE_DUMP)
596static struct msm_cache_dump_platform_data msm_cache_dump_pdata = {
597 .l2_size = L2_BUFFER_SIZE,
598};
599
600static struct platform_device msm_cache_dump_device = {
601 .name = "msm_cache_dump",
602 .id = -1,
603 .dev = {
604 .platform_data = &msm_cache_dump_pdata,
605 },
606};
607
608#endif
609
610static void reserve_cache_dump_memory(void)
611{
612#ifdef CONFIG_MSM_CACHE_DUMP
613 unsigned int spare;
614 unsigned int l1_size;
615 unsigned int total;
616 int ret;
617
618 ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
619 sizeof(spare), &l1_size, sizeof(l1_size));
620
621 if (ret)
622 /* Fall back to something reasonable here */
623 l1_size = L1_BUFFER_SIZE;
624
625 total = l1_size + L2_BUFFER_SIZE;
626
627 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
628 msm_cache_dump_pdata.l1_size = l1_size;
629#endif
630}
631
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700632static void __init msm8960_calculate_reserve_sizes(void)
633{
634 size_pmem_devices();
635 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700636 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800637 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800638 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800639 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700640}
641
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642static struct reserve_info msm8960_reserve_info __initdata = {
643 .memtype_reserve_table = msm8960_reserve_table,
644 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
645 .paddr_to_memtype = msm8960_paddr_to_memtype,
646};
647
Larry Basselb4126da2011-07-18 14:31:33 -0700648static int msm8960_memory_bank_size(void)
649{
650 return 1<<29;
651}
652
653static void __init locate_unstable_memory(void)
654{
655 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
656 unsigned long bank_size;
657 unsigned long low, high;
658
659 bank_size = msm8960_memory_bank_size();
660 low = meminfo.bank[0].start;
661 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700662
663 /* Check if 32 bit overflow occured */
664 if (high < mb->start)
665 high = ~0UL;
666
Larry Basselb4126da2011-07-18 14:31:33 -0700667 low &= ~(bank_size - 1);
668
669 if (high - low <= bank_size)
670 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800671
672 msm8960_reserve_info.bank_size = bank_size;
673#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800674 msm8960_reserve_info.low_unstable_address = mb->start -
675 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800676 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700677 pr_info("low unstable address %lx max size %lx bank size %lx\n",
678 msm8960_reserve_info.low_unstable_address,
679 msm8960_reserve_info.max_unstable_size,
680 msm8960_reserve_info.bank_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800681#else
682 msm8960_reserve_info.low_unstable_address = 0;
683 msm8960_reserve_info.max_unstable_size = 0;
684#endif
Larry Basselb4126da2011-07-18 14:31:33 -0700685}
686
Larry Basselb830e182011-10-14 10:46:55 -0700687static void __init place_movable_zone(void)
688{
Larry Basselb8d61022012-02-24 10:49:45 -0800689#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700690 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
691 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
692 pr_info("movable zone start %lx size %lx\n",
693 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800694#endif
Larry Basselb830e182011-10-14 10:46:55 -0700695}
696
697static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700698{
699 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700700 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700701 place_movable_zone();
702}
703
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800704static char prim_panel_name[PANEL_NAME_MAX_LEN];
705static char ext_panel_name[PANEL_NAME_MAX_LEN];
706static int __init prim_display_setup(char *param)
707{
708 if (strnlen(param, PANEL_NAME_MAX_LEN))
709 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
710 return 0;
711}
712early_param("prim_display", prim_display_setup);
713
714static int __init ext_display_setup(char *param)
715{
716 if (strnlen(param, PANEL_NAME_MAX_LEN))
717 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
718 return 0;
719}
720early_param("ext_display", ext_display_setup);
721
Larry Basselb830e182011-10-14 10:46:55 -0700722static void __init msm8960_reserve(void)
723{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800724 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700725 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800726 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700727}
728
Larry Bassela4414b12011-08-04 11:11:02 -0700729static int msm8960_change_memory_power(u64 start, u64 size,
730 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700731{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700732 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700733}
734
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735static void __init msm8960_allocate_memory_regions(void)
736{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800737 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700738}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800739
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700740#ifdef CONFIG_WCD9310_CODEC
741
742#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
743
Patrick Lai3043fba2011-08-01 14:15:57 -0700744/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
745 * 4 micbiases are used to power various analog and digital
746 * microphones operating at 1800 mV. Technically, all micbiases
747 * can source from single cfilter since all microphones operate
748 * at the same voltage level. The arrangement below is to make
749 * sure all cfilters are exercised. LDO_H regulator ouput level
750 * does not need to be as high as 2.85V. It is choosen for
751 * microphone sensitivity purpose.
752 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530753static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754 .slimbus_slave_device = {
755 .name = "tabla-slave",
756 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
757 },
758 .irq = MSM_GPIO_TO_INT(62),
759 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530760 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700762 .micbias = {
763 .ldoh_v = TABLA_LDOH_2P85_V,
764 .cfilt1_mv = 1800,
765 .cfilt2_mv = 1800,
766 .cfilt3_mv = 1800,
767 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
768 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
769 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
770 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530771 },
772 .regulator = {
773 {
774 .name = "CDC_VDD_CP",
775 .min_uV = 1800000,
776 .max_uV = 1800000,
777 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
778 },
779 {
780 .name = "CDC_VDDA_RX",
781 .min_uV = 1800000,
782 .max_uV = 1800000,
783 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
784 },
785 {
786 .name = "CDC_VDDA_TX",
787 .min_uV = 1800000,
788 .max_uV = 1800000,
789 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
790 },
791 {
792 .name = "VDDIO_CDC",
793 .min_uV = 1800000,
794 .max_uV = 1800000,
795 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
796 },
797 {
798 .name = "VDDD_CDC_D",
799 .min_uV = 1225000,
800 .max_uV = 1225000,
801 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
802 },
803 {
804 .name = "CDC_VDDA_A_1P2V",
805 .min_uV = 1225000,
806 .max_uV = 1225000,
807 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
808 },
809 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700810};
811
812static struct slim_device msm_slim_tabla = {
813 .name = "tabla-slim",
814 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
815 .dev = {
816 .platform_data = &tabla_platform_data,
817 },
818};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530819
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530820static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530821 .slimbus_slave_device = {
822 .name = "tabla-slave",
823 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
824 },
825 .irq = MSM_GPIO_TO_INT(62),
826 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530827 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530828 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
829 .micbias = {
830 .ldoh_v = TABLA_LDOH_2P85_V,
831 .cfilt1_mv = 1800,
832 .cfilt2_mv = 1800,
833 .cfilt3_mv = 1800,
834 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
835 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
836 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
837 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530838 },
839 .regulator = {
840 {
841 .name = "CDC_VDD_CP",
842 .min_uV = 1800000,
843 .max_uV = 1800000,
844 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
845 },
846 {
847 .name = "CDC_VDDA_RX",
848 .min_uV = 1800000,
849 .max_uV = 1800000,
850 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
851 },
852 {
853 .name = "CDC_VDDA_TX",
854 .min_uV = 1800000,
855 .max_uV = 1800000,
856 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
857 },
858 {
859 .name = "VDDIO_CDC",
860 .min_uV = 1800000,
861 .max_uV = 1800000,
862 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
863 },
864 {
865 .name = "VDDD_CDC_D",
866 .min_uV = 1225000,
867 .max_uV = 1225000,
868 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
869 },
870 {
871 .name = "CDC_VDDA_A_1P2V",
872 .min_uV = 1225000,
873 .max_uV = 1225000,
874 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
875 },
876 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530877};
878
879static struct slim_device msm_slim_tabla20 = {
880 .name = "tabla2x-slim",
881 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
882 .dev = {
883 .platform_data = &tabla20_platform_data,
884 },
885};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700886#endif
887
888static struct slim_boardinfo msm_slim_devices[] = {
889#ifdef CONFIG_WCD9310_CODEC
890 {
891 .bus_num = 1,
892 .slim_slave = &msm_slim_tabla,
893 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530894 {
895 .bus_num = 1,
896 .slim_slave = &msm_slim_tabla20,
897 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700898#endif
899 /* add more slimbus slaves as needed */
900};
901
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700902#define MSM_WCNSS_PHYS 0x03000000
903#define MSM_WCNSS_SIZE 0x280000
904
905static struct resource resources_wcnss_wlan[] = {
906 {
907 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
908 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
909 .name = "wcnss_wlanrx_irq",
910 .flags = IORESOURCE_IRQ,
911 },
912 {
913 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
914 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
915 .name = "wcnss_wlantx_irq",
916 .flags = IORESOURCE_IRQ,
917 },
918 {
919 .start = MSM_WCNSS_PHYS,
920 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
921 .name = "wcnss_mmio",
922 .flags = IORESOURCE_MEM,
923 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700924 {
925 .start = 84,
926 .end = 88,
927 .name = "wcnss_gpios_5wire",
928 .flags = IORESOURCE_IO,
929 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700930};
931
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700932static struct qcom_wcnss_opts qcom_wcnss_pdata = {
933 .has_48mhz_xo = 1,
934};
935
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700936static struct platform_device msm_device_wcnss_wlan = {
937 .name = "wcnss_wlan",
938 .id = 0,
939 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
940 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700941 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700942};
943
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700944#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
945 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
946 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
947 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
948
949#define QCE_SIZE 0x10000
950#define QCE_0_BASE 0x18500000
951
952#define QCE_HW_KEY_SUPPORT 0
953#define QCE_SHA_HMAC_SUPPORT 1
954#define QCE_SHARE_CE_RESOURCE 1
955#define QCE_CE_SHARED 0
956
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800957/* Begin Bus scaling definitions */
958static struct msm_bus_vectors crypto_hw_init_vectors[] = {
959 {
960 .src = MSM_BUS_MASTER_ADM_PORT0,
961 .dst = MSM_BUS_SLAVE_EBI_CH0,
962 .ab = 0,
963 .ib = 0,
964 },
965 {
966 .src = MSM_BUS_MASTER_ADM_PORT1,
967 .dst = MSM_BUS_SLAVE_GSBI1_UART,
968 .ab = 0,
969 .ib = 0,
970 },
971};
972
973static struct msm_bus_vectors crypto_hw_active_vectors[] = {
974 {
975 .src = MSM_BUS_MASTER_ADM_PORT0,
976 .dst = MSM_BUS_SLAVE_EBI_CH0,
977 .ab = 70000000UL,
978 .ib = 70000000UL,
979 },
980 {
981 .src = MSM_BUS_MASTER_ADM_PORT1,
982 .dst = MSM_BUS_SLAVE_GSBI1_UART,
983 .ab = 2480000000UL,
984 .ib = 2480000000UL,
985 },
986};
987
988static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
989 {
990 ARRAY_SIZE(crypto_hw_init_vectors),
991 crypto_hw_init_vectors,
992 },
993 {
994 ARRAY_SIZE(crypto_hw_active_vectors),
995 crypto_hw_active_vectors,
996 },
997};
998
999static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1000 crypto_hw_bus_scale_usecases,
1001 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1002 .name = "cryptohw",
1003};
1004/* End Bus Scaling Definitions*/
1005
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001006static struct resource qcrypto_resources[] = {
1007 [0] = {
1008 .start = QCE_0_BASE,
1009 .end = QCE_0_BASE + QCE_SIZE - 1,
1010 .flags = IORESOURCE_MEM,
1011 },
1012 [1] = {
1013 .name = "crypto_channels",
1014 .start = DMOV_CE_IN_CHAN,
1015 .end = DMOV_CE_OUT_CHAN,
1016 .flags = IORESOURCE_DMA,
1017 },
1018 [2] = {
1019 .name = "crypto_crci_in",
1020 .start = DMOV_CE_IN_CRCI,
1021 .end = DMOV_CE_IN_CRCI,
1022 .flags = IORESOURCE_DMA,
1023 },
1024 [3] = {
1025 .name = "crypto_crci_out",
1026 .start = DMOV_CE_OUT_CRCI,
1027 .end = DMOV_CE_OUT_CRCI,
1028 .flags = IORESOURCE_DMA,
1029 },
1030};
1031
1032static struct resource qcedev_resources[] = {
1033 [0] = {
1034 .start = QCE_0_BASE,
1035 .end = QCE_0_BASE + QCE_SIZE - 1,
1036 .flags = IORESOURCE_MEM,
1037 },
1038 [1] = {
1039 .name = "crypto_channels",
1040 .start = DMOV_CE_IN_CHAN,
1041 .end = DMOV_CE_OUT_CHAN,
1042 .flags = IORESOURCE_DMA,
1043 },
1044 [2] = {
1045 .name = "crypto_crci_in",
1046 .start = DMOV_CE_IN_CRCI,
1047 .end = DMOV_CE_IN_CRCI,
1048 .flags = IORESOURCE_DMA,
1049 },
1050 [3] = {
1051 .name = "crypto_crci_out",
1052 .start = DMOV_CE_OUT_CRCI,
1053 .end = DMOV_CE_OUT_CRCI,
1054 .flags = IORESOURCE_DMA,
1055 },
1056};
1057
1058#endif
1059
1060#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1061 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1062
1063static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1064 .ce_shared = QCE_CE_SHARED,
1065 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1066 .hw_key_support = QCE_HW_KEY_SUPPORT,
1067 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001068 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001069};
1070
1071static struct platform_device qcrypto_device = {
1072 .name = "qcrypto",
1073 .id = 0,
1074 .num_resources = ARRAY_SIZE(qcrypto_resources),
1075 .resource = qcrypto_resources,
1076 .dev = {
1077 .coherent_dma_mask = DMA_BIT_MASK(32),
1078 .platform_data = &qcrypto_ce_hw_suppport,
1079 },
1080};
1081#endif
1082
1083#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1084 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1085
1086static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1087 .ce_shared = QCE_CE_SHARED,
1088 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1089 .hw_key_support = QCE_HW_KEY_SUPPORT,
1090 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001091 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001092};
1093
1094static struct platform_device qcedev_device = {
1095 .name = "qce",
1096 .id = 0,
1097 .num_resources = ARRAY_SIZE(qcedev_resources),
1098 .resource = qcedev_resources,
1099 .dev = {
1100 .coherent_dma_mask = DMA_BIT_MASK(32),
1101 .platform_data = &qcedev_ce_hw_suppport,
1102 },
1103};
1104#endif
1105
Joel Kingb8352a12011-11-15 18:46:24 -08001106#define MDM2AP_ERRFATAL 70
1107#define AP2MDM_ERRFATAL 95
1108#define MDM2AP_STATUS 69
1109#define AP2MDM_STATUS 94
1110#define AP2MDM_PMIC_RESET_N 80
1111#define AP2MDM_KPDPWR_N 81
1112
Joel Kingb8352a12011-11-15 18:46:24 -08001113static struct resource mdm_resources[] = {
1114 {
1115 .start = MDM2AP_ERRFATAL,
1116 .end = MDM2AP_ERRFATAL,
1117 .name = "MDM2AP_ERRFATAL",
1118 .flags = IORESOURCE_IO,
1119 },
1120 {
1121 .start = AP2MDM_ERRFATAL,
1122 .end = AP2MDM_ERRFATAL,
1123 .name = "AP2MDM_ERRFATAL",
1124 .flags = IORESOURCE_IO,
1125 },
1126 {
1127 .start = MDM2AP_STATUS,
1128 .end = MDM2AP_STATUS,
1129 .name = "MDM2AP_STATUS",
1130 .flags = IORESOURCE_IO,
1131 },
1132 {
1133 .start = AP2MDM_STATUS,
1134 .end = AP2MDM_STATUS,
1135 .name = "AP2MDM_STATUS",
1136 .flags = IORESOURCE_IO,
1137 },
1138 {
1139 .start = AP2MDM_PMIC_RESET_N,
1140 .end = AP2MDM_PMIC_RESET_N,
1141 .name = "AP2MDM_PMIC_RESET_N",
1142 .flags = IORESOURCE_IO,
1143 },
1144 {
1145 .start = AP2MDM_KPDPWR_N,
1146 .end = AP2MDM_KPDPWR_N,
1147 .name = "AP2MDM_KPDPWR_N",
1148 .flags = IORESOURCE_IO,
1149 },
1150};
1151
1152static struct mdm_platform_data mdm_platform_data = {
1153 .mdm_version = "2.5",
1154};
1155
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001156static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -08001157 .name = "mdm2_modem",
1158 .id = -1,
1159 .num_resources = ARRAY_SIZE(mdm_resources),
1160 .resource = mdm_resources,
1161 .dev = {
1162 .platform_data = &mdm_platform_data,
1163 },
1164};
1165
1166static struct platform_device *mdm_devices[] __initdata = {
1167 &mdm_device,
1168};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001169
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001170#define MSM_SHARED_RAM_PHYS 0x80000000
1171
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001172static void __init msm8960_map_io(void)
1173{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001174 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001175 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001176
1177 if (socinfo_init() < 0)
1178 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001179}
1180
1181static void __init msm8960_init_irq(void)
1182{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001183 struct msm_mpm_device_data *data = NULL;
1184
1185#ifdef CONFIG_MSM_MPM
1186 data = &msm8960_mpm_dev_data;
1187#endif
1188
1189 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001190 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001191 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001192}
1193
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001194static void __init msm8960_init_buses(void)
1195{
1196#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001197 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001198 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1199 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1200 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1201 msm_bus_apps_fabric.dev.platform_data =
1202 &msm_bus_8960_apps_fabric_pdata;
1203 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1204 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1205 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1206 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001207#endif
1208}
1209
1210static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1211 .max_clock_speed = 15060000,
1212};
1213
1214#ifdef CONFIG_USB_MSM_OTG_72K
1215static struct msm_otg_platform_data msm_otg_pdata;
1216#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301217static int wr_phy_init_seq[] = {
1218 0x44, 0x80, /* set VBUS valid threshold
1219 and disconnect valid threshold */
1220 0x38, 0x81, /* update DC voltage level */
1221 0x14, 0x82, /* set preemphasis and rise/fall time */
1222 0x13, 0x83, /* set source impedance adjusment */
1223 -1};
1224
1225static int liquid_v1_phy_init_seq[] = {
1226 0x44, 0x80,/* set VBUS valid threshold
1227 and disconnect valid threshold */
1228 0x3C, 0x81,/* update DC voltage level */
1229 0x18, 0x82,/* set preemphasis and rise/fall time */
1230 0x23, 0x83,/* set source impedance sdjusment */
1231 -1};
1232
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301233#ifdef CONFIG_MSM_BUS_SCALING
1234/* Bandwidth requests (zero) if no vote placed */
1235static struct msm_bus_vectors usb_init_vectors[] = {
1236 {
1237 .src = MSM_BUS_MASTER_SPS,
1238 .dst = MSM_BUS_SLAVE_EBI_CH0,
1239 .ab = 0,
1240 .ib = 0,
1241 },
1242};
1243
1244/* Bus bandwidth requests in Bytes/sec */
1245static struct msm_bus_vectors usb_max_vectors[] = {
1246 {
1247 .src = MSM_BUS_MASTER_SPS,
1248 .dst = MSM_BUS_SLAVE_EBI_CH0,
1249 .ab = 60000000, /* At least 480Mbps on bus. */
1250 .ib = 960000000, /* MAX bursts rate */
1251 },
1252};
1253
1254static struct msm_bus_paths usb_bus_scale_usecases[] = {
1255 {
1256 ARRAY_SIZE(usb_init_vectors),
1257 usb_init_vectors,
1258 },
1259 {
1260 ARRAY_SIZE(usb_max_vectors),
1261 usb_max_vectors,
1262 },
1263};
1264
1265static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1266 usb_bus_scale_usecases,
1267 ARRAY_SIZE(usb_bus_scale_usecases),
1268 .name = "usb",
1269};
1270#endif
1271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001272static struct msm_otg_platform_data msm_otg_pdata = {
1273 .mode = USB_OTG,
1274 .otg_control = OTG_PMIC_CONTROL,
1275 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301277 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301278#ifdef CONFIG_MSM_BUS_SCALING
1279 .bus_scale_table = &usb_bus_scale_pdata,
1280#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001281};
1282#endif
1283
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301284#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301285#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301286static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1287 .strobe = 150,
1288 .data = 151,
1289};
1290#else
1291static struct msm_hsic_host_platform_data msm_hsic_pdata;
1292#endif
1293
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001294#define PID_MAGIC_ID 0x71432909
1295#define SERIAL_NUM_MAGIC_ID 0x61945374
1296#define SERIAL_NUMBER_LENGTH 127
1297#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1298
1299struct magic_num_struct {
1300 uint32_t pid;
1301 uint32_t serial_num;
1302};
1303
1304struct dload_struct {
1305 uint32_t reserved1;
1306 uint32_t reserved2;
1307 uint32_t reserved3;
1308 uint16_t reserved4;
1309 uint16_t pid;
1310 char serial_number[SERIAL_NUMBER_LENGTH];
1311 uint16_t reserved5;
1312 struct magic_num_struct magic_struct;
1313};
1314
1315static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1316{
1317 struct dload_struct __iomem *dload = 0;
1318
1319 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1320 if (!dload) {
1321 pr_err("%s: cannot remap I/O memory region: %08x\n",
1322 __func__, DLOAD_USB_BASE_ADD);
1323 return -ENXIO;
1324 }
1325
1326 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1327 __func__, dload, pid, snum);
1328 /* update pid */
1329 dload->magic_struct.pid = PID_MAGIC_ID;
1330 dload->pid = pid;
1331
1332 /* update serial number */
1333 dload->magic_struct.serial_num = 0;
1334 if (!snum) {
1335 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1336 goto out;
1337 }
1338
1339 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001340 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001341out:
1342 iounmap(dload);
1343 return 0;
1344}
1345
1346static struct android_usb_platform_data android_usb_pdata = {
1347 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1348};
1349
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001350static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351 .name = "android_usb",
1352 .id = -1,
1353 .dev = {
1354 .platform_data = &android_usb_pdata,
1355 },
1356};
1357
1358static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1359 0x03, 0x0f,
1360};
1361
1362static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1363 0x00, 0x24, 0x54, 0x10,
1364 0x09, 0x03, 0x01,
1365 0x10, 0x54, 0x30, 0x0C,
1366 0x24, 0x30, 0x0f,
1367};
1368
1369static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1370 0x00, 0x24, 0x54, 0x10,
1371 0x09, 0x07, 0x01, 0x0B,
1372 0x10, 0x54, 0x30, 0x0C,
1373 0x24, 0x30, 0x0f,
1374};
1375
1376static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1377 [0] = {
1378 .mode = MSM_SPM_MODE_CLOCK_GATING,
1379 .notify_rpm = false,
1380 .cmd = spm_wfi_cmd_sequence,
1381 },
1382 [1] = {
1383 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1384 .notify_rpm = false,
1385 .cmd = spm_power_collapse_without_rpm,
1386 },
1387 [2] = {
1388 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1389 .notify_rpm = true,
1390 .cmd = spm_power_collapse_with_rpm,
1391 },
1392};
1393
1394static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1395 [0] = {
1396 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001397 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001398#if defined(CONFIG_MSM_AVS_HW)
1399 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1400 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1401#endif
1402 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001403 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1405 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1406 .vctl_timeout_us = 50,
1407 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1408 .modes = msm_spm_seq_list,
1409 },
1410 [1] = {
1411 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001412 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413#if defined(CONFIG_MSM_AVS_HW)
1414 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1415 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1416#endif
1417 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
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] = 0x0060009C,
1420 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1421 .vctl_timeout_us = 50,
1422 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1423 .modes = msm_spm_seq_list,
1424 },
1425};
1426
1427static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1428 0x00, 0x20, 0x03, 0x20,
1429 0x00, 0x0f,
1430};
1431
1432static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1433 0x00, 0x20, 0x34, 0x64,
1434 0x48, 0x07, 0x48, 0x20,
1435 0x50, 0x64, 0x04, 0x34,
1436 0x50, 0x0f,
1437};
1438static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1439 0x00, 0x10, 0x34, 0x64,
1440 0x48, 0x07, 0x48, 0x10,
1441 0x50, 0x64, 0x04, 0x34,
1442 0x50, 0x0F,
1443};
1444
1445static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1446 [0] = {
1447 .mode = MSM_SPM_L2_MODE_RETENTION,
1448 .notify_rpm = false,
1449 .cmd = l2_spm_wfi_cmd_sequence,
1450 },
1451 [1] = {
1452 .mode = MSM_SPM_L2_MODE_GDHS,
1453 .notify_rpm = true,
1454 .cmd = l2_spm_gdhs_cmd_sequence,
1455 },
1456 [2] = {
1457 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1458 .notify_rpm = true,
1459 .cmd = l2_spm_power_off_cmd_sequence,
1460 },
1461};
1462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001463static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1464 [0] = {
1465 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001466 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001467 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1469 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1470 .modes = msm_spm_l2_seq_list,
1471 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1472 },
1473};
1474
Mohan Pallaka5e490392011-09-09 15:18:41 +05301475#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1476#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1477
1478static struct msm_xo_voter *xo_handle_d1;
1479
1480static int isa1200_power(int on)
1481{
1482 int rc = 0;
1483
1484 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1485
1486 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1487 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1488 if (rc < 0) {
1489 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1490 __func__, on ? "" : "de-", rc);
1491 goto err_xo_vote;
1492 }
1493
1494 return 0;
1495
1496err_xo_vote:
1497 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1498 return rc;
1499}
1500
1501static int isa1200_dev_setup(bool enable)
1502{
1503 int rc = 0;
1504
1505 struct pm_gpio hap_gpio_config = {
1506 .direction = PM_GPIO_DIR_OUT,
1507 .pull = PM_GPIO_PULL_NO,
1508 .out_strength = PM_GPIO_STRENGTH_HIGH,
1509 .function = PM_GPIO_FUNC_NORMAL,
1510 .inv_int_pol = 0,
1511 .vin_sel = 2,
1512 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1513 .output_value = 0,
1514 };
1515
1516 if (enable == true) {
1517 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1518 if (rc) {
1519 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1520 __func__, PM_HAP_EN_GPIO, rc);
1521 return rc;
1522 }
1523
1524 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1525 if (rc) {
1526 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1527 __func__, PM_HAP_LEN_GPIO, rc);
1528 return rc;
1529 }
1530
1531 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1532 if (rc) {
1533 pr_err("%s: unable to request gpio %d (%d)\n",
1534 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1535 return rc;
1536 }
1537
1538 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1539 if (rc) {
1540 pr_err("%s: Unable to set direction\n", __func__);
1541 goto free_gpio;
1542 }
1543
1544 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1545 if (IS_ERR(xo_handle_d1)) {
1546 rc = PTR_ERR(xo_handle_d1);
1547 pr_err("%s: failed to get the handle for D1(%d)\n",
1548 __func__, rc);
1549 goto gpio_set_dir;
1550 }
1551 } else {
1552 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1553
1554 msm_xo_put(xo_handle_d1);
1555 }
1556
1557 return 0;
1558
1559gpio_set_dir:
1560 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1561free_gpio:
1562 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1563 return rc;
1564}
1565
1566static struct isa1200_regulator isa1200_reg_data[] = {
1567 {
1568 .name = "vcc_i2c",
1569 .min_uV = ISA_I2C_VTG_MIN_UV,
1570 .max_uV = ISA_I2C_VTG_MAX_UV,
1571 .load_uA = ISA_I2C_CURR_UA,
1572 },
1573};
1574
1575static struct isa1200_platform_data isa1200_1_pdata = {
1576 .name = "vibrator",
1577 .dev_setup = isa1200_dev_setup,
1578 .power_on = isa1200_power,
1579 .hap_en_gpio = PM_HAP_EN_GPIO,
1580 .hap_len_gpio = PM_HAP_LEN_GPIO,
1581 .max_timeout = 15000,
1582 .mode_ctrl = PWM_GEN_MODE,
1583 .pwm_fd = {
1584 .pwm_div = 256,
1585 },
1586 .is_erm = false,
1587 .smart_en = true,
1588 .ext_clk_en = true,
1589 .chip_en = 1,
1590 .regulator_info = isa1200_reg_data,
1591 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1592};
1593
1594static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1595 {
1596 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301597 },
1598};
1599
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001600#define CYTTSP_TS_GPIO_IRQ 11
1601#define CYTTSP_TS_SLEEP_GPIO 50
1602#define CYTTSP_TS_RESOUT_N_GPIO 52
1603
1604/*virtual key support */
1605static ssize_t tma340_vkeys_show(struct kobject *kobj,
1606 struct kobj_attribute *attr, char *buf)
1607{
1608 return snprintf(buf, 200,
1609 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1610 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1611 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1612 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1613 "\n");
1614}
1615
1616static struct kobj_attribute tma340_vkeys_attr = {
1617 .attr = {
1618 .mode = S_IRUGO,
1619 },
1620 .show = &tma340_vkeys_show,
1621};
1622
1623static struct attribute *tma340_properties_attrs[] = {
1624 &tma340_vkeys_attr.attr,
1625 NULL
1626};
1627
1628static struct attribute_group tma340_properties_attr_group = {
1629 .attrs = tma340_properties_attrs,
1630};
1631
1632
1633static int cyttsp_platform_init(struct i2c_client *client)
1634{
1635 int rc = 0;
1636 static struct kobject *tma340_properties_kobj;
1637
1638 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1639 tma340_properties_kobj = kobject_create_and_add("board_properties",
1640 NULL);
1641 if (tma340_properties_kobj)
1642 rc = sysfs_create_group(tma340_properties_kobj,
1643 &tma340_properties_attr_group);
1644 if (!tma340_properties_kobj || rc)
1645 pr_err("%s: failed to create board_properties\n",
1646 __func__);
1647
1648 return 0;
1649}
1650
1651static struct cyttsp_regulator regulator_data[] = {
1652 {
1653 .name = "vdd",
1654 .min_uV = CY_TMA300_VTG_MIN_UV,
1655 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301656 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1657 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001658 },
1659 /* TODO: Remove after runtime PM is enabled in I2C driver */
1660 {
1661 .name = "vcc_i2c",
1662 .min_uV = CY_I2C_VTG_MIN_UV,
1663 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301664 .hpm_load_uA = CY_I2C_CURR_UA,
1665 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666 },
1667};
1668
1669static struct cyttsp_platform_data cyttsp_pdata = {
1670 .panel_maxx = 634,
1671 .panel_maxy = 1166,
1672 .disp_maxx = 616,
1673 .disp_maxy = 1023,
1674 .disp_minx = 0,
1675 .disp_miny = 16,
1676 .flags = 0x01,
1677 .gen = CY_GEN3, /* or */
1678 .use_st = CY_USE_ST,
1679 .use_mt = CY_USE_MT,
1680 .use_hndshk = CY_SEND_HNDSHK,
1681 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301682 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683 .use_gestures = CY_USE_GESTURES,
1684 .fw_fname = "cyttsp_8960_cdp.hex",
1685 /* activate up to 4 groups
1686 * and set active distance
1687 */
1688 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1689 CY_GEST_GRP3 | CY_GEST_GRP4 |
1690 CY_ACT_DIST,
1691 /* change act_intrvl to customize the Active power state
1692 * scanning/processing refresh interval for Operating mode
1693 */
1694 .act_intrvl = CY_ACT_INTRVL_DFLT,
1695 /* change tch_tmout to customize the touch timeout for the
1696 * Active power state for Operating mode
1697 */
1698 .tch_tmout = CY_TCH_TMOUT_DFLT,
1699 /* change lp_intrvl to customize the Low Power power state
1700 * scanning/processing refresh interval for Operating mode
1701 */
1702 .lp_intrvl = CY_LP_INTRVL_DFLT,
1703 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1704 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1705 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1706 .regulator_info = regulator_data,
1707 .num_regulators = ARRAY_SIZE(regulator_data),
1708 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301709 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710};
1711
1712static struct i2c_board_info cyttsp_info[] __initdata = {
1713 {
1714 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1715 .platform_data = &cyttsp_pdata,
1716#ifndef CY_USE_TIMER
1717 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1718#endif /* CY_USE_TIMER */
1719 },
1720};
1721
Jing Lindc4413c2012-01-16 15:22:52 -08001722/* configuration data for mxt1386 */
1723static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301724 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001725 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301726 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001727 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001728 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, 0, 0, 0, 0, 0, 0,
1732 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1733 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301734 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001735 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301736 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001737 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301738 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001739 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1740 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1741 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1742 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301743 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001744 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1745 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301746 /* T18 Object */
1747 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301748 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001749 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1750 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301751 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001752 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1753 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301754 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001755 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1756 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301757 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001758 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301759 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001760 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301761 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001762 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301763 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001764 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301765 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001766 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301767};
1768
Jing Lin33b007d2011-12-21 17:40:23 -08001769/* configuration data for mxt1386e using V1.0 firmware */
1770static const u8 mxt1386e_config_data_v1_0[] = {
1771 /* T6 Object */
1772 0, 0, 0, 0, 0, 0,
1773 /* T38 Object */
1774 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1775 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1778 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1779 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1780 0, 0, 0, 0,
1781 /* T7 Object */
1782 100, 16, 50,
1783 /* T8 Object */
1784 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1785 /* T9 Object */
1786 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1787 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1788 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1789 10, 5, 0, 0, 0,
1790 /* T18 Object */
1791 0, 0,
1792 /* T24 Object */
1793 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1794 0, 0, 0, 0, 0, 0, 0, 0, 0,
1795 /* T25 Object */
1796 3, 0, 60, 115, 156, 99,
1797 /* T27 Object */
1798 0, 0, 0, 0, 0, 0, 0,
1799 /* T40 Object */
1800 0, 0, 0, 0, 0,
1801 /* T42 Object */
1802 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1803 /* T43 Object */
1804 0, 0, 0, 0, 0, 0, 0,
1805 /* T46 Object */
1806 64, 0, 20, 20, 0, 0, 0, 0, 0,
1807 /* T47 Object */
1808 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1809 /* T48 Object */
1810 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1811 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1812 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1813 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1814 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1815 0, 0, 0, 0,
1816 /* T56 Object */
1817 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1818 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1819 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1820 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1821 2, 99, 33,
1822};
1823
1824/* configuration data for mxt1386e using V2.1 firmware */
1825static const u8 mxt1386e_config_data_v2_1[] = {
1826 /* T6 Object */
1827 0, 0, 0, 0, 0, 0,
1828 /* T38 Object */
1829 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
1830 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1832 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1834 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1835 0, 0, 0, 0,
1836 /* T7 Object */
1837 100, 16, 50,
1838 /* T8 Object */
1839 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1840 /* T9 Object */
1841 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1842 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1843 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1844 10, 5, 0, 0, 0,
1845 /* T18 Object */
1846 0, 0,
1847 /* T24 Object */
1848 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1849 0, 0, 0, 0, 0, 0, 0, 0, 0,
1850 /* T25 Object */
1851 3, 0, 60, 115, 156, 99,
1852 /* T27 Object */
1853 0, 0, 0, 0, 0, 0, 0,
1854 /* T40 Object */
1855 0, 0, 0, 0, 0,
1856 /* T42 Object */
1857 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1858 /* T43 Object */
1859 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1860 16,
1861 /* T46 Object */
1862 64, 0, 20, 20, 0, 0, 0, 0, 0,
1863 /* T47 Object */
1864 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1865 /* T48 Object */
1866 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1867 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1868 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1869 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1870 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1871 0, 0, 0, 0,
1872 /* T56 Object */
1873 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1874 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1875 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1876 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1877 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
1878 255,
1879};
1880
Jing Lineec88ca2012-02-08 11:18:30 -08001881/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
1882static const u8 mxt1386e_config_data_3d[] = {
1883 /* T6 Object */
1884 0, 0, 0, 0, 0, 0,
1885 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001886 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001887 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1888 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1889 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1890 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1891 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1892 0, 0, 0, 0,
1893 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001894 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08001895 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001896 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001897 /* T9 Object */
1898 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1899 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08001900 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
1901 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001902 /* T18 Object */
1903 0, 0,
1904 /* T24 Object */
1905 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1906 0, 0, 0, 0, 0, 0, 0, 0, 0,
1907 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001908 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08001909 /* T27 Object */
1910 0, 0, 0, 0, 0, 0, 0,
1911 /* T40 Object */
1912 0, 0, 0, 0, 0,
1913 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001914 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001915 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001916 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1917 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001918 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08001919 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001920 /* T47 Object */
1921 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1922 /* T48 Object */
1923 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08001924 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
1925 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
1926 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001927 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1928 0, 0, 0, 0,
1929 /* T56 Object */
1930 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1931 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1933 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08001934 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1935 0,
Jing Lineec88ca2012-02-08 11:18:30 -08001936};
1937
Amy Maloche08266db2011-11-04 11:07:16 -07001938#define MXT_TS_GPIO_IRQ 11
1939#define MXT_TS_LDO_EN_GPIO 50
1940#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301941
1942static void mxt_init_hw_liquid(void)
1943{
1944 int rc;
1945
Mohan Pallaka50837382011-09-07 11:00:57 +05301946 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1947 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001948 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1949 __func__, MXT_TS_LDO_EN_GPIO);
1950 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301951 }
1952
1953 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1954 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001955 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1956 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301957 goto err_ldo_gpio_req;
1958 }
1959
Mohan Pallaka50837382011-09-07 11:00:57 +05301960 return;
1961
Mohan Pallaka50837382011-09-07 11:00:57 +05301962err_ldo_gpio_req:
1963 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301964}
1965
Jing Lineec88ca2012-02-08 11:18:30 -08001966static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08001967 {
1968 .config = mxt1386_config_data,
1969 .config_length = ARRAY_SIZE(mxt1386_config_data),
1970 .family_id = 0xA0,
1971 .variant_id = 0x0,
1972 .version = 0x10,
1973 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08001974 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08001975 },
Jing Lin33b007d2011-12-21 17:40:23 -08001976 {
1977 .config = mxt1386e_config_data_v1_0,
1978 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
1979 .family_id = 0xA0,
1980 .variant_id = 0x2,
1981 .version = 0x10,
1982 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08001983 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Anirudh Ghayal3432d7f2012-02-17 14:59:53 -08001984 .fw_name = "atmel_8960_liquid_v2_1_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08001985 },
1986 {
1987 .config = mxt1386e_config_data_v2_1,
1988 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1989 .family_id = 0xA0,
1990 .variant_id = 0x7,
1991 .version = 0x21,
1992 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08001993 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08001994 },
Jing Lindc4413c2012-01-16 15:22:52 -08001995};
1996
Jing Lineec88ca2012-02-08 11:18:30 -08001997static struct mxt_platform_data mxt_platform_data_2d = {
1998 .config_array = mxt_config_array_2d,
1999 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002000 .panel_minx = 0,
2001 .panel_maxx = 1365,
2002 .panel_miny = 0,
2003 .panel_maxy = 767,
2004 .disp_minx = 0,
2005 .disp_maxx = 1365,
2006 .disp_miny = 0,
2007 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302008 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002009 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002010 .reset_gpio = MXT_TS_RESET_GPIO,
2011 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302012};
2013
Jing Lineec88ca2012-02-08 11:18:30 -08002014static struct mxt_config_info mxt_config_array_3d[] = {
2015 {
2016 .config = mxt1386e_config_data_3d,
2017 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2018 .family_id = 0xA0,
2019 .variant_id = 0x7,
2020 .version = 0x21,
2021 .build = 0xAA,
2022 },
2023};
2024
2025static struct mxt_platform_data mxt_platform_data_3d = {
2026 .config_array = mxt_config_array_3d,
2027 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002028 .panel_minx = 0,
2029 .panel_maxx = 1919,
2030 .panel_miny = 0,
2031 .panel_maxy = 1199,
2032 .disp_minx = 0,
2033 .disp_maxx = 1919,
2034 .disp_miny = 0,
2035 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002036 .irqflags = IRQF_TRIGGER_FALLING,
2037 .i2c_pull_up = true,
2038 .reset_gpio = MXT_TS_RESET_GPIO,
2039 .irq_gpio = MXT_TS_GPIO_IRQ,
2040};
2041
Mohan Pallaka50837382011-09-07 11:00:57 +05302042static struct i2c_board_info mxt_device_info[] __initdata = {
2043 {
2044 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302045 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2046 },
2047};
2048
Eugene Yasmand2316b82011-12-07 18:23:48 +02002049static struct i2c_board_info sii_device_info[] __initdata = {
2050 {
2051 I2C_BOARD_INFO("Sil-9244", 0x39),
2052 .flags = I2C_CLIENT_WAKE,
2053 .irq = MSM_GPIO_TO_INT(15),
2054 },
2055};
2056
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002057static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2058 .clk_freq = 100000,
2059 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002060};
2061
2062static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2063 .clk_freq = 100000,
2064 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002065};
2066
2067static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2068 .clk_freq = 100000,
2069 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002070};
2071
2072static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2073 .clk_freq = 100000,
2074 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002075};
2076
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002077static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2078 .base_addr = MSM_ACC0_BASE + 0x08,
2079 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2080 .mask = 1UL << 13,
2081};
2082
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002083static struct ks8851_pdata spi_eth_pdata = {
2084 .irq_gpio = KS8851_IRQ_GPIO,
2085 .rst_gpio = KS8851_RST_GPIO,
2086};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002087
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002088static struct spi_board_info spi_board_info[] __initdata = {
2089 {
2090 .modalias = "ks8851",
2091 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2092 .max_speed_hz = 19200000,
2093 .bus_num = 0,
2094 .chip_select = 0,
2095 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002096 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002097 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002098 {
2099 .modalias = "dsi_novatek_3d_panel_spi",
2100 .max_speed_hz = 10800000,
2101 .bus_num = 0,
2102 .chip_select = 1,
2103 .mode = SPI_MODE_0,
2104 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002105};
2106
2107static struct platform_device msm_device_saw_core0 = {
2108 .name = "saw-regulator",
2109 .id = 0,
2110 .dev = {
2111 .platform_data = &msm_saw_regulator_pdata_s5,
2112 },
2113};
2114
2115static struct platform_device msm_device_saw_core1 = {
2116 .name = "saw-regulator",
2117 .id = 1,
2118 .dev = {
2119 .platform_data = &msm_saw_regulator_pdata_s6,
2120 },
2121};
2122
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002123static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002124 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002125 .tsens_factor = 1000,
2126 .hw_type = MSM_8960,
2127 .tsens_num_sensor = 5,
2128};
2129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002130#ifdef CONFIG_MSM_FAKE_BATTERY
2131static struct platform_device fish_battery_device = {
2132 .name = "fish_battery",
2133};
2134#endif
2135
David Collins26f05562011-06-20 09:56:28 -07002136static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002137 .name = GPIO_REGULATOR_DEV_NAME,
2138 .id = PM8921_MPP_PM_TO_SYS(7),
2139 .dev = {
2140 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2141 },
2142};
2143
David Collins26f05562011-06-20 09:56:28 -07002144static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002145 .name = GPIO_REGULATOR_DEV_NAME,
2146 .id = 91,
2147 .dev = {
2148 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2149 },
2150};
2151
David Collinsb10be1d2011-09-02 10:29:31 -07002152static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2153 .name = GPIO_REGULATOR_DEV_NAME,
2154 .id = PM8921_GPIO_PM_TO_SYS(17),
2155 .dev = {
2156 .platform_data =
2157 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2158 },
2159};
2160
David Collins35a78f52011-12-14 15:54:25 -08002161static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2162 .name = GPIO_REGULATOR_DEV_NAME,
2163 .id = PM8921_GPIO_PM_TO_SYS(42),
2164 .dev = {
2165 .platform_data =
2166 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2167 },
2168};
2169
David Collins26f05562011-06-20 09:56:28 -07002170static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2171 .name = "rpm-regulator",
2172 .id = -1,
2173 .dev = {
2174 .platform_data = &msm_rpm_regulator_pdata,
2175 },
2176};
2177
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002178static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002179 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002180 &msm_device_smd,
2181 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302182 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183 &msm_device_saw_core0,
2184 &msm_device_saw_core1,
2185 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002186 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002187 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188 &msm8960_device_qup_spi_gsbi1,
2189 &msm8960_device_qup_i2c_gsbi3,
2190 &msm8960_device_qup_i2c_gsbi4,
2191 &msm8960_device_qup_i2c_gsbi10,
2192#ifndef CONFIG_MSM_DSPS
2193 &msm8960_device_qup_i2c_gsbi12,
2194#endif
2195 &msm_slim_ctrl,
2196 &msm_device_wcnss_wlan,
2197#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2198 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2199 &qcrypto_device,
2200#endif
2201
2202#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2203 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2204 &qcedev_device,
2205#endif
2206#ifdef CONFIG_MSM_ROTATOR
2207 &msm_rotator_device,
2208#endif
2209 &msm_device_sps,
2210#ifdef CONFIG_MSM_FAKE_BATTERY
2211 &fish_battery_device,
2212#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08002213 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002214#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002215#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002216 &android_pmem_device,
2217 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07002218#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002219 &android_pmem_audio_device,
2220#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002221 &msm_device_vidc,
2222 &msm_device_bam_dmux,
2223 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002224
Joel Nidera1261942011-09-12 16:30:09 +03002225#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2226#ifdef CONFIG_MSM_USE_TSIF1
2227 &msm_device_tsif[1],
2228#else
2229 &msm_device_tsif[0],
2230#endif
2231#endif
2232
Mona Hossain9c430e32011-07-27 11:04:47 -07002233#ifdef CONFIG_HW_RANDOM_MSM
2234 &msm_device_rng,
2235#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002236#ifdef CONFIG_ION_MSM
2237 &ion_dev,
2238#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002239 &msm8960_rpm_device,
2240 &msm8960_rpm_log_device,
2241 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002242 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002243#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002244 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002245 &msm_etb_device,
2246 &msm_tpiu_device,
2247 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002248 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002249#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002250 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002251 &msm8960_device_watchdog,
Laura Abbottf8c03b92012-02-16 14:57:58 -08002252#ifdef CONFIG_MSM_RTB
2253 &msm_rtb_device,
2254#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002255 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002256 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002257 &msm8960_device_cache_erp,
Laura Abbott306bcc22012-03-08 11:24:53 -08002258#ifdef CONFIG_MSM_CACHE_DUMP
2259 &msm_cache_dump_device,
2260#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002261};
2262
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002263static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002264 &msm8960_device_otg,
2265 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302267 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002268 &android_usb_device,
2269 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002270 &msm_bus_apps_fabric,
2271 &msm_bus_sys_fabric,
2272 &msm_bus_mm_fabric,
2273 &msm_bus_sys_fpb,
2274 &msm_bus_cpss_fpb,
2275 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002276 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277 &msm_pcm_routing,
2278 &msm_cpudai0,
2279 &msm_cpudai1,
2280 &msm_cpudai_hdmi_rx,
2281 &msm_cpudai_bt_rx,
2282 &msm_cpudai_bt_tx,
2283 &msm_cpudai_fm_rx,
2284 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002285 &msm_cpudai_auxpcm_rx,
2286 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002287 &msm_cpu_fe,
2288 &msm_stub_codec,
2289 &msm_voice,
2290 &msm_voip,
2291 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302292 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002293 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002294 &msm_cpudai_incall_record_rx,
2295 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002296
2297#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2298 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2299 &qcrypto_device,
2300#endif
2301
2302#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2303 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2304 &qcedev_device,
2305#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002306};
2307
2308static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 &msm_kgsl_3d0,
2310 &msm_kgsl_2d0,
2311 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002312#ifdef CONFIG_MSM_GEMINI
2313 &msm8960_gemini_device,
2314#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002315};
2316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002318 &msm_8960_q6_lpass,
2319 &msm_8960_q6_mss_fw,
2320 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002321 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002322 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002323 &msm_pil_dsps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002324 &msm8960_device_otg,
2325 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002326 &msm_device_hsusb_host,
2327 &android_usb_device,
2328 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002329 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002330 &msm_pcm_routing,
2331 &msm_cpudai0,
2332 &msm_cpudai1,
2333 &msm_cpudai_hdmi_rx,
2334 &msm_cpudai_bt_rx,
2335 &msm_cpudai_bt_tx,
2336 &msm_cpudai_fm_rx,
2337 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002338 &msm_cpudai_auxpcm_rx,
2339 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002340 &msm_cpu_fe,
2341 &msm_stub_codec,
2342 &msm_kgsl_3d0,
2343#ifdef CONFIG_MSM_KGSL_2D
2344 &msm_kgsl_2d0,
2345 &msm_kgsl_2d1,
2346#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347#ifdef CONFIG_MSM_GEMINI
2348 &msm8960_gemini_device,
2349#endif
2350 &msm_voice,
2351 &msm_voip,
2352 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302353 &msm_cpudai_afe_01_rx,
2354 &msm_cpudai_afe_01_tx,
2355 &msm_cpudai_afe_02_rx,
2356 &msm_cpudai_afe_02_tx,
2357 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302358 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002359 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002360 &msm_cpudai_incall_record_rx,
2361 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362 &msm_pcm_hostless,
2363 &msm_bus_apps_fabric,
2364 &msm_bus_sys_fabric,
2365 &msm_bus_mm_fabric,
2366 &msm_bus_sys_fpb,
2367 &msm_bus_cpss_fpb,
2368};
2369
2370static void __init msm8960_i2c_init(void)
2371{
2372 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2373 &msm8960_i2c_qup_gsbi4_pdata;
2374
2375 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2376 &msm8960_i2c_qup_gsbi3_pdata;
2377
2378 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2379 &msm8960_i2c_qup_gsbi10_pdata;
2380
2381 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2382 &msm8960_i2c_qup_gsbi12_pdata;
2383}
2384
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002385static void __init msm8960_gfx_init(void)
2386{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002387 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002388 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2389 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2390 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002391 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2392 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002393 }
2394}
2395
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002396static struct msm_cpuidle_state msm_cstates[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002397
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002398 {0, 0, "C0", "WFI",
2399 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2400
2401 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2402 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2403
2404 {0, 2, "C2", "POWER_COLLAPSE",
2405 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
2406
2407 {1, 0, "C0", "WFI",
2408 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2409
2410 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2411 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2412};
2413
2414static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
2415 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2416 .idle_supported = 1,
2417 .suspend_supported = 1,
2418 .idle_enabled = 0,
2419 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002420 },
2421
2422 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2423 .idle_supported = 1,
2424 .suspend_supported = 1,
2425 .idle_enabled = 0,
2426 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002427 },
2428
2429 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2430 .idle_supported = 1,
2431 .suspend_supported = 1,
2432 .idle_enabled = 1,
2433 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002434 },
2435
2436 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2437 .idle_supported = 0,
2438 .suspend_supported = 1,
2439 .idle_enabled = 0,
2440 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002441 },
2442
2443 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2444 .idle_supported = 1,
2445 .suspend_supported = 1,
2446 .idle_enabled = 0,
2447 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002448 },
2449
2450 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2451 .idle_supported = 1,
2452 .suspend_supported = 0,
2453 .idle_enabled = 1,
2454 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002455 },
2456};
2457
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302458static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459 {
2460 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2461 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2462 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002463 100, 650, 801, 200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002464 },
2465
2466 {
2467 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2468 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2469 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002470 2000, 200, 576000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002471 },
2472
2473 {
2474 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2475 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2476 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002477 8500, 51, 1122000, 8500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002478 },
2479
2480 {
2481 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2482 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2483 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002484 9000, 51, 1130300, 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002485 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002486 {
2487 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2488 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2489 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002490 10000, 51, 1130300, 10000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002491 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002492
2493 {
2494 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2495 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2496 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002497 12000, 14, 2205900, 12000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002498 },
2499
2500 {
2501 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2502 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2503 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002504 18000, 12, 2364250, 18000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002505 },
2506
2507 {
2508 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2509 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2510 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002511 23500, 10, 2667000, 23500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002512 },
2513
2514 {
2515 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2516 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2517 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002518 29700, 5, 2867000, 30000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002519 },
2520};
2521
Praveen Chidambaram78499012011-11-01 17:15:17 -06002522static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2523 .levels = &msm_rpmrs_levels[0],
2524 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2525 .vdd_mem_levels = {
2526 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2527 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2528 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2529 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2530 },
2531 .vdd_dig_levels = {
2532 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2533 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2534 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2535 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2536 },
2537 .vdd_mask = 0x7FFFFF,
2538 .rpmrs_target_id = {
2539 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2540 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2541 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2542 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2543 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2544 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2545 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2546 },
2547};
2548
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002549static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2550 .mode = MSM_PM_BOOT_CONFIG_TZ,
2551};
2552
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302553uint32_t msm_rpm_get_swfi_latency(void)
2554{
2555 int i;
2556
2557 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
2558 if (msm_rpmrs_levels[i].sleep_mode ==
2559 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
2560 return msm_rpmrs_levels[i].latency_us;
2561 }
2562
2563 return 0;
2564}
2565
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002566#ifdef CONFIG_I2C
2567#define I2C_SURF 1
2568#define I2C_FFA (1 << 1)
2569#define I2C_RUMI (1 << 2)
2570#define I2C_SIM (1 << 3)
2571#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002572#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002573
2574struct i2c_registry {
2575 u8 machs;
2576 int bus;
2577 struct i2c_board_info *info;
2578 int len;
2579};
2580
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002581/* Sensors DSPS platform data */
2582#ifdef CONFIG_MSM_DSPS
2583#define DSPS_PIL_GENERIC_NAME "dsps"
2584#endif /* CONFIG_MSM_DSPS */
2585
2586static void __init msm8960_init_dsps(void)
2587{
2588#ifdef CONFIG_MSM_DSPS
2589 struct msm_dsps_platform_data *pdata =
2590 msm_dsps_device.dev.platform_data;
2591 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2592 pdata->gpios = NULL;
2593 pdata->gpios_num = 0;
2594
2595 platform_device_register(&msm_dsps_device);
2596#endif /* CONFIG_MSM_DSPS */
2597}
2598
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002599static int hsic_peripheral_status = 1;
2600static DEFINE_MUTEX(hsic_status_lock);
2601
2602void peripheral_connect()
2603{
2604 mutex_lock(&hsic_status_lock);
2605 if (hsic_peripheral_status)
2606 goto out;
2607 platform_device_add(&msm_device_hsic_host);
2608 hsic_peripheral_status = 1;
2609out:
2610 mutex_unlock(&hsic_status_lock);
2611}
2612EXPORT_SYMBOL(peripheral_connect);
2613
2614void peripheral_disconnect()
2615{
2616 mutex_lock(&hsic_status_lock);
2617 if (!hsic_peripheral_status)
2618 goto out;
2619 platform_device_del(&msm_device_hsic_host);
2620 hsic_peripheral_status = 0;
2621out:
2622 mutex_unlock(&hsic_status_lock);
2623}
2624EXPORT_SYMBOL(peripheral_disconnect);
2625
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002626static void __init msm8960_init_hsic(void)
2627{
2628#ifdef CONFIG_USB_EHCI_MSM_HSIC
2629 uint32_t version = socinfo_get_version();
2630
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002631 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002632 return;
2633
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002634 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002635 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002636#endif
2637}
2638
Amir Samuelov5137e392011-09-21 17:31:25 +03002639#ifdef CONFIG_ISL9519_CHARGER
2640static struct isl_platform_data isl_data __initdata = {
2641 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2642 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2643 .max_system_voltage = 4200,
2644 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002645 .chgcurrent = 1900,
2646 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002647 .input_current = 2048,
2648};
2649
2650static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2651 {
2652 I2C_BOARD_INFO("isl9519q", 0x9),
2653 .irq = 0, /* Not required when notify-by-pmic */
2654 .platform_data = &isl_data,
2655 },
2656};
2657#endif /* CONFIG_ISL9519_CHARGER */
2658
Amir Samuelov755616d2011-12-13 16:34:46 +02002659static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2660 {
2661 I2C_BOARD_INFO("sx1508q", 0x20),
2662 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2663 },
2664};
2665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002667#ifdef CONFIG_ISL9519_CHARGER
2668 {
2669 I2C_LIQUID,
2670 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2671 isl_charger_i2c_info,
2672 ARRAY_SIZE(isl_charger_i2c_info),
2673 },
2674#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002675 {
2676 I2C_SURF | I2C_FFA | I2C_FLUID,
2677 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2678 cyttsp_info,
2679 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002680 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302681 {
2682 I2C_LIQUID,
2683 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2684 mxt_device_info,
2685 ARRAY_SIZE(mxt_device_info),
2686 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302687 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302688 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302689 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002690 sii_device_info,
2691 ARRAY_SIZE(sii_device_info),
2692 },
2693 {
2694 I2C_LIQUID,
2695 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302696 msm_isa1200_board_info,
2697 ARRAY_SIZE(msm_isa1200_board_info),
2698 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002699 {
2700 I2C_LIQUID,
2701 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2702 liquid_io_expander_i2c_info,
2703 ARRAY_SIZE(liquid_io_expander_i2c_info),
2704 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002705};
2706#endif /* CONFIG_I2C */
2707
2708static void __init register_i2c_devices(void)
2709{
2710#ifdef CONFIG_I2C
2711 u8 mach_mask = 0;
2712 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002713#ifdef CONFIG_MSM_CAMERA
2714 struct i2c_registry msm8960_camera_i2c_devices = {
2715 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2716 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2717 msm8960_camera_board_info.board_info,
2718 msm8960_camera_board_info.num_i2c_board_info,
2719 };
2720#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002721
2722 /* Build the matching 'supported_machs' bitmask */
2723 if (machine_is_msm8960_cdp())
2724 mach_mask = I2C_SURF;
2725 else if (machine_is_msm8960_rumi3())
2726 mach_mask = I2C_RUMI;
2727 else if (machine_is_msm8960_sim())
2728 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002729 else if (machine_is_msm8960_fluid())
2730 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002731 else if (machine_is_msm8960_liquid())
2732 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002733 else if (machine_is_msm8960_mtp())
2734 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735 else
2736 pr_err("unmatched machine ID in register_i2c_devices\n");
2737
Jing Lineec88ca2012-02-08 11:18:30 -08002738 if (machine_is_msm8960_liquid()) {
2739 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
2740 mxt_device_info[0].platform_data =
2741 &mxt_platform_data_3d;
2742 else
2743 mxt_device_info[0].platform_data =
2744 &mxt_platform_data_2d;
2745 }
2746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002747 /* Run the array and install devices as appropriate */
2748 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2749 if (msm8960_i2c_devices[i].machs & mach_mask)
2750 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2751 msm8960_i2c_devices[i].info,
2752 msm8960_i2c_devices[i].len);
2753 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002754#ifdef CONFIG_MSM_CAMERA
2755 if (msm8960_camera_i2c_devices.machs & mach_mask)
2756 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2757 msm8960_camera_i2c_devices.info,
2758 msm8960_camera_i2c_devices.len);
2759#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760#endif
2761}
2762
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002763static void __init msm8960_sim_init(void)
2764{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002765 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2766 &msm8960_device_watchdog.dev.platform_data;
2767
2768 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002769 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002770 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2771 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002773 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002774 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002775 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002777 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002778 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 msm8960_i2c_init();
2780 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2781 msm_spm_l2_init(msm_spm_l2_data);
2782 msm8960_init_buses();
2783 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002784 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002785 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002786 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002787
2788 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2789 &msm8960_qup_spi_gsbi1_pdata;
2790 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2791
2792 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002793 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002794 slim_register_board_info(msm_slim_devices,
2795 ARRAY_SIZE(msm_slim_devices));
2796 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2797 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2798 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2799 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002800 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002801 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002802}
2803
2804static void __init msm8960_rumi3_init(void)
2805{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002806 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002807 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2808 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002809 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002810 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002811 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002812 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002813 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2815 &msm8960_qup_spi_gsbi1_pdata;
2816 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2817 msm8960_i2c_init();
2818 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2819 msm_spm_l2_init(msm_spm_l2_data);
2820 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002821 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002822 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002823 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002825 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826 slim_register_board_info(msm_slim_devices,
2827 ARRAY_SIZE(msm_slim_devices));
2828 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2829 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2830 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2831 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002832 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002833 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002834}
2835
2836static void __init msm8960_cdp_init(void)
2837{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002838 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2839 pr_err("meminfo_init() failed!\n");
2840
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002841 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002842 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2843 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002844
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002845 regulator_suppress_info_printing();
2846 if (msm_xo_init())
2847 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002848 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002849 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302850 if (machine_is_msm8960_liquid())
2851 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002852 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302853 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2854 machine_is_msm8960_cdp()) {
2855 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2856 } else if (machine_is_msm8960_liquid()) {
2857 msm_otg_pdata.phy_init_seq =
2858 liquid_v1_phy_init_seq;
2859 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302860 msm_otg_pdata.swfi_latency =
2861 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302862#ifdef CONFIG_USB_EHCI_MSM_HSIC
2863 if (machine_is_msm8960_liquid()) {
2864 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2865 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2866 }
2867#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302868 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002869 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002870 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2871 &msm8960_qup_spi_gsbi1_pdata;
2872 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002873
2874 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302875 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2876 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2877 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002878 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002879 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002880 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2881 msm_spm_l2_init(msm_spm_l2_data);
2882 msm8960_init_buses();
2883 platform_add_devices(msm_footswitch_devices,
2884 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002885 if (machine_is_msm8960_liquid())
2886 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002887 if (machine_is_msm8960_cdp())
2888 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002889 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002890 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002891 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002892 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002893 msm8960_init_cam();
2894 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002895 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302896 if (machine_is_msm8960_liquid())
2897 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002898 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002899 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002900 slim_register_board_info(msm_slim_devices,
2901 ARRAY_SIZE(msm_slim_devices));
2902 msm8960_init_dsps();
2903 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2904 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2905 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2906 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002907 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002908 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002909 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002910 if (PLATFORM_IS_CHARM25())
2911 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002912}
2913
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002914MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2915 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002916 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002917 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302918 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002919 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002920 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002921 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002922 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002923MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002924
2925MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2926 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002927 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002928 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302929 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002930 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002931 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002933 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002934MACHINE_END
2935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002936MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2937 .map_io = msm8960_map_io,
2938 .reserve = msm8960_reserve,
2939 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302940 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941 .timer = &msm_timer,
2942 .init_machine = msm8960_cdp_init,
2943 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002944 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002945MACHINE_END
2946
2947MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2948 .map_io = msm8960_map_io,
2949 .reserve = msm8960_reserve,
2950 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302951 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002952 .timer = &msm_timer,
2953 .init_machine = msm8960_cdp_init,
2954 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002955 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002956MACHINE_END
2957
2958MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2959 .map_io = msm8960_map_io,
2960 .reserve = msm8960_reserve,
2961 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302962 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002963 .timer = &msm_timer,
2964 .init_machine = msm8960_cdp_init,
2965 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002966 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002967MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002968
2969MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2970 .map_io = msm8960_map_io,
2971 .reserve = msm8960_reserve,
2972 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302973 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002974 .timer = &msm_timer,
2975 .init_machine = msm8960_cdp_init,
2976 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002977 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002978MACHINE_END