| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2007 Google, Inc. | 
| Duy Truong | e833aca | 2013-02-12 13:35:08 -0800 | [diff] [blame^] | 3 | * Copyright (c) 2008-2012, The Linux Foundation. All rights reserved. | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 4 | * Author: Brian Swetland <swetland@google.com> | 
|  | 5 | * | 
|  | 6 | * This software is licensed under the terms of the GNU General Public | 
|  | 7 | * License version 2, as published by the Free Software Foundation, and | 
|  | 8 | * may be copied, distributed, and modified under those terms. | 
|  | 9 | * | 
|  | 10 | * This program is distributed in the hope that it will be useful, | 
|  | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 13 | * GNU General Public License for more details. | 
|  | 14 | * | 
|  | 15 | */ | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 16 | #include <linux/kernel.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <linux/gpio.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 18 | #include <linux/init.h> | 
|  | 19 | #include <linux/platform_device.h> | 
|  | 20 | #include <linux/input.h> | 
|  | 21 | #include <linux/io.h> | 
|  | 22 | #include <linux/delay.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 23 | #include <linux/bootmem.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 24 | #include <linux/power_supply.h> | 
|  | 25 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | #include <mach/msm_memtypes.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 27 | #include <mach/hardware.h> | 
|  | 28 | #include <asm/mach-types.h> | 
|  | 29 | #include <asm/mach/arch.h> | 
|  | 30 | #include <asm/mach/map.h> | 
|  | 31 | #include <asm/mach/flash.h> | 
|  | 32 | #include <asm/setup.h> | 
|  | 33 | #ifdef CONFIG_CACHE_L2X0 | 
|  | 34 | #include <asm/hardware/cache-l2x0.h> | 
|  | 35 | #endif | 
|  | 36 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 37 | #include <asm/mach/mmc.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 38 | #include <mach/vreg.h> | 
|  | 39 | #include <mach/mpp.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 40 | #include <mach/board.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 41 | #include <mach/pmic.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 42 | #include <mach/msm_iomap.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 43 | #include <mach/msm_rpcrouter.h> | 
|  | 44 | #include <mach/msm_hsusb.h> | 
|  | 45 | #include <mach/rpc_hsusb.h> | 
|  | 46 | #include <mach/rpc_pmapp.h> | 
|  | 47 | #include <mach/msm_serial_hs.h> | 
|  | 48 | #include <mach/memory.h> | 
|  | 49 | #include <mach/msm_battery.h> | 
|  | 50 | #include <mach/rpc_server_handset.h> | 
|  | 51 | #include <mach/msm_tsif.h> | 
|  | 52 | #include <mach/socinfo.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 53 |  | 
|  | 54 | #include <linux/mtd/nand.h> | 
|  | 55 | #include <linux/mtd/partitions.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 56 | #include <linux/i2c.h> | 
|  | 57 | #include <linux/android_pmem.h> | 
|  | 58 | #include <mach/camera.h> | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 59 |  | 
| Manu Gautam | 99ed391 | 2011-10-13 18:00:55 +0530 | [diff] [blame] | 60 | #ifdef CONFIG_USB_G_ANDROID | 
|  | 61 | #include <linux/usb/android.h> | 
|  | 62 | #include <mach/usbdiag.h> | 
|  | 63 | #endif | 
|  | 64 |  | 
| Pankaj Kumar | 75c86fd | 2011-10-01 18:51:09 +0530 | [diff] [blame] | 65 | #include "board-msm7627-regulator.h" | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 66 | #include "devices.h" | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 67 | #include "clock.h" | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 68 | #include "msm-keypad-devices.h" | 
| Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 69 | #include "pm.h" | 
| Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 70 | #include "pm-boot.h" | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 71 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 72 | #ifdef CONFIG_ARCH_MSM7X25 | 
|  | 73 | #define MSM_PMEM_MDP_SIZE	0xb21000 | 
|  | 74 | #define MSM_PMEM_ADSP_SIZE	0x97b000 | 
|  | 75 | #define MSM_PMEM_AUDIO_SIZE	0x121000 | 
|  | 76 | #define MSM_FB_SIZE		0x200000 | 
|  | 77 | #define PMEM_KERNEL_EBI1_SIZE	0x64000 | 
|  | 78 | #endif | 
|  | 79 |  | 
|  | 80 | #ifdef CONFIG_ARCH_MSM7X27 | 
|  | 81 | #define MSM_PMEM_MDP_SIZE	0x1B76000 | 
|  | 82 | #define MSM_PMEM_ADSP_SIZE	0xC8A000 | 
|  | 83 | #define MSM_PMEM_AUDIO_SIZE	0x5B000 | 
|  | 84 |  | 
|  | 85 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER | 
|  | 86 | #define MSM_FB_SIZE		0x233000 | 
|  | 87 | #else | 
|  | 88 | #define MSM_FB_SIZE		0x177000 | 
|  | 89 | #endif | 
|  | 90 |  | 
|  | 91 | #define PMEM_KERNEL_EBI1_SIZE	0x1C000 | 
|  | 92 | #endif | 
| Laxminath Kasam | 1f2cd2a | 2012-02-15 12:12:44 +0530 | [diff] [blame] | 93 | #define ADSP_RPC_PROG           0x3000000a | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 94 |  | 
|  | 95 | static struct resource smc91x_resources[] = { | 
|  | 96 | [0] = { | 
|  | 97 | .start	= 0x9C004300, | 
|  | 98 | .end	= 0x9C0043ff, | 
|  | 99 | .flags	= IORESOURCE_MEM, | 
|  | 100 | }, | 
|  | 101 | [1] = { | 
|  | 102 | .start	= MSM_GPIO_TO_INT(132), | 
|  | 103 | .end	= MSM_GPIO_TO_INT(132), | 
|  | 104 | .flags	= IORESOURCE_IRQ, | 
|  | 105 | }, | 
|  | 106 | }; | 
|  | 107 |  | 
|  | 108 | static struct platform_device smc91x_device = { | 
|  | 109 | .name		= "smc91x", | 
|  | 110 | .id		= 0, | 
|  | 111 | .num_resources	= ARRAY_SIZE(smc91x_resources), | 
|  | 112 | .resource	= smc91x_resources, | 
|  | 113 | }; | 
|  | 114 |  | 
| Manu Gautam | 99ed391 | 2011-10-13 18:00:55 +0530 | [diff] [blame] | 115 | #ifdef CONFIG_USB_G_ANDROID | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 116 | static struct android_usb_platform_data android_usb_pdata = { | 
| Manu Gautam | 99ed391 | 2011-10-13 18:00:55 +0530 | [diff] [blame] | 117 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 118 | }; | 
|  | 119 |  | 
|  | 120 | static struct platform_device android_usb_device = { | 
|  | 121 | .name	= "android_usb", | 
|  | 122 | .id		= -1, | 
|  | 123 | .dev		= { | 
|  | 124 | .platform_data = &android_usb_pdata, | 
|  | 125 | }, | 
|  | 126 | }; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 127 | #endif | 
|  | 128 |  | 
|  | 129 | #ifdef CONFIG_USB_EHCI_MSM_72K | 
|  | 130 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) | 
|  | 131 | { | 
|  | 132 | if (on) | 
|  | 133 | msm_hsusb_vbus_powerup(); | 
|  | 134 | else | 
|  | 135 | msm_hsusb_vbus_shutdown(); | 
|  | 136 | } | 
|  | 137 |  | 
|  | 138 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { | 
|  | 139 | .phy_info       = (USB_PHY_INTEGRATED | USB_PHY_MODEL_65NM), | 
|  | 140 | }; | 
|  | 141 |  | 
|  | 142 | static void __init msm7x2x_init_host(void) | 
|  | 143 | { | 
|  | 144 | if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) | 
|  | 145 | return; | 
|  | 146 |  | 
|  | 147 | msm_add_host(0, &msm_usb_host_pdata); | 
|  | 148 | } | 
|  | 149 | #endif | 
|  | 150 |  | 
|  | 151 | #ifdef CONFIG_USB_MSM_OTG_72K | 
|  | 152 | static int hsusb_rpc_connect(int connect) | 
|  | 153 | { | 
|  | 154 | if (connect) | 
|  | 155 | return msm_hsusb_rpc_connect(); | 
|  | 156 | else | 
|  | 157 | return msm_hsusb_rpc_close(); | 
|  | 158 | } | 
|  | 159 | #endif | 
|  | 160 |  | 
|  | 161 | #ifdef CONFIG_USB_MSM_OTG_72K | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 162 | static int msm_hsusb_ldo_init(int init) | 
|  | 163 | { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 164 | static struct regulator *reg_hsusb; | 
|  | 165 | int rc; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 166 | if (init) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 167 | reg_hsusb = regulator_get(NULL, "usb"); | 
|  | 168 | if (IS_ERR(reg_hsusb)) { | 
|  | 169 | rc = PTR_ERR(reg_hsusb); | 
|  | 170 | pr_err("%s: could not get regulator: %d\n", | 
|  | 171 | __func__, rc); | 
|  | 172 | goto out; | 
|  | 173 | } | 
|  | 174 |  | 
|  | 175 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); | 
|  | 176 | if (rc < 0) { | 
|  | 177 | pr_err("%s: could not set voltage: %d\n", | 
|  | 178 | __func__, rc); | 
|  | 179 | goto usb_reg_fail; | 
|  | 180 | } | 
|  | 181 |  | 
|  | 182 | rc = regulator_enable(reg_hsusb); | 
|  | 183 | if (rc < 0) { | 
|  | 184 | pr_err("%s: could not enable regulator: %d\n", | 
|  | 185 | __func__, rc); | 
|  | 186 | goto usb_reg_fail; | 
|  | 187 | } | 
|  | 188 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 189 | /* | 
|  | 190 | * PHY 3.3V analog domain(VDDA33) is powered up by | 
|  | 191 | * an always enabled power supply (LP5900TL-3.3). | 
|  | 192 | * USB VREG default source is VBUS line. Turning | 
|  | 193 | * on USB VREG has a side effect on the USB suspend | 
|  | 194 | * current. Hence USB VREG is explicitly turned | 
|  | 195 | * off here. | 
|  | 196 | */ | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 197 |  | 
|  | 198 | rc = regulator_disable(reg_hsusb); | 
|  | 199 | if (rc < 0) { | 
|  | 200 | pr_err("%s: could not disable regulator: %d\n", | 
|  | 201 | __func__, rc); | 
|  | 202 | goto usb_reg_fail; | 
|  | 203 | } | 
|  | 204 |  | 
|  | 205 | regulator_put(reg_hsusb); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 206 | } | 
|  | 207 |  | 
|  | 208 | return 0; | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 209 | usb_reg_fail: | 
|  | 210 | regulator_put(reg_hsusb); | 
|  | 211 | out: | 
|  | 212 | return rc; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 213 | } | 
|  | 214 |  | 
|  | 215 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) | 
|  | 216 | { | 
|  | 217 | int ret; | 
|  | 218 |  | 
|  | 219 | if (init) { | 
|  | 220 | ret = msm_pm_app_rpc_init(callback); | 
|  | 221 | } else { | 
|  | 222 | msm_pm_app_rpc_deinit(callback); | 
|  | 223 | ret = 0; | 
|  | 224 | } | 
|  | 225 | return ret; | 
|  | 226 | } | 
|  | 227 |  | 
|  | 228 | static int msm_otg_rpc_phy_reset(void __iomem *regs) | 
|  | 229 | { | 
|  | 230 | return msm_hsusb_phy_reset(); | 
|  | 231 | } | 
|  | 232 |  | 
|  | 233 | static struct msm_otg_platform_data msm_otg_pdata = { | 
|  | 234 | .rpc_connect	= hsusb_rpc_connect, | 
|  | 235 | .pmic_vbus_notif_init         = msm_hsusb_pmic_notif_init, | 
|  | 236 | .chg_vbus_draw		 = hsusb_chg_vbus_draw, | 
|  | 237 | .chg_connected		 = hsusb_chg_connected, | 
|  | 238 | .chg_init		 = hsusb_chg_init, | 
|  | 239 | #ifdef CONFIG_USB_EHCI_MSM_72K | 
|  | 240 | .vbus_power = msm_hsusb_vbus_power, | 
|  | 241 | #endif | 
|  | 242 | .ldo_init		= msm_hsusb_ldo_init, | 
|  | 243 | .pclk_required_during_lpm = 1, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 244 | }; | 
|  | 245 |  | 
|  | 246 | #ifdef CONFIG_USB_GADGET | 
|  | 247 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata; | 
|  | 248 | #endif | 
|  | 249 | #endif | 
|  | 250 |  | 
|  | 251 | #define SND(desc, num) { .name = #desc, .id = num } | 
|  | 252 | static struct snd_endpoint snd_endpoints_list[] = { | 
|  | 253 | SND(HANDSET, 0), | 
|  | 254 | SND(MONO_HEADSET, 2), | 
|  | 255 | SND(HEADSET, 3), | 
|  | 256 | SND(SPEAKER, 6), | 
|  | 257 | SND(TTY_HEADSET, 8), | 
|  | 258 | SND(TTY_VCO, 9), | 
|  | 259 | SND(TTY_HCO, 10), | 
|  | 260 | SND(BT, 12), | 
|  | 261 | SND(IN_S_SADC_OUT_HANDSET, 16), | 
|  | 262 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), | 
|  | 263 | SND(CURRENT, 27), | 
|  | 264 | }; | 
|  | 265 | #undef SND | 
|  | 266 |  | 
|  | 267 | static struct msm_snd_endpoints msm_device_snd_endpoints = { | 
|  | 268 | .endpoints = snd_endpoints_list, | 
|  | 269 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) | 
|  | 270 | }; | 
|  | 271 |  | 
|  | 272 | static struct platform_device msm_device_snd = { | 
|  | 273 | .name = "msm_snd", | 
|  | 274 | .id = -1, | 
|  | 275 | .dev    = { | 
|  | 276 | .platform_data = &msm_device_snd_endpoints | 
|  | 277 | }, | 
|  | 278 | }; | 
|  | 279 |  | 
|  | 280 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ | 
|  | 281 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ | 
|  | 282 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ | 
|  | 283 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ | 
|  | 284 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ | 
|  | 285 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) | 
|  | 286 | #ifdef CONFIG_ARCH_MSM7X25 | 
|  | 287 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_WAV)|(1<<MSM_ADSP_CODEC_ADPCM)| \ | 
|  | 288 | (1<<MSM_ADSP_CODEC_YADPCM)|(1<<MSM_ADSP_CODEC_QCELP)| \ | 
|  | 289 | (1<<MSM_ADSP_CODEC_MP3)) | 
|  | 290 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_WAV)|(1<<MSM_ADSP_CODEC_ADPCM)| \ | 
|  | 291 | (1<<MSM_ADSP_CODEC_YADPCM)|(1<<MSM_ADSP_CODEC_QCELP)| \ | 
|  | 292 | (1<<MSM_ADSP_CODEC_MP3)) | 
|  | 293 | #define DEC3_FORMAT 0 | 
|  | 294 | #define DEC4_FORMAT 0 | 
|  | 295 | #else | 
|  | 296 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ | 
|  | 297 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ | 
|  | 298 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ | 
|  | 299 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ | 
|  | 300 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ | 
|  | 301 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) | 
|  | 302 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ | 
|  | 303 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ | 
|  | 304 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ | 
|  | 305 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ | 
|  | 306 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ | 
|  | 307 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) | 
|  | 308 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ | 
|  | 309 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ | 
|  | 310 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ | 
|  | 311 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ | 
|  | 312 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ | 
|  | 313 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) | 
|  | 314 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) | 
|  | 315 | #endif | 
|  | 316 |  | 
|  | 317 | static unsigned int dec_concurrency_table[] = { | 
|  | 318 | /* Audio LP */ | 
|  | 319 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, | 
|  | 320 | 0, 0, 0, | 
|  | 321 |  | 
|  | 322 | /* Concurrency 1 */ | 
|  | 323 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 324 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 325 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 326 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 327 | (DEC4_FORMAT), | 
|  | 328 |  | 
|  | 329 | /* Concurrency 2 */ | 
|  | 330 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 331 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 332 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 333 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 334 | (DEC4_FORMAT), | 
|  | 335 |  | 
|  | 336 | /* Concurrency 3 */ | 
|  | 337 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 338 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 339 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 340 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 341 | (DEC4_FORMAT), | 
|  | 342 |  | 
|  | 343 | /* Concurrency 4 */ | 
|  | 344 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 345 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 346 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 347 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 348 | (DEC4_FORMAT), | 
|  | 349 |  | 
|  | 350 | /* Concurrency 5 */ | 
|  | 351 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 352 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 353 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 354 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 355 | (DEC4_FORMAT), | 
|  | 356 |  | 
|  | 357 | /* Concurrency 6 */ | 
|  | 358 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 359 | 0, 0, 0, 0, | 
|  | 360 |  | 
|  | 361 | /* Concurrency 7 */ | 
|  | 362 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 363 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 364 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 365 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), | 
|  | 366 | (DEC4_FORMAT), | 
|  | 367 | }; | 
|  | 368 |  | 
|  | 369 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ | 
|  | 370 | .module_queueid = queueid, .module_decid = decid, \ | 
|  | 371 | .nr_codec_support = nr_codec} | 
|  | 372 |  | 
|  | 373 | static struct msm_adspdec_info dec_info_list[] = { | 
|  | 374 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ | 
|  | 375 | #ifdef CONFIG_ARCH_MSM7X25 | 
|  | 376 | DEC_INFO("AUDPLAY1TASK", 14, 1, 5),  /* AudPlay1BitStreamCtrlQueue */ | 
|  | 377 | DEC_INFO("AUDPLAY2TASK", 15, 2, 5),  /* AudPlay2BitStreamCtrlQueue */ | 
|  | 378 | DEC_INFO("AUDPLAY3TASK", 16, 3, 0),  /* AudPlay3BitStreamCtrlQueue */ | 
|  | 379 | DEC_INFO("AUDPLAY4TASK", 17, 4, 0),  /* AudPlay4BitStreamCtrlQueue */ | 
|  | 380 | #else | 
|  | 381 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11),  /* AudPlay1BitStreamCtrlQueue */ | 
|  | 382 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11),  /* AudPlay2BitStreamCtrlQueue */ | 
|  | 383 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11),  /* AudPlay3BitStreamCtrlQueue */ | 
|  | 384 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1),  /* AudPlay4BitStreamCtrlQueue */ | 
|  | 385 | #endif | 
|  | 386 | }; | 
|  | 387 |  | 
|  | 388 | static struct msm_adspdec_database msm_device_adspdec_database = { | 
|  | 389 | .num_dec = ARRAY_SIZE(dec_info_list), | 
|  | 390 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ | 
|  | 391 | ARRAY_SIZE(dec_info_list)), | 
|  | 392 | .dec_concurrency_table = dec_concurrency_table, | 
|  | 393 | .dec_info_list = dec_info_list, | 
|  | 394 | }; | 
|  | 395 |  | 
|  | 396 | static struct platform_device msm_device_adspdec = { | 
|  | 397 | .name = "msm_adspdec", | 
|  | 398 | .id = -1, | 
|  | 399 | .dev    = { | 
|  | 400 | .platform_data = &msm_device_adspdec_database | 
|  | 401 | }, | 
|  | 402 | }; | 
|  | 403 |  | 
|  | 404 | static struct android_pmem_platform_data android_pmem_pdata = { | 
|  | 405 | .name = "pmem", | 
|  | 406 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, | 
|  | 407 | .cached = 1, | 
|  | 408 | .memory_type = MEMTYPE_EBI1, | 
|  | 409 | }; | 
|  | 410 |  | 
|  | 411 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { | 
|  | 412 | .name = "pmem_adsp", | 
|  | 413 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, | 
|  | 414 | .cached = 0, | 
|  | 415 | .memory_type = MEMTYPE_EBI1, | 
|  | 416 | }; | 
|  | 417 |  | 
|  | 418 | static struct android_pmem_platform_data android_pmem_audio_pdata = { | 
|  | 419 | .name = "pmem_audio", | 
|  | 420 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, | 
|  | 421 | .cached = 0, | 
|  | 422 | .memory_type = MEMTYPE_EBI1, | 
|  | 423 | }; | 
|  | 424 |  | 
|  | 425 | static struct platform_device android_pmem_device = { | 
|  | 426 | .name = "android_pmem", | 
|  | 427 | .id = 0, | 
|  | 428 | .dev = { .platform_data = &android_pmem_pdata }, | 
|  | 429 | }; | 
|  | 430 |  | 
|  | 431 | static struct platform_device android_pmem_adsp_device = { | 
|  | 432 | .name = "android_pmem", | 
|  | 433 | .id = 1, | 
|  | 434 | .dev = { .platform_data = &android_pmem_adsp_pdata }, | 
|  | 435 | }; | 
|  | 436 |  | 
|  | 437 | static struct platform_device android_pmem_audio_device = { | 
|  | 438 | .name = "android_pmem", | 
|  | 439 | .id = 2, | 
|  | 440 | .dev = { .platform_data = &android_pmem_audio_pdata }, | 
|  | 441 | }; | 
|  | 442 |  | 
|  | 443 | static struct msm_handset_platform_data hs_platform_data = { | 
|  | 444 | .hs_name = "7k_handset", | 
|  | 445 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ | 
|  | 446 | }; | 
|  | 447 |  | 
|  | 448 | static struct platform_device hs_device = { | 
|  | 449 | .name   = "msm-handset", | 
|  | 450 | .id     = -1, | 
|  | 451 | .dev    = { | 
|  | 452 | .platform_data = &hs_platform_data, | 
|  | 453 | }, | 
|  | 454 | }; | 
|  | 455 |  | 
|  | 456 | /* TSIF begin */ | 
|  | 457 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) | 
|  | 458 |  | 
|  | 459 | #define TSIF_B_SYNC      GPIO_CFG(87, 5, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) | 
|  | 460 | #define TSIF_B_DATA      GPIO_CFG(86, 3, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) | 
|  | 461 | #define TSIF_B_EN        GPIO_CFG(85, 3, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) | 
|  | 462 | #define TSIF_B_CLK       GPIO_CFG(84, 4, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) | 
|  | 463 |  | 
|  | 464 | static const struct msm_gpio tsif_gpios[] = { | 
|  | 465 | { .gpio_cfg = TSIF_B_CLK,  .label =  "tsif_clk", }, | 
|  | 466 | { .gpio_cfg = TSIF_B_EN,   .label =  "tsif_en", }, | 
|  | 467 | { .gpio_cfg = TSIF_B_DATA, .label =  "tsif_data", }, | 
|  | 468 | { .gpio_cfg = TSIF_B_SYNC, .label =  "tsif_sync", }, | 
|  | 469 | }; | 
|  | 470 |  | 
|  | 471 | static struct msm_tsif_platform_data tsif_platform_data = { | 
|  | 472 | .num_gpios = ARRAY_SIZE(tsif_gpios), | 
|  | 473 | .gpios = tsif_gpios, | 
| Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 474 | .tsif_clk = "core_clk", | 
|  | 475 | .tsif_pclk = "iface_clk", | 
|  | 476 | .tsif_ref_clk = "ref_clk", | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 477 | }; | 
|  | 478 | #endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */ | 
|  | 479 | /* TSIF end   */ | 
|  | 480 |  | 
|  | 481 | #define LCDC_CONFIG_PROC          21 | 
|  | 482 | #define LCDC_UN_CONFIG_PROC       22 | 
|  | 483 | #define LCDC_API_PROG             0x30000066 | 
|  | 484 | #define LCDC_API_VERS             0x00010001 | 
|  | 485 |  | 
|  | 486 | #define GPIO_OUT_132    132 | 
|  | 487 | #define GPIO_OUT_131    131 | 
|  | 488 | #define GPIO_OUT_103    103 | 
|  | 489 | #define GPIO_OUT_102    102 | 
|  | 490 | #define GPIO_OUT_88     88 | 
|  | 491 |  | 
|  | 492 | static struct msm_rpc_endpoint *lcdc_ep; | 
|  | 493 |  | 
|  | 494 | static int msm_fb_lcdc_config(int on) | 
|  | 495 | { | 
|  | 496 | int rc = 0; | 
|  | 497 | struct rpc_request_hdr hdr; | 
|  | 498 |  | 
|  | 499 | if (on) | 
|  | 500 | pr_info("lcdc config\n"); | 
|  | 501 | else | 
|  | 502 | pr_info("lcdc un-config\n"); | 
|  | 503 |  | 
|  | 504 | lcdc_ep = msm_rpc_connect_compatible(LCDC_API_PROG, LCDC_API_VERS, 0); | 
|  | 505 | if (IS_ERR(lcdc_ep)) { | 
|  | 506 | printk(KERN_ERR "%s: msm_rpc_connect failed! rc = %ld\n", | 
|  | 507 | __func__, PTR_ERR(lcdc_ep)); | 
|  | 508 | return -EINVAL; | 
|  | 509 | } | 
|  | 510 |  | 
|  | 511 | rc = msm_rpc_call(lcdc_ep, | 
|  | 512 | (on) ? LCDC_CONFIG_PROC : LCDC_UN_CONFIG_PROC, | 
|  | 513 | &hdr, sizeof(hdr), | 
|  | 514 | 5 * HZ); | 
|  | 515 | if (rc) | 
|  | 516 | printk(KERN_ERR | 
|  | 517 | "%s: msm_rpc_call failed! rc = %d\n", __func__, rc); | 
|  | 518 |  | 
|  | 519 | msm_rpc_close(lcdc_ep); | 
|  | 520 | return rc; | 
|  | 521 | } | 
|  | 522 |  | 
|  | 523 | static int gpio_array_num[] = { | 
|  | 524 | GPIO_OUT_132, /* spi_clk */ | 
|  | 525 | GPIO_OUT_131, /* spi_cs  */ | 
|  | 526 | GPIO_OUT_103, /* spi_sdi */ | 
|  | 527 | GPIO_OUT_102, /* spi_sdoi */ | 
|  | 528 | GPIO_OUT_88 | 
|  | 529 | }; | 
|  | 530 |  | 
|  | 531 | static void lcdc_gordon_gpio_init(void) | 
|  | 532 | { | 
|  | 533 | if (gpio_request(GPIO_OUT_132, "spi_clk")) | 
|  | 534 | pr_err("failed to request gpio spi_clk\n"); | 
|  | 535 | if (gpio_request(GPIO_OUT_131, "spi_cs")) | 
|  | 536 | pr_err("failed to request gpio spi_cs\n"); | 
|  | 537 | if (gpio_request(GPIO_OUT_103, "spi_sdi")) | 
|  | 538 | pr_err("failed to request gpio spi_sdi\n"); | 
|  | 539 | if (gpio_request(GPIO_OUT_102, "spi_sdoi")) | 
|  | 540 | pr_err("failed to request gpio spi_sdoi\n"); | 
|  | 541 | if (gpio_request(GPIO_OUT_88, "gpio_dac")) | 
|  | 542 | pr_err("failed to request gpio_dac\n"); | 
|  | 543 | } | 
|  | 544 |  | 
|  | 545 | static uint32_t lcdc_gpio_table[] = { | 
|  | 546 | GPIO_CFG(GPIO_OUT_132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), | 
|  | 547 | GPIO_CFG(GPIO_OUT_131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), | 
|  | 548 | GPIO_CFG(GPIO_OUT_103, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), | 
|  | 549 | GPIO_CFG(GPIO_OUT_102, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), | 
|  | 550 | GPIO_CFG(GPIO_OUT_88,  0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), | 
|  | 551 | }; | 
|  | 552 |  | 
|  | 553 | static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable) | 
|  | 554 | { | 
|  | 555 | int n, rc; | 
|  | 556 | for (n = 0; n < len; n++) { | 
|  | 557 | rc = gpio_tlmm_config(table[n], | 
|  | 558 | enable ? GPIO_CFG_ENABLE : GPIO_CFG_DISABLE); | 
|  | 559 | if (rc) { | 
|  | 560 | printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n", | 
|  | 561 | __func__, table[n], rc); | 
|  | 562 | break; | 
|  | 563 | } | 
|  | 564 | } | 
|  | 565 | } | 
|  | 566 |  | 
|  | 567 | static void lcdc_gordon_config_gpios(int enable) | 
|  | 568 | { | 
|  | 569 | config_lcdc_gpio_table(lcdc_gpio_table, | 
|  | 570 | ARRAY_SIZE(lcdc_gpio_table), enable); | 
|  | 571 | } | 
|  | 572 |  | 
|  | 573 | static char *msm_fb_lcdc_vreg[] = { | 
|  | 574 | "gp5" | 
|  | 575 | }; | 
|  | 576 |  | 
|  | 577 | static int msm_fb_lcdc_power_save(int on) | 
|  | 578 | { | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 579 | int i, rc = 0; | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 580 | static struct regulator *vreg[ARRAY_SIZE(msm_fb_lcdc_vreg)]; | 
|  | 581 |  | 
|  | 582 | if (on) { | 
|  | 583 | for (i = 0; i < ARRAY_SIZE(msm_fb_lcdc_vreg); i++) { | 
|  | 584 | vreg[i] = regulator_get(NULL, msm_fb_lcdc_vreg[i]); | 
|  | 585 | if (IS_ERR(vreg[i])) { | 
|  | 586 | rc = PTR_ERR(vreg[i]); | 
|  | 587 | pr_err("%s: could get not regulator: %d\n", | 
|  | 588 | __func__, rc); | 
|  | 589 | goto reg_get_fail; | 
|  | 590 | } | 
|  | 591 |  | 
|  | 592 | rc = regulator_set_voltage(vreg[i], 2850000, 3000000); | 
|  | 593 | if (rc < 0) { | 
|  | 594 | pr_err("%s: could not set voltage: %d\n", | 
|  | 595 | __func__, rc); | 
|  | 596 | goto reg_get_fail; | 
|  | 597 | } | 
|  | 598 | } | 
|  | 599 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 600 |  | 
|  | 601 | for (i = 0; i < ARRAY_SIZE(msm_fb_lcdc_vreg); i++) { | 
|  | 602 | if (on) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 603 | rc = regulator_enable(vreg[i]); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 604 | if (rc) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 605 | pr_err("%s: could not enable regulator %s:" | 
|  | 606 | "%d\n", __func__, | 
|  | 607 | msm_fb_lcdc_vreg[i], rc); | 
|  | 608 | goto vreg_lcdc_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 609 | } | 
|  | 610 | } else { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 611 | rc = regulator_disable(vreg[i]); | 
|  | 612 | if (rc) { | 
|  | 613 | pr_err("%s: could not disable regulator %s:" | 
|  | 614 | "%d\n", __func__, | 
|  | 615 | msm_fb_lcdc_vreg[i], rc); | 
|  | 616 |  | 
|  | 617 | regulator_put(vreg[i]); | 
|  | 618 | goto vreg_lcdc_fail; | 
|  | 619 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 620 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 621 |  | 
|  | 622 | regulator_put(vreg[i]); | 
|  | 623 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_OUT_88, 0, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 624 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, | 
|  | 625 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 626 | if (rc) | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 627 | printk(KERN_ERR "gpio_tlmm_config failed\n"); | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 628 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 629 | gpio_set_value(88, 0); | 
|  | 630 | mdelay(15); | 
|  | 631 | gpio_set_value(88, 1); | 
|  | 632 | mdelay(15); | 
|  | 633 | } | 
|  | 634 | } | 
|  | 635 |  | 
|  | 636 | return rc; | 
|  | 637 |  | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 638 | reg_get_fail: | 
|  | 639 | for (; i > 0; i--) | 
|  | 640 | regulator_put(vreg[i - 1]); | 
|  | 641 | return rc; | 
|  | 642 |  | 
|  | 643 | vreg_lcdc_fail: | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 644 | if (on) { | 
|  | 645 | for (; i > 0; i--) | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 646 | regulator_disable(vreg[i - 1]); | 
|  | 647 | } else { | 
|  | 648 | for (; i > 0; i--) | 
|  | 649 | regulator_enable(vreg[i - 1]); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 650 | } | 
|  | 651 |  | 
|  | 652 | return rc; | 
|  | 653 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 654 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 655 | static struct lcdc_platform_data lcdc_pdata = { | 
|  | 656 | .lcdc_gpio_config = msm_fb_lcdc_config, | 
|  | 657 | .lcdc_power_save   = msm_fb_lcdc_power_save, | 
|  | 658 | }; | 
|  | 659 |  | 
|  | 660 | static struct msm_panel_common_pdata lcdc_gordon_panel_data = { | 
|  | 661 | .panel_config_gpio = lcdc_gordon_config_gpios, | 
|  | 662 | .gpio_num          = gpio_array_num, | 
|  | 663 | }; | 
|  | 664 |  | 
|  | 665 | static struct platform_device lcdc_gordon_panel_device = { | 
|  | 666 | .name   = "lcdc_gordon_vga", | 
|  | 667 | .id     = 0, | 
|  | 668 | .dev    = { | 
|  | 669 | .platform_data = &lcdc_gordon_panel_data, | 
|  | 670 | } | 
|  | 671 | }; | 
|  | 672 |  | 
|  | 673 | static struct resource msm_fb_resources[] = { | 
|  | 674 | { | 
|  | 675 | .flags  = IORESOURCE_DMA, | 
|  | 676 | } | 
|  | 677 | }; | 
|  | 678 |  | 
|  | 679 | static int msm_fb_detect_panel(const char *name) | 
|  | 680 | { | 
|  | 681 | int ret = -EPERM; | 
|  | 682 |  | 
|  | 683 | if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) { | 
|  | 684 | if (!strcmp(name, "lcdc_gordon_vga")) | 
|  | 685 | ret = 0; | 
|  | 686 | else | 
|  | 687 | ret = -ENODEV; | 
|  | 688 | } | 
|  | 689 |  | 
|  | 690 | return ret; | 
|  | 691 | } | 
|  | 692 |  | 
|  | 693 | static struct msm_fb_platform_data msm_fb_pdata = { | 
|  | 694 | .detect_client = msm_fb_detect_panel, | 
|  | 695 | .mddi_prescan = 1, | 
|  | 696 | }; | 
|  | 697 |  | 
|  | 698 | static struct platform_device msm_fb_device = { | 
|  | 699 | .name   = "msm_fb", | 
|  | 700 | .id     = 0, | 
|  | 701 | .num_resources  = ARRAY_SIZE(msm_fb_resources), | 
|  | 702 | .resource       = msm_fb_resources, | 
|  | 703 | .dev    = { | 
|  | 704 | .platform_data = &msm_fb_pdata, | 
|  | 705 | } | 
|  | 706 | }; | 
|  | 707 |  | 
|  | 708 | #ifdef CONFIG_BT | 
|  | 709 | static struct platform_device msm_bt_power_device = { | 
|  | 710 | .name = "bt_power", | 
|  | 711 | }; | 
|  | 712 |  | 
|  | 713 | enum { | 
|  | 714 | BT_WAKE, | 
|  | 715 | BT_RFR, | 
|  | 716 | BT_CTS, | 
|  | 717 | BT_RX, | 
|  | 718 | BT_TX, | 
|  | 719 | BT_PCM_DOUT, | 
|  | 720 | BT_PCM_DIN, | 
|  | 721 | BT_PCM_SYNC, | 
|  | 722 | BT_PCM_CLK, | 
|  | 723 | BT_HOST_WAKE, | 
|  | 724 | }; | 
|  | 725 |  | 
|  | 726 | static unsigned bt_config_power_on[] = { | 
|  | 727 | GPIO_CFG(42, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* WAKE */ | 
|  | 728 | GPIO_CFG(43, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* RFR */ | 
|  | 729 | GPIO_CFG(44, 2, GPIO_CFG_INPUT,  GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* CTS */ | 
|  | 730 | GPIO_CFG(45, 2, GPIO_CFG_INPUT,  GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* Rx */ | 
|  | 731 | GPIO_CFG(46, 3, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* Tx */ | 
|  | 732 | GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* PCM_DOUT */ | 
|  | 733 | GPIO_CFG(69, 1, GPIO_CFG_INPUT,  GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* PCM_DIN */ | 
|  | 734 | GPIO_CFG(70, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* PCM_SYNC */ | 
|  | 735 | GPIO_CFG(71, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* PCM_CLK */ | 
|  | 736 | GPIO_CFG(83, 0, GPIO_CFG_INPUT,  GPIO_CFG_NO_PULL, GPIO_CFG_2MA),	/* HOST_WAKE */ | 
|  | 737 | }; | 
|  | 738 | static unsigned bt_config_power_off[] = { | 
|  | 739 | GPIO_CFG(42, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* WAKE */ | 
|  | 740 | GPIO_CFG(43, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* RFR */ | 
|  | 741 | GPIO_CFG(44, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* CTS */ | 
|  | 742 | GPIO_CFG(45, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* Rx */ | 
|  | 743 | GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* Tx */ | 
|  | 744 | GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* PCM_DOUT */ | 
|  | 745 | GPIO_CFG(69, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* PCM_DIN */ | 
|  | 746 | GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* PCM_SYNC */ | 
|  | 747 | GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* PCM_CLK */ | 
|  | 748 | GPIO_CFG(83, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),	/* HOST_WAKE */ | 
|  | 749 | }; | 
|  | 750 |  | 
|  | 751 | static int bluetooth_power(int on) | 
|  | 752 | { | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 753 | int pin, rc; | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 754 | static struct regulator *vreg_bt; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 755 |  | 
|  | 756 | printk(KERN_DEBUG "%s\n", __func__); | 
|  | 757 |  | 
|  | 758 | /* do not have vreg bt defined, gp6 is the same */ | 
|  | 759 | /* vreg_get parameter 1 (struct device *) is ignored */ | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 760 |  | 
|  | 761 | if (on) { | 
|  | 762 | for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on); pin++) { | 
|  | 763 | rc = gpio_tlmm_config(bt_config_power_on[pin], | 
|  | 764 | GPIO_CFG_ENABLE); | 
|  | 765 | if (rc) { | 
|  | 766 | printk(KERN_ERR | 
|  | 767 | "%s: gpio_tlmm_config(%#x)=%d\n", | 
|  | 768 | __func__, bt_config_power_on[pin], rc); | 
|  | 769 | return -EIO; | 
|  | 770 | } | 
|  | 771 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 772 | vreg_bt = regulator_get(NULL, "gp6"); | 
|  | 773 |  | 
|  | 774 | if (IS_ERR(vreg_bt)) { | 
|  | 775 | rc = PTR_ERR(vreg_bt); | 
|  | 776 | pr_err("%s: could get not regulator: %d\n", | 
|  | 777 | __func__, rc); | 
|  | 778 | goto out; | 
|  | 779 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 780 |  | 
|  | 781 | /* units of mV, steps of 50 mV */ | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 782 | rc = regulator_set_voltage(vreg_bt, 2600000, 2600000); | 
|  | 783 | if (rc < 0) { | 
|  | 784 | pr_err("%s: could not set voltage: %d\n", __func__, rc); | 
|  | 785 | goto bt_vreg_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 786 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 787 | rc = regulator_enable(vreg_bt); | 
|  | 788 | if (rc < 0) { | 
|  | 789 | pr_err("%s: could not enable regulator: %d\n", | 
|  | 790 | __func__, rc); | 
|  | 791 | goto bt_vreg_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 792 | } | 
|  | 793 | } else { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 794 | rc = regulator_disable(vreg_bt); | 
|  | 795 | if (rc < 0) { | 
|  | 796 | pr_err("%s: could not disable regulator: %d\n", | 
|  | 797 | __func__, rc); | 
|  | 798 | goto bt_vreg_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 799 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 800 | regulator_put(vreg_bt); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 801 | for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off); pin++) { | 
|  | 802 | rc = gpio_tlmm_config(bt_config_power_off[pin], | 
|  | 803 | GPIO_CFG_ENABLE); | 
|  | 804 | if (rc) { | 
|  | 805 | printk(KERN_ERR | 
|  | 806 | "%s: gpio_tlmm_config(%#x)=%d\n", | 
|  | 807 | __func__, bt_config_power_off[pin], rc); | 
|  | 808 | return -EIO; | 
|  | 809 | } | 
|  | 810 | } | 
|  | 811 | } | 
|  | 812 | return 0; | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 813 |  | 
|  | 814 | bt_vreg_fail: | 
|  | 815 | regulator_put(vreg_bt); | 
|  | 816 | out: | 
|  | 817 | return rc; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 818 | } | 
|  | 819 |  | 
|  | 820 | static void __init bt_power_init(void) | 
|  | 821 | { | 
|  | 822 | msm_bt_power_device.dev.platform_data = &bluetooth_power; | 
|  | 823 | } | 
|  | 824 | #else | 
|  | 825 | #define bt_power_init(x) do {} while (0) | 
|  | 826 | #endif | 
|  | 827 |  | 
|  | 828 | static struct platform_device msm_device_pmic_leds = { | 
|  | 829 | .name   = "pmic-leds", | 
|  | 830 | .id = -1, | 
|  | 831 | }; | 
|  | 832 |  | 
|  | 833 | static struct resource bluesleep_resources[] = { | 
|  | 834 | { | 
|  | 835 | .name	= "gpio_host_wake", | 
|  | 836 | .start	= 83, | 
|  | 837 | .end	= 83, | 
|  | 838 | .flags	= IORESOURCE_IO, | 
|  | 839 | }, | 
|  | 840 | { | 
|  | 841 | .name	= "gpio_ext_wake", | 
|  | 842 | .start	= 42, | 
|  | 843 | .end	= 42, | 
|  | 844 | .flags	= IORESOURCE_IO, | 
|  | 845 | }, | 
|  | 846 | { | 
|  | 847 | .name	= "host_wake", | 
|  | 848 | .start	= MSM_GPIO_TO_INT(83), | 
|  | 849 | .end	= MSM_GPIO_TO_INT(83), | 
|  | 850 | .flags	= IORESOURCE_IRQ, | 
|  | 851 | }, | 
|  | 852 | }; | 
|  | 853 |  | 
|  | 854 | static struct platform_device msm_bluesleep_device = { | 
|  | 855 | .name = "bluesleep", | 
|  | 856 | .id		= -1, | 
|  | 857 | .num_resources	= ARRAY_SIZE(bluesleep_resources), | 
|  | 858 | .resource	= bluesleep_resources, | 
|  | 859 | }; | 
|  | 860 |  | 
|  | 861 | static struct i2c_board_info i2c_devices[] = { | 
|  | 862 | #ifdef CONFIG_MT9D112 | 
|  | 863 | { | 
|  | 864 | I2C_BOARD_INFO("mt9d112", 0x78 >> 1), | 
|  | 865 | }, | 
|  | 866 | #endif | 
|  | 867 | #ifdef CONFIG_S5K3E2FX | 
|  | 868 | { | 
|  | 869 | I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1), | 
|  | 870 | }, | 
|  | 871 | #endif | 
|  | 872 | #ifdef CONFIG_MT9P012 | 
|  | 873 | { | 
|  | 874 | I2C_BOARD_INFO("mt9p012", 0x6C >> 1), | 
|  | 875 | }, | 
|  | 876 | #endif | 
|  | 877 | #ifdef CONFIG_MT9P012_KM | 
|  | 878 | { | 
|  | 879 | I2C_BOARD_INFO("mt9p012_km", 0x6C >> 2), | 
|  | 880 | }, | 
|  | 881 | #endif | 
|  | 882 | #if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013) | 
|  | 883 | { | 
|  | 884 | I2C_BOARD_INFO("mt9t013", 0x6C), | 
|  | 885 | }, | 
|  | 886 | #endif | 
|  | 887 | #ifdef CONFIG_VB6801 | 
|  | 888 | { | 
|  | 889 | I2C_BOARD_INFO("vb6801", 0x20), | 
|  | 890 | }, | 
|  | 891 | #endif | 
|  | 892 | }; | 
|  | 893 |  | 
|  | 894 | #ifdef CONFIG_MSM_CAMERA | 
|  | 895 | static uint32_t camera_off_gpio_table[] = { | 
|  | 896 | /* parallel CAMERA interfaces */ | 
|  | 897 | GPIO_CFG(0,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT0 */ | 
|  | 898 | GPIO_CFG(1,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT1 */ | 
|  | 899 | GPIO_CFG(2,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT2 */ | 
|  | 900 | GPIO_CFG(3,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT3 */ | 
|  | 901 | GPIO_CFG(4,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT4 */ | 
|  | 902 | GPIO_CFG(5,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT5 */ | 
|  | 903 | GPIO_CFG(6,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT6 */ | 
|  | 904 | GPIO_CFG(7,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT7 */ | 
|  | 905 | GPIO_CFG(8,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT8 */ | 
|  | 906 | GPIO_CFG(9,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT9 */ | 
|  | 907 | GPIO_CFG(10, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT10 */ | 
|  | 908 | GPIO_CFG(11, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT11 */ | 
|  | 909 | GPIO_CFG(12, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* PCLK */ | 
|  | 910 | GPIO_CFG(13, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* HSYNC_IN */ | 
|  | 911 | GPIO_CFG(14, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VSYNC_IN */ | 
|  | 912 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* MCLK */ | 
|  | 913 | }; | 
|  | 914 |  | 
|  | 915 | static uint32_t camera_on_gpio_table[] = { | 
|  | 916 | /* parallel CAMERA interfaces */ | 
|  | 917 | GPIO_CFG(0,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT0 */ | 
|  | 918 | GPIO_CFG(1,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT1 */ | 
|  | 919 | GPIO_CFG(2,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT2 */ | 
|  | 920 | GPIO_CFG(3,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT3 */ | 
|  | 921 | GPIO_CFG(4,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT4 */ | 
|  | 922 | GPIO_CFG(5,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT5 */ | 
|  | 923 | GPIO_CFG(6,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT6 */ | 
|  | 924 | GPIO_CFG(7,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT7 */ | 
|  | 925 | GPIO_CFG(8,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT8 */ | 
|  | 926 | GPIO_CFG(9,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT9 */ | 
|  | 927 | GPIO_CFG(10, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT10 */ | 
|  | 928 | GPIO_CFG(11, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT11 */ | 
|  | 929 | GPIO_CFG(12, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), /* PCLK */ | 
|  | 930 | GPIO_CFG(13, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* HSYNC_IN */ | 
|  | 931 | GPIO_CFG(14, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VSYNC_IN */ | 
|  | 932 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), /* MCLK */ | 
|  | 933 | }; | 
|  | 934 |  | 
|  | 935 | static void config_gpio_table(uint32_t *table, int len) | 
|  | 936 | { | 
|  | 937 | int n, rc; | 
|  | 938 | for (n = 0; n < len; n++) { | 
|  | 939 | rc = gpio_tlmm_config(table[n], GPIO_CFG_ENABLE); | 
|  | 940 | if (rc) { | 
|  | 941 | printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n", | 
|  | 942 | __func__, table[n], rc); | 
|  | 943 | break; | 
|  | 944 | } | 
|  | 945 | } | 
|  | 946 | } | 
|  | 947 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 948 | static void msm_camera_vreg_config(int vreg_en) | 
|  | 949 | { | 
|  | 950 | int rc; | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 951 | static struct regulator *vreg_gp2; | 
|  | 952 | static struct regulator *vreg_gp3; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 953 |  | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 954 | if (vreg_gp2 == NULL && vreg_gp3 == NULL) { | 
|  | 955 | vreg_gp2 = regulator_get(NULL, "gp2"); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 956 | if (IS_ERR(vreg_gp2)) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 957 | rc = PTR_ERR(vreg_gp2); | 
|  | 958 | pr_err("%s: could not get regulator: %d\n", | 
|  | 959 | __func__, rc); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 960 | return; | 
|  | 961 | } | 
|  | 962 |  | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 963 | rc = regulator_set_voltage(vreg_gp2, 1800000, 1800000); | 
|  | 964 | if (rc < 0) { | 
|  | 965 | pr_err("%s: could not set voltage: %d\n", | 
|  | 966 | __func__, rc); | 
|  | 967 | goto cam_vreg_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 968 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 969 |  | 
|  | 970 | vreg_gp3 = regulator_get(NULL, "gp3"); | 
|  | 971 | if (IS_ERR(vreg_gp3)) { | 
|  | 972 | rc = PTR_ERR(vreg_gp3); | 
|  | 973 | pr_err("%s: could not get regulator: %d\n", | 
|  | 974 | __func__, rc); | 
|  | 975 | goto cam_vreg_fail; | 
|  | 976 | } | 
|  | 977 |  | 
|  | 978 | rc = regulator_set_voltage(vreg_gp3, 2850000, 2850000); | 
|  | 979 | if (rc < 0) { | 
|  | 980 | pr_err("%s: could not set voltage: %d\n", __func__, rc); | 
|  | 981 | goto cam_vreg2_fail; | 
|  | 982 | } | 
|  | 983 |  | 
|  | 984 | return; | 
|  | 985 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 986 | } | 
|  | 987 |  | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 988 | if (vreg_gp2 == NULL || vreg_gp3 == NULL) { | 
|  | 989 | pr_err("Camera Regulators are not initialized\n"); | 
|  | 990 | return; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 991 | } | 
|  | 992 |  | 
|  | 993 | if (vreg_en) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 994 | rc = regulator_enable(vreg_gp2); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 995 | if (rc) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 996 | pr_err("%s: could not enable regulator: %d\n", | 
|  | 997 | __func__, rc); | 
|  | 998 | goto cam_vreg2_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 999 | } | 
|  | 1000 |  | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1001 | rc = regulator_enable(vreg_gp3); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1002 | if (rc) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1003 | pr_err("%s: could not enable regulator: %d\n", | 
|  | 1004 | __func__, rc); | 
|  | 1005 | goto vreg_gp3_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1006 | } | 
|  | 1007 | } else { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1008 | rc = regulator_disable(vreg_gp2); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1009 | if (rc) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1010 | pr_err("%s: could not disable regulator: %d\n", | 
|  | 1011 | __func__, rc); | 
|  | 1012 | return; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1013 | } | 
|  | 1014 |  | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1015 | rc = regulator_disable(vreg_gp3); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1016 | if (rc) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1017 | pr_err("%s: could not disable regulator: %d\n", | 
|  | 1018 | __func__, rc); | 
|  | 1019 | goto cam_vreg2_fail; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1020 | } | 
|  | 1021 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1022 |  | 
|  | 1023 | return; | 
|  | 1024 |  | 
|  | 1025 | vreg_gp3_fail: | 
|  | 1026 | if (vreg_en) | 
|  | 1027 | regulator_disable(vreg_gp2); | 
|  | 1028 |  | 
|  | 1029 | cam_vreg2_fail: | 
|  | 1030 | regulator_put(vreg_gp3); | 
|  | 1031 | cam_vreg_fail: | 
|  | 1032 | regulator_put(vreg_gp2); | 
|  | 1033 | vreg_gp3 = NULL; | 
|  | 1034 | vreg_gp2 = NULL; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1035 | } | 
|  | 1036 |  | 
|  | 1037 | static int config_camera_on_gpios(void) | 
|  | 1038 | { | 
|  | 1039 | int vreg_en = 1; | 
|  | 1040 |  | 
|  | 1041 | if (machine_is_msm7x25_ffa() || | 
|  | 1042 | machine_is_msm7x27_ffa()) | 
|  | 1043 | msm_camera_vreg_config(vreg_en); | 
|  | 1044 |  | 
|  | 1045 | config_gpio_table(camera_on_gpio_table, | 
|  | 1046 | ARRAY_SIZE(camera_on_gpio_table)); | 
|  | 1047 | return 0; | 
|  | 1048 | } | 
|  | 1049 |  | 
|  | 1050 | static void config_camera_off_gpios(void) | 
|  | 1051 | { | 
|  | 1052 | int vreg_en = 0; | 
|  | 1053 |  | 
|  | 1054 | if (machine_is_msm7x25_ffa() || | 
|  | 1055 | machine_is_msm7x27_ffa()) | 
|  | 1056 | msm_camera_vreg_config(vreg_en); | 
|  | 1057 |  | 
|  | 1058 | config_gpio_table(camera_off_gpio_table, | 
|  | 1059 | ARRAY_SIZE(camera_off_gpio_table)); | 
|  | 1060 | } | 
|  | 1061 |  | 
|  | 1062 | static struct msm_camera_device_platform_data msm_camera_device_data = { | 
|  | 1063 | .camera_gpio_on  = config_camera_on_gpios, | 
|  | 1064 | .camera_gpio_off = config_camera_off_gpios, | 
| Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 1065 | .ioext.mdcphy = MSM7XXX_MDC_PHYS, | 
|  | 1066 | .ioext.mdcsz  = MSM7XXX_MDC_SIZE, | 
|  | 1067 | .ioext.appphy = MSM7XXX_CLK_CTL_PHYS, | 
|  | 1068 | .ioext.appsz  = MSM7XXX_CLK_CTL_SIZE, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1069 | }; | 
|  | 1070 |  | 
|  | 1071 | int pmic_set_flash_led_current(enum pmic8058_leds id, unsigned mA) | 
|  | 1072 | { | 
|  | 1073 | int rc; | 
|  | 1074 | rc = pmic_flash_led_set_current(mA); | 
|  | 1075 | return rc; | 
|  | 1076 | } | 
|  | 1077 |  | 
|  | 1078 | static struct msm_camera_sensor_flash_src msm_flash_src = { | 
|  | 1079 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_PMIC, | 
|  | 1080 | ._fsrc.pmic_src.num_of_src = 1, | 
|  | 1081 | ._fsrc.pmic_src.low_current  = 30, | 
|  | 1082 | ._fsrc.pmic_src.high_current = 100, | 
|  | 1083 | ._fsrc.pmic_src.led_src_1 = 0, | 
|  | 1084 | ._fsrc.pmic_src.led_src_2 = 0, | 
|  | 1085 | ._fsrc.pmic_src.pmic_set_current = pmic_set_flash_led_current, | 
|  | 1086 | }; | 
|  | 1087 |  | 
|  | 1088 | #ifdef CONFIG_MT9D112 | 
|  | 1089 | static struct msm_camera_sensor_flash_data flash_mt9d112 = { | 
|  | 1090 | .flash_type = MSM_CAMERA_FLASH_LED, | 
|  | 1091 | .flash_src  = &msm_flash_src | 
|  | 1092 | }; | 
|  | 1093 |  | 
|  | 1094 | static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = { | 
|  | 1095 | .sensor_name    = "mt9d112", | 
|  | 1096 | .sensor_reset   = 89, | 
|  | 1097 | .sensor_pwd     = 85, | 
|  | 1098 | .vcm_pwd        = 0, | 
|  | 1099 | .vcm_enable     = 0, | 
|  | 1100 | .pdata          = &msm_camera_device_data, | 
|  | 1101 | .flash_data     = &flash_mt9d112 | 
|  | 1102 | }; | 
|  | 1103 |  | 
|  | 1104 | static struct platform_device msm_camera_sensor_mt9d112 = { | 
|  | 1105 | .name      = "msm_camera_mt9d112", | 
|  | 1106 | .dev       = { | 
|  | 1107 | .platform_data = &msm_camera_sensor_mt9d112_data, | 
|  | 1108 | }, | 
|  | 1109 | }; | 
|  | 1110 | #endif | 
|  | 1111 |  | 
|  | 1112 | #ifdef CONFIG_S5K3E2FX | 
|  | 1113 | static struct msm_camera_sensor_flash_data flash_s5k3e2fx = { | 
|  | 1114 | .flash_type = MSM_CAMERA_FLASH_LED, | 
|  | 1115 | .flash_src  = &msm_flash_src | 
|  | 1116 | }; | 
|  | 1117 |  | 
|  | 1118 | static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = { | 
|  | 1119 | .sensor_name    = "s5k3e2fx", | 
|  | 1120 | .sensor_reset   = 89, | 
|  | 1121 | .sensor_pwd     = 85, | 
|  | 1122 | .vcm_pwd        = 0, | 
|  | 1123 | .vcm_enable     = 0, | 
|  | 1124 | .pdata          = &msm_camera_device_data, | 
|  | 1125 | .flash_data     = &flash_s5k3e2fx | 
|  | 1126 | }; | 
|  | 1127 |  | 
|  | 1128 | static struct platform_device msm_camera_sensor_s5k3e2fx = { | 
|  | 1129 | .name      = "msm_camera_s5k3e2fx", | 
|  | 1130 | .dev       = { | 
|  | 1131 | .platform_data = &msm_camera_sensor_s5k3e2fx_data, | 
|  | 1132 | }, | 
|  | 1133 | }; | 
|  | 1134 | #endif | 
|  | 1135 |  | 
|  | 1136 | #ifdef CONFIG_MT9P012 | 
|  | 1137 | static struct msm_camera_sensor_flash_data flash_mt9p012 = { | 
|  | 1138 | .flash_type = MSM_CAMERA_FLASH_LED, | 
|  | 1139 | .flash_src  = &msm_flash_src | 
|  | 1140 | }; | 
|  | 1141 |  | 
|  | 1142 | static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = { | 
|  | 1143 | .sensor_name    = "mt9p012", | 
|  | 1144 | .sensor_reset   = 89, | 
|  | 1145 | .sensor_pwd     = 85, | 
|  | 1146 | .vcm_pwd        = 88, | 
|  | 1147 | .vcm_enable     = 0, | 
|  | 1148 | .pdata          = &msm_camera_device_data, | 
|  | 1149 | .flash_data     = &flash_mt9p012 | 
|  | 1150 | }; | 
|  | 1151 |  | 
|  | 1152 | static struct platform_device msm_camera_sensor_mt9p012 = { | 
|  | 1153 | .name      = "msm_camera_mt9p012", | 
|  | 1154 | .dev       = { | 
|  | 1155 | .platform_data = &msm_camera_sensor_mt9p012_data, | 
|  | 1156 | }, | 
|  | 1157 | }; | 
|  | 1158 | #endif | 
|  | 1159 |  | 
|  | 1160 | #ifdef CONFIG_MT9P012_KM | 
|  | 1161 | static struct msm_camera_sensor_flash_data flash_mt9p012_km = { | 
|  | 1162 | .flash_type = MSM_CAMERA_FLASH_LED, | 
|  | 1163 | .flash_src  = &msm_flash_src | 
|  | 1164 | }; | 
|  | 1165 |  | 
|  | 1166 | static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_km_data = { | 
|  | 1167 | .sensor_name    = "mt9p012_km", | 
|  | 1168 | .sensor_reset   = 89, | 
|  | 1169 | .sensor_pwd     = 85, | 
|  | 1170 | .vcm_pwd        = 88, | 
|  | 1171 | .vcm_enable     = 0, | 
|  | 1172 | .pdata          = &msm_camera_device_data, | 
|  | 1173 | .flash_data     = &flash_mt9p012_km | 
|  | 1174 | }; | 
|  | 1175 |  | 
|  | 1176 | static struct platform_device msm_camera_sensor_mt9p012_km = { | 
|  | 1177 | .name      = "msm_camera_mt9p012_km", | 
|  | 1178 | .dev       = { | 
|  | 1179 | .platform_data = &msm_camera_sensor_mt9p012_km_data, | 
|  | 1180 | }, | 
|  | 1181 | }; | 
|  | 1182 | #endif | 
|  | 1183 |  | 
|  | 1184 | #ifdef CONFIG_MT9T013 | 
|  | 1185 | static struct msm_camera_sensor_flash_data flash_mt9t013 = { | 
|  | 1186 | .flash_type = MSM_CAMERA_FLASH_LED, | 
|  | 1187 | .flash_src  = &msm_flash_src | 
|  | 1188 | }; | 
|  | 1189 |  | 
|  | 1190 | static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = { | 
|  | 1191 | .sensor_name    = "mt9t013", | 
|  | 1192 | .sensor_reset   = 89, | 
|  | 1193 | .sensor_pwd     = 85, | 
|  | 1194 | .vcm_pwd        = 0, | 
|  | 1195 | .vcm_enable     = 0, | 
|  | 1196 | .pdata          = &msm_camera_device_data, | 
|  | 1197 | .flash_data     = &flash_mt9t013 | 
|  | 1198 | }; | 
|  | 1199 |  | 
|  | 1200 | static struct platform_device msm_camera_sensor_mt9t013 = { | 
|  | 1201 | .name      = "msm_camera_mt9t013", | 
|  | 1202 | .dev       = { | 
|  | 1203 | .platform_data = &msm_camera_sensor_mt9t013_data, | 
|  | 1204 | }, | 
|  | 1205 | }; | 
|  | 1206 | #endif | 
|  | 1207 |  | 
|  | 1208 | #ifdef CONFIG_VB6801 | 
|  | 1209 | static struct msm_camera_sensor_flash_data flash_vb6801 = { | 
|  | 1210 | .flash_type = MSM_CAMERA_FLASH_LED, | 
|  | 1211 | .flash_src  = &msm_flash_src | 
|  | 1212 | }; | 
|  | 1213 |  | 
|  | 1214 | static struct msm_camera_sensor_info msm_camera_sensor_vb6801_data = { | 
|  | 1215 | .sensor_name    = "vb6801", | 
|  | 1216 | .sensor_reset   = 89, | 
|  | 1217 | .sensor_pwd     = 88, | 
|  | 1218 | .vcm_pwd        = 0, | 
|  | 1219 | .vcm_enable     = 0, | 
|  | 1220 | .pdata          = &msm_camera_device_data, | 
|  | 1221 | .flash_data     = &flash_vb6801 | 
|  | 1222 | }; | 
|  | 1223 |  | 
|  | 1224 | static struct platform_device msm_camera_sensor_vb6801 = { | 
|  | 1225 | .name      = "msm_camera_vb6801", | 
|  | 1226 | .dev       = { | 
|  | 1227 | .platform_data = &msm_camera_sensor_vb6801_data, | 
|  | 1228 | }, | 
|  | 1229 | }; | 
|  | 1230 | #endif | 
|  | 1231 | #endif | 
|  | 1232 |  | 
|  | 1233 | static u32 msm_calculate_batt_capacity(u32 current_voltage); | 
|  | 1234 |  | 
|  | 1235 | static struct msm_psy_batt_pdata msm_psy_batt_data = { | 
|  | 1236 | .voltage_min_design 	= 2800, | 
|  | 1237 | .voltage_max_design	= 4300, | 
|  | 1238 | .avail_chg_sources   	= AC_CHG | USB_CHG , | 
|  | 1239 | .batt_technology        = POWER_SUPPLY_TECHNOLOGY_LION, | 
|  | 1240 | .calculate_capacity	= &msm_calculate_batt_capacity, | 
|  | 1241 | }; | 
|  | 1242 |  | 
|  | 1243 | static u32 msm_calculate_batt_capacity(u32 current_voltage) | 
|  | 1244 | { | 
|  | 1245 | u32 low_voltage   = msm_psy_batt_data.voltage_min_design; | 
|  | 1246 | u32 high_voltage  = msm_psy_batt_data.voltage_max_design; | 
|  | 1247 |  | 
|  | 1248 | return (current_voltage - low_voltage) * 100 | 
|  | 1249 | / (high_voltage - low_voltage); | 
|  | 1250 | } | 
|  | 1251 |  | 
|  | 1252 | static struct platform_device msm_batt_device = { | 
|  | 1253 | .name 		    = "msm-battery", | 
|  | 1254 | .id		    = -1, | 
|  | 1255 | .dev.platform_data  = &msm_psy_batt_data, | 
|  | 1256 | }; | 
|  | 1257 |  | 
|  | 1258 |  | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1259 | static struct platform_device *devices[] __initdata = { | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1260 | &asoc_msm_pcm, | 
|  | 1261 | &asoc_msm_dai0, | 
|  | 1262 | &asoc_msm_dai1, | 
|  | 1263 |  | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1264 | &msm_device_smd, | 
|  | 1265 | &msm_device_dmov, | 
|  | 1266 | &msm_device_nand, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1267 |  | 
|  | 1268 | #ifdef CONFIG_USB_MSM_OTG_72K | 
|  | 1269 | &msm_device_otg, | 
|  | 1270 | #ifdef CONFIG_USB_GADGET | 
|  | 1271 | &msm_device_gadget_peripheral, | 
|  | 1272 | #endif | 
|  | 1273 | #endif | 
|  | 1274 |  | 
| Manu Gautam | 99ed391 | 2011-10-13 18:00:55 +0530 | [diff] [blame] | 1275 | #ifdef CONFIG_USB_G_ANDROID | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1276 | &android_usb_device, | 
|  | 1277 | #endif | 
| Manu Gautam | 99ed391 | 2011-10-13 18:00:55 +0530 | [diff] [blame] | 1278 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1279 | &msm_device_i2c, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1280 | &smc91x_device, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1281 | &msm_device_tssc, | 
|  | 1282 | &android_pmem_device, | 
|  | 1283 | &android_pmem_adsp_device, | 
|  | 1284 | &android_pmem_audio_device, | 
|  | 1285 | &msm_fb_device, | 
|  | 1286 | &lcdc_gordon_panel_device, | 
|  | 1287 | &msm_device_uart_dm1, | 
|  | 1288 | #ifdef CONFIG_BT | 
|  | 1289 | &msm_bt_power_device, | 
|  | 1290 | #endif | 
|  | 1291 | &msm_device_pmic_leds, | 
|  | 1292 | &msm_device_snd, | 
|  | 1293 | &msm_device_adspdec, | 
|  | 1294 | #ifdef CONFIG_MT9T013 | 
|  | 1295 | &msm_camera_sensor_mt9t013, | 
|  | 1296 | #endif | 
|  | 1297 | #ifdef CONFIG_MT9D112 | 
|  | 1298 | &msm_camera_sensor_mt9d112, | 
|  | 1299 | #endif | 
|  | 1300 | #ifdef CONFIG_S5K3E2FX | 
|  | 1301 | &msm_camera_sensor_s5k3e2fx, | 
|  | 1302 | #endif | 
|  | 1303 | #ifdef CONFIG_MT9P012 | 
|  | 1304 | &msm_camera_sensor_mt9p012, | 
|  | 1305 | #endif | 
|  | 1306 | #ifdef CONFIG_MT9P012_KM | 
|  | 1307 | &msm_camera_sensor_mt9p012_km, | 
|  | 1308 | #endif | 
|  | 1309 | #ifdef CONFIG_VB6801 | 
|  | 1310 | &msm_camera_sensor_vb6801, | 
|  | 1311 | #endif | 
|  | 1312 | &msm_bluesleep_device, | 
|  | 1313 | #ifdef CONFIG_ARCH_MSM7X27 | 
|  | 1314 | &msm_kgsl_3d0, | 
|  | 1315 | #endif | 
|  | 1316 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) | 
|  | 1317 | &msm_device_tsif, | 
|  | 1318 | #endif | 
|  | 1319 | &hs_device, | 
|  | 1320 | &msm_batt_device, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1321 | }; | 
|  | 1322 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1323 | static struct msm_panel_common_pdata mdp_pdata = { | 
|  | 1324 | .gpio = 97, | 
| Ravishangar Kalyanam | 07ef788 | 2011-08-09 15:50:48 -0700 | [diff] [blame] | 1325 | .mdp_rev = MDP_REV_30, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1326 | }; | 
|  | 1327 |  | 
|  | 1328 | static void __init msm_fb_add_devices(void) | 
|  | 1329 | { | 
|  | 1330 | msm_fb_register_device("mdp", &mdp_pdata); | 
|  | 1331 | msm_fb_register_device("pmdh", 0); | 
|  | 1332 | msm_fb_register_device("lcdc", &lcdc_pdata); | 
|  | 1333 | } | 
|  | 1334 |  | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1335 | extern struct sys_timer msm_timer; | 
|  | 1336 |  | 
|  | 1337 | static void __init msm7x2x_init_irq(void) | 
|  | 1338 | { | 
|  | 1339 | msm_init_irq(); | 
|  | 1340 | } | 
|  | 1341 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1342 | void msm_serial_debug_init(unsigned int base, int irq, | 
|  | 1343 | struct device *clk_device, int signal_irq); | 
|  | 1344 |  | 
|  | 1345 | #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ | 
|  | 1346 | || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\ | 
|  | 1347 | || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\ | 
|  | 1348 | || defined(CONFIG_MMC_MSM_SDC4_SUPPORT)) | 
|  | 1349 |  | 
|  | 1350 | static unsigned long vreg_sts, gpio_sts; | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1351 | static struct regulator *vreg_mmc; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1352 | static unsigned mpp_mmc = 2; | 
|  | 1353 |  | 
|  | 1354 | struct sdcc_gpio { | 
|  | 1355 | struct msm_gpio *cfg_data; | 
|  | 1356 | uint32_t size; | 
|  | 1357 | struct msm_gpio *sleep_cfg_data; | 
|  | 1358 | }; | 
|  | 1359 |  | 
|  | 1360 | static struct msm_gpio sdc1_cfg_data[] = { | 
|  | 1361 | {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_3"}, | 
|  | 1362 | {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_2"}, | 
|  | 1363 | {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_1"}, | 
|  | 1364 | {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_0"}, | 
|  | 1365 | {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_cmd"}, | 
|  | 1366 | {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "sdc1_clk"}, | 
|  | 1367 | }; | 
|  | 1368 |  | 
|  | 1369 | static struct msm_gpio sdc2_cfg_data[] = { | 
|  | 1370 | {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "sdc2_clk"}, | 
|  | 1371 | {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_cmd"}, | 
|  | 1372 | {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_3"}, | 
|  | 1373 | {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_2"}, | 
|  | 1374 | {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_1"}, | 
|  | 1375 | {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_0"}, | 
|  | 1376 | }; | 
|  | 1377 |  | 
|  | 1378 | static struct msm_gpio sdc2_sleep_cfg_data[] = { | 
|  | 1379 | {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "sdc2_clk"}, | 
|  | 1380 | {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "sdc2_cmd"}, | 
|  | 1381 | {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "sdc2_dat_3"}, | 
|  | 1382 | {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "sdc2_dat_2"}, | 
|  | 1383 | {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "sdc2_dat_1"}, | 
|  | 1384 | {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "sdc2_dat_0"}, | 
|  | 1385 | }; | 
|  | 1386 | static struct msm_gpio sdc3_cfg_data[] = { | 
|  | 1387 | {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "sdc3_clk"}, | 
|  | 1388 | {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_cmd"}, | 
|  | 1389 | {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_3"}, | 
|  | 1390 | {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_2"}, | 
|  | 1391 | {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_1"}, | 
|  | 1392 | {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_0"}, | 
|  | 1393 | }; | 
|  | 1394 |  | 
|  | 1395 | static struct msm_gpio sdc4_cfg_data[] = { | 
|  | 1396 | {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_3"}, | 
|  | 1397 | {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_2"}, | 
|  | 1398 | {GPIO_CFG(21, 4, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_1"}, | 
|  | 1399 | {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_cmd"}, | 
|  | 1400 | {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_0"}, | 
|  | 1401 | {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "sdc4_clk"}, | 
|  | 1402 | }; | 
|  | 1403 |  | 
|  | 1404 | static struct sdcc_gpio sdcc_cfg_data[] = { | 
|  | 1405 | { | 
|  | 1406 | .cfg_data = sdc1_cfg_data, | 
|  | 1407 | .size = ARRAY_SIZE(sdc1_cfg_data), | 
|  | 1408 | .sleep_cfg_data = NULL, | 
|  | 1409 | }, | 
|  | 1410 | { | 
|  | 1411 | .cfg_data = sdc2_cfg_data, | 
|  | 1412 | .size = ARRAY_SIZE(sdc2_cfg_data), | 
|  | 1413 | .sleep_cfg_data = sdc2_sleep_cfg_data, | 
|  | 1414 | }, | 
|  | 1415 | { | 
|  | 1416 | .cfg_data = sdc3_cfg_data, | 
|  | 1417 | .size = ARRAY_SIZE(sdc3_cfg_data), | 
|  | 1418 | .sleep_cfg_data = NULL, | 
|  | 1419 | }, | 
|  | 1420 | { | 
|  | 1421 | .cfg_data = sdc4_cfg_data, | 
|  | 1422 | .size = ARRAY_SIZE(sdc4_cfg_data), | 
|  | 1423 | .sleep_cfg_data = NULL, | 
|  | 1424 | }, | 
|  | 1425 | }; | 
|  | 1426 |  | 
|  | 1427 | static void msm_sdcc_setup_gpio(int dev_id, unsigned int enable) | 
|  | 1428 | { | 
|  | 1429 | int rc = 0; | 
|  | 1430 | struct sdcc_gpio *curr; | 
|  | 1431 |  | 
|  | 1432 | curr = &sdcc_cfg_data[dev_id - 1]; | 
|  | 1433 | if (!(test_bit(dev_id, &gpio_sts)^enable)) | 
|  | 1434 | return; | 
|  | 1435 |  | 
|  | 1436 | if (enable) { | 
|  | 1437 | set_bit(dev_id, &gpio_sts); | 
|  | 1438 | rc = msm_gpios_request_enable(curr->cfg_data, curr->size); | 
|  | 1439 | if (rc) | 
|  | 1440 | printk(KERN_ERR "%s: Failed to turn on GPIOs for slot %d\n", | 
|  | 1441 | __func__,  dev_id); | 
|  | 1442 | } else { | 
|  | 1443 | clear_bit(dev_id, &gpio_sts); | 
|  | 1444 | if (curr->sleep_cfg_data) { | 
|  | 1445 | msm_gpios_enable(curr->sleep_cfg_data, curr->size); | 
|  | 1446 | msm_gpios_free(curr->sleep_cfg_data, curr->size); | 
|  | 1447 | return; | 
|  | 1448 | } | 
|  | 1449 | msm_gpios_disable_free(curr->cfg_data, curr->size); | 
|  | 1450 | } | 
|  | 1451 | } | 
|  | 1452 |  | 
|  | 1453 | static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd) | 
|  | 1454 | { | 
|  | 1455 | int rc = 0; | 
|  | 1456 | struct platform_device *pdev; | 
|  | 1457 |  | 
|  | 1458 | pdev = container_of(dv, struct platform_device, dev); | 
|  | 1459 | msm_sdcc_setup_gpio(pdev->id, !!vdd); | 
|  | 1460 |  | 
|  | 1461 | if (vdd == 0) { | 
|  | 1462 | if (!vreg_sts) | 
|  | 1463 | return 0; | 
|  | 1464 |  | 
|  | 1465 | clear_bit(pdev->id, &vreg_sts); | 
|  | 1466 |  | 
|  | 1467 | if (!vreg_sts) { | 
|  | 1468 | if (machine_is_msm7x25_ffa() || | 
|  | 1469 | machine_is_msm7x27_ffa()) { | 
|  | 1470 | rc = mpp_config_digital_out(mpp_mmc, | 
|  | 1471 | MPP_CFG(MPP_DLOGIC_LVL_MSMP, | 
|  | 1472 | MPP_DLOGIC_OUT_CTRL_LOW)); | 
|  | 1473 | } else | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1474 | rc = regulator_disable(vreg_mmc); | 
|  | 1475 | if (rc) { | 
|  | 1476 | pr_err("%s: return val: %d\n", | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1477 | __func__, rc); | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1478 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1479 | } | 
|  | 1480 | return 0; | 
|  | 1481 | } | 
|  | 1482 |  | 
|  | 1483 | if (!vreg_sts) { | 
|  | 1484 | if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) { | 
|  | 1485 | rc = mpp_config_digital_out(mpp_mmc, | 
|  | 1486 | MPP_CFG(MPP_DLOGIC_LVL_MSMP, | 
|  | 1487 | MPP_DLOGIC_OUT_CTRL_HIGH)); | 
|  | 1488 | } else { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1489 | rc = regulator_set_voltage(vreg_mmc, 2850000, 2850000); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1490 | if (!rc) | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1491 | rc = regulator_enable(vreg_mmc); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1492 | } | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1493 | if (rc) { | 
|  | 1494 | pr_err("%s: return val: %d\n", | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1495 | __func__, rc); | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1496 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1497 | } | 
|  | 1498 | set_bit(pdev->id, &vreg_sts); | 
|  | 1499 | return 0; | 
|  | 1500 | } | 
|  | 1501 |  | 
|  | 1502 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT | 
|  | 1503 | static struct mmc_platform_data msm7x2x_sdc1_data = { | 
|  | 1504 | .ocr_mask	= MMC_VDD_28_29, | 
|  | 1505 | .translate_vdd	= msm_sdcc_setup_power, | 
|  | 1506 | .mmc_bus_width  = MMC_CAP_4_BIT_DATA, | 
|  | 1507 | .msmsdcc_fmin	= 144000, | 
|  | 1508 | .msmsdcc_fmid	= 24576000, | 
|  | 1509 | .msmsdcc_fmax	= 49152000, | 
|  | 1510 | .nonremovable	= 0, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1511 | }; | 
|  | 1512 | #endif | 
|  | 1513 |  | 
|  | 1514 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT | 
|  | 1515 | static struct mmc_platform_data msm7x2x_sdc2_data = { | 
|  | 1516 | .ocr_mask	= MMC_VDD_28_29, | 
|  | 1517 | .translate_vdd	= msm_sdcc_setup_power, | 
|  | 1518 | .mmc_bus_width  = MMC_CAP_4_BIT_DATA, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1519 | .sdiowakeup_irq = MSM_GPIO_TO_INT(66), | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1520 | .msmsdcc_fmin	= 144000, | 
|  | 1521 | .msmsdcc_fmid	= 24576000, | 
|  | 1522 | .msmsdcc_fmax	= 49152000, | 
|  | 1523 | .nonremovable	= 0, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1524 | }; | 
|  | 1525 | #endif | 
|  | 1526 |  | 
|  | 1527 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT | 
|  | 1528 | static struct mmc_platform_data msm7x2x_sdc3_data = { | 
|  | 1529 | .ocr_mask	= MMC_VDD_28_29, | 
|  | 1530 | .translate_vdd	= msm_sdcc_setup_power, | 
|  | 1531 | .mmc_bus_width  = MMC_CAP_4_BIT_DATA, | 
|  | 1532 | .msmsdcc_fmin	= 144000, | 
|  | 1533 | .msmsdcc_fmid	= 24576000, | 
|  | 1534 | .msmsdcc_fmax	= 49152000, | 
|  | 1535 | .nonremovable	= 0, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1536 | }; | 
|  | 1537 | #endif | 
|  | 1538 |  | 
|  | 1539 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT | 
|  | 1540 | static struct mmc_platform_data msm7x2x_sdc4_data = { | 
|  | 1541 | .ocr_mask	= MMC_VDD_28_29, | 
|  | 1542 | .translate_vdd	= msm_sdcc_setup_power, | 
|  | 1543 | .mmc_bus_width  = MMC_CAP_4_BIT_DATA, | 
|  | 1544 | .msmsdcc_fmin	= 144000, | 
|  | 1545 | .msmsdcc_fmid	= 24576000, | 
|  | 1546 | .msmsdcc_fmax	= 49152000, | 
|  | 1547 | .nonremovable	= 0, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1548 | }; | 
|  | 1549 | #endif | 
|  | 1550 |  | 
|  | 1551 | static void __init msm7x2x_init_mmc(void) | 
|  | 1552 | { | 
|  | 1553 | if (!machine_is_msm7x25_ffa() && !machine_is_msm7x27_ffa()) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1554 | vreg_mmc = regulator_get(NULL, "mmc"); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1555 | if (IS_ERR(vreg_mmc)) { | 
| Pankaj Kumar | 0f77ca8 | 2011-10-03 10:20:30 +0530 | [diff] [blame] | 1556 | pr_err("%s: could not get regulator: %ld\n", | 
|  | 1557 | __func__, PTR_ERR(vreg_mmc)); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1558 | } | 
|  | 1559 | } | 
|  | 1560 |  | 
|  | 1561 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT | 
|  | 1562 | msm_add_sdcc(1, &msm7x2x_sdc1_data); | 
|  | 1563 | #endif | 
|  | 1564 |  | 
|  | 1565 | if (machine_is_msm7x25_surf() || machine_is_msm7x27_surf() || | 
|  | 1566 | machine_is_msm7x27_ffa()) { | 
|  | 1567 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT | 
|  | 1568 | msm_sdcc_setup_gpio(2, 1); | 
|  | 1569 | msm_add_sdcc(2, &msm7x2x_sdc2_data); | 
|  | 1570 | #endif | 
|  | 1571 | } | 
|  | 1572 |  | 
|  | 1573 | if (machine_is_msm7x25_surf() || machine_is_msm7x27_surf()) { | 
|  | 1574 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT | 
|  | 1575 | msm_add_sdcc(3, &msm7x2x_sdc3_data); | 
|  | 1576 | #endif | 
|  | 1577 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT | 
|  | 1578 | msm_add_sdcc(4, &msm7x2x_sdc4_data); | 
|  | 1579 | #endif | 
|  | 1580 | } | 
|  | 1581 | } | 
|  | 1582 | #else | 
|  | 1583 | #define msm7x2x_init_mmc() do {} while (0) | 
|  | 1584 | #endif | 
|  | 1585 |  | 
|  | 1586 |  | 
|  | 1587 | static struct msm_pm_platform_data msm7x25_pm_data[MSM_PM_SLEEP_MODE_NR] = { | 
| Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 1588 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)].latency = 16000, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1589 |  | 
| Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 1590 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] | 
|  | 1591 | .latency = 12000, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1592 |  | 
| Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 1593 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT)] | 
|  | 1594 | .latency = 2000, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1595 | }; | 
|  | 1596 |  | 
|  | 1597 | static struct msm_pm_platform_data msm7x27_pm_data[MSM_PM_SLEEP_MODE_NR] = { | 
| Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 1598 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1599 | .idle_supported = 1, | 
|  | 1600 | .suspend_supported = 1, | 
|  | 1601 | .idle_enabled = 1, | 
|  | 1602 | .suspend_enabled = 1, | 
|  | 1603 | .latency = 16000, | 
|  | 1604 | .residency = 20000, | 
|  | 1605 | }, | 
|  | 1606 |  | 
| Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 1607 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1608 | .idle_supported = 1, | 
|  | 1609 | .suspend_supported = 1, | 
|  | 1610 | .idle_enabled = 1, | 
|  | 1611 | .suspend_enabled = 1, | 
|  | 1612 | .latency = 12000, | 
|  | 1613 | .residency = 20000, | 
|  | 1614 | }, | 
|  | 1615 |  | 
| Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 1616 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT)] = { | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1617 | .idle_supported = 1, | 
|  | 1618 | .suspend_supported = 1, | 
|  | 1619 | .idle_enabled = 1, | 
|  | 1620 | .suspend_enabled = 1, | 
|  | 1621 | .latency = 2000, | 
|  | 1622 | .residency = 0, | 
|  | 1623 | }, | 
|  | 1624 | }; | 
|  | 1625 |  | 
| Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1626 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { | 
| Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 1627 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, | 
|  | 1628 | .p_addr = 0, | 
| Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1629 | }; | 
|  | 1630 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1631 | static void | 
|  | 1632 | msm_i2c_gpio_config(int iface, int config_type) | 
|  | 1633 | { | 
|  | 1634 | int gpio_scl; | 
|  | 1635 | int gpio_sda; | 
|  | 1636 | if (iface) { | 
|  | 1637 | gpio_scl = 95; | 
|  | 1638 | gpio_sda = 96; | 
|  | 1639 | } else { | 
|  | 1640 | gpio_scl = 60; | 
|  | 1641 | gpio_sda = 61; | 
|  | 1642 | } | 
|  | 1643 | if (config_type) { | 
|  | 1644 | gpio_tlmm_config(GPIO_CFG(gpio_scl, 1, GPIO_CFG_INPUT, | 
|  | 1645 | GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); | 
|  | 1646 | gpio_tlmm_config(GPIO_CFG(gpio_sda, 1, GPIO_CFG_INPUT, | 
|  | 1647 | GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); | 
|  | 1648 | } else { | 
|  | 1649 | gpio_tlmm_config(GPIO_CFG(gpio_scl, 0, GPIO_CFG_OUTPUT, | 
|  | 1650 | GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); | 
|  | 1651 | gpio_tlmm_config(GPIO_CFG(gpio_sda, 0, GPIO_CFG_OUTPUT, | 
|  | 1652 | GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); | 
|  | 1653 | } | 
|  | 1654 | } | 
|  | 1655 |  | 
|  | 1656 | static struct msm_i2c_platform_data msm_i2c_pdata = { | 
|  | 1657 | .clk_freq = 100000, | 
|  | 1658 | .rmutex  = 0, | 
|  | 1659 | .pri_clk = 60, | 
|  | 1660 | .pri_dat = 61, | 
|  | 1661 | .aux_clk = 95, | 
|  | 1662 | .aux_dat = 96, | 
|  | 1663 | .msm_i2c_config_gpio = msm_i2c_gpio_config, | 
|  | 1664 | }; | 
| Pankaj Kumar | 75c86fd | 2011-10-01 18:51:09 +0530 | [diff] [blame] | 1665 | static struct platform_device msm_proccomm_regulator_dev = { | 
|  | 1666 | .name   = PROCCOMM_REGULATOR_DEV_NAME, | 
|  | 1667 | .id     = -1, | 
|  | 1668 | .dev    = { | 
|  | 1669 | .platform_data = &msm7627_proccomm_regulator_data | 
|  | 1670 | } | 
|  | 1671 | }; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1672 |  | 
| Pankaj Kumar | 75c86fd | 2011-10-01 18:51:09 +0530 | [diff] [blame] | 1673 | static void __init msm7627_init_regulators(void) | 
|  | 1674 | { | 
|  | 1675 | int rc = platform_device_register(&msm_proccomm_regulator_dev); | 
|  | 1676 | if (rc) | 
|  | 1677 | pr_err("%s: could not register regulator device: %d\n", | 
|  | 1678 | __func__, rc); | 
|  | 1679 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1680 | static void __init msm_device_i2c_init(void) | 
|  | 1681 | { | 
|  | 1682 | if (gpio_request(60, "i2c_pri_clk")) | 
|  | 1683 | pr_err("failed to request gpio i2c_pri_clk\n"); | 
|  | 1684 | if (gpio_request(61, "i2c_pri_dat")) | 
|  | 1685 | pr_err("failed to request gpio i2c_pri_dat\n"); | 
|  | 1686 | if (gpio_request(95, "i2c_sec_clk")) | 
|  | 1687 | pr_err("failed to request gpio i2c_sec_clk\n"); | 
|  | 1688 | if (gpio_request(96, "i2c_sec_dat")) | 
|  | 1689 | pr_err("failed to request gpio i2c_sec_dat\n"); | 
|  | 1690 |  | 
|  | 1691 | if (cpu_is_msm7x27()) | 
|  | 1692 | msm_i2c_pdata.pm_lat = | 
|  | 1693 | msm7x27_pm_data[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] | 
|  | 1694 | .latency; | 
|  | 1695 | else | 
|  | 1696 | msm_i2c_pdata.pm_lat = | 
|  | 1697 | msm7x25_pm_data[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] | 
|  | 1698 | .latency; | 
|  | 1699 |  | 
|  | 1700 | msm_device_i2c.dev.platform_data = &msm_i2c_pdata; | 
|  | 1701 | } | 
|  | 1702 |  | 
|  | 1703 | static void usb_mpp_init(void) | 
|  | 1704 | { | 
|  | 1705 | unsigned rc; | 
|  | 1706 | unsigned mpp_usb = 7; | 
|  | 1707 |  | 
|  | 1708 | if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) { | 
|  | 1709 | rc = mpp_config_digital_out(mpp_usb, | 
|  | 1710 | MPP_CFG(MPP_DLOGIC_LVL_VDD, | 
|  | 1711 | MPP_DLOGIC_OUT_CTRL_HIGH)); | 
|  | 1712 | if (rc) | 
|  | 1713 | pr_err("%s: configuring mpp pin" | 
|  | 1714 | "to enable 3.3V LDO failed\n", __func__); | 
|  | 1715 | } | 
|  | 1716 | } | 
|  | 1717 |  | 
|  | 1718 | static void msm7x27_wlan_init(void) | 
|  | 1719 | { | 
|  | 1720 | int rc = 0; | 
|  | 1721 | /* TBD: if (machine_is_msm7x27_ffa_with_wcn1312()) */ | 
|  | 1722 | if (machine_is_msm7x27_ffa()) { | 
|  | 1723 | rc = mpp_config_digital_out(3, MPP_CFG(MPP_DLOGIC_LVL_MSMP, | 
|  | 1724 | MPP_DLOGIC_OUT_CTRL_LOW)); | 
|  | 1725 | if (rc) | 
|  | 1726 | printk(KERN_ERR "%s: return val: %d \n", | 
|  | 1727 | __func__, rc); | 
|  | 1728 | } | 
|  | 1729 | } | 
|  | 1730 |  | 
| Laxminath Kasam | 1f2cd2a | 2012-02-15 12:12:44 +0530 | [diff] [blame] | 1731 | static void msm_adsp_add_pdev(void) | 
|  | 1732 | { | 
|  | 1733 | int rc = 0; | 
|  | 1734 | struct rpc_board_dev *rpc_adsp_pdev; | 
|  | 1735 |  | 
|  | 1736 | rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL); | 
|  | 1737 | if (rpc_adsp_pdev == NULL) { | 
|  | 1738 | pr_err("%s: Memory Allocation failure\n", __func__); | 
|  | 1739 | return; | 
|  | 1740 | } | 
|  | 1741 | rpc_adsp_pdev->prog = ADSP_RPC_PROG; | 
|  | 1742 | rpc_adsp_pdev->pdev = msm_adsp_device; | 
|  | 1743 | rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1); | 
|  | 1744 | if (rc < 0) { | 
|  | 1745 | pr_err("%s: return val: %d\n",	__func__, rc); | 
|  | 1746 | kfree(rpc_adsp_pdev); | 
|  | 1747 | } | 
|  | 1748 | } | 
|  | 1749 |  | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1750 | static void __init msm7x2x_init(void) | 
|  | 1751 | { | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1752 |  | 
| Pankaj Kumar | 75c86fd | 2011-10-01 18:51:09 +0530 | [diff] [blame] | 1753 | msm7627_init_regulators(); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1754 | #ifdef CONFIG_ARCH_MSM7X25 | 
|  | 1755 | msm_clock_init(msm_clocks_7x25, msm_num_clocks_7x25); | 
|  | 1756 | #elif defined(CONFIG_ARCH_MSM7X27) | 
| Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 1757 | msm_clock_init(&msm7x27_clock_init_data); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1758 | #endif | 
|  | 1759 |  | 
|  | 1760 | #if defined(CONFIG_SMC91X) | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1761 | if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) { | 
|  | 1762 | smc91x_resources[0].start = 0x98000300; | 
|  | 1763 | smc91x_resources[0].end = 0x980003ff; | 
|  | 1764 | smc91x_resources[1].start = MSM_GPIO_TO_INT(85); | 
|  | 1765 | smc91x_resources[1].end = MSM_GPIO_TO_INT(85); | 
|  | 1766 | if (gpio_tlmm_config(GPIO_CFG(85, 0, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1767 | GPIO_CFG_INPUT, | 
|  | 1768 | GPIO_CFG_PULL_DOWN, | 
|  | 1769 | GPIO_CFG_2MA), | 
|  | 1770 | GPIO_CFG_ENABLE)) { | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1771 | printk(KERN_ERR | 
|  | 1772 | "%s: Err: Config GPIO-85 INT\n", | 
|  | 1773 | __func__); | 
|  | 1774 | } | 
|  | 1775 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1776 | #endif | 
| Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 1777 | platform_device_register(&msm7x27_device_acpuclk); | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1778 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1779 | usb_mpp_init(); | 
|  | 1780 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1781 |  | 
|  | 1782 | #ifdef CONFIG_USB_MSM_OTG_72K | 
|  | 1783 | msm_device_otg.dev.platform_data = &msm_otg_pdata; | 
|  | 1784 | if (machine_is_msm7x25_surf() || machine_is_msm7x25_ffa()) { | 
|  | 1785 | msm_otg_pdata.pemp_level = | 
|  | 1786 | PRE_EMPHASIS_WITH_20_PERCENT; | 
|  | 1787 | msm_otg_pdata.drv_ampl = HS_DRV_AMPLITUDE_5_PERCENT; | 
|  | 1788 | msm_otg_pdata.cdr_autoreset = CDR_AUTO_RESET_ENABLE; | 
|  | 1789 | msm_otg_pdata.phy_reset = msm_otg_rpc_phy_reset; | 
|  | 1790 | } | 
|  | 1791 | if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) { | 
|  | 1792 | msm_otg_pdata.pemp_level = | 
|  | 1793 | PRE_EMPHASIS_WITH_10_PERCENT; | 
|  | 1794 | msm_otg_pdata.drv_ampl = HS_DRV_AMPLITUDE_5_PERCENT; | 
|  | 1795 | msm_otg_pdata.cdr_autoreset = CDR_AUTO_RESET_DISABLE; | 
|  | 1796 | msm_otg_pdata.phy_reset_sig_inverted = 1; | 
|  | 1797 | } | 
|  | 1798 |  | 
|  | 1799 | #ifdef CONFIG_USB_GADGET | 
|  | 1800 | msm_otg_pdata.swfi_latency = | 
|  | 1801 | msm7x27_pm_data | 
|  | 1802 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; | 
|  | 1803 | msm_device_gadget_peripheral.dev.platform_data = &msm_gadget_pdata; | 
|  | 1804 | msm_gadget_pdata.is_phy_status_timer_on = 1; | 
|  | 1805 | #endif | 
|  | 1806 | #endif | 
|  | 1807 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) | 
|  | 1808 | msm_device_tsif.dev.platform_data = &tsif_platform_data; | 
|  | 1809 | #endif | 
|  | 1810 | platform_add_devices(msm_footswitch_devices, | 
|  | 1811 | msm_num_footswitch_devices); | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1812 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1813 | #ifdef CONFIG_MSM_CAMERA | 
|  | 1814 | config_camera_off_gpios(); /* might not be necessary */ | 
|  | 1815 | #endif | 
| Laxminath Kasam | 1f2cd2a | 2012-02-15 12:12:44 +0530 | [diff] [blame] | 1816 | msm_adsp_add_pdev(); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1817 | msm_device_i2c_init(); | 
|  | 1818 | i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); | 
|  | 1819 |  | 
|  | 1820 | #ifdef CONFIG_SURF_FFA_GPIO_KEYPAD | 
|  | 1821 | if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) | 
|  | 1822 | platform_device_register(&keypad_device_7k_ffa); | 
|  | 1823 | else | 
|  | 1824 | platform_device_register(&keypad_device_surf); | 
|  | 1825 | #endif | 
|  | 1826 | lcdc_gordon_gpio_init(); | 
|  | 1827 | msm_fb_add_devices(); | 
|  | 1828 | #ifdef CONFIG_USB_EHCI_MSM_72K | 
|  | 1829 | msm7x2x_init_host(); | 
|  | 1830 | #endif | 
|  | 1831 | msm7x2x_init_mmc(); | 
|  | 1832 | bt_power_init(); | 
|  | 1833 |  | 
|  | 1834 | if (cpu_is_msm7x27()) | 
|  | 1835 | msm_pm_set_platform_data(msm7x27_pm_data, | 
|  | 1836 | ARRAY_SIZE(msm7x27_pm_data)); | 
|  | 1837 | else | 
|  | 1838 | msm_pm_set_platform_data(msm7x25_pm_data, | 
|  | 1839 | ARRAY_SIZE(msm7x25_pm_data)); | 
| Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 1840 |  | 
| Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1841 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); | 
|  | 1842 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1843 | msm7x27_wlan_init(); | 
|  | 1844 | } | 
|  | 1845 |  | 
|  | 1846 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; | 
|  | 1847 | static int __init pmem_kernel_ebi1_size_setup(char *p) | 
|  | 1848 | { | 
|  | 1849 | pmem_kernel_ebi1_size = memparse(p, NULL); | 
|  | 1850 | return 0; | 
|  | 1851 | } | 
|  | 1852 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); | 
|  | 1853 |  | 
|  | 1854 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; | 
|  | 1855 | static int __init pmem_mdp_size_setup(char *p) | 
|  | 1856 | { | 
|  | 1857 | pmem_mdp_size = memparse(p, NULL); | 
|  | 1858 | return 0; | 
|  | 1859 | } | 
|  | 1860 | early_param("pmem_mdp_size", pmem_mdp_size_setup); | 
|  | 1861 |  | 
|  | 1862 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; | 
|  | 1863 | static int __init pmem_adsp_size_setup(char *p) | 
|  | 1864 | { | 
|  | 1865 | pmem_adsp_size = memparse(p, NULL); | 
|  | 1866 | return 0; | 
|  | 1867 | } | 
|  | 1868 | early_param("pmem_adsp_size", pmem_adsp_size_setup); | 
|  | 1869 |  | 
|  | 1870 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; | 
|  | 1871 | static int __init pmem_audio_size_setup(char *p) | 
|  | 1872 | { | 
|  | 1873 | pmem_audio_size = memparse(p, NULL); | 
|  | 1874 | return 0; | 
|  | 1875 | } | 
|  | 1876 | early_param("pmem_audio_size", pmem_audio_size_setup); | 
|  | 1877 |  | 
|  | 1878 | static unsigned fb_size = MSM_FB_SIZE; | 
|  | 1879 | static int __init fb_size_setup(char *p) | 
|  | 1880 | { | 
|  | 1881 | fb_size = memparse(p, NULL); | 
|  | 1882 | return 0; | 
|  | 1883 | } | 
|  | 1884 | early_param("fb_size", fb_size_setup); | 
|  | 1885 |  | 
|  | 1886 | static void __init msm_msm7x2x_allocate_memory_regions(void) | 
|  | 1887 | { | 
|  | 1888 | void *addr; | 
|  | 1889 | unsigned long size; | 
|  | 1890 |  | 
|  | 1891 | size = fb_size ? : MSM_FB_SIZE; | 
|  | 1892 | addr = alloc_bootmem_align(size, 0x1000); | 
|  | 1893 | msm_fb_resources[0].start = __pa(addr); | 
|  | 1894 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; | 
|  | 1895 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", | 
|  | 1896 | size, addr, __pa(addr)); | 
|  | 1897 | } | 
|  | 1898 |  | 
|  | 1899 | static struct memtype_reserve msm7x27_reserve_table[] __initdata = { | 
|  | 1900 | [MEMTYPE_SMI] = { | 
|  | 1901 | }, | 
|  | 1902 | [MEMTYPE_EBI0] = { | 
|  | 1903 | .flags	=	MEMTYPE_FLAGS_1M_ALIGN, | 
|  | 1904 | }, | 
|  | 1905 | [MEMTYPE_EBI1] = { | 
|  | 1906 | .flags	=	MEMTYPE_FLAGS_1M_ALIGN, | 
|  | 1907 | }, | 
|  | 1908 | }; | 
|  | 1909 |  | 
|  | 1910 | static void __init size_pmem_devices(void) | 
|  | 1911 | { | 
|  | 1912 | #ifdef CONFIG_ANDROID_PMEM | 
|  | 1913 | android_pmem_adsp_pdata.size = pmem_adsp_size; | 
|  | 1914 | android_pmem_pdata.size = pmem_mdp_size; | 
|  | 1915 | android_pmem_audio_pdata.size = pmem_audio_size; | 
|  | 1916 | #endif | 
|  | 1917 | } | 
|  | 1918 |  | 
|  | 1919 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) | 
|  | 1920 | { | 
|  | 1921 | msm7x27_reserve_table[p->memory_type].size += p->size; | 
|  | 1922 | } | 
|  | 1923 |  | 
|  | 1924 | static void __init reserve_pmem_memory(void) | 
|  | 1925 | { | 
|  | 1926 | #ifdef CONFIG_ANDROID_PMEM | 
|  | 1927 | reserve_memory_for(&android_pmem_adsp_pdata); | 
|  | 1928 | reserve_memory_for(&android_pmem_pdata); | 
|  | 1929 | reserve_memory_for(&android_pmem_audio_pdata); | 
|  | 1930 | msm7x27_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; | 
|  | 1931 | #endif | 
|  | 1932 | } | 
|  | 1933 |  | 
|  | 1934 | static void __init msm7x27_calculate_reserve_sizes(void) | 
|  | 1935 | { | 
|  | 1936 | size_pmem_devices(); | 
|  | 1937 | reserve_pmem_memory(); | 
|  | 1938 | } | 
|  | 1939 |  | 
|  | 1940 | static int msm7x27_paddr_to_memtype(unsigned int paddr) | 
|  | 1941 | { | 
|  | 1942 | return MEMTYPE_EBI1; | 
|  | 1943 | } | 
|  | 1944 |  | 
|  | 1945 | static struct reserve_info msm7x27_reserve_info __initdata = { | 
|  | 1946 | .memtype_reserve_table = msm7x27_reserve_table, | 
|  | 1947 | .calculate_reserve_sizes = msm7x27_calculate_reserve_sizes, | 
|  | 1948 | .paddr_to_memtype = msm7x27_paddr_to_memtype, | 
|  | 1949 | }; | 
|  | 1950 |  | 
|  | 1951 | static void __init msm7x27_reserve(void) | 
|  | 1952 | { | 
|  | 1953 | reserve_info = &msm7x27_reserve_info; | 
|  | 1954 | msm_reserve(); | 
|  | 1955 | } | 
|  | 1956 |  | 
|  | 1957 | static void __init msm7x27_init_early(void) | 
|  | 1958 | { | 
|  | 1959 | msm_msm7x2x_allocate_memory_regions(); | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1960 | } | 
|  | 1961 |  | 
|  | 1962 | static void __init msm7x2x_map_io(void) | 
|  | 1963 | { | 
|  | 1964 | msm_map_common_io(); | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1965 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1966 | if (socinfo_init() < 0) | 
|  | 1967 | BUG(); | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1968 |  | 
|  | 1969 | #ifdef CONFIG_CACHE_L2X0 | 
|  | 1970 | if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) { | 
|  | 1971 | /* 7x27 has 256KB L2 cache: | 
|  | 1972 | 64Kb/Way and 4-Way Associativity; | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1973 | evmon/parity/share disabled. */ | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1974 | if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) > 1) | 
|  | 1975 | || ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1) | 
|  | 1976 | && (SOCINFO_VERSION_MINOR(socinfo_get_version()) >= 3))) | 
|  | 1977 | /* R/W latency: 4 cycles; */ | 
|  | 1978 | l2x0_init(MSM_L2CC_BASE, 0x0006801B, 0xfe000000); | 
|  | 1979 | else | 
|  | 1980 | /* R/W latency: 3 cycles; */ | 
|  | 1981 | l2x0_init(MSM_L2CC_BASE, 0x00068012, 0xfe000000); | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1982 | } | 
|  | 1983 | #endif | 
|  | 1984 | } | 
|  | 1985 |  | 
|  | 1986 | MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF") | 
| Nicolas Pitre | f631dd4 | 2011-07-05 22:38:14 -0400 | [diff] [blame] | 1987 | .atag_offset	= 0x100, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1988 | .map_io		= msm7x2x_map_io, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1989 | .reserve	= msm7x27_reserve, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1990 | .init_irq	= msm7x2x_init_irq, | 
|  | 1991 | .init_machine	= msm7x2x_init, | 
|  | 1992 | .timer		= &msm_timer, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1993 | .init_early     = msm7x27_init_early, | 
| Taniya Das | be561a0 | 2011-10-12 09:53:11 +0530 | [diff] [blame] | 1994 | .handle_irq     = vic_handle_irq, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1995 | MACHINE_END | 
|  | 1996 |  | 
|  | 1997 | MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA") | 
| Nicolas Pitre | f631dd4 | 2011-07-05 22:38:14 -0400 | [diff] [blame] | 1998 | .atag_offset	= 0x100, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 1999 | .map_io		= msm7x2x_map_io, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2000 | .reserve	= msm7x27_reserve, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2001 | .init_irq	= msm7x2x_init_irq, | 
|  | 2002 | .init_machine	= msm7x2x_init, | 
|  | 2003 | .timer		= &msm_timer, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2004 | .init_early     = msm7x27_init_early, | 
| Taniya Das | be561a0 | 2011-10-12 09:53:11 +0530 | [diff] [blame] | 2005 | .handle_irq     = vic_handle_irq, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2006 | MACHINE_END | 
|  | 2007 |  | 
|  | 2008 | MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF") | 
| Nicolas Pitre | f631dd4 | 2011-07-05 22:38:14 -0400 | [diff] [blame] | 2009 | .atag_offset	= 0x100, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2010 | .map_io		= msm7x2x_map_io, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2011 | .reserve	= msm7x27_reserve, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2012 | .init_irq	= msm7x2x_init_irq, | 
|  | 2013 | .init_machine	= msm7x2x_init, | 
|  | 2014 | .timer		= &msm_timer, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2015 | .init_early     = msm7x27_init_early, | 
| Taniya Das | be561a0 | 2011-10-12 09:53:11 +0530 | [diff] [blame] | 2016 | .handle_irq     = vic_handle_irq, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2017 | MACHINE_END | 
|  | 2018 |  | 
|  | 2019 | MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA") | 
| Nicolas Pitre | f631dd4 | 2011-07-05 22:38:14 -0400 | [diff] [blame] | 2020 | .atag_offset	= 0x100, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2021 | .map_io		= msm7x2x_map_io, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2022 | .reserve	= msm7x27_reserve, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2023 | .init_irq	= msm7x2x_init_irq, | 
|  | 2024 | .init_machine	= msm7x2x_init, | 
|  | 2025 | .timer		= &msm_timer, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2026 | .init_early     = msm7x27_init_early, | 
| Taniya Das | be561a0 | 2011-10-12 09:53:11 +0530 | [diff] [blame] | 2027 | .handle_irq     = vic_handle_irq, | 
| Daniel Walker | 2682fd3 | 2010-02-24 15:47:58 -0800 | [diff] [blame] | 2028 | MACHINE_END |