| Abhijeet Dharmapurikar | de91d2c | 2012-08-23 14:36:59 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 |  * | 
 | 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> | 
| Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 14 | #include <linux/bitops.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 15 | #include <linux/platform_device.h> | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 16 | #include <linux/gpio.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <linux/io.h> | 
 | 18 | #include <linux/irq.h> | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 19 | #include <linux/i2c.h> | 
| David Keitel | 2f613d9 | 2012-02-15 11:29:16 -0800 | [diff] [blame] | 20 | #include <linux/i2c/smb349.h> | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 21 | #include <linux/i2c/sx150x.h> | 
| Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 22 | #include <linux/slimbus/slimbus.h> | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 23 | #include <linux/mfd/wcd9xxx/core.h> | 
 | 24 | #include <linux/mfd/wcd9xxx/pdata.h> | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 25 | #include <linux/mfd/pm8xxx/misc.h> | 
| Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 26 | #include <linux/msm_ssbi.h> | 
| Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 27 | #include <linux/spi/spi.h> | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 28 | #include <linux/dma-mapping.h> | 
 | 29 | #include <linux/platform_data/qcom_crypto_device.h> | 
| Mitchel Humpherys | 6ff930c | 2012-09-06 11:32:54 -0700 | [diff] [blame] | 30 | #include <linux/msm_ion.h> | 
| Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 31 | #include <linux/memory.h> | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 32 | #include <linux/memblock.h> | 
| Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 33 | #include <linux/msm_thermal.h> | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 34 | #include <linux/i2c/atmel_mxt_ts.h> | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 35 | #include <linux/cyttsp-qc.h> | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 36 | #include <linux/i2c/isa1200.h> | 
| Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 37 | #include <linux/gpio_keys.h> | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 38 | #include <linux/epm_adc.h> | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 39 | #include <linux/i2c/sx150x.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 40 | #include <asm/mach-types.h> | 
 | 41 | #include <asm/mach/arch.h> | 
 | 42 | #include <asm/hardware/gic.h> | 
| Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 43 | #include <asm/mach/mmc.h> | 
| Ankit Verma | 6b7e2ba | 2012-01-26 15:48:54 -0800 | [diff] [blame] | 44 | #include <linux/platform_data/qcom_wcnss_device.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 45 |  | 
 | 46 | #include <mach/board.h> | 
 | 47 | #include <mach/msm_iomap.h> | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 48 | #include <mach/ion.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 49 | #include <linux/usb/msm_hsusb.h> | 
 | 50 | #include <linux/usb/android.h> | 
 | 51 | #include <mach/socinfo.h> | 
| Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 52 | #include <mach/msm_spi.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | #include "timer.h" | 
 | 54 | #include "devices.h" | 
| Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 55 | #include <mach/gpiomux.h> | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 56 | #include <mach/rpm.h> | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 57 | #ifdef CONFIG_ANDROID_PMEM | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 58 | #include <linux/android_pmem.h> | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 59 | #endif | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 60 | #include <mach/msm_memtypes.h> | 
 | 61 | #include <linux/bootmem.h> | 
 | 62 | #include <asm/setup.h> | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 63 | #include <mach/dma.h> | 
| Jin Hong | d3024e6 | 2012-02-09 16:13:32 -0800 | [diff] [blame] | 64 | #include <mach/msm_dsps.h> | 
| Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 65 | #include <mach/msm_bus_board.h> | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 66 | #include <mach/cpuidle.h> | 
| Joel King | dacbc82 | 2012-01-25 13:30:57 -0800 | [diff] [blame] | 67 | #include <mach/mdm2.h> | 
| Siddartha Mohanadoss | caeaa92 | 2012-02-07 16:41:38 -0800 | [diff] [blame] | 68 | #include <linux/msm_tsens.h> | 
| Stephen Boyd | 4d0d258 | 2012-02-10 14:49:40 -0800 | [diff] [blame] | 69 | #include <mach/msm_xo.h> | 
| Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 70 | #include <mach/msm_rtb.h> | 
| Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 71 | #include <sound/cs8427.h> | 
| Ravi Kumar V | 05931a2 | 2012-04-04 17:09:37 +0530 | [diff] [blame] | 72 | #include <media/gpio-ir-recv.h> | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 73 | #include <linux/fmem.h> | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 74 | #include <mach/msm_pcie.h> | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 75 | #include <mach/restart.h> | 
| Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 76 | #include <mach/msm_iomap.h> | 
| Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 77 |  | 
| Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 78 | #include "msm_watchdog.h" | 
| Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 79 | #include "board-8064.h" | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 80 | #include "spm.h" | 
| Subhash Jadavani | 909e04f | 2012-04-12 10:52:50 +0530 | [diff] [blame] | 81 | #include <mach/mpm.h> | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 82 | #include "rpm_resources.h" | 
| Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 83 | #include "pm.h" | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 84 | #include "pm-boot.h" | 
| Rajesh Sastrula | aee8af3 | 2012-01-20 11:46:31 -0800 | [diff] [blame] | 85 | #include "devices-msm8x60.h" | 
| Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 86 | #include "smd_private.h" | 
| Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 87 |  | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 88 | #define MSM_PMEM_ADSP_SIZE         0x7800000 | 
| Bharath Ramachandramurthy | 2fd017a | 2012-03-13 10:21:09 -0700 | [diff] [blame] | 89 | #define MSM_PMEM_AUDIO_SIZE        0x4CF000 | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 90 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY | 
 | 91 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ | 
 | 92 | #else | 
| Chetan Kalyan | 72aac4f | 2012-02-23 14:56:54 -0800 | [diff] [blame] | 93 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 94 | #endif | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 95 |  | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 96 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 97 | #define HOLE_SIZE		0x20000 | 
| Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 98 | #define MSM_CONTIG_MEM_SIZE  0x65000 | 
| Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 99 | #ifdef CONFIG_MSM_IOMMU | 
 | 100 | #define MSM_ION_MM_SIZE		0x3800000 | 
 | 101 | #define MSM_ION_SF_SIZE		0 | 
| Olav Haugan | 39477bb | 2012-05-14 16:05:36 -0700 | [diff] [blame] | 102 | #define MSM_ION_QSECOM_SIZE	0x780000 /* (7.5MB) */ | 
| Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 103 | #define MSM_ION_HEAP_NUM	7 | 
 | 104 | #else | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 105 | #define MSM_ION_MM_SIZE		MSM_PMEM_ADSP_SIZE | 
| Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 106 | #define MSM_ION_SF_SIZE		MSM_PMEM_SIZE | 
| Olav Haugan | 39477bb | 2012-05-14 16:05:36 -0700 | [diff] [blame] | 107 | #define MSM_ION_QSECOM_SIZE	0x600000 /* (6MB) */ | 
| Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 108 | #define MSM_ION_HEAP_NUM	8 | 
 | 109 | #endif | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 110 | #define MSM_ION_MM_FW_SIZE	(0x200000 - HOLE_SIZE) /* (2MB - 128KB) */ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 111 | #define MSM_ION_MFC_SIZE	SZ_8K | 
| Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 112 | #define MSM_ION_AUDIO_SIZE	MSM_PMEM_AUDIO_SIZE | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 113 | #else | 
| Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 114 | #define MSM_CONTIG_MEM_SIZE  0x110C000 | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 115 | #define MSM_ION_HEAP_NUM	1 | 
 | 116 | #endif | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 117 |  | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 118 | #define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \ | 
 | 119 | 							HOLE_SIZE)) | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 120 | #define MAX_FIXED_AREA_SIZE	0x10000000 | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 121 | #define MSM_MM_FW_SIZE		(0x200000 - HOLE_SIZE) | 
 | 122 | #define APQ8064_FW_START	APQ8064_FIXED_AREA_START | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 123 |  | 
| Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 124 | #define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB     (MSM_QFPROM_BASE + 0x23c) | 
 | 125 | #define QFPROM_RAW_OEM_CONFIG_ROW0_LSB      (MSM_QFPROM_BASE + 0x220) | 
 | 126 |  | 
| Niranjana Vishwanathapura | 68210ff | 2012-06-24 18:03:49 -0600 | [diff] [blame] | 127 | /* PCIE AXI address space */ | 
 | 128 | #define PCIE_AXI_BAR_PHYS   0x08000000 | 
 | 129 | #define PCIE_AXI_BAR_SIZE   SZ_128M | 
 | 130 |  | 
| Niranjana Vishwanathapura | 459a27d | 2012-07-20 12:23:55 -0600 | [diff] [blame] | 131 | /* PCIe pmic gpios */ | 
 | 132 | #define PCIE_WAKE_N_PMIC_GPIO 12 | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 133 | #define PCIE_PWR_EN_PMIC_GPIO 13 | 
 | 134 | #define PCIE_RST_N_PMIC_MPP 1 | 
 | 135 |  | 
| Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 136 | #ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION | 
 | 137 | static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE; | 
 | 138 | static int __init msm_contig_mem_size_setup(char *p) | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 139 | { | 
| Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 140 | 	msm_contig_mem_size = memparse(p, NULL); | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 141 | 	return 0; | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 142 | } | 
| Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 143 | early_param("msm_contig_mem_size", msm_contig_mem_size_setup); | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 144 | #endif | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 145 |  | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 146 | #ifdef CONFIG_ANDROID_PMEM | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 147 | static unsigned pmem_size = MSM_PMEM_SIZE; | 
 | 148 | static int __init pmem_size_setup(char *p) | 
 | 149 | { | 
 | 150 | 	pmem_size = memparse(p, NULL); | 
 | 151 | 	return 0; | 
 | 152 | } | 
 | 153 | early_param("pmem_size", pmem_size_setup); | 
 | 154 |  | 
 | 155 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; | 
 | 156 |  | 
 | 157 | static int __init pmem_adsp_size_setup(char *p) | 
 | 158 | { | 
 | 159 | 	pmem_adsp_size = memparse(p, NULL); | 
 | 160 | 	return 0; | 
 | 161 | } | 
 | 162 | early_param("pmem_adsp_size", pmem_adsp_size_setup); | 
 | 163 |  | 
 | 164 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; | 
 | 165 |  | 
 | 166 | static int __init pmem_audio_size_setup(char *p) | 
 | 167 | { | 
 | 168 | 	pmem_audio_size = memparse(p, NULL); | 
 | 169 | 	return 0; | 
 | 170 | } | 
 | 171 | early_param("pmem_audio_size", pmem_audio_size_setup); | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 172 | #endif | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 173 |  | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 174 | #ifdef CONFIG_ANDROID_PMEM | 
 | 175 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 176 | static struct android_pmem_platform_data android_pmem_pdata = { | 
 | 177 | 	.name = "pmem", | 
 | 178 | 	.allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, | 
 | 179 | 	.cached = 1, | 
 | 180 | 	.memory_type = MEMTYPE_EBI1, | 
 | 181 | }; | 
 | 182 |  | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 183 | static struct platform_device apq8064_android_pmem_device = { | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 184 | 	.name = "android_pmem", | 
 | 185 | 	.id = 0, | 
 | 186 | 	.dev = {.platform_data = &android_pmem_pdata}, | 
 | 187 | }; | 
 | 188 |  | 
 | 189 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { | 
 | 190 | 	.name = "pmem_adsp", | 
 | 191 | 	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP, | 
 | 192 | 	.cached = 0, | 
 | 193 | 	.memory_type = MEMTYPE_EBI1, | 
 | 194 | }; | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 195 | static struct platform_device apq8064_android_pmem_adsp_device = { | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 196 | 	.name = "android_pmem", | 
 | 197 | 	.id = 2, | 
 | 198 | 	.dev = { .platform_data = &android_pmem_adsp_pdata }, | 
 | 199 | }; | 
 | 200 |  | 
 | 201 | static struct android_pmem_platform_data android_pmem_audio_pdata = { | 
 | 202 | 	.name = "pmem_audio", | 
 | 203 | 	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP, | 
 | 204 | 	.cached = 0, | 
 | 205 | 	.memory_type = MEMTYPE_EBI1, | 
 | 206 | }; | 
 | 207 |  | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 208 | static struct platform_device apq8064_android_pmem_audio_device = { | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 209 | 	.name = "android_pmem", | 
 | 210 | 	.id = 4, | 
 | 211 | 	.dev = { .platform_data = &android_pmem_audio_pdata }, | 
 | 212 | }; | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 213 | #endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */ | 
 | 214 | #endif /* CONFIG_ANDROID_PMEM */ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 215 |  | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 216 | struct fmem_platform_data apq8064_fmem_pdata = { | 
 | 217 | }; | 
 | 218 |  | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 219 | static struct memtype_reserve apq8064_reserve_table[] __initdata = { | 
 | 220 | 	[MEMTYPE_SMI] = { | 
 | 221 | 	}, | 
 | 222 | 	[MEMTYPE_EBI0] = { | 
 | 223 | 		.flags	=	MEMTYPE_FLAGS_1M_ALIGN, | 
 | 224 | 	}, | 
 | 225 | 	[MEMTYPE_EBI1] = { | 
 | 226 | 		.flags	=	MEMTYPE_FLAGS_1M_ALIGN, | 
 | 227 | 	}, | 
 | 228 | }; | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 229 |  | 
| Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 230 | static void __init reserve_rtb_memory(void) | 
 | 231 | { | 
 | 232 | #if defined(CONFIG_MSM_RTB) | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 233 | 	apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size; | 
| Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 234 | #endif | 
 | 235 | } | 
 | 236 |  | 
 | 237 |  | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 238 | static void __init size_pmem_devices(void) | 
 | 239 | { | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 240 | #ifdef CONFIG_ANDROID_PMEM | 
 | 241 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 242 | 	android_pmem_adsp_pdata.size = pmem_adsp_size; | 
 | 243 | 	android_pmem_pdata.size = pmem_size; | 
 | 244 | 	android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 245 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ | 
 | 246 | #endif /*CONFIG_ANDROID_PMEM*/ | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 247 | } | 
 | 248 |  | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 249 | #ifdef CONFIG_ANDROID_PMEM | 
 | 250 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 251 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) | 
 | 252 | { | 
 | 253 | 	apq8064_reserve_table[p->memory_type].size += p->size; | 
 | 254 | } | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 255 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ | 
 | 256 | #endif /*CONFIG_ANDROID_PMEM*/ | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 257 |  | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 258 | static void __init reserve_pmem_memory(void) | 
 | 259 | { | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 260 | #ifdef CONFIG_ANDROID_PMEM | 
 | 261 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 262 | 	reserve_memory_for(&android_pmem_adsp_pdata); | 
 | 263 | 	reserve_memory_for(&android_pmem_pdata); | 
 | 264 | 	reserve_memory_for(&android_pmem_audio_pdata); | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 265 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ | 
| Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 266 | 	apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size; | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 267 | #endif /*CONFIG_ANDROID_PMEM*/ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 268 | } | 
 | 269 |  | 
 | 270 | static int apq8064_paddr_to_memtype(unsigned int paddr) | 
 | 271 | { | 
 | 272 | 	return MEMTYPE_EBI1; | 
 | 273 | } | 
 | 274 |  | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 275 | #define FMEM_ENABLED 0 | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 276 |  | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 277 | #ifdef CONFIG_ION_MSM | 
 | 278 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 279 | static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = { | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 280 | 	.permission_type = IPT_TYPE_MM_CARVEOUT, | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 281 | 	.align = PAGE_SIZE, | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 282 | 	.reusable = FMEM_ENABLED, | 
 | 283 | 	.mem_is_fmem = FMEM_ENABLED, | 
 | 284 | 	.fixed_position = FIXED_MIDDLE, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 285 | }; | 
 | 286 |  | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 287 | static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = { | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 288 | 	.permission_type = IPT_TYPE_MFC_SHAREDMEM, | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 289 | 	.align = PAGE_SIZE, | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 290 | 	.reusable = 0, | 
 | 291 | 	.mem_is_fmem = FMEM_ENABLED, | 
 | 292 | 	.fixed_position = FIXED_HIGH, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 293 | }; | 
 | 294 |  | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 295 | static struct ion_co_heap_pdata co_apq8064_ion_pdata = { | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 296 | 	.adjacent_mem_id = INVALID_HEAP_ID, | 
 | 297 | 	.align = PAGE_SIZE, | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 298 | 	.mem_is_fmem = 0, | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 299 | }; | 
 | 300 |  | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 301 | static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = { | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 302 | 	.adjacent_mem_id = ION_CP_MM_HEAP_ID, | 
 | 303 | 	.align = SZ_128K, | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 304 | 	.mem_is_fmem = FMEM_ENABLED, | 
 | 305 | 	.fixed_position = FIXED_LOW, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 306 | }; | 
 | 307 | #endif | 
| Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 308 |  | 
 | 309 | /** | 
 | 310 |  * These heaps are listed in the order they will be allocated. Due to | 
 | 311 |  * video hardware restrictions and content protection the FW heap has to | 
 | 312 |  * be allocated adjacent (below) the MM heap and the MFC heap has to be | 
 | 313 |  * allocated after the MM heap to ensure MFC heap is not more than 256MB | 
 | 314 |  * away from the base address of the FW heap. | 
 | 315 |  * However, the order of FW heap and MM heap doesn't matter since these | 
 | 316 |  * two heaps are taken care of by separate code to ensure they are adjacent | 
 | 317 |  * to each other. | 
 | 318 |  * Don't swap the order unless you know what you are doing! | 
 | 319 |  */ | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 320 | static struct ion_platform_data apq8064_ion_pdata = { | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 321 | 	.nr = MSM_ION_HEAP_NUM, | 
 | 322 | 	.heaps = { | 
 | 323 | 		{ | 
 | 324 | 			.id	= ION_SYSTEM_HEAP_ID, | 
 | 325 | 			.type	= ION_HEAP_TYPE_SYSTEM, | 
 | 326 | 			.name	= ION_VMALLOC_HEAP_NAME, | 
 | 327 | 		}, | 
 | 328 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION | 
 | 329 | 		{ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 330 | 			.id	= ION_CP_MM_HEAP_ID, | 
 | 331 | 			.type	= ION_HEAP_TYPE_CP, | 
 | 332 | 			.name	= ION_MM_HEAP_NAME, | 
 | 333 | 			.size	= MSM_ION_MM_SIZE, | 
 | 334 | 			.memory_type = ION_EBI_TYPE, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 335 | 			.extra_data = (void *) &cp_mm_apq8064_ion_pdata, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 336 | 		}, | 
 | 337 | 		{ | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 338 | 			.id	= ION_MM_FIRMWARE_HEAP_ID, | 
 | 339 | 			.type	= ION_HEAP_TYPE_CARVEOUT, | 
 | 340 | 			.name	= ION_MM_FIRMWARE_HEAP_NAME, | 
 | 341 | 			.size	= MSM_ION_MM_FW_SIZE, | 
 | 342 | 			.memory_type = ION_EBI_TYPE, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 343 | 			.extra_data = (void *) &fw_co_apq8064_ion_pdata, | 
| Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 344 | 		}, | 
 | 345 | 		{ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 346 | 			.id	= ION_CP_MFC_HEAP_ID, | 
 | 347 | 			.type	= ION_HEAP_TYPE_CP, | 
 | 348 | 			.name	= ION_MFC_HEAP_NAME, | 
 | 349 | 			.size	= MSM_ION_MFC_SIZE, | 
 | 350 | 			.memory_type = ION_EBI_TYPE, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 351 | 			.extra_data = (void *) &cp_mfc_apq8064_ion_pdata, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 352 | 		}, | 
| Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 353 | #ifndef CONFIG_MSM_IOMMU | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 354 | 		{ | 
| Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 355 | 			.id	= ION_SF_HEAP_ID, | 
 | 356 | 			.type	= ION_HEAP_TYPE_CARVEOUT, | 
 | 357 | 			.name	= ION_SF_HEAP_NAME, | 
 | 358 | 			.size	= MSM_ION_SF_SIZE, | 
 | 359 | 			.memory_type = ION_EBI_TYPE, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 360 | 			.extra_data = (void *) &co_apq8064_ion_pdata, | 
| Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 361 | 		}, | 
| Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 362 | #endif | 
| Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 363 | 		{ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 364 | 			.id	= ION_IOMMU_HEAP_ID, | 
 | 365 | 			.type	= ION_HEAP_TYPE_IOMMU, | 
 | 366 | 			.name	= ION_IOMMU_HEAP_NAME, | 
 | 367 | 		}, | 
| Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 368 | 		{ | 
 | 369 | 			.id	= ION_QSECOM_HEAP_ID, | 
 | 370 | 			.type	= ION_HEAP_TYPE_CARVEOUT, | 
 | 371 | 			.name	= ION_QSECOM_HEAP_NAME, | 
 | 372 | 			.size	= MSM_ION_QSECOM_SIZE, | 
 | 373 | 			.memory_type = ION_EBI_TYPE, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 374 | 			.extra_data = (void *) &co_apq8064_ion_pdata, | 
| Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 375 | 		}, | 
| Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 376 | 		{ | 
 | 377 | 			.id	= ION_AUDIO_HEAP_ID, | 
 | 378 | 			.type	= ION_HEAP_TYPE_CARVEOUT, | 
 | 379 | 			.name	= ION_AUDIO_HEAP_NAME, | 
 | 380 | 			.size	= MSM_ION_AUDIO_SIZE, | 
 | 381 | 			.memory_type = ION_EBI_TYPE, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 382 | 			.extra_data = (void *) &co_apq8064_ion_pdata, | 
| Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 383 | 		}, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 384 | #endif | 
 | 385 | 	} | 
 | 386 | }; | 
 | 387 |  | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 388 | static struct platform_device apq8064_ion_dev = { | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 389 | 	.name = "ion-msm", | 
 | 390 | 	.id = 1, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 391 | 	.dev = { .platform_data = &apq8064_ion_pdata }, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 392 | }; | 
 | 393 | #endif | 
 | 394 |  | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 395 | static struct platform_device apq8064_fmem_device = { | 
 | 396 | 	.name = "fmem", | 
 | 397 | 	.id = 1, | 
 | 398 | 	.dev = { .platform_data = &apq8064_fmem_pdata }, | 
 | 399 | }; | 
 | 400 |  | 
 | 401 | static void __init reserve_mem_for_ion(enum ion_memory_types mem_type, | 
 | 402 | 				      unsigned long size) | 
 | 403 | { | 
 | 404 | 	apq8064_reserve_table[mem_type].size += size; | 
 | 405 | } | 
 | 406 |  | 
 | 407 | static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size) | 
 | 408 | { | 
 | 409 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) | 
 | 410 | 	int ret; | 
 | 411 |  | 
 | 412 | 	if (fixed_area_size > MAX_FIXED_AREA_SIZE) | 
 | 413 | 		panic("fixed area size is larger than %dM\n", | 
 | 414 | 			MAX_FIXED_AREA_SIZE >> 20); | 
 | 415 |  | 
 | 416 | 	reserve_info->fixed_area_size = fixed_area_size; | 
 | 417 | 	reserve_info->fixed_area_start = APQ8064_FW_START; | 
 | 418 |  | 
 | 419 | 	ret = memblock_remove(reserve_info->fixed_area_start, | 
 | 420 | 		reserve_info->fixed_area_size); | 
 | 421 | 	BUG_ON(ret); | 
 | 422 | #endif | 
 | 423 | } | 
 | 424 |  | 
 | 425 | /** | 
 | 426 |  * Reserve memory for ION and calculate amount of reusable memory for fmem. | 
 | 427 |  * We only reserve memory for heaps that are not reusable. However, we only | 
 | 428 |  * support one reusable heap at the moment so we ignore the reusable flag for | 
 | 429 |  * other than the first heap with reusable flag set. Also handle special case | 
 | 430 |  * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be | 
 | 431 |  * at a higher address than FW in addition to not more than 256MB away from the | 
 | 432 |  * base address of the firmware. This means that if MM is reusable the other | 
 | 433 |  * two heaps must be allocated in the same region as FW. This is handled by the | 
 | 434 |  * mem_is_fmem flag in the platform data. In addition the MM heap must be | 
 | 435 |  * adjacent to the FW heap for content protection purposes. | 
 | 436 |  */ | 
| Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 437 | static void __init reserve_ion_memory(void) | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 438 | { | 
 | 439 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 440 | 	unsigned int i; | 
 | 441 | 	unsigned int reusable_count = 0; | 
 | 442 | 	unsigned int fixed_size = 0; | 
 | 443 | 	unsigned int fixed_low_size, fixed_middle_size, fixed_high_size; | 
 | 444 | 	unsigned long fixed_low_start, fixed_middle_start, fixed_high_start; | 
 | 445 |  | 
 | 446 | 	apq8064_fmem_pdata.size = 0; | 
 | 447 | 	apq8064_fmem_pdata.reserved_size_low = 0; | 
 | 448 | 	apq8064_fmem_pdata.reserved_size_high = 0; | 
| Olav Haugan | 6243625 | 2012-05-16 09:09:43 -0700 | [diff] [blame] | 449 | 	apq8064_fmem_pdata.align = PAGE_SIZE; | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 450 | 	fixed_low_size = 0; | 
 | 451 | 	fixed_middle_size = 0; | 
 | 452 | 	fixed_high_size = 0; | 
 | 453 |  | 
 | 454 | 	/* We only support 1 reusable heap. Check if more than one heap | 
 | 455 | 	 * is specified as reusable and set as non-reusable if found. | 
 | 456 | 	 */ | 
 | 457 | 	for (i = 0; i < apq8064_ion_pdata.nr; ++i) { | 
 | 458 | 		const struct ion_platform_heap *heap = | 
 | 459 | 			&(apq8064_ion_pdata.heaps[i]); | 
 | 460 |  | 
 | 461 | 		if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) { | 
 | 462 | 			struct ion_cp_heap_pdata *data = heap->extra_data; | 
 | 463 |  | 
 | 464 | 			reusable_count += (data->reusable) ? 1 : 0; | 
 | 465 |  | 
 | 466 | 			if (data->reusable && reusable_count > 1) { | 
 | 467 | 				pr_err("%s: Too many heaps specified as " | 
 | 468 | 					"reusable. Heap %s was not configured " | 
 | 469 | 					"as reusable.\n", __func__, heap->name); | 
 | 470 | 				data->reusable = 0; | 
 | 471 | 			} | 
 | 472 | 		} | 
 | 473 | 	} | 
 | 474 |  | 
 | 475 | 	for (i = 0; i < apq8064_ion_pdata.nr; ++i) { | 
 | 476 | 		const struct ion_platform_heap *heap = | 
 | 477 | 			&(apq8064_ion_pdata.heaps[i]); | 
 | 478 |  | 
 | 479 | 		if (heap->extra_data) { | 
 | 480 | 			int fixed_position = NOT_FIXED; | 
 | 481 | 			int mem_is_fmem = 0; | 
 | 482 |  | 
 | 483 | 			switch (heap->type) { | 
 | 484 | 			case ION_HEAP_TYPE_CP: | 
 | 485 | 				mem_is_fmem = ((struct ion_cp_heap_pdata *) | 
 | 486 | 					heap->extra_data)->mem_is_fmem; | 
 | 487 | 				fixed_position = ((struct ion_cp_heap_pdata *) | 
 | 488 | 					heap->extra_data)->fixed_position; | 
 | 489 | 				break; | 
 | 490 | 			case ION_HEAP_TYPE_CARVEOUT: | 
 | 491 | 				mem_is_fmem = ((struct ion_co_heap_pdata *) | 
 | 492 | 					heap->extra_data)->mem_is_fmem; | 
 | 493 | 				fixed_position = ((struct ion_co_heap_pdata *) | 
 | 494 | 					heap->extra_data)->fixed_position; | 
 | 495 | 				break; | 
 | 496 | 			default: | 
 | 497 | 				break; | 
 | 498 | 			} | 
 | 499 |  | 
 | 500 | 			if (fixed_position != NOT_FIXED) | 
 | 501 | 				fixed_size += heap->size; | 
 | 502 | 			else | 
 | 503 | 				reserve_mem_for_ion(MEMTYPE_EBI1, heap->size); | 
 | 504 |  | 
 | 505 | 			if (fixed_position == FIXED_LOW) | 
 | 506 | 				fixed_low_size += heap->size; | 
 | 507 | 			else if (fixed_position == FIXED_MIDDLE) | 
 | 508 | 				fixed_middle_size += heap->size; | 
 | 509 | 			else if (fixed_position == FIXED_HIGH) | 
 | 510 | 				fixed_high_size += heap->size; | 
 | 511 |  | 
 | 512 | 			if (mem_is_fmem) | 
 | 513 | 				apq8064_fmem_pdata.size += heap->size; | 
 | 514 | 		} | 
 | 515 | 	} | 
 | 516 |  | 
 | 517 | 	if (!fixed_size) | 
 | 518 | 		return; | 
 | 519 |  | 
 | 520 | 	if (apq8064_fmem_pdata.size) { | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 521 | 		apq8064_fmem_pdata.reserved_size_low = fixed_low_size + | 
 | 522 | 								HOLE_SIZE; | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 523 | 		apq8064_fmem_pdata.reserved_size_high = fixed_high_size; | 
 | 524 | 	} | 
 | 525 |  | 
 | 526 | 	/* Since the fixed area may be carved out of lowmem, | 
 | 527 | 	 * make sure the length is a multiple of 1M. | 
 | 528 | 	 */ | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 529 | 	fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1) | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 530 | 		& SECTION_MASK; | 
 | 531 | 	apq8064_reserve_fixed_area(fixed_size); | 
 | 532 |  | 
 | 533 | 	fixed_low_start = APQ8064_FIXED_AREA_START; | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 534 | 	fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE; | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 535 | 	fixed_high_start = fixed_middle_start + fixed_middle_size; | 
 | 536 |  | 
 | 537 | 	for (i = 0; i < apq8064_ion_pdata.nr; ++i) { | 
 | 538 | 		struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]); | 
 | 539 |  | 
 | 540 | 		if (heap->extra_data) { | 
 | 541 | 			int fixed_position = NOT_FIXED; | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 542 | 			struct ion_cp_heap_pdata *pdata = NULL; | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 543 |  | 
 | 544 | 			switch (heap->type) { | 
 | 545 | 			case ION_HEAP_TYPE_CP: | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 546 | 				pdata = | 
 | 547 | 				(struct ion_cp_heap_pdata *)heap->extra_data; | 
 | 548 | 				fixed_position = pdata->fixed_position; | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 549 | 				break; | 
 | 550 | 			case ION_HEAP_TYPE_CARVEOUT: | 
 | 551 | 				fixed_position = ((struct ion_co_heap_pdata *) | 
 | 552 | 					heap->extra_data)->fixed_position; | 
 | 553 | 				break; | 
 | 554 | 			default: | 
 | 555 | 				break; | 
 | 556 | 			} | 
 | 557 |  | 
 | 558 | 			switch (fixed_position) { | 
 | 559 | 			case FIXED_LOW: | 
 | 560 | 				heap->base = fixed_low_start; | 
 | 561 | 				break; | 
 | 562 | 			case FIXED_MIDDLE: | 
 | 563 | 				heap->base = fixed_middle_start; | 
| Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 564 | 				pdata->secure_base = fixed_middle_start | 
 | 565 | 								- HOLE_SIZE; | 
 | 566 | 				pdata->secure_size = HOLE_SIZE + heap->size; | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 567 | 				break; | 
 | 568 | 			case FIXED_HIGH: | 
 | 569 | 				heap->base = fixed_high_start; | 
 | 570 | 				break; | 
 | 571 | 			default: | 
 | 572 | 				break; | 
 | 573 | 			} | 
 | 574 | 		} | 
 | 575 | 	} | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 576 | #endif | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 577 | } | 
 | 578 |  | 
| Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 579 | static void __init reserve_mdp_memory(void) | 
 | 580 | { | 
 | 581 | 	apq8064_mdp_writeback(apq8064_reserve_table); | 
 | 582 | } | 
 | 583 |  | 
| Laura Abbott | 93a4a35 | 2012-05-25 09:26:35 -0700 | [diff] [blame] | 584 | static void __init reserve_cache_dump_memory(void) | 
 | 585 | { | 
 | 586 | #ifdef CONFIG_MSM_CACHE_DUMP | 
 | 587 | 	unsigned int total; | 
 | 588 |  | 
 | 589 | 	total = apq8064_cache_dump_pdata.l1_size + | 
 | 590 | 		apq8064_cache_dump_pdata.l2_size; | 
 | 591 | 	apq8064_reserve_table[MEMTYPE_EBI1].size += total; | 
 | 592 | #endif | 
 | 593 | } | 
 | 594 |  | 
| Abhijeet Dharmapurikar | 3edb5de | 2012-09-13 11:02:03 -0700 | [diff] [blame] | 595 | static void __init reserve_mpdcvs_memory(void) | 
 | 596 | { | 
 | 597 | 	apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K; | 
 | 598 | } | 
 | 599 |  | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 600 | static void __init apq8064_calculate_reserve_sizes(void) | 
 | 601 | { | 
 | 602 | 	size_pmem_devices(); | 
 | 603 | 	reserve_pmem_memory(); | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 604 | 	reserve_ion_memory(); | 
| Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 605 | 	reserve_mdp_memory(); | 
| Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 606 | 	reserve_rtb_memory(); | 
| Laura Abbott | 93a4a35 | 2012-05-25 09:26:35 -0700 | [diff] [blame] | 607 | 	reserve_cache_dump_memory(); | 
| Abhijeet Dharmapurikar | 3edb5de | 2012-09-13 11:02:03 -0700 | [diff] [blame] | 608 | 	reserve_mpdcvs_memory(); | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 609 | } | 
 | 610 |  | 
 | 611 | static struct reserve_info apq8064_reserve_info __initdata = { | 
 | 612 | 	.memtype_reserve_table = apq8064_reserve_table, | 
 | 613 | 	.calculate_reserve_sizes = apq8064_calculate_reserve_sizes, | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 614 | 	.reserve_fixed_area = apq8064_reserve_fixed_area, | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 615 | 	.paddr_to_memtype = apq8064_paddr_to_memtype, | 
 | 616 | }; | 
 | 617 |  | 
 | 618 | static int apq8064_memory_bank_size(void) | 
 | 619 | { | 
 | 620 | 	return 1<<29; | 
 | 621 | } | 
 | 622 |  | 
 | 623 | static void __init locate_unstable_memory(void) | 
 | 624 | { | 
 | 625 | 	struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; | 
 | 626 | 	unsigned long bank_size; | 
 | 627 | 	unsigned long low, high; | 
 | 628 |  | 
 | 629 | 	bank_size = apq8064_memory_bank_size(); | 
 | 630 | 	low = meminfo.bank[0].start; | 
 | 631 | 	high = mb->start + mb->size; | 
| Olav Haugan | d76e3a8 | 2012-01-16 16:55:07 -0800 | [diff] [blame] | 632 |  | 
 | 633 | 	/* Check if 32 bit overflow occured */ | 
 | 634 | 	if (high < mb->start) | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 635 | 		high = -PAGE_SIZE; | 
| Olav Haugan | d76e3a8 | 2012-01-16 16:55:07 -0800 | [diff] [blame] | 636 |  | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 637 | 	low &= ~(bank_size - 1); | 
 | 638 |  | 
 | 639 | 	if (high - low <= bank_size) | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 640 | 		goto no_dmm; | 
 | 641 |  | 
 | 642 | #ifdef CONFIG_ENABLE_DMM | 
| Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 643 | 	apq8064_reserve_info.low_unstable_address = mb->start - | 
 | 644 | 					MIN_MEMORY_BLOCK_SIZE + mb->size; | 
 | 645 | 	apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; | 
 | 646 |  | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 647 | 	apq8064_reserve_info.bank_size = bank_size; | 
 | 648 | 	pr_info("low unstable address %lx max size %lx bank size %lx\n", | 
 | 649 | 		apq8064_reserve_info.low_unstable_address, | 
 | 650 | 		apq8064_reserve_info.max_unstable_size, | 
 | 651 | 		apq8064_reserve_info.bank_size); | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 652 | 	return; | 
 | 653 | #endif | 
 | 654 | no_dmm: | 
 | 655 | 	apq8064_reserve_info.low_unstable_address = high; | 
 | 656 | 	apq8064_reserve_info.max_unstable_size = 0; | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 657 | } | 
 | 658 |  | 
| Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 659 | static int apq8064_change_memory_power(u64 start, u64 size, | 
 | 660 | 	int change_type) | 
 | 661 | { | 
 | 662 | 	return soc_change_memory_power(start, size, change_type); | 
 | 663 | } | 
 | 664 |  | 
| Aravind Venkateswaran | 8ac7f41 | 2012-03-16 17:57:30 -0700 | [diff] [blame] | 665 | static char prim_panel_name[PANEL_NAME_MAX_LEN]; | 
 | 666 | static char ext_panel_name[PANEL_NAME_MAX_LEN]; | 
| Ajay Singh Parmar | 6b82d2b | 2012-07-19 17:23:26 +0530 | [diff] [blame] | 667 |  | 
 | 668 | static int ext_resolution; | 
 | 669 |  | 
| Aravind Venkateswaran | 8ac7f41 | 2012-03-16 17:57:30 -0700 | [diff] [blame] | 670 | static int __init prim_display_setup(char *param) | 
 | 671 | { | 
 | 672 | 	if (strnlen(param, PANEL_NAME_MAX_LEN)) | 
 | 673 | 		strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN); | 
 | 674 | 	return 0; | 
 | 675 | } | 
 | 676 | early_param("prim_display", prim_display_setup); | 
 | 677 |  | 
 | 678 | static int __init ext_display_setup(char *param) | 
 | 679 | { | 
 | 680 | 	if (strnlen(param, PANEL_NAME_MAX_LEN)) | 
 | 681 | 		strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN); | 
 | 682 | 	return 0; | 
 | 683 | } | 
 | 684 | early_param("ext_display", ext_display_setup); | 
 | 685 |  | 
| Ajay Singh Parmar | 6b82d2b | 2012-07-19 17:23:26 +0530 | [diff] [blame] | 686 | static int __init hdmi_resulution_setup(char *param) | 
 | 687 | { | 
 | 688 | 	int ret; | 
 | 689 | 	ret = kstrtoint(param, 10, &ext_resolution); | 
 | 690 | 	return ret; | 
 | 691 | } | 
 | 692 | early_param("ext_resolution", hdmi_resulution_setup); | 
 | 693 |  | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 694 | static void __init apq8064_reserve(void) | 
 | 695 | { | 
| Ajay Singh Parmar | 6b82d2b | 2012-07-19 17:23:26 +0530 | [diff] [blame] | 696 | 	apq8064_set_display_params(prim_panel_name, ext_panel_name, | 
 | 697 | 		ext_resolution); | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 698 | 	msm_reserve(); | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 699 | 	if (apq8064_fmem_pdata.size) { | 
 | 700 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) | 
 | 701 | 		if (reserve_info->fixed_area_size) { | 
 | 702 | 			apq8064_fmem_pdata.phys = | 
 | 703 | 				reserve_info->fixed_area_start + MSM_MM_FW_SIZE; | 
 | 704 | 			pr_info("mm fw at %lx (fixed) size %x\n", | 
 | 705 | 				reserve_info->fixed_area_start, MSM_MM_FW_SIZE); | 
 | 706 | 			pr_info("fmem start %lx (fixed) size %lx\n", | 
 | 707 | 				apq8064_fmem_pdata.phys, | 
 | 708 | 				apq8064_fmem_pdata.size); | 
 | 709 | 		} | 
 | 710 | #endif | 
 | 711 | 	} | 
| Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 712 | } | 
 | 713 |  | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 714 | static void __init place_movable_zone(void) | 
 | 715 | { | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 716 | #ifdef CONFIG_ENABLE_DMM | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 717 | 	movable_reserved_start = apq8064_reserve_info.low_unstable_address; | 
 | 718 | 	movable_reserved_size = apq8064_reserve_info.max_unstable_size; | 
 | 719 | 	pr_info("movable zone start %lx size %lx\n", | 
 | 720 | 		movable_reserved_start, movable_reserved_size); | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 721 | #endif | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 722 | } | 
 | 723 |  | 
 | 724 | static void __init apq8064_early_reserve(void) | 
 | 725 | { | 
 | 726 | 	reserve_info = &apq8064_reserve_info; | 
 | 727 | 	locate_unstable_memory(); | 
 | 728 | 	place_movable_zone(); | 
 | 729 |  | 
 | 730 | } | 
| Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 731 | #ifdef CONFIG_USB_EHCI_MSM_HSIC | 
| Hemant Kumar | e627597 | 2012-02-29 20:06:21 -0800 | [diff] [blame] | 732 | /* Bandwidth requests (zero) if no vote placed */ | 
 | 733 | static struct msm_bus_vectors hsic_init_vectors[] = { | 
 | 734 | 	{ | 
 | 735 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 736 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 737 | 		.ab = 0, | 
 | 738 | 		.ib = 0, | 
 | 739 | 	}, | 
 | 740 | 	{ | 
 | 741 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 742 | 		.dst = MSM_BUS_SLAVE_SPS, | 
 | 743 | 		.ab = 0, | 
 | 744 | 		.ib = 0, | 
 | 745 | 	}, | 
 | 746 | }; | 
 | 747 |  | 
 | 748 | /* Bus bandwidth requests in Bytes/sec */ | 
 | 749 | static struct msm_bus_vectors hsic_max_vectors[] = { | 
 | 750 | 	{ | 
 | 751 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 752 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 753 | 		.ab = 60000000,		/* At least 480Mbps on bus. */ | 
 | 754 | 		.ib = 960000000,	/* MAX bursts rate */ | 
 | 755 | 	}, | 
 | 756 | 	{ | 
 | 757 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 758 | 		.dst = MSM_BUS_SLAVE_SPS, | 
 | 759 | 		.ab = 0, | 
 | 760 | 		.ib = 512000000, /*vote for 64Mhz dfab clk rate*/ | 
 | 761 | 	}, | 
 | 762 | }; | 
 | 763 |  | 
 | 764 | static struct msm_bus_paths hsic_bus_scale_usecases[] = { | 
 | 765 | 	{ | 
 | 766 | 		ARRAY_SIZE(hsic_init_vectors), | 
 | 767 | 		hsic_init_vectors, | 
 | 768 | 	}, | 
 | 769 | 	{ | 
 | 770 | 		ARRAY_SIZE(hsic_max_vectors), | 
 | 771 | 		hsic_max_vectors, | 
 | 772 | 	}, | 
 | 773 | }; | 
 | 774 |  | 
 | 775 | static struct msm_bus_scale_pdata hsic_bus_scale_pdata = { | 
 | 776 | 	hsic_bus_scale_usecases, | 
 | 777 | 	ARRAY_SIZE(hsic_bus_scale_usecases), | 
 | 778 | 	.name = "hsic", | 
 | 779 | }; | 
 | 780 |  | 
| Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 781 | static struct msm_hsic_host_platform_data msm_hsic_pdata = { | 
| Hemant Kumar | e627597 | 2012-02-29 20:06:21 -0800 | [diff] [blame] | 782 | 	.strobe			= 88, | 
 | 783 | 	.data			= 89, | 
 | 784 | 	.bus_scale_table	= &hsic_bus_scale_pdata, | 
| Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 785 | }; | 
 | 786 | #else | 
 | 787 | static struct msm_hsic_host_platform_data msm_hsic_pdata; | 
 | 788 | #endif | 
 | 789 |  | 
| Hemant Kumar | cb7d8a1 | 2012-01-25 12:25:55 -0800 | [diff] [blame] | 790 | #define PID_MAGIC_ID		0x71432909 | 
 | 791 | #define SERIAL_NUM_MAGIC_ID	0x61945374 | 
 | 792 | #define SERIAL_NUMBER_LENGTH	127 | 
 | 793 | #define DLOAD_USB_BASE_ADD	0x2A03F0C8 | 
 | 794 |  | 
 | 795 | struct magic_num_struct { | 
 | 796 | 	uint32_t pid; | 
 | 797 | 	uint32_t serial_num; | 
 | 798 | }; | 
 | 799 |  | 
 | 800 | struct dload_struct { | 
 | 801 | 	uint32_t	reserved1; | 
 | 802 | 	uint32_t	reserved2; | 
 | 803 | 	uint32_t	reserved3; | 
 | 804 | 	uint16_t	reserved4; | 
 | 805 | 	uint16_t	pid; | 
 | 806 | 	char		serial_number[SERIAL_NUMBER_LENGTH]; | 
 | 807 | 	uint16_t	reserved5; | 
 | 808 | 	struct magic_num_struct magic_struct; | 
 | 809 | }; | 
 | 810 |  | 
 | 811 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) | 
 | 812 | { | 
 | 813 | 	struct dload_struct __iomem *dload = 0; | 
 | 814 |  | 
 | 815 | 	dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); | 
 | 816 | 	if (!dload) { | 
 | 817 | 		pr_err("%s: cannot remap I/O memory region: %08x\n", | 
 | 818 | 					__func__, DLOAD_USB_BASE_ADD); | 
 | 819 | 		return -ENXIO; | 
 | 820 | 	} | 
 | 821 |  | 
 | 822 | 	pr_debug("%s: dload:%p pid:%x serial_num:%s\n", | 
 | 823 | 				__func__, dload, pid, snum); | 
 | 824 | 	/* update pid */ | 
 | 825 | 	dload->magic_struct.pid = PID_MAGIC_ID; | 
 | 826 | 	dload->pid = pid; | 
 | 827 |  | 
 | 828 | 	/* update serial number */ | 
 | 829 | 	dload->magic_struct.serial_num = 0; | 
 | 830 | 	if (!snum) { | 
 | 831 | 		memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); | 
 | 832 | 		goto out; | 
 | 833 | 	} | 
 | 834 |  | 
 | 835 | 	dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; | 
 | 836 | 	strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); | 
 | 837 | out: | 
 | 838 | 	iounmap(dload); | 
 | 839 | 	return 0; | 
 | 840 | } | 
 | 841 |  | 
 | 842 | static struct android_usb_platform_data android_usb_pdata = { | 
 | 843 | 	.update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, | 
 | 844 | }; | 
 | 845 |  | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 846 | static struct platform_device android_usb_device = { | 
| Hemant Kumar | cb7d8a1 | 2012-01-25 12:25:55 -0800 | [diff] [blame] | 847 | 	.name	= "android_usb", | 
 | 848 | 	.id	= -1, | 
 | 849 | 	.dev	= { | 
 | 850 | 		.platform_data = &android_usb_pdata, | 
 | 851 | 	}, | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 852 | }; | 
 | 853 |  | 
