blob: cd5139763675d65dec6f4cbd6dd71b3a1cbb6d01 [file] [log] [blame]
David Collinsb4558422012-01-05 10:50:49 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenko39236d72011-11-30 17:42:23 -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 *
12 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/i2c.h>
18#include <linux/i2c/sx150x.h>
19#include <linux/i2c/isl9519.h>
20#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
24#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
25#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#include <linux/msm_kgsl.h>
30#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>
36#include <linux/platform_data/qcom_wcnss_device.h>
37#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
39#include <linux/i2c/atmel_mxt_ts.h>
40#include <linux/msm_tsens.h>
41#include <linux/ks8851.h>
42#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053043#include <linux/gpio_keys.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080044
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
47#include <asm/setup.h>
48#include <asm/hardware/gic.h>
49#include <asm/mach/mmc.h>
50
51#include <mach/board.h>
52#include <mach/msm_iomap.h>
53#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>
64#include <mach/gpiomux.h>
65#include <mach/msm_bus_board.h>
66#include <mach/msm_memtypes.h>
67#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080068#include <mach/msm_xo.h>
69#include <mach/restart.h>
70
71#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
77#include <linux/ion.h>
78#include <mach/ion.h>
79#include <mach/mdm2.h>
80
81#include "timer.h"
82#include "devices.h"
83#include "devices-msm8x60.h"
84#include "spm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080085#include <mach/pm.h>
86#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080087#include "rpm_resources.h"
88#include "mpm.h"
89#include "acpuclock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080090#include "smd_private.h"
91#include "pm-boot.h"
92#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080093#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080094
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095static struct platform_device msm_fm_platform_init = {
96 .name = "iris_fm",
97 .id = -1,
98};
99
100#define KS8851_RST_GPIO 89
101#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800102#define HAP_SHIFT_LVL_OE_GPIO 47
103
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800104#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
105
106struct sx150x_platform_data msm8930_sx150x_data[] = {
107 [SX150X_CAM] = {
108 .gpio_base = GPIO_CAM_EXPANDER_BASE,
109 .oscio_is_gpo = false,
110 .io_pullup_ena = 0x0,
111 .io_pulldn_ena = 0xc0,
112 .io_open_drain_ena = 0x0,
113 .irq_summary = -1,
114 },
115};
116
117#endif
118
Olav Haugana21169d2012-01-04 09:17:06 -0800119#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800120#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800121#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
122#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
123#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800124#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800125#endif
126
127
128#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
129#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
Olav Hauganb88eef12012-01-15 10:59:26 -0800130#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan42ebe712012-01-10 16:30:58 -0800131#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb88eef12012-01-15 10:59:26 -0800132#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan80854eb2012-01-12 12:00:23 -0800133#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800134#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800135#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
136#define MSM_ION_HEAP_NUM 8
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800137#else
138#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800139#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800140#endif
141
142#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
143static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
144static int __init pmem_kernel_ebi1_size_setup(char *p)
145{
146 pmem_kernel_ebi1_size = memparse(p, NULL);
147 return 0;
148}
149early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
150#endif
151
152#ifdef CONFIG_ANDROID_PMEM
153static unsigned pmem_size = MSM_PMEM_SIZE;
154static int __init pmem_size_setup(char *p)
155{
156 pmem_size = memparse(p, NULL);
157 return 0;
158}
159early_param("pmem_size", pmem_size_setup);
160
161static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
162
163static int __init pmem_adsp_size_setup(char *p)
164{
165 pmem_adsp_size = memparse(p, NULL);
166 return 0;
167}
168early_param("pmem_adsp_size", pmem_adsp_size_setup);
169
170static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
171
172static int __init pmem_audio_size_setup(char *p)
173{
174 pmem_audio_size = memparse(p, NULL);
175 return 0;
176}
177early_param("pmem_audio_size", pmem_audio_size_setup);
178#endif
179
180#ifdef CONFIG_ANDROID_PMEM
181#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
182static struct android_pmem_platform_data android_pmem_pdata = {
183 .name = "pmem",
184 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
185 .cached = 1,
186 .memory_type = MEMTYPE_EBI1,
187};
188
189static struct platform_device android_pmem_device = {
190 .name = "android_pmem",
191 .id = 0,
192 .dev = {.platform_data = &android_pmem_pdata},
193};
194
195static struct android_pmem_platform_data android_pmem_adsp_pdata = {
196 .name = "pmem_adsp",
197 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
198 .cached = 0,
199 .memory_type = MEMTYPE_EBI1,
200};
201static struct platform_device android_pmem_adsp_device = {
202 .name = "android_pmem",
203 .id = 2,
204 .dev = { .platform_data = &android_pmem_adsp_pdata },
205};
206#endif
207
208static struct android_pmem_platform_data android_pmem_audio_pdata = {
209 .name = "pmem_audio",
210 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
211 .cached = 0,
212 .memory_type = MEMTYPE_EBI1,
213};
214
215static struct platform_device android_pmem_audio_device = {
216 .name = "android_pmem",
217 .id = 4,
218 .dev = { .platform_data = &android_pmem_audio_pdata },
219};
220#endif
221
222#define DSP_RAM_BASE_8960 0x8da00000
223#define DSP_RAM_SIZE_8960 0x1800000
224static int dspcrashd_pdata_8960 = 0xDEADDEAD;
225
226static struct resource resources_dspcrashd_8960[] = {
227 {
228 .name = "msm_dspcrashd",
229 .start = DSP_RAM_BASE_8960,
230 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
231 .flags = IORESOURCE_DMA,
232 },
233};
234
235static struct platform_device msm_device_dspcrashd_8960 = {
236 .name = "msm_dspcrashd",
237 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
238 .resource = resources_dspcrashd_8960,
239 .dev = { .platform_data = &dspcrashd_pdata_8960 },
240};
241
242static struct memtype_reserve msm8930_reserve_table[] __initdata = {
243 [MEMTYPE_SMI] = {
244 },
245 [MEMTYPE_EBI0] = {
246 .flags = MEMTYPE_FLAGS_1M_ALIGN,
247 },
248 [MEMTYPE_EBI1] = {
249 .flags = MEMTYPE_FLAGS_1M_ALIGN,
250 },
251};
252
253static void __init size_pmem_devices(void)
254{
255#ifdef CONFIG_ANDROID_PMEM
256#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
257 android_pmem_adsp_pdata.size = pmem_adsp_size;
258 android_pmem_pdata.size = pmem_size;
259#endif
260 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
261#endif
262}
263
264static void __init reserve_memory_for(struct android_pmem_platform_data *p)
265{
266 msm8930_reserve_table[p->memory_type].size += p->size;
267}
268
269static void __init reserve_pmem_memory(void)
270{
271#ifdef CONFIG_ANDROID_PMEM
272#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
273 reserve_memory_for(&android_pmem_adsp_pdata);
274 reserve_memory_for(&android_pmem_pdata);
275#endif
276 reserve_memory_for(&android_pmem_audio_pdata);
277 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
278#endif
279}
280
281static int msm8930_paddr_to_memtype(unsigned int paddr)
282{
283 return MEMTYPE_EBI1;
284}
285
286#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800287#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
288static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
289 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800290 .align = PAGE_SIZE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800291};
292
293static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
294 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800295 .align = PAGE_SIZE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800296};
297static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800298 .adjacent_mem_id = INVALID_HEAP_ID,
299 .align = PAGE_SIZE,
300};
301static struct ion_co_heap_pdata fw_co_ion_pdata = {
302 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
303 .align = SZ_128K,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800304};
305#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800306static struct ion_platform_data ion_pdata = {
307 .nr = MSM_ION_HEAP_NUM,
308 .heaps = {
309 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800310 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800311 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800312 .name = ION_VMALLOC_HEAP_NAME,
313 },
314#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
315 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800316 .id = ION_SF_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800317 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800318 .name = ION_SF_HEAP_NAME,
319 .size = MSM_ION_SF_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800320 .memory_type = ION_EBI_TYPE,
Olav Haugan42ebe712012-01-10 16:30:58 -0800321 .extra_data = (void *) &co_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800322 },
323 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800324 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800325 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800326 .name = ION_MM_HEAP_NAME,
327 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800328 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800329 .extra_data = (void *) &cp_mm_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800330 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800331 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800332 .id = ION_MM_FIRMWARE_HEAP_ID,
333 .type = ION_HEAP_TYPE_CARVEOUT,
334 .name = ION_MM_FIRMWARE_HEAP_NAME,
335 .size = MSM_ION_MM_FW_SIZE,
336 .memory_type = ION_EBI_TYPE,
337 .extra_data = (void *) &fw_co_ion_pdata,
338 },
339 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800340 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800341 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800342 .name = ION_MFC_HEAP_NAME,
343 .size = MSM_ION_MFC_SIZE,
344 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800345 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800346 },
347 {
348 .id = ION_IOMMU_HEAP_ID,
349 .type = ION_HEAP_TYPE_IOMMU,
350 .name = ION_IOMMU_HEAP_NAME,
351 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800352 {
353 .id = ION_QSECOM_HEAP_ID,
354 .type = ION_HEAP_TYPE_CARVEOUT,
355 .name = ION_QSECOM_HEAP_NAME,
356 .size = MSM_ION_QSECOM_SIZE,
357 .memory_type = ION_EBI_TYPE,
358 .extra_data = (void *) &co_ion_pdata,
359 },
Olav Haugan7355db02012-01-13 16:59:13 -0800360 {
361 .id = ION_AUDIO_HEAP_ID,
362 .type = ION_HEAP_TYPE_CARVEOUT,
363 .name = ION_AUDIO_HEAP_NAME,
364 .size = MSM_ION_AUDIO_SIZE,
365 .memory_type = ION_EBI_TYPE,
366 .extra_data = (void *) &co_ion_pdata,
367 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800368#endif
369 }
370};
371
372static struct platform_device ion_dev = {
373 .name = "ion-msm",
374 .id = 1,
375 .dev = { .platform_data = &ion_pdata },
376};
377#endif
378
379static void reserve_ion_memory(void)
380{
381#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Olav Hauganb5be7992011-11-18 14:29:02 -0800382 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
383 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugan42ebe712012-01-10 16:30:58 -0800384 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Hauganb5be7992011-11-18 14:29:02 -0800385 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Haugan80854eb2012-01-12 12:00:23 -0800386 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan7355db02012-01-13 16:59:13 -0800387 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800388#endif
389}
Huaibin Yanga5419422011-12-08 23:52:10 -0800390
391static void __init reserve_mdp_memory(void)
392{
393 msm8930_mdp_writeback(msm8930_reserve_table);
394}
395
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800396static void __init msm8930_calculate_reserve_sizes(void)
397{
398 size_pmem_devices();
399 reserve_pmem_memory();
400 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800401 reserve_mdp_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800402}
403
404static struct reserve_info msm8930_reserve_info __initdata = {
405 .memtype_reserve_table = msm8930_reserve_table,
406 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
407 .paddr_to_memtype = msm8930_paddr_to_memtype,
408};
409
410static int msm8930_memory_bank_size(void)
411{
412 return 1<<29;
413}
414
415static void __init locate_unstable_memory(void)
416{
417 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
418 unsigned long bank_size;
419 unsigned long low, high;
420
421 bank_size = msm8930_memory_bank_size();
422 low = meminfo.bank[0].start;
423 high = mb->start + mb->size;
424
425 /* Check if 32 bit overflow occured */
426 if (high < mb->start)
427 high = ~0UL;
428
429 low &= ~(bank_size - 1);
430
431 if (high - low <= bank_size)
432 return;
433 msm8930_reserve_info.low_unstable_address = low + bank_size;
434 /* To avoid overflow of u32 compute max_unstable_size
435 * by first subtracting low from mb->start)
436 * */
437 msm8930_reserve_info.max_unstable_size = (mb->start - low) +
438 mb->size - bank_size;
439
440 msm8930_reserve_info.bank_size = bank_size;
441 pr_info("low unstable address %lx max size %lx bank size %lx\n",
442 msm8930_reserve_info.low_unstable_address,
443 msm8930_reserve_info.max_unstable_size,
444 msm8930_reserve_info.bank_size);
445}
446
447static void __init place_movable_zone(void)
448{
449 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
450 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
451 pr_info("movable zone start %lx size %lx\n",
452 movable_reserved_start, movable_reserved_size);
453}
454
455static void __init msm8930_early_memory(void)
456{
457 reserve_info = &msm8930_reserve_info;
458 locate_unstable_memory();
459 place_movable_zone();
460}
461
462static void __init msm8930_reserve(void)
463{
464 msm_reserve();
465}
466
467static int msm8930_change_memory_power(u64 start, u64 size,
468 int change_type)
469{
470 return soc_change_memory_power(start, size, change_type);
471}
472
473static void __init msm8930_allocate_memory_regions(void)
474{
475 msm8930_allocate_fb_region();
476}
477
478#ifdef CONFIG_WCD9310_CODEC
479
480#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
481
482/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
483 * 4 micbiases are used to power various analog and digital
484 * microphones operating at 1800 mV. Technically, all micbiases
485 * can source from single cfilter since all microphones operate
486 * at the same voltage level. The arrangement below is to make
487 * sure all cfilters are exercised. LDO_H regulator ouput level
488 * does not need to be as high as 2.85V. It is choosen for
489 * microphone sensitivity purpose.
490 */
491static struct tabla_pdata tabla_platform_data = {
492 .slimbus_slave_device = {
493 .name = "tabla-slave",
494 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
495 },
496 .irq = MSM_GPIO_TO_INT(62),
497 .irq_base = TABLA_INTERRUPT_BASE,
498 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800499
500/*TODO: Replace this with right PM8038 gpio */
501#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800502 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800503#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800504 .micbias = {
505 .ldoh_v = TABLA_LDOH_2P85_V,
506 .cfilt1_mv = 1800,
507 .cfilt2_mv = 1800,
508 .cfilt3_mv = 1800,
509 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
510 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
511 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
512 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
513 }
514};
515
516static struct slim_device msm_slim_tabla = {
517 .name = "tabla-slim",
518 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
519 .dev = {
520 .platform_data = &tabla_platform_data,
521 },
522};
523
524static struct tabla_pdata tabla20_platform_data = {
525 .slimbus_slave_device = {
526 .name = "tabla-slave",
527 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
528 },
529 .irq = MSM_GPIO_TO_INT(62),
530 .irq_base = TABLA_INTERRUPT_BASE,
531 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800532
533/*TODO: Replace this with right PM8038 gpio */
534#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800535 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800536#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800537 .micbias = {
538 .ldoh_v = TABLA_LDOH_2P85_V,
539 .cfilt1_mv = 1800,
540 .cfilt2_mv = 1800,
541 .cfilt3_mv = 1800,
542 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
543 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
544 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
545 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
546 }
547};
548
549static struct slim_device msm_slim_tabla20 = {
550 .name = "tabla2x-slim",
551 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
552 .dev = {
553 .platform_data = &tabla20_platform_data,
554 },
555};
556#endif
557
558static struct slim_boardinfo msm_slim_devices[] = {
559#ifdef CONFIG_WCD9310_CODEC
560 {
561 .bus_num = 1,
562 .slim_slave = &msm_slim_tabla,
563 },
564 {
565 .bus_num = 1,
566 .slim_slave = &msm_slim_tabla20,
567 },
568#endif
569 /* add more slimbus slaves as needed */
570};
571
572#define MSM_WCNSS_PHYS 0x03000000
573#define MSM_WCNSS_SIZE 0x280000
574
575static struct resource resources_wcnss_wlan[] = {
576 {
577 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
578 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
579 .name = "wcnss_wlanrx_irq",
580 .flags = IORESOURCE_IRQ,
581 },
582 {
583 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
584 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
585 .name = "wcnss_wlantx_irq",
586 .flags = IORESOURCE_IRQ,
587 },
588 {
589 .start = MSM_WCNSS_PHYS,
590 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
591 .name = "wcnss_mmio",
592 .flags = IORESOURCE_MEM,
593 },
594 {
595 .start = 84,
596 .end = 88,
597 .name = "wcnss_gpios_5wire",
598 .flags = IORESOURCE_IO,
599 },
600};
601
602static struct qcom_wcnss_opts qcom_wcnss_pdata = {
603 .has_48mhz_xo = 1,
604};
605
606static struct platform_device msm_device_wcnss_wlan = {
607 .name = "wcnss_wlan",
608 .id = 0,
609 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
610 .resource = resources_wcnss_wlan,
611 .dev = {.platform_data = &qcom_wcnss_pdata},
612};
613
614#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
615 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
616 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
617 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
618
619#define QCE_SIZE 0x10000
620#define QCE_0_BASE 0x18500000
621
622#define QCE_HW_KEY_SUPPORT 0
623#define QCE_SHA_HMAC_SUPPORT 1
624#define QCE_SHARE_CE_RESOURCE 1
625#define QCE_CE_SHARED 0
626
627static struct resource qcrypto_resources[] = {
628 [0] = {
629 .start = QCE_0_BASE,
630 .end = QCE_0_BASE + QCE_SIZE - 1,
631 .flags = IORESOURCE_MEM,
632 },
633 [1] = {
634 .name = "crypto_channels",
635 .start = DMOV_CE_IN_CHAN,
636 .end = DMOV_CE_OUT_CHAN,
637 .flags = IORESOURCE_DMA,
638 },
639 [2] = {
640 .name = "crypto_crci_in",
641 .start = DMOV_CE_IN_CRCI,
642 .end = DMOV_CE_IN_CRCI,
643 .flags = IORESOURCE_DMA,
644 },
645 [3] = {
646 .name = "crypto_crci_out",
647 .start = DMOV_CE_OUT_CRCI,
648 .end = DMOV_CE_OUT_CRCI,
649 .flags = IORESOURCE_DMA,
650 },
651};
652
653static struct resource qcedev_resources[] = {
654 [0] = {
655 .start = QCE_0_BASE,
656 .end = QCE_0_BASE + QCE_SIZE - 1,
657 .flags = IORESOURCE_MEM,
658 },
659 [1] = {
660 .name = "crypto_channels",
661 .start = DMOV_CE_IN_CHAN,
662 .end = DMOV_CE_OUT_CHAN,
663 .flags = IORESOURCE_DMA,
664 },
665 [2] = {
666 .name = "crypto_crci_in",
667 .start = DMOV_CE_IN_CRCI,
668 .end = DMOV_CE_IN_CRCI,
669 .flags = IORESOURCE_DMA,
670 },
671 [3] = {
672 .name = "crypto_crci_out",
673 .start = DMOV_CE_OUT_CRCI,
674 .end = DMOV_CE_OUT_CRCI,
675 .flags = IORESOURCE_DMA,
676 },
677};
678
679#endif
680
681#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
682 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
683
684static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
685 .ce_shared = QCE_CE_SHARED,
686 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
687 .hw_key_support = QCE_HW_KEY_SUPPORT,
688 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
689};
690
691static struct platform_device qcrypto_device = {
692 .name = "qcrypto",
693 .id = 0,
694 .num_resources = ARRAY_SIZE(qcrypto_resources),
695 .resource = qcrypto_resources,
696 .dev = {
697 .coherent_dma_mask = DMA_BIT_MASK(32),
698 .platform_data = &qcrypto_ce_hw_suppport,
699 },
700};
701#endif
702
703#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
704 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
705
706static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
707 .ce_shared = QCE_CE_SHARED,
708 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
709 .hw_key_support = QCE_HW_KEY_SUPPORT,
710 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
711};
712
713static struct platform_device qcedev_device = {
714 .name = "qce",
715 .id = 0,
716 .num_resources = ARRAY_SIZE(qcedev_resources),
717 .resource = qcedev_resources,
718 .dev = {
719 .coherent_dma_mask = DMA_BIT_MASK(32),
720 .platform_data = &qcedev_ce_hw_suppport,
721 },
722};
723#endif
724
725#define MDM2AP_ERRFATAL 70
726#define AP2MDM_ERRFATAL 95
727#define MDM2AP_STATUS 69
728#define AP2MDM_STATUS 94
729#define AP2MDM_PMIC_RESET_N 80
730#define AP2MDM_KPDPWR_N 81
731
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800732static struct resource mdm_resources[] = {
733 {
734 .start = MDM2AP_ERRFATAL,
735 .end = MDM2AP_ERRFATAL,
736 .name = "MDM2AP_ERRFATAL",
737 .flags = IORESOURCE_IO,
738 },
739 {
740 .start = AP2MDM_ERRFATAL,
741 .end = AP2MDM_ERRFATAL,
742 .name = "AP2MDM_ERRFATAL",
743 .flags = IORESOURCE_IO,
744 },
745 {
746 .start = MDM2AP_STATUS,
747 .end = MDM2AP_STATUS,
748 .name = "MDM2AP_STATUS",
749 .flags = IORESOURCE_IO,
750 },
751 {
752 .start = AP2MDM_STATUS,
753 .end = AP2MDM_STATUS,
754 .name = "AP2MDM_STATUS",
755 .flags = IORESOURCE_IO,
756 },
757 {
758 .start = AP2MDM_PMIC_RESET_N,
759 .end = AP2MDM_PMIC_RESET_N,
760 .name = "AP2MDM_PMIC_RESET_N",
761 .flags = IORESOURCE_IO,
762 },
763 {
764 .start = AP2MDM_KPDPWR_N,
765 .end = AP2MDM_KPDPWR_N,
766 .name = "AP2MDM_KPDPWR_N",
767 .flags = IORESOURCE_IO,
768 },
769};
770
771static struct mdm_platform_data mdm_platform_data = {
772 .mdm_version = "2.5",
773};
774
775static struct platform_device mdm_device = {
776 .name = "mdm2_modem",
777 .id = -1,
778 .num_resources = ARRAY_SIZE(mdm_resources),
779 .resource = mdm_resources,
780 .dev = {
781 .platform_data = &mdm_platform_data,
782 },
783};
784
785static struct platform_device *mdm_devices[] __initdata = {
786 &mdm_device,
787};
788
Praveen Chidambaram78499012011-11-01 17:15:17 -0600789#ifdef CONFIG_MSM_MPM
790static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
791 [1] = MSM_GPIO_TO_INT(46),
792 [2] = MSM_GPIO_TO_INT(150),
793 [4] = MSM_GPIO_TO_INT(103),
794 [5] = MSM_GPIO_TO_INT(104),
795 [6] = MSM_GPIO_TO_INT(105),
796 [7] = MSM_GPIO_TO_INT(106),
797 [8] = MSM_GPIO_TO_INT(107),
798 [9] = MSM_GPIO_TO_INT(7),
799 [10] = MSM_GPIO_TO_INT(11),
800 [11] = MSM_GPIO_TO_INT(15),
801 [12] = MSM_GPIO_TO_INT(19),
802 [13] = MSM_GPIO_TO_INT(23),
803 [14] = MSM_GPIO_TO_INT(27),
804 [15] = MSM_GPIO_TO_INT(31),
805 [16] = MSM_GPIO_TO_INT(35),
806 [19] = MSM_GPIO_TO_INT(90),
807 [20] = MSM_GPIO_TO_INT(92),
808 [23] = MSM_GPIO_TO_INT(85),
809 [24] = MSM_GPIO_TO_INT(83),
810 [25] = USB1_HS_IRQ,
811 [27] = HDMI_IRQ,
812 [29] = MSM_GPIO_TO_INT(10),
813 [30] = MSM_GPIO_TO_INT(102),
814 [31] = MSM_GPIO_TO_INT(81),
815 [32] = MSM_GPIO_TO_INT(78),
816 [33] = MSM_GPIO_TO_INT(94),
817 [34] = MSM_GPIO_TO_INT(72),
818 [35] = MSM_GPIO_TO_INT(39),
819 [36] = MSM_GPIO_TO_INT(43),
820 [37] = MSM_GPIO_TO_INT(61),
821 [38] = MSM_GPIO_TO_INT(50),
822 [39] = MSM_GPIO_TO_INT(42),
823 [41] = MSM_GPIO_TO_INT(62),
824 [42] = MSM_GPIO_TO_INT(76),
825 [43] = MSM_GPIO_TO_INT(75),
826 [44] = MSM_GPIO_TO_INT(70),
827 [45] = MSM_GPIO_TO_INT(69),
828 [46] = MSM_GPIO_TO_INT(67),
829 [47] = MSM_GPIO_TO_INT(65),
830 [48] = MSM_GPIO_TO_INT(58),
831 [49] = MSM_GPIO_TO_INT(54),
832 [50] = MSM_GPIO_TO_INT(52),
833 [51] = MSM_GPIO_TO_INT(49),
834 [52] = MSM_GPIO_TO_INT(40),
835 [53] = MSM_GPIO_TO_INT(37),
836 [54] = MSM_GPIO_TO_INT(24),
837 [55] = MSM_GPIO_TO_INT(14),
838};
839
840static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
841 TLMM_MSM_SUMMARY_IRQ,
842 RPM_APCC_CPU0_GP_HIGH_IRQ,
843 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
844 RPM_APCC_CPU0_GP_LOW_IRQ,
845 RPM_APCC_CPU0_WAKE_UP_IRQ,
846 RPM_APCC_CPU1_GP_HIGH_IRQ,
847 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
848 RPM_APCC_CPU1_GP_LOW_IRQ,
849 RPM_APCC_CPU1_WAKE_UP_IRQ,
850 MSS_TO_APPS_IRQ_0,
851 MSS_TO_APPS_IRQ_1,
852 MSS_TO_APPS_IRQ_2,
853 MSS_TO_APPS_IRQ_3,
854 MSS_TO_APPS_IRQ_4,
855 MSS_TO_APPS_IRQ_5,
856 MSS_TO_APPS_IRQ_6,
857 MSS_TO_APPS_IRQ_7,
858 MSS_TO_APPS_IRQ_8,
859 MSS_TO_APPS_IRQ_9,
860 LPASS_SCSS_GP_LOW_IRQ,
861 LPASS_SCSS_GP_MEDIUM_IRQ,
862 LPASS_SCSS_GP_HIGH_IRQ,
863 SPS_MTI_30,
864 SPS_MTI_31,
865 RIVA_APSS_SPARE_IRQ,
866 RIVA_APPS_WLAN_SMSM_IRQ,
867 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
868 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
869};
870
871struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
872 .irqs_m2a = msm_mpm_irqs_m2a,
873 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
874 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
875 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
876 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
877 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
878 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
879 .mpm_apps_ipc_val = BIT(1),
880 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
881
882};
883#endif
884
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800885#define MSM_SHARED_RAM_PHYS 0x80000000
886
887static void __init msm8930_map_io(void)
888{
889 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
890 msm_map_msm8930_io();
891
892 if (socinfo_init() < 0)
893 pr_err("socinfo_init() failed!\n");
894}
895
896static void __init msm8930_init_irq(void)
897{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600898 struct msm_mpm_device_data *data = NULL;
899#ifdef CONFIG_MSM_MPM
900 data = &msm8930_mpm_dev_data;
901#endif
902
903 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800904 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
905 (void *)MSM_QGIC_CPU_BASE);
906
907 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
908 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
909
910 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
911 mb();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800912}
913
914static void __init msm8930_init_buses(void)
915{
916#ifdef CONFIG_MSM_BUS_SCALING
917 msm_bus_rpm_set_mt_mask();
918 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
919 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
920 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
921 msm_bus_apps_fabric.dev.platform_data =
922 &msm_bus_8960_apps_fabric_pdata;
923 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
924 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
925 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
926 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
927#endif
928}
929
930static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
931 .max_clock_speed = 15060000,
932};
933
934#ifdef CONFIG_USB_MSM_OTG_72K
935static struct msm_otg_platform_data msm_otg_pdata;
936#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800937static struct msm_otg_platform_data msm_otg_pdata = {
938 .mode = USB_OTG,
939 .otg_control = OTG_PMIC_CONTROL,
940 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800941 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800942 .power_budget = 750,
943};
944#endif
945
946#ifdef CONFIG_USB_EHCI_MSM_HSIC
947#define HSIC_HUB_RESET_GPIO 91
948static struct msm_hsic_host_platform_data msm_hsic_pdata = {
949 .strobe = 150,
950 .data = 151,
951};
952#else
953static struct msm_hsic_host_platform_data msm_hsic_pdata;
954#endif
955
956#define PID_MAGIC_ID 0x71432909
957#define SERIAL_NUM_MAGIC_ID 0x61945374
958#define SERIAL_NUMBER_LENGTH 127
959#define DLOAD_USB_BASE_ADD 0x2A03F0C8
960
961struct magic_num_struct {
962 uint32_t pid;
963 uint32_t serial_num;
964};
965
966struct dload_struct {
967 uint32_t reserved1;
968 uint32_t reserved2;
969 uint32_t reserved3;
970 uint16_t reserved4;
971 uint16_t pid;
972 char serial_number[SERIAL_NUMBER_LENGTH];
973 uint16_t reserved5;
974 struct magic_num_struct magic_struct;
975};
976
977static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
978{
979 struct dload_struct __iomem *dload = 0;
980
981 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
982 if (!dload) {
983 pr_err("%s: cannot remap I/O memory region: %08x\n",
984 __func__, DLOAD_USB_BASE_ADD);
985 return -ENXIO;
986 }
987
988 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
989 __func__, dload, pid, snum);
990 /* update pid */
991 dload->magic_struct.pid = PID_MAGIC_ID;
992 dload->pid = pid;
993
994 /* update serial number */
995 dload->magic_struct.serial_num = 0;
996 if (!snum) {
997 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
998 goto out;
999 }
1000
1001 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1002 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1003out:
1004 iounmap(dload);
1005 return 0;
1006}
1007
1008static struct android_usb_platform_data android_usb_pdata = {
1009 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1010};
1011
1012static struct platform_device android_usb_device = {
1013 .name = "android_usb",
1014 .id = -1,
1015 .dev = {
1016 .platform_data = &android_usb_pdata,
1017 },
1018};
1019
1020static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001021 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001022};
1023
1024static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001025 0x00, 0x24, 0x54, 0x10,
1026 0x09, 0x03, 0x01,
1027 0x10, 0x54, 0x30, 0x0C,
1028 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001029};
1030
1031static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001032 0x00, 0x24, 0x54, 0x10,
1033 0x09, 0x07, 0x01, 0x0B,
1034 0x10, 0x54, 0x30, 0x0C,
1035 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001036};
1037
1038static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1039 [0] = {
1040 .mode = MSM_SPM_MODE_CLOCK_GATING,
1041 .notify_rpm = false,
1042 .cmd = spm_wfi_cmd_sequence,
1043 },
1044 [1] = {
1045 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1046 .notify_rpm = false,
1047 .cmd = spm_power_collapse_without_rpm,
1048 },
1049 [2] = {
1050 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1051 .notify_rpm = true,
1052 .cmd = spm_power_collapse_with_rpm,
1053 },
1054};
1055
1056static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1057 [0] = {
1058 .reg_base_addr = MSM_SAW0_BASE,
1059 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1060 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1061 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1062#if defined(CONFIG_MSM_AVS_HW)
1063 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1064 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1065#endif
1066 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1067 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1068 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1069 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1070 .vctl_timeout_us = 50,
1071 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1072 .modes = msm_spm_seq_list,
1073 },
1074 [1] = {
1075 .reg_base_addr = MSM_SAW1_BASE,
1076 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1077 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1078 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1079#if defined(CONFIG_MSM_AVS_HW)
1080 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1081 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1082#endif
1083 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1084 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1085 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1086 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1087 .vctl_timeout_us = 50,
1088 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1089 .modes = msm_spm_seq_list,
1090 },
1091};
1092
1093static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001094 0x00, 0x20, 0x03, 0x20,
1095 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001096};
1097
1098static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001099 0x00, 0x20, 0x34, 0x64,
1100 0x48, 0x07, 0x48, 0x20,
1101 0x50, 0x64, 0x04, 0x34,
1102 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001103};
1104static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001105 0x00, 0x10, 0x34, 0x64,
1106 0x48, 0x07, 0x48, 0x10,
1107 0x50, 0x64, 0x04, 0x34,
1108 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001109};
1110
1111static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1112 [0] = {
1113 .mode = MSM_SPM_L2_MODE_RETENTION,
1114 .notify_rpm = false,
1115 .cmd = l2_spm_wfi_cmd_sequence,
1116 },
1117 [1] = {
1118 .mode = MSM_SPM_L2_MODE_GDHS,
1119 .notify_rpm = true,
1120 .cmd = l2_spm_gdhs_cmd_sequence,
1121 },
1122 [2] = {
1123 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1124 .notify_rpm = true,
1125 .cmd = l2_spm_power_off_cmd_sequence,
1126 },
1127};
1128
1129static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1130 [0] = {
1131 .reg_base_addr = MSM_SAW_L2_BASE,
1132 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1133 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1134 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1135 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1136 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1137 .modes = msm_spm_l2_seq_list,
1138 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1139 },
1140};
1141
Jay Chokshi06fa7542011-12-07 13:09:17 -08001142#/* TODO: Remove this once PM8038 physically becomes
1143 * available.
1144 */
1145#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001146#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1147#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301148#else
1149#define ISA1200_HAP_EN_GPIO 77
1150#define ISA1200_HAP_LEN_GPIO 78
1151#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Jay Chokshi06fa7542011-12-07 13:09:17 -08001152#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001153
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301154#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001155static struct msm_xo_voter *xo_handle_d1;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301156#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001157
1158static int isa1200_power(int on)
1159{
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301160#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001161 int rc = 0;
1162
1163 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1164
1165 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1166 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1167 if (rc < 0) {
1168 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1169 __func__, on ? "" : "de-", rc);
1170 goto err_xo_vote;
1171 }
1172
1173 return 0;
1174
1175err_xo_vote:
1176 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1177 return rc;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301178#else
1179 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1180
1181 return 0;
1182#endif
1183
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001184}
1185
1186static int isa1200_dev_setup(bool enable)
1187{
1188 int rc = 0;
1189
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301190#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001191 struct pm_gpio hap_gpio_config = {
1192 .direction = PM_GPIO_DIR_OUT,
1193 .pull = PM_GPIO_PULL_NO,
1194 .out_strength = PM_GPIO_STRENGTH_HIGH,
1195 .function = PM_GPIO_FUNC_NORMAL,
1196 .inv_int_pol = 0,
1197 .vin_sel = 2,
1198 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1199 .output_value = 0,
1200 };
1201
1202 if (enable == true) {
1203 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1204 if (rc) {
1205 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1206 __func__, PM_HAP_EN_GPIO, rc);
1207 return rc;
1208 }
1209
1210 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1211 if (rc) {
1212 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1213 __func__, PM_HAP_LEN_GPIO, rc);
1214 return rc;
1215 }
1216
1217 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1218 if (rc) {
1219 pr_err("%s: unable to request gpio %d (%d)\n",
1220 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1221 return rc;
1222 }
1223
1224 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1225 if (rc) {
1226 pr_err("%s: Unable to set direction\n", __func__);
1227 goto free_gpio;
1228 }
1229
1230 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1231 if (IS_ERR(xo_handle_d1)) {
1232 rc = PTR_ERR(xo_handle_d1);
1233 pr_err("%s: failed to get the handle for D1(%d)\n",
1234 __func__, rc);
1235 goto gpio_set_dir;
1236 }
1237 } else {
1238 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1239
1240 msm_xo_put(xo_handle_d1);
1241 }
1242
1243 return 0;
1244
1245gpio_set_dir:
1246 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1247free_gpio:
1248 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1249 return rc;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301250#else
1251 struct pm_gpio hap_clk_gpio_config = {
1252 .direction = PM_GPIO_DIR_OUT,
1253 .pull = PM_GPIO_PULL_NO,
1254 .out_strength = PM_GPIO_STRENGTH_HIGH,
1255 .function = PM_GPIO_FUNC_1,
1256 .inv_int_pol = 0,
1257 .vin_sel = PM_GPIO_VIN_S4,
1258 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1259 .output_value = 0,
1260 };
1261
1262 rc = pm8xxx_gpio_config(ISA1200_HAP_CLK, &hap_clk_gpio_config);
1263 if (rc) {
1264 pr_err("%s: pm8038 gpio %d config failed(%d)\n",
1265 __func__, ISA1200_HAP_CLK, rc);
1266 return rc;
1267 }
1268
1269 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1270 if (rc) {
1271 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1272 __func__, ISA1200_HAP_CLK, rc);
1273 goto fail_gpio_req;
1274 }
1275
1276 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1277 if (rc) {
1278 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1279 __func__, ISA1200_HAP_CLK, rc);
1280 goto fail_gpio_dir;
1281 }
1282
1283 return 0;
1284
1285fail_gpio_dir:
1286 gpio_free(ISA1200_HAP_CLK);
1287fail_gpio_req:
1288 return rc;
1289
1290#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001291}
1292
1293static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301294#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001295 {
1296 .name = "vcc_i2c",
1297 .min_uV = ISA_I2C_VTG_MIN_UV,
1298 .max_uV = ISA_I2C_VTG_MAX_UV,
1299 .load_uA = ISA_I2C_CURR_UA,
1300 },
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301301#else
1302 {
1303 .name = "vddp",
1304 .min_uV = ISA_I2C_VTG_MIN_UV,
1305 .max_uV = ISA_I2C_VTG_MAX_UV,
1306 .load_uA = ISA_I2C_CURR_UA,
1307 },
1308#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001309};
1310
1311static struct isa1200_platform_data isa1200_1_pdata = {
1312 .name = "vibrator",
1313 .dev_setup = isa1200_dev_setup,
1314 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301315#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001316 .hap_en_gpio = PM_HAP_EN_GPIO,
1317 .hap_len_gpio = PM_HAP_LEN_GPIO,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301318#else
1319 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1320 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1321#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001322 .max_timeout = 15000,
1323 .mode_ctrl = PWM_GEN_MODE,
1324 .pwm_fd = {
1325 .pwm_div = 256,
1326 },
1327 .is_erm = false,
1328 .smart_en = true,
1329 .ext_clk_en = true,
1330 .chip_en = 1,
1331 .regulator_info = isa1200_reg_data,
1332 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1333};
1334
1335static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1336 {
1337 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1338 .platform_data = &isa1200_1_pdata,
1339 },
1340};
1341
1342#define CYTTSP_TS_GPIO_IRQ 11
1343#define CYTTSP_TS_SLEEP_GPIO 50
1344#define CYTTSP_TS_RESOUT_N_GPIO 52
1345
1346/*virtual key support */
1347static ssize_t tma340_vkeys_show(struct kobject *kobj,
1348 struct kobj_attribute *attr, char *buf)
1349{
1350 return snprintf(buf, 200,
1351 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1352 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1353 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1354 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1355 "\n");
1356}
1357
1358static struct kobj_attribute tma340_vkeys_attr = {
1359 .attr = {
1360 .mode = S_IRUGO,
1361 },
1362 .show = &tma340_vkeys_show,
1363};
1364
1365static struct attribute *tma340_properties_attrs[] = {
1366 &tma340_vkeys_attr.attr,
1367 NULL
1368};
1369
1370static struct attribute_group tma340_properties_attr_group = {
1371 .attrs = tma340_properties_attrs,
1372};
1373
1374
1375static int cyttsp_platform_init(struct i2c_client *client)
1376{
1377 int rc = 0;
1378 static struct kobject *tma340_properties_kobj;
1379
1380 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1381 tma340_properties_kobj = kobject_create_and_add("board_properties",
1382 NULL);
1383 if (tma340_properties_kobj)
1384 rc = sysfs_create_group(tma340_properties_kobj,
1385 &tma340_properties_attr_group);
1386 if (!tma340_properties_kobj || rc)
1387 pr_err("%s: failed to create board_properties\n",
1388 __func__);
1389
1390 return 0;
1391}
1392
1393static struct cyttsp_regulator regulator_data[] = {
1394 {
1395 .name = "vdd",
1396 .min_uV = CY_TMA300_VTG_MIN_UV,
1397 .max_uV = CY_TMA300_VTG_MAX_UV,
1398 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1399 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
1400 },
1401 /* TODO: Remove after runtime PM is enabled in I2C driver */
1402 {
1403 .name = "vcc_i2c",
1404 .min_uV = CY_I2C_VTG_MIN_UV,
1405 .max_uV = CY_I2C_VTG_MAX_UV,
1406 .hpm_load_uA = CY_I2C_CURR_UA,
1407 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
1408 },
1409};
1410
1411static struct cyttsp_platform_data cyttsp_pdata = {
1412 .panel_maxx = 634,
1413 .panel_maxy = 1166,
1414 .disp_maxx = 616,
1415 .disp_maxy = 1023,
1416 .disp_minx = 0,
1417 .disp_miny = 16,
1418 .flags = 0x01,
1419 .gen = CY_GEN3, /* or */
1420 .use_st = CY_USE_ST,
1421 .use_mt = CY_USE_MT,
1422 .use_hndshk = CY_SEND_HNDSHK,
1423 .use_trk_id = CY_USE_TRACKING_ID,
1424 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
1425 .use_gestures = CY_USE_GESTURES,
1426 .fw_fname = "cyttsp_8960_cdp.hex",
1427 /* activate up to 4 groups
1428 * and set active distance
1429 */
1430 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1431 CY_GEST_GRP3 | CY_GEST_GRP4 |
1432 CY_ACT_DIST,
1433 /* change act_intrvl to customize the Active power state
1434 * scanning/processing refresh interval for Operating mode
1435 */
1436 .act_intrvl = CY_ACT_INTRVL_DFLT,
1437 /* change tch_tmout to customize the touch timeout for the
1438 * Active power state for Operating mode
1439 */
1440 .tch_tmout = CY_TCH_TMOUT_DFLT,
1441 /* change lp_intrvl to customize the Low Power power state
1442 * scanning/processing refresh interval for Operating mode
1443 */
1444 .lp_intrvl = CY_LP_INTRVL_DFLT,
1445 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1446 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1447 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1448 .regulator_info = regulator_data,
1449 .num_regulators = ARRAY_SIZE(regulator_data),
1450 .init = cyttsp_platform_init,
1451 .correct_fw_ver = 9,
1452};
1453
1454static struct i2c_board_info cyttsp_info[] __initdata = {
1455 {
1456 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1457 .platform_data = &cyttsp_pdata,
1458#ifndef CY_USE_TIMER
1459 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1460#endif /* CY_USE_TIMER */
1461 },
1462};
1463
Amy Malochef3c9db42011-12-08 15:17:35 -08001464#define MXT_TS_GPIO_IRQ 11
1465#define MXT_TS_RESET_GPIO 52
1466
1467static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001468 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001469 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001470 /* T38 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001471 15, 1, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001472 /* T7 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001473 48, 255, 25,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001474 /* T8 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001475 27, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001476 /* T9 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001477 131, 0, 0, 19, 11, 0, 16, 35, 1, 3,
1478 10, 15, 1, 11, 4, 5, 40, 10, 54, 2,
1479 43, 4, 0, 0, 0, 0, 143, 40, 143, 80,
1480 18, 15, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001481 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001482 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1483 0,
1484 /* T18 Object */
1485 0, 0,
1486 /* T19 Object */
1487 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1488 0, 0, 0, 0, 0, 0,
1489 /* T23 Object */
1490 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1491 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001492 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001493 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1494 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001495 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001496 0, 0, 0, 0, 0,
1497 /* T42 Object */
1498 0, 0, 0, 0, 0, 0, 0, 0,
1499 /* T46 Object */
1500 0, 3, 16, 48, 0, 0, 1, 0, 0,
1501 /* T47 Object */
1502 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1503 /* T48 Object */
1504 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1505 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1506 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1507 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1508 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1509 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001510};
1511
Amy Malochef3c9db42011-12-08 15:17:35 -08001512static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1513 struct kobj_attribute *attr, char *buf)
1514{
1515 return snprintf(buf, 200,
1516 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":65:938:90:90"
1517 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":208:938:90:90"
1518 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":348:938:90:90"
1519 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":490:938:90:90"
1520 "\n");
1521}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001522
Amy Malochef3c9db42011-12-08 15:17:35 -08001523static struct kobj_attribute mxt224e_vkeys_attr = {
1524 .attr = {
1525 .mode = S_IRUGO,
1526 },
1527 .show = &mxt224e_vkeys_show,
1528};
1529
1530static struct attribute *mxt224e_properties_attrs[] = {
1531 &mxt224e_vkeys_attr.attr,
1532 NULL
1533};
1534
1535static struct attribute_group mxt224e_properties_attr_group = {
1536 .attrs = mxt224e_properties_attrs,
1537};
1538
1539static void mxt_init_vkeys_8930(void)
1540{
1541 int rc;
1542 static struct kobject *mxt224e_properties_kobj;
1543
1544 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1545 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1546 NULL);
1547 if (mxt224e_properties_kobj)
1548 rc = sysfs_create_group(mxt224e_properties_kobj,
1549 &mxt224e_properties_attr_group);
1550 if (!mxt224e_properties_kobj || rc)
1551 pr_err("%s: failed to create board_properties\n",
1552 __func__);
1553
1554 return;
1555}
1556
1557static struct mxt_platform_data mxt_platform_data_8930 = {
1558 .config = mxt_config_data_8930,
1559 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1560 .x_size = 1067,
1561 .y_size = 566,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001562 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301563#ifdef MSM8930_PHASE_2
1564 .digital_pwr_regulator = true,
1565#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001566 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001567 .reset_gpio = MXT_TS_RESET_GPIO,
1568 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001569};
1570
Amy Malochef3c9db42011-12-08 15:17:35 -08001571static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001572 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001573 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1574 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001575 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1576 },
1577};
1578
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301579#ifdef MSM8930_PHASE_2
1580
1581#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1582#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1583#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1584#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1585
1586static struct gpio_keys_button keys_8930[] = {
1587 {
1588 .code = KEY_VOLUMEUP,
1589 .type = EV_KEY,
1590 .desc = "volume_up",
1591 .gpio = GPIO_VOLUME_UP,
1592 .wakeup = 1,
1593 .active_low = 1,
1594 },
1595 {
1596 .code = KEY_VOLUMEDOWN,
1597 .type = EV_KEY,
1598 .desc = "volume_down",
1599 .gpio = GPIO_VOLUME_DOWN,
1600 .wakeup = 1,
1601 .active_low = 1,
1602 },
1603 {
1604 .code = KEY_CAMERA_FOCUS,
1605 .type = EV_KEY,
1606 .desc = "camera_focus",
1607 .gpio = GPIO_CAMERA_FOCUS,
1608 .wakeup = 1,
1609 .active_low = 1,
1610 },
1611 {
1612 .code = KEY_CAMERA_SNAPSHOT,
1613 .type = EV_KEY,
1614 .desc = "camera_snapshot",
1615 .gpio = GPIO_CAMERA_SNAPSHOT,
1616 .wakeup = 1,
1617 .active_low = 1,
1618 },
1619};
1620
1621/* Add GPIO keys for 8930 */
1622static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1623 .buttons = keys_8930,
1624 .nbuttons = 4,
1625};
1626
1627static struct platform_device gpio_keys_8930 = {
1628 .name = "gpio-keys",
1629 .id = -1,
1630 .dev = {
1631 .platform_data = &gpio_keys_8930_pdata,
1632 },
1633};
1634#endif /* MSM8930_PHASE_2 */
1635
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001636static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1637 .clk_freq = 100000,
1638 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001639};
1640
1641static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1642 .clk_freq = 100000,
1643 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001644};
1645
1646static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1647 .clk_freq = 100000,
1648 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001649};
1650
1651static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1652 .clk_freq = 100000,
1653 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001654};
1655
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001656
1657static struct ks8851_pdata spi_eth_pdata = {
1658 .irq_gpio = KS8851_IRQ_GPIO,
1659 .rst_gpio = KS8851_RST_GPIO,
1660};
1661
1662static struct spi_board_info spi_board_info[] __initdata = {
1663 {
1664 .modalias = "ks8851",
1665 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1666 .max_speed_hz = 19200000,
1667 .bus_num = 0,
1668 .chip_select = 0,
1669 .mode = SPI_MODE_0,
1670 .platform_data = &spi_eth_pdata
1671 },
1672 {
1673 .modalias = "dsi_novatek_3d_panel_spi",
1674 .max_speed_hz = 10800000,
1675 .bus_num = 0,
1676 .chip_select = 1,
1677 .mode = SPI_MODE_0,
1678 },
1679};
1680
1681static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001682 .name = "saw-regulator",
1683 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001684 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001685 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001686 },
1687};
1688
1689static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001690 .name = "saw-regulator",
1691 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001692 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001693 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001694 },
1695};
1696
1697static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001698 .slope = 910,
1699 .tsens_factor = 1000,
1700 .hw_type = MSM_8960,
1701 .tsens_num_sensor = 5,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001702};
1703
1704static struct platform_device msm_tsens_device = {
1705 .name = "tsens8960-tm",
1706 .id = -1,
1707 .dev = {
1708 .platform_data = &msm_tsens_pdata,
1709 },
1710};
1711
1712#ifdef CONFIG_MSM_FAKE_BATTERY
1713static struct platform_device fish_battery_device = {
1714 .name = "fish_battery",
1715};
1716#endif
1717
David Collins1d4061b2011-12-06 15:36:40 -08001718#ifndef MSM8930_PHASE_2
1719
1720/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08001721static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001722 .name = GPIO_REGULATOR_DEV_NAME,
1723 .id = PM8921_MPP_PM_TO_SYS(7),
1724 .dev = {
1725 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1726 },
1727};
1728
Jay Chokshi06fa7542011-12-07 13:09:17 -08001729static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001730 .name = GPIO_REGULATOR_DEV_NAME,
1731 .id = 91,
1732 .dev = {
1733 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1734 },
1735};
1736
David Collins1d4061b2011-12-06 15:36:40 -08001737#else
1738
1739/* 8930 Phase 2 */
1740static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
1741 .name = GPIO_REGULATOR_DEV_NAME,
1742 .id = 63,
1743 .dev = {
1744 .platform_data =
1745 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
1746 },
1747};
1748
1749static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
1750 .name = GPIO_REGULATOR_DEV_NAME,
1751 .id = 97,
1752 .dev = {
1753 .platform_data =
1754 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
1755 },
1756};
1757
1758#endif
1759
Jay Chokshi06fa7542011-12-07 13:09:17 -08001760static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001761 .name = "rpm-regulator",
1762 .id = -1,
1763 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001764 /*
1765 * TODO: When physical 8930/PM8038 hardware becomes
1766 * available, replace msm_rpm_regulator_pdata
1767 * with 8930 rpm regulator object.
1768 */
1769#if !defined(MSM8930_PHASE_2)
1770
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001771 .platform_data = &msm_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001772#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001773 },
1774};
1775
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001776static struct platform_device *common_devices[] __initdata = {
1777 &msm8960_device_dmov,
1778 &msm_device_smd,
1779 &msm8960_device_uart_gsbi5,
1780 &msm_device_uart_dm6,
1781 &msm_device_saw_core0,
1782 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001783 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001784#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08001785 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001786#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08001787 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08001788#ifdef MSM8930_PHASE_2
1789 &msm8930_device_ext_otg_sw_vreg,
1790#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08001791 &msm_8960_q6_lpass,
1792 &msm_8960_q6_mss_fw,
1793 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001794 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001795 &msm_pil_tzapps,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001796 &msm8960_device_qup_spi_gsbi1,
1797 &msm8960_device_qup_i2c_gsbi3,
1798 &msm8960_device_qup_i2c_gsbi4,
1799 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001800 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001801 &msm_slim_ctrl,
1802 &msm_device_wcnss_wlan,
1803#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1804 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1805 &qcrypto_device,
1806#endif
1807
1808#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1809 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1810 &qcedev_device,
1811#endif
1812#ifdef CONFIG_MSM_ROTATOR
1813 &msm_rotator_device,
1814#endif
1815 &msm_device_sps,
1816#ifdef CONFIG_MSM_FAKE_BATTERY
1817 &fish_battery_device,
1818#endif
1819#ifdef CONFIG_ANDROID_PMEM
1820#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
1821 &android_pmem_device,
1822 &android_pmem_adsp_device,
1823#endif
1824 &android_pmem_audio_device,
1825#endif
1826 &msm_device_vidc,
1827 &msm_device_bam_dmux,
1828 &msm_fm_platform_init,
1829
1830#ifdef CONFIG_HW_RANDOM_MSM
1831 &msm_device_rng,
1832#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06001833 &msm8930_rpm_device,
1834 &msm8930_rpm_log_device,
1835 &msm8930_rpm_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001836#ifdef CONFIG_ION_MSM
1837 &ion_dev,
1838#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001839 &msm_device_tz_log,
1840
1841#ifdef CONFIG_MSM_QDSS
1842 &msm_etb_device,
1843 &msm_tpiu_device,
1844 &msm_funnel_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001845 &msm_ptm_device,
1846#endif
1847 &msm_device_dspcrashd_8960,
1848 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301849#ifdef MSM8930_PHASE_2
1850 &gpio_keys_8930,
1851#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001852};
1853
1854static struct platform_device *cdp_devices[] __initdata = {
1855 &msm8960_device_otg,
1856 &msm8960_device_gadget_peripheral,
1857 &msm_device_hsusb_host,
1858 &android_usb_device,
1859 &msm_pcm,
1860 &msm_pcm_routing,
1861 &msm_cpudai0,
1862 &msm_cpudai1,
1863 &msm_cpudai_hdmi_rx,
1864 &msm_cpudai_bt_rx,
1865 &msm_cpudai_bt_tx,
1866 &msm_cpudai_fm_rx,
1867 &msm_cpudai_fm_tx,
1868 &msm_cpudai_auxpcm_rx,
1869 &msm_cpudai_auxpcm_tx,
1870 &msm_cpu_fe,
1871 &msm_stub_codec,
1872 &msm_kgsl_3d0,
1873#ifdef CONFIG_MSM_KGSL_2D
1874 &msm_kgsl_2d0,
1875 &msm_kgsl_2d1,
1876#endif
1877#ifdef CONFIG_MSM_GEMINI
1878 &msm8960_gemini_device,
1879#endif
1880 &msm_voice,
1881 &msm_voip,
1882 &msm_lpa_pcm,
1883 &msm_cpudai_afe_01_rx,
1884 &msm_cpudai_afe_01_tx,
1885 &msm_cpudai_afe_02_rx,
1886 &msm_cpudai_afe_02_tx,
1887 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08001888 &msm_compr_dsp,
1889 &msm_cpudai_incall_music_rx,
1890 &msm_cpudai_incall_record_rx,
1891 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001892 &msm_pcm_hostless,
1893 &msm_bus_apps_fabric,
1894 &msm_bus_sys_fabric,
1895 &msm_bus_mm_fabric,
1896 &msm_bus_sys_fpb,
1897 &msm_bus_cpss_fpb,
1898 &msm_tsens_device,
1899};
1900
1901static void __init msm8930_i2c_init(void)
1902{
1903 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1904 &msm8960_i2c_qup_gsbi4_pdata;
1905
1906 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1907 &msm8960_i2c_qup_gsbi3_pdata;
1908
1909 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1910 &msm8960_i2c_qup_gsbi10_pdata;
1911
1912 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1913 &msm8960_i2c_qup_gsbi12_pdata;
1914}
1915
1916static void __init msm8930_gfx_init(void)
1917{
1918 uint32_t soc_platform_version = socinfo_get_version();
1919 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1920 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1921 msm_kgsl_3d0.dev.platform_data;
1922 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1923 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
1924 }
1925}
1926
1927static struct msm_cpuidle_state msm_cstates[] __initdata = {
1928 {0, 0, "C0", "WFI",
1929 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1930
1931 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1932 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1933
1934 {0, 2, "C2", "POWER_COLLAPSE",
1935 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1936
1937 {1, 0, "C0", "WFI",
1938 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1939
1940 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1941 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1942};
1943
1944static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1945 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1946 .idle_supported = 1,
1947 .suspend_supported = 1,
1948 .idle_enabled = 0,
1949 .suspend_enabled = 0,
1950 },
1951
1952 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1953 .idle_supported = 1,
1954 .suspend_supported = 1,
1955 .idle_enabled = 0,
1956 .suspend_enabled = 0,
1957 },
1958
1959 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1960 .idle_supported = 1,
1961 .suspend_supported = 1,
1962 .idle_enabled = 1,
1963 .suspend_enabled = 1,
1964 },
1965
1966 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1967 .idle_supported = 0,
1968 .suspend_supported = 1,
1969 .idle_enabled = 0,
1970 .suspend_enabled = 0,
1971 },
1972
1973 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1974 .idle_supported = 1,
1975 .suspend_supported = 1,
1976 .idle_enabled = 0,
1977 .suspend_enabled = 0,
1978 },
1979
1980 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1981 .idle_supported = 1,
1982 .suspend_supported = 0,
1983 .idle_enabled = 1,
1984 .suspend_enabled = 0,
1985 },
1986};
1987
1988static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1989 {
1990 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1991 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1992 true,
1993 100, 8000, 100000, 1,
1994 },
1995
1996 {
1997 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1998 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1999 true,
2000 2000, 6000, 60100000, 3000,
2001 },
2002
2003 {
2004 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2005 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2006 false,
2007 4200, 5000, 60350000, 3500,
2008 },
2009
2010 {
2011 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2012 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2013 false,
2014 6300, 4500, 65350000, 4800,
2015 },
2016 {
2017 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2018 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2019 false,
2020 7000, 3500, 66600000, 5150,
2021 },
2022
2023 {
2024 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2025 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2026 false,
2027 11700, 2500, 67850000, 5500,
2028 },
2029
2030 {
2031 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2032 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2033 false,
2034 13800, 2000, 71850000, 6800,
2035 },
2036
2037 {
2038 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2039 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2040 false,
2041 29700, 500, 75850000, 8800,
2042 },
2043
2044 {
2045 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2046 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2047 false,
2048 29700, 0, 76350000, 9800,
2049 },
2050};
2051
Praveen Chidambaram78499012011-11-01 17:15:17 -06002052static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2053 .levels = &msm_rpmrs_levels[0],
2054 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2055 .vdd_mem_levels = {
2056 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2057 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2058 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2059 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2060 },
2061 .vdd_dig_levels = {
2062 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2063 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2064 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2065 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2066 },
2067 .vdd_mask = 0x7FFFFF,
2068 .rpmrs_target_id = {
2069 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2070 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2071 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8038_S1_0,
2072 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8038_S1_1,
2073 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2074 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2075 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2076 },
2077};
2078
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002079static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2080 .mode = MSM_PM_BOOT_CONFIG_TZ,
2081};
2082
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002083#ifdef CONFIG_I2C
2084#define I2C_SURF 1
2085#define I2C_FFA (1 << 1)
2086#define I2C_RUMI (1 << 2)
2087#define I2C_SIM (1 << 3)
2088#define I2C_FLUID (1 << 4)
2089#define I2C_LIQUID (1 << 5)
2090
2091struct i2c_registry {
2092 u8 machs;
2093 int bus;
2094 struct i2c_board_info *info;
2095 int len;
2096};
2097
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002098static void __init msm8930_init_hsic(void)
2099{
2100#ifdef CONFIG_USB_EHCI_MSM_HSIC
2101 uint32_t version = socinfo_get_version();
2102
2103 pr_info("%s: version:%d mtp:%d\n", __func__,
2104 SOCINFO_VERSION_MAJOR(version),
2105 machine_is_msm8930_mtp());
2106
2107 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
2108 machine_is_msm8930_mtp() ||
2109 machine_is_msm8930_fluid())
2110 return;
2111
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002112 platform_device_register(&msm_device_hsic_host);
2113#endif
2114}
2115
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002116#ifdef CONFIG_ISL9519_CHARGER
2117static struct isl_platform_data isl_data __initdata = {
2118 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2119 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2120 .max_system_voltage = 4200,
2121 .min_system_voltage = 3200,
2122 .chgcurrent = 1000, /* 1900, */
2123 .term_current = 400, /* Need fine tuning */
2124 .input_current = 2048,
2125};
2126
2127static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2128 {
2129 I2C_BOARD_INFO("isl9519q", 0x9),
2130 .irq = 0, /* Not required when notify-by-pmic */
2131 .platform_data = &isl_data,
2132 },
2133};
2134#endif /* CONFIG_ISL9519_CHARGER */
2135
2136static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002137#ifdef CONFIG_ISL9519_CHARGER
2138 {
2139 I2C_LIQUID,
2140 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2141 isl_charger_i2c_info,
2142 ARRAY_SIZE(isl_charger_i2c_info),
2143 },
2144#endif /* CONFIG_ISL9519_CHARGER */
2145 {
2146 I2C_SURF | I2C_FFA | I2C_FLUID,
2147 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2148 cyttsp_info,
2149 ARRAY_SIZE(cyttsp_info),
2150 },
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05302151#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002152 {
2153 I2C_LIQUID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002154 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2155 msm_isa1200_board_info,
2156 ARRAY_SIZE(msm_isa1200_board_info),
2157 },
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05302158#else
2159 {
2160 I2C_FFA | I2C_FLUID,
2161 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2162 msm_isa1200_board_info,
2163 ARRAY_SIZE(msm_isa1200_board_info),
2164 },
2165#endif
Amy Malochef3c9db42011-12-08 15:17:35 -08002166 {
2167 I2C_SURF,
2168 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2169 mxt_device_info_8930,
2170 ARRAY_SIZE(mxt_device_info_8930),
2171 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002172};
2173#endif /* CONFIG_I2C */
2174
2175static void __init register_i2c_devices(void)
2176{
2177#ifdef CONFIG_I2C
2178 u8 mach_mask = 0;
2179 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002180#ifdef CONFIG_MSM_CAMERA
2181 struct i2c_registry msm8930_camera_i2c_devices = {
2182 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2183 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2184 msm8930_camera_board_info.board_info,
2185 msm8930_camera_board_info.num_i2c_board_info,
2186 };
2187#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002188
2189 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002190 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002191 mach_mask = I2C_SURF;
2192 else if (machine_is_msm8930_fluid())
2193 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002194 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002195 mach_mask = I2C_FFA;
2196 else
2197 pr_err("unmatched machine ID in register_i2c_devices\n");
2198
2199 /* Run the array and install devices as appropriate */
2200 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2201 if (msm8960_i2c_devices[i].machs & mach_mask)
2202 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2203 msm8960_i2c_devices[i].info,
2204 msm8960_i2c_devices[i].len);
2205 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002206#ifdef CONFIG_MSM_CAMERA
2207 if (msm8930_camera_i2c_devices.machs & mach_mask)
2208 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2209 msm8930_camera_i2c_devices.info,
2210 msm8930_camera_i2c_devices.len);
2211#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002212#endif
2213}
2214
2215static void __init msm8930_cdp_init(void)
2216{
2217 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2218 pr_err("meminfo_init() failed!\n");
2219
Praveen Chidambaram78499012011-11-01 17:15:17 -06002220 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2221 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002222
2223 regulator_suppress_info_printing();
2224 if (msm_xo_init())
2225 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002226 platform_device_register(&msm8930_device_rpm_regulator);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002227 msm_clock_init(&msm8960_clock_init_data);
2228 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
2229 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002230 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002231 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2232 &msm8960_qup_spi_gsbi1_pdata;
2233 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2234
Jay Chokshi06fa7542011-12-07 13:09:17 -08002235 /*
2236 * TODO: When physical 8930/PM8038 hardware becomes
2237 * available, remove this block or add the config
2238 * option.
2239 */
2240#ifndef MSM8930_PHASE_2
2241 msm8960_init_pmic();
2242#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002243 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002244#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002245 msm8930_i2c_init();
2246 msm8930_gfx_init();
2247 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2248 msm_spm_l2_init(msm_spm_l2_data);
2249 msm8930_init_buses();
2250 platform_add_devices(msm_footswitch_devices,
2251 msm_num_footswitch_devices);
2252 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi06fa7542011-12-07 13:09:17 -08002253 /*
2254 * TODO: When physical 8930/PM8038 hardware becomes
2255 * available, remove this block or add the config
2256 * option.
2257 */
2258#ifndef MSM8930_PHASE_2
2259 msm8960_pm8921_gpio_mpp_init();
2260#else
2261 msm8930_pm8038_gpio_mpp_init();
2262#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002263 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2264 msm8930_init_hsic();
2265 msm8930_init_cam();
2266 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08002267 acpuclk_init(&acpuclk_8930_soc_data);
Amy Malochef3c9db42011-12-08 15:17:35 -08002268 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
2269 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002270 register_i2c_devices();
2271 msm8930_init_fb();
2272 slim_register_board_info(msm_slim_devices,
2273 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002274 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2275 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2276 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2277 msm_pm_data);
2278 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002279 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002280
2281 if (PLATFORM_IS_CHARM25())
2282 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2283}
2284
2285MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2286 .map_io = msm8930_map_io,
2287 .reserve = msm8930_reserve,
2288 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302289 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002290 .timer = &msm_timer,
2291 .init_machine = msm8930_cdp_init,
2292 .init_early = msm8930_allocate_memory_regions,
2293 .init_very_early = msm8930_early_memory,
2294MACHINE_END
2295
2296MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2297 .map_io = msm8930_map_io,
2298 .reserve = msm8930_reserve,
2299 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302300 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002301 .timer = &msm_timer,
2302 .init_machine = msm8930_cdp_init,
2303 .init_early = msm8930_allocate_memory_regions,
2304 .init_very_early = msm8930_early_memory,
2305MACHINE_END
2306
2307MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2308 .map_io = msm8930_map_io,
2309 .reserve = msm8930_reserve,
2310 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302311 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002312 .timer = &msm_timer,
2313 .init_machine = msm8930_cdp_init,
2314 .init_early = msm8930_allocate_memory_regions,
2315 .init_very_early = msm8930_early_memory,
2316MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002317
2318MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2319 .map_io = msm8930_map_io,
2320 .reserve = msm8930_reserve,
2321 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302322 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002323 .timer = &msm_timer,
2324 .init_machine = msm8930_cdp_init,
2325 .init_early = msm8930_allocate_memory_regions,
2326 .init_very_early = msm8930_early_memory,
2327MACHINE_END
2328
2329MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2330 .map_io = msm8930_map_io,
2331 .reserve = msm8930_reserve,
2332 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302333 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002334 .timer = &msm_timer,
2335 .init_machine = msm8930_cdp_init,
2336 .init_early = msm8930_allocate_memory_regions,
2337 .init_very_early = msm8930_early_memory,
2338MACHINE_END