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