| Hemant Kumar | 7620eed | 2012-02-26 09:08:43 -0800 | [diff] [blame] | 854 | /* Bandwidth requests (zero) if no vote placed */ | 
 | 855 | static struct msm_bus_vectors usb_init_vectors[] = { | 
 | 856 | 	{ | 
 | 857 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 858 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 859 | 		.ab = 0, | 
 | 860 | 		.ib = 0, | 
 | 861 | 	}, | 
 | 862 | }; | 
 | 863 |  | 
 | 864 | /* Bus bandwidth requests in Bytes/sec */ | 
 | 865 | static struct msm_bus_vectors usb_max_vectors[] = { | 
 | 866 | 	{ | 
 | 867 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 868 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 869 | 		.ab = 60000000,		/* At least 480Mbps on bus. */ | 
 | 870 | 		.ib = 960000000,	/* MAX bursts rate */ | 
 | 871 | 	}, | 
 | 872 | }; | 
 | 873 |  | 
 | 874 | static struct msm_bus_paths usb_bus_scale_usecases[] = { | 
 | 875 | 	{ | 
 | 876 | 		ARRAY_SIZE(usb_init_vectors), | 
 | 877 | 		usb_init_vectors, | 
 | 878 | 	}, | 
 | 879 | 	{ | 
 | 880 | 		ARRAY_SIZE(usb_max_vectors), | 
 | 881 | 		usb_max_vectors, | 
 | 882 | 	}, | 
 | 883 | }; | 
 | 884 |  | 
 | 885 | static struct msm_bus_scale_pdata usb_bus_scale_pdata = { | 
 | 886 | 	usb_bus_scale_usecases, | 
 | 887 | 	ARRAY_SIZE(usb_bus_scale_usecases), | 
 | 888 | 	.name = "usb", | 
 | 889 | }; | 
 | 890 |  | 
| Vamsi Krishna | 1f8704c | 2012-03-29 18:24:24 -0700 | [diff] [blame] | 891 | static int phy_init_seq[] = { | 
 | 892 | 	0x38, 0x81, /* update DC voltage level */ | 
 | 893 | 	0x24, 0x82, /* set pre-emphasis and rise/fall time */ | 
 | 894 | 	-1 | 
 | 895 | }; | 
 | 896 |  | 
| Vijayavardhan Vennapusa | 4fa1369 | 2012-08-02 14:35:03 +0530 | [diff] [blame] | 897 | #define PMIC_GPIO_DP		27    /* PMIC GPIO for D+ change */ | 
 | 898 | #define PMIC_GPIO_DP_IRQ	PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP) | 
| Jack Pham | 87f202f | 2012-08-06 00:24:22 -0700 | [diff] [blame] | 899 | #define MSM_MPM_PIN_USB1_OTGSESSVLD	40 | 
 | 900 |  | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 901 | static struct msm_otg_platform_data msm_otg_pdata = { | 
| Hemant Kumar | d86c488 | 2012-01-24 19:39:37 -0800 | [diff] [blame] | 902 | 	.mode			= USB_OTG, | 
 | 903 | 	.otg_control		= OTG_PMIC_CONTROL, | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 904 | 	.phy_type		= SNPS_28NM_INTEGRATED_PHY, | 
| Hemant Kumar | d86c488 | 2012-01-24 19:39:37 -0800 | [diff] [blame] | 905 | 	.pmic_id_irq		= PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), | 
 | 906 | 	.power_budget		= 750, | 
| Hemant Kumar | 7620eed | 2012-02-26 09:08:43 -0800 | [diff] [blame] | 907 | 	.bus_scale_table	= &usb_bus_scale_pdata, | 
| Vamsi Krishna | 1f8704c | 2012-03-29 18:24:24 -0700 | [diff] [blame] | 908 | 	.phy_init_seq		= phy_init_seq, | 
| Jack Pham | 87f202f | 2012-08-06 00:24:22 -0700 | [diff] [blame] | 909 | 	.mpm_otgsessvld_int	= MSM_MPM_PIN_USB1_OTGSESSVLD, | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 910 | }; | 
 | 911 |  | 
| Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 912 | static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = { | 
| Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 913 | 	.power_budget = 500, | 
 | 914 | }; | 
 | 915 |  | 
| Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 916 | #ifdef CONFIG_USB_EHCI_MSM_HOST4 | 
 | 917 | static struct msm_usb_host_platform_data msm_ehci_host_pdata4; | 
 | 918 | #endif | 
 | 919 |  | 
| Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 920 | static void __init apq8064_ehci_host_init(void) | 
 | 921 | { | 
| Chiranjeevi Velempati | b822fa3 | 2012-05-23 22:05:59 +0530 | [diff] [blame] | 922 | 	if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() || | 
 | 923 | 		machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { | 
 | 924 | 		if (machine_is_apq8064_liquid()) | 
 | 925 | 			msm_ehci_host_pdata3.dock_connect_irq = | 
 | 926 | 					PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9); | 
| Vijayavardhan Vennapusa | 4fa1369 | 2012-08-02 14:35:03 +0530 | [diff] [blame] | 927 | 		else | 
 | 928 | 			msm_ehci_host_pdata3.pmic_gpio_dp_irq = | 
 | 929 | 							PMIC_GPIO_DP_IRQ; | 
| Hemant Kumar | 5692535 | 2012-02-13 16:59:52 -0800 | [diff] [blame] | 930 |  | 
| Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 931 | 		apq8064_device_ehci_host3.dev.platform_data = | 
| Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 932 | 				&msm_ehci_host_pdata3; | 
| Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 933 | 		platform_device_register(&apq8064_device_ehci_host3); | 
| Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 934 |  | 
 | 935 | #ifdef CONFIG_USB_EHCI_MSM_HOST4 | 
 | 936 | 		apq8064_device_ehci_host4.dev.platform_data = | 
 | 937 | 				&msm_ehci_host_pdata4; | 
 | 938 | 		platform_device_register(&apq8064_device_ehci_host4); | 
 | 939 | #endif | 
| Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 940 | 	} | 
 | 941 | } | 
 | 942 |  | 
| David Keitel | 2f613d9 | 2012-02-15 11:29:16 -0800 | [diff] [blame] | 943 | static struct smb349_platform_data smb349_data __initdata = { | 
 | 944 | 	.en_n_gpio		= PM8921_GPIO_PM_TO_SYS(37), | 
 | 945 | 	.chg_susp_gpio		= PM8921_GPIO_PM_TO_SYS(30), | 
 | 946 | 	.chg_current_ma		= 2200, | 
 | 947 | }; | 
 | 948 |  | 
 | 949 | static struct i2c_board_info smb349_charger_i2c_info[] __initdata = { | 
 | 950 | 	{ | 
 | 951 | 		I2C_BOARD_INFO(SMB349_NAME, 0x1B), | 
 | 952 | 		.platform_data	= &smb349_data, | 
 | 953 | 	}, | 
 | 954 | }; | 
 | 955 |  | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 956 | struct sx150x_platform_data apq8064_sx150x_data[] = { | 
 | 957 | 	[SX150X_EPM] = { | 
 | 958 | 		.gpio_base	= GPIO_EPM_EXPANDER_BASE, | 
 | 959 | 		.oscio_is_gpo	= false, | 
 | 960 | 		.io_pullup_ena	= 0x0, | 
 | 961 | 		.io_pulldn_ena	= 0x0, | 
 | 962 | 		.io_open_drain_ena = 0x0, | 
 | 963 | 		.io_polarity	= 0, | 
 | 964 | 		.irq_summary	= -1, | 
 | 965 | 	}, | 
 | 966 | }; | 
 | 967 |  | 
 | 968 | static struct epm_chan_properties ads_adc_channel_data[] = { | 
| Yan He | c942e40 | 2012-08-31 11:14:58 -0700 | [diff] [blame] | 969 | 	{10, 100}, {1000, 1}, {10, 100}, {1000, 1}, | 
 | 970 | 	{10, 100}, {1000, 1}, {10, 100}, {1000, 1}, | 
 | 971 | 	{10, 100}, {20, 100}, {500, 100}, {5, 100}, | 
 | 972 | 	{1000, 1}, {200, 100}, {50, 100}, {10, 100}, | 
 | 973 | 	{510, 100}, {50, 100}, {20, 100}, {100, 100}, | 
 | 974 | 	{510, 100}, {20, 100}, {50, 100}, {200, 100}, | 
 | 975 | 	{10, 100}, {20, 100}, {1000, 1}, {10, 100}, | 
 | 976 | 	{200, 100}, {510, 100}, {1000, 100}, {200, 100}, | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 977 | }; | 
 | 978 |  | 
 | 979 | static struct epm_adc_platform_data epm_adc_pdata = { | 
 | 980 | 	.channel		= ads_adc_channel_data, | 
 | 981 | 	.bus_id	= 0x0, | 
 | 982 | 	.epm_i2c_board_info = { | 
 | 983 | 		.type	= "sx1509q", | 
 | 984 | 		.addr = 0x3e, | 
 | 985 | 		.platform_data = &apq8064_sx150x_data[SX150X_EPM], | 
 | 986 | 	}, | 
 | 987 | 	.gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE, | 
 | 988 | }; | 
 | 989 |  | 
 | 990 | static struct platform_device epm_adc_device = { | 
 | 991 | 	.name   = "epm_adc", | 
 | 992 | 	.id = -1, | 
 | 993 | 	.dev = { | 
 | 994 | 		.platform_data = &epm_adc_pdata, | 
 | 995 | 	}, | 
 | 996 | }; | 
 | 997 |  | 
 | 998 | static void __init apq8064_epm_adc_init(void) | 
 | 999 | { | 
 | 1000 | 	epm_adc_pdata.num_channels = 32; | 
 | 1001 | 	epm_adc_pdata.num_adc = 2; | 
 | 1002 | 	epm_adc_pdata.chan_per_adc = 16; | 
 | 1003 | 	epm_adc_pdata.chan_per_mux = 8; | 
 | 1004 | }; | 
 | 1005 |  | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1006 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement | 
 | 1007 |  * 4 micbiases are used to power various analog and digital | 
 | 1008 |  * microphones operating at 1800 mV. Technically, all micbiases | 
 | 1009 |  * can source from single cfilter since all microphones operate | 
 | 1010 |  * at the same voltage level. The arrangement below is to make | 
 | 1011 |  * sure all cfilters are exercised. LDO_H regulator ouput level | 
 | 1012 |  * does not need to be as high as 2.85V. It is choosen for | 
 | 1013 |  * microphone sensitivity purpose. | 
 | 1014 |  */ | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1015 | static struct wcd9xxx_pdata apq8064_tabla_platform_data = { | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1016 | 	.slimbus_slave_device = { | 
 | 1017 | 		.name = "tabla-slave", | 
 | 1018 | 		.e_addr = {0, 0, 0x10, 0, 0x17, 2}, | 
 | 1019 | 	}, | 
| Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1020 | 	.irq = MSM_GPIO_TO_INT(42), | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1021 | 	.irq_base = TABLA_INTERRUPT_BASE, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1022 | 	.num_irqs = NR_WCD9XXX_IRQS, | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1023 | 	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34), | 
 | 1024 | 	.micbias = { | 
 | 1025 | 		.ldoh_v = TABLA_LDOH_2P85_V, | 
 | 1026 | 		.cfilt1_mv = 1800, | 
| Bhalchandra Gajare | 975c53a | 2012-08-10 12:16:49 -0700 | [diff] [blame] | 1027 | 		.cfilt2_mv = 2700, | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1028 | 		.cfilt3_mv = 1800, | 
 | 1029 | 		.bias1_cfilt_sel = TABLA_CFILT1_SEL, | 
 | 1030 | 		.bias2_cfilt_sel = TABLA_CFILT2_SEL, | 
 | 1031 | 		.bias3_cfilt_sel = TABLA_CFILT3_SEL, | 
 | 1032 | 		.bias4_cfilt_sel = TABLA_CFILT3_SEL, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1033 | 	}, | 
 | 1034 | 	.regulator = { | 
 | 1035 | 	{ | 
 | 1036 | 		.name = "CDC_VDD_CP", | 
 | 1037 | 		.min_uV = 1800000, | 
 | 1038 | 		.max_uV = 1800000, | 
 | 1039 | 		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, | 
 | 1040 | 	}, | 
 | 1041 | 	{ | 
 | 1042 | 		.name = "CDC_VDDA_RX", | 
 | 1043 | 		.min_uV = 1800000, | 
 | 1044 | 		.max_uV = 1800000, | 
 | 1045 | 		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, | 
 | 1046 | 	}, | 
 | 1047 | 	{ | 
 | 1048 | 		.name = "CDC_VDDA_TX", | 
 | 1049 | 		.min_uV = 1800000, | 
 | 1050 | 		.max_uV = 1800000, | 
 | 1051 | 		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, | 
 | 1052 | 	}, | 
 | 1053 | 	{ | 
 | 1054 | 		.name = "VDDIO_CDC", | 
 | 1055 | 		.min_uV = 1800000, | 
 | 1056 | 		.max_uV = 1800000, | 
 | 1057 | 		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, | 
 | 1058 | 	}, | 
 | 1059 | 	{ | 
 | 1060 | 		.name = "VDDD_CDC_D", | 
 | 1061 | 		.min_uV = 1225000, | 
| David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1062 | 		.max_uV = 1250000, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1063 | 		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, | 
 | 1064 | 	}, | 
 | 1065 | 	{ | 
 | 1066 | 		.name = "CDC_VDDA_A_1P2V", | 
 | 1067 | 		.min_uV = 1225000, | 
| David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1068 | 		.max_uV = 1250000, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1069 | 		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, | 
 | 1070 | 	}, | 
 | 1071 | 	}, | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1072 | }; | 
 | 1073 |  | 
 | 1074 | static struct slim_device apq8064_slim_tabla = { | 
 | 1075 | 	.name = "tabla-slim", | 
 | 1076 | 	.e_addr = {0, 1, 0x10, 0, 0x17, 2}, | 
 | 1077 | 	.dev = { | 
 | 1078 | 		.platform_data = &apq8064_tabla_platform_data, | 
 | 1079 | 	}, | 
 | 1080 | }; | 
 | 1081 |  | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1082 | static struct wcd9xxx_pdata apq8064_tabla20_platform_data = { | 
| Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1083 | 	.slimbus_slave_device = { | 
 | 1084 | 		.name = "tabla-slave", | 
 | 1085 | 		.e_addr = {0, 0, 0x60, 0, 0x17, 2}, | 
 | 1086 | 	}, | 
 | 1087 | 	.irq = MSM_GPIO_TO_INT(42), | 
 | 1088 | 	.irq_base = TABLA_INTERRUPT_BASE, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1089 | 	.num_irqs = NR_WCD9XXX_IRQS, | 
| Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1090 | 	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34), | 
 | 1091 | 	.micbias = { | 
 | 1092 | 		.ldoh_v = TABLA_LDOH_2P85_V, | 
 | 1093 | 		.cfilt1_mv = 1800, | 
| Bhalchandra Gajare | 975c53a | 2012-08-10 12:16:49 -0700 | [diff] [blame] | 1094 | 		.cfilt2_mv = 2700, | 
| Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1095 | 		.cfilt3_mv = 1800, | 
 | 1096 | 		.bias1_cfilt_sel = TABLA_CFILT1_SEL, | 
 | 1097 | 		.bias2_cfilt_sel = TABLA_CFILT2_SEL, | 
 | 1098 | 		.bias3_cfilt_sel = TABLA_CFILT3_SEL, | 
 | 1099 | 		.bias4_cfilt_sel = TABLA_CFILT3_SEL, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1100 | 	}, | 
 | 1101 | 	.regulator = { | 
 | 1102 | 	{ | 
 | 1103 | 		.name = "CDC_VDD_CP", | 
 | 1104 | 		.min_uV = 1800000, | 
 | 1105 | 		.max_uV = 1800000, | 
 | 1106 | 		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, | 
 | 1107 | 	}, | 
 | 1108 | 	{ | 
 | 1109 | 		.name = "CDC_VDDA_RX", | 
 | 1110 | 		.min_uV = 1800000, | 
 | 1111 | 		.max_uV = 1800000, | 
 | 1112 | 		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, | 
 | 1113 | 	}, | 
 | 1114 | 	{ | 
 | 1115 | 		.name = "CDC_VDDA_TX", | 
 | 1116 | 		.min_uV = 1800000, | 
 | 1117 | 		.max_uV = 1800000, | 
 | 1118 | 		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, | 
 | 1119 | 	}, | 
 | 1120 | 	{ | 
 | 1121 | 		.name = "VDDIO_CDC", | 
 | 1122 | 		.min_uV = 1800000, | 
 | 1123 | 		.max_uV = 1800000, | 
 | 1124 | 		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, | 
 | 1125 | 	}, | 
 | 1126 | 	{ | 
 | 1127 | 		.name = "VDDD_CDC_D", | 
 | 1128 | 		.min_uV = 1225000, | 
| David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1129 | 		.max_uV = 1250000, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1130 | 		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, | 
 | 1131 | 	}, | 
 | 1132 | 	{ | 
 | 1133 | 		.name = "CDC_VDDA_A_1P2V", | 
 | 1134 | 		.min_uV = 1225000, | 
| David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1135 | 		.max_uV = 1250000, | 
| Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1136 | 		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, | 
 | 1137 | 	}, | 
 | 1138 | 	}, | 
| Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1139 | }; | 
 | 1140 |  | 
 | 1141 | static struct slim_device apq8064_slim_tabla20 = { | 
 | 1142 | 	.name = "tabla2x-slim", | 
 | 1143 | 	.e_addr = {0, 1, 0x60, 0, 0x17, 2}, | 
 | 1144 | 	.dev = { | 
 | 1145 | 		.platform_data = &apq8064_tabla20_platform_data, | 
 | 1146 | 	}, | 
 | 1147 | }; | 
 | 1148 |  | 
| Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1149 | /* enable the level shifter for cs8427 to make sure the I2C | 
 | 1150 |  * clock is running at 100KHz and voltage levels are at 3.3 | 
 | 1151 |  * and 5 volts | 
 | 1152 |  */ | 
 | 1153 | static int enable_100KHz_ls(int enable) | 
 | 1154 | { | 
 | 1155 | 	int ret = 0; | 
 | 1156 | 	if (enable) { | 
 | 1157 | 		ret = gpio_request(SX150X_GPIO(1, 10), | 
 | 1158 | 					"cs8427_100KHZ_ENABLE"); | 
 | 1159 | 		if (ret) { | 
 | 1160 | 			pr_err("%s: Failed to request gpio %d\n", __func__, | 
 | 1161 | 				SX150X_GPIO(1, 10)); | 
 | 1162 | 			return ret; | 
 | 1163 | 		} | 
 | 1164 | 		gpio_direction_output(SX150X_GPIO(1, 10), 1); | 
| Santosh Mardi | d706fcf | 2012-08-31 19:26:54 +0530 | [diff] [blame] | 1165 | 	} else { | 
 | 1166 | 		gpio_direction_output(SX150X_GPIO(1, 10), 0); | 
| Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1167 | 		gpio_free(SX150X_GPIO(1, 10)); | 
| Santosh Mardi | d706fcf | 2012-08-31 19:26:54 +0530 | [diff] [blame] | 1168 | 	} | 
| Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1169 | 	return ret; | 
 | 1170 | } | 
 | 1171 |  | 
| Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 1172 | static struct cs8427_platform_data cs8427_i2c_platform_data = { | 
 | 1173 | 	.irq = SX150X_GPIO(1, 4), | 
 | 1174 | 	.reset_gpio = SX150X_GPIO(1, 6), | 
| Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1175 | 	.enable = enable_100KHz_ls, | 
| Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 1176 | }; | 
 | 1177 |  | 
 | 1178 | static struct i2c_board_info cs8427_device_info[] __initdata = { | 
 | 1179 | 	{ | 
 | 1180 | 		I2C_BOARD_INFO("cs8427", CS8427_ADDR4), | 
 | 1181 | 		.platform_data = &cs8427_i2c_platform_data, | 
 | 1182 | 	}, | 
 | 1183 | }; | 
 | 1184 |  | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1185 | #define HAP_SHIFT_LVL_OE_GPIO		PM8921_MPP_PM_TO_SYS(8) | 
 | 1186 | #define ISA1200_HAP_EN_GPIO		PM8921_GPIO_PM_TO_SYS(33) | 
 | 1187 | #define ISA1200_HAP_LEN_GPIO		PM8921_GPIO_PM_TO_SYS(20) | 
 | 1188 | #define ISA1200_HAP_CLK			PM8921_GPIO_PM_TO_SYS(44) | 
 | 1189 |  | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1190 | static int isa1200_clk_enable(bool on) | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1191 | { | 
| Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1192 | 	int rc = 0; | 
 | 1193 |  | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1194 | 	gpio_set_value_cansleep(ISA1200_HAP_CLK, on); | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1195 |  | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1196 | 	if (on) { | 
| Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1197 | 		rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true); | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1198 | 		if (rc) { | 
 | 1199 | 			pr_err("%s: unable to write aux clock register(%d)\n", | 
 | 1200 | 				__func__, rc); | 
 | 1201 | 			goto err_gpio_dis; | 
 | 1202 | 		} | 
 | 1203 | 	} else { | 
| Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1204 | 		rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true); | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1205 | 		if (rc) | 
 | 1206 | 			pr_err("%s: unable to write aux clock register(%d)\n", | 
 | 1207 | 				__func__, rc); | 
| Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1208 | 	} | 
 | 1209 |  | 
 | 1210 | 	return rc; | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1211 |  | 
 | 1212 | err_gpio_dis: | 
 | 1213 | 	gpio_set_value_cansleep(ISA1200_HAP_CLK, !on); | 
 | 1214 | 	return rc; | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1215 | } | 
 | 1216 |  | 
 | 1217 | static int isa1200_dev_setup(bool enable) | 
 | 1218 | { | 
 | 1219 | 	int rc = 0; | 
 | 1220 |  | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1221 | 	if (!enable) | 
 | 1222 | 		goto free_gpio; | 
 | 1223 |  | 
 | 1224 | 	rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk"); | 
 | 1225 | 	if (rc) { | 
 | 1226 | 		pr_err("%s: unable to request gpio %d config(%d)\n", | 
 | 1227 | 			__func__, ISA1200_HAP_CLK, rc); | 
 | 1228 | 		return rc; | 
 | 1229 | 	} | 
 | 1230 |  | 
 | 1231 | 	rc = gpio_direction_output(ISA1200_HAP_CLK, 0); | 
 | 1232 | 	if (rc) { | 
 | 1233 | 		pr_err("%s: unable to set direction\n", __func__); | 
 | 1234 | 		goto free_gpio; | 
 | 1235 | 	} | 
 | 1236 |  | 
 | 1237 | 	return 0; | 
 | 1238 |  | 
 | 1239 | free_gpio: | 
 | 1240 | 	gpio_free(ISA1200_HAP_CLK); | 
 | 1241 | 	return rc; | 
 | 1242 | } | 
 | 1243 |  | 
 | 1244 | static struct isa1200_regulator isa1200_reg_data[] = { | 
 | 1245 | 	{ | 
 | 1246 | 		.name = "vddp", | 
 | 1247 | 		.min_uV = ISA_I2C_VTG_MIN_UV, | 
 | 1248 | 		.max_uV = ISA_I2C_VTG_MAX_UV, | 
 | 1249 | 		.load_uA = ISA_I2C_CURR_UA, | 
 | 1250 | 	}, | 
 | 1251 | }; | 
 | 1252 |  | 
 | 1253 | static struct isa1200_platform_data isa1200_1_pdata = { | 
 | 1254 | 	.name = "vibrator", | 
 | 1255 | 	.dev_setup = isa1200_dev_setup, | 
| Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1256 | 	.clk_enable = isa1200_clk_enable, | 
| Mohan Pallaka | 32f20a7 | 2012-06-14 14:41:11 +0530 | [diff] [blame] | 1257 | 	.need_pwm_clk = true, | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1258 | 	.hap_en_gpio = ISA1200_HAP_EN_GPIO, | 
 | 1259 | 	.hap_len_gpio = ISA1200_HAP_LEN_GPIO, | 
 | 1260 | 	.max_timeout = 15000, | 
 | 1261 | 	.mode_ctrl = PWM_GEN_MODE, | 
 | 1262 | 	.pwm_fd = { | 
 | 1263 | 		.pwm_div = 256, | 
 | 1264 | 	}, | 
 | 1265 | 	.is_erm = false, | 
 | 1266 | 	.smart_en = true, | 
 | 1267 | 	.ext_clk_en = true, | 
 | 1268 | 	.chip_en = 1, | 
 | 1269 | 	.regulator_info = isa1200_reg_data, | 
 | 1270 | 	.num_regulators = ARRAY_SIZE(isa1200_reg_data), | 
 | 1271 | }; | 
 | 1272 |  | 
 | 1273 | static struct i2c_board_info isa1200_board_info[] __initdata = { | 
 | 1274 | 	{ | 
 | 1275 | 		I2C_BOARD_INFO("isa1200_1", 0x90>>1), | 
 | 1276 | 		.platform_data = &isa1200_1_pdata, | 
 | 1277 | 	}, | 
 | 1278 | }; | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1279 | /* configuration data for mxt1386e using V2.1 firmware */ | 
 | 1280 | static const u8 mxt1386e_config_data_v2_1[] = { | 
 | 1281 | 	/* T6 Object */ | 
 | 1282 | 	0, 0, 0, 0, 0, 0, | 
 | 1283 | 	/* T38 Object */ | 
| Jing Lin | e4c4704 | 2012-08-31 10:54:44 -0700 | [diff] [blame^] | 1284 | 	14, 3, 0, 5, 7, 12, 0, 0, 0, 0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1285 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1286 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1287 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1288 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1289 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1290 | 	0, 0, 0, 0, | 
 | 1291 | 	/* T7 Object */ | 
| Jing Lin | e4c4704 | 2012-08-31 10:54:44 -0700 | [diff] [blame^] | 1292 | 	32, 10, 50, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1293 | 	/* T8 Object */ | 
| Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1294 | 	25, 0, 20, 20, 0, 0, 0, 0, 0, 0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1295 | 	/* T9 Object */ | 
| Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1296 | 	139, 0, 0, 26, 42, 0, 32, 80, 2, 5, | 
| Jing Lin | e4c4704 | 2012-08-31 10:54:44 -0700 | [diff] [blame^] | 1297 | 	0, 5, 5, 79, 10, 30, 10, 10, 255, 2, | 
| Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1298 | 	85, 5, 0, 5, 9, 5, 12, 35, 70, 40, | 
 | 1299 | 	20, 5, 0, 0, 0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1300 | 	/* T18 Object */ | 
 | 1301 | 	0, 0, | 
 | 1302 | 	/* T24 Object */ | 
 | 1303 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1304 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1305 | 	/* T25 Object */ | 
| Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1306 | 	1, 0, 60, 115, 156, 99, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1307 | 	/* T27 Object */ | 
 | 1308 | 	0, 0, 0, 0, 0, 0, 0, | 
 | 1309 | 	/* T40 Object */ | 
 | 1310 | 	0, 0, 0, 0, 0, | 
 | 1311 | 	/* T42 Object */ | 
| Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1312 | 	0, 0, 255, 0, 255, 0, 0, 0, 0, 0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1313 | 	/* T43 Object */ | 
 | 1314 | 	0, 0, 0, 0, 0, 0, 0, 64, 0, 8, | 
 | 1315 | 	16, | 
 | 1316 | 	/* T46 Object */ | 
| Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1317 | 	68, 0, 16, 16, 0, 0, 0, 0, 0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1318 | 	/* T47 Object */ | 
 | 1319 | 	0, 0, 0, 0, 0, 0, 3, 64, 66, 0, | 
 | 1320 | 	/* T48 Object */ | 
| Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1321 | 	1, 64, 64, 0, 0, 0, 0, 0, 0, 0, | 
| Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1322 | 	32, 40, 0, 10, 10, 0, 0, 100, 10, 90, | 
 | 1323 | 	0, 0, 0, 0, 0, 0, 0, 10, 1, 10, | 
 | 1324 | 	52, 10, 12, 0, 33, 0, 1, 0, 0, 0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1325 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1326 | 	0, 0, 0, 0, | 
 | 1327 | 	/* T56 Object */ | 
 | 1328 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1329 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1330 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1331 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
| Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1332 | 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
 | 1333 | 	0, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1334 | }; | 
 | 1335 |  | 
 | 1336 | #define MXT_TS_GPIO_IRQ			6 | 
 | 1337 | #define MXT_TS_PWR_EN_GPIO		PM8921_GPIO_PM_TO_SYS(23) | 
 | 1338 | #define MXT_TS_RESET_GPIO		33 | 
 | 1339 |  | 
 | 1340 | static struct mxt_config_info mxt_config_array[] = { | 
 | 1341 | 	{ | 
 | 1342 | 		.config		= mxt1386e_config_data_v2_1, | 
 | 1343 | 		.config_length	= ARRAY_SIZE(mxt1386e_config_data_v2_1), | 
 | 1344 | 		.family_id	= 0xA0, | 
 | 1345 | 		.variant_id	= 0x7, | 
 | 1346 | 		.version	= 0x21, | 
 | 1347 | 		.build		= 0xAA, | 
| Jing Lin | ef4aa9b | 2012-03-26 12:01:41 -0700 | [diff] [blame] | 1348 | 		.bootldr_id	= MXT_BOOTLOADER_ID_1386E, | 
 | 1349 | 		.fw_name	= "atmel_8064_liquid_v2_2_AA.hex", | 
 | 1350 | 	}, | 
 | 1351 | 	{ | 
 | 1352 | 		/* The config data for V2.2.AA is the same as for V2.1.AA */ | 
 | 1353 | 		.config		= mxt1386e_config_data_v2_1, | 
 | 1354 | 		.config_length	= ARRAY_SIZE(mxt1386e_config_data_v2_1), | 
 | 1355 | 		.family_id	= 0xA0, | 
 | 1356 | 		.variant_id	= 0x7, | 
 | 1357 | 		.version	= 0x22, | 
 | 1358 | 		.build		= 0xAA, | 
 | 1359 | 		.bootldr_id	= MXT_BOOTLOADER_ID_1386E, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1360 | 	}, | 
 | 1361 | }; | 
 | 1362 |  | 
 | 1363 | static struct mxt_platform_data mxt_platform_data = { | 
 | 1364 | 	.config_array		= mxt_config_array, | 
 | 1365 | 	.config_array_size	= ARRAY_SIZE(mxt_config_array), | 
| Mohan Pallaka | 56a1a5d | 2012-02-23 12:05:13 -0800 | [diff] [blame] | 1366 | 	.panel_minx		= 0, | 
 | 1367 | 	.panel_maxx		= 1365, | 
 | 1368 | 	.panel_miny		= 0, | 
 | 1369 | 	.panel_maxy		= 767, | 
 | 1370 | 	.disp_minx		= 0, | 
 | 1371 | 	.disp_maxx		= 1365, | 
 | 1372 | 	.disp_miny		= 0, | 
 | 1373 | 	.disp_maxy		= 767, | 
| Anirudh Ghayal | 39dbe3f | 2012-04-13 15:43:16 +0530 | [diff] [blame] | 1374 | 	.irqflags		= IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1375 | 	.i2c_pull_up		= true, | 
 | 1376 | 	.reset_gpio		= MXT_TS_RESET_GPIO, | 
 | 1377 | 	.irq_gpio		= MXT_TS_GPIO_IRQ, | 
 | 1378 | }; | 
 | 1379 |  | 
 | 1380 | static struct i2c_board_info mxt_device_info[] __initdata = { | 
 | 1381 | 	{ | 
 | 1382 | 		I2C_BOARD_INFO("atmel_mxt_ts", 0x5b), | 
 | 1383 | 		.platform_data = &mxt_platform_data, | 
 | 1384 | 		.irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), | 
 | 1385 | 	}, | 
 | 1386 | }; | 
| Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1387 | #define CYTTSP_TS_GPIO_IRQ		6 | 
| Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1388 | #define CYTTSP_TS_GPIO_SLEEP		33 | 
| Amy Maloche | 609bb5e | 2012-08-03 09:41:42 -0700 | [diff] [blame] | 1389 | #define CYTTSP_TS_GPIO_SLEEP_ALT	12 | 
| Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1390 |  | 
 | 1391 | static ssize_t tma340_vkeys_show(struct kobject *kobj, | 
 | 1392 | 			struct kobj_attribute *attr, char *buf) | 
 | 1393 | { | 
 | 1394 | 	return snprintf(buf, 200, | 
 | 1395 | 	__stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97" | 
 | 1396 | 	":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97" | 
 | 1397 | 	":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97" | 
 | 1398 | 	":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97" | 
 | 1399 | 	"\n"); | 
 | 1400 | } | 
 | 1401 |  | 
 | 1402 | static struct kobj_attribute tma340_vkeys_attr = { | 
 | 1403 | 	.attr = { | 
 | 1404 | 		.mode = S_IRUGO, | 
 | 1405 | 	}, | 
 | 1406 | 	.show = &tma340_vkeys_show, | 
 | 1407 | }; | 
 | 1408 |  | 
 | 1409 | static struct attribute *tma340_properties_attrs[] = { | 
 | 1410 | 	&tma340_vkeys_attr.attr, | 
 | 1411 | 	NULL | 
 | 1412 | }; | 
 | 1413 |  | 
 | 1414 | static struct attribute_group tma340_properties_attr_group = { | 
 | 1415 | 	.attrs = tma340_properties_attrs, | 
 | 1416 | }; | 
 | 1417 |  | 
 | 1418 | static int cyttsp_platform_init(struct i2c_client *client) | 
 | 1419 | { | 
 | 1420 | 	int rc = 0; | 
 | 1421 | 	static struct kobject *tma340_properties_kobj; | 
 | 1422 |  | 
 | 1423 | 	tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c"; | 
 | 1424 | 	tma340_properties_kobj = kobject_create_and_add("board_properties", | 
 | 1425 | 								NULL); | 
 | 1426 | 	if (tma340_properties_kobj) | 
 | 1427 | 		rc = sysfs_create_group(tma340_properties_kobj, | 
 | 1428 | 					&tma340_properties_attr_group); | 
 | 1429 | 	if (!tma340_properties_kobj || rc) | 
 | 1430 | 		pr_err("%s: failed to create board_properties\n", | 
 | 1431 | 				__func__); | 
 | 1432 |  | 
 | 1433 | 	return 0; | 
 | 1434 | } | 
 | 1435 |  | 
 | 1436 | static struct cyttsp_regulator cyttsp_regulator_data[] = { | 
 | 1437 | 	{ | 
 | 1438 | 		.name = "vdd", | 
 | 1439 | 		.min_uV = CY_TMA300_VTG_MIN_UV, | 
 | 1440 | 		.max_uV = CY_TMA300_VTG_MAX_UV, | 
 | 1441 | 		.hpm_load_uA = CY_TMA300_CURR_24HZ_UA, | 
 | 1442 | 		.lpm_load_uA = CY_TMA300_CURR_24HZ_UA, | 
 | 1443 | 	}, | 
 | 1444 | 	{ | 
 | 1445 | 		.name = "vcc_i2c", | 
 | 1446 | 		.min_uV = CY_I2C_VTG_MIN_UV, | 
 | 1447 | 		.max_uV = CY_I2C_VTG_MAX_UV, | 
 | 1448 | 		.hpm_load_uA = CY_I2C_CURR_UA, | 
 | 1449 | 		.lpm_load_uA = CY_I2C_CURR_UA, | 
 | 1450 | 	}, | 
 | 1451 | }; | 
 | 1452 |  | 
 | 1453 | static struct cyttsp_platform_data cyttsp_pdata = { | 
 | 1454 | 	.panel_maxx = 634, | 
 | 1455 | 	.panel_maxy = 1166, | 
 | 1456 | 	.disp_maxx = 599, | 
 | 1457 | 	.disp_maxy = 1023, | 
 | 1458 | 	.disp_minx = 0, | 
 | 1459 | 	.disp_miny = 0, | 
 | 1460 | 	.flags = 0x01, | 
 | 1461 | 	.gen = CY_GEN3, | 
 | 1462 | 	.use_st = CY_USE_ST, | 
 | 1463 | 	.use_mt = CY_USE_MT, | 
 | 1464 | 	.use_hndshk = CY_SEND_HNDSHK, | 
 | 1465 | 	.use_trk_id = CY_USE_TRACKING_ID, | 
 | 1466 | 	.use_sleep = CY_USE_DEEP_SLEEP_SEL, | 
 | 1467 | 	.use_gestures = CY_USE_GESTURES, | 
 | 1468 | 	.fw_fname = "cyttsp_8064_mtp.hex", | 
 | 1469 | 	/* change act_intrvl to customize the Active power state | 
 | 1470 | 	 * scanning/processing refresh interval for Operating mode | 
 | 1471 | 	 */ | 
 | 1472 | 	.act_intrvl = CY_ACT_INTRVL_DFLT, | 
 | 1473 | 	/* change tch_tmout to customize the touch timeout for the | 
 | 1474 | 	 * Active power state for Operating mode | 
 | 1475 | 	 */ | 
 | 1476 | 	.tch_tmout = CY_TCH_TMOUT_DFLT, | 
 | 1477 | 	/* change lp_intrvl to customize the Low Power power state | 
 | 1478 | 	 * scanning/processing refresh interval for Operating mode | 
 | 1479 | 	 */ | 
 | 1480 | 	.lp_intrvl = CY_LP_INTRVL_DFLT, | 
 | 1481 | 	.sleep_gpio = CYTTSP_TS_GPIO_SLEEP, | 
| Amy Maloche | 9ba3ffe | 2012-04-26 10:31:20 -0700 | [diff] [blame] | 1482 | 	.resout_gpio = -1, | 
| Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1483 | 	.irq_gpio = CYTTSP_TS_GPIO_IRQ, | 
 | 1484 | 	.regulator_info = cyttsp_regulator_data, | 
 | 1485 | 	.num_regulators = ARRAY_SIZE(cyttsp_regulator_data), | 
 | 1486 | 	.init = cyttsp_platform_init, | 
 | 1487 | 	.correct_fw_ver = 17, | 
 | 1488 | }; | 
 | 1489 |  | 
 | 1490 | static struct i2c_board_info cyttsp_info[] __initdata = { | 
 | 1491 | 	{ | 
 | 1492 | 		I2C_BOARD_INFO(CY_I2C_NAME, 0x24), | 
 | 1493 | 		.platform_data = &cyttsp_pdata, | 
 | 1494 | 		.irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), | 
 | 1495 | 	}, | 
 | 1496 | }; | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1497 |  | 
| Ankit Verma | 6b7e2ba | 2012-01-26 15:48:54 -0800 | [diff] [blame] | 1498 | #define MSM_WCNSS_PHYS	0x03000000 | 
 | 1499 | #define MSM_WCNSS_SIZE	0x280000 | 
 | 1500 |  | 
 | 1501 | static struct resource resources_wcnss_wlan[] = { | 
 | 1502 | 	{ | 
 | 1503 | 		.start	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, | 
 | 1504 | 		.end	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, | 
 | 1505 | 		.name	= "wcnss_wlanrx_irq", | 
 | 1506 | 		.flags	= IORESOURCE_IRQ, | 
 | 1507 | 	}, | 
 | 1508 | 	{ | 
 | 1509 | 		.start	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, | 
 | 1510 | 		.end	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, | 
 | 1511 | 		.name	= "wcnss_wlantx_irq", | 
 | 1512 | 		.flags	= IORESOURCE_IRQ, | 
 | 1513 | 	}, | 
 | 1514 | 	{ | 
 | 1515 | 		.start	= MSM_WCNSS_PHYS, | 
 | 1516 | 		.end	= MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, | 
 | 1517 | 		.name	= "wcnss_mmio", | 
 | 1518 | 		.flags	= IORESOURCE_MEM, | 
 | 1519 | 	}, | 
 | 1520 | 	{ | 
 | 1521 | 		.start	= 64, | 
 | 1522 | 		.end	= 68, | 
 | 1523 | 		.name	= "wcnss_gpios_5wire", | 
 | 1524 | 		.flags	= IORESOURCE_IO, | 
 | 1525 | 	}, | 
 | 1526 | }; | 
 | 1527 |  | 
 | 1528 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { | 
 | 1529 | 	.has_48mhz_xo	= 1, | 
 | 1530 | }; | 
 | 1531 |  | 
 | 1532 | static struct platform_device msm_device_wcnss_wlan = { | 
 | 1533 | 	.name		= "wcnss_wlan", | 
 | 1534 | 	.id		= 0, | 
 | 1535 | 	.num_resources	= ARRAY_SIZE(resources_wcnss_wlan), | 
 | 1536 | 	.resource	= resources_wcnss_wlan, | 
 | 1537 | 	.dev		= {.platform_data = &qcom_wcnss_pdata}, | 
 | 1538 | }; | 
 | 1539 |  | 
| Ankit Verma | b7c26e6 | 2012-02-28 15:04:15 -0800 | [diff] [blame] | 1540 | static struct platform_device msm_device_iris_fm __devinitdata = { | 
 | 1541 | 	.name = "iris_fm", | 
 | 1542 | 	.id   = -1, | 
 | 1543 | }; | 
 | 1544 |  | 
| Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1545 | #ifdef CONFIG_QSEECOM | 
 | 1546 | /* qseecom bus scaling */ | 
 | 1547 | static struct msm_bus_vectors qseecom_clks_init_vectors[] = { | 
 | 1548 | 	{ | 
 | 1549 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 1550 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 1551 | 		.ib = 0, | 
 | 1552 | 		.ab = 0, | 
 | 1553 | 	}, | 
 | 1554 | 	{ | 
 | 1555 | 		.src = MSM_BUS_MASTER_SPDM, | 
 | 1556 | 		.dst = MSM_BUS_SLAVE_SPDM, | 
 | 1557 | 		.ib = 0, | 
 | 1558 | 		.ab = 0, | 
 | 1559 | 	}, | 
 | 1560 | }; | 
 | 1561 |  | 
 | 1562 | static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = { | 
 | 1563 | 	{ | 
 | 1564 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 1565 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 1566 | 		.ib = (492 * 8) * 1000000UL, | 
 | 1567 | 		.ab = (492 * 8) *  100000UL, | 
 | 1568 | 	}, | 
 | 1569 | 	{ | 
 | 1570 | 		.src = MSM_BUS_MASTER_SPDM, | 
 | 1571 | 		.dst = MSM_BUS_SLAVE_SPDM, | 
 | 1572 | 		.ib = 0, | 
 | 1573 | 		.ab = 0, | 
 | 1574 | 	}, | 
 | 1575 | }; | 
 | 1576 |  | 
 | 1577 | static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = { | 
 | 1578 | 	{ | 
 | 1579 | 		.src = MSM_BUS_MASTER_SPS, | 
 | 1580 | 		.dst = MSM_BUS_SLAVE_EBI_CH0, | 
 | 1581 | 		.ib = 0, | 
 | 1582 | 		.ab = 0, | 
 | 1583 | 	}, | 
 | 1584 | 	{ | 
 | 1585 | 		.src = MSM_BUS_MASTER_SPDM, | 
 | 1586 | 		.dst = MSM_BUS_SLAVE_SPDM, | 
 | 1587 | 		.ib = (64 * 8) * 1000000UL, | 
 | 1588 | 		.ab = (64 * 8) *  100000UL, | 
 | 1589 | 	}, | 
 | 1590 | }; | 
 | 1591 |  | 
 | 1592 | static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = { | 
 | 1593 | 	{ | 
 | 1594 | 		ARRAY_SIZE(qseecom_clks_init_vectors), | 
 | 1595 | 		qseecom_clks_init_vectors, | 
 | 1596 | 	}, | 
 | 1597 | 	{ | 
 | 1598 | 		ARRAY_SIZE(qseecom_enable_dfab_vectors), | 
 | 1599 | 		qseecom_enable_sfpb_vectors, | 
 | 1600 | 	}, | 
 | 1601 | 	{ | 
 | 1602 | 		ARRAY_SIZE(qseecom_enable_sfpb_vectors), | 
 | 1603 | 		qseecom_enable_sfpb_vectors, | 
 | 1604 | 	}, | 
 | 1605 | }; | 
 | 1606 |  | 
 | 1607 | static struct msm_bus_scale_pdata qseecom_bus_pdata = { | 
 | 1608 | 	qseecom_hw_bus_scale_usecases, | 
 | 1609 | 	ARRAY_SIZE(qseecom_hw_bus_scale_usecases), | 
 | 1610 | 	.name = "qsee", | 
 | 1611 | }; | 
 | 1612 |  | 
 | 1613 | static struct platform_device qseecom_device = { | 
 | 1614 | 	.name		= "qseecom", | 
 | 1615 | 	.id		= 0, | 
 | 1616 | 	.dev		= { | 
 | 1617 | 		.platform_data = &qseecom_bus_pdata, | 
 | 1618 | 	}, | 
 | 1619 | }; | 
 | 1620 | #endif | 
 | 1621 |  | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1622 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ | 
 | 1623 | 		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ | 
 | 1624 | 		defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ | 
 | 1625 | 		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) | 
 | 1626 |  | 
 | 1627 | #define QCE_SIZE		0x10000 | 
 | 1628 | #define QCE_0_BASE		0x11000000 | 
 | 1629 |  | 
 | 1630 | #define QCE_HW_KEY_SUPPORT	0 | 
 | 1631 | #define QCE_SHA_HMAC_SUPPORT	1 | 
 | 1632 | #define QCE_SHARE_CE_RESOURCE	3 | 
 | 1633 | #define QCE_CE_SHARED		0 | 
 | 1634 |  | 
 | 1635 | static struct resource qcrypto_resources[] = { | 
 | 1636 | 	[0] = { | 
 | 1637 | 		.start = QCE_0_BASE, | 
 | 1638 | 		.end = QCE_0_BASE + QCE_SIZE - 1, | 
 | 1639 | 		.flags = IORESOURCE_MEM, | 
 | 1640 | 	}, | 
 | 1641 | 	[1] = { | 
 | 1642 | 		.name = "crypto_channels", | 
 | 1643 | 		.start = DMOV8064_CE_IN_CHAN, | 
 | 1644 | 		.end = DMOV8064_CE_OUT_CHAN, | 
 | 1645 | 		.flags = IORESOURCE_DMA, | 
 | 1646 | 	}, | 
 | 1647 | 	[2] = { | 
 | 1648 | 		.name = "crypto_crci_in", | 
 | 1649 | 		.start = DMOV8064_CE_IN_CRCI, | 
 | 1650 | 		.end = DMOV8064_CE_IN_CRCI, | 
 | 1651 | 		.flags = IORESOURCE_DMA, | 
 | 1652 | 	}, | 
 | 1653 | 	[3] = { | 
 | 1654 | 		.name = "crypto_crci_out", | 
 | 1655 | 		.start = DMOV8064_CE_OUT_CRCI, | 
 | 1656 | 		.end = DMOV8064_CE_OUT_CRCI, | 
 | 1657 | 		.flags = IORESOURCE_DMA, | 
 | 1658 | 	}, | 
 | 1659 | }; | 
 | 1660 |  | 
 | 1661 | static struct resource qcedev_resources[] = { | 
 | 1662 | 	[0] = { | 
 | 1663 | 		.start = QCE_0_BASE, | 
 | 1664 | 		.end = QCE_0_BASE + QCE_SIZE - 1, | 
 | 1665 | 		.flags = IORESOURCE_MEM, | 
 | 1666 | 	}, | 
 | 1667 | 	[1] = { | 
 | 1668 | 		.name = "crypto_channels", | 
 | 1669 | 		.start = DMOV8064_CE_IN_CHAN, | 
 | 1670 | 		.end = DMOV8064_CE_OUT_CHAN, | 
 | 1671 | 		.flags = IORESOURCE_DMA, | 
 | 1672 | 	}, | 
 | 1673 | 	[2] = { | 
 | 1674 | 		.name = "crypto_crci_in", | 
 | 1675 | 		.start = DMOV8064_CE_IN_CRCI, | 
 | 1676 | 		.end = DMOV8064_CE_IN_CRCI, | 
 | 1677 | 		.flags = IORESOURCE_DMA, | 
 | 1678 | 	}, | 
 | 1679 | 	[3] = { | 
 | 1680 | 		.name = "crypto_crci_out", | 
 | 1681 | 		.start = DMOV8064_CE_OUT_CRCI, | 
 | 1682 | 		.end = DMOV8064_CE_OUT_CRCI, | 
 | 1683 | 		.flags = IORESOURCE_DMA, | 
 | 1684 | 	}, | 
 | 1685 | }; | 
 | 1686 |  | 
 | 1687 | #endif | 
 | 1688 |  | 
 | 1689 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ | 
 | 1690 | 		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) | 
 | 1691 |  | 
 | 1692 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { | 
 | 1693 | 	.ce_shared = QCE_CE_SHARED, | 
 | 1694 | 	.shared_ce_resource = QCE_SHARE_CE_RESOURCE, | 
 | 1695 | 	.hw_key_support = QCE_HW_KEY_SUPPORT, | 
 | 1696 | 	.sha_hmac = QCE_SHA_HMAC_SUPPORT, | 
| Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 1697 | 	.bus_scale_table = NULL, | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1698 | }; | 
 | 1699 |  | 
 | 1700 | static struct platform_device qcrypto_device = { | 
 | 1701 | 	.name		= "qcrypto", | 
 | 1702 | 	.id		= 0, | 
 | 1703 | 	.num_resources	= ARRAY_SIZE(qcrypto_resources), | 
 | 1704 | 	.resource	= qcrypto_resources, | 
 | 1705 | 	.dev		= { | 
 | 1706 | 		.coherent_dma_mask = DMA_BIT_MASK(32), | 
 | 1707 | 		.platform_data = &qcrypto_ce_hw_suppport, | 
 | 1708 | 	}, | 
 | 1709 | }; | 
 | 1710 | #endif | 
 | 1711 |  | 
 | 1712 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ | 
 | 1713 | 		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) | 
 | 1714 |  | 
 | 1715 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { | 
 | 1716 | 	.ce_shared = QCE_CE_SHARED, | 
 | 1717 | 	.shared_ce_resource = QCE_SHARE_CE_RESOURCE, | 
 | 1718 | 	.hw_key_support = QCE_HW_KEY_SUPPORT, | 
 | 1719 | 	.sha_hmac = QCE_SHA_HMAC_SUPPORT, | 
| Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 1720 | 	.bus_scale_table = NULL, | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1721 | }; | 
 | 1722 |  | 
 | 1723 | static struct platform_device qcedev_device = { | 
 | 1724 | 	.name		= "qce", | 
 | 1725 | 	.id		= 0, | 
 | 1726 | 	.num_resources	= ARRAY_SIZE(qcedev_resources), | 
 | 1727 | 	.resource	= qcedev_resources, | 
 | 1728 | 	.dev		= { | 
 | 1729 | 		.coherent_dma_mask = DMA_BIT_MASK(32), | 
 | 1730 | 		.platform_data = &qcedev_ce_hw_suppport, | 
 | 1731 | 	}, | 
 | 1732 | }; | 
 | 1733 | #endif | 
 | 1734 |  | 
| Joel King | ef39084 | 2012-05-23 16:42:48 -0700 | [diff] [blame] | 1735 | static struct mdm_vddmin_resource mdm_vddmin_rscs = { | 
 | 1736 | 	.rpm_id = MSM_RPM_ID_VDDMIN_GPIO, | 
 | 1737 | 	.ap2mdm_vddmin_gpio = 30, | 
 | 1738 | 	.modes  = 0x03, | 
 | 1739 | 	.drive_strength = 8, | 
 | 1740 | 	.mdm2ap_vddmin_gpio = 80, | 
 | 1741 | }; | 
 | 1742 |  | 
| Joel King | 269aa60 | 2012-07-23 08:07:35 -0700 | [diff] [blame] | 1743 | static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = { | 
 | 1744 | 	.func = GPIOMUX_FUNC_GPIO, | 
 | 1745 | 	.drv = GPIOMUX_DRV_8MA, | 
 | 1746 | 	.pull = GPIOMUX_PULL_NONE, | 
 | 1747 | }; | 
 | 1748 |  | 
| Joel King | dacbc82 | 2012-01-25 13:30:57 -0800 | [diff] [blame] | 1749 | static struct mdm_platform_data mdm_platform_data = { | 
 | 1750 | 	.mdm_version = "3.0", | 
 | 1751 | 	.ramdump_delay_ms = 2000, | 
| Joel King | 14fe7fa | 2012-05-27 14:26:11 -0700 | [diff] [blame] | 1752 | 	.early_power_on = 1, | 
 | 1753 | 	.sfr_query = 1, | 
| Joel King | ef39084 | 2012-05-23 16:42:48 -0700 | [diff] [blame] | 1754 | 	.vddmin_resource = &mdm_vddmin_rscs, | 
| Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 1755 | 	.peripheral_platform_device = &apq8064_device_hsic_host, | 
| Ameya Thakur | c9a7a84 | 2012-06-24 22:47:52 -0700 | [diff] [blame] | 1756 | 	.ramdump_timeout_ms = 120000, | 
| Joel King | 269aa60 | 2012-07-23 08:07:35 -0700 | [diff] [blame] | 1757 | 	.mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg, | 
| Joel King | dacbc82 | 2012-01-25 13:30:57 -0800 | [diff] [blame] | 1758 | }; | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1759 |  | 
| Siddartha Mohanadoss | caeaa92 | 2012-02-07 16:41:38 -0800 | [diff] [blame] | 1760 | static struct tsens_platform_data apq_tsens_pdata  = { | 
 | 1761 | 		.tsens_factor		= 1000, | 
 | 1762 | 		.hw_type		= APQ_8064, | 
 | 1763 | 		.tsens_num_sensor	= 11, | 
 | 1764 | 		.slope = {1176, 1176, 1154, 1176, 1111, | 
 | 1765 | 			1132, 1132, 1199, 1132, 1199, 1132}, | 
 | 1766 | }; | 
 | 1767 |  | 
| Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 1768 | static struct platform_device msm_tsens_device = { | 
 | 1769 | 	.name   = "tsens8960-tm", | 
 | 1770 | 	.id = -1, | 
 | 1771 | }; | 
 | 1772 |  | 
| Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 1773 | static struct msm_thermal_data msm_thermal_pdata = { | 
 | 1774 | 	.sensor_id = 7, | 
| Eugene Seah | 2ee4a5d | 2012-06-25 18:16:41 -0600 | [diff] [blame] | 1775 | 	.poll_ms = 250, | 
 | 1776 | 	.limit_temp_degC = 60, | 
 | 1777 | 	.temp_hysteresis_degC = 10, | 
 | 1778 | 	.freq_step = 2, | 
| Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 1779 | }; | 
 | 1780 |  | 
| Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 1781 | #define MSM_SHARED_RAM_PHYS 0x80000000 | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1782 | static void __init apq8064_map_io(void) | 
 | 1783 | { | 
| Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 1784 | 	msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1785 | 	msm_map_apq8064_io(); | 
| Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 1786 | 	if (socinfo_init() < 0) | 
 | 1787 | 		pr_err("socinfo_init() failed!\n"); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1788 | } | 
 | 1789 |  | 
 | 1790 | static void __init apq8064_init_irq(void) | 
 | 1791 | { | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1792 | 	struct msm_mpm_device_data *data = NULL; | 
 | 1793 |  | 
 | 1794 | #ifdef CONFIG_MSM_MPM | 
 | 1795 | 	data = &apq8064_mpm_dev_data; | 
 | 1796 | #endif | 
 | 1797 |  | 
 | 1798 | 	msm_mpm_irq_extn_init(data); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1799 | 	gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, | 
 | 1800 | 						(void *)MSM_QGIC_CPU_BASE); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1801 | } | 
 | 1802 |  | 
| Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 1803 | static struct platform_device msm8064_device_saw_regulator_core0 = { | 
 | 1804 | 	.name	= "saw-regulator", | 
 | 1805 | 	.id	= 0, | 
 | 1806 | 	.dev	= { | 
 | 1807 | 		.platform_data = &msm8064_saw_regulator_pdata_8921_s5, | 
 | 1808 | 	}, | 
 | 1809 | }; | 
 | 1810 |  | 
 | 1811 | static struct platform_device msm8064_device_saw_regulator_core1 = { | 
 | 1812 | 	.name	= "saw-regulator", | 
 | 1813 | 	.id	= 1, | 
 | 1814 | 	.dev	= { | 
 | 1815 | 		.platform_data = &msm8064_saw_regulator_pdata_8921_s6, | 
 | 1816 | 	}, | 
 | 1817 | }; | 
 | 1818 |  | 
 | 1819 | static struct platform_device msm8064_device_saw_regulator_core2 = { | 
 | 1820 | 	.name	= "saw-regulator", | 
 | 1821 | 	.id	= 2, | 
 | 1822 | 	.dev	= { | 
 | 1823 | 		.platform_data = &msm8064_saw_regulator_pdata_8821_s0, | 
 | 1824 | 	}, | 
 | 1825 | }; | 
 | 1826 |  | 
 | 1827 | static struct platform_device msm8064_device_saw_regulator_core3 = { | 
 | 1828 | 	.name	= "saw-regulator", | 
 | 1829 | 	.id	= 3, | 
 | 1830 | 	.dev	= { | 
 | 1831 | 		.platform_data = &msm8064_saw_regulator_pdata_8821_s1, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1832 |  | 
 | 1833 | 	}, | 
 | 1834 | }; | 
 | 1835 |  | 
| Oluwafemi Adeyemi | f5a3142 | 2012-03-08 16:58:45 -0800 | [diff] [blame] | 1836 | static struct msm_rpmrs_level msm_rpmrs_levels[] = { | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1837 | 	{ | 
 | 1838 | 		MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, | 
 | 1839 | 		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), | 
 | 1840 | 		true, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1841 | 		1, 784, 180000, 100, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1842 | 	}, | 
 | 1843 |  | 
 | 1844 | 	{ | 
 | 1845 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, | 
 | 1846 | 		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), | 
 | 1847 | 		true, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1848 | 		1300, 228, 1200000, 2000, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1849 | 	}, | 
 | 1850 |  | 
 | 1851 | 	{ | 
 | 1852 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE, | 
 | 1853 | 		MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), | 
 | 1854 | 		false, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1855 | 		2000, 138, 1208400, 3200, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1856 | 	}, | 
 | 1857 |  | 
 | 1858 | 	{ | 
 | 1859 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE, | 
| Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 1860 | 		MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), | 
 | 1861 | 		false, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1862 | 		6000, 119, 1850300, 9000, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1863 | 	}, | 
 | 1864 |  | 
 | 1865 | 	{ | 
 | 1866 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE, | 
 | 1867 | 		MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), | 
 | 1868 | 		false, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1869 | 		9200, 68, 2839200, 16400, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1870 | 	}, | 
 | 1871 |  | 
 | 1872 | 	{ | 
 | 1873 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE, | 
 | 1874 | 		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), | 
 | 1875 | 		false, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1876 | 		10300, 63, 3128000, 18200, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1877 | 	}, | 
 | 1878 |  | 
 | 1879 | 	{ | 
 | 1880 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE, | 
 | 1881 | 		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), | 
 | 1882 | 		false, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1883 | 		18000, 10, 4602600, 27000, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1884 | 	}, | 
 | 1885 |  | 
 | 1886 | 	{ | 
 | 1887 | 		MSM_PM_SLEEP_MODE_POWER_COLLAPSE, | 
 | 1888 | 		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), | 
 | 1889 | 		false, | 
| Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1890 | 		20000, 2, 5752000, 32000, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1891 | 	}, | 
 | 1892 | }; | 
 | 1893 |  | 
 | 1894 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { | 
 | 1895 | 	.mode = MSM_PM_BOOT_CONFIG_TZ, | 
 | 1896 | }; | 
 | 1897 |  | 
 | 1898 | static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = { | 
 | 1899 | 	.levels = &msm_rpmrs_levels[0], | 
 | 1900 | 	.num_levels = ARRAY_SIZE(msm_rpmrs_levels), | 
 | 1901 | 	.vdd_mem_levels  = { | 
 | 1902 | 		[MSM_RPMRS_VDD_MEM_RET_LOW]	= 750000, | 
 | 1903 | 		[MSM_RPMRS_VDD_MEM_RET_HIGH]	= 750000, | 
 | 1904 | 		[MSM_RPMRS_VDD_MEM_ACTIVE]	= 1050000, | 
 | 1905 | 		[MSM_RPMRS_VDD_MEM_MAX]		= 1150000, | 
 | 1906 | 	}, | 
 | 1907 | 	.vdd_dig_levels = { | 
 | 1908 | 		[MSM_RPMRS_VDD_DIG_RET_LOW]	= 500000, | 
 | 1909 | 		[MSM_RPMRS_VDD_DIG_RET_HIGH]	= 750000, | 
 | 1910 | 		[MSM_RPMRS_VDD_DIG_ACTIVE]	= 950000, | 
 | 1911 | 		[MSM_RPMRS_VDD_DIG_MAX]		= 1150000, | 
 | 1912 | 	}, | 
 | 1913 | 	.vdd_mask = 0x7FFFFF, | 
 | 1914 | 	.rpmrs_target_id = { | 
 | 1915 | 		[MSM_RPMRS_ID_PXO_CLK]		= MSM_RPM_ID_PXO_CLK, | 
 | 1916 | 		[MSM_RPMRS_ID_L2_CACHE_CTL]	= MSM_RPM_ID_LAST, | 
 | 1917 | 		[MSM_RPMRS_ID_VDD_DIG_0]	= MSM_RPM_ID_PM8921_S3_0, | 
 | 1918 | 		[MSM_RPMRS_ID_VDD_DIG_1]	= MSM_RPM_ID_PM8921_S3_1, | 
 | 1919 | 		[MSM_RPMRS_ID_VDD_MEM_0]	= MSM_RPM_ID_PM8921_L24_0, | 
 | 1920 | 		[MSM_RPMRS_ID_VDD_MEM_1]	= MSM_RPM_ID_PM8921_L24_1, | 
 | 1921 | 		[MSM_RPMRS_ID_RPM_CTL]		= MSM_RPM_ID_RPM_CTL, | 
 | 1922 | 	}, | 
 | 1923 | }; | 
 | 1924 |  | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1925 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { | 
 | 1926 | 	0x03, 0x0f, | 
 | 1927 | }; | 
 | 1928 |  | 
 | 1929 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { | 
 | 1930 | 	0x00, 0x24, 0x54, 0x10, | 
 | 1931 | 	0x09, 0x03, 0x01, | 
 | 1932 | 	0x10, 0x54, 0x30, 0x0C, | 
 | 1933 | 	0x24, 0x30, 0x0f, | 
 | 1934 | }; | 
 | 1935 |  | 
 | 1936 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { | 
 | 1937 | 	0x00, 0x24, 0x54, 0x10, | 
 | 1938 | 	0x09, 0x07, 0x01, 0x0B, | 
 | 1939 | 	0x10, 0x54, 0x30, 0x0C, | 
 | 1940 | 	0x24, 0x30, 0x0f, | 
 | 1941 | }; | 
 | 1942 |  | 
 | 1943 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { | 
 | 1944 | 	[0] = { | 
 | 1945 | 		.mode = MSM_SPM_MODE_CLOCK_GATING, | 
 | 1946 | 		.notify_rpm = false, | 
 | 1947 | 		.cmd = spm_wfi_cmd_sequence, | 
 | 1948 | 	}, | 
 | 1949 | 	[1] = { | 
 | 1950 | 		.mode = MSM_SPM_MODE_POWER_COLLAPSE, | 
 | 1951 | 		.notify_rpm = false, | 
 | 1952 | 		.cmd = spm_power_collapse_without_rpm, | 
 | 1953 | 	}, | 
 | 1954 | 	[2] = { | 
 | 1955 | 		.mode = MSM_SPM_MODE_POWER_COLLAPSE, | 
 | 1956 | 		.notify_rpm = true, | 
 | 1957 | 		.cmd = spm_power_collapse_with_rpm, | 
 | 1958 | 	}, | 
 | 1959 | }; | 
 | 1960 |  | 
 | 1961 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { | 
 | 1962 | 	0x00, 0x20, 0x03, 0x20, | 
 | 1963 | 	0x00, 0x0f, | 
 | 1964 | }; | 
 | 1965 |  | 
 | 1966 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { | 
 | 1967 | 	0x00, 0x20, 0x34, 0x64, | 
 | 1968 | 	0x48, 0x07, 0x48, 0x20, | 
 | 1969 | 	0x50, 0x64, 0x04, 0x34, | 
 | 1970 | 	0x50, 0x0f, | 
 | 1971 | }; | 
 | 1972 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { | 
 | 1973 | 	0x00, 0x10, 0x34, 0x64, | 
 | 1974 | 	0x48, 0x07, 0x48, 0x10, | 
 | 1975 | 	0x50, 0x64, 0x04, 0x34, | 
 | 1976 | 	0x50, 0x0F, | 
 | 1977 | }; | 
 | 1978 |  | 
 | 1979 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { | 
 | 1980 | 	[0] = { | 
 | 1981 | 		.mode = MSM_SPM_L2_MODE_RETENTION, | 
 | 1982 | 		.notify_rpm = false, | 
 | 1983 | 		.cmd = l2_spm_wfi_cmd_sequence, | 
 | 1984 | 	}, | 
 | 1985 | 	[1] = { | 
 | 1986 | 		.mode = MSM_SPM_L2_MODE_GDHS, | 
 | 1987 | 		.notify_rpm = true, | 
 | 1988 | 		.cmd = l2_spm_gdhs_cmd_sequence, | 
 | 1989 | 	}, | 
 | 1990 | 	[2] = { | 
 | 1991 | 		.mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, | 
 | 1992 | 		.notify_rpm = true, | 
 | 1993 | 		.cmd = l2_spm_power_off_cmd_sequence, | 
 | 1994 | 	}, | 
 | 1995 | }; | 
 | 1996 |  | 
 | 1997 |  | 
 | 1998 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { | 
 | 1999 | 	[0] = { | 
 | 2000 | 		.reg_base_addr = MSM_SAW_L2_BASE, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2001 | 		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, | 
| Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2002 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2003 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, | 
 | 2004 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, | 
 | 2005 | 		.modes = msm_spm_l2_seq_list, | 
 | 2006 | 		.num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), | 
 | 2007 | 	}, | 
 | 2008 | }; | 
 | 2009 |  | 
 | 2010 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { | 
 | 2011 | 	[0] = { | 
 | 2012 | 		.reg_base_addr = MSM_SAW0_BASE, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2013 | 		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2014 | #if defined(CONFIG_MSM_AVS_HW) | 
 | 2015 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, | 
 | 2016 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, | 
 | 2017 | #endif | 
 | 2018 | 		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, | 
| Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2019 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2020 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, | 
 | 2021 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, | 
 | 2022 | 		.vctl_timeout_us = 50, | 
 | 2023 | 		.num_modes = ARRAY_SIZE(msm_spm_seq_list), | 
 | 2024 | 		.modes = msm_spm_seq_list, | 
 | 2025 | 	}, | 
 | 2026 | 	[1] = { | 
 | 2027 | 		.reg_base_addr = MSM_SAW1_BASE, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2028 | 		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2029 | #if defined(CONFIG_MSM_AVS_HW) | 
 | 2030 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, | 
 | 2031 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, | 
 | 2032 | #endif | 
 | 2033 | 		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, | 
| Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2034 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2035 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, | 
 | 2036 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, | 
 | 2037 | 		.vctl_timeout_us = 50, | 
 | 2038 | 		.num_modes = ARRAY_SIZE(msm_spm_seq_list), | 
 | 2039 | 		.modes = msm_spm_seq_list, | 
 | 2040 | 	}, | 
 | 2041 | 	[2] = { | 
 | 2042 | 		.reg_base_addr = MSM_SAW2_BASE, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2043 | 		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2044 | #if defined(CONFIG_MSM_AVS_HW) | 
 | 2045 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, | 
 | 2046 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, | 
 | 2047 | #endif | 
 | 2048 | 		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, | 
| Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2049 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2050 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, | 
 | 2051 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, | 
 | 2052 | 		.vctl_timeout_us = 50, | 
 | 2053 | 		.num_modes = ARRAY_SIZE(msm_spm_seq_list), | 
 | 2054 | 		.modes = msm_spm_seq_list, | 
 | 2055 | 	}, | 
 | 2056 | 	[3] = { | 
 | 2057 | 		.reg_base_addr = MSM_SAW3_BASE, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2058 | 		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2059 | #if defined(CONFIG_MSM_AVS_HW) | 
 | 2060 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, | 
 | 2061 | 		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, | 
 | 2062 | #endif | 
 | 2063 | 		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, | 
| Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2064 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2065 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, | 
 | 2066 | 		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, | 
 | 2067 | 		.vctl_timeout_us = 50, | 
 | 2068 | 		.num_modes = ARRAY_SIZE(msm_spm_seq_list), | 
 | 2069 | 		.modes = msm_spm_seq_list, | 
| Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 2070 | 	}, | 
 | 2071 | }; | 
 | 2072 |  | 
| Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 2073 | static void __init apq8064_init_buses(void) | 
 | 2074 | { | 
 | 2075 | 	msm_bus_rpm_set_mt_mask(); | 
 | 2076 | 	msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1; | 
 | 2077 | 	msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1; | 
 | 2078 | 	msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1; | 
 | 2079 | 	msm_bus_8064_apps_fabric.dev.platform_data = | 
 | 2080 | 		&msm_bus_8064_apps_fabric_pdata; | 
 | 2081 | 	msm_bus_8064_sys_fabric.dev.platform_data = | 
 | 2082 | 		&msm_bus_8064_sys_fabric_pdata; | 
 | 2083 | 	msm_bus_8064_mm_fabric.dev.platform_data = | 
 | 2084 | 		&msm_bus_8064_mm_fabric_pdata; | 
 | 2085 | 	msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata; | 
 | 2086 | 	msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata; | 
 | 2087 | } | 
 | 2088 |  | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2089 | /* PCIe gpios */ | 
 | 2090 | static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = { | 
 | 2091 | 	{"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0}, | 
 | 2092 | 	{"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1}, | 
 | 2093 | }; | 
 | 2094 |  | 
 | 2095 | static struct msm_pcie_platform msm_pcie_platform_data = { | 
 | 2096 | 	.gpio = msm_pcie_gpio_info, | 
| Niranjana Vishwanathapura | 68210ff | 2012-06-24 18:03:49 -0600 | [diff] [blame] | 2097 | 	.axi_addr = PCIE_AXI_BAR_PHYS, | 
 | 2098 | 	.axi_size = PCIE_AXI_BAR_SIZE, | 
| Niranjana Vishwanathapura | 459a27d | 2012-07-20 12:23:55 -0600 | [diff] [blame] | 2099 | 	.wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO), | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2100 | }; | 
 | 2101 |  | 
| Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 2102 | static int __init mpq8064_pcie_enabled(void) | 
 | 2103 | { | 
 | 2104 | 	return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) || | 
 | 2105 | 		(readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4))); | 
 | 2106 | } | 
 | 2107 |  | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2108 | static void __init mpq8064_pcie_init(void) | 
 | 2109 | { | 
| Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 2110 | 	if (mpq8064_pcie_enabled()) { | 
 | 2111 | 		msm_device_pcie.dev.platform_data = &msm_pcie_platform_data; | 
 | 2112 | 		platform_device_register(&msm_device_pcie); | 
 | 2113 | 	} | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2114 | } | 
 | 2115 |  | 
| David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2116 | static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = { | 
 | 2117 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2118 | 	.id	= PM8921_MPP_PM_TO_SYS(7), | 
 | 2119 | 	.dev	= { | 
 | 2120 | 		.platform_data | 
 | 2121 | 			= &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], | 
 | 2122 | 	}, | 
 | 2123 | }; | 
 | 2124 |  | 
| Jay Chokshi | 1de4f9d | 2012-02-07 16:11:31 -0800 | [diff] [blame] | 2125 | static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = { | 
 | 2126 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2127 | 	.id	= PM8921_MPP_PM_TO_SYS(8), | 
 | 2128 | 	.dev	= { | 
 | 2129 | 		.platform_data | 
 | 2130 | 			= &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8], | 
 | 2131 | 	}, | 
 | 2132 | }; | 
 | 2133 |  | 
| David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2134 | static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = { | 
 | 2135 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2136 | 	.id	= APQ8064_EXT_3P3V_REG_EN_GPIO, | 
 | 2137 | 	.dev	= { | 
 | 2138 | 		.platform_data = | 
 | 2139 | 			&apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V], | 
 | 2140 | 	}, | 
 | 2141 | }; | 
 | 2142 |  | 
| David Collins | 390fc33 | 2012-02-07 14:38:16 -0800 | [diff] [blame] | 2143 | static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = { | 
 | 2144 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2145 | 	.id	= PM8921_GPIO_PM_TO_SYS(23), | 
 | 2146 | 	.dev	= { | 
 | 2147 | 		.platform_data | 
 | 2148 | 			= &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW], | 
 | 2149 | 	}, | 
 | 2150 | }; | 
 | 2151 |  | 
| David Collins | 2782b5c | 2012-02-06 10:02:42 -0800 | [diff] [blame] | 2152 | static struct platform_device apq8064_device_rpm_regulator __devinitdata = { | 
 | 2153 | 	.name	= "rpm-regulator", | 
 | 2154 | 	.id	= -1, | 
 | 2155 | 	.dev	= { | 
 | 2156 | 		.platform_data = &apq8064_rpm_regulator_pdata, | 
 | 2157 | 	}, | 
 | 2158 | }; | 
 | 2159 |  | 
| Ravi Kumar V | 05931a2 | 2012-04-04 17:09:37 +0530 | [diff] [blame] | 2160 | static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = { | 
 | 2161 | 	.gpio_nr = 88, | 
 | 2162 | 	.active_low = 1, | 
 | 2163 | }; | 
 | 2164 |  | 
 | 2165 | static struct platform_device gpio_ir_recv_pdev = { | 
 | 2166 | 	.name = "gpio-rc-recv", | 
 | 2167 | 	.dev = { | 
 | 2168 | 		.platform_data = &gpio_ir_recv_pdata, | 
 | 2169 | 	}, | 
 | 2170 | }; | 
 | 2171 |  | 
| Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2172 | static struct platform_device *common_not_mpq_devices[] __initdata = { | 
| David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2173 | 	&apq8064_device_qup_i2c_gsbi1, | 
| Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2174 | 	&apq8064_device_qup_i2c_gsbi3, | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2175 | 	&apq8064_device_qup_i2c_gsbi4, | 
| Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2176 | }; | 
 | 2177 |  | 
 | 2178 | static struct platform_device *common_devices[] __initdata = { | 
| Matt Wagantall | f5cc389 | 2012-06-07 19:47:02 -0700 | [diff] [blame] | 2179 | 	&apq8064_device_acpuclk, | 
| Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2180 | 	&apq8064_device_dmov, | 
| Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2181 | 	&apq8064_device_qup_spi_gsbi5, | 
| David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2182 | 	&apq8064_device_ext_5v_vreg, | 
| Jay Chokshi | 1de4f9d | 2012-02-07 16:11:31 -0800 | [diff] [blame] | 2183 | 	&apq8064_device_ext_mpp8_vreg, | 
| David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2184 | 	&apq8064_device_ext_3p3v_vreg, | 
| Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 2185 | 	&apq8064_device_ssbi_pmic1, | 
 | 2186 | 	&apq8064_device_ssbi_pmic2, | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2187 | 	&apq8064_device_ext_ts_sw_vreg, | 
| Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 2188 | 	&msm_device_smd_apq8064, | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 2189 | 	&apq8064_device_otg, | 
 | 2190 | 	&apq8064_device_gadget_peripheral, | 
| Hemant Kumar | d86c488 | 2012-01-24 19:39:37 -0800 | [diff] [blame] | 2191 | 	&apq8064_device_hsusb_host, | 
| Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 2192 | 	&android_usb_device, | 
| Ankit Verma | 6b7e2ba | 2012-01-26 15:48:54 -0800 | [diff] [blame] | 2193 | 	&msm_device_wcnss_wlan, | 
| Ankit Verma | b7c26e6 | 2012-02-28 15:04:15 -0800 | [diff] [blame] | 2194 | 	&msm_device_iris_fm, | 
| Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 2195 | 	&apq8064_fmem_device, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 2196 | #ifdef CONFIG_ANDROID_PMEM | 
 | 2197 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2198 | 	&apq8064_android_pmem_device, | 
 | 2199 | 	&apq8064_android_pmem_adsp_device, | 
 | 2200 | 	&apq8064_android_pmem_audio_device, | 
| Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 2201 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ | 
 | 2202 | #endif /*CONFIG_ANDROID_PMEM*/ | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 2203 | #ifdef CONFIG_ION_MSM | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2204 | 	&apq8064_ion_dev, | 
| Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 2205 | #endif | 
| Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 2206 | 	&msm8064_device_watchdog, | 
| Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 2207 | 	&msm8064_device_saw_regulator_core0, | 
 | 2208 | 	&msm8064_device_saw_regulator_core1, | 
 | 2209 | 	&msm8064_device_saw_regulator_core2, | 
 | 2210 | 	&msm8064_device_saw_regulator_core3, | 
| Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 2211 | #if defined(CONFIG_QSEECOM) | 
 | 2212 | 	&qseecom_device, | 
 | 2213 | #endif | 
 | 2214 |  | 
| Joel Nider | 6b9a7bc | 2012-06-26 11:19:19 +0300 | [diff] [blame] | 2215 | 	&msm_8064_device_tsif[0], | 
 | 2216 | 	&msm_8064_device_tsif[1], | 
 | 2217 |  | 
| Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 2218 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ | 
 | 2219 | 		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) | 
 | 2220 | 	&qcrypto_device, | 
 | 2221 | #endif | 
 | 2222 |  | 
 | 2223 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ | 
 | 2224 | 		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) | 
 | 2225 | 	&qcedev_device, | 
 | 2226 | #endif | 
| Ramesh Masavarapu | f46be1b | 2011-11-03 11:13:41 -0700 | [diff] [blame] | 2227 |  | 
 | 2228 | #ifdef CONFIG_HW_RANDOM_MSM | 
 | 2229 | 	&apq8064_device_rng, | 
 | 2230 | #endif | 
| Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2231 | 	&apq_pcm, | 
 | 2232 | 	&apq_pcm_routing, | 
 | 2233 | 	&apq_cpudai0, | 
 | 2234 | 	&apq_cpudai1, | 
| Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 2235 | 	&mpq_cpudai_sec_i2s_rx, | 
| Kuirong Wang | f23f8c5 | 2012-03-31 12:34:51 -0700 | [diff] [blame] | 2236 | 	&mpq_cpudai_mi2s_tx, | 
| Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2237 | 	&apq_cpudai_hdmi_rx, | 
 | 2238 | 	&apq_cpudai_bt_rx, | 
 | 2239 | 	&apq_cpudai_bt_tx, | 
 | 2240 | 	&apq_cpudai_fm_rx, | 
 | 2241 | 	&apq_cpudai_fm_tx, | 
 | 2242 | 	&apq_cpu_fe, | 
 | 2243 | 	&apq_stub_codec, | 
 | 2244 | 	&apq_voice, | 
 | 2245 | 	&apq_voip, | 
 | 2246 | 	&apq_lpa_pcm, | 
| Krishnankutty Kolathappilly | 4374e33 | 2012-03-18 22:27:30 -0700 | [diff] [blame] | 2247 | 	&apq_compr_dsp, | 
 | 2248 | 	&apq_multi_ch_pcm, | 
| Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 2249 | 	&apq_lowlatency_pcm, | 
| Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2250 | 	&apq_pcm_hostless, | 
 | 2251 | 	&apq_cpudai_afe_01_rx, | 
 | 2252 | 	&apq_cpudai_afe_01_tx, | 
 | 2253 | 	&apq_cpudai_afe_02_rx, | 
 | 2254 | 	&apq_cpudai_afe_02_tx, | 
 | 2255 | 	&apq_pcm_afe, | 
 | 2256 | 	&apq_cpudai_auxpcm_rx, | 
 | 2257 | 	&apq_cpudai_auxpcm_tx, | 
| Neema Shetty | 8427c26 | 2012-02-16 11:23:43 -0800 | [diff] [blame] | 2258 | 	&apq_cpudai_stub, | 
| Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 2259 | 	&apq_cpudai_slimbus_1_rx, | 
 | 2260 | 	&apq_cpudai_slimbus_1_tx, | 
| Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 2261 | 	&apq_cpudai_slimbus_2_rx, | 
| Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 2262 | 	&apq_cpudai_slimbus_2_tx, | 
| Neema Shetty | c9d86c3 | 2012-05-09 12:01:39 -0700 | [diff] [blame] | 2263 | 	&apq_cpudai_slimbus_3_rx, | 
| Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 2264 | 	&apq_cpudai_slimbus_3_tx, | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2265 | 	&apq8064_rpm_device, | 
 | 2266 | 	&apq8064_rpm_log_device, | 
 | 2267 | 	&apq8064_rpm_stat_device, | 
| Ramesh Masavarapu | f31ff24 | 2012-05-10 18:55:21 -0700 | [diff] [blame] | 2268 | 	&apq_device_tz_log, | 
| Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 2269 | 	&msm_bus_8064_apps_fabric, | 
 | 2270 | 	&msm_bus_8064_sys_fabric, | 
 | 2271 | 	&msm_bus_8064_mm_fabric, | 
 | 2272 | 	&msm_bus_8064_sys_fpb, | 
 | 2273 | 	&msm_bus_8064_cpss_fpb, | 
| Mohan Kumar Gubbihalli Lachma Naik | 7f72edd | 2012-02-06 17:26:47 -0800 | [diff] [blame] | 2274 | 	&apq8064_msm_device_vidc, | 
| Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 2275 | 	&msm_pil_dsps, | 
| Matt Wagantall | b94b9a5 | 2012-02-02 21:59:54 -0800 | [diff] [blame] | 2276 | 	&msm_8960_q6_lpass, | 
| Stephen Boyd | 7b973de | 2012-03-09 12:26:16 -0800 | [diff] [blame] | 2277 | 	&msm_pil_vidc, | 
| Matt Wagantall | 292aace | 2012-01-26 19:12:34 -0800 | [diff] [blame] | 2278 | 	&msm_gss, | 
| Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2279 | 	&apq8064_rtb_device, | 
| Abhijeet Dharmapurikar | de91d2c | 2012-08-23 14:36:59 -0700 | [diff] [blame] | 2280 | 	&apq8064_msm_gov_device, | 
| Stepan Moskovchenko | 28662c5 | 2012-03-01 12:48:45 -0800 | [diff] [blame] | 2281 | 	&apq8064_device_cache_erp, | 
| Stepan Moskovchenko | 0f3de11 | 2012-06-08 18:11:46 -0700 | [diff] [blame] | 2282 | 	&msm8960_device_ebi1_ch0_erp, | 
 | 2283 | 	&msm8960_device_ebi1_ch1_erp, | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2284 | 	&epm_adc_device, | 
| Pratik Patel | 3b0ca88 | 2012-06-01 16:54:14 -0700 | [diff] [blame] | 2285 | 	&coresight_tpiu_device, | 
 | 2286 | 	&coresight_etb_device, | 
 | 2287 | 	&apq8064_coresight_funnel_device, | 
 | 2288 | 	&coresight_etm0_device, | 
 | 2289 | 	&coresight_etm1_device, | 
 | 2290 | 	&coresight_etm2_device, | 
 | 2291 | 	&coresight_etm3_device, | 
| Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 2292 | 	&apq_cpudai_slim_4_rx, | 
 | 2293 | 	&apq_cpudai_slim_4_tx, | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2294 | #ifdef CONFIG_MSM_GEMINI | 
| Jignesh Mehta | 921649d | 2012-04-19 06:57:23 -0700 | [diff] [blame] | 2295 | 	&msm8960_gemini_device, | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2296 | #endif | 
| Laura Abbott | 0577d7b | 2012-04-17 11:14:30 -0700 | [diff] [blame] | 2297 | 	&apq8064_iommu_domain_device, | 
| Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 2298 | 	&msm_tsens_device, | 
| Laura Abbott | 93a4a35 | 2012-05-25 09:26:35 -0700 | [diff] [blame] | 2299 | 	&apq8064_cache_dump_device, | 
| Joel Nider | 0e4a16d | 2012-08-05 14:20:11 +0300 | [diff] [blame] | 2300 | 	&msm_8064_device_tspp, | 
| Abhijeet Dharmapurikar | de91d2c | 2012-08-23 14:36:59 -0700 | [diff] [blame] | 2301 | #ifdef CONFIG_BATTERY_BCL | 
 | 2302 | 	&battery_bcl_device, | 
 | 2303 | #endif | 
 | 2304 | 	&apq8064_msm_mpd_device, | 
| Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2305 | }; | 
 | 2306 |  | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 2307 | static struct platform_device *cdp_devices[] __initdata = { | 
 | 2308 | 	&apq8064_device_uart_gsbi1, | 
| Jin Hong | 4bbbfba | 2012-02-02 21:48:07 -0800 | [diff] [blame] | 2309 | 	&apq8064_device_uart_gsbi7, | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 2310 | 	&msm_device_sps_apq8064, | 
| Aravind Venkateswaran | 4ca2753 | 2012-02-16 14:27:05 -0800 | [diff] [blame] | 2311 | #ifdef CONFIG_MSM_ROTATOR | 
 | 2312 | 	&msm_rotator_device, | 
 | 2313 | #endif | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 2314 | }; | 
 | 2315 |  | 
| Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2316 | static struct platform_device | 
| Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2317 | mpq8064_device_ext_1p2_buck_vreg __devinitdata = { | 
 | 2318 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2319 | 	.id	= SX150X_GPIO(4, 2), | 
 | 2320 | 	.dev	= { | 
 | 2321 | 		.platform_data = | 
 | 2322 | 		 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V], | 
 | 2323 | 	}, | 
 | 2324 | }; | 
 | 2325 |  | 
 | 2326 | static struct platform_device | 
 | 2327 | mpq8064_device_ext_1p8_buck_vreg __devinitdata = { | 
 | 2328 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2329 | 	.id	= SX150X_GPIO(4, 4), | 
 | 2330 | 	.dev	= { | 
 | 2331 | 		.platform_data = | 
 | 2332 | 		&mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V], | 
 | 2333 | 	}, | 
 | 2334 | }; | 
 | 2335 |  | 
 | 2336 | static struct platform_device | 
 | 2337 | mpq8064_device_ext_2p2_buck_vreg __devinitdata = { | 
 | 2338 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2339 | 	.id	= SX150X_GPIO(4, 14), | 
 | 2340 | 	.dev	= { | 
 | 2341 | 		.platform_data = | 
 | 2342 | 		&mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V], | 
 | 2343 | 	}, | 
 | 2344 | }; | 
 | 2345 |  | 
 | 2346 | static struct platform_device | 
 | 2347 | mpq8064_device_ext_5v_buck_vreg __devinitdata = { | 
 | 2348 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2349 | 	.id	= SX150X_GPIO(4, 3), | 
 | 2350 | 	.dev	= { | 
 | 2351 | 		.platform_data = | 
 | 2352 | 		 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V], | 
 | 2353 | 	}, | 
 | 2354 | }; | 
 | 2355 |  | 
 | 2356 | static struct platform_device | 
 | 2357 | mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = { | 
 | 2358 | 	.name	= GPIO_REGULATOR_DEV_NAME, | 
 | 2359 | 	.id	= SX150X_GPIO(4, 15), | 
 | 2360 | 	.dev	= { | 
 | 2361 | 		.platform_data = | 
 | 2362 | 		&mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V], | 
 | 2363 | 	}, | 
 | 2364 | }; | 
 | 2365 |  | 
| Ravi Kumar V | 1c90301 | 2012-05-15 16:11:35 +0530 | [diff] [blame] | 2366 | static struct platform_device rc_input_loopback_pdev = { | 
 | 2367 | 	.name	= "rc-user-input", | 
 | 2368 | 	.id	= -1, | 
 | 2369 | }; | 
 | 2370 |  | 
| Ravi Kumar V | 040eeff | 2012-05-23 21:29:23 +0530 | [diff] [blame] | 2371 | static int rf4ce_gpio_init(void) | 
 | 2372 | { | 
| Ravi Kumar V | 0143c58 | 2012-08-14 17:18:11 +0530 | [diff] [blame] | 2373 | 	if (!machine_is_mpq8064_cdp() && | 
 | 2374 | 		!machine_is_mpq8064_hrd() && | 
 | 2375 | 			!machine_is_mpq8064_dtv()) | 
| Ravi Kumar V | 040eeff | 2012-05-23 21:29:23 +0530 | [diff] [blame] | 2376 | 		return -EINVAL; | 
 | 2377 |  | 
 | 2378 | 	/* CC2533 SRDY Input */ | 
 | 2379 | 	if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) { | 
 | 2380 | 		gpio_direction_input(SX150X_GPIO(4, 6)); | 
 | 2381 | 		gpio_export(SX150X_GPIO(4, 6), true); | 
 | 2382 | 	} | 
 | 2383 |  | 
 | 2384 | 	/* CC2533 MRDY Output */ | 
 | 2385 | 	if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) { | 
 | 2386 | 		gpio_direction_output(SX150X_GPIO(4, 5), 1); | 
 | 2387 | 		gpio_export(SX150X_GPIO(4, 5), true); | 
 | 2388 | 	} | 
 | 2389 |  | 
 | 2390 | 	/* CC2533 Reset Output */ | 
 | 2391 | 	if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) { | 
 | 2392 | 		gpio_direction_output(SX150X_GPIO(4, 7), 0); | 
 | 2393 | 		gpio_export(SX150X_GPIO(4, 7), true); | 
 | 2394 | 	} | 
 | 2395 |  | 
 | 2396 | 	return 0; | 
 | 2397 | } | 
 | 2398 | late_initcall(rf4ce_gpio_init); | 
 | 2399 |  | 
| Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2400 | static struct platform_device *mpq_devices[] __initdata = { | 
 | 2401 | 	&msm_device_sps_apq8064, | 
 | 2402 | 	&mpq8064_device_qup_i2c_gsbi5, | 
 | 2403 | #ifdef CONFIG_MSM_ROTATOR | 
 | 2404 | 	&msm_rotator_device, | 
 | 2405 | #endif | 
| Ravi Kumar V | 05931a2 | 2012-04-04 17:09:37 +0530 | [diff] [blame] | 2406 | 	&gpio_ir_recv_pdev, | 
| Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2407 | 	&mpq8064_device_ext_1p2_buck_vreg, | 
 | 2408 | 	&mpq8064_device_ext_1p8_buck_vreg, | 
 | 2409 | 	&mpq8064_device_ext_2p2_buck_vreg, | 
 | 2410 | 	&mpq8064_device_ext_5v_buck_vreg, | 
 | 2411 | 	&mpq8064_device_ext_3p3v_ldo_vreg, | 
| Terence Hampson | 2e1705f | 2012-04-11 19:55:29 -0400 | [diff] [blame] | 2412 | #ifdef CONFIG_MSM_VCAP | 
 | 2413 | 	&msm8064_device_vcap, | 
 | 2414 | #endif | 
| Ravi Kumar V | 1c90301 | 2012-05-15 16:11:35 +0530 | [diff] [blame] | 2415 | 	&rc_input_loopback_pdev, | 
| Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2416 | }; | 
 | 2417 |  | 
| Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2418 | static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = { | 
| Stepan Moskovchenko | c71c979 | 2012-01-31 18:12:44 -0800 | [diff] [blame] | 2419 | 	.max_clock_speed = 1100000, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2420 | }; | 
 | 2421 |  | 
| Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 2422 | #define KS8851_IRQ_GPIO		43 | 
 | 2423 |  | 
 | 2424 | static struct spi_board_info spi_board_info[] __initdata = { | 
 | 2425 | 	{ | 
 | 2426 | 		.modalias               = "ks8851", | 
 | 2427 | 		.irq                    = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), | 
 | 2428 | 		.max_speed_hz           = 19200000, | 
 | 2429 | 		.bus_num                = 0, | 
 | 2430 | 		.chip_select            = 2, | 
 | 2431 | 		.mode                   = SPI_MODE_0, | 
 | 2432 | 	}, | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2433 | 	{ | 
 | 2434 | 		.modalias		= "epm_adc", | 
 | 2435 | 		.max_speed_hz		= 1100000, | 
 | 2436 | 		.bus_num		= 0, | 
 | 2437 | 		.chip_select		= 3, | 
 | 2438 | 		.mode			= SPI_MODE_0, | 
 | 2439 | 	}, | 
| Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 2440 | }; | 
 | 2441 |  | 
| Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 2442 | static struct slim_boardinfo apq8064_slim_devices[] = { | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 2443 | 	{ | 
| Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 2444 | 		.bus_num = 1, | 
 | 2445 | 		.slim_slave = &apq8064_slim_tabla, | 
 | 2446 | 	}, | 
 | 2447 | 	{ | 
 | 2448 | 		.bus_num = 1, | 
 | 2449 | 		.slim_slave = &apq8064_slim_tabla20, | 
| Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 2450 | 	}, | 
 | 2451 | 	/* add more slimbus slaves as needed */ | 
| Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 2452 | }; | 
 | 2453 |  | 
| David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2454 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = { | 
 | 2455 | 	.clk_freq = 100000, | 
 | 2456 | 	.src_clk_rate = 24000000, | 
 | 2457 | }; | 
 | 2458 |  | 
| Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2459 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = { | 
| Anirudh Ghayal | c216347 | 2012-04-10 14:58:14 +0530 | [diff] [blame] | 2460 | 	.clk_freq = 384000, | 
| Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2461 | 	.src_clk_rate = 24000000, | 
 | 2462 | }; | 
 | 2463 |  | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2464 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = { | 
 | 2465 | 	.clk_freq = 100000, | 
 | 2466 | 	.src_clk_rate = 24000000, | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2467 | }; | 
 | 2468 |  | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 2469 | static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = { | 
 | 2470 | 	.clk_freq = 100000, | 
 | 2471 | 	.src_clk_rate = 24000000, | 
 | 2472 | }; | 
 | 2473 |  | 
| David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2474 | #define GSBI_DUAL_MODE_CODE 0x60 | 
 | 2475 | #define MSM_GSBI1_PHYS		0x12440000 | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2476 | static void __init apq8064_i2c_init(void) | 
 | 2477 | { | 
| David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2478 | 	void __iomem *gsbi_mem; | 
 | 2479 |  | 
 | 2480 | 	apq8064_device_qup_i2c_gsbi1.dev.platform_data = | 
 | 2481 | 					&apq8064_i2c_qup_gsbi1_pdata; | 
 | 2482 | 	gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4); | 
 | 2483 | 	writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem); | 
 | 2484 | 	/* Ensure protocol code is written before proceeding */ | 
 | 2485 | 	wmb(); | 
 | 2486 | 	iounmap(gsbi_mem); | 
 | 2487 | 	apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1; | 
| Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2488 | 	apq8064_device_qup_i2c_gsbi3.dev.platform_data = | 
 | 2489 | 					&apq8064_i2c_qup_gsbi3_pdata; | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2490 | 	apq8064_device_qup_i2c_gsbi1.dev.platform_data = | 
 | 2491 | 					&apq8064_i2c_qup_gsbi1_pdata; | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2492 | 	apq8064_device_qup_i2c_gsbi4.dev.platform_data = | 
 | 2493 | 					&apq8064_i2c_qup_gsbi4_pdata; | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 2494 | 	mpq8064_device_qup_i2c_gsbi5.dev.platform_data = | 
 | 2495 | 					&mpq8064_i2c_qup_gsbi5_pdata; | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2496 | } | 
 | 2497 |  | 
| Stepan Moskovchenko | c71c979 | 2012-01-31 18:12:44 -0800 | [diff] [blame] | 2498 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) | 
| Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 2499 | static int ethernet_init(void) | 
 | 2500 | { | 
 | 2501 | 	int ret; | 
 | 2502 | 	ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); | 
 | 2503 | 	if (ret) { | 
 | 2504 | 		pr_err("ks8851 gpio_request failed: %d\n", ret); | 
 | 2505 | 		goto fail; | 
 | 2506 | 	} | 
 | 2507 |  | 
 | 2508 | 	return 0; | 
 | 2509 | fail: | 
 | 2510 | 	return ret; | 
 | 2511 | } | 
 | 2512 | #else | 
 | 2513 | static int ethernet_init(void) | 
 | 2514 | { | 
 | 2515 | 	return 0; | 
 | 2516 | } | 
 | 2517 | #endif | 
 | 2518 |  | 
| Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2519 | #define GPIO_KEY_HOME		PM8921_GPIO_PM_TO_SYS(27) | 
 | 2520 | #define GPIO_KEY_VOLUME_UP	PM8921_GPIO_PM_TO_SYS(35) | 
 | 2521 | #define GPIO_KEY_VOLUME_DOWN	PM8921_GPIO_PM_TO_SYS(38) | 
 | 2522 | #define GPIO_KEY_CAM_FOCUS	PM8921_GPIO_PM_TO_SYS(3) | 
 | 2523 | #define GPIO_KEY_CAM_SNAP	PM8921_GPIO_PM_TO_SYS(4) | 
| Jing Lin | 3f8f842 | 2012-03-05 09:32:11 -0800 | [diff] [blame] | 2524 | #define GPIO_KEY_ROTATION	PM8921_GPIO_PM_TO_SYS(42) | 
| Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2525 |  | 
 | 2526 | static struct gpio_keys_button cdp_keys[] = { | 
 | 2527 | 	{ | 
 | 2528 | 		.code           = KEY_HOME, | 
 | 2529 | 		.gpio           = GPIO_KEY_HOME, | 
 | 2530 | 		.desc           = "home_key", | 
 | 2531 | 		.active_low     = 1, | 
 | 2532 | 		.type		= EV_KEY, | 
 | 2533 | 		.wakeup		= 1, | 
 | 2534 | 		.debounce_interval = 15, | 
 | 2535 | 	}, | 
 | 2536 | 	{ | 
 | 2537 | 		.code           = KEY_VOLUMEUP, | 
 | 2538 | 		.gpio           = GPIO_KEY_VOLUME_UP, | 
 | 2539 | 		.desc           = "volume_up_key", | 
 | 2540 | 		.active_low     = 1, | 
 | 2541 | 		.type		= EV_KEY, | 
 | 2542 | 		.wakeup		= 1, | 
 | 2543 | 		.debounce_interval = 15, | 
 | 2544 | 	}, | 
 | 2545 | 	{ | 
 | 2546 | 		.code           = KEY_VOLUMEDOWN, | 
 | 2547 | 		.gpio           = GPIO_KEY_VOLUME_DOWN, | 
 | 2548 | 		.desc           = "volume_down_key", | 
 | 2549 | 		.active_low     = 1, | 
 | 2550 | 		.type		= EV_KEY, | 
 | 2551 | 		.wakeup		= 1, | 
 | 2552 | 		.debounce_interval = 15, | 
 | 2553 | 	}, | 
 | 2554 | 	{ | 
 | 2555 | 		.code           = SW_ROTATE_LOCK, | 
 | 2556 | 		.gpio           = GPIO_KEY_ROTATION, | 
 | 2557 | 		.desc           = "rotate_key", | 
 | 2558 | 		.active_low     = 1, | 
 | 2559 | 		.type		= EV_SW, | 
 | 2560 | 		.debounce_interval = 15, | 
 | 2561 | 	}, | 
 | 2562 | }; | 
 | 2563 |  | 
 | 2564 | static struct gpio_keys_platform_data cdp_keys_data = { | 
 | 2565 | 	.buttons        = cdp_keys, | 
 | 2566 | 	.nbuttons       = ARRAY_SIZE(cdp_keys), | 
 | 2567 | }; | 
 | 2568 |  | 
 | 2569 | static struct platform_device cdp_kp_pdev = { | 
 | 2570 | 	.name           = "gpio-keys", | 
 | 2571 | 	.id             = -1, | 
 | 2572 | 	.dev            = { | 
 | 2573 | 		.platform_data  = &cdp_keys_data, | 
 | 2574 | 	}, | 
 | 2575 | }; | 
 | 2576 |  | 
 | 2577 | static struct gpio_keys_button mtp_keys[] = { | 
 | 2578 | 	{ | 
 | 2579 | 		.code           = KEY_CAMERA_FOCUS, | 
 | 2580 | 		.gpio           = GPIO_KEY_CAM_FOCUS, | 
 | 2581 | 		.desc           = "cam_focus_key", | 
 | 2582 | 		.active_low     = 1, | 
 | 2583 | 		.type		= EV_KEY, | 
 | 2584 | 		.wakeup		= 1, | 
 | 2585 | 		.debounce_interval = 15, | 
 | 2586 | 	}, | 
 | 2587 | 	{ | 
 | 2588 | 		.code           = KEY_VOLUMEUP, | 
 | 2589 | 		.gpio           = GPIO_KEY_VOLUME_UP, | 
 | 2590 | 		.desc           = "volume_up_key", | 
 | 2591 | 		.active_low     = 1, | 
 | 2592 | 		.type		= EV_KEY, | 
 | 2593 | 		.wakeup		= 1, | 
 | 2594 | 		.debounce_interval = 15, | 
 | 2595 | 	}, | 
 | 2596 | 	{ | 
 | 2597 | 		.code           = KEY_VOLUMEDOWN, | 
 | 2598 | 		.gpio           = GPIO_KEY_VOLUME_DOWN, | 
 | 2599 | 		.desc           = "volume_down_key", | 
 | 2600 | 		.active_low     = 1, | 
 | 2601 | 		.type		= EV_KEY, | 
 | 2602 | 		.wakeup		= 1, | 
 | 2603 | 		.debounce_interval = 15, | 
 | 2604 | 	}, | 
 | 2605 | 	{ | 
 | 2606 | 		.code           = KEY_CAMERA_SNAPSHOT, | 
 | 2607 | 		.gpio           = GPIO_KEY_CAM_SNAP, | 
 | 2608 | 		.desc           = "cam_snap_key", | 
 | 2609 | 		.active_low     = 1, | 
 | 2610 | 		.type		= EV_KEY, | 
 | 2611 | 		.debounce_interval = 15, | 
 | 2612 | 	}, | 
 | 2613 | }; | 
 | 2614 |  | 
 | 2615 | static struct gpio_keys_platform_data mtp_keys_data = { | 
 | 2616 | 	.buttons        = mtp_keys, | 
 | 2617 | 	.nbuttons       = ARRAY_SIZE(mtp_keys), | 
 | 2618 | }; | 
 | 2619 |  | 
 | 2620 | static struct platform_device mtp_kp_pdev = { | 
 | 2621 | 	.name           = "gpio-keys", | 
 | 2622 | 	.id             = -1, | 
 | 2623 | 	.dev            = { | 
 | 2624 | 		.platform_data  = &mtp_keys_data, | 
 | 2625 | 	}, | 
 | 2626 | }; | 
 | 2627 |  | 
| Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 2628 | static struct gpio_keys_button mpq_keys[] = { | 
 | 2629 | 	{ | 
 | 2630 | 		.code           = KEY_VOLUMEDOWN, | 
 | 2631 | 		.gpio           = GPIO_KEY_VOLUME_DOWN, | 
 | 2632 | 		.desc           = "volume_down_key", | 
 | 2633 | 		.active_low     = 1, | 
 | 2634 | 		.type		= EV_KEY, | 
 | 2635 | 		.wakeup		= 1, | 
 | 2636 | 		.debounce_interval = 15, | 
 | 2637 | 	}, | 
 | 2638 | 	{ | 
 | 2639 | 		.code           = KEY_VOLUMEUP, | 
 | 2640 | 		.gpio           = GPIO_KEY_VOLUME_UP, | 
 | 2641 | 		.desc           = "volume_up_key", | 
 | 2642 | 		.active_low     = 1, | 
 | 2643 | 		.type		= EV_KEY, | 
 | 2644 | 		.wakeup		= 1, | 
 | 2645 | 		.debounce_interval = 15, | 
 | 2646 | 	}, | 
 | 2647 | }; | 
 | 2648 |  | 
 | 2649 | static struct gpio_keys_platform_data mpq_keys_data = { | 
 | 2650 | 	.buttons        = mpq_keys, | 
 | 2651 | 	.nbuttons       = ARRAY_SIZE(mpq_keys), | 
 | 2652 | }; | 
 | 2653 |  | 
 | 2654 | static struct platform_device mpq_gpio_keys_pdev = { | 
 | 2655 | 	.name           = "gpio-keys", | 
 | 2656 | 	.id             = -1, | 
 | 2657 | 	.dev            = { | 
 | 2658 | 		.platform_data  = &mpq_keys_data, | 
 | 2659 | 	}, | 
 | 2660 | }; | 
 | 2661 |  | 
 | 2662 | #define MPQ_KP_ROW_BASE		SX150X_EXP2_GPIO_BASE | 
 | 2663 | #define MPQ_KP_COL_BASE		(SX150X_EXP2_GPIO_BASE + 4) | 
 | 2664 |  | 
 | 2665 | static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1, | 
 | 2666 | 				MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3}; | 
 | 2667 | static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1, | 
 | 2668 | 				MPQ_KP_COL_BASE + 2}; | 
 | 2669 |  | 
 | 2670 | static const unsigned int mpq_keymap[] = { | 
 | 2671 | 	KEY(0, 0, KEY_UP), | 
 | 2672 | 	KEY(0, 1, KEY_ENTER), | 
 | 2673 | 	KEY(0, 2, KEY_3), | 
 | 2674 |  | 
 | 2675 | 	KEY(1, 0, KEY_DOWN), | 
 | 2676 | 	KEY(1, 1, KEY_EXIT), | 
 | 2677 | 	KEY(1, 2, KEY_4), | 
 | 2678 |  | 
 | 2679 | 	KEY(2, 0, KEY_LEFT), | 
 | 2680 | 	KEY(2, 1, KEY_1), | 
 | 2681 | 	KEY(2, 2, KEY_5), | 
 | 2682 |  | 
 | 2683 | 	KEY(3, 0, KEY_RIGHT), | 
 | 2684 | 	KEY(3, 1, KEY_2), | 
 | 2685 | 	KEY(3, 2, KEY_6), | 
 | 2686 | }; | 
 | 2687 |  | 
 | 2688 | static struct matrix_keymap_data mpq_keymap_data = { | 
 | 2689 | 	.keymap_size	= ARRAY_SIZE(mpq_keymap), | 
 | 2690 | 	.keymap		= mpq_keymap, | 
 | 2691 | }; | 
 | 2692 |  | 
 | 2693 | static struct matrix_keypad_platform_data mpq_keypad_data = { | 
 | 2694 | 	.keymap_data		= &mpq_keymap_data, | 
 | 2695 | 	.row_gpios		= mpq_row_gpios, | 
 | 2696 | 	.col_gpios		= mpq_col_gpios, | 
 | 2697 | 	.num_row_gpios		= ARRAY_SIZE(mpq_row_gpios), | 
 | 2698 | 	.num_col_gpios		= ARRAY_SIZE(mpq_col_gpios), | 
 | 2699 | 	.col_scan_delay_us	= 32000, | 
 | 2700 | 	.debounce_ms		= 20, | 
 | 2701 | 	.wakeup			= 1, | 
 | 2702 | 	.active_low		= 1, | 
 | 2703 | 	.no_autorepeat		= 1, | 
 | 2704 | }; | 
 | 2705 |  | 
 | 2706 | static struct platform_device mpq_keypad_device = { | 
 | 2707 | 	.name           = "matrix-keypad", | 
 | 2708 | 	.id             = -1, | 
 | 2709 | 	.dev            = { | 
 | 2710 | 		.platform_data  = &mpq_keypad_data, | 
 | 2711 | 	}, | 
 | 2712 | }; | 
 | 2713 |  | 
| Jin Hong | d3024e6 | 2012-02-09 16:13:32 -0800 | [diff] [blame] | 2714 | /* Sensors DSPS platform data */ | 
 | 2715 | #define DSPS_PIL_GENERIC_NAME		"dsps" | 
 | 2716 | static void __init apq8064_init_dsps(void) | 
 | 2717 | { | 
 | 2718 | 	struct msm_dsps_platform_data *pdata = | 
 | 2719 | 		msm_dsps_device_8064.dev.platform_data; | 
 | 2720 | 	pdata->pil_name = DSPS_PIL_GENERIC_NAME; | 
 | 2721 | 	pdata->gpios = NULL; | 
 | 2722 | 	pdata->gpios_num = 0; | 
 | 2723 |  | 
 | 2724 | 	platform_device_register(&msm_dsps_device_8064); | 
 | 2725 | } | 
| Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2726 |  | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2727 | #define I2C_SURF 1 | 
 | 2728 | #define I2C_FFA  (1 << 1) | 
 | 2729 | #define I2C_RUMI (1 << 2) | 
 | 2730 | #define I2C_SIM  (1 << 3) | 
 | 2731 | #define I2C_LIQUID (1 << 4) | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2732 | #define I2C_MPQ_CDP	BIT(5) | 
 | 2733 | #define I2C_MPQ_HRD	BIT(6) | 
 | 2734 | #define I2C_MPQ_DTV	BIT(7) | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2735 |  | 
 | 2736 | struct i2c_registry { | 
 | 2737 | 	u8                     machs; | 
 | 2738 | 	int                    bus; | 
 | 2739 | 	struct i2c_board_info *info; | 
 | 2740 | 	int                    len; | 
 | 2741 | }; | 
 | 2742 |  | 
 | 2743 | static struct i2c_registry apq8064_i2c_devices[] __initdata = { | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 2744 | 	{ | 
| David Keitel | 2f613d9 | 2012-02-15 11:29:16 -0800 | [diff] [blame] | 2745 | 		I2C_LIQUID, | 
 | 2746 | 		APQ_8064_GSBI1_QUP_I2C_BUS_ID, | 
 | 2747 | 		smb349_charger_i2c_info, | 
 | 2748 | 		ARRAY_SIZE(smb349_charger_i2c_info) | 
 | 2749 | 	}, | 
 | 2750 | 	{ | 
| Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 2751 | 		I2C_SURF | I2C_LIQUID, | 
 | 2752 | 		APQ_8064_GSBI3_QUP_I2C_BUS_ID, | 
 | 2753 | 		mxt_device_info, | 
 | 2754 | 		ARRAY_SIZE(mxt_device_info), | 
 | 2755 | 	}, | 
| Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 2756 | 	{ | 
 | 2757 | 		I2C_FFA, | 
 | 2758 | 		APQ_8064_GSBI3_QUP_I2C_BUS_ID, | 
 | 2759 | 		cyttsp_info, | 
 | 2760 | 		ARRAY_SIZE(cyttsp_info), | 
 | 2761 | 	}, | 
| Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 2762 | 	{ | 
 | 2763 | 		I2C_FFA | I2C_LIQUID, | 
 | 2764 | 		APQ_8064_GSBI1_QUP_I2C_BUS_ID, | 
 | 2765 | 		isa1200_board_info, | 
 | 2766 | 		ARRAY_SIZE(isa1200_board_info), | 
 | 2767 | 	}, | 
| Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 2768 | 	{ | 
 | 2769 | 		I2C_MPQ_CDP, | 
 | 2770 | 		APQ_8064_GSBI5_QUP_I2C_BUS_ID, | 
 | 2771 | 		cs8427_device_info, | 
 | 2772 | 		ARRAY_SIZE(cs8427_device_info), | 
 | 2773 | 	}, | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2774 | }; | 
 | 2775 |  | 
| Jay Chokshi | 607f61b | 2012-04-25 18:21:21 -0700 | [diff] [blame] | 2776 | #define SX150X_EXP1_INT_N	PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9) | 
| Anirudh Ghayal | 9f1aaa7 | 2012-04-26 18:15:08 +0530 | [diff] [blame] | 2777 | #define SX150X_EXP2_INT_N	MSM_GPIO_TO_INT(81) | 
| Jay Chokshi | 607f61b | 2012-04-25 18:21:21 -0700 | [diff] [blame] | 2778 |  | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2779 | struct sx150x_platform_data mpq8064_sx150x_pdata[] = { | 
 | 2780 | 	[SX150X_EXP1] = { | 
 | 2781 | 		.gpio_base	= SX150X_EXP1_GPIO_BASE, | 
 | 2782 | 		.oscio_is_gpo	= false, | 
 | 2783 | 		.io_pullup_ena	= 0x0, | 
 | 2784 | 		.io_pulldn_ena	= 0x0, | 
 | 2785 | 		.io_open_drain_ena = 0x0, | 
 | 2786 | 		.io_polarity	= 0, | 
| Jay Chokshi | 607f61b | 2012-04-25 18:21:21 -0700 | [diff] [blame] | 2787 | 		.irq_summary	= SX150X_EXP1_INT_N, | 
 | 2788 | 		.irq_base	= SX150X_EXP1_IRQ_BASE, | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2789 | 	}, | 
 | 2790 | 	[SX150X_EXP2] = { | 
 | 2791 | 		.gpio_base	= SX150X_EXP2_GPIO_BASE, | 
 | 2792 | 		.oscio_is_gpo	= false, | 
| Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 2793 | 		.io_pullup_ena	= 0x0f, | 
 | 2794 | 		.io_pulldn_ena	= 0x70, | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2795 | 		.io_open_drain_ena = 0x0, | 
 | 2796 | 		.io_polarity	= 0, | 
| Anirudh Ghayal | 9f1aaa7 | 2012-04-26 18:15:08 +0530 | [diff] [blame] | 2797 | 		.irq_summary	= SX150X_EXP2_INT_N, | 
 | 2798 | 		.irq_base	= SX150X_EXP2_IRQ_BASE, | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2799 | 	}, | 
 | 2800 | 	[SX150X_EXP3] = { | 
 | 2801 | 		.gpio_base	= SX150X_EXP3_GPIO_BASE, | 
 | 2802 | 		.oscio_is_gpo	= false, | 
 | 2803 | 		.io_pullup_ena	= 0x0, | 
 | 2804 | 		.io_pulldn_ena	= 0x0, | 
 | 2805 | 		.io_open_drain_ena = 0x0, | 
 | 2806 | 		.io_polarity	= 0, | 
 | 2807 | 		.irq_summary	= -1, | 
 | 2808 | 	}, | 
 | 2809 | 	[SX150X_EXP4] = { | 
 | 2810 | 		.gpio_base	= SX150X_EXP4_GPIO_BASE, | 
 | 2811 | 		.oscio_is_gpo	= false, | 
 | 2812 | 		.io_pullup_ena	= 0x0, | 
 | 2813 | 		.io_pulldn_ena	= 0x0, | 
 | 2814 | 		.io_open_drain_ena = 0x0, | 
 | 2815 | 		.io_polarity	= 0, | 
 | 2816 | 		.irq_summary	= -1, | 
 | 2817 | 	}, | 
 | 2818 | }; | 
 | 2819 |  | 
 | 2820 | static struct i2c_board_info sx150x_gpio_exp_info[] = { | 
 | 2821 | 	{ | 
 | 2822 | 		I2C_BOARD_INFO("sx1509q", 0x70), | 
 | 2823 | 		.platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1], | 
 | 2824 | 	}, | 
 | 2825 | 	{ | 
 | 2826 | 		I2C_BOARD_INFO("sx1508q", 0x23), | 
 | 2827 | 		.platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2], | 
 | 2828 | 	}, | 
 | 2829 | 	{ | 
 | 2830 | 		I2C_BOARD_INFO("sx1508q", 0x22), | 
 | 2831 | 		.platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3], | 
 | 2832 | 	}, | 
 | 2833 | 	{ | 
 | 2834 | 		I2C_BOARD_INFO("sx1509q", 0x3E), | 
 | 2835 | 		.platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4], | 
 | 2836 | 	}, | 
 | 2837 | }; | 
 | 2838 |  | 
 | 2839 | #define MPQ8064_I2C_GSBI5_BUS_ID	5 | 
 | 2840 |  | 
 | 2841 | static struct i2c_registry mpq8064_i2c_devices[] __initdata = { | 
 | 2842 | 	{ | 
 | 2843 | 		I2C_MPQ_CDP, | 
 | 2844 | 		MPQ8064_I2C_GSBI5_BUS_ID, | 
 | 2845 | 		sx150x_gpio_exp_info, | 
 | 2846 | 		ARRAY_SIZE(sx150x_gpio_exp_info), | 
 | 2847 | 	}, | 
 | 2848 | }; | 
 | 2849 |  | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2850 | static void __init register_i2c_devices(void) | 
 | 2851 | { | 
 | 2852 | 	u8 mach_mask = 0; | 
 | 2853 | 	int i; | 
 | 2854 |  | 
| Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 2855 | #ifdef CONFIG_MSM_CAMERA | 
 | 2856 | 	struct i2c_registry apq8064_camera_i2c_devices = { | 
 | 2857 | 		I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI, | 
 | 2858 | 		APQ_8064_GSBI4_QUP_I2C_BUS_ID, | 
 | 2859 | 		apq8064_camera_board_info.board_info, | 
 | 2860 | 		apq8064_camera_board_info.num_i2c_board_info, | 
 | 2861 | 	}; | 
 | 2862 | #endif | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2863 | 	/* Build the matching 'supported_machs' bitmask */ | 
 | 2864 | 	if (machine_is_apq8064_cdp()) | 
 | 2865 | 		mach_mask = I2C_SURF; | 
 | 2866 | 	else if (machine_is_apq8064_mtp()) | 
 | 2867 | 		mach_mask = I2C_FFA; | 
 | 2868 | 	else if (machine_is_apq8064_liquid()) | 
 | 2869 | 		mach_mask = I2C_LIQUID; | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2870 | 	else if (PLATFORM_IS_MPQ8064()) | 
 | 2871 | 		mach_mask = I2C_MPQ_CDP; | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2872 | 	else | 
 | 2873 | 		pr_err("unmatched machine ID in register_i2c_devices\n"); | 
 | 2874 |  | 
 | 2875 | 	/* Run the array and install devices as appropriate */ | 
 | 2876 | 	for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) { | 
 | 2877 | 		if (apq8064_i2c_devices[i].machs & mach_mask) | 
 | 2878 | 			i2c_register_board_info(apq8064_i2c_devices[i].bus, | 
 | 2879 | 						apq8064_i2c_devices[i].info, | 
 | 2880 | 						apq8064_i2c_devices[i].len); | 
 | 2881 | 	} | 
| Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 2882 | #ifdef CONFIG_MSM_CAMERA | 
 | 2883 | 	if (apq8064_camera_i2c_devices.machs & mach_mask) | 
 | 2884 | 		i2c_register_board_info(apq8064_camera_i2c_devices.bus, | 
 | 2885 | 			apq8064_camera_i2c_devices.info, | 
 | 2886 | 			apq8064_camera_i2c_devices.len); | 
 | 2887 | #endif | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2888 |  | 
 | 2889 | 	for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) { | 
 | 2890 | 		if (mpq8064_i2c_devices[i].machs & mach_mask) | 
 | 2891 | 			i2c_register_board_info( | 
 | 2892 | 					mpq8064_i2c_devices[i].bus, | 
 | 2893 | 					mpq8064_i2c_devices[i].info, | 
 | 2894 | 					mpq8064_i2c_devices[i].len); | 
 | 2895 | 	} | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2896 | } | 
 | 2897 |  | 
| Jay Chokshi | 994ff12 | 2012-03-27 15:43:48 -0700 | [diff] [blame] | 2898 | static void enable_ddr3_regulator(void) | 
 | 2899 | { | 
 | 2900 | 	static struct regulator *ext_ddr3; | 
 | 2901 |  | 
 | 2902 | 	/* Use MPP7 output state as a flag for PCDDR3 presence. */ | 
 | 2903 | 	if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) { | 
 | 2904 | 		ext_ddr3 = regulator_get(NULL, "ext_ddr3"); | 
 | 2905 | 		if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL) | 
 | 2906 | 			pr_err("Could not get MPP7 regulator\n"); | 
 | 2907 | 		else | 
 | 2908 | 			regulator_enable(ext_ddr3); | 
 | 2909 | 	} | 
 | 2910 | } | 
 | 2911 |  | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2912 | static void enable_avc_i2c_bus(void) | 
 | 2913 | { | 
 | 2914 | 	int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8); | 
 | 2915 | 	int rc; | 
 | 2916 |  | 
 | 2917 | 	rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en"); | 
 | 2918 | 	if (rc) | 
 | 2919 | 		pr_err("request for avc_i2c_en mpp failed," | 
 | 2920 | 						 "rc=%d\n", rc); | 
 | 2921 | 	else | 
 | 2922 | 		gpio_set_value_cansleep(avc_i2c_en_mpp, 1); | 
 | 2923 | } | 
 | 2924 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2925 | static void __init apq8064_common_init(void) | 
 | 2926 | { | 
| Ameya Thakur | e155ece | 2012-07-09 12:08:37 -0700 | [diff] [blame] | 2927 | 	u32 platform_version; | 
| Rohit Vaswani | b1cc493 | 2012-07-23 21:30:11 -0700 | [diff] [blame] | 2928 | 	platform_device_register(&msm_gpio_device); | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 2929 | 	msm_tsens_early_init(&apq_tsens_pdata); | 
| Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 2930 | 	msm_thermal_init(&msm_thermal_pdata); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2931 | 	if (socinfo_init() < 0) | 
 | 2932 | 		pr_err("socinfo_init() failed!\n"); | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2933 | 	BUG_ON(msm_rpm_init(&apq8064_rpm_data)); | 
 | 2934 | 	BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data)); | 
| David Collins | 2782b5c | 2012-02-06 10:02:42 -0800 | [diff] [blame] | 2935 | 	regulator_suppress_info_printing(); | 
 | 2936 | 	platform_device_register(&apq8064_device_rpm_regulator); | 
| Stephen Boyd | 4d0d258 | 2012-02-10 14:49:40 -0800 | [diff] [blame] | 2937 | 	if (msm_xo_init()) | 
 | 2938 | 		pr_err("Failed to initialize XO votes\n"); | 
| Matt Wagantall | c51e560 | 2012-02-27 17:25:25 -0800 | [diff] [blame] | 2939 | 	msm_clock_init(&apq8064_clock_init_data); | 
| Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 2940 | 	apq8064_init_gpiomux(); | 
| Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2941 | 	apq8064_i2c_init(); | 
| Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2942 | 	register_i2c_devices(); | 
| Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 2943 |  | 
| Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2944 | 	apq8064_device_qup_spi_gsbi5.dev.platform_data = | 
 | 2945 | 						&apq8064_qup_spi_gsbi5_pdata; | 
| Stepan Moskovchenko | c1074f0 | 2011-12-14 17:51:57 -0800 | [diff] [blame] | 2946 | 	apq8064_init_pmic(); | 
| Hemant Kumar | 94e7da2 | 2012-02-03 16:52:29 -0800 | [diff] [blame] | 2947 | 	if (machine_is_apq8064_liquid()) | 
 | 2948 | 		msm_otg_pdata.mhl_enable = true; | 
| Vamsi Krishna | d9863eb | 2012-03-26 17:34:48 -0700 | [diff] [blame] | 2949 |  | 
| Ofir Cohen | 94213a7 | 2012-05-03 14:26:32 +0300 | [diff] [blame] | 2950 | 	android_usb_pdata.swfi_latency = | 
 | 2951 | 		msm_rpmrs_levels[0].latency_us; | 
| Vamsi Krishna | d9863eb | 2012-03-26 17:34:48 -0700 | [diff] [blame] | 2952 |  | 
| Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 2953 | 	apq8064_device_otg.dev.platform_data = &msm_otg_pdata; | 
| Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 2954 | 	apq8064_ehci_host_init(); | 
| Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 2955 | 	apq8064_init_buses(); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2956 | 	platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); | 
| Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2957 | 	if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || | 
 | 2958 | 			machine_is_mpq8064_dtv())) | 
 | 2959 | 		platform_add_devices(common_not_mpq_devices, | 
 | 2960 | 			ARRAY_SIZE(common_not_mpq_devices)); | 
| Jay Chokshi | 994ff12 | 2012-03-27 15:43:48 -0700 | [diff] [blame] | 2961 | 	enable_ddr3_regulator(); | 
| Hemant Kumar | f1ca919 | 2012-02-07 18:59:33 -0800 | [diff] [blame] | 2962 | 	if (machine_is_apq8064_mtp()) { | 
| Ajay Dudani | c4e40db | 2012-08-20 14:44:40 -0700 | [diff] [blame] | 2963 | 		msm_hsic_pdata.log2_irq_thresh = 5, | 
| Hemant Kumar | f1ca919 | 2012-02-07 18:59:33 -0800 | [diff] [blame] | 2964 | 		apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata; | 
 | 2965 | 		device_initialize(&apq8064_device_hsic_host.dev); | 
 | 2966 | 	} | 
| Jay Chokshi | e874128 | 2012-01-25 15:22:55 -0800 | [diff] [blame] | 2967 | 	apq8064_pm8xxx_gpio_mpp_init(); | 
| Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 2968 | 	apq8064_init_mmc(); | 
| Swaminathan Sathappan | 144b488 | 2012-02-06 17:01:20 -0800 | [diff] [blame] | 2969 |  | 
 | 2970 | 	if (machine_is_apq8064_mtp()) { | 
 | 2971 | 		mdm_8064_device.dev.platform_data = &mdm_platform_data; | 
| Ameya Thakur | e155ece | 2012-07-09 12:08:37 -0700 | [diff] [blame] | 2972 | 		platform_version = socinfo_get_platform_version(); | 
 | 2973 | 		if (SOCINFO_VERSION_MINOR(platform_version) == 1) { | 
 | 2974 | 			i2s_mdm_8064_device.dev.platform_data = | 
 | 2975 | 				&mdm_platform_data; | 
 | 2976 | 			platform_device_register(&i2s_mdm_8064_device); | 
 | 2977 | 		} else { | 
 | 2978 | 			mdm_8064_device.dev.platform_data = &mdm_platform_data; | 
 | 2979 | 			platform_device_register(&mdm_8064_device); | 
 | 2980 | 		} | 
| Swaminathan Sathappan | 144b488 | 2012-02-06 17:01:20 -0800 | [diff] [blame] | 2981 | 	} | 
 | 2982 | 	platform_device_register(&apq8064_slim_ctrl); | 
| Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 2983 | 	slim_register_board_info(apq8064_slim_devices, | 
 | 2984 | 		ARRAY_SIZE(apq8064_slim_devices)); | 
| Taniya Das | bbf633d | 2012-07-31 16:07:47 +0530 | [diff] [blame] | 2985 | 	if (!PLATFORM_IS_MPQ8064()) { | 
| Taniya Das | 30cae29 | 2012-07-31 15:56:12 +0530 | [diff] [blame] | 2986 | 		apq8064_init_dsps(); | 
| Taniya Das | bbf633d | 2012-07-31 16:07:47 +0530 | [diff] [blame] | 2987 | 		platform_device_register(&msm_8960_riva); | 
 | 2988 | 	} | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2989 | 	msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); | 
 | 2990 | 	msm_spm_l2_init(msm_spm_l2_data); | 
| Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2991 | 	BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); | 
| Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2992 | 	apq8064_epm_adc_init(); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2993 | } | 
 | 2994 |  | 
| Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 2995 | static void __init apq8064_allocate_memory_regions(void) | 
 | 2996 | { | 
 | 2997 | 	apq8064_allocate_fb_region(); | 
 | 2998 | } | 
 | 2999 |  | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3000 | static void __init apq8064_cdp_init(void) | 
 | 3001 | { | 
| Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 3002 | 	if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) | 
 | 3003 | 		pr_err("meminfo_init() failed!\n"); | 
| Amy Maloche | 609bb5e | 2012-08-03 09:41:42 -0700 | [diff] [blame] | 3004 | 	if (machine_is_apq8064_mtp() && | 
 | 3005 | 		SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1) | 
 | 3006 | 			cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT; | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3007 | 	apq8064_common_init(); | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3008 | 	if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || | 
 | 3009 | 		machine_is_mpq8064_dtv()) { | 
| Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3010 | 		enable_avc_i2c_bus(); | 
| Olav Haugan | ef95ae3 | 2012-05-15 09:50:30 -0700 | [diff] [blame] | 3011 | 		msm_rotator_set_split_iommu_domain(); | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3012 | 		platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices)); | 
| Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 3013 | 		mpq8064_pcie_init(); | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3014 | 	} else { | 
 | 3015 | 		ethernet_init(); | 
| Olav Haugan | ef95ae3 | 2012-05-15 09:50:30 -0700 | [diff] [blame] | 3016 | 		msm_rotator_set_split_iommu_domain(); | 
| Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3017 | 		platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); | 
 | 3018 | 		spi_register_board_info(spi_board_info, | 
 | 3019 | 						ARRAY_SIZE(spi_board_info)); | 
 | 3020 | 	} | 
| Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3021 | 	apq8064_init_fb(); | 
| Jordan Crouse | b3115fe | 2012-02-01 22:11:12 -0700 | [diff] [blame] | 3022 | 	apq8064_init_gpu(); | 
| Matt Wagantall | 1f65d9d | 2012-04-25 14:24:20 -0700 | [diff] [blame] | 3023 | 	platform_add_devices(apq8064_footswitch, apq8064_num_footswitch); | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3024 | #ifdef CONFIG_MSM_CAMERA | 
| Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 3025 | 	apq8064_init_cam(); | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3026 | #endif | 
| Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 3027 |  | 
 | 3028 | 	if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid()) | 
 | 3029 | 		platform_device_register(&cdp_kp_pdev); | 
 | 3030 |  | 
 | 3031 | 	if (machine_is_apq8064_mtp()) | 
 | 3032 | 		platform_device_register(&mtp_kp_pdev); | 
| Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 3033 |  | 
 | 3034 | 	change_memory_power = &apq8064_change_memory_power; | 
| Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 3035 |  | 
 | 3036 | 	if (machine_is_mpq8064_cdp()) { | 
 | 3037 | 		platform_device_register(&mpq_gpio_keys_pdev); | 
 | 3038 | 		platform_device_register(&mpq_keypad_device); | 
 | 3039 | 	} | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3040 | } | 
 | 3041 |  | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3042 | MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP") | 
 | 3043 | 	.map_io = apq8064_map_io, | 
 | 3044 | 	.reserve = apq8064_reserve, | 
 | 3045 | 	.init_irq = apq8064_init_irq, | 
 | 3046 | 	.handle_irq = gic_handle_irq, | 
 | 3047 | 	.timer = &msm_timer, | 
 | 3048 | 	.init_machine = apq8064_cdp_init, | 
| Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3049 | 	.init_early = apq8064_allocate_memory_regions, | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3050 | 	.init_very_early = apq8064_early_reserve, | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3051 | 	.restart = msm_restart, | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3052 | MACHINE_END | 
 | 3053 |  | 
 | 3054 | MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP") | 
 | 3055 | 	.map_io = apq8064_map_io, | 
 | 3056 | 	.reserve = apq8064_reserve, | 
 | 3057 | 	.init_irq = apq8064_init_irq, | 
 | 3058 | 	.handle_irq = gic_handle_irq, | 
 | 3059 | 	.timer = &msm_timer, | 
 | 3060 | 	.init_machine = apq8064_cdp_init, | 
| Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3061 | 	.init_early = apq8064_allocate_memory_regions, | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3062 | 	.init_very_early = apq8064_early_reserve, | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3063 | 	.restart = msm_restart, | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3064 | MACHINE_END | 
 | 3065 |  | 
 | 3066 | MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID") | 
 | 3067 | 	.map_io = apq8064_map_io, | 
 | 3068 | 	.reserve = apq8064_reserve, | 
 | 3069 | 	.init_irq = apq8064_init_irq, | 
 | 3070 | 	.handle_irq = gic_handle_irq, | 
 | 3071 | 	.timer = &msm_timer, | 
 | 3072 | 	.init_machine = apq8064_cdp_init, | 
| Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3073 | 	.init_early = apq8064_allocate_memory_regions, | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3074 | 	.init_very_early = apq8064_early_reserve, | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3075 | 	.restart = msm_restart, | 
| Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3076 | MACHINE_END | 
 | 3077 |  | 
| Joel King | 064bbf8 | 2012-04-01 13:23:39 -0700 | [diff] [blame] | 3078 | MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP") | 
 | 3079 | 	.map_io = apq8064_map_io, | 
 | 3080 | 	.reserve = apq8064_reserve, | 
 | 3081 | 	.init_irq = apq8064_init_irq, | 
 | 3082 | 	.handle_irq = gic_handle_irq, | 
 | 3083 | 	.timer = &msm_timer, | 
 | 3084 | 	.init_machine = apq8064_cdp_init, | 
 | 3085 | 	.init_early = apq8064_allocate_memory_regions, | 
 | 3086 | 	.init_very_early = apq8064_early_reserve, | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3087 | 	.restart = msm_restart, | 
| Joel King | 064bbf8 | 2012-04-01 13:23:39 -0700 | [diff] [blame] | 3088 | MACHINE_END | 
 | 3089 |  | 
| Joel King | 11ca820 | 2012-02-13 16:19:03 -0800 | [diff] [blame] | 3090 | MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD") | 
 | 3091 | 	.map_io = apq8064_map_io, | 
 | 3092 | 	.reserve = apq8064_reserve, | 
 | 3093 | 	.init_irq = apq8064_init_irq, | 
 | 3094 | 	.handle_irq = gic_handle_irq, | 
 | 3095 | 	.timer = &msm_timer, | 
 | 3096 | 	.init_machine = apq8064_cdp_init, | 
| Joel King | 3a57e77 | 2012-05-28 11:22:55 -0700 | [diff] [blame] | 3097 | 	.init_early = apq8064_allocate_memory_regions, | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3098 | 	.init_very_early = apq8064_early_reserve, | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3099 | 	.restart = msm_restart, | 
| Joel King | 11ca820 | 2012-02-13 16:19:03 -0800 | [diff] [blame] | 3100 | MACHINE_END | 
 | 3101 |  | 
 | 3102 | MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV") | 
 | 3103 | 	.map_io = apq8064_map_io, | 
 | 3104 | 	.reserve = apq8064_reserve, | 
 | 3105 | 	.init_irq = apq8064_init_irq, | 
 | 3106 | 	.handle_irq = gic_handle_irq, | 
 | 3107 | 	.timer = &msm_timer, | 
 | 3108 | 	.init_machine = apq8064_cdp_init, | 
| Joel King | 3a57e77 | 2012-05-28 11:22:55 -0700 | [diff] [blame] | 3109 | 	.init_early = apq8064_allocate_memory_regions, | 
| Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3110 | 	.init_very_early = apq8064_early_reserve, | 
| Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3111 | 	.restart = msm_restart, | 
| Joel King | 11ca820 | 2012-02-13 16:19:03 -0800 | [diff] [blame] | 3112 | MACHINE_END | 
 | 3113 |  |