Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved. |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/irq.h> |
| 16 | #include <linux/gpio.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/delay.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 19 | #include <linux/bootmem.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 20 | #include <linux/io.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 21 | #ifdef CONFIG_SPI_QSD |
| 22 | #include <linux/spi/spi.h> |
| 23 | #endif |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 24 | #include <linux/msm_ssbi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | #include <linux/mfd/pmic8058.h> |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 26 | #include <linux/leds.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 27 | #include <linux/mfd/marimba.h> |
| 28 | #include <linux/i2c.h> |
| 29 | #include <linux/input.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 30 | #include <linux/smsc911x.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | #include <linux/ofn_atlab.h> |
| 32 | #include <linux/power_supply.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 33 | #include <linux/i2c/isa1200.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 34 | #include <linux/i2c/tsc2007.h> |
| 35 | #include <linux/input/kp_flip_switch.h> |
| 36 | #include <linux/leds-pmic8058.h> |
| 37 | #include <linux/input/cy8c_ts.h> |
| 38 | #include <linux/msm_adc.h> |
| 39 | #include <linux/dma-mapping.h> |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 40 | #include <linux/regulator/consumer.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 41 | |
| 42 | #include <asm/mach-types.h> |
| 43 | #include <asm/mach/arch.h> |
| 44 | #include <asm/setup.h> |
| 45 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 46 | #include <mach/mpp.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 47 | #include <mach/board.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 48 | #include <mach/camera.h> |
| 49 | #include <mach/memory.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 50 | #include <mach/msm_iomap.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 51 | #include <mach/msm_hsusb.h> |
| 52 | #include <mach/rpc_hsusb.h> |
| 53 | #include <mach/msm_spi.h> |
| 54 | #include <mach/qdsp5v2/msm_lpa.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 55 | #include <mach/dma.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 56 | #include <linux/android_pmem.h> |
| 57 | #include <linux/input/msm_ts.h> |
| 58 | #include <mach/pmic.h> |
| 59 | #include <mach/rpc_pmapp.h> |
| 60 | #include <mach/qdsp5v2/aux_pcm.h> |
| 61 | #include <mach/qdsp5v2/mi2s.h> |
| 62 | #include <mach/qdsp5v2/audio_dev_ctl.h> |
| 63 | #include <mach/msm_battery.h> |
| 64 | #include <mach/rpc_server_handset.h> |
| 65 | #include <mach/msm_tsif.h> |
| 66 | #include <mach/socinfo.h> |
| 67 | #include <mach/msm_memtypes.h> |
| 68 | #include <linux/cyttsp.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 69 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 70 | #include <asm/mach/mmc.h> |
| 71 | #include <asm/mach/flash.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 72 | #include <mach/vreg.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 73 | #include <linux/platform_data/qcom_crypto_device.h> |
| 74 | |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 75 | #include "devices.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 76 | #include "timer.h" |
| 77 | #ifdef CONFIG_USB_G_ANDROID |
| 78 | #include <linux/usb/android.h> |
| 79 | #include <mach/usbdiag.h> |
| 80 | #endif |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 81 | #include "pm.h" |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 82 | #include "pm-boot.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 83 | #include "spm.h" |
Matt Wagantall | 6d9ebee | 2011-08-26 12:15:24 -0700 | [diff] [blame] | 84 | #include "acpuclock.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 85 | #include <mach/dal_axi.h> |
| 86 | #include <mach/msm_serial_hs.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 87 | #include <mach/qdsp5v2/mi2s.h> |
| 88 | #include <mach/qdsp5v2/audio_dev_ctl.h> |
| 89 | #include <mach/sdio_al.h> |
| 90 | #include "smd_private.h" |
| 91 | #include <linux/bma150.h> |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 92 | |
Justin Paupore | 637a25d | 2011-07-14 17:11:04 -0700 | [diff] [blame] | 93 | #include "board-msm7x30-regulator.h" |
| 94 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | #define MSM_PMEM_SF_SIZE 0x1700000 |
| 96 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
| 97 | #define MSM_FB_SIZE 0x780000 |
| 98 | #else |
| 99 | #define MSM_FB_SIZE 0x500000 |
| 100 | #endif |
| 101 | #define MSM_PMEM_ADSP_SIZE 0x1E00000 |
| 102 | #define MSM_FLUID_PMEM_ADSP_SIZE 0x2800000 |
| 103 | #define PMEM_KERNEL_EBI0_SIZE 0x600000 |
| 104 | #define MSM_PMEM_AUDIO_SIZE 0x200000 |
Daniel Walker | 90e37c5 | 2010-05-12 14:24:15 -0700 | [diff] [blame] | 105 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 106 | #define PMIC_GPIO_INT 27 |
| 107 | #define PMIC_VREG_WLAN_LEVEL 2900 |
| 108 | #define PMIC_GPIO_SD_DET 36 |
| 109 | #define PMIC_GPIO_SDC4_EN_N 17 /* PMIC GPIO Number 18 */ |
| 110 | #define PMIC_GPIO_HDMI_5V_EN_V3 32 /* PMIC GPIO for V3 H/W */ |
| 111 | #define PMIC_GPIO_HDMI_5V_EN_V2 39 /* PMIC GPIO for V2 H/W */ |
| 112 | |
| 113 | #define ADV7520_I2C_ADDR 0x39 |
| 114 | |
| 115 | #define FPGA_SDCC_STATUS 0x8E0001A8 |
| 116 | |
| 117 | #define FPGA_OPTNAV_GPIO_ADDR 0x8E000026 |
| 118 | #define OPTNAV_I2C_SLAVE_ADDR (0xB0 >> 1) |
| 119 | #define OPTNAV_IRQ 20 |
| 120 | #define OPTNAV_CHIP_SELECT 19 |
Asutosh Das | 853bbcd | 2012-02-01 10:40:05 +0530 | [diff] [blame] | 121 | #define PMIC_GPIO_SDC4_PWR_EN_N 24 /* PMIC GPIO Number 25 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 122 | |
| 123 | /* Macros assume PMIC GPIOs start at 0 */ |
| 124 | #define PM8058_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + NR_GPIO_IRQS) |
| 125 | #define PM8058_GPIO_SYS_TO_PM(sys_gpio) (sys_gpio - NR_GPIO_IRQS) |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 126 | #define PM8058_MPP_BASE PM8058_GPIO_PM_TO_SYS(PM8058_GPIOS) |
| 127 | #define PM8058_MPP_PM_TO_SYS(pm_gpio) (pm_gpio + PM8058_MPP_BASE) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 128 | |
| 129 | #define PMIC_GPIO_FLASH_BOOST_ENABLE 15 /* PMIC GPIO Number 16 */ |
| 130 | #define PMIC_GPIO_HAP_ENABLE 16 /* PMIC GPIO Number 17 */ |
| 131 | |
| 132 | #define PMIC_GPIO_WLAN_EXT_POR 22 /* PMIC GPIO NUMBER 23 */ |
| 133 | |
| 134 | #define BMA150_GPIO_INT 1 |
| 135 | |
| 136 | #define HAP_LVL_SHFT_MSM_GPIO 24 |
| 137 | |
| 138 | #define PMIC_GPIO_QUICKVX_CLK 37 /* PMIC GPIO 38 */ |
| 139 | |
| 140 | #define PM_FLIP_MPP 5 /* PMIC MPP 06 */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 141 | |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 142 | #define DDR1_BANK_BASE 0X20000000 |
| 143 | #define DDR2_BANK_BASE 0X40000000 |
| 144 | |
| 145 | static unsigned int phys_add = DDR2_BANK_BASE; |
| 146 | unsigned long ebi1_phys_offset = DDR2_BANK_BASE; |
| 147 | EXPORT_SYMBOL(ebi1_phys_offset); |
| 148 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 149 | struct pm8xxx_gpio_init_info { |
| 150 | unsigned gpio; |
| 151 | struct pm_gpio config; |
| 152 | }; |
| 153 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 154 | static int pm8058_gpios_init(void) |
| 155 | { |
| 156 | int rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 157 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 158 | struct pm8xxx_gpio_init_info sdc4_en = { |
| 159 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_EN_N), |
| 160 | { |
| 161 | .direction = PM_GPIO_DIR_OUT, |
| 162 | .pull = PM_GPIO_PULL_NO, |
| 163 | .vin_sel = PM8058_GPIO_VIN_L5, |
| 164 | .function = PM_GPIO_FUNC_NORMAL, |
| 165 | .inv_int_pol = 0, |
| 166 | .out_strength = PM_GPIO_STRENGTH_LOW, |
| 167 | .output_value = 0, |
| 168 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 169 | }; |
| 170 | |
Asutosh Das | 853bbcd | 2012-02-01 10:40:05 +0530 | [diff] [blame] | 171 | struct pm8xxx_gpio_init_info sdc4_pwr_en = { |
| 172 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_PWR_EN_N), |
| 173 | { |
| 174 | .direction = PM_GPIO_DIR_OUT, |
| 175 | .pull = PM_GPIO_PULL_NO, |
| 176 | .vin_sel = PM8058_GPIO_VIN_L5, |
| 177 | .function = PM_GPIO_FUNC_NORMAL, |
| 178 | .inv_int_pol = 0, |
| 179 | .out_strength = PM_GPIO_STRENGTH_LOW, |
| 180 | .output_value = 0, |
| 181 | }, |
| 182 | }; |
| 183 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 184 | struct pm8xxx_gpio_init_info haptics_enable = { |
| 185 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_ENABLE), |
| 186 | { |
| 187 | .direction = PM_GPIO_DIR_OUT, |
| 188 | .pull = PM_GPIO_PULL_NO, |
| 189 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 190 | .function = PM_GPIO_FUNC_NORMAL, |
| 191 | .inv_int_pol = 0, |
| 192 | .vin_sel = 2, |
| 193 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 194 | .output_value = 0, |
| 195 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 196 | }; |
| 197 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 198 | struct pm8xxx_gpio_init_info hdmi_5V_en = { |
| 199 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HDMI_5V_EN_V3), |
| 200 | { |
| 201 | .direction = PM_GPIO_DIR_OUT, |
| 202 | .pull = PM_GPIO_PULL_NO, |
| 203 | .vin_sel = PM8058_GPIO_VIN_VPH, |
| 204 | .function = PM_GPIO_FUNC_NORMAL, |
| 205 | .out_strength = PM_GPIO_STRENGTH_LOW, |
| 206 | .output_value = 0, |
| 207 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 208 | }; |
| 209 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 210 | struct pm8xxx_gpio_init_info flash_boost_enable = { |
| 211 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_FLASH_BOOST_ENABLE), |
| 212 | { |
| 213 | .direction = PM_GPIO_DIR_OUT, |
| 214 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 215 | .output_value = 0, |
| 216 | .pull = PM_GPIO_PULL_NO, |
| 217 | .vin_sel = PM8058_GPIO_VIN_S3, |
| 218 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 219 | .function = PM_GPIO_FUNC_2, |
| 220 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 221 | }; |
| 222 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 223 | struct pm8xxx_gpio_init_info gpio23 = { |
| 224 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_WLAN_EXT_POR), |
| 225 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 226 | .direction = PM_GPIO_DIR_OUT, |
| 227 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 228 | .output_value = 0, |
| 229 | .pull = PM_GPIO_PULL_NO, |
| 230 | .vin_sel = 2, |
| 231 | .out_strength = PM_GPIO_STRENGTH_LOW, |
| 232 | .function = PM_GPIO_FUNC_NORMAL, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 233 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 234 | }; |
| 235 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 236 | #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 237 | struct pm8xxx_gpio_init_info sdcc_det = { |
| 238 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SD_DET - 1), |
| 239 | { |
| 240 | .direction = PM_GPIO_DIR_IN, |
| 241 | .pull = PM_GPIO_PULL_UP_1P5, |
| 242 | .vin_sel = 2, |
| 243 | .function = PM_GPIO_FUNC_NORMAL, |
| 244 | .inv_int_pol = 0, |
| 245 | }, |
| 246 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 247 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 248 | if (machine_is_msm7x30_fluid()) |
| 249 | sdcc_det.config.inv_int_pol = 1; |
| 250 | |
| 251 | rc = pm8xxx_gpio_config(sdcc_det.gpio, &sdcc_det.config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 252 | if (rc) { |
| 253 | pr_err("%s PMIC_GPIO_SD_DET config failed\n", __func__); |
| 254 | return rc; |
| 255 | } |
| 256 | #endif |
| 257 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 258 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa() || |
| 259 | machine_is_msm7x30_fluid()) |
| 260 | hdmi_5V_en.gpio = PMIC_GPIO_HDMI_5V_EN_V2; |
| 261 | else |
| 262 | hdmi_5V_en.gpio = PMIC_GPIO_HDMI_5V_EN_V3; |
| 263 | |
| 264 | hdmi_5V_en.gpio = PM8058_GPIO_PM_TO_SYS(hdmi_5V_en.gpio); |
| 265 | |
| 266 | rc = pm8xxx_gpio_config(hdmi_5V_en.gpio, &hdmi_5V_en.config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 267 | if (rc) { |
| 268 | pr_err("%s PMIC_GPIO_HDMI_5V_EN config failed\n", __func__); |
| 269 | return rc; |
| 270 | } |
| 271 | |
| 272 | /* Deassert GPIO#23 (source for Ext_POR on WLAN-Volans) */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 273 | rc = pm8xxx_gpio_config(gpio23.gpio, &gpio23.config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 274 | if (rc) { |
| 275 | pr_err("%s PMIC_GPIO_WLAN_EXT_POR config failed\n", __func__); |
| 276 | return rc; |
| 277 | } |
| 278 | |
| 279 | if (machine_is_msm7x30_fluid()) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 280 | /* Haptics gpio */ |
| 281 | rc = pm8xxx_gpio_config(haptics_enable.gpio, |
| 282 | &haptics_enable.config); |
| 283 | if (rc) { |
| 284 | pr_err("%s: PMIC GPIO %d write failed\n", __func__, |
| 285 | haptics_enable.gpio); |
| 286 | return rc; |
| 287 | } |
| 288 | /* Flash boost gpio */ |
| 289 | rc = pm8xxx_gpio_config(flash_boost_enable.gpio, |
| 290 | &flash_boost_enable.config); |
| 291 | if (rc) { |
| 292 | pr_err("%s: PMIC GPIO %d write failed\n", __func__, |
| 293 | flash_boost_enable.gpio); |
| 294 | return rc; |
| 295 | } |
| 296 | /* SCD4 gpio */ |
| 297 | rc = pm8xxx_gpio_config(sdc4_en.gpio, &sdc4_en.config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 298 | if (rc) { |
| 299 | pr_err("%s PMIC_GPIO_SDC4_EN_N config failed\n", |
| 300 | __func__); |
| 301 | return rc; |
| 302 | } |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 303 | rc = gpio_request(sdc4_en.gpio, "sdc4_en"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 304 | if (rc) { |
| 305 | pr_err("%s PMIC_GPIO_SDC4_EN_N gpio_request failed\n", |
| 306 | __func__); |
| 307 | return rc; |
| 308 | } |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 309 | gpio_set_value_cansleep(sdc4_en.gpio, 0); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 310 | } |
Asutosh Das | 853bbcd | 2012-02-01 10:40:05 +0530 | [diff] [blame] | 311 | /* FFA -> gpio_25 controls vdd of sdcc4 */ |
| 312 | else { |
| 313 | /* SCD4 gpio_25 */ |
| 314 | rc = pm8xxx_gpio_config(sdc4_pwr_en.gpio, &sdc4_pwr_en.config); |
| 315 | if (rc) { |
| 316 | pr_err("%s PMIC_GPIO_SDC4_PWR_EN_N config failed: %d\n", |
| 317 | __func__, rc); |
| 318 | return rc; |
| 319 | } |
| 320 | |
| 321 | rc = gpio_request(sdc4_pwr_en.gpio, "sdc4_pwr_en"); |
| 322 | if (rc) { |
| 323 | pr_err("PMIC_GPIO_SDC4_PWR_EN_N gpio_req failed: %d\n", |
| 324 | rc); |
| 325 | return rc; |
| 326 | } |
| 327 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 328 | |
| 329 | return 0; |
| 330 | } |
| 331 | |
Justin Paupore | 637a25d | 2011-07-14 17:11:04 -0700 | [diff] [blame] | 332 | /* Regulator API support */ |
| 333 | |
| 334 | #ifdef CONFIG_MSM_PROC_COMM_REGULATOR |
| 335 | static struct platform_device msm_proccomm_regulator_dev = { |
| 336 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 337 | .id = -1, |
| 338 | .dev = { |
| 339 | .platform_data = &msm7x30_proccomm_regulator_data |
| 340 | } |
| 341 | }; |
| 342 | #endif |
| 343 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 344 | /*virtual key support */ |
| 345 | static ssize_t tma300_vkeys_show(struct kobject *kobj, |
| 346 | struct kobj_attribute *attr, char *buf) |
| 347 | { |
| 348 | return sprintf(buf, |
| 349 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":50:842:80:100" |
| 350 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":170:842:80:100" |
| 351 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":290:842:80:100" |
| 352 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":410:842:80:100" |
| 353 | "\n"); |
| 354 | } |
| 355 | |
| 356 | static struct kobj_attribute tma300_vkeys_attr = { |
| 357 | .attr = { |
| 358 | .mode = S_IRUGO, |
| 359 | }, |
| 360 | .show = &tma300_vkeys_show, |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 361 | }; |
| 362 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 363 | static struct attribute *tma300_properties_attrs[] = { |
| 364 | &tma300_vkeys_attr.attr, |
| 365 | NULL |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 366 | }; |
| 367 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 368 | static struct attribute_group tma300_properties_attr_group = { |
| 369 | .attrs = tma300_properties_attrs, |
| 370 | }; |
| 371 | |
| 372 | static struct kobject *properties_kobj; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 373 | static struct regulator_bulk_data cyttsp_regs[] = { |
| 374 | { .supply = "ldo8", .min_uV = 1800000, .max_uV = 1800000 }, |
| 375 | { .supply = "ldo15", .min_uV = 3050000, .max_uV = 3100000 }, |
| 376 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 377 | |
| 378 | #define CYTTSP_TS_GPIO_IRQ 150 |
| 379 | static int cyttsp_platform_init(struct i2c_client *client) |
| 380 | { |
| 381 | int rc = -EINVAL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 382 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 383 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(cyttsp_regs), cyttsp_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 384 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 385 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 386 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 387 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 388 | } |
| 389 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 390 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(cyttsp_regs), cyttsp_regs); |
| 391 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 392 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 393 | pr_err("%s: could not set regulator voltages: %d\n", __func__, |
| 394 | rc); |
| 395 | goto regs_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 396 | } |
| 397 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 398 | rc = regulator_bulk_enable(ARRAY_SIZE(cyttsp_regs), cyttsp_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 399 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 400 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 401 | pr_err("%s: could not enable regulators: %d\n", __func__, rc); |
| 402 | goto regs_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 403 | } |
| 404 | |
| 405 | /* check this device active by reading first byte/register */ |
| 406 | rc = i2c_smbus_read_byte_data(client, 0x01); |
| 407 | if (rc < 0) { |
| 408 | pr_err("%s: i2c sanity check failed\n", __func__); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 409 | goto regs_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | rc = gpio_tlmm_config(GPIO_CFG(CYTTSP_TS_GPIO_IRQ, 0, GPIO_CFG_INPUT, |
| 413 | GPIO_CFG_PULL_UP, GPIO_CFG_6MA), GPIO_CFG_ENABLE); |
| 414 | if (rc) { |
| 415 | pr_err("%s: Could not configure gpio %d\n", |
| 416 | __func__, CYTTSP_TS_GPIO_IRQ); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 417 | goto regs_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 418 | } |
| 419 | |
| 420 | /* virtual keys */ |
| 421 | tma300_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c"; |
| 422 | properties_kobj = kobject_create_and_add("board_properties", |
| 423 | NULL); |
| 424 | if (properties_kobj) |
| 425 | rc = sysfs_create_group(properties_kobj, |
| 426 | &tma300_properties_attr_group); |
| 427 | if (!properties_kobj || rc) |
| 428 | pr_err("%s: failed to create board_properties\n", |
| 429 | __func__); |
| 430 | |
| 431 | return CY_OK; |
| 432 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 433 | regs_disable: |
| 434 | regulator_bulk_disable(ARRAY_SIZE(cyttsp_regs), cyttsp_regs); |
| 435 | regs_free: |
| 436 | regulator_bulk_free(ARRAY_SIZE(cyttsp_regs), cyttsp_regs); |
| 437 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 438 | return rc; |
| 439 | } |
| 440 | |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 441 | /* TODO: Put the regulator to LPM / HPM in suspend/resume*/ |
| 442 | static int cyttsp_platform_suspend(struct i2c_client *client) |
| 443 | { |
| 444 | msleep(20); |
| 445 | |
| 446 | return CY_OK; |
| 447 | } |
| 448 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 449 | static int cyttsp_platform_resume(struct i2c_client *client) |
| 450 | { |
| 451 | /* add any special code to strobe a wakeup pin or chip reset */ |
| 452 | mdelay(10); |
| 453 | |
| 454 | return CY_OK; |
| 455 | } |
| 456 | |
| 457 | static struct cyttsp_platform_data cyttsp_data = { |
| 458 | .fw_fname = "cyttsp_7630_fluid.hex", |
| 459 | .panel_maxx = 479, |
| 460 | .panel_maxy = 799, |
| 461 | .disp_maxx = 469, |
| 462 | .disp_maxy = 799, |
| 463 | .disp_minx = 10, |
| 464 | .disp_miny = 0, |
| 465 | .flags = 0, |
| 466 | .gen = CY_GEN3, /* or */ |
| 467 | .use_st = CY_USE_ST, |
| 468 | .use_mt = CY_USE_MT, |
| 469 | .use_hndshk = CY_SEND_HNDSHK, |
| 470 | .use_trk_id = CY_USE_TRACKING_ID, |
Anirudh Ghayal | 1518777 | 2011-06-22 17:39:41 +0530 | [diff] [blame] | 471 | .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 472 | .use_gestures = CY_USE_GESTURES, |
| 473 | /* activate up to 4 groups |
| 474 | * and set active distance |
| 475 | */ |
| 476 | .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 | |
| 477 | CY_GEST_GRP3 | CY_GEST_GRP4 | |
| 478 | CY_ACT_DIST, |
| 479 | /* change act_intrvl to customize the Active power state |
| 480 | * scanning/processing refresh interval for Operating mode |
| 481 | */ |
| 482 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 483 | /* change tch_tmout to customize the touch timeout for the |
| 484 | * Active power state for Operating mode |
| 485 | */ |
| 486 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 487 | /* change lp_intrvl to customize the Low Power power state |
| 488 | * scanning/processing refresh interval for Operating mode |
| 489 | */ |
| 490 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 491 | .resume = cyttsp_platform_resume, |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 492 | .suspend = cyttsp_platform_suspend, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 493 | .init = cyttsp_platform_init, |
| 494 | .sleep_gpio = -1, |
| 495 | .resout_gpio = -1, |
| 496 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
Mohan Pallaka | 49c37d6 | 2011-08-01 11:52:00 +0530 | [diff] [blame] | 497 | .correct_fw_ver = 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 498 | }; |
| 499 | |
| 500 | static int pm8058_pwm_config(struct pwm_device *pwm, int ch, int on) |
| 501 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 502 | struct pm_gpio pwm_gpio_config = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 503 | .direction = PM_GPIO_DIR_OUT, |
| 504 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 505 | .output_value = 0, |
| 506 | .pull = PM_GPIO_PULL_NO, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 507 | .vin_sel = PM8058_GPIO_VIN_S3, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 508 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 509 | .function = PM_GPIO_FUNC_2, |
| 510 | }; |
| 511 | int rc = -EINVAL; |
| 512 | int id, mode, max_mA; |
| 513 | |
| 514 | id = mode = max_mA = 0; |
| 515 | switch (ch) { |
| 516 | case 0: |
| 517 | case 1: |
| 518 | case 2: |
| 519 | if (on) { |
| 520 | id = 24 + ch; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 521 | rc = pm8xxx_gpio_config(PM8058_GPIO_PM_TO_SYS(id - 1), |
| 522 | &pwm_gpio_config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 523 | if (rc) |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 524 | pr_err("%s: pm8xxx_gpio_config(%d): rc=%d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 525 | __func__, id, rc); |
| 526 | } |
| 527 | break; |
| 528 | |
| 529 | case 3: |
| 530 | id = PM_PWM_LED_KPD; |
| 531 | mode = PM_PWM_CONF_DTEST3; |
| 532 | max_mA = 200; |
| 533 | break; |
| 534 | |
| 535 | case 4: |
| 536 | id = PM_PWM_LED_0; |
| 537 | mode = PM_PWM_CONF_PWM1; |
| 538 | max_mA = 40; |
| 539 | break; |
| 540 | |
| 541 | case 5: |
| 542 | id = PM_PWM_LED_2; |
| 543 | mode = PM_PWM_CONF_PWM2; |
| 544 | max_mA = 40; |
| 545 | break; |
| 546 | |
| 547 | case 6: |
| 548 | id = PM_PWM_LED_FLASH; |
| 549 | mode = PM_PWM_CONF_DTEST3; |
| 550 | max_mA = 200; |
| 551 | break; |
| 552 | |
| 553 | default: |
| 554 | break; |
| 555 | } |
| 556 | |
| 557 | if (ch >= 3 && ch <= 6) { |
| 558 | if (!on) { |
| 559 | mode = PM_PWM_CONF_NONE; |
| 560 | max_mA = 0; |
| 561 | } |
| 562 | rc = pm8058_pwm_config_led(pwm, id, mode, max_mA); |
| 563 | if (rc) |
| 564 | pr_err("%s: pm8058_pwm_config_led(ch=%d): rc=%d\n", |
| 565 | __func__, ch, rc); |
| 566 | } |
| 567 | |
| 568 | return rc; |
| 569 | } |
| 570 | |
| 571 | static int pm8058_pwm_enable(struct pwm_device *pwm, int ch, int on) |
| 572 | { |
| 573 | int rc; |
| 574 | |
| 575 | switch (ch) { |
| 576 | case 7: |
| 577 | rc = pm8058_pwm_set_dtest(pwm, on); |
| 578 | if (rc) |
| 579 | pr_err("%s: pwm_set_dtest(%d): rc=%d\n", |
| 580 | __func__, on, rc); |
| 581 | break; |
| 582 | default: |
| 583 | rc = -EINVAL; |
| 584 | break; |
| 585 | } |
| 586 | return rc; |
| 587 | } |
| 588 | |
| 589 | static const unsigned int fluid_keymap[] = { |
| 590 | KEY(0, 0, KEY_7), |
| 591 | KEY(0, 1, KEY_ENTER), |
| 592 | KEY(0, 2, KEY_UP), |
| 593 | /* drop (0,3) as it always shows up in pair with(0,2) */ |
| 594 | KEY(0, 4, KEY_DOWN), |
| 595 | |
| 596 | KEY(1, 0, KEY_CAMERA_SNAPSHOT), |
| 597 | KEY(1, 1, KEY_SELECT), |
| 598 | KEY(1, 2, KEY_1), |
| 599 | KEY(1, 3, KEY_VOLUMEUP), |
| 600 | KEY(1, 4, KEY_VOLUMEDOWN), |
| 601 | }; |
| 602 | |
| 603 | static const unsigned int surf_keymap[] = { |
| 604 | KEY(0, 0, KEY_7), |
| 605 | KEY(0, 1, KEY_DOWN), |
| 606 | KEY(0, 2, KEY_UP), |
| 607 | KEY(0, 3, KEY_RIGHT), |
| 608 | KEY(0, 4, KEY_ENTER), |
| 609 | KEY(0, 5, KEY_L), |
| 610 | KEY(0, 6, KEY_BACK), |
| 611 | KEY(0, 7, KEY_M), |
| 612 | |
| 613 | KEY(1, 0, KEY_LEFT), |
| 614 | KEY(1, 1, KEY_SEND), |
| 615 | KEY(1, 2, KEY_1), |
| 616 | KEY(1, 3, KEY_4), |
| 617 | KEY(1, 4, KEY_CLEAR), |
| 618 | KEY(1, 5, KEY_MSDOS), |
| 619 | KEY(1, 6, KEY_SPACE), |
| 620 | KEY(1, 7, KEY_COMMA), |
| 621 | |
| 622 | KEY(2, 0, KEY_6), |
| 623 | KEY(2, 1, KEY_5), |
| 624 | KEY(2, 2, KEY_8), |
| 625 | KEY(2, 3, KEY_3), |
| 626 | KEY(2, 4, KEY_NUMERIC_STAR), |
| 627 | KEY(2, 5, KEY_UP), |
| 628 | KEY(2, 6, KEY_DOWN), /* SYN */ |
| 629 | KEY(2, 7, KEY_LEFTSHIFT), |
| 630 | |
| 631 | KEY(3, 0, KEY_9), |
| 632 | KEY(3, 1, KEY_NUMERIC_POUND), |
| 633 | KEY(3, 2, KEY_0), |
| 634 | KEY(3, 3, KEY_2), |
| 635 | KEY(3, 4, KEY_SLEEP), |
| 636 | KEY(3, 5, KEY_F1), |
| 637 | KEY(3, 6, KEY_F2), |
| 638 | KEY(3, 7, KEY_F3), |
| 639 | |
| 640 | KEY(4, 0, KEY_BACK), |
| 641 | KEY(4, 1, KEY_HOME), |
| 642 | KEY(4, 2, KEY_MENU), |
| 643 | KEY(4, 3, KEY_VOLUMEUP), |
| 644 | KEY(4, 4, KEY_VOLUMEDOWN), |
| 645 | KEY(4, 5, KEY_F4), |
| 646 | KEY(4, 6, KEY_F5), |
| 647 | KEY(4, 7, KEY_F6), |
| 648 | |
| 649 | KEY(5, 0, KEY_R), |
| 650 | KEY(5, 1, KEY_T), |
| 651 | KEY(5, 2, KEY_Y), |
| 652 | KEY(5, 3, KEY_LEFTALT), |
| 653 | KEY(5, 4, KEY_KPENTER), |
| 654 | KEY(5, 5, KEY_Q), |
| 655 | KEY(5, 6, KEY_W), |
| 656 | KEY(5, 7, KEY_E), |
| 657 | |
| 658 | KEY(6, 0, KEY_F), |
| 659 | KEY(6, 1, KEY_G), |
| 660 | KEY(6, 2, KEY_H), |
| 661 | KEY(6, 3, KEY_CAPSLOCK), |
| 662 | KEY(6, 4, KEY_PAGEUP), |
| 663 | KEY(6, 5, KEY_A), |
| 664 | KEY(6, 6, KEY_S), |
| 665 | KEY(6, 7, KEY_D), |
| 666 | |
| 667 | KEY(7, 0, KEY_V), |
| 668 | KEY(7, 1, KEY_B), |
| 669 | KEY(7, 2, KEY_N), |
| 670 | KEY(7, 3, KEY_MENU), /* REVISIT - SYM */ |
| 671 | KEY(7, 4, KEY_PAGEDOWN), |
| 672 | KEY(7, 5, KEY_Z), |
| 673 | KEY(7, 6, KEY_X), |
| 674 | KEY(7, 7, KEY_C), |
| 675 | |
| 676 | KEY(8, 0, KEY_P), |
| 677 | KEY(8, 1, KEY_J), |
| 678 | KEY(8, 2, KEY_K), |
| 679 | KEY(8, 3, KEY_INSERT), |
| 680 | KEY(8, 4, KEY_LINEFEED), |
| 681 | KEY(8, 5, KEY_U), |
| 682 | KEY(8, 6, KEY_I), |
| 683 | KEY(8, 7, KEY_O), |
| 684 | |
| 685 | KEY(9, 0, KEY_4), |
| 686 | KEY(9, 1, KEY_5), |
| 687 | KEY(9, 2, KEY_6), |
| 688 | KEY(9, 3, KEY_7), |
| 689 | KEY(9, 4, KEY_8), |
| 690 | KEY(9, 5, KEY_1), |
| 691 | KEY(9, 6, KEY_2), |
| 692 | KEY(9, 7, KEY_3), |
| 693 | |
| 694 | KEY(10, 0, KEY_F7), |
| 695 | KEY(10, 1, KEY_F8), |
| 696 | KEY(10, 2, KEY_F9), |
| 697 | KEY(10, 3, KEY_F10), |
| 698 | KEY(10, 4, KEY_FN), |
| 699 | KEY(10, 5, KEY_9), |
| 700 | KEY(10, 6, KEY_0), |
| 701 | KEY(10, 7, KEY_DOT), |
| 702 | |
| 703 | KEY(11, 0, KEY_LEFTCTRL), |
| 704 | KEY(11, 1, KEY_F11), /* START */ |
| 705 | KEY(11, 2, KEY_ENTER), |
| 706 | KEY(11, 3, KEY_SEARCH), |
| 707 | KEY(11, 4, KEY_DELETE), |
| 708 | KEY(11, 5, KEY_RIGHT), |
| 709 | KEY(11, 6, KEY_LEFT), |
| 710 | KEY(11, 7, KEY_RIGHTSHIFT), |
| 711 | }; |
| 712 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 713 | static struct matrix_keymap_data surf_keymap_data = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 714 | .keymap_size = ARRAY_SIZE(surf_keymap), |
| 715 | .keymap = surf_keymap, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 716 | }; |
| 717 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 718 | static struct pm8xxx_keypad_platform_data surf_keypad_data = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 719 | .input_name = "surf_keypad", |
| 720 | .input_phys_device = "surf_keypad/input0", |
| 721 | .num_rows = 12, |
| 722 | .num_cols = 8, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 723 | .rows_gpio_start = PM8058_GPIO_PM_TO_SYS(8), |
| 724 | .cols_gpio_start = PM8058_GPIO_PM_TO_SYS(0), |
| 725 | .debounce_ms = 15, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 726 | .scan_delay_ms = 32, |
| 727 | .row_hold_ns = 91500, |
| 728 | .wakeup = 1, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 729 | .keymap_data = &surf_keymap_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 730 | }; |
| 731 | |
| 732 | static struct matrix_keymap_data fluid_keymap_data = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 733 | .keymap_size = ARRAY_SIZE(fluid_keymap), |
| 734 | .keymap = fluid_keymap, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 735 | }; |
| 736 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 737 | static struct pm8xxx_keypad_platform_data fluid_keypad_data = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 738 | .input_name = "fluid-keypad", |
| 739 | .input_phys_device = "fluid-keypad/input0", |
| 740 | .num_rows = 5, |
| 741 | .num_cols = 5, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 742 | .rows_gpio_start = PM8058_GPIO_PM_TO_SYS(8), |
| 743 | .cols_gpio_start = PM8058_GPIO_PM_TO_SYS(0), |
| 744 | .debounce_ms = 15, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 745 | .scan_delay_ms = 32, |
| 746 | .row_hold_ns = 91500, |
| 747 | .wakeup = 1, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 748 | .keymap_data = &fluid_keymap_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 749 | }; |
| 750 | |
| 751 | static struct pm8058_pwm_pdata pm8058_pwm_data = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 752 | .config = pm8058_pwm_config, |
| 753 | .enable = pm8058_pwm_enable, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 754 | }; |
| 755 | |
| 756 | static struct pmic8058_led pmic8058_ffa_leds[] = { |
| 757 | [0] = { |
| 758 | .name = "keyboard-backlight", |
| 759 | .max_brightness = 15, |
| 760 | .id = PMIC8058_ID_LED_KB_LIGHT, |
Dima Zavin | ba5499e | 2011-01-10 11:00:30 -0800 | [diff] [blame] | 761 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 762 | }; |
| 763 | |
| 764 | static struct pmic8058_leds_platform_data pm8058_ffa_leds_data = { |
| 765 | .num_leds = ARRAY_SIZE(pmic8058_ffa_leds), |
| 766 | .leds = pmic8058_ffa_leds, |
| 767 | }; |
| 768 | |
| 769 | static struct pmic8058_led pmic8058_surf_leds[] = { |
| 770 | [0] = { |
| 771 | .name = "keyboard-backlight", |
| 772 | .max_brightness = 15, |
| 773 | .id = PMIC8058_ID_LED_KB_LIGHT, |
| 774 | }, |
| 775 | [1] = { |
| 776 | .name = "voice:red", |
| 777 | .max_brightness = 20, |
| 778 | .id = PMIC8058_ID_LED_0, |
| 779 | }, |
| 780 | [2] = { |
| 781 | .name = "wlan:green", |
| 782 | .max_brightness = 20, |
| 783 | .id = PMIC8058_ID_LED_2, |
| 784 | }, |
| 785 | }; |
| 786 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 787 | static struct pmic8058_leds_platform_data pm8058_surf_leds_data = { |
| 788 | .num_leds = ARRAY_SIZE(pmic8058_surf_leds), |
| 789 | .leds = pmic8058_surf_leds, |
| 790 | }; |
| 791 | |
| 792 | static struct pmic8058_led pmic8058_fluid_leds[] = { |
| 793 | [0] = { |
| 794 | .name = "keyboard-backlight", |
| 795 | .max_brightness = 15, |
| 796 | .id = PMIC8058_ID_LED_KB_LIGHT, |
| 797 | }, |
| 798 | [1] = { |
| 799 | .name = "flash:led_0", |
| 800 | .max_brightness = 15, |
| 801 | .id = PMIC8058_ID_FLASH_LED_0, |
| 802 | }, |
| 803 | [2] = { |
| 804 | .name = "flash:led_1", |
| 805 | .max_brightness = 15, |
| 806 | .id = PMIC8058_ID_FLASH_LED_1, |
| 807 | }, |
| 808 | }; |
| 809 | |
| 810 | static struct pmic8058_leds_platform_data pm8058_fluid_leds_data = { |
| 811 | .num_leds = ARRAY_SIZE(pmic8058_fluid_leds), |
| 812 | .leds = pmic8058_fluid_leds, |
| 813 | }; |
| 814 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 815 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata = { |
| 816 | .irq_base = PMIC8058_IRQ_BASE, |
| 817 | .devirq = MSM_GPIO_TO_INT(PMIC_GPIO_INT), |
| 818 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 819 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 820 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 821 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata = { |
| 822 | .gpio_base = PM8058_GPIO_PM_TO_SYS(0), |
| 823 | }; |
| 824 | |
| 825 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata = { |
| 826 | .mpp_base = PM8058_MPP_PM_TO_SYS(0), |
| 827 | }; |
| 828 | |
| 829 | static struct pm8058_platform_data pm8058_7x30_data = { |
| 830 | .irq_pdata = &pm8xxx_irq_pdata, |
| 831 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 832 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 833 | .pwm_pdata = &pm8058_pwm_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 834 | }; |
| 835 | |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 836 | #ifdef CONFIG_MSM_SSBI |
| 837 | static struct msm_ssbi_platform_data msm7x30_ssbi_pm8058_pdata = { |
Kenneth Heitke | 4895291 | 2012-01-12 14:02:06 -0700 | [diff] [blame] | 838 | .rsl_id = "D:PMIC_SSBI", |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 839 | .controller_type = MSM_SBI_CTRL_SSBI2, |
| 840 | .slave = { |
| 841 | .name = "pm8058-core", |
| 842 | .platform_data = &pm8058_7x30_data, |
| 843 | }, |
| 844 | }; |
| 845 | #endif |
| 846 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 847 | static struct i2c_board_info cy8info[] __initdata = { |
| 848 | { |
| 849 | I2C_BOARD_INFO(CY_I2C_NAME, 0x24), |
| 850 | .platform_data = &cyttsp_data, |
| 851 | #ifndef CY_USE_TIMER |
| 852 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 853 | #endif /* CY_USE_TIMER */ |
| 854 | }, |
| 855 | }; |
| 856 | |
| 857 | static struct i2c_board_info msm_camera_boardinfo[] __initdata = { |
| 858 | #ifdef CONFIG_MT9D112 |
| 859 | { |
| 860 | I2C_BOARD_INFO("mt9d112", 0x78 >> 1), |
Dima Zavin | ba5499e | 2011-01-10 11:00:30 -0800 | [diff] [blame] | 861 | }, |
| 862 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 863 | #ifdef CONFIG_WEBCAM_OV9726 |
| 864 | { |
| 865 | I2C_BOARD_INFO("ov9726", 0x10), |
| 866 | }, |
| 867 | #endif |
| 868 | #ifdef CONFIG_S5K3E2FX |
| 869 | { |
| 870 | I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1), |
| 871 | }, |
| 872 | #endif |
| 873 | #ifdef CONFIG_MT9P012 |
| 874 | { |
| 875 | I2C_BOARD_INFO("mt9p012", 0x6C >> 1), |
| 876 | }, |
| 877 | #endif |
| 878 | #ifdef CONFIG_VX6953 |
| 879 | { |
| 880 | I2C_BOARD_INFO("vx6953", 0x20), |
| 881 | }, |
| 882 | #endif |
| 883 | #ifdef CONFIG_MT9E013 |
| 884 | { |
| 885 | I2C_BOARD_INFO("mt9e013", 0x6C >> 2), |
| 886 | }, |
| 887 | #endif |
| 888 | #ifdef CONFIG_SN12M0PZ |
| 889 | { |
| 890 | I2C_BOARD_INFO("sn12m0pz", 0x34 >> 1), |
| 891 | }, |
| 892 | #endif |
| 893 | #if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013) |
| 894 | { |
| 895 | I2C_BOARD_INFO("mt9t013", 0x6C), |
| 896 | }, |
| 897 | #endif |
| 898 | |
Dima Zavin | ba5499e | 2011-01-10 11:00:30 -0800 | [diff] [blame] | 899 | }; |
| 900 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 901 | #ifdef CONFIG_MSM_CAMERA |
| 902 | #define CAM_STNDBY 143 |
| 903 | static uint32_t camera_off_vcm_gpio_table[] = { |
| 904 | GPIO_CFG(1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VCM */ |
| 905 | }; |
| 906 | |
| 907 | static uint32_t camera_off_gpio_table[] = { |
| 908 | /* parallel CAMERA interfaces */ |
| 909 | GPIO_CFG(0, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* RST */ |
| 910 | GPIO_CFG(2, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT2 */ |
| 911 | GPIO_CFG(3, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT3 */ |
| 912 | GPIO_CFG(4, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT4 */ |
| 913 | GPIO_CFG(5, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT5 */ |
| 914 | GPIO_CFG(6, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT6 */ |
| 915 | GPIO_CFG(7, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT7 */ |
| 916 | GPIO_CFG(8, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT8 */ |
| 917 | GPIO_CFG(9, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT9 */ |
| 918 | GPIO_CFG(10, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT10 */ |
| 919 | GPIO_CFG(11, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT11 */ |
| 920 | GPIO_CFG(12, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* PCLK */ |
| 921 | GPIO_CFG(13, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* HSYNC_IN */ |
| 922 | GPIO_CFG(14, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VSYNC_IN */ |
| 923 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* MCLK */ |
| 924 | }; |
| 925 | |
| 926 | static uint32_t camera_on_vcm_gpio_table[] = { |
| 927 | GPIO_CFG(1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), /* VCM */ |
| 928 | }; |
| 929 | |
| 930 | static uint32_t camera_on_gpio_table[] = { |
| 931 | /* parallel CAMERA interfaces */ |
| 932 | GPIO_CFG(0, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* RST */ |
| 933 | GPIO_CFG(2, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT2 */ |
| 934 | GPIO_CFG(3, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT3 */ |
| 935 | GPIO_CFG(4, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT4 */ |
| 936 | GPIO_CFG(5, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT5 */ |
| 937 | GPIO_CFG(6, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT6 */ |
| 938 | GPIO_CFG(7, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT7 */ |
| 939 | GPIO_CFG(8, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT8 */ |
| 940 | GPIO_CFG(9, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT9 */ |
| 941 | GPIO_CFG(10, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT10 */ |
| 942 | GPIO_CFG(11, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT11 */ |
| 943 | GPIO_CFG(12, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* PCLK */ |
| 944 | GPIO_CFG(13, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* HSYNC_IN */ |
| 945 | GPIO_CFG(14, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VSYNC_IN */ |
| 946 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* MCLK */ |
| 947 | }; |
| 948 | |
| 949 | static uint32_t camera_off_gpio_fluid_table[] = { |
| 950 | /* FLUID: CAM_VGA_RST_N */ |
| 951 | GPIO_CFG(31, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 952 | /* FLUID: CAMIF_STANDBY */ |
| 953 | GPIO_CFG(CAM_STNDBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA) |
| 954 | }; |
| 955 | |
| 956 | static uint32_t camera_on_gpio_fluid_table[] = { |
| 957 | /* FLUID: CAM_VGA_RST_N */ |
| 958 | GPIO_CFG(31, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 959 | /* FLUID: CAMIF_STANDBY */ |
| 960 | GPIO_CFG(CAM_STNDBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA) |
| 961 | }; |
| 962 | |
| 963 | static void config_gpio_table(uint32_t *table, int len) |
| 964 | { |
| 965 | int n, rc; |
| 966 | for (n = 0; n < len; n++) { |
| 967 | rc = gpio_tlmm_config(table[n], GPIO_CFG_ENABLE); |
| 968 | if (rc) { |
| 969 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 970 | __func__, table[n], rc); |
| 971 | break; |
| 972 | } |
| 973 | } |
| 974 | } |
| 975 | static int config_camera_on_gpios(void) |
| 976 | { |
| 977 | config_gpio_table(camera_on_gpio_table, |
| 978 | ARRAY_SIZE(camera_on_gpio_table)); |
| 979 | |
| 980 | if (adie_get_detected_codec_type() != TIMPANI_ID) |
| 981 | /* GPIO1 is shared also used in Timpani RF card so |
| 982 | only configure it for non-Timpani RF card */ |
| 983 | config_gpio_table(camera_on_vcm_gpio_table, |
| 984 | ARRAY_SIZE(camera_on_vcm_gpio_table)); |
| 985 | |
| 986 | if (machine_is_msm7x30_fluid()) { |
| 987 | config_gpio_table(camera_on_gpio_fluid_table, |
| 988 | ARRAY_SIZE(camera_on_gpio_fluid_table)); |
| 989 | /* FLUID: turn on 5V booster */ |
| 990 | gpio_set_value( |
| 991 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_FLASH_BOOST_ENABLE), 1); |
| 992 | /* FLUID: drive high to put secondary sensor to STANDBY */ |
| 993 | gpio_set_value(CAM_STNDBY, 1); |
| 994 | } |
| 995 | return 0; |
| 996 | } |
| 997 | |
| 998 | static void config_camera_off_gpios(void) |
| 999 | { |
| 1000 | config_gpio_table(camera_off_gpio_table, |
| 1001 | ARRAY_SIZE(camera_off_gpio_table)); |
| 1002 | |
| 1003 | if (adie_get_detected_codec_type() != TIMPANI_ID) |
| 1004 | /* GPIO1 is shared also used in Timpani RF card so |
| 1005 | only configure it for non-Timpani RF card */ |
| 1006 | config_gpio_table(camera_off_vcm_gpio_table, |
| 1007 | ARRAY_SIZE(camera_off_vcm_gpio_table)); |
| 1008 | |
| 1009 | if (machine_is_msm7x30_fluid()) { |
| 1010 | config_gpio_table(camera_off_gpio_fluid_table, |
| 1011 | ARRAY_SIZE(camera_off_gpio_fluid_table)); |
| 1012 | /* FLUID: turn off 5V booster */ |
| 1013 | gpio_set_value( |
| 1014 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_FLASH_BOOST_ENABLE), 0); |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | struct resource msm_camera_resources[] = { |
| 1019 | { |
| 1020 | .start = 0xA6000000, |
| 1021 | .end = 0xA6000000 + SZ_1M - 1, |
| 1022 | .flags = IORESOURCE_MEM, |
| 1023 | }, |
| 1024 | { |
| 1025 | .start = INT_VFE, |
| 1026 | .end = INT_VFE, |
| 1027 | .flags = IORESOURCE_IRQ, |
| 1028 | }, |
| 1029 | { |
| 1030 | .flags = IORESOURCE_DMA, |
| 1031 | } |
| 1032 | }; |
| 1033 | |
| 1034 | struct msm_camera_device_platform_data msm_camera_device_data = { |
| 1035 | .camera_gpio_on = config_camera_on_gpios, |
| 1036 | .camera_gpio_off = config_camera_off_gpios, |
| 1037 | .ioext.camifpadphy = 0xAB000000, |
| 1038 | .ioext.camifpadsz = 0x00000400, |
| 1039 | .ioext.csiphy = 0xA6100000, |
| 1040 | .ioext.csisz = 0x00000400, |
| 1041 | .ioext.csiirq = INT_CSI, |
| 1042 | .ioclk.mclk_clk_rate = 24000000, |
| 1043 | .ioclk.vfe_clk_rate = 147456000, |
| 1044 | }; |
| 1045 | |
| 1046 | static struct msm_camera_sensor_flash_src msm_flash_src_pwm = { |
| 1047 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_PWM, |
| 1048 | ._fsrc.pwm_src.freq = 1000, |
| 1049 | ._fsrc.pwm_src.max_load = 300, |
| 1050 | ._fsrc.pwm_src.low_load = 30, |
| 1051 | ._fsrc.pwm_src.high_load = 100, |
| 1052 | ._fsrc.pwm_src.channel = 7, |
| 1053 | }; |
| 1054 | |
| 1055 | #ifdef CONFIG_MT9D112 |
| 1056 | static struct msm_camera_sensor_flash_data flash_mt9d112 = { |
| 1057 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1058 | .flash_src = &msm_flash_src_pwm |
| 1059 | }; |
| 1060 | |
| 1061 | static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = { |
| 1062 | .sensor_name = "mt9d112", |
| 1063 | .sensor_reset = 0, |
| 1064 | .sensor_pwd = 85, |
| 1065 | .vcm_pwd = 1, |
| 1066 | .vcm_enable = 0, |
| 1067 | .pdata = &msm_camera_device_data, |
| 1068 | .resource = msm_camera_resources, |
| 1069 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1070 | .flash_data = &flash_mt9d112, |
| 1071 | .csi_if = 0 |
| 1072 | }; |
| 1073 | |
| 1074 | static struct platform_device msm_camera_sensor_mt9d112 = { |
| 1075 | .name = "msm_camera_mt9d112", |
| 1076 | .dev = { |
| 1077 | .platform_data = &msm_camera_sensor_mt9d112_data, |
| 1078 | }, |
| 1079 | }; |
| 1080 | #endif |
| 1081 | |
| 1082 | #ifdef CONFIG_WEBCAM_OV9726 |
| 1083 | |
| 1084 | static struct msm_camera_sensor_platform_info ov9726_sensor_7630_info = { |
| 1085 | .mount_angle = 90 |
| 1086 | }; |
| 1087 | |
| 1088 | static struct msm_camera_sensor_flash_data flash_ov9726 = { |
| 1089 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1090 | .flash_src = &msm_flash_src_pwm |
| 1091 | }; |
| 1092 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = { |
| 1093 | .sensor_name = "ov9726", |
| 1094 | .sensor_reset = 0, |
| 1095 | .sensor_pwd = 85, |
| 1096 | .vcm_pwd = 1, |
| 1097 | .vcm_enable = 0, |
| 1098 | .pdata = &msm_camera_device_data, |
| 1099 | .resource = msm_camera_resources, |
| 1100 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1101 | .flash_data = &flash_ov9726, |
| 1102 | .sensor_platform_info = &ov9726_sensor_7630_info, |
| 1103 | .csi_if = 1 |
| 1104 | }; |
| 1105 | struct platform_device msm_camera_sensor_ov9726 = { |
| 1106 | .name = "msm_camera_ov9726", |
| 1107 | .dev = { |
| 1108 | .platform_data = &msm_camera_sensor_ov9726_data, |
| 1109 | }, |
| 1110 | }; |
| 1111 | #endif |
| 1112 | |
| 1113 | #ifdef CONFIG_S5K3E2FX |
| 1114 | static struct msm_camera_sensor_flash_data flash_s5k3e2fx = { |
| 1115 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1116 | .flash_src = &msm_flash_src_pwm, |
| 1117 | }; |
| 1118 | |
| 1119 | static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = { |
| 1120 | .sensor_name = "s5k3e2fx", |
| 1121 | .sensor_reset = 0, |
| 1122 | .sensor_pwd = 85, |
| 1123 | .vcm_pwd = 1, |
| 1124 | .vcm_enable = 0, |
| 1125 | .pdata = &msm_camera_device_data, |
| 1126 | .resource = msm_camera_resources, |
| 1127 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1128 | .flash_data = &flash_s5k3e2fx, |
| 1129 | .csi_if = 0 |
| 1130 | }; |
| 1131 | |
| 1132 | static struct platform_device msm_camera_sensor_s5k3e2fx = { |
| 1133 | .name = "msm_camera_s5k3e2fx", |
| 1134 | .dev = { |
| 1135 | .platform_data = &msm_camera_sensor_s5k3e2fx_data, |
| 1136 | }, |
| 1137 | }; |
| 1138 | #endif |
| 1139 | |
| 1140 | #ifdef CONFIG_MT9P012 |
| 1141 | static struct msm_camera_sensor_flash_data flash_mt9p012 = { |
| 1142 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1143 | .flash_src = &msm_flash_src_pwm |
| 1144 | }; |
| 1145 | |
| 1146 | static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = { |
| 1147 | .sensor_name = "mt9p012", |
| 1148 | .sensor_reset = 0, |
| 1149 | .sensor_pwd = 85, |
| 1150 | .vcm_pwd = 1, |
| 1151 | .vcm_enable = 1, |
| 1152 | .pdata = &msm_camera_device_data, |
| 1153 | .resource = msm_camera_resources, |
| 1154 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1155 | .flash_data = &flash_mt9p012, |
| 1156 | .csi_if = 0 |
| 1157 | }; |
| 1158 | |
| 1159 | static struct platform_device msm_camera_sensor_mt9p012 = { |
| 1160 | .name = "msm_camera_mt9p012", |
| 1161 | .dev = { |
| 1162 | .platform_data = &msm_camera_sensor_mt9p012_data, |
| 1163 | }, |
| 1164 | }; |
| 1165 | #endif |
| 1166 | |
| 1167 | #ifdef CONFIG_MT9E013 |
| 1168 | static struct msm_camera_sensor_platform_info mt9e013_sensor_7630_info = { |
| 1169 | .mount_angle = 0 |
| 1170 | }; |
| 1171 | |
| 1172 | static struct msm_camera_sensor_flash_data flash_mt9e013 = { |
| 1173 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1174 | .flash_src = &msm_flash_src_pwm |
| 1175 | }; |
| 1176 | |
| 1177 | static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = { |
| 1178 | .sensor_name = "mt9e013", |
| 1179 | .sensor_reset = 0, |
| 1180 | .sensor_pwd = 85, |
| 1181 | .vcm_pwd = 1, |
| 1182 | .vcm_enable = 1, |
| 1183 | .pdata = &msm_camera_device_data, |
| 1184 | .resource = msm_camera_resources, |
| 1185 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1186 | .flash_data = &flash_mt9e013, |
| 1187 | .sensor_platform_info = &mt9e013_sensor_7630_info, |
| 1188 | .csi_if = 1 |
| 1189 | }; |
| 1190 | |
| 1191 | static struct platform_device msm_camera_sensor_mt9e013 = { |
| 1192 | .name = "msm_camera_mt9e013", |
| 1193 | .dev = { |
| 1194 | .platform_data = &msm_camera_sensor_mt9e013_data, |
| 1195 | }, |
| 1196 | }; |
| 1197 | #endif |
| 1198 | |
| 1199 | #ifdef CONFIG_VX6953 |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 1200 | static struct msm_camera_sensor_platform_info vx6953_sensor_7630_info = { |
| 1201 | .mount_angle = 0 |
| 1202 | }; |
| 1203 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1204 | static struct msm_camera_sensor_flash_data flash_vx6953 = { |
| 1205 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1206 | .flash_src = &msm_flash_src_pwm |
| 1207 | }; |
| 1208 | static struct msm_camera_sensor_info msm_camera_sensor_vx6953_data = { |
| 1209 | .sensor_name = "vx6953", |
| 1210 | .sensor_reset = 0, |
| 1211 | .sensor_pwd = 85, |
| 1212 | .vcm_pwd = 1, |
| 1213 | .vcm_enable = 0, |
| 1214 | .pdata = &msm_camera_device_data, |
| 1215 | .resource = msm_camera_resources, |
| 1216 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 1217 | .sensor_platform_info = &vx6953_sensor_7630_info, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1218 | .flash_data = &flash_vx6953, |
| 1219 | .csi_if = 1 |
| 1220 | }; |
| 1221 | static struct platform_device msm_camera_sensor_vx6953 = { |
| 1222 | .name = "msm_camera_vx6953", |
| 1223 | .dev = { |
| 1224 | .platform_data = &msm_camera_sensor_vx6953_data, |
| 1225 | }, |
| 1226 | }; |
| 1227 | #endif |
| 1228 | |
| 1229 | #ifdef CONFIG_SN12M0PZ |
| 1230 | static struct msm_camera_sensor_flash_src msm_flash_src_current_driver = { |
| 1231 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER, |
| 1232 | ._fsrc.current_driver_src.low_current = 210, |
| 1233 | ._fsrc.current_driver_src.high_current = 700, |
| 1234 | ._fsrc.current_driver_src.driver_channel = &pm8058_fluid_leds_data, |
| 1235 | }; |
| 1236 | |
| 1237 | static struct msm_camera_sensor_flash_data flash_sn12m0pz = { |
| 1238 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1239 | .flash_src = &msm_flash_src_current_driver |
| 1240 | }; |
| 1241 | static struct msm_camera_sensor_info msm_camera_sensor_sn12m0pz_data = { |
| 1242 | .sensor_name = "sn12m0pz", |
| 1243 | .sensor_reset = 0, |
| 1244 | .sensor_pwd = 85, |
| 1245 | .vcm_pwd = 1, |
| 1246 | .vcm_enable = 1, |
| 1247 | .pdata = &msm_camera_device_data, |
| 1248 | .flash_data = &flash_sn12m0pz, |
| 1249 | .resource = msm_camera_resources, |
| 1250 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1251 | .csi_if = 0 |
| 1252 | }; |
| 1253 | |
| 1254 | static struct platform_device msm_camera_sensor_sn12m0pz = { |
| 1255 | .name = "msm_camera_sn12m0pz", |
| 1256 | .dev = { |
| 1257 | .platform_data = &msm_camera_sensor_sn12m0pz_data, |
| 1258 | }, |
| 1259 | }; |
| 1260 | #endif |
| 1261 | |
| 1262 | #ifdef CONFIG_MT9T013 |
| 1263 | static struct msm_camera_sensor_flash_data flash_mt9t013 = { |
| 1264 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1265 | .flash_src = &msm_flash_src_pwm |
| 1266 | }; |
| 1267 | |
| 1268 | static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = { |
| 1269 | .sensor_name = "mt9t013", |
| 1270 | .sensor_reset = 0, |
| 1271 | .sensor_pwd = 85, |
| 1272 | .vcm_pwd = 1, |
| 1273 | .vcm_enable = 0, |
| 1274 | .pdata = &msm_camera_device_data, |
| 1275 | .resource = msm_camera_resources, |
| 1276 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 1277 | .flash_data = &flash_mt9t013, |
| 1278 | .csi_if = 1 |
| 1279 | }; |
| 1280 | |
| 1281 | static struct platform_device msm_camera_sensor_mt9t013 = { |
| 1282 | .name = "msm_camera_mt9t013", |
| 1283 | .dev = { |
| 1284 | .platform_data = &msm_camera_sensor_mt9t013_data, |
| 1285 | }, |
| 1286 | }; |
| 1287 | #endif |
| 1288 | |
| 1289 | #ifdef CONFIG_MSM_GEMINI |
| 1290 | static struct resource msm_gemini_resources[] = { |
| 1291 | { |
| 1292 | .start = 0xA3A00000, |
| 1293 | .end = 0xA3A00000 + 0x0150 - 1, |
| 1294 | .flags = IORESOURCE_MEM, |
| 1295 | }, |
| 1296 | { |
| 1297 | .start = INT_JPEG, |
| 1298 | .end = INT_JPEG, |
| 1299 | .flags = IORESOURCE_IRQ, |
| 1300 | }, |
| 1301 | }; |
| 1302 | |
| 1303 | static struct platform_device msm_gemini_device = { |
| 1304 | .name = "msm_gemini", |
| 1305 | .resource = msm_gemini_resources, |
| 1306 | .num_resources = ARRAY_SIZE(msm_gemini_resources), |
| 1307 | }; |
| 1308 | #endif |
| 1309 | |
| 1310 | #ifdef CONFIG_MSM_VPE |
| 1311 | static struct resource msm_vpe_resources[] = { |
| 1312 | { |
| 1313 | .start = 0xAD200000, |
| 1314 | .end = 0xAD200000 + SZ_1M - 1, |
| 1315 | .flags = IORESOURCE_MEM, |
| 1316 | }, |
| 1317 | { |
| 1318 | .start = INT_VPE, |
| 1319 | .end = INT_VPE, |
| 1320 | .flags = IORESOURCE_IRQ, |
| 1321 | }, |
| 1322 | }; |
| 1323 | |
| 1324 | static struct platform_device msm_vpe_device = { |
| 1325 | .name = "msm_vpe", |
| 1326 | .id = 0, |
| 1327 | .num_resources = ARRAY_SIZE(msm_vpe_resources), |
| 1328 | .resource = msm_vpe_resources, |
| 1329 | }; |
| 1330 | #endif |
| 1331 | |
| 1332 | #endif /*CONFIG_MSM_CAMERA*/ |
| 1333 | |
| 1334 | #ifdef CONFIG_MSM7KV2_AUDIO |
| 1335 | static uint32_t audio_pamp_gpio_config = |
| 1336 | GPIO_CFG(82, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); |
| 1337 | |
| 1338 | static uint32_t audio_fluid_icodec_tx_config = |
| 1339 | GPIO_CFG(85, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); |
| 1340 | |
| 1341 | static int __init snddev_poweramp_gpio_init(void) |
| 1342 | { |
| 1343 | int rc; |
| 1344 | |
| 1345 | pr_info("snddev_poweramp_gpio_init \n"); |
| 1346 | rc = gpio_tlmm_config(audio_pamp_gpio_config, GPIO_CFG_ENABLE); |
| 1347 | if (rc) { |
| 1348 | printk(KERN_ERR |
| 1349 | "%s: gpio_tlmm_config(%#x)=%d\n", |
| 1350 | __func__, audio_pamp_gpio_config, rc); |
| 1351 | } |
| 1352 | return rc; |
| 1353 | } |
| 1354 | |
| 1355 | void msm_snddev_tx_route_config(void) |
| 1356 | { |
| 1357 | int rc; |
| 1358 | |
| 1359 | pr_debug("%s()\n", __func__); |
| 1360 | |
| 1361 | if (machine_is_msm7x30_fluid()) { |
| 1362 | rc = gpio_tlmm_config(audio_fluid_icodec_tx_config, |
| 1363 | GPIO_CFG_ENABLE); |
| 1364 | if (rc) { |
| 1365 | printk(KERN_ERR |
| 1366 | "%s: gpio_tlmm_config(%#x)=%d\n", |
| 1367 | __func__, audio_fluid_icodec_tx_config, rc); |
| 1368 | } else |
| 1369 | gpio_set_value(85, 0); |
| 1370 | } |
| 1371 | } |
| 1372 | |
| 1373 | void msm_snddev_tx_route_deconfig(void) |
| 1374 | { |
| 1375 | int rc; |
| 1376 | |
| 1377 | pr_debug("%s()\n", __func__); |
| 1378 | |
| 1379 | if (machine_is_msm7x30_fluid()) { |
| 1380 | rc = gpio_tlmm_config(audio_fluid_icodec_tx_config, |
| 1381 | GPIO_CFG_DISABLE); |
| 1382 | if (rc) { |
| 1383 | printk(KERN_ERR |
| 1384 | "%s: gpio_tlmm_config(%#x)=%d\n", |
| 1385 | __func__, audio_fluid_icodec_tx_config, rc); |
| 1386 | } |
| 1387 | } |
| 1388 | } |
| 1389 | |
| 1390 | void msm_snddev_poweramp_on(void) |
| 1391 | { |
| 1392 | gpio_set_value(82, 1); /* enable spkr poweramp */ |
| 1393 | pr_info("%s: power on amplifier\n", __func__); |
| 1394 | } |
| 1395 | |
| 1396 | void msm_snddev_poweramp_off(void) |
| 1397 | { |
| 1398 | gpio_set_value(82, 0); /* disable spkr poweramp */ |
| 1399 | pr_info("%s: power off amplifier\n", __func__); |
| 1400 | } |
| 1401 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1402 | static struct regulator_bulk_data snddev_regs[] = { |
| 1403 | { .supply = "gp4", .min_uV = 2600000, .max_uV = 2600000 }, |
| 1404 | { .supply = "ncp", .min_uV = 1800000, .max_uV = 1800000 }, |
| 1405 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1406 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1407 | static int __init snddev_hsed_voltage_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1408 | { |
| 1409 | int rc; |
| 1410 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1411 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(snddev_regs), snddev_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1412 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1413 | if (rc) { |
| 1414 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 1415 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1416 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1417 | |
| 1418 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(snddev_regs), snddev_regs); |
| 1419 | |
| 1420 | if (rc) { |
| 1421 | pr_err("%s: could not set regulator voltages: %d\n", |
| 1422 | __func__, rc); |
| 1423 | goto regs_free; |
| 1424 | } |
| 1425 | |
| 1426 | return 0; |
| 1427 | |
| 1428 | regs_free: |
| 1429 | regulator_bulk_free(ARRAY_SIZE(snddev_regs), snddev_regs); |
| 1430 | out: |
| 1431 | return rc; |
| 1432 | } |
| 1433 | |
| 1434 | |
| 1435 | void msm_snddev_hsed_voltage_on(void) |
| 1436 | { |
| 1437 | int rc = regulator_bulk_enable(ARRAY_SIZE(snddev_regs), snddev_regs); |
| 1438 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1439 | if (rc) |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1440 | pr_err("%s: could not enable regulators: %d\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1441 | } |
| 1442 | |
| 1443 | void msm_snddev_hsed_voltage_off(void) |
| 1444 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1445 | int rc = regulator_bulk_disable(ARRAY_SIZE(snddev_regs), snddev_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1446 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1447 | if (rc) { |
| 1448 | pr_err("%s: could not disable regulators: %d\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1449 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1450 | } |
| 1451 | |
| 1452 | static unsigned aux_pcm_gpio_on[] = { |
| 1453 | GPIO_CFG(138, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_DOUT */ |
| 1454 | GPIO_CFG(139, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_DIN */ |
| 1455 | GPIO_CFG(140, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_SYNC */ |
| 1456 | GPIO_CFG(141, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_CLK */ |
| 1457 | }; |
| 1458 | |
| 1459 | static int __init aux_pcm_gpio_init(void) |
| 1460 | { |
| 1461 | int pin, rc; |
| 1462 | |
| 1463 | pr_info("aux_pcm_gpio_init \n"); |
| 1464 | for (pin = 0; pin < ARRAY_SIZE(aux_pcm_gpio_on); pin++) { |
| 1465 | rc = gpio_tlmm_config(aux_pcm_gpio_on[pin], |
| 1466 | GPIO_CFG_ENABLE); |
| 1467 | if (rc) { |
| 1468 | printk(KERN_ERR |
| 1469 | "%s: gpio_tlmm_config(%#x)=%d\n", |
| 1470 | __func__, aux_pcm_gpio_on[pin], rc); |
| 1471 | } |
| 1472 | } |
| 1473 | return rc; |
| 1474 | } |
| 1475 | |
| 1476 | static struct msm_gpio mi2s_clk_gpios[] = { |
| 1477 | { GPIO_CFG(145, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1478 | "MI2S_SCLK"}, |
| 1479 | { GPIO_CFG(144, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1480 | "MI2S_WS"}, |
| 1481 | { GPIO_CFG(120, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1482 | "MI2S_MCLK_A"}, |
| 1483 | }; |
| 1484 | |
| 1485 | static struct msm_gpio mi2s_rx_data_lines_gpios[] = { |
| 1486 | { GPIO_CFG(121, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1487 | "MI2S_DATA_SD0_A"}, |
| 1488 | { GPIO_CFG(122, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1489 | "MI2S_DATA_SD1_A"}, |
| 1490 | { GPIO_CFG(123, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1491 | "MI2S_DATA_SD2_A"}, |
| 1492 | { GPIO_CFG(146, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1493 | "MI2S_DATA_SD3"}, |
| 1494 | }; |
| 1495 | |
| 1496 | static struct msm_gpio mi2s_tx_data_lines_gpios[] = { |
| 1497 | { GPIO_CFG(146, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1498 | "MI2S_DATA_SD3"}, |
| 1499 | }; |
| 1500 | |
| 1501 | int mi2s_config_clk_gpio(void) |
| 1502 | { |
| 1503 | int rc = 0; |
| 1504 | |
| 1505 | rc = msm_gpios_request_enable(mi2s_clk_gpios, |
| 1506 | ARRAY_SIZE(mi2s_clk_gpios)); |
| 1507 | if (rc) { |
| 1508 | pr_err("%s: enable mi2s clk gpios failed\n", |
| 1509 | __func__); |
| 1510 | return rc; |
| 1511 | } |
| 1512 | return 0; |
| 1513 | } |
| 1514 | |
| 1515 | int mi2s_unconfig_data_gpio(u32 direction, u8 sd_line_mask) |
| 1516 | { |
| 1517 | int i, rc = 0; |
| 1518 | sd_line_mask &= MI2S_SD_LINE_MASK; |
| 1519 | |
| 1520 | switch (direction) { |
| 1521 | case DIR_TX: |
| 1522 | msm_gpios_disable_free(mi2s_tx_data_lines_gpios, 1); |
| 1523 | break; |
| 1524 | case DIR_RX: |
| 1525 | i = 0; |
| 1526 | while (sd_line_mask) { |
| 1527 | if (sd_line_mask & 0x1) |
| 1528 | msm_gpios_disable_free( |
| 1529 | mi2s_rx_data_lines_gpios + i , 1); |
| 1530 | sd_line_mask = sd_line_mask >> 1; |
| 1531 | i++; |
| 1532 | } |
| 1533 | break; |
| 1534 | default: |
| 1535 | pr_err("%s: Invaild direction direction = %u\n", |
| 1536 | __func__, direction); |
| 1537 | rc = -EINVAL; |
| 1538 | break; |
| 1539 | } |
| 1540 | return rc; |
| 1541 | } |
| 1542 | |
| 1543 | int mi2s_config_data_gpio(u32 direction, u8 sd_line_mask) |
| 1544 | { |
| 1545 | int i , rc = 0; |
| 1546 | u8 sd_config_done_mask = 0; |
| 1547 | |
| 1548 | sd_line_mask &= MI2S_SD_LINE_MASK; |
| 1549 | |
| 1550 | switch (direction) { |
| 1551 | case DIR_TX: |
| 1552 | if ((sd_line_mask & MI2S_SD_0) || (sd_line_mask & MI2S_SD_1) || |
| 1553 | (sd_line_mask & MI2S_SD_2) || !(sd_line_mask & MI2S_SD_3)) { |
| 1554 | pr_err("%s: can not use SD0 or SD1 or SD2 for TX" |
| 1555 | ".only can use SD3. sd_line_mask = 0x%x\n", |
| 1556 | __func__ , sd_line_mask); |
| 1557 | rc = -EINVAL; |
| 1558 | } else { |
| 1559 | rc = msm_gpios_request_enable(mi2s_tx_data_lines_gpios, |
| 1560 | 1); |
| 1561 | if (rc) |
| 1562 | pr_err("%s: enable mi2s gpios for TX failed\n", |
| 1563 | __func__); |
| 1564 | } |
| 1565 | break; |
| 1566 | case DIR_RX: |
| 1567 | i = 0; |
| 1568 | while (sd_line_mask && (rc == 0)) { |
| 1569 | if (sd_line_mask & 0x1) { |
| 1570 | rc = msm_gpios_request_enable( |
| 1571 | mi2s_rx_data_lines_gpios + i , 1); |
| 1572 | if (rc) { |
| 1573 | pr_err("%s: enable mi2s gpios for" |
| 1574 | "RX failed. SD line = %s\n", |
| 1575 | __func__, |
| 1576 | (mi2s_rx_data_lines_gpios + i)->label); |
| 1577 | mi2s_unconfig_data_gpio(DIR_RX, |
| 1578 | sd_config_done_mask); |
| 1579 | } else |
| 1580 | sd_config_done_mask |= (1 << i); |
| 1581 | } |
| 1582 | sd_line_mask = sd_line_mask >> 1; |
| 1583 | i++; |
| 1584 | } |
| 1585 | break; |
| 1586 | default: |
| 1587 | pr_err("%s: Invaild direction direction = %u\n", |
| 1588 | __func__, direction); |
| 1589 | rc = -EINVAL; |
| 1590 | break; |
| 1591 | } |
| 1592 | return rc; |
| 1593 | } |
| 1594 | |
| 1595 | int mi2s_unconfig_clk_gpio(void) |
| 1596 | { |
| 1597 | msm_gpios_disable_free(mi2s_clk_gpios, ARRAY_SIZE(mi2s_clk_gpios)); |
| 1598 | return 0; |
| 1599 | } |
| 1600 | |
| 1601 | #endif /* CONFIG_MSM7KV2_AUDIO */ |
| 1602 | |
| 1603 | static int __init buses_init(void) |
| 1604 | { |
| 1605 | if (gpio_tlmm_config(GPIO_CFG(PMIC_GPIO_INT, 1, GPIO_CFG_INPUT, |
| 1606 | GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE)) |
| 1607 | pr_err("%s: gpio_tlmm_config (gpio=%d) failed\n", |
| 1608 | __func__, PMIC_GPIO_INT); |
| 1609 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1610 | if (machine_is_msm8x60_fluid()) |
| 1611 | pm8058_7x30_data.keypad_pdata = &fluid_keypad_data; |
| 1612 | else |
| 1613 | pm8058_7x30_data.keypad_pdata = &surf_keypad_data; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1614 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1615 | return 0; |
| 1616 | } |
| 1617 | |
| 1618 | #define TIMPANI_RESET_GPIO 1 |
| 1619 | |
| 1620 | struct bahama_config_register{ |
| 1621 | u8 reg; |
| 1622 | u8 value; |
| 1623 | u8 mask; |
| 1624 | }; |
| 1625 | |
| 1626 | enum version{ |
| 1627 | VER_1_0, |
| 1628 | VER_2_0, |
| 1629 | VER_UNSUPPORTED = 0xFF |
| 1630 | }; |
| 1631 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1632 | static struct regulator *vreg_marimba_1; |
| 1633 | static struct regulator *vreg_marimba_2; |
| 1634 | static struct regulator *vreg_bahama; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1635 | |
| 1636 | static struct msm_gpio timpani_reset_gpio_cfg[] = { |
| 1637 | { GPIO_CFG(TIMPANI_RESET_GPIO, 0, GPIO_CFG_OUTPUT, |
| 1638 | GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "timpani_reset"} }; |
| 1639 | |
| 1640 | static u8 read_bahama_ver(void) |
| 1641 | { |
| 1642 | int rc; |
| 1643 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA }; |
| 1644 | u8 bahama_version; |
| 1645 | |
| 1646 | rc = marimba_read_bit_mask(&config, 0x00, &bahama_version, 1, 0x1F); |
| 1647 | if (rc < 0) { |
| 1648 | printk(KERN_ERR |
| 1649 | "%s: version read failed: %d\n", |
| 1650 | __func__, rc); |
| 1651 | return rc; |
| 1652 | } else { |
| 1653 | printk(KERN_INFO |
| 1654 | "%s: version read got: 0x%x\n", |
| 1655 | __func__, bahama_version); |
| 1656 | } |
| 1657 | |
| 1658 | switch (bahama_version) { |
| 1659 | case 0x08: /* varient of bahama v1 */ |
| 1660 | case 0x10: |
| 1661 | case 0x00: |
| 1662 | return VER_1_0; |
| 1663 | case 0x09: /* variant of bahama v2 */ |
| 1664 | return VER_2_0; |
| 1665 | default: |
| 1666 | return VER_UNSUPPORTED; |
| 1667 | } |
| 1668 | } |
| 1669 | |
| 1670 | static int config_timpani_reset(void) |
| 1671 | { |
| 1672 | int rc; |
| 1673 | |
| 1674 | rc = msm_gpios_request_enable(timpani_reset_gpio_cfg, |
| 1675 | ARRAY_SIZE(timpani_reset_gpio_cfg)); |
| 1676 | if (rc < 0) { |
| 1677 | printk(KERN_ERR |
| 1678 | "%s: msm_gpios_request_enable failed (%d)\n", |
| 1679 | __func__, rc); |
| 1680 | } |
| 1681 | return rc; |
| 1682 | } |
| 1683 | |
| 1684 | static unsigned int msm_timpani_setup_power(void) |
| 1685 | { |
| 1686 | int rc; |
| 1687 | |
| 1688 | rc = config_timpani_reset(); |
| 1689 | if (rc < 0) |
| 1690 | goto out; |
| 1691 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1692 | rc = regulator_enable(vreg_marimba_1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1693 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1694 | pr_err("%s: regulator_enable failed (%d)\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1695 | goto out; |
| 1696 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1697 | |
| 1698 | rc = regulator_enable(vreg_marimba_2); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1699 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1700 | pr_err("%s: regulator_enable failed (%d)\n", __func__, rc); |
| 1701 | goto disable_marimba_1; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1702 | } |
| 1703 | |
| 1704 | rc = gpio_direction_output(TIMPANI_RESET_GPIO, 1); |
| 1705 | if (rc < 0) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1706 | pr_err("%s: gpio_direction_output failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1707 | __func__, rc); |
| 1708 | msm_gpios_free(timpani_reset_gpio_cfg, |
| 1709 | ARRAY_SIZE(timpani_reset_gpio_cfg)); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1710 | goto disable_marimba_2; |
| 1711 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1712 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1713 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1714 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1715 | disable_marimba_2: |
| 1716 | regulator_disable(vreg_marimba_2); |
| 1717 | disable_marimba_1: |
| 1718 | regulator_disable(vreg_marimba_1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1719 | out: |
| 1720 | return rc; |
| 1721 | }; |
| 1722 | |
| 1723 | static void msm_timpani_shutdown_power(void) |
| 1724 | { |
| 1725 | int rc; |
| 1726 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1727 | rc = regulator_disable(vreg_marimba_2); |
| 1728 | if (rc) |
| 1729 | pr_err("%s: regulator_disable failed (%d)\n", __func__, rc); |
| 1730 | |
| 1731 | rc = regulator_disable(vreg_marimba_1); |
| 1732 | if (rc) |
| 1733 | pr_err("%s: regulator_disable failed (%d)\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1734 | |
| 1735 | rc = gpio_direction_output(TIMPANI_RESET_GPIO, 0); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1736 | if (rc < 0) |
| 1737 | pr_err("%s: gpio_direction_output failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1738 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1739 | |
| 1740 | msm_gpios_free(timpani_reset_gpio_cfg, |
| 1741 | ARRAY_SIZE(timpani_reset_gpio_cfg)); |
| 1742 | }; |
| 1743 | |
| 1744 | static unsigned int msm_bahama_core_config(int type) |
| 1745 | { |
| 1746 | int rc = 0; |
| 1747 | |
| 1748 | if (type == BAHAMA_ID) { |
| 1749 | |
| 1750 | int i; |
| 1751 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA }; |
| 1752 | |
| 1753 | const struct bahama_config_register v20_init[] = { |
| 1754 | /* reg, value, mask */ |
| 1755 | { 0xF4, 0x84, 0xFF }, /* AREG */ |
| 1756 | { 0xF0, 0x04, 0xFF } /* DREG */ |
| 1757 | }; |
| 1758 | |
| 1759 | if (read_bahama_ver() == VER_2_0) { |
| 1760 | for (i = 0; i < ARRAY_SIZE(v20_init); i++) { |
| 1761 | u8 value = v20_init[i].value; |
| 1762 | rc = marimba_write_bit_mask(&config, |
| 1763 | v20_init[i].reg, |
| 1764 | &value, |
| 1765 | sizeof(v20_init[i].value), |
| 1766 | v20_init[i].mask); |
| 1767 | if (rc < 0) { |
| 1768 | printk(KERN_ERR |
| 1769 | "%s: reg %d write failed: %d\n", |
| 1770 | __func__, v20_init[i].reg, rc); |
| 1771 | return rc; |
| 1772 | } |
| 1773 | printk(KERN_INFO "%s: reg 0x%02x value 0x%02x" |
| 1774 | " mask 0x%02x\n", |
| 1775 | __func__, v20_init[i].reg, |
| 1776 | v20_init[i].value, v20_init[i].mask); |
| 1777 | } |
| 1778 | } |
| 1779 | } |
| 1780 | printk(KERN_INFO "core type: %d\n", type); |
| 1781 | |
| 1782 | return rc; |
| 1783 | } |
| 1784 | |
| 1785 | static unsigned int msm_bahama_setup_power(void) |
| 1786 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1787 | int rc = regulator_enable(vreg_bahama); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1788 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1789 | if (rc) |
| 1790 | pr_err("%s: regulator_enable failed (%d)\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1791 | |
| 1792 | return rc; |
| 1793 | }; |
| 1794 | |
| 1795 | static unsigned int msm_bahama_shutdown_power(int value) |
| 1796 | { |
| 1797 | int rc = 0; |
| 1798 | |
| 1799 | if (value != BAHAMA_ID) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1800 | rc = regulator_disable(vreg_bahama); |
| 1801 | |
| 1802 | if (rc) |
| 1803 | pr_err("%s: regulator_disable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1804 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1805 | } |
| 1806 | |
| 1807 | return rc; |
| 1808 | }; |
| 1809 | |
| 1810 | static struct msm_gpio marimba_svlte_config_clock[] = { |
| 1811 | { GPIO_CFG(34, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 1812 | "MARIMBA_SVLTE_CLOCK_ENABLE" }, |
| 1813 | }; |
| 1814 | |
| 1815 | static unsigned int msm_marimba_gpio_config_svlte(int gpio_cfg_marimba) |
| 1816 | { |
| 1817 | if (machine_is_msm8x55_svlte_surf() || |
| 1818 | machine_is_msm8x55_svlte_ffa()) { |
| 1819 | if (gpio_cfg_marimba) |
| 1820 | gpio_set_value(GPIO_PIN |
| 1821 | (marimba_svlte_config_clock->gpio_cfg), 1); |
| 1822 | else |
| 1823 | gpio_set_value(GPIO_PIN |
| 1824 | (marimba_svlte_config_clock->gpio_cfg), 0); |
| 1825 | } |
| 1826 | |
| 1827 | return 0; |
| 1828 | }; |
| 1829 | |
| 1830 | static unsigned int msm_marimba_setup_power(void) |
| 1831 | { |
| 1832 | int rc; |
| 1833 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1834 | rc = regulator_enable(vreg_marimba_1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1835 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1836 | pr_err("%s: regulator_enable failed (%d)\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1837 | goto out; |
| 1838 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1839 | |
| 1840 | rc = regulator_enable(vreg_marimba_2); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1841 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1842 | pr_err("%s: regulator_enable failed (%d)\n", __func__, rc); |
| 1843 | goto disable_marimba_1; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1844 | } |
| 1845 | |
| 1846 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) { |
| 1847 | rc = msm_gpios_request_enable(marimba_svlte_config_clock, |
| 1848 | ARRAY_SIZE(marimba_svlte_config_clock)); |
| 1849 | if (rc < 0) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1850 | pr_err("%s: msm_gpios_request_enable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1851 | __func__, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1852 | goto disable_marimba_2; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1853 | } |
| 1854 | |
| 1855 | rc = gpio_direction_output(GPIO_PIN |
| 1856 | (marimba_svlte_config_clock->gpio_cfg), 0); |
| 1857 | if (rc < 0) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1858 | pr_err("%s: gpio_direction_output failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1859 | __func__, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1860 | goto disable_marimba_2; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1861 | } |
| 1862 | } |
| 1863 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1864 | return 0; |
| 1865 | |
| 1866 | disable_marimba_2: |
| 1867 | regulator_disable(vreg_marimba_2); |
| 1868 | disable_marimba_1: |
| 1869 | regulator_disable(vreg_marimba_1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1870 | out: |
| 1871 | return rc; |
| 1872 | }; |
| 1873 | |
| 1874 | static void msm_marimba_shutdown_power(void) |
| 1875 | { |
| 1876 | int rc; |
| 1877 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1878 | rc = regulator_disable(vreg_marimba_2); |
| 1879 | if (rc) |
| 1880 | pr_err("%s: regulator_disable failed (%d)\n", __func__, rc); |
| 1881 | |
| 1882 | rc = regulator_disable(vreg_marimba_1); |
| 1883 | if (rc) |
| 1884 | pr_err("%s: regulator_disable failed (%d)\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1885 | }; |
| 1886 | |
| 1887 | static int bahama_present(void) |
| 1888 | { |
| 1889 | int id; |
| 1890 | switch (id = adie_get_detected_connectivity_type()) { |
| 1891 | case BAHAMA_ID: |
| 1892 | return 1; |
| 1893 | |
| 1894 | case MARIMBA_ID: |
| 1895 | return 0; |
| 1896 | |
| 1897 | case TIMPANI_ID: |
| 1898 | default: |
| 1899 | printk(KERN_ERR "%s: unexpected adie connectivity type: %d\n", |
| 1900 | __func__, id); |
| 1901 | return -ENODEV; |
| 1902 | } |
| 1903 | } |
| 1904 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1905 | struct regulator *fm_regulator; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1906 | static int fm_radio_setup(struct marimba_fm_platform_data *pdata) |
| 1907 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1908 | int rc, voltage; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1909 | uint32_t irqcfg; |
| 1910 | const char *id = "FMPW"; |
| 1911 | |
| 1912 | int bahama_not_marimba = bahama_present(); |
| 1913 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1914 | if (bahama_not_marimba < 0) { |
| 1915 | pr_warn("%s: bahama_present: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1916 | __func__, bahama_not_marimba); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1917 | rc = -ENODEV; |
| 1918 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1919 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1920 | if (bahama_not_marimba) { |
| 1921 | fm_regulator = regulator_get(NULL, "s3"); |
| 1922 | voltage = 1800000; |
| 1923 | } else { |
| 1924 | fm_regulator = regulator_get(NULL, "s2"); |
| 1925 | voltage = 1300000; |
| 1926 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1927 | |
| 1928 | if (IS_ERR(fm_regulator)) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1929 | rc = PTR_ERR(fm_regulator); |
| 1930 | pr_err("%s: regulator_get failed (%d)\n", __func__, rc); |
| 1931 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1932 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1933 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1934 | rc = regulator_set_voltage(fm_regulator, voltage, voltage); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1935 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1936 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1937 | pr_err("%s: regulator_set_voltage failed (%d)\n", __func__, rc); |
| 1938 | goto regulator_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1939 | } |
| 1940 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1941 | rc = regulator_enable(fm_regulator); |
| 1942 | |
| 1943 | if (rc) { |
| 1944 | pr_err("%s: regulator_enable failed (%d)\n", __func__, rc); |
| 1945 | goto regulator_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1946 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1947 | |
| 1948 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO, PMAPP_CLOCK_VOTE_ON); |
| 1949 | |
| 1950 | if (rc < 0) { |
| 1951 | pr_err("%s: clock vote failed (%d)\n", __func__, rc); |
| 1952 | goto regulator_disable; |
| 1953 | } |
| 1954 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1955 | /*Request the Clock Using GPIO34/AP2MDM_MRMBCK_EN in case |
| 1956 | of svlte*/ |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1957 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1958 | rc = marimba_gpio_config(1); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1959 | if (rc < 0) { |
| 1960 | pr_err("%s: clock enable for svlte : %d\n", |
| 1961 | __func__, rc); |
| 1962 | goto clock_devote; |
| 1963 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1964 | } |
| 1965 | irqcfg = GPIO_CFG(147, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 1966 | GPIO_CFG_2MA); |
| 1967 | rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE); |
| 1968 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1969 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", __func__, irqcfg, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1970 | rc = -EIO; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1971 | goto gpio_deconfig; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1972 | |
| 1973 | } |
| 1974 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1975 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1976 | gpio_deconfig: |
| 1977 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) |
| 1978 | marimba_gpio_config(0); |
| 1979 | clock_devote: |
| 1980 | pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO, PMAPP_CLOCK_VOTE_OFF); |
| 1981 | regulator_disable: |
| 1982 | regulator_disable(fm_regulator); |
| 1983 | regulator_free: |
| 1984 | regulator_put(fm_regulator); |
| 1985 | fm_regulator = NULL; |
| 1986 | out: |
| 1987 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1988 | }; |
| 1989 | |
| 1990 | static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata) |
| 1991 | { |
| 1992 | int rc; |
| 1993 | const char *id = "FMPW"; |
| 1994 | uint32_t irqcfg = GPIO_CFG(147, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 1995 | GPIO_CFG_2MA); |
| 1996 | |
| 1997 | int bahama_not_marimba = bahama_present(); |
| 1998 | if (bahama_not_marimba == -1) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 1999 | pr_warn("%s: bahama_present: %d\n", |
| 2000 | __func__, bahama_not_marimba); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2001 | return; |
| 2002 | } |
| 2003 | |
| 2004 | rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE); |
| 2005 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2006 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", __func__, irqcfg, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2007 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2008 | if (!IS_ERR_OR_NULL(fm_regulator)) { |
| 2009 | rc = regulator_disable(fm_regulator); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2010 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2011 | if (rc) |
| 2012 | pr_err("%s: return val: %d\n", __func__, rc); |
| 2013 | |
| 2014 | regulator_put(fm_regulator); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2015 | fm_regulator = NULL; |
| 2016 | } |
| 2017 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO, |
| 2018 | PMAPP_CLOCK_VOTE_OFF); |
| 2019 | if (rc < 0) |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2020 | pr_err("%s: clock_vote return val: %d\n", __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2021 | |
| 2022 | /*Disable the Clock Using GPIO34/AP2MDM_MRMBCK_EN in case |
| 2023 | of svlte*/ |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2024 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2025 | rc = marimba_gpio_config(0); |
| 2026 | if (rc < 0) |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2027 | pr_err("%s: clock disable for svlte : %d\n", |
| 2028 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2029 | } |
| 2030 | } |
| 2031 | |
| 2032 | static struct marimba_fm_platform_data marimba_fm_pdata = { |
| 2033 | .fm_setup = fm_radio_setup, |
| 2034 | .fm_shutdown = fm_radio_shutdown, |
| 2035 | .irq = MSM_GPIO_TO_INT(147), |
| 2036 | .vreg_s2 = NULL, |
| 2037 | .vreg_xo_out = NULL, |
| 2038 | .is_fm_soc_i2s_master = false, |
| 2039 | .config_i2s_gpio = NULL, |
| 2040 | }; |
| 2041 | |
| 2042 | |
| 2043 | /* Slave id address for FM/CDC/QMEMBIST |
| 2044 | * Values can be programmed using Marimba slave id 0 |
| 2045 | * should there be a conflict with other I2C devices |
| 2046 | * */ |
| 2047 | #define MARIMBA_SLAVE_ID_FM_ADDR 0x2A |
| 2048 | #define MARIMBA_SLAVE_ID_CDC_ADDR 0x77 |
| 2049 | #define MARIMBA_SLAVE_ID_QMEMBIST_ADDR 0X66 |
| 2050 | |
| 2051 | #define BAHAMA_SLAVE_ID_FM_ADDR 0x2A |
| 2052 | #define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B |
| 2053 | |
| 2054 | static const char *tsadc_id = "MADC"; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2055 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2056 | static struct regulator_bulk_data regs_tsadc_marimba[] = { |
| 2057 | { .supply = "gp12", .min_uV = 2200000, .max_uV = 2200000 }, |
| 2058 | { .supply = "s2", .min_uV = 1300000, .max_uV = 1300000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2059 | }; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2060 | |
| 2061 | static struct regulator_bulk_data regs_tsadc_timpani[] = { |
| 2062 | { .supply = "s3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2063 | { .supply = "gp12", .min_uV = 2200000, .max_uV = 2200000 }, |
| 2064 | { .supply = "gp16", .min_uV = 1200000, .max_uV = 1200000 }, |
| 2065 | }; |
| 2066 | |
| 2067 | static struct regulator_bulk_data *regs_tsadc; |
| 2068 | static int regs_tsadc_count; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2069 | |
| 2070 | static int marimba_tsadc_power(int vreg_on) |
| 2071 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2072 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2073 | int tsadc_adie_type = adie_get_detected_codec_type(); |
| 2074 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2075 | switch (tsadc_adie_type) { |
| 2076 | case TIMPANI_ID: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2077 | rc = pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_D1, |
| 2078 | vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF); |
| 2079 | if (rc) { |
| 2080 | pr_err("%s: unable to %svote for d1 clk\n", |
| 2081 | __func__, vreg_on ? "" : "de-"); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2082 | goto D1_vote_fail; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2083 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2084 | |
| 2085 | /* fall through */ |
| 2086 | case MARIMBA_ID: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2087 | rc = pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_DO, |
| 2088 | vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF); |
| 2089 | if (rc) { |
| 2090 | pr_err("%s: unable to %svote for d1 clk\n", |
| 2091 | __func__, vreg_on ? "" : "de-"); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2092 | goto D0_vote_fail; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2093 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2094 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2095 | WARN_ON(regs_tsadc_count == 0); |
| 2096 | |
| 2097 | rc = vreg_on ? |
| 2098 | regulator_bulk_enable(regs_tsadc_count, regs_tsadc) : |
| 2099 | regulator_bulk_disable(regs_tsadc_count, regs_tsadc); |
| 2100 | |
| 2101 | if (rc) { |
| 2102 | pr_err("%s: regulator %sable failed: %d\n", |
| 2103 | __func__, vreg_on ? "en" : "dis", rc); |
| 2104 | goto regulator_switch_fail; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2105 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2106 | |
| 2107 | break; |
| 2108 | default: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2109 | pr_err("%s:Adie %d not supported\n", |
| 2110 | __func__, tsadc_adie_type); |
| 2111 | return -ENODEV; |
| 2112 | } |
| 2113 | |
| 2114 | msleep(5); /* ensure power is stable */ |
| 2115 | |
| 2116 | return 0; |
| 2117 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2118 | regulator_switch_fail: |
| 2119 | pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_DO, |
| 2120 | vreg_on ? PMAPP_CLOCK_VOTE_OFF : PMAPP_CLOCK_VOTE_ON); |
| 2121 | D0_vote_fail: |
| 2122 | if (tsadc_adie_type == TIMPANI_ID) |
| 2123 | pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_D1, |
| 2124 | vreg_on ? PMAPP_CLOCK_VOTE_OFF : PMAPP_CLOCK_VOTE_ON); |
| 2125 | D1_vote_fail: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2126 | return rc; |
| 2127 | } |
| 2128 | |
| 2129 | static int marimba_tsadc_init(void) |
| 2130 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2131 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2132 | int tsadc_adie_type = adie_get_detected_codec_type(); |
| 2133 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2134 | switch (tsadc_adie_type) { |
| 2135 | case MARIMBA_ID: |
| 2136 | regs_tsadc = regs_tsadc_marimba; |
| 2137 | regs_tsadc_count = ARRAY_SIZE(regs_tsadc_marimba); |
| 2138 | break; |
| 2139 | case TIMPANI_ID: |
| 2140 | regs_tsadc = regs_tsadc_timpani; |
| 2141 | regs_tsadc_count = ARRAY_SIZE(regs_tsadc_timpani); |
| 2142 | break; |
| 2143 | default: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2144 | pr_err("%s:Adie %d not supported\n", |
| 2145 | __func__, tsadc_adie_type); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2146 | rc = -ENODEV; |
| 2147 | goto out; |
| 2148 | } |
| 2149 | |
| 2150 | rc = regulator_bulk_get(NULL, regs_tsadc_count, regs_tsadc); |
| 2151 | if (rc) { |
| 2152 | pr_err("%s: could not get regulators: %d\n", |
| 2153 | __func__, rc); |
| 2154 | goto out; |
| 2155 | } |
| 2156 | |
| 2157 | rc = regulator_bulk_set_voltage(regs_tsadc_count, regs_tsadc); |
| 2158 | if (rc) { |
| 2159 | pr_err("%s: could not set regulator voltages: %d\n", |
| 2160 | __func__, rc); |
| 2161 | goto vreg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2162 | } |
| 2163 | |
| 2164 | return 0; |
| 2165 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2166 | vreg_free: |
| 2167 | regulator_bulk_free(regs_tsadc_count, regs_tsadc); |
| 2168 | out: |
| 2169 | regs_tsadc = NULL; |
| 2170 | regs_tsadc_count = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2171 | return rc; |
| 2172 | } |
| 2173 | |
| 2174 | static int marimba_tsadc_exit(void) |
| 2175 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2176 | regulator_bulk_free(regs_tsadc_count, regs_tsadc); |
| 2177 | regs_tsadc_count = 0; |
| 2178 | regs_tsadc = NULL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2179 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2180 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2181 | } |
| 2182 | |
| 2183 | |
| 2184 | static struct msm_ts_platform_data msm_ts_data = { |
Anirudh Ghayal | 82b7472 | 2012-01-19 15:35:34 +0530 | [diff] [blame] | 2185 | .min_x = 284, |
| 2186 | .max_x = 3801, |
| 2187 | .min_y = 155, |
| 2188 | .max_y = 3929, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2189 | .min_press = 0, |
| 2190 | .max_press = 255, |
| 2191 | .inv_x = 4096, |
| 2192 | .inv_y = 4096, |
| 2193 | .can_wakeup = false, |
| 2194 | }; |
| 2195 | |
| 2196 | static struct marimba_tsadc_platform_data marimba_tsadc_pdata = { |
| 2197 | .marimba_tsadc_power = marimba_tsadc_power, |
| 2198 | .init = marimba_tsadc_init, |
| 2199 | .exit = marimba_tsadc_exit, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2200 | .tsadc_prechg_en = true, |
| 2201 | .can_wakeup = false, |
| 2202 | .setup = { |
| 2203 | .pen_irq_en = true, |
| 2204 | .tsadc_en = true, |
| 2205 | }, |
| 2206 | .params2 = { |
| 2207 | .input_clk_khz = 2400, |
| 2208 | .sample_prd = TSADC_CLK_3, |
| 2209 | }, |
| 2210 | .params3 = { |
| 2211 | .prechg_time_nsecs = 6400, |
| 2212 | .stable_time_nsecs = 6400, |
| 2213 | .tsadc_test_mode = 0, |
| 2214 | }, |
| 2215 | .tssc_data = &msm_ts_data, |
| 2216 | }; |
| 2217 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2218 | static struct regulator_bulk_data codec_regs[] = { |
| 2219 | { .supply = "s4", .min_uV = 2200000, .max_uV = 2200000 }, |
| 2220 | }; |
| 2221 | |
| 2222 | static int __init msm_marimba_codec_init(void) |
| 2223 | { |
| 2224 | int rc = regulator_bulk_get(NULL, ARRAY_SIZE(codec_regs), codec_regs); |
| 2225 | |
| 2226 | if (rc) { |
| 2227 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 2228 | goto out; |
| 2229 | } |
| 2230 | |
| 2231 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(codec_regs), codec_regs); |
| 2232 | if (rc) { |
| 2233 | pr_err("%s: could not set regulator voltages: %d\n", |
| 2234 | __func__, rc); |
| 2235 | goto reg_free; |
| 2236 | } |
| 2237 | |
| 2238 | return rc; |
| 2239 | |
| 2240 | reg_free: |
| 2241 | regulator_bulk_free(ARRAY_SIZE(codec_regs), codec_regs); |
| 2242 | out: |
| 2243 | return rc; |
| 2244 | } |
| 2245 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2246 | static int msm_marimba_codec_power(int vreg_on) |
| 2247 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2248 | int rc = vreg_on ? |
| 2249 | regulator_bulk_enable(ARRAY_SIZE(codec_regs), codec_regs) : |
| 2250 | regulator_bulk_disable(ARRAY_SIZE(codec_regs), codec_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2251 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2252 | if (rc) { |
| 2253 | pr_err("%s: could not %sable regulators: %d", |
| 2254 | __func__, vreg_on ? "en" : "dis", rc); |
| 2255 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2256 | } |
| 2257 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2258 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2259 | } |
| 2260 | |
| 2261 | static struct marimba_codec_platform_data mariba_codec_pdata = { |
| 2262 | .marimba_codec_power = msm_marimba_codec_power, |
| 2263 | #ifdef CONFIG_MARIMBA_CODEC |
| 2264 | .snddev_profile_init = msm_snddev_init, |
| 2265 | #endif |
| 2266 | }; |
| 2267 | |
| 2268 | static struct marimba_platform_data marimba_pdata = { |
| 2269 | .slave_id[MARIMBA_SLAVE_ID_FM] = MARIMBA_SLAVE_ID_FM_ADDR, |
| 2270 | .slave_id[MARIMBA_SLAVE_ID_CDC] = MARIMBA_SLAVE_ID_CDC_ADDR, |
| 2271 | .slave_id[MARIMBA_SLAVE_ID_QMEMBIST] = MARIMBA_SLAVE_ID_QMEMBIST_ADDR, |
| 2272 | .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR, |
| 2273 | .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR, |
| 2274 | .marimba_setup = msm_marimba_setup_power, |
| 2275 | .marimba_shutdown = msm_marimba_shutdown_power, |
| 2276 | .bahama_setup = msm_bahama_setup_power, |
| 2277 | .bahama_shutdown = msm_bahama_shutdown_power, |
| 2278 | .marimba_gpio_config = msm_marimba_gpio_config_svlte, |
| 2279 | .bahama_core_config = msm_bahama_core_config, |
| 2280 | .fm = &marimba_fm_pdata, |
| 2281 | .codec = &mariba_codec_pdata, |
| 2282 | .tsadc_ssbi_adap = MARIMBA_SSBI_ADAP, |
| 2283 | }; |
| 2284 | |
| 2285 | static void __init msm7x30_init_marimba(void) |
| 2286 | { |
| 2287 | int rc; |
| 2288 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2289 | struct regulator_bulk_data regs[] = { |
| 2290 | { .supply = "s3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2291 | { .supply = "gp16", .min_uV = 1200000, .max_uV = 1200000 }, |
| 2292 | { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2293 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2294 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2295 | rc = msm_marimba_codec_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2296 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2297 | if (rc) { |
| 2298 | pr_err("%s: msm_marimba_codec_init failed (%d)\n", |
| 2299 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2300 | return; |
| 2301 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2302 | |
| 2303 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs), regs); |
| 2304 | |
| 2305 | if (rc) { |
| 2306 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 2307 | return; |
| 2308 | } |
| 2309 | |
| 2310 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs), regs); |
| 2311 | |
| 2312 | if (rc) { |
| 2313 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 2314 | regulator_bulk_free(ARRAY_SIZE(regs), regs); |
| 2315 | return; |
| 2316 | } |
| 2317 | |
| 2318 | vreg_marimba_1 = regs[0].consumer; |
| 2319 | vreg_marimba_2 = regs[1].consumer; |
| 2320 | vreg_bahama = regs[2].consumer; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2321 | } |
| 2322 | |
| 2323 | static struct marimba_codec_platform_data timpani_codec_pdata = { |
| 2324 | .marimba_codec_power = msm_marimba_codec_power, |
| 2325 | #ifdef CONFIG_TIMPANI_CODEC |
| 2326 | .snddev_profile_init = msm_snddev_init_timpani, |
| 2327 | #endif |
| 2328 | }; |
| 2329 | |
| 2330 | static struct marimba_platform_data timpani_pdata = { |
| 2331 | .slave_id[MARIMBA_SLAVE_ID_CDC] = MARIMBA_SLAVE_ID_CDC_ADDR, |
| 2332 | .slave_id[MARIMBA_SLAVE_ID_QMEMBIST] = MARIMBA_SLAVE_ID_QMEMBIST_ADDR, |
| 2333 | .marimba_setup = msm_timpani_setup_power, |
| 2334 | .marimba_shutdown = msm_timpani_shutdown_power, |
| 2335 | .codec = &timpani_codec_pdata, |
| 2336 | .tsadc = &marimba_tsadc_pdata, |
| 2337 | .tsadc_ssbi_adap = MARIMBA_SSBI_ADAP, |
| 2338 | }; |
| 2339 | |
| 2340 | #define TIMPANI_I2C_SLAVE_ADDR 0xD |
| 2341 | |
| 2342 | static struct i2c_board_info msm_i2c_gsbi7_timpani_info[] = { |
| 2343 | { |
| 2344 | I2C_BOARD_INFO("timpani", TIMPANI_I2C_SLAVE_ADDR), |
| 2345 | .platform_data = &timpani_pdata, |
| 2346 | }, |
| 2347 | }; |
| 2348 | |
| 2349 | #ifdef CONFIG_MSM7KV2_AUDIO |
| 2350 | static struct resource msm_aictl_resources[] = { |
| 2351 | { |
| 2352 | .name = "aictl", |
| 2353 | .start = 0xa5000100, |
| 2354 | .end = 0xa5000100, |
| 2355 | .flags = IORESOURCE_MEM, |
| 2356 | } |
| 2357 | }; |
| 2358 | |
| 2359 | static struct resource msm_mi2s_resources[] = { |
| 2360 | { |
| 2361 | .name = "hdmi", |
| 2362 | .start = 0xac900000, |
| 2363 | .end = 0xac900038, |
| 2364 | .flags = IORESOURCE_MEM, |
| 2365 | }, |
| 2366 | { |
| 2367 | .name = "codec_rx", |
| 2368 | .start = 0xac940040, |
| 2369 | .end = 0xac940078, |
| 2370 | .flags = IORESOURCE_MEM, |
| 2371 | }, |
| 2372 | { |
| 2373 | .name = "codec_tx", |
| 2374 | .start = 0xac980080, |
| 2375 | .end = 0xac9800B8, |
| 2376 | .flags = IORESOURCE_MEM, |
| 2377 | } |
| 2378 | |
| 2379 | }; |
| 2380 | |
| 2381 | static struct msm_lpa_platform_data lpa_pdata = { |
| 2382 | .obuf_hlb_size = 0x2BFF8, |
| 2383 | .dsp_proc_id = 0, |
| 2384 | .app_proc_id = 2, |
| 2385 | .nosb_config = { |
| 2386 | .llb_min_addr = 0, |
| 2387 | .llb_max_addr = 0x3ff8, |
| 2388 | .sb_min_addr = 0, |
| 2389 | .sb_max_addr = 0, |
| 2390 | }, |
| 2391 | .sb_config = { |
| 2392 | .llb_min_addr = 0, |
| 2393 | .llb_max_addr = 0x37f8, |
| 2394 | .sb_min_addr = 0x3800, |
| 2395 | .sb_max_addr = 0x3ff8, |
| 2396 | } |
| 2397 | }; |
| 2398 | |
| 2399 | static struct resource msm_lpa_resources[] = { |
| 2400 | { |
| 2401 | .name = "lpa", |
| 2402 | .start = 0xa5000000, |
| 2403 | .end = 0xa50000a0, |
| 2404 | .flags = IORESOURCE_MEM, |
| 2405 | } |
| 2406 | }; |
| 2407 | |
| 2408 | static struct resource msm_aux_pcm_resources[] = { |
| 2409 | |
| 2410 | { |
| 2411 | .name = "aux_codec_reg_addr", |
| 2412 | .start = 0xac9c00c0, |
| 2413 | .end = 0xac9c00c8, |
| 2414 | .flags = IORESOURCE_MEM, |
| 2415 | }, |
| 2416 | { |
| 2417 | .name = "aux_pcm_dout", |
| 2418 | .start = 138, |
| 2419 | .end = 138, |
| 2420 | .flags = IORESOURCE_IO, |
| 2421 | }, |
| 2422 | { |
| 2423 | .name = "aux_pcm_din", |
| 2424 | .start = 139, |
| 2425 | .end = 139, |
| 2426 | .flags = IORESOURCE_IO, |
| 2427 | }, |
| 2428 | { |
| 2429 | .name = "aux_pcm_syncout", |
| 2430 | .start = 140, |
| 2431 | .end = 140, |
| 2432 | .flags = IORESOURCE_IO, |
| 2433 | }, |
| 2434 | { |
| 2435 | .name = "aux_pcm_clkin_a", |
| 2436 | .start = 141, |
| 2437 | .end = 141, |
| 2438 | .flags = IORESOURCE_IO, |
| 2439 | }, |
| 2440 | }; |
| 2441 | |
| 2442 | static struct platform_device msm_aux_pcm_device = { |
| 2443 | .name = "msm_aux_pcm", |
| 2444 | .id = 0, |
| 2445 | .num_resources = ARRAY_SIZE(msm_aux_pcm_resources), |
| 2446 | .resource = msm_aux_pcm_resources, |
| 2447 | }; |
| 2448 | |
| 2449 | struct platform_device msm_aictl_device = { |
| 2450 | .name = "audio_interct", |
| 2451 | .id = 0, |
| 2452 | .num_resources = ARRAY_SIZE(msm_aictl_resources), |
| 2453 | .resource = msm_aictl_resources, |
| 2454 | }; |
| 2455 | |
| 2456 | struct platform_device msm_mi2s_device = { |
| 2457 | .name = "mi2s", |
| 2458 | .id = 0, |
| 2459 | .num_resources = ARRAY_SIZE(msm_mi2s_resources), |
| 2460 | .resource = msm_mi2s_resources, |
| 2461 | }; |
| 2462 | |
| 2463 | struct platform_device msm_lpa_device = { |
| 2464 | .name = "lpa", |
| 2465 | .id = 0, |
| 2466 | .num_resources = ARRAY_SIZE(msm_lpa_resources), |
| 2467 | .resource = msm_lpa_resources, |
| 2468 | .dev = { |
| 2469 | .platform_data = &lpa_pdata, |
| 2470 | }, |
| 2471 | }; |
| 2472 | #endif /* CONFIG_MSM7KV2_AUDIO */ |
| 2473 | |
| 2474 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 2475 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 2476 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 2477 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 2478 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 2479 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 2480 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 2481 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 2482 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 2483 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 2484 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 2485 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 2486 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 2487 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 2488 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 2489 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 2490 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 2491 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 2492 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 2493 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 2494 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 2495 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 2496 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 2497 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 2498 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 2499 | |
| 2500 | static unsigned int dec_concurrency_table[] = { |
| 2501 | /* Audio LP */ |
| 2502 | 0, |
| 2503 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2504 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2505 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2506 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_MODE_LP)| |
| 2507 | (1<<MSM_ADSP_OP_DM)), |
| 2508 | |
| 2509 | /* Concurrency 1 */ |
| 2510 | (DEC4_FORMAT), |
| 2511 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2512 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2513 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2514 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2515 | |
| 2516 | /* Concurrency 2 */ |
| 2517 | (DEC4_FORMAT), |
| 2518 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2519 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2520 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2521 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2522 | |
| 2523 | /* Concurrency 3 */ |
| 2524 | (DEC4_FORMAT), |
| 2525 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2526 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2527 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2528 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2529 | |
| 2530 | /* Concurrency 4 */ |
| 2531 | (DEC4_FORMAT), |
| 2532 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2533 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2534 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2535 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2536 | |
| 2537 | /* Concurrency 5 */ |
| 2538 | (DEC4_FORMAT), |
| 2539 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2540 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2541 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2542 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2543 | |
| 2544 | /* Concurrency 6 */ |
| 2545 | (DEC4_FORMAT), |
| 2546 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2547 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2548 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2549 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 2550 | }; |
| 2551 | |
| 2552 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 2553 | .module_queueid = queueid, .module_decid = decid, \ |
| 2554 | .nr_codec_support = nr_codec} |
| 2555 | |
| 2556 | #define DEC_INSTANCE(max_instance_same, max_instance_diff) { \ |
| 2557 | .max_instances_same_dec = max_instance_same, \ |
| 2558 | .max_instances_diff_dec = max_instance_diff} |
| 2559 | |
| 2560 | static struct msm_adspdec_info dec_info_list[] = { |
| 2561 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 2562 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 2563 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 2564 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 2565 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 2566 | }; |
| 2567 | |
| 2568 | static struct dec_instance_table dec_instance_list[][MSM_MAX_DEC_CNT] = { |
| 2569 | /* Non Turbo Mode */ |
| 2570 | { |
| 2571 | DEC_INSTANCE(4, 3), /* WAV */ |
| 2572 | DEC_INSTANCE(4, 3), /* ADPCM */ |
| 2573 | DEC_INSTANCE(4, 2), /* MP3 */ |
| 2574 | DEC_INSTANCE(0, 0), /* Real Audio */ |
| 2575 | DEC_INSTANCE(4, 2), /* WMA */ |
| 2576 | DEC_INSTANCE(3, 2), /* AAC */ |
| 2577 | DEC_INSTANCE(0, 0), /* Reserved */ |
| 2578 | DEC_INSTANCE(0, 0), /* MIDI */ |
| 2579 | DEC_INSTANCE(4, 3), /* YADPCM */ |
| 2580 | DEC_INSTANCE(4, 3), /* QCELP */ |
| 2581 | DEC_INSTANCE(4, 3), /* AMRNB */ |
| 2582 | DEC_INSTANCE(1, 1), /* AMRWB/WB+ */ |
| 2583 | DEC_INSTANCE(4, 3), /* EVRC */ |
| 2584 | DEC_INSTANCE(1, 1), /* WMAPRO */ |
| 2585 | }, |
| 2586 | /* Turbo Mode */ |
| 2587 | { |
| 2588 | DEC_INSTANCE(4, 3), /* WAV */ |
| 2589 | DEC_INSTANCE(4, 3), /* ADPCM */ |
| 2590 | DEC_INSTANCE(4, 3), /* MP3 */ |
| 2591 | DEC_INSTANCE(0, 0), /* Real Audio */ |
| 2592 | DEC_INSTANCE(4, 3), /* WMA */ |
| 2593 | DEC_INSTANCE(4, 3), /* AAC */ |
| 2594 | DEC_INSTANCE(0, 0), /* Reserved */ |
| 2595 | DEC_INSTANCE(0, 0), /* MIDI */ |
| 2596 | DEC_INSTANCE(4, 3), /* YADPCM */ |
| 2597 | DEC_INSTANCE(4, 3), /* QCELP */ |
| 2598 | DEC_INSTANCE(4, 3), /* AMRNB */ |
| 2599 | DEC_INSTANCE(2, 3), /* AMRWB/WB+ */ |
| 2600 | DEC_INSTANCE(4, 3), /* EVRC */ |
| 2601 | DEC_INSTANCE(1, 2), /* WMAPRO */ |
| 2602 | }, |
| 2603 | }; |
| 2604 | |
| 2605 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 2606 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 2607 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 2608 | ARRAY_SIZE(dec_info_list)), |
| 2609 | .dec_concurrency_table = dec_concurrency_table, |
| 2610 | .dec_info_list = dec_info_list, |
| 2611 | .dec_instance_list = &dec_instance_list[0][0], |
| 2612 | }; |
| 2613 | |
| 2614 | static struct platform_device msm_device_adspdec = { |
| 2615 | .name = "msm_adspdec", |
| 2616 | .id = -1, |
| 2617 | .dev = { |
| 2618 | .platform_data = &msm_device_adspdec_database |
| 2619 | }, |
| 2620 | }; |
| 2621 | |
| 2622 | static struct resource smc91x_resources[] = { |
| 2623 | [0] = { |
| 2624 | .start = 0x8A000300, |
| 2625 | .end = 0x8A0003ff, |
| 2626 | .flags = IORESOURCE_MEM, |
| 2627 | }, |
| 2628 | [1] = { |
| 2629 | .start = MSM_GPIO_TO_INT(156), |
| 2630 | .end = MSM_GPIO_TO_INT(156), |
| 2631 | .flags = IORESOURCE_IRQ, |
| 2632 | }, |
| 2633 | }; |
| 2634 | |
| 2635 | static struct platform_device smc91x_device = { |
| 2636 | .name = "smc91x", |
| 2637 | .id = 0, |
| 2638 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 2639 | .resource = smc91x_resources, |
| 2640 | }; |
| 2641 | |
| 2642 | static struct smsc911x_platform_config smsc911x_config = { |
| 2643 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 2644 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 2645 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 2646 | .flags = SMSC911X_USE_32BIT, |
| 2647 | }; |
| 2648 | |
| 2649 | static struct resource smsc911x_resources[] = { |
| 2650 | [0] = { |
| 2651 | .start = 0x8D000000, |
| 2652 | .end = 0x8D000100, |
| 2653 | .flags = IORESOURCE_MEM, |
| 2654 | }, |
| 2655 | [1] = { |
| 2656 | .start = MSM_GPIO_TO_INT(88), |
| 2657 | .end = MSM_GPIO_TO_INT(88), |
| 2658 | .flags = IORESOURCE_IRQ, |
| 2659 | }, |
| 2660 | }; |
| 2661 | |
| 2662 | static struct platform_device smsc911x_device = { |
| 2663 | .name = "smsc911x", |
| 2664 | .id = -1, |
| 2665 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 2666 | .resource = smsc911x_resources, |
| 2667 | .dev = { |
| 2668 | .platform_data = &smsc911x_config, |
| 2669 | }, |
| 2670 | }; |
| 2671 | |
| 2672 | static struct msm_gpio smsc911x_gpios[] = { |
| 2673 | { GPIO_CFG(172, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr6" }, |
| 2674 | { GPIO_CFG(173, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr5" }, |
| 2675 | { GPIO_CFG(174, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr4" }, |
| 2676 | { GPIO_CFG(175, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr3" }, |
| 2677 | { GPIO_CFG(176, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr2" }, |
| 2678 | { GPIO_CFG(177, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr1" }, |
| 2679 | { GPIO_CFG(178, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr0" }, |
| 2680 | { GPIO_CFG(88, 2, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), "smsc911x_irq" }, |
| 2681 | }; |
| 2682 | |
| 2683 | static void msm7x30_cfg_smsc911x(void) |
| 2684 | { |
| 2685 | int rc; |
| 2686 | |
| 2687 | rc = msm_gpios_request_enable(smsc911x_gpios, |
| 2688 | ARRAY_SIZE(smsc911x_gpios)); |
| 2689 | if (rc) |
| 2690 | pr_err("%s: unable to enable gpios\n", __func__); |
| 2691 | } |
| 2692 | |
| 2693 | #ifdef CONFIG_USB_G_ANDROID |
| 2694 | static struct android_usb_platform_data android_usb_pdata = { |
| 2695 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 2696 | }; |
| 2697 | |
| 2698 | static struct platform_device android_usb_device = { |
| 2699 | .name = "android_usb", |
| 2700 | .id = -1, |
| 2701 | .dev = { |
| 2702 | .platform_data = &android_usb_pdata, |
| 2703 | }, |
| 2704 | }; |
| 2705 | #endif |
| 2706 | |
| 2707 | static struct msm_gpio optnav_config_data[] = { |
| 2708 | { GPIO_CFG(OPTNAV_CHIP_SELECT, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), |
| 2709 | "optnav_chip_select" }, |
| 2710 | }; |
| 2711 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2712 | static struct regulator_bulk_data optnav_regulators[] = { |
| 2713 | { .supply = "gp7", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2714 | { .supply = "gp4", .min_uV = 2600000, .max_uV = 2600000 }, |
| 2715 | { .supply = "gp9", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2716 | { .supply = "usb", .min_uV = 3300000, .max_uV = 3300000 }, |
| 2717 | }; |
| 2718 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2719 | static void __iomem *virtual_optnav; |
| 2720 | |
| 2721 | static int optnav_gpio_setup(void) |
| 2722 | { |
| 2723 | int rc = -ENODEV; |
| 2724 | rc = msm_gpios_request_enable(optnav_config_data, |
| 2725 | ARRAY_SIZE(optnav_config_data)); |
| 2726 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2727 | if (rc) |
| 2728 | return rc; |
| 2729 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2730 | /* Configure the FPGA for GPIOs */ |
| 2731 | virtual_optnav = ioremap(FPGA_OPTNAV_GPIO_ADDR, 0x4); |
| 2732 | if (!virtual_optnav) { |
| 2733 | pr_err("%s:Could not ioremap region\n", __func__); |
| 2734 | return -ENOMEM; |
| 2735 | } |
| 2736 | /* |
| 2737 | * Configure the FPGA to set GPIO 19 as |
| 2738 | * normal, active(enabled), output(MSM to SURF) |
| 2739 | */ |
| 2740 | writew(0x311E, virtual_optnav); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2741 | |
| 2742 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(optnav_regulators), |
| 2743 | optnav_regulators); |
| 2744 | if (rc) |
| 2745 | return rc; |
| 2746 | |
| 2747 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(optnav_regulators), |
| 2748 | optnav_regulators); |
| 2749 | |
| 2750 | if (rc) |
| 2751 | goto regulator_put; |
| 2752 | |
| 2753 | return rc; |
| 2754 | |
| 2755 | regulator_put: |
| 2756 | regulator_bulk_free(ARRAY_SIZE(optnav_regulators), optnav_regulators); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2757 | return rc; |
| 2758 | } |
| 2759 | |
| 2760 | static void optnav_gpio_release(void) |
| 2761 | { |
| 2762 | msm_gpios_disable_free(optnav_config_data, |
| 2763 | ARRAY_SIZE(optnav_config_data)); |
| 2764 | iounmap(virtual_optnav); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2765 | regulator_bulk_free(ARRAY_SIZE(optnav_regulators), optnav_regulators); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2766 | } |
| 2767 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2768 | static int optnav_enable(void) |
| 2769 | { |
| 2770 | int rc; |
| 2771 | /* |
| 2772 | * Enable the VREGs L8(gp7), L10(gp4), L12(gp9), L6(usb) |
| 2773 | * for I2C communication with keyboard. |
| 2774 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2775 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2776 | rc = regulator_bulk_enable(ARRAY_SIZE(optnav_regulators), |
| 2777 | optnav_regulators); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2778 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2779 | if (rc) |
| 2780 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2781 | |
| 2782 | /* Enable the chip select GPIO */ |
| 2783 | gpio_set_value(OPTNAV_CHIP_SELECT, 1); |
| 2784 | gpio_set_value(OPTNAV_CHIP_SELECT, 0); |
| 2785 | |
| 2786 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2787 | } |
| 2788 | |
| 2789 | static void optnav_disable(void) |
| 2790 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2791 | regulator_bulk_disable(ARRAY_SIZE(optnav_regulators), |
| 2792 | optnav_regulators); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2793 | |
| 2794 | gpio_set_value(OPTNAV_CHIP_SELECT, 1); |
| 2795 | } |
| 2796 | |
| 2797 | static struct ofn_atlab_platform_data optnav_data = { |
| 2798 | .gpio_setup = optnav_gpio_setup, |
| 2799 | .gpio_release = optnav_gpio_release, |
| 2800 | .optnav_on = optnav_enable, |
| 2801 | .optnav_off = optnav_disable, |
| 2802 | .rotate_xy = 0, |
| 2803 | .function1 = { |
| 2804 | .no_motion1_en = true, |
| 2805 | .touch_sensor_en = true, |
| 2806 | .ofn_en = true, |
| 2807 | .clock_select_khz = 1500, |
| 2808 | .cpi_selection = 1200, |
| 2809 | }, |
| 2810 | .function2 = { |
| 2811 | .invert_y = false, |
| 2812 | .invert_x = true, |
| 2813 | .swap_x_y = false, |
| 2814 | .hold_a_b_en = true, |
| 2815 | .motion_filter_en = true, |
| 2816 | }, |
| 2817 | }; |
| 2818 | |
| 2819 | static int hdmi_comm_power(int on, int show); |
| 2820 | static int hdmi_init_irq(void); |
| 2821 | static int hdmi_enable_5v(int on); |
| 2822 | static int hdmi_core_power(int on, int show); |
| 2823 | static int hdmi_cec_power(int on); |
| 2824 | static bool hdmi_check_hdcp_hw_support(void); |
| 2825 | |
| 2826 | static struct msm_hdmi_platform_data adv7520_hdmi_data = { |
| 2827 | .irq = MSM_GPIO_TO_INT(18), |
| 2828 | .comm_power = hdmi_comm_power, |
| 2829 | .init_irq = hdmi_init_irq, |
| 2830 | .enable_5v = hdmi_enable_5v, |
| 2831 | .core_power = hdmi_core_power, |
| 2832 | .cec_power = hdmi_cec_power, |
| 2833 | .check_hdcp_hw_support = hdmi_check_hdcp_hw_support, |
| 2834 | }; |
| 2835 | |
| 2836 | #ifdef CONFIG_BOSCH_BMA150 |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2837 | |
| 2838 | static struct regulator_bulk_data sensors_ldo[] = { |
| 2839 | { .supply = "gp7", .min_uV = 1800000, .max_uV = 1800000 }, |
| 2840 | { .supply = "gp6", .min_uV = 3050000, .max_uV = 3100000 }, |
| 2841 | }; |
| 2842 | |
| 2843 | static int __init sensors_ldo_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2844 | { |
| 2845 | int rc; |
| 2846 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2847 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(sensors_ldo), sensors_ldo); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2848 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2849 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2850 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 2851 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2852 | } |
| 2853 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2854 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(sensors_ldo), sensors_ldo); |
| 2855 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2856 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2857 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 2858 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2859 | } |
| 2860 | |
| 2861 | return 0; |
| 2862 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2863 | reg_free: |
| 2864 | regulator_bulk_free(ARRAY_SIZE(sensors_ldo), sensors_ldo); |
| 2865 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2866 | return rc; |
| 2867 | } |
| 2868 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2869 | static int sensors_ldo_set(int on) |
| 2870 | { |
| 2871 | int rc = on ? |
| 2872 | regulator_bulk_enable(ARRAY_SIZE(sensors_ldo), sensors_ldo) : |
| 2873 | regulator_bulk_disable(ARRAY_SIZE(sensors_ldo), sensors_ldo); |
| 2874 | |
| 2875 | if (rc) |
| 2876 | pr_err("%s: could not %sable regulators: %d\n", |
| 2877 | __func__, on ? "en" : "dis", rc); |
| 2878 | |
| 2879 | return rc; |
| 2880 | } |
| 2881 | |
| 2882 | static int sensors_ldo_enable(void) |
| 2883 | { |
| 2884 | return sensors_ldo_set(1); |
| 2885 | } |
| 2886 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2887 | static void sensors_ldo_disable(void) |
| 2888 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2889 | sensors_ldo_set(0); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2890 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 2891 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2892 | static struct bma150_platform_data bma150_data = { |
| 2893 | .power_on = sensors_ldo_enable, |
| 2894 | .power_off = sensors_ldo_disable, |
| 2895 | }; |
| 2896 | |
| 2897 | static struct i2c_board_info bma150_board_info[] __initdata = { |
| 2898 | { |
| 2899 | I2C_BOARD_INFO("bma150", 0x38), |
| 2900 | .flags = I2C_CLIENT_WAKE, |
| 2901 | .irq = MSM_GPIO_TO_INT(BMA150_GPIO_INT), |
| 2902 | .platform_data = &bma150_data, |
| 2903 | }, |
| 2904 | }; |
| 2905 | #endif |
| 2906 | |
| 2907 | static struct i2c_board_info msm_i2c_board_info[] = { |
| 2908 | { |
| 2909 | I2C_BOARD_INFO("m33c01", OPTNAV_I2C_SLAVE_ADDR), |
| 2910 | .irq = MSM_GPIO_TO_INT(OPTNAV_IRQ), |
| 2911 | .platform_data = &optnav_data, |
| 2912 | }, |
| 2913 | { |
| 2914 | I2C_BOARD_INFO("adv7520", ADV7520_I2C_ADDR), |
| 2915 | .platform_data = &adv7520_hdmi_data, |
| 2916 | }, |
| 2917 | }; |
| 2918 | |
| 2919 | static struct i2c_board_info msm_marimba_board_info[] = { |
| 2920 | { |
| 2921 | I2C_BOARD_INFO("marimba", 0xc), |
| 2922 | .platform_data = &marimba_pdata, |
| 2923 | } |
| 2924 | }; |
| 2925 | |
| 2926 | |
| 2927 | static struct msm_handset_platform_data hs_platform_data = { |
| 2928 | .hs_name = "7k_handset", |
| 2929 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ |
| 2930 | }; |
| 2931 | |
| 2932 | static struct platform_device hs_device = { |
| 2933 | .name = "msm-handset", |
| 2934 | .id = -1, |
| 2935 | .dev = { |
| 2936 | .platform_data = &hs_platform_data, |
| 2937 | }, |
| 2938 | }; |
| 2939 | |
| 2940 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 2941 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2942 | .idle_supported = 1, |
| 2943 | .suspend_supported = 1, |
| 2944 | .idle_enabled = 1, |
| 2945 | .suspend_enabled = 1, |
| 2946 | .latency = 8594, |
| 2947 | .residency = 23740, |
| 2948 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 2949 | [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] | 2950 | .idle_supported = 1, |
| 2951 | .suspend_supported = 1, |
| 2952 | .idle_enabled = 1, |
| 2953 | .suspend_enabled = 1, |
| 2954 | .latency = 4594, |
| 2955 | .residency = 23740, |
| 2956 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 2957 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2958 | #ifdef CONFIG_MSM_STANDALONE_POWER_COLLAPSE |
| 2959 | .idle_supported = 1, |
| 2960 | .suspend_supported = 1, |
| 2961 | .idle_enabled = 1, |
| 2962 | .suspend_enabled = 0, |
| 2963 | #else /*CONFIG_MSM_STANDALONE_POWER_COLLAPSE*/ |
| 2964 | .idle_supported = 0, |
| 2965 | .suspend_supported = 0, |
| 2966 | .idle_enabled = 0, |
| 2967 | .suspend_enabled = 0, |
| 2968 | #endif /*CONFIG_MSM_STANDALONE_POWER_COLLAPSE*/ |
| 2969 | .latency = 500, |
| 2970 | .residency = 6000, |
| 2971 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 2972 | [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] | 2973 | .idle_supported = 1, |
| 2974 | .suspend_supported = 1, |
| 2975 | .idle_enabled = 0, |
| 2976 | .suspend_enabled = 1, |
| 2977 | .latency = 443, |
| 2978 | .residency = 1098, |
| 2979 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 2980 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2981 | .idle_supported = 1, |
| 2982 | .suspend_supported = 1, |
| 2983 | .idle_enabled = 1, |
| 2984 | .suspend_enabled = 1, |
| 2985 | .latency = 2, |
| 2986 | .residency = 0, |
| 2987 | }, |
| 2988 | }; |
| 2989 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 2990 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 2991 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_VIRT, |
| 2992 | .v_addr = (uint32_t *)PAGE_OFFSET, |
| 2993 | }; |
| 2994 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2995 | static struct resource qsd_spi_resources[] = { |
| 2996 | { |
| 2997 | .name = "spi_irq_in", |
| 2998 | .start = INT_SPI_INPUT, |
| 2999 | .end = INT_SPI_INPUT, |
| 3000 | .flags = IORESOURCE_IRQ, |
| 3001 | }, |
| 3002 | { |
| 3003 | .name = "spi_irq_out", |
| 3004 | .start = INT_SPI_OUTPUT, |
| 3005 | .end = INT_SPI_OUTPUT, |
| 3006 | .flags = IORESOURCE_IRQ, |
| 3007 | }, |
| 3008 | { |
| 3009 | .name = "spi_irq_err", |
| 3010 | .start = INT_SPI_ERROR, |
| 3011 | .end = INT_SPI_ERROR, |
| 3012 | .flags = IORESOURCE_IRQ, |
| 3013 | }, |
| 3014 | { |
| 3015 | .name = "spi_base", |
| 3016 | .start = 0xA8000000, |
| 3017 | .end = 0xA8000000 + SZ_4K - 1, |
| 3018 | .flags = IORESOURCE_MEM, |
| 3019 | }, |
| 3020 | { |
| 3021 | .name = "spidm_channels", |
| 3022 | .flags = IORESOURCE_DMA, |
| 3023 | }, |
| 3024 | { |
| 3025 | .name = "spidm_crci", |
| 3026 | .flags = IORESOURCE_DMA, |
| 3027 | }, |
| 3028 | }; |
| 3029 | |
| 3030 | #define AMDH0_BASE_PHYS 0xAC200000 |
| 3031 | #define ADMH0_GP_CTL (ct_adm_base + 0x3D8) |
| 3032 | static int msm_qsd_spi_dma_config(void) |
| 3033 | { |
| 3034 | void __iomem *ct_adm_base = 0; |
| 3035 | u32 spi_mux = 0; |
| 3036 | int ret = 0; |
| 3037 | |
| 3038 | ct_adm_base = ioremap(AMDH0_BASE_PHYS, PAGE_SIZE); |
| 3039 | if (!ct_adm_base) { |
| 3040 | pr_err("%s: Could not remap %x\n", __func__, AMDH0_BASE_PHYS); |
| 3041 | return -ENOMEM; |
| 3042 | } |
| 3043 | |
| 3044 | spi_mux = (ioread32(ADMH0_GP_CTL) & (0x3 << 12)) >> 12; |
| 3045 | |
| 3046 | qsd_spi_resources[4].start = DMOV_USB_CHAN; |
| 3047 | qsd_spi_resources[4].end = DMOV_TSIF_CHAN; |
| 3048 | |
| 3049 | switch (spi_mux) { |
| 3050 | case (1): |
| 3051 | qsd_spi_resources[5].start = DMOV_HSUART1_RX_CRCI; |
| 3052 | qsd_spi_resources[5].end = DMOV_HSUART1_TX_CRCI; |
| 3053 | break; |
| 3054 | case (2): |
| 3055 | qsd_spi_resources[5].start = DMOV_HSUART2_RX_CRCI; |
| 3056 | qsd_spi_resources[5].end = DMOV_HSUART2_TX_CRCI; |
| 3057 | break; |
| 3058 | case (3): |
| 3059 | qsd_spi_resources[5].start = DMOV_CE_OUT_CRCI; |
| 3060 | qsd_spi_resources[5].end = DMOV_CE_IN_CRCI; |
| 3061 | break; |
| 3062 | default: |
| 3063 | ret = -ENOENT; |
| 3064 | } |
| 3065 | |
| 3066 | iounmap(ct_adm_base); |
| 3067 | |
| 3068 | return ret; |
| 3069 | } |
| 3070 | |
| 3071 | static struct platform_device qsd_device_spi = { |
| 3072 | .name = "spi_qsd", |
| 3073 | .id = 0, |
| 3074 | .num_resources = ARRAY_SIZE(qsd_spi_resources), |
| 3075 | .resource = qsd_spi_resources, |
| 3076 | }; |
| 3077 | |
| 3078 | #ifdef CONFIG_SPI_QSD |
| 3079 | static struct spi_board_info lcdc_sharp_spi_board_info[] __initdata = { |
| 3080 | { |
| 3081 | .modalias = "lcdc_sharp_ls038y7dx01", |
| 3082 | .mode = SPI_MODE_1, |
| 3083 | .bus_num = 0, |
| 3084 | .chip_select = 0, |
| 3085 | .max_speed_hz = 26331429, |
| 3086 | } |
| 3087 | }; |
| 3088 | static struct spi_board_info lcdc_toshiba_spi_board_info[] __initdata = { |
| 3089 | { |
| 3090 | .modalias = "lcdc_toshiba_ltm030dd40", |
| 3091 | .mode = SPI_MODE_3|SPI_CS_HIGH, |
| 3092 | .bus_num = 0, |
| 3093 | .chip_select = 0, |
| 3094 | .max_speed_hz = 9963243, |
| 3095 | } |
| 3096 | }; |
| 3097 | #endif |
| 3098 | |
| 3099 | static struct msm_gpio qsd_spi_gpio_config_data[] = { |
| 3100 | { GPIO_CFG(45, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_clk" }, |
| 3101 | { GPIO_CFG(46, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_cs0" }, |
| 3102 | { GPIO_CFG(47, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "spi_mosi" }, |
| 3103 | { GPIO_CFG(48, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_miso" }, |
| 3104 | }; |
| 3105 | |
| 3106 | static int msm_qsd_spi_gpio_config(void) |
| 3107 | { |
| 3108 | return msm_gpios_request_enable(qsd_spi_gpio_config_data, |
| 3109 | ARRAY_SIZE(qsd_spi_gpio_config_data)); |
| 3110 | } |
| 3111 | |
| 3112 | static void msm_qsd_spi_gpio_release(void) |
| 3113 | { |
| 3114 | msm_gpios_disable_free(qsd_spi_gpio_config_data, |
| 3115 | ARRAY_SIZE(qsd_spi_gpio_config_data)); |
| 3116 | } |
| 3117 | |
| 3118 | static struct msm_spi_platform_data qsd_spi_pdata = { |
| 3119 | .max_clock_speed = 26331429, |
| 3120 | .gpio_config = msm_qsd_spi_gpio_config, |
| 3121 | .gpio_release = msm_qsd_spi_gpio_release, |
| 3122 | .dma_config = msm_qsd_spi_dma_config, |
| 3123 | }; |
| 3124 | |
| 3125 | static void __init msm_qsd_spi_init(void) |
| 3126 | { |
| 3127 | qsd_device_spi.dev.platform_data = &qsd_spi_pdata; |
| 3128 | } |
| 3129 | |
| 3130 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 3131 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 3132 | { |
| 3133 | int rc; |
| 3134 | static int vbus_is_on; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 3135 | struct pm8xxx_gpio_init_info usb_vbus = { |
| 3136 | PM8058_GPIO_PM_TO_SYS(36), |
| 3137 | { |
| 3138 | .direction = PM_GPIO_DIR_OUT, |
| 3139 | .pull = PM_GPIO_PULL_NO, |
| 3140 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 3141 | .output_value = 1, |
| 3142 | .vin_sel = 2, |
| 3143 | .out_strength = PM_GPIO_STRENGTH_MED, |
| 3144 | .function = PM_GPIO_FUNC_NORMAL, |
| 3145 | .inv_int_pol = 0, |
| 3146 | }, |
| 3147 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3148 | |
| 3149 | /* If VBUS is already on (or off), do nothing. */ |
| 3150 | if (unlikely(on == vbus_is_on)) |
| 3151 | return; |
| 3152 | |
| 3153 | if (on) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 3154 | rc = pm8xxx_gpio_config(usb_vbus.gpio, &usb_vbus.config); |
| 3155 | if (rc) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3156 | pr_err("%s PMIC GPIO 36 write failed\n", __func__); |
| 3157 | return; |
| 3158 | } |
| 3159 | } else { |
| 3160 | gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS(36), 0); |
| 3161 | } |
| 3162 | |
| 3163 | vbus_is_on = on; |
| 3164 | } |
| 3165 | |
| 3166 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 3167 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 3168 | .vbus_power = msm_hsusb_vbus_power, |
| 3169 | .power_budget = 180, |
| 3170 | }; |
| 3171 | #endif |
| 3172 | |
| 3173 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 3174 | static int hsusb_rpc_connect(int connect) |
| 3175 | { |
| 3176 | if (connect) |
| 3177 | return msm_hsusb_rpc_connect(); |
| 3178 | else |
| 3179 | return msm_hsusb_rpc_close(); |
| 3180 | } |
| 3181 | #endif |
| 3182 | |
| 3183 | #ifdef CONFIG_USB_MSM_OTG_72K |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3184 | static struct regulator *vreg_3p3; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3185 | static int msm_hsusb_ldo_init(int init) |
| 3186 | { |
| 3187 | uint32_t version = 0; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3188 | int def_vol = 3400000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3189 | |
| 3190 | version = socinfo_get_version(); |
| 3191 | |
| 3192 | if (SOCINFO_VERSION_MAJOR(version) >= 2 && |
| 3193 | SOCINFO_VERSION_MINOR(version) >= 1) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3194 | def_vol = 3075000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3195 | pr_debug("%s: default voltage:%d\n", __func__, def_vol); |
| 3196 | } |
| 3197 | |
| 3198 | if (init) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3199 | vreg_3p3 = regulator_get(NULL, "usb"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3200 | if (IS_ERR(vreg_3p3)) |
| 3201 | return PTR_ERR(vreg_3p3); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3202 | regulator_set_voltage(vreg_3p3, def_vol, def_vol); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3203 | } else |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3204 | regulator_put(vreg_3p3); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3205 | |
| 3206 | return 0; |
| 3207 | } |
| 3208 | |
| 3209 | static int msm_hsusb_ldo_enable(int enable) |
| 3210 | { |
| 3211 | static int ldo_status; |
| 3212 | |
| 3213 | if (!vreg_3p3 || IS_ERR(vreg_3p3)) |
| 3214 | return -ENODEV; |
| 3215 | |
| 3216 | if (ldo_status == enable) |
| 3217 | return 0; |
| 3218 | |
| 3219 | ldo_status = enable; |
| 3220 | |
| 3221 | if (enable) |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3222 | return regulator_enable(vreg_3p3); |
| 3223 | else |
| 3224 | return regulator_disable(vreg_3p3); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3225 | } |
| 3226 | |
| 3227 | static int msm_hsusb_ldo_set_voltage(int mV) |
| 3228 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3229 | static int cur_voltage; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3230 | |
| 3231 | if (!vreg_3p3 || IS_ERR(vreg_3p3)) |
| 3232 | return -ENODEV; |
| 3233 | |
| 3234 | if (cur_voltage == mV) |
| 3235 | return 0; |
| 3236 | |
| 3237 | cur_voltage = mV; |
| 3238 | |
| 3239 | pr_debug("%s: (%d)\n", __func__, mV); |
| 3240 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3241 | return regulator_set_voltage(vreg_3p3, mV*1000, mV*1000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3242 | } |
| 3243 | #endif |
| 3244 | |
| 3245 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 3246 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init); |
| 3247 | #endif |
| 3248 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 3249 | .rpc_connect = hsusb_rpc_connect, |
| 3250 | |
| 3251 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 3252 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 3253 | #else |
| 3254 | .vbus_power = msm_hsusb_vbus_power, |
| 3255 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3256 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 3257 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 3258 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 3259 | .se1_gating = SE1_GATING_DISABLE, |
| 3260 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 3261 | .chg_connected = hsusb_chg_connected, |
| 3262 | .chg_init = hsusb_chg_init, |
| 3263 | .ldo_enable = msm_hsusb_ldo_enable, |
| 3264 | .ldo_init = msm_hsusb_ldo_init, |
| 3265 | .ldo_set_voltage = msm_hsusb_ldo_set_voltage, |
| 3266 | }; |
| 3267 | |
| 3268 | #ifdef CONFIG_USB_GADGET |
| 3269 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 3270 | .is_phy_status_timer_on = 1, |
| 3271 | }; |
| 3272 | #endif |
| 3273 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 3274 | typedef void (*notify_vbus_state) (int); |
| 3275 | notify_vbus_state notify_vbus_state_func_ptr; |
| 3276 | int vbus_on_irq; |
| 3277 | static irqreturn_t pmic_vbus_on_irq(int irq, void *data) |
| 3278 | { |
| 3279 | pr_info("%s: vbus notification from pmic\n", __func__); |
| 3280 | |
| 3281 | (*notify_vbus_state_func_ptr) (1); |
| 3282 | |
| 3283 | return IRQ_HANDLED; |
| 3284 | } |
| 3285 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 3286 | { |
| 3287 | int ret; |
| 3288 | |
| 3289 | if (init) { |
| 3290 | if (!callback) |
| 3291 | return -ENODEV; |
| 3292 | |
| 3293 | notify_vbus_state_func_ptr = callback; |
| 3294 | vbus_on_irq = platform_get_irq_byname(&msm_device_otg, |
| 3295 | "vbus_on"); |
| 3296 | if (vbus_on_irq <= 0) { |
| 3297 | pr_err("%s: unable to get vbus on irq\n", __func__); |
| 3298 | return -ENODEV; |
| 3299 | } |
| 3300 | |
| 3301 | ret = request_any_context_irq(vbus_on_irq, pmic_vbus_on_irq, |
| 3302 | IRQF_TRIGGER_RISING, "msm_otg_vbus_on", NULL); |
| 3303 | if (ret < 0) { |
| 3304 | pr_info("%s: request_irq for vbus_on" |
| 3305 | "interrupt failed\n", __func__); |
| 3306 | return ret; |
| 3307 | } |
| 3308 | msm_otg_pdata.pmic_vbus_irq = vbus_on_irq; |
| 3309 | return 0; |
| 3310 | } else { |
| 3311 | free_irq(vbus_on_irq, 0); |
| 3312 | notify_vbus_state_func_ptr = NULL; |
| 3313 | return 0; |
| 3314 | } |
| 3315 | } |
| 3316 | #endif |
| 3317 | |
| 3318 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 3319 | .name = "pmem", |
| 3320 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 3321 | .cached = 1, |
| 3322 | .memory_type = MEMTYPE_EBI0, |
| 3323 | }; |
| 3324 | |
| 3325 | static struct platform_device android_pmem_device = { |
| 3326 | .name = "android_pmem", |
| 3327 | .id = 0, |
| 3328 | .dev = { .platform_data = &android_pmem_pdata }, |
| 3329 | }; |
| 3330 | |
| 3331 | #ifndef CONFIG_SPI_QSD |
| 3332 | static int lcdc_gpio_array_num[] = { |
| 3333 | 45, /* spi_clk */ |
| 3334 | 46, /* spi_cs */ |
| 3335 | 47, /* spi_mosi */ |
| 3336 | 48, /* spi_miso */ |
| 3337 | }; |
| 3338 | |
| 3339 | static struct msm_gpio lcdc_gpio_config_data[] = { |
| 3340 | { GPIO_CFG(45, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_clk" }, |
| 3341 | { GPIO_CFG(46, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_cs0" }, |
| 3342 | { GPIO_CFG(47, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_mosi" }, |
| 3343 | { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_miso" }, |
| 3344 | }; |
| 3345 | |
| 3346 | static void lcdc_config_gpios(int enable) |
| 3347 | { |
| 3348 | if (enable) { |
| 3349 | msm_gpios_request_enable(lcdc_gpio_config_data, |
| 3350 | ARRAY_SIZE( |
| 3351 | lcdc_gpio_config_data)); |
| 3352 | } else |
| 3353 | msm_gpios_disable_free(lcdc_gpio_config_data, |
| 3354 | ARRAY_SIZE( |
| 3355 | lcdc_gpio_config_data)); |
| 3356 | } |
| 3357 | #endif |
| 3358 | |
| 3359 | static struct msm_panel_common_pdata lcdc_sharp_panel_data = { |
| 3360 | #ifndef CONFIG_SPI_QSD |
| 3361 | .panel_config_gpio = lcdc_config_gpios, |
| 3362 | .gpio_num = lcdc_gpio_array_num, |
| 3363 | #endif |
| 3364 | .gpio = 2, /* LPG PMIC_GPIO26 channel number */ |
| 3365 | }; |
| 3366 | |
| 3367 | static struct platform_device lcdc_sharp_panel_device = { |
| 3368 | .name = "lcdc_sharp_wvga", |
| 3369 | .id = 0, |
| 3370 | .dev = { |
| 3371 | .platform_data = &lcdc_sharp_panel_data, |
| 3372 | } |
| 3373 | }; |
| 3374 | |
| 3375 | static struct msm_gpio dtv_panel_irq_gpios[] = { |
| 3376 | { GPIO_CFG(18, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), |
| 3377 | "hdmi_int" }, |
| 3378 | }; |
| 3379 | |
| 3380 | static struct msm_gpio dtv_panel_gpios[] = { |
| 3381 | { GPIO_CFG(120, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_mclk" }, |
| 3382 | { GPIO_CFG(121, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_sd0" }, |
| 3383 | { GPIO_CFG(122, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_sd1" }, |
| 3384 | { GPIO_CFG(123, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_sd2" }, |
| 3385 | { GPIO_CFG(124, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "dtv_pclk" }, |
| 3386 | { GPIO_CFG(125, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_en" }, |
| 3387 | { GPIO_CFG(126, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_vsync" }, |
| 3388 | { GPIO_CFG(127, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_hsync" }, |
| 3389 | { GPIO_CFG(128, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data0" }, |
| 3390 | { GPIO_CFG(129, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data1" }, |
| 3391 | { GPIO_CFG(130, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data2" }, |
| 3392 | { GPIO_CFG(131, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data3" }, |
| 3393 | { GPIO_CFG(132, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data4" }, |
| 3394 | { GPIO_CFG(160, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data5" }, |
| 3395 | { GPIO_CFG(161, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data6" }, |
| 3396 | { GPIO_CFG(162, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data7" }, |
| 3397 | { GPIO_CFG(163, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data8" }, |
| 3398 | { GPIO_CFG(164, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data9" }, |
| 3399 | { GPIO_CFG(165, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat10" }, |
| 3400 | { GPIO_CFG(166, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat11" }, |
| 3401 | { GPIO_CFG(167, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat12" }, |
| 3402 | { GPIO_CFG(168, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat13" }, |
| 3403 | { GPIO_CFG(169, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat14" }, |
| 3404 | { GPIO_CFG(170, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat15" }, |
| 3405 | { GPIO_CFG(171, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat16" }, |
| 3406 | { GPIO_CFG(172, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat17" }, |
| 3407 | { GPIO_CFG(173, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat18" }, |
| 3408 | { GPIO_CFG(174, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat19" }, |
| 3409 | { GPIO_CFG(175, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat20" }, |
| 3410 | { GPIO_CFG(176, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat21" }, |
| 3411 | { GPIO_CFG(177, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat22" }, |
| 3412 | { GPIO_CFG(178, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat23" }, |
| 3413 | }; |
| 3414 | |
| 3415 | |
| 3416 | #ifdef HDMI_RESET |
| 3417 | static unsigned dtv_reset_gpio = |
| 3418 | GPIO_CFG(37, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); |
| 3419 | #endif |
| 3420 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3421 | static struct regulator_bulk_data hdmi_core_regs[] = { |
| 3422 | { .supply = "ldo8", .min_uV = 1800000, .max_uV = 1800000 }, |
| 3423 | }; |
| 3424 | |
| 3425 | static struct regulator_bulk_data hdmi_comm_regs[] = { |
| 3426 | { .supply = "ldo8", .min_uV = 1800000, .max_uV = 1800000 }, |
| 3427 | { .supply = "ldo10", .min_uV = 2600000, .max_uV = 2600000 }, |
| 3428 | }; |
| 3429 | |
| 3430 | static struct regulator_bulk_data hdmi_cec_regs[] = { |
| 3431 | { .supply = "ldo17", .min_uV = 2600000, .max_uV = 2600000 }, |
| 3432 | }; |
| 3433 | |
| 3434 | static int __init hdmi_init_regs(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3435 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3436 | int rc; |
| 3437 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3438 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(hdmi_core_regs), |
| 3439 | hdmi_core_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3440 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3441 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3442 | pr_err("%s: could not get %s regulators: %d\n", |
| 3443 | __func__, "core", rc); |
| 3444 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3445 | } |
| 3446 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3447 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(hdmi_core_regs), |
| 3448 | hdmi_core_regs); |
| 3449 | |
| 3450 | if (rc) { |
| 3451 | pr_err("%s: could not set %s voltages: %d\n", |
| 3452 | __func__, "core", rc); |
| 3453 | goto free_core; |
| 3454 | } |
| 3455 | |
| 3456 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(hdmi_comm_regs), |
| 3457 | hdmi_comm_regs); |
| 3458 | |
| 3459 | if (rc) { |
| 3460 | pr_err("%s: could not get %s regulators: %d\n", |
| 3461 | __func__, "comm", rc); |
| 3462 | goto free_core; |
| 3463 | } |
| 3464 | |
| 3465 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(hdmi_comm_regs), |
| 3466 | hdmi_comm_regs); |
| 3467 | |
| 3468 | if (rc) { |
| 3469 | pr_err("%s: could not set %s voltages: %d\n", |
| 3470 | __func__, "comm", rc); |
| 3471 | goto free_comm; |
| 3472 | } |
| 3473 | |
| 3474 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(hdmi_cec_regs), |
| 3475 | hdmi_cec_regs); |
| 3476 | |
| 3477 | if (rc) { |
| 3478 | pr_err("%s: could not get %s regulators: %d\n", |
| 3479 | __func__, "cec", rc); |
| 3480 | goto free_comm; |
| 3481 | } |
| 3482 | |
| 3483 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(hdmi_cec_regs), |
| 3484 | hdmi_cec_regs); |
| 3485 | |
| 3486 | if (rc) { |
| 3487 | pr_err("%s: could not set %s voltages: %d\n", |
| 3488 | __func__, "cec", rc); |
| 3489 | goto free_cec; |
| 3490 | } |
| 3491 | |
| 3492 | return 0; |
| 3493 | |
| 3494 | free_cec: |
| 3495 | regulator_bulk_free(ARRAY_SIZE(hdmi_cec_regs), hdmi_cec_regs); |
| 3496 | free_comm: |
| 3497 | regulator_bulk_free(ARRAY_SIZE(hdmi_comm_regs), hdmi_comm_regs); |
| 3498 | free_core: |
| 3499 | regulator_bulk_free(ARRAY_SIZE(hdmi_core_regs), hdmi_core_regs); |
| 3500 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3501 | return rc; |
| 3502 | } |
| 3503 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3504 | static int hdmi_init_irq(void) |
| 3505 | { |
| 3506 | int rc = msm_gpios_enable(dtv_panel_irq_gpios, |
| 3507 | ARRAY_SIZE(dtv_panel_irq_gpios)); |
| 3508 | if (rc < 0) { |
| 3509 | pr_err("%s: gpio enable failed: %d\n", __func__, rc); |
| 3510 | return rc; |
| 3511 | } |
| 3512 | pr_info("%s\n", __func__); |
| 3513 | |
| 3514 | return 0; |
| 3515 | } |
| 3516 | |
| 3517 | static int hdmi_enable_5v(int on) |
| 3518 | { |
| 3519 | int pmic_gpio_hdmi_5v_en ; |
| 3520 | |
| 3521 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa() || |
| 3522 | machine_is_msm7x30_fluid()) |
| 3523 | pmic_gpio_hdmi_5v_en = PMIC_GPIO_HDMI_5V_EN_V2 ; |
| 3524 | else |
| 3525 | pmic_gpio_hdmi_5v_en = PMIC_GPIO_HDMI_5V_EN_V3 ; |
| 3526 | |
| 3527 | pr_info("%s: %d\n", __func__, on); |
| 3528 | if (on) { |
| 3529 | int rc; |
| 3530 | rc = gpio_request(PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en), |
| 3531 | "hdmi_5V_en"); |
| 3532 | if (rc) { |
| 3533 | pr_err("%s PMIC_GPIO_HDMI_5V_EN gpio_request failed\n", |
| 3534 | __func__); |
| 3535 | return rc; |
| 3536 | } |
| 3537 | gpio_set_value_cansleep( |
| 3538 | PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en), 1); |
| 3539 | } else { |
| 3540 | gpio_set_value_cansleep( |
| 3541 | PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en), 0); |
| 3542 | gpio_free(PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en)); |
| 3543 | } |
| 3544 | return 0; |
| 3545 | } |
| 3546 | |
| 3547 | static int hdmi_comm_power(int on, int show) |
| 3548 | { |
| 3549 | if (show) |
| 3550 | pr_info("%s: i2c comm: %d <LDO8+LDO10>\n", __func__, on); |
| 3551 | return on ? |
| 3552 | regulator_bulk_enable(ARRAY_SIZE(hdmi_comm_regs), |
| 3553 | hdmi_comm_regs) : |
| 3554 | regulator_bulk_disable(ARRAY_SIZE(hdmi_comm_regs), |
| 3555 | hdmi_comm_regs); |
| 3556 | } |
| 3557 | |
| 3558 | static int hdmi_core_power(int on, int show) |
| 3559 | { |
| 3560 | if (show) |
| 3561 | pr_info("%s: %d <LDO8>\n", __func__, on); |
| 3562 | return on ? |
| 3563 | regulator_bulk_enable(ARRAY_SIZE(hdmi_core_regs), |
| 3564 | hdmi_core_regs) : |
| 3565 | regulator_bulk_disable(ARRAY_SIZE(hdmi_core_regs), |
| 3566 | hdmi_core_regs); |
| 3567 | } |
| 3568 | |
| 3569 | static int hdmi_cec_power(int on) |
| 3570 | { |
| 3571 | pr_info("%s: %d <LDO17>\n", __func__, on); |
| 3572 | return on ? regulator_bulk_enable(ARRAY_SIZE(hdmi_cec_regs), |
| 3573 | hdmi_cec_regs) : |
| 3574 | regulator_bulk_disable(ARRAY_SIZE(hdmi_cec_regs), |
| 3575 | hdmi_cec_regs); |
| 3576 | } |
| 3577 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3578 | #if defined(CONFIG_FB_MSM_HDMI_ADV7520_PANEL) || defined(CONFIG_BOSCH_BMA150) |
| 3579 | /* there is an i2c address conflict between adv7520 and bma150 sensor after |
| 3580 | * power up on fluid. As a solution, the default address of adv7520's packet |
| 3581 | * memory is changed as soon as possible |
| 3582 | */ |
| 3583 | static int __init fluid_i2c_address_fixup(void) |
| 3584 | { |
| 3585 | unsigned char wBuff[16]; |
| 3586 | unsigned char rBuff[16]; |
| 3587 | struct i2c_msg msgs[3]; |
| 3588 | int res; |
| 3589 | int rc = -EINVAL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3590 | struct i2c_adapter *adapter; |
| 3591 | |
| 3592 | if (machine_is_msm7x30_fluid()) { |
| 3593 | adapter = i2c_get_adapter(0); |
| 3594 | if (!adapter) { |
| 3595 | pr_err("%s: invalid i2c adapter\n", __func__); |
| 3596 | return PTR_ERR(adapter); |
| 3597 | } |
| 3598 | |
| 3599 | /* turn on LDO8 */ |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3600 | rc = hdmi_core_power(1, 0); |
| 3601 | if (rc) { |
| 3602 | pr_err("%s: could not enable hdmi core regs: %d", |
| 3603 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3604 | goto adapter_put; |
| 3605 | } |
| 3606 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3607 | /* change packet memory address to 0x74 */ |
| 3608 | wBuff[0] = 0x45; |
| 3609 | wBuff[1] = 0x74; |
| 3610 | |
| 3611 | msgs[0].addr = ADV7520_I2C_ADDR; |
| 3612 | msgs[0].flags = 0; |
| 3613 | msgs[0].buf = (unsigned char *) wBuff; |
| 3614 | msgs[0].len = 2; |
| 3615 | |
| 3616 | res = i2c_transfer(adapter, msgs, 1); |
| 3617 | if (res != 1) { |
| 3618 | pr_err("%s: error writing adv7520\n", __func__); |
| 3619 | goto ldo8_disable; |
| 3620 | } |
| 3621 | |
| 3622 | /* powerdown adv7520 using bit 6 */ |
| 3623 | /* i2c read first */ |
| 3624 | wBuff[0] = 0x41; |
| 3625 | |
| 3626 | msgs[0].addr = ADV7520_I2C_ADDR; |
| 3627 | msgs[0].flags = 0; |
| 3628 | msgs[0].buf = (unsigned char *) wBuff; |
| 3629 | msgs[0].len = 1; |
| 3630 | |
| 3631 | msgs[1].addr = ADV7520_I2C_ADDR; |
| 3632 | msgs[1].flags = I2C_M_RD; |
| 3633 | msgs[1].buf = rBuff; |
| 3634 | msgs[1].len = 1; |
| 3635 | res = i2c_transfer(adapter, msgs, 2); |
| 3636 | if (res != 2) { |
| 3637 | pr_err("%s: error reading adv7520\n", __func__); |
| 3638 | goto ldo8_disable; |
| 3639 | } |
| 3640 | |
| 3641 | /* i2c write back */ |
| 3642 | wBuff[0] = 0x41; |
| 3643 | wBuff[1] = rBuff[0] | 0x40; |
| 3644 | |
| 3645 | msgs[0].addr = ADV7520_I2C_ADDR; |
| 3646 | msgs[0].flags = 0; |
| 3647 | msgs[0].buf = (unsigned char *) wBuff; |
| 3648 | msgs[0].len = 2; |
| 3649 | |
| 3650 | res = i2c_transfer(adapter, msgs, 1); |
| 3651 | if (res != 1) { |
| 3652 | pr_err("%s: error writing adv7520\n", __func__); |
| 3653 | goto ldo8_disable; |
| 3654 | } |
| 3655 | |
| 3656 | /* for successful fixup, we release the i2c adapter */ |
| 3657 | /* but leave ldo8 on so that the adv7520 is not repowered */ |
| 3658 | i2c_put_adapter(adapter); |
| 3659 | pr_info("%s: fluid i2c address conflict resolved\n", __func__); |
| 3660 | } |
| 3661 | return 0; |
| 3662 | |
| 3663 | ldo8_disable: |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3664 | hdmi_core_power(0, 0); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3665 | adapter_put: |
| 3666 | i2c_put_adapter(adapter); |
| 3667 | return rc; |
| 3668 | } |
| 3669 | fs_initcall_sync(fluid_i2c_address_fixup); |
| 3670 | #endif |
| 3671 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3672 | static bool hdmi_check_hdcp_hw_support(void) |
| 3673 | { |
| 3674 | if (machine_is_msm7x30_fluid()) |
| 3675 | return false; |
| 3676 | else |
| 3677 | return true; |
| 3678 | } |
| 3679 | |
| 3680 | static int dtv_panel_power(int on) |
| 3681 | { |
| 3682 | int flag_on = !!on; |
| 3683 | static int dtv_power_save_on; |
| 3684 | int rc; |
| 3685 | |
| 3686 | if (dtv_power_save_on == flag_on) |
| 3687 | return 0; |
| 3688 | |
| 3689 | dtv_power_save_on = flag_on; |
| 3690 | pr_info("%s: %d\n", __func__, on); |
| 3691 | |
| 3692 | #ifdef HDMI_RESET |
| 3693 | if (on) { |
| 3694 | /* reset Toshiba WeGA chip -- toggle reset pin -- gpio_180 */ |
| 3695 | rc = gpio_tlmm_config(dtv_reset_gpio, GPIO_CFG_ENABLE); |
| 3696 | if (rc) { |
| 3697 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 3698 | __func__, dtv_reset_gpio, rc); |
| 3699 | return rc; |
| 3700 | } |
| 3701 | |
| 3702 | /* bring reset line low to hold reset*/ |
| 3703 | gpio_set_value(37, 0); |
| 3704 | } |
| 3705 | #endif |
| 3706 | |
| 3707 | if (on) { |
| 3708 | rc = msm_gpios_enable(dtv_panel_gpios, |
| 3709 | ARRAY_SIZE(dtv_panel_gpios)); |
| 3710 | if (rc < 0) { |
| 3711 | printk(KERN_ERR "%s: gpio enable failed: %d\n", |
| 3712 | __func__, rc); |
| 3713 | return rc; |
| 3714 | } |
| 3715 | } else { |
| 3716 | rc = msm_gpios_disable(dtv_panel_gpios, |
| 3717 | ARRAY_SIZE(dtv_panel_gpios)); |
| 3718 | if (rc < 0) { |
| 3719 | printk(KERN_ERR "%s: gpio disable failed: %d\n", |
| 3720 | __func__, rc); |
| 3721 | return rc; |
| 3722 | } |
| 3723 | } |
| 3724 | |
| 3725 | mdelay(5); /* ensure power is stable */ |
| 3726 | |
| 3727 | #ifdef HDMI_RESET |
| 3728 | if (on) { |
| 3729 | gpio_set_value(37, 1); /* bring reset line high */ |
| 3730 | mdelay(10); /* 10 msec before IO can be accessed */ |
| 3731 | } |
| 3732 | #endif |
| 3733 | |
| 3734 | return rc; |
| 3735 | } |
| 3736 | |
| 3737 | static struct lcdc_platform_data dtv_pdata = { |
| 3738 | .lcdc_power_save = dtv_panel_power, |
| 3739 | }; |
| 3740 | |
| 3741 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 3742 | .inject_rx_on_wakeup = 1, |
| 3743 | .rx_to_inject = 0xFD, |
| 3744 | }; |
| 3745 | |
| 3746 | static struct resource msm_fb_resources[] = { |
| 3747 | { |
| 3748 | .flags = IORESOURCE_DMA, |
| 3749 | } |
| 3750 | }; |
| 3751 | |
| 3752 | static int msm_fb_detect_panel(const char *name) |
| 3753 | { |
| 3754 | if (machine_is_msm7x30_fluid()) { |
| 3755 | if (!strcmp(name, "lcdc_sharp_wvga_pt")) |
| 3756 | return 0; |
| 3757 | } else { |
| 3758 | if (!strncmp(name, "mddi_toshiba_wvga_pt", 20)) |
| 3759 | return -EPERM; |
| 3760 | else if (!strncmp(name, "lcdc_toshiba_wvga_pt", 20)) |
| 3761 | return 0; |
| 3762 | else if (!strcmp(name, "mddi_orise")) |
| 3763 | return -EPERM; |
| 3764 | else if (!strcmp(name, "mddi_quickvx")) |
| 3765 | return -EPERM; |
| 3766 | } |
| 3767 | return -ENODEV; |
| 3768 | } |
| 3769 | |
| 3770 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 3771 | .detect_client = msm_fb_detect_panel, |
| 3772 | .mddi_prescan = 1, |
| 3773 | }; |
| 3774 | |
| 3775 | static struct platform_device msm_fb_device = { |
| 3776 | .name = "msm_fb", |
| 3777 | .id = 0, |
| 3778 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 3779 | .resource = msm_fb_resources, |
| 3780 | .dev = { |
| 3781 | .platform_data = &msm_fb_pdata, |
| 3782 | } |
| 3783 | }; |
| 3784 | |
| 3785 | static struct platform_device msm_migrate_pages_device = { |
| 3786 | .name = "msm_migrate_pages", |
| 3787 | .id = -1, |
| 3788 | }; |
| 3789 | |
| 3790 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 3791 | .name = "pmem_adsp", |
| 3792 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 3793 | .cached = 0, |
| 3794 | .memory_type = MEMTYPE_EBI0, |
| 3795 | }; |
| 3796 | |
| 3797 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 3798 | .name = "pmem_audio", |
| 3799 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 3800 | .cached = 0, |
| 3801 | .memory_type = MEMTYPE_EBI0, |
| 3802 | }; |
| 3803 | |
| 3804 | static struct platform_device android_pmem_adsp_device = { |
| 3805 | .name = "android_pmem", |
| 3806 | .id = 2, |
| 3807 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 3808 | }; |
| 3809 | |
| 3810 | static struct platform_device android_pmem_audio_device = { |
| 3811 | .name = "android_pmem", |
| 3812 | .id = 4, |
| 3813 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 3814 | }; |
| 3815 | |
| 3816 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 3817 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 3818 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 3819 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 3820 | |
| 3821 | #define QCE_SIZE 0x10000 |
| 3822 | #define QCE_0_BASE 0xA8400000 |
| 3823 | |
| 3824 | #define QCE_HW_KEY_SUPPORT 1 |
| 3825 | #define QCE_SHA_HMAC_SUPPORT 0 |
| 3826 | #define QCE_SHARE_CE_RESOURCE 0 |
| 3827 | #define QCE_CE_SHARED 0 |
| 3828 | |
| 3829 | static struct resource qcrypto_resources[] = { |
| 3830 | [0] = { |
| 3831 | .start = QCE_0_BASE, |
| 3832 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 3833 | .flags = IORESOURCE_MEM, |
| 3834 | }, |
| 3835 | [1] = { |
| 3836 | .name = "crypto_channels", |
| 3837 | .start = DMOV_CE_IN_CHAN, |
| 3838 | .end = DMOV_CE_OUT_CHAN, |
| 3839 | .flags = IORESOURCE_DMA, |
| 3840 | }, |
| 3841 | [2] = { |
| 3842 | .name = "crypto_crci_in", |
| 3843 | .start = DMOV_CE_IN_CRCI, |
| 3844 | .end = DMOV_CE_IN_CRCI, |
| 3845 | .flags = IORESOURCE_DMA, |
| 3846 | }, |
| 3847 | [3] = { |
| 3848 | .name = "crypto_crci_out", |
| 3849 | .start = DMOV_CE_OUT_CRCI, |
| 3850 | .end = DMOV_CE_OUT_CRCI, |
| 3851 | .flags = IORESOURCE_DMA, |
| 3852 | }, |
| 3853 | [4] = { |
| 3854 | .name = "crypto_crci_hash", |
| 3855 | .start = DMOV_CE_HASH_CRCI, |
| 3856 | .end = DMOV_CE_HASH_CRCI, |
| 3857 | .flags = IORESOURCE_DMA, |
| 3858 | }, |
| 3859 | }; |
| 3860 | |
| 3861 | static struct resource qcedev_resources[] = { |
| 3862 | [0] = { |
| 3863 | .start = QCE_0_BASE, |
| 3864 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 3865 | .flags = IORESOURCE_MEM, |
| 3866 | }, |
| 3867 | [1] = { |
| 3868 | .name = "crypto_channels", |
| 3869 | .start = DMOV_CE_IN_CHAN, |
| 3870 | .end = DMOV_CE_OUT_CHAN, |
| 3871 | .flags = IORESOURCE_DMA, |
| 3872 | }, |
| 3873 | [2] = { |
| 3874 | .name = "crypto_crci_in", |
| 3875 | .start = DMOV_CE_IN_CRCI, |
| 3876 | .end = DMOV_CE_IN_CRCI, |
| 3877 | .flags = IORESOURCE_DMA, |
| 3878 | }, |
| 3879 | [3] = { |
| 3880 | .name = "crypto_crci_out", |
| 3881 | .start = DMOV_CE_OUT_CRCI, |
| 3882 | .end = DMOV_CE_OUT_CRCI, |
| 3883 | .flags = IORESOURCE_DMA, |
| 3884 | }, |
| 3885 | [4] = { |
| 3886 | .name = "crypto_crci_hash", |
| 3887 | .start = DMOV_CE_HASH_CRCI, |
| 3888 | .end = DMOV_CE_HASH_CRCI, |
| 3889 | .flags = IORESOURCE_DMA, |
| 3890 | }, |
| 3891 | }; |
| 3892 | |
| 3893 | #endif |
| 3894 | |
| 3895 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 3896 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 3897 | |
| 3898 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 3899 | .ce_shared = QCE_CE_SHARED, |
| 3900 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 3901 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 3902 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 3903 | /* Bus Scaling declaration*/ |
| 3904 | .bus_scale_table = NULL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3905 | }; |
| 3906 | |
| 3907 | static struct platform_device qcrypto_device = { |
| 3908 | .name = "qcrypto", |
| 3909 | .id = 0, |
| 3910 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 3911 | .resource = qcrypto_resources, |
| 3912 | .dev = { |
| 3913 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 3914 | .platform_data = &qcrypto_ce_hw_suppport, |
| 3915 | }, |
| 3916 | }; |
| 3917 | #endif |
| 3918 | |
| 3919 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 3920 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 3921 | |
| 3922 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 3923 | .ce_shared = QCE_CE_SHARED, |
| 3924 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 3925 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 3926 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 3927 | /* Bus Scaling declaration*/ |
| 3928 | .bus_scale_table = NULL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3929 | }; |
| 3930 | static struct platform_device qcedev_device = { |
| 3931 | .name = "qce", |
| 3932 | .id = 0, |
| 3933 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 3934 | .resource = qcedev_resources, |
| 3935 | .dev = { |
| 3936 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 3937 | .platform_data = &qcedev_ce_hw_suppport, |
| 3938 | }, |
| 3939 | }; |
| 3940 | #endif |
| 3941 | |
| 3942 | static int mddi_toshiba_pmic_bl(int level) |
| 3943 | { |
| 3944 | int ret = -EPERM; |
| 3945 | |
| 3946 | ret = pmic_set_led_intensity(LED_LCD, level); |
| 3947 | |
| 3948 | if (ret) |
| 3949 | printk(KERN_WARNING "%s: can't set lcd backlight!\n", |
| 3950 | __func__); |
| 3951 | return ret; |
| 3952 | } |
| 3953 | |
| 3954 | static struct msm_panel_common_pdata mddi_toshiba_pdata = { |
| 3955 | .pmic_backlight = mddi_toshiba_pmic_bl, |
| 3956 | }; |
| 3957 | |
| 3958 | static struct platform_device mddi_toshiba_device = { |
| 3959 | .name = "mddi_toshiba", |
| 3960 | .id = 0, |
| 3961 | .dev = { |
| 3962 | .platform_data = &mddi_toshiba_pdata, |
| 3963 | } |
| 3964 | }; |
| 3965 | |
| 3966 | static unsigned wega_reset_gpio = |
| 3967 | GPIO_CFG(180, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); |
| 3968 | |
| 3969 | static struct msm_gpio fluid_vee_reset_gpio[] = { |
| 3970 | { GPIO_CFG(20, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "vee_reset" }, |
| 3971 | }; |
| 3972 | |
| 3973 | static unsigned char quickvx_mddi_client = 1, other_mddi_client = 1; |
| 3974 | static unsigned char quickvx_ldo_enabled; |
| 3975 | |
| 3976 | static unsigned quickvx_vlp_gpio = |
| 3977 | GPIO_CFG(97, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA); |
| 3978 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 3979 | static struct pm8xxx_gpio_init_info pmic_quickvx_clk_gpio = { |
| 3980 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_QUICKVX_CLK), |
| 3981 | { |
| 3982 | .direction = PM_GPIO_DIR_OUT, |
| 3983 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 3984 | .output_value = 1, |
| 3985 | .pull = PM_GPIO_PULL_NO, |
| 3986 | .vin_sel = PM8058_GPIO_VIN_S3, |
| 3987 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 3988 | .function = PM_GPIO_FUNC_2, |
| 3989 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3990 | }; |
| 3991 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 3992 | static struct regulator *mddi_ldo20; |
| 3993 | static struct regulator *mddi_ldo12; |
| 3994 | static struct regulator *mddi_ldo16; |
| 3995 | static struct regulator *mddi_ldo6; |
| 3996 | static struct regulator *mddi_lcd; |
| 3997 | |
| 3998 | static int display_common_init(void) |
| 3999 | { |
| 4000 | struct regulator_bulk_data regs[5] = { |
| 4001 | { .supply = "ldo20", /* voltage set in display_common_power */}, |
| 4002 | { .supply = "ldo12", .min_uV = 1800000, .max_uV = 1800000 }, |
| 4003 | { .supply = "ldo6", .min_uV = 3075000, .max_uV = 3400000 }, |
| 4004 | { .supply = "ldo16", .min_uV = 2600000, .max_uV = 2600000 }, |
| 4005 | { .supply = NULL, /* mddi_lcd, initialized below */ }, |
| 4006 | }; |
| 4007 | |
| 4008 | int rc = 0; |
| 4009 | |
| 4010 | if (machine_is_msm7x30_fluid()) { |
| 4011 | /* lcd: LDO8 @1.8V */ |
| 4012 | regs[4].supply = "ldo8"; |
| 4013 | regs[4].min_uV = 1800000; |
| 4014 | regs[4].max_uV = 1800000; |
| 4015 | } else { |
| 4016 | /* lcd: LDO15 @3.1V */ |
| 4017 | regs[4].supply = "ldo15"; |
| 4018 | regs[4].min_uV = 3100000; |
| 4019 | regs[4].max_uV = 3100000; |
| 4020 | } |
| 4021 | |
| 4022 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs), regs); |
| 4023 | if (rc) { |
| 4024 | pr_err("%s: regulator_bulk_get failed: %d\n", |
| 4025 | __func__, rc); |
| 4026 | goto bail; |
| 4027 | } |
| 4028 | |
| 4029 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs), regs); |
| 4030 | if (rc) { |
| 4031 | pr_err("%s: regulator_bulk_set_voltage failed: %d\n", |
| 4032 | __func__, rc); |
| 4033 | goto put_regs; |
| 4034 | } |
| 4035 | |
| 4036 | mddi_ldo20 = regs[0].consumer; |
| 4037 | mddi_ldo12 = regs[1].consumer; |
| 4038 | mddi_ldo6 = regs[2].consumer; |
| 4039 | mddi_ldo16 = regs[3].consumer; |
| 4040 | mddi_lcd = regs[4].consumer; |
| 4041 | |
| 4042 | return rc; |
| 4043 | |
| 4044 | put_regs: |
| 4045 | regulator_bulk_free(ARRAY_SIZE(regs), regs); |
| 4046 | bail: |
| 4047 | return rc; |
| 4048 | } |
| 4049 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4050 | static int display_common_power(int on) |
| 4051 | { |
| 4052 | int rc = 0, flag_on = !!on; |
| 4053 | static int display_common_power_save_on; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4054 | static bool display_regs_initialized; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4055 | |
| 4056 | if (display_common_power_save_on == flag_on) |
| 4057 | return 0; |
| 4058 | |
| 4059 | display_common_power_save_on = flag_on; |
| 4060 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4061 | if (unlikely(!display_regs_initialized)) { |
| 4062 | rc = display_common_init(); |
| 4063 | if (rc) { |
| 4064 | pr_err("%s: regulator init failed: %d\n", |
| 4065 | __func__, rc); |
| 4066 | return rc; |
| 4067 | } |
| 4068 | display_regs_initialized = true; |
| 4069 | } |
| 4070 | |
| 4071 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4072 | if (on) { |
| 4073 | /* reset Toshiba WeGA chip -- toggle reset pin -- gpio_180 */ |
| 4074 | rc = gpio_tlmm_config(wega_reset_gpio, GPIO_CFG_ENABLE); |
| 4075 | if (rc) { |
| 4076 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 4077 | __func__, wega_reset_gpio, rc); |
| 4078 | return rc; |
| 4079 | } |
| 4080 | |
| 4081 | /* bring reset line low to hold reset*/ |
| 4082 | gpio_set_value(180, 0); |
| 4083 | |
| 4084 | if (quickvx_mddi_client) { |
| 4085 | /* QuickVX chip -- VLP pin -- gpio 97 */ |
| 4086 | rc = gpio_tlmm_config(quickvx_vlp_gpio, |
| 4087 | GPIO_CFG_ENABLE); |
| 4088 | if (rc) { |
| 4089 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 4090 | __func__, quickvx_vlp_gpio, rc); |
| 4091 | return rc; |
| 4092 | } |
| 4093 | |
| 4094 | /* bring QuickVX VLP line low */ |
| 4095 | gpio_set_value(97, 0); |
| 4096 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4097 | rc = pm8xxx_gpio_config(pmic_quickvx_clk_gpio.gpio, |
| 4098 | &pmic_quickvx_clk_gpio.config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4099 | if (rc) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4100 | pr_err("%s: pm8xxx_gpio_config(%#x)=%d\n", |
| 4101 | __func__, pmic_quickvx_clk_gpio.gpio, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4102 | rc); |
| 4103 | return rc; |
| 4104 | } |
| 4105 | |
| 4106 | gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS( |
| 4107 | PMIC_GPIO_QUICKVX_CLK), 0); |
| 4108 | } |
| 4109 | } |
| 4110 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4111 | if (quickvx_mddi_client) |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4112 | rc = regulator_set_voltage(mddi_ldo20, 1800000, 1800000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4113 | else |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4114 | rc = regulator_set_voltage(mddi_ldo20, 1500000, 1500000); |
| 4115 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4116 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4117 | pr_err("%s: could not set voltage for ldo20: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4118 | __func__, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4119 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4120 | } |
| 4121 | |
| 4122 | if (on) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4123 | rc = regulator_enable(mddi_ldo20); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4124 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4125 | pr_err("%s: LDO20 regulator enable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4126 | __func__, rc); |
| 4127 | return rc; |
| 4128 | } |
| 4129 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4130 | rc = regulator_enable(mddi_ldo12); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4131 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4132 | pr_err("%s: LDO12 regulator enable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4133 | __func__, rc); |
| 4134 | return rc; |
| 4135 | } |
| 4136 | |
| 4137 | if (other_mddi_client) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4138 | rc = regulator_enable(mddi_ldo16); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4139 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4140 | pr_err("%s: LDO16 regulator enable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4141 | __func__, rc); |
| 4142 | return rc; |
| 4143 | } |
| 4144 | } |
| 4145 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4146 | if (quickvx_ldo_enabled) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4147 | /* Disable LDO6 during display ON */ |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4148 | rc = regulator_disable(mddi_ldo6); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4149 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4150 | pr_err("%s: LDO6 regulator disable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4151 | __func__, rc); |
| 4152 | return rc; |
| 4153 | } |
| 4154 | quickvx_ldo_enabled = 0; |
| 4155 | } |
| 4156 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4157 | rc = regulator_enable(mddi_lcd); |
| 4158 | if (rc) { |
| 4159 | pr_err("%s: LCD regulator enable failed (%d)\n", |
| 4160 | __func__, rc); |
| 4161 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4162 | } |
| 4163 | |
| 4164 | mdelay(5); /* ensure power is stable */ |
| 4165 | |
| 4166 | if (machine_is_msm7x30_fluid()) { |
| 4167 | rc = msm_gpios_request_enable(fluid_vee_reset_gpio, |
| 4168 | ARRAY_SIZE(fluid_vee_reset_gpio)); |
| 4169 | if (rc) |
| 4170 | pr_err("%s gpio_request_enable failed rc=%d\n", |
| 4171 | __func__, rc); |
| 4172 | else { |
| 4173 | /* assert vee reset_n */ |
| 4174 | gpio_set_value(20, 1); |
| 4175 | gpio_set_value(20, 0); |
| 4176 | mdelay(1); |
| 4177 | gpio_set_value(20, 1); |
| 4178 | } |
| 4179 | } |
| 4180 | |
| 4181 | gpio_set_value(180, 1); /* bring reset line high */ |
| 4182 | mdelay(10); /* 10 msec before IO can be accessed */ |
| 4183 | |
| 4184 | if (quickvx_mddi_client) { |
| 4185 | gpio_set_value(97, 1); |
| 4186 | msleep(2); |
| 4187 | gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS( |
| 4188 | PMIC_GPIO_QUICKVX_CLK), 1); |
| 4189 | msleep(2); |
| 4190 | } |
| 4191 | |
| 4192 | rc = pmapp_display_clock_config(1); |
| 4193 | if (rc) { |
| 4194 | pr_err("%s pmapp_display_clock_config rc=%d\n", |
| 4195 | __func__, rc); |
| 4196 | return rc; |
| 4197 | } |
| 4198 | |
| 4199 | } else { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4200 | rc = regulator_disable(mddi_ldo20); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4201 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4202 | pr_err("%s: LDO20 regulator disable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4203 | __func__, rc); |
| 4204 | return rc; |
| 4205 | } |
| 4206 | |
| 4207 | |
| 4208 | if (other_mddi_client) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4209 | rc = regulator_disable(mddi_ldo16); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4210 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4211 | pr_err("%s: LDO16 regulator disable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4212 | __func__, rc); |
| 4213 | return rc; |
| 4214 | } |
| 4215 | } |
| 4216 | |
| 4217 | if (quickvx_mddi_client && !quickvx_ldo_enabled) { |
| 4218 | /* Enable LDO6 during display OFF for |
| 4219 | Quicklogic chip to sleep with data retention */ |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4220 | rc = regulator_enable(mddi_ldo6); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4221 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4222 | pr_err("%s: LDO6 regulator enable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4223 | __func__, rc); |
| 4224 | return rc; |
| 4225 | } |
| 4226 | quickvx_ldo_enabled = 1; |
| 4227 | } |
| 4228 | |
| 4229 | gpio_set_value(180, 0); /* bring reset line low */ |
| 4230 | |
| 4231 | if (quickvx_mddi_client) { |
| 4232 | gpio_set_value(97, 0); |
| 4233 | gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS( |
| 4234 | PMIC_GPIO_QUICKVX_CLK), 0); |
| 4235 | } |
| 4236 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4237 | rc = regulator_disable(mddi_lcd); |
| 4238 | if (rc) { |
| 4239 | pr_err("%s: LCD regulator disable failed (%d)\n", |
| 4240 | __func__, rc); |
| 4241 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4242 | } |
| 4243 | |
| 4244 | mdelay(5); /* ensure power is stable */ |
| 4245 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4246 | rc = regulator_disable(mddi_ldo12); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4247 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4248 | pr_err("%s: LDO12 regulator disable failed (%d)\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4249 | __func__, rc); |
| 4250 | return rc; |
| 4251 | } |
| 4252 | |
| 4253 | if (machine_is_msm7x30_fluid()) { |
| 4254 | msm_gpios_disable_free(fluid_vee_reset_gpio, |
| 4255 | ARRAY_SIZE(fluid_vee_reset_gpio)); |
| 4256 | } |
| 4257 | |
| 4258 | rc = pmapp_display_clock_config(0); |
| 4259 | if (rc) { |
| 4260 | pr_err("%s pmapp_display_clock_config rc=%d\n", |
| 4261 | __func__, rc); |
| 4262 | return rc; |
| 4263 | } |
| 4264 | } |
| 4265 | |
| 4266 | return rc; |
| 4267 | } |
| 4268 | |
| 4269 | static int msm_fb_mddi_sel_clk(u32 *clk_rate) |
| 4270 | { |
| 4271 | *clk_rate *= 2; |
| 4272 | return 0; |
| 4273 | } |
| 4274 | |
| 4275 | static int msm_fb_mddi_client_power(u32 client_id) |
| 4276 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4277 | printk(KERN_NOTICE "\n client_id = 0x%x", client_id); |
| 4278 | /* Check if it is Quicklogic client */ |
| 4279 | if (client_id == 0xc5835800) { |
| 4280 | printk(KERN_NOTICE "\n Quicklogic MDDI client"); |
| 4281 | other_mddi_client = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4282 | } else { |
| 4283 | printk(KERN_NOTICE "\n Non-Quicklogic MDDI client"); |
| 4284 | quickvx_mddi_client = 0; |
| 4285 | gpio_set_value(97, 0); |
| 4286 | gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS( |
| 4287 | PMIC_GPIO_QUICKVX_CLK), 0); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4288 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4289 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4290 | return 0; |
| 4291 | } |
| 4292 | |
| 4293 | static struct mddi_platform_data mddi_pdata = { |
| 4294 | .mddi_power_save = display_common_power, |
| 4295 | .mddi_sel_clk = msm_fb_mddi_sel_clk, |
| 4296 | .mddi_client_power = msm_fb_mddi_client_power, |
| 4297 | }; |
| 4298 | |
| 4299 | int mdp_core_clk_rate_table[] = { |
| 4300 | 122880000, |
| 4301 | 122880000, |
Pradeep Jilagam | 3cc12f9 | 2011-07-26 22:25:18 +0530 | [diff] [blame] | 4302 | 192000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4303 | 192000000, |
| 4304 | }; |
| 4305 | |
| 4306 | static struct msm_panel_common_pdata mdp_pdata = { |
| 4307 | .hw_revision_addr = 0xac001270, |
| 4308 | .gpio = 30, |
| 4309 | .mdp_core_clk_rate = 122880000, |
| 4310 | .mdp_core_clk_table = mdp_core_clk_rate_table, |
| 4311 | .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table), |
Ravishangar Kalyanam | 07ef788 | 2011-08-09 15:50:48 -0700 | [diff] [blame] | 4312 | .mdp_rev = MDP_REV_40, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4313 | }; |
| 4314 | |
| 4315 | static int lcd_panel_spi_gpio_num[] = { |
| 4316 | 45, /* spi_clk */ |
| 4317 | 46, /* spi_cs */ |
| 4318 | 47, /* spi_mosi */ |
| 4319 | 48, /* spi_miso */ |
| 4320 | }; |
| 4321 | |
| 4322 | static struct msm_gpio lcd_panel_gpios[] = { |
| 4323 | /* Workaround, since HDMI_INT is using the same GPIO line (18), and is used as |
| 4324 | * input. if there is a hardware revision; we should reassign this GPIO to a |
| 4325 | * new open line; and removing it will just ensure that this will be missed in |
| 4326 | * the future. |
| 4327 | { GPIO_CFG(18, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn0" }, |
| 4328 | */ |
| 4329 | { GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn1" }, |
| 4330 | { GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu0" }, |
| 4331 | { GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu1" }, |
| 4332 | { GPIO_CFG(22, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu2" }, |
| 4333 | { GPIO_CFG(23, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red0" }, |
| 4334 | { GPIO_CFG(24, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red1" }, |
| 4335 | { GPIO_CFG(25, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red2" }, |
| 4336 | #ifndef CONFIG_SPI_QSD |
| 4337 | { GPIO_CFG(45, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_clk" }, |
| 4338 | { GPIO_CFG(46, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_cs0" }, |
| 4339 | { GPIO_CFG(47, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_mosi" }, |
| 4340 | { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_miso" }, |
| 4341 | #endif |
| 4342 | { GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_pclk" }, |
| 4343 | { GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_en" }, |
| 4344 | { GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_vsync" }, |
| 4345 | { GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_hsync" }, |
| 4346 | { GPIO_CFG(94, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn2" }, |
| 4347 | { GPIO_CFG(95, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn3" }, |
| 4348 | { GPIO_CFG(96, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn4" }, |
| 4349 | { GPIO_CFG(97, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn5" }, |
| 4350 | { GPIO_CFG(98, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn6" }, |
| 4351 | { GPIO_CFG(99, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn7" }, |
| 4352 | { GPIO_CFG(100, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu3" }, |
| 4353 | { GPIO_CFG(101, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu4" }, |
| 4354 | { GPIO_CFG(102, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu5" }, |
| 4355 | { GPIO_CFG(103, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu6" }, |
| 4356 | { GPIO_CFG(104, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu7" }, |
| 4357 | { GPIO_CFG(105, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red3" }, |
| 4358 | { GPIO_CFG(106, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red4" }, |
| 4359 | { GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red5" }, |
| 4360 | { GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red6" }, |
| 4361 | { GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red7" }, |
| 4362 | }; |
| 4363 | |
| 4364 | static struct msm_gpio lcd_sharp_panel_gpios[] = { |
| 4365 | { GPIO_CFG(22, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu2" }, |
| 4366 | { GPIO_CFG(25, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red2" }, |
| 4367 | { GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_pclk" }, |
| 4368 | { GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_en" }, |
| 4369 | { GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_vsync" }, |
| 4370 | { GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_hsync" }, |
| 4371 | { GPIO_CFG(94, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn2" }, |
| 4372 | { GPIO_CFG(95, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn3" }, |
| 4373 | { GPIO_CFG(96, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn4" }, |
| 4374 | { GPIO_CFG(97, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn5" }, |
| 4375 | { GPIO_CFG(98, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn6" }, |
| 4376 | { GPIO_CFG(99, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn7" }, |
| 4377 | { GPIO_CFG(100, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu3" }, |
| 4378 | { GPIO_CFG(101, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu4" }, |
| 4379 | { GPIO_CFG(102, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu5" }, |
| 4380 | { GPIO_CFG(103, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu6" }, |
| 4381 | { GPIO_CFG(104, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu7" }, |
| 4382 | { GPIO_CFG(105, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red3" }, |
| 4383 | { GPIO_CFG(106, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red4" }, |
| 4384 | { GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red5" }, |
| 4385 | { GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red6" }, |
| 4386 | { GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red7" }, |
| 4387 | }; |
| 4388 | |
| 4389 | static int lcdc_toshiba_panel_power(int on) |
| 4390 | { |
| 4391 | int rc, i; |
| 4392 | struct msm_gpio *gp; |
| 4393 | |
| 4394 | rc = display_common_power(on); |
| 4395 | if (rc < 0) { |
| 4396 | printk(KERN_ERR "%s display_common_power failed: %d\n", |
| 4397 | __func__, rc); |
| 4398 | return rc; |
| 4399 | } |
| 4400 | |
| 4401 | if (on) { |
| 4402 | rc = msm_gpios_enable(lcd_panel_gpios, |
| 4403 | ARRAY_SIZE(lcd_panel_gpios)); |
| 4404 | if (rc < 0) { |
| 4405 | printk(KERN_ERR "%s: gpio enable failed: %d\n", |
| 4406 | __func__, rc); |
| 4407 | } |
| 4408 | } else { /* off */ |
| 4409 | gp = lcd_panel_gpios; |
| 4410 | for (i = 0; i < ARRAY_SIZE(lcd_panel_gpios); i++) { |
| 4411 | /* ouput low */ |
| 4412 | gpio_set_value(GPIO_PIN(gp->gpio_cfg), 0); |
| 4413 | gp++; |
| 4414 | } |
| 4415 | } |
| 4416 | |
| 4417 | return rc; |
| 4418 | } |
| 4419 | |
| 4420 | static int lcdc_sharp_panel_power(int on) |
| 4421 | { |
| 4422 | int rc, i; |
| 4423 | struct msm_gpio *gp; |
| 4424 | |
| 4425 | rc = display_common_power(on); |
| 4426 | if (rc < 0) { |
| 4427 | printk(KERN_ERR "%s display_common_power failed: %d\n", |
| 4428 | __func__, rc); |
| 4429 | return rc; |
| 4430 | } |
| 4431 | |
| 4432 | if (on) { |
| 4433 | rc = msm_gpios_enable(lcd_sharp_panel_gpios, |
| 4434 | ARRAY_SIZE(lcd_sharp_panel_gpios)); |
| 4435 | if (rc < 0) { |
| 4436 | printk(KERN_ERR "%s: gpio enable failed: %d\n", |
| 4437 | __func__, rc); |
| 4438 | } |
| 4439 | } else { /* off */ |
| 4440 | gp = lcd_sharp_panel_gpios; |
| 4441 | for (i = 0; i < ARRAY_SIZE(lcd_sharp_panel_gpios); i++) { |
| 4442 | /* ouput low */ |
| 4443 | gpio_set_value(GPIO_PIN(gp->gpio_cfg), 0); |
| 4444 | gp++; |
| 4445 | } |
| 4446 | } |
| 4447 | |
| 4448 | return rc; |
| 4449 | } |
| 4450 | |
| 4451 | static int lcdc_panel_power(int on) |
| 4452 | { |
| 4453 | int flag_on = !!on; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4454 | static int lcdc_power_save_on, lcdc_power_initialized; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4455 | |
| 4456 | if (lcdc_power_save_on == flag_on) |
| 4457 | return 0; |
| 4458 | |
| 4459 | lcdc_power_save_on = flag_on; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4460 | |
| 4461 | if (unlikely(!lcdc_power_initialized)) { |
| 4462 | quickvx_mddi_client = 0; |
| 4463 | display_common_init(); |
| 4464 | lcdc_power_initialized = 1; |
| 4465 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4466 | |
| 4467 | if (machine_is_msm7x30_fluid()) |
| 4468 | return lcdc_sharp_panel_power(on); |
| 4469 | else |
| 4470 | return lcdc_toshiba_panel_power(on); |
| 4471 | } |
| 4472 | |
| 4473 | static struct lcdc_platform_data lcdc_pdata = { |
| 4474 | .lcdc_power_save = lcdc_panel_power, |
| 4475 | }; |
| 4476 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4477 | static struct regulator *atv_s4, *atv_ldo9; |
| 4478 | |
| 4479 | static int __init atv_dac_power_init(void) |
| 4480 | { |
| 4481 | int rc; |
| 4482 | struct regulator_bulk_data regs[] = { |
| 4483 | { .supply = "smps4", .min_uV = 2200000, .max_uV = 2200000 }, |
| 4484 | { .supply = "ldo9", .min_uV = 2050000, .max_uV = 2050000 }, |
| 4485 | }; |
| 4486 | |
| 4487 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs), regs); |
| 4488 | |
| 4489 | if (rc) { |
| 4490 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 4491 | goto bail; |
| 4492 | } |
| 4493 | |
| 4494 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs), regs); |
| 4495 | |
| 4496 | if (rc) { |
| 4497 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 4498 | goto reg_free; |
| 4499 | } |
| 4500 | |
| 4501 | atv_s4 = regs[0].consumer; |
| 4502 | atv_ldo9 = regs[1].consumer; |
| 4503 | |
| 4504 | reg_free: |
| 4505 | regulator_bulk_free(ARRAY_SIZE(regs), regs); |
| 4506 | bail: |
| 4507 | return rc; |
| 4508 | } |
| 4509 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4510 | static int atv_dac_power(int on) |
| 4511 | { |
| 4512 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4513 | |
| 4514 | if (on) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4515 | rc = regulator_enable(atv_s4); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4516 | if (rc) { |
| 4517 | pr_err("%s: s4 vreg enable failed (%d)\n", |
| 4518 | __func__, rc); |
| 4519 | return rc; |
| 4520 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4521 | rc = regulator_enable(atv_ldo9); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4522 | if (rc) { |
| 4523 | pr_err("%s: ldo9 vreg enable failed (%d)\n", |
| 4524 | __func__, rc); |
| 4525 | return rc; |
| 4526 | } |
| 4527 | } else { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4528 | rc = regulator_disable(atv_ldo9); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4529 | if (rc) { |
| 4530 | pr_err("%s: ldo9 vreg disable failed (%d)\n", |
| 4531 | __func__, rc); |
| 4532 | return rc; |
| 4533 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4534 | rc = regulator_disable(atv_s4); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4535 | if (rc) { |
| 4536 | pr_err("%s: s4 vreg disable failed (%d)\n", |
| 4537 | __func__, rc); |
| 4538 | return rc; |
| 4539 | } |
| 4540 | } |
| 4541 | return rc; |
| 4542 | } |
| 4543 | |
| 4544 | static struct tvenc_platform_data atv_pdata = { |
| 4545 | .poll = 1, |
| 4546 | .pm_vid_en = atv_dac_power, |
| 4547 | }; |
| 4548 | |
| 4549 | static void __init msm_fb_add_devices(void) |
| 4550 | { |
| 4551 | msm_fb_register_device("mdp", &mdp_pdata); |
| 4552 | msm_fb_register_device("pmdh", &mddi_pdata); |
| 4553 | msm_fb_register_device("lcdc", &lcdc_pdata); |
| 4554 | msm_fb_register_device("dtv", &dtv_pdata); |
| 4555 | msm_fb_register_device("tvenc", &atv_pdata); |
| 4556 | #ifdef CONFIG_FB_MSM_TVOUT |
| 4557 | msm_fb_register_device("tvout_device", NULL); |
| 4558 | #endif |
| 4559 | } |
| 4560 | |
| 4561 | static struct msm_panel_common_pdata lcdc_toshiba_panel_data = { |
| 4562 | .gpio_num = lcd_panel_spi_gpio_num, |
| 4563 | }; |
| 4564 | |
| 4565 | static struct platform_device lcdc_toshiba_panel_device = { |
| 4566 | .name = "lcdc_toshiba_wvga", |
| 4567 | .id = 0, |
| 4568 | .dev = { |
| 4569 | .platform_data = &lcdc_toshiba_panel_data, |
| 4570 | } |
| 4571 | }; |
| 4572 | |
| 4573 | #if defined(CONFIG_MARIMBA_CORE) && \ |
| 4574 | (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE)) |
| 4575 | static struct platform_device msm_bt_power_device = { |
| 4576 | .name = "bt_power", |
| 4577 | .id = -1 |
| 4578 | }; |
| 4579 | |
| 4580 | enum { |
| 4581 | BT_RFR, |
| 4582 | BT_CTS, |
| 4583 | BT_RX, |
| 4584 | BT_TX, |
| 4585 | }; |
| 4586 | |
| 4587 | static struct msm_gpio bt_config_power_on[] = { |
| 4588 | { GPIO_CFG(134, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 4589 | "UART1DM_RFR" }, |
| 4590 | { GPIO_CFG(135, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 4591 | "UART1DM_CTS" }, |
| 4592 | { GPIO_CFG(136, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 4593 | "UART1DM_Rx" }, |
| 4594 | { GPIO_CFG(137, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 4595 | "UART1DM_Tx" } |
| 4596 | }; |
| 4597 | |
| 4598 | static struct msm_gpio bt_config_power_off[] = { |
| 4599 | { GPIO_CFG(134, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 4600 | "UART1DM_RFR" }, |
| 4601 | { GPIO_CFG(135, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 4602 | "UART1DM_CTS" }, |
| 4603 | { GPIO_CFG(136, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 4604 | "UART1DM_Rx" }, |
| 4605 | { GPIO_CFG(137, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 4606 | "UART1DM_Tx" } |
| 4607 | }; |
| 4608 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4609 | static u8 bahama_version; |
| 4610 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4611 | static struct regulator_bulk_data regs_bt_marimba[] = { |
| 4612 | { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 4613 | { .supply = "smps2", .min_uV = 1300000, .max_uV = 1300000 }, |
| 4614 | { .supply = "ldo24", .min_uV = 1200000, .max_uV = 1200000 }, |
Pankaj Kumar | a2320de | 2011-11-30 12:55:12 +0530 | [diff] [blame] | 4615 | { .supply = "ldo13", .min_uV = 2900000, .max_uV = 3050000 }, |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4616 | }; |
| 4617 | |
| 4618 | static struct regulator_bulk_data regs_bt_bahama_v1[] = { |
| 4619 | { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 4620 | { .supply = "ldo7", .min_uV = 1800000, .max_uV = 1800000 }, |
| 4621 | { .supply = "smps2", .min_uV = 1300000, .max_uV = 1300000 }, |
Pankaj Kumar | a2320de | 2011-11-30 12:55:12 +0530 | [diff] [blame] | 4622 | { .supply = "ldo13", .min_uV = 2900000, .max_uV = 3050000 }, |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4623 | }; |
| 4624 | |
| 4625 | static struct regulator_bulk_data regs_bt_bahama_v2[] = { |
| 4626 | { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 4627 | { .supply = "ldo7", .min_uV = 1800000, .max_uV = 1800000 }, |
Pankaj Kumar | a2320de | 2011-11-30 12:55:12 +0530 | [diff] [blame] | 4628 | { .supply = "ldo13", .min_uV = 2900000, .max_uV = 3050000 }, |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4629 | }; |
| 4630 | |
| 4631 | static struct regulator_bulk_data *regs_bt; |
| 4632 | static int regs_bt_count; |
| 4633 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4634 | static int marimba_bt(int on) |
| 4635 | { |
| 4636 | int rc; |
| 4637 | int i; |
| 4638 | struct marimba config = { .mod_id = MARIMBA_SLAVE_ID_MARIMBA }; |
| 4639 | |
| 4640 | struct marimba_config_register { |
| 4641 | u8 reg; |
| 4642 | u8 value; |
| 4643 | u8 mask; |
| 4644 | }; |
| 4645 | |
| 4646 | struct marimba_variant_register { |
| 4647 | const size_t size; |
| 4648 | const struct marimba_config_register *set; |
| 4649 | }; |
| 4650 | |
| 4651 | const struct marimba_config_register *p; |
| 4652 | |
| 4653 | u8 version; |
| 4654 | |
| 4655 | const struct marimba_config_register v10_bt_on[] = { |
| 4656 | { 0xE5, 0x0B, 0x0F }, |
| 4657 | { 0x05, 0x02, 0x07 }, |
| 4658 | { 0x06, 0x88, 0xFF }, |
| 4659 | { 0xE7, 0x21, 0x21 }, |
| 4660 | { 0xE3, 0x38, 0xFF }, |
| 4661 | { 0xE4, 0x06, 0xFF }, |
| 4662 | }; |
| 4663 | |
| 4664 | const struct marimba_config_register v10_bt_off[] = { |
| 4665 | { 0xE5, 0x0B, 0x0F }, |
| 4666 | { 0x05, 0x08, 0x0F }, |
| 4667 | { 0x06, 0x88, 0xFF }, |
| 4668 | { 0xE7, 0x00, 0x21 }, |
| 4669 | { 0xE3, 0x00, 0xFF }, |
| 4670 | { 0xE4, 0x00, 0xFF }, |
| 4671 | }; |
| 4672 | |
| 4673 | const struct marimba_config_register v201_bt_on[] = { |
| 4674 | { 0x05, 0x08, 0x07 }, |
| 4675 | { 0x06, 0x88, 0xFF }, |
| 4676 | { 0xE7, 0x21, 0x21 }, |
| 4677 | { 0xE3, 0x38, 0xFF }, |
| 4678 | { 0xE4, 0x06, 0xFF }, |
| 4679 | }; |
| 4680 | |
| 4681 | const struct marimba_config_register v201_bt_off[] = { |
| 4682 | { 0x05, 0x08, 0x07 }, |
| 4683 | { 0x06, 0x88, 0xFF }, |
| 4684 | { 0xE7, 0x00, 0x21 }, |
| 4685 | { 0xE3, 0x00, 0xFF }, |
| 4686 | { 0xE4, 0x00, 0xFF }, |
| 4687 | }; |
| 4688 | |
| 4689 | const struct marimba_config_register v210_bt_on[] = { |
| 4690 | { 0xE9, 0x01, 0x01 }, |
| 4691 | { 0x06, 0x88, 0xFF }, |
| 4692 | { 0xE7, 0x21, 0x21 }, |
| 4693 | { 0xE3, 0x38, 0xFF }, |
| 4694 | { 0xE4, 0x06, 0xFF }, |
| 4695 | }; |
| 4696 | |
| 4697 | const struct marimba_config_register v210_bt_off[] = { |
| 4698 | { 0x06, 0x88, 0xFF }, |
| 4699 | { 0xE7, 0x00, 0x21 }, |
| 4700 | { 0xE9, 0x00, 0x01 }, |
| 4701 | { 0xE3, 0x00, 0xFF }, |
| 4702 | { 0xE4, 0x00, 0xFF }, |
| 4703 | }; |
| 4704 | |
| 4705 | const struct marimba_variant_register bt_marimba[2][4] = { |
| 4706 | { |
| 4707 | { ARRAY_SIZE(v10_bt_off), v10_bt_off }, |
| 4708 | { 0, NULL }, |
| 4709 | { ARRAY_SIZE(v201_bt_off), v201_bt_off }, |
| 4710 | { ARRAY_SIZE(v210_bt_off), v210_bt_off } |
| 4711 | }, |
| 4712 | { |
| 4713 | { ARRAY_SIZE(v10_bt_on), v10_bt_on }, |
| 4714 | { 0, NULL }, |
| 4715 | { ARRAY_SIZE(v201_bt_on), v201_bt_on }, |
| 4716 | { ARRAY_SIZE(v210_bt_on), v210_bt_on } |
| 4717 | } |
| 4718 | }; |
| 4719 | |
| 4720 | on = on ? 1 : 0; |
| 4721 | |
| 4722 | rc = marimba_read_bit_mask(&config, 0x11, &version, 1, 0x1F); |
| 4723 | if (rc < 0) { |
| 4724 | printk(KERN_ERR |
| 4725 | "%s: version read failed: %d\n", |
| 4726 | __func__, rc); |
| 4727 | return rc; |
| 4728 | } |
| 4729 | |
| 4730 | if ((version >= ARRAY_SIZE(bt_marimba[on])) || |
| 4731 | (bt_marimba[on][version].size == 0)) { |
| 4732 | printk(KERN_ERR |
| 4733 | "%s: unsupported version\n", |
| 4734 | __func__); |
| 4735 | return -EIO; |
| 4736 | } |
| 4737 | |
| 4738 | p = bt_marimba[on][version].set; |
| 4739 | |
| 4740 | printk(KERN_INFO "%s: found version %d\n", __func__, version); |
| 4741 | |
| 4742 | for (i = 0; i < bt_marimba[on][version].size; i++) { |
| 4743 | u8 value = (p+i)->value; |
| 4744 | rc = marimba_write_bit_mask(&config, |
| 4745 | (p+i)->reg, |
| 4746 | &value, |
| 4747 | sizeof((p+i)->value), |
| 4748 | (p+i)->mask); |
| 4749 | if (rc < 0) { |
| 4750 | printk(KERN_ERR |
| 4751 | "%s: reg %d write failed: %d\n", |
| 4752 | __func__, (p+i)->reg, rc); |
| 4753 | return rc; |
| 4754 | } |
| 4755 | printk(KERN_INFO "%s: reg 0x%02x value 0x%02x mask 0x%02x\n", |
| 4756 | __func__, (p+i)->reg, |
| 4757 | value, (p+i)->mask); |
| 4758 | } |
| 4759 | return 0; |
| 4760 | } |
| 4761 | |
| 4762 | static int bahama_bt(int on) |
| 4763 | { |
| 4764 | int rc; |
| 4765 | int i; |
| 4766 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA }; |
| 4767 | |
| 4768 | struct bahama_variant_register { |
| 4769 | const size_t size; |
| 4770 | const struct bahama_config_register *set; |
| 4771 | }; |
| 4772 | |
| 4773 | const struct bahama_config_register *p; |
| 4774 | |
| 4775 | |
| 4776 | const struct bahama_config_register v10_bt_on[] = { |
| 4777 | { 0xE9, 0x00, 0xFF }, |
| 4778 | { 0xF4, 0x80, 0xFF }, |
| 4779 | { 0xF0, 0x06, 0xFF }, |
| 4780 | { 0xE4, 0x00, 0xFF }, |
| 4781 | { 0xE5, 0x00, 0x0F }, |
| 4782 | #ifdef CONFIG_WLAN |
| 4783 | { 0xE6, 0x38, 0x7F }, |
| 4784 | { 0xE7, 0x06, 0xFF }, |
| 4785 | #endif |
| 4786 | { 0x11, 0x13, 0xFF }, |
| 4787 | { 0xE9, 0x21, 0xFF }, |
| 4788 | { 0x01, 0x0C, 0x1F }, |
| 4789 | { 0x01, 0x08, 0x1F }, |
| 4790 | }; |
| 4791 | |
| 4792 | const struct bahama_config_register v20_bt_on_fm_off[] = { |
| 4793 | { 0x11, 0x0C, 0xFF }, |
| 4794 | { 0x13, 0x01, 0xFF }, |
| 4795 | { 0xF4, 0x80, 0xFF }, |
| 4796 | { 0xF0, 0x00, 0xFF }, |
| 4797 | { 0xE9, 0x00, 0xFF }, |
| 4798 | #ifdef CONFIG_WLAN |
| 4799 | { 0x81, 0x00, 0xFF }, |
| 4800 | { 0x82, 0x00, 0xFF }, |
| 4801 | { 0xE6, 0x38, 0x7F }, |
| 4802 | { 0xE7, 0x06, 0xFF }, |
| 4803 | #endif |
| 4804 | { 0xE9, 0x21, 0xFF } |
| 4805 | }; |
| 4806 | |
| 4807 | const struct bahama_config_register v20_bt_on_fm_on[] = { |
| 4808 | { 0x11, 0x0C, 0xFF }, |
| 4809 | { 0x13, 0x01, 0xFF }, |
| 4810 | { 0xF4, 0x86, 0xFF }, |
| 4811 | { 0xF0, 0x06, 0xFF }, |
| 4812 | { 0xE9, 0x00, 0xFF }, |
| 4813 | #ifdef CONFIG_WLAN |
| 4814 | { 0x81, 0x00, 0xFF }, |
| 4815 | { 0x82, 0x00, 0xFF }, |
| 4816 | { 0xE6, 0x38, 0x7F }, |
| 4817 | { 0xE7, 0x06, 0xFF }, |
| 4818 | #endif |
| 4819 | { 0xE9, 0x21, 0xFF } |
| 4820 | }; |
| 4821 | |
| 4822 | const struct bahama_config_register v10_bt_off[] = { |
| 4823 | { 0xE9, 0x00, 0xFF }, |
| 4824 | }; |
| 4825 | |
| 4826 | const struct bahama_config_register v20_bt_off_fm_off[] = { |
| 4827 | { 0xF4, 0x84, 0xFF }, |
| 4828 | { 0xF0, 0x04, 0xFF }, |
| 4829 | { 0xE9, 0x00, 0xFF } |
| 4830 | }; |
| 4831 | |
| 4832 | const struct bahama_config_register v20_bt_off_fm_on[] = { |
| 4833 | { 0xF4, 0x86, 0xFF }, |
| 4834 | { 0xF0, 0x06, 0xFF }, |
| 4835 | { 0xE9, 0x00, 0xFF } |
| 4836 | }; |
| 4837 | |
| 4838 | const struct bahama_variant_register bt_bahama[2][3] = { |
| 4839 | { |
| 4840 | { ARRAY_SIZE(v10_bt_off), v10_bt_off }, |
| 4841 | { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off }, |
| 4842 | { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on } |
| 4843 | }, |
| 4844 | { |
| 4845 | { ARRAY_SIZE(v10_bt_on), v10_bt_on }, |
| 4846 | { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off }, |
| 4847 | { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on } |
| 4848 | } |
| 4849 | }; |
| 4850 | |
| 4851 | u8 offset = 0; /* index into bahama configs */ |
| 4852 | |
| 4853 | on = on ? 1 : 0; |
| 4854 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4855 | |
| 4856 | if (bahama_version == VER_2_0) { |
| 4857 | if (marimba_get_fm_status(&config)) |
| 4858 | offset = 0x01; |
| 4859 | } |
| 4860 | |
| 4861 | p = bt_bahama[on][bahama_version + offset].set; |
| 4862 | |
| 4863 | dev_info(&msm_bt_power_device.dev, |
| 4864 | "%s: found version %d\n", __func__, bahama_version); |
| 4865 | |
| 4866 | for (i = 0; i < bt_bahama[on][bahama_version + offset].size; i++) { |
| 4867 | u8 value = (p+i)->value; |
| 4868 | rc = marimba_write_bit_mask(&config, |
| 4869 | (p+i)->reg, |
| 4870 | &value, |
| 4871 | sizeof((p+i)->value), |
| 4872 | (p+i)->mask); |
| 4873 | if (rc < 0) { |
| 4874 | dev_err(&msm_bt_power_device.dev, |
| 4875 | "%s: reg %d write failed: %d\n", |
| 4876 | __func__, (p+i)->reg, rc); |
| 4877 | return rc; |
| 4878 | } |
| 4879 | dev_info(&msm_bt_power_device.dev, |
| 4880 | "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n", |
| 4881 | __func__, (p+i)->reg, |
| 4882 | value, (p+i)->mask); |
| 4883 | } |
| 4884 | /* Update BT status */ |
| 4885 | if (on) |
| 4886 | marimba_set_bt_status(&config, true); |
| 4887 | else |
| 4888 | marimba_set_bt_status(&config, false); |
| 4889 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4890 | return 0; |
| 4891 | } |
| 4892 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4893 | static int bluetooth_regs_init(int bahama_not_marimba) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4894 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4895 | int rc = 0; |
| 4896 | struct device *const dev = &msm_bt_power_device.dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4897 | |
| 4898 | if (bahama_not_marimba) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4899 | bahama_version = read_bahama_ver(); |
| 4900 | |
| 4901 | switch (bahama_version) { |
| 4902 | case VER_1_0: |
| 4903 | regs_bt = regs_bt_bahama_v1; |
| 4904 | regs_bt_count = ARRAY_SIZE(regs_bt_bahama_v1); |
| 4905 | break; |
| 4906 | case VER_2_0: |
| 4907 | regs_bt = regs_bt_bahama_v2; |
| 4908 | regs_bt_count = ARRAY_SIZE(regs_bt_bahama_v2); |
| 4909 | break; |
| 4910 | case VER_UNSUPPORTED: |
| 4911 | default: |
| 4912 | dev_err(dev, |
| 4913 | "%s: i2c failure or unsupported version: %d\n", |
| 4914 | __func__, bahama_version); |
| 4915 | rc = -EIO; |
| 4916 | goto out; |
| 4917 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4918 | } else { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4919 | regs_bt = regs_bt_marimba; |
| 4920 | regs_bt_count = ARRAY_SIZE(regs_bt_marimba); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4921 | } |
| 4922 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4923 | rc = regulator_bulk_get(&msm_bt_power_device.dev, |
| 4924 | regs_bt_count, regs_bt); |
| 4925 | if (rc) { |
| 4926 | dev_err(dev, "%s: could not get regulators: %d\n", |
| 4927 | __func__, rc); |
| 4928 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4929 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4930 | |
| 4931 | rc = regulator_bulk_set_voltage(regs_bt_count, regs_bt); |
| 4932 | if (rc) { |
| 4933 | dev_err(dev, "%s: could not set voltages: %d\n", |
| 4934 | __func__, rc); |
| 4935 | goto reg_free; |
| 4936 | } |
| 4937 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4938 | return 0; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4939 | |
| 4940 | reg_free: |
| 4941 | regulator_bulk_free(regs_bt_count, regs_bt); |
| 4942 | out: |
| 4943 | regs_bt_count = 0; |
| 4944 | regs_bt = NULL; |
| 4945 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4946 | } |
| 4947 | |
| 4948 | static int bluetooth_power(int on) |
| 4949 | { |
| 4950 | int rc; |
| 4951 | const char *id = "BTPW"; |
| 4952 | |
| 4953 | int bahama_not_marimba = bahama_present(); |
| 4954 | |
| 4955 | if (bahama_not_marimba == -1) { |
| 4956 | printk(KERN_WARNING "%s: bahama_present: %d\n", |
| 4957 | __func__, bahama_not_marimba); |
| 4958 | return -ENODEV; |
| 4959 | } |
| 4960 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4961 | if (unlikely(regs_bt_count == 0)) { |
| 4962 | rc = bluetooth_regs_init(bahama_not_marimba); |
| 4963 | if (rc) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4964 | return rc; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4965 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4966 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 4967 | if (on) { |
| 4968 | rc = regulator_bulk_enable(regs_bt_count, regs_bt); |
| 4969 | if (rc) |
| 4970 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4971 | |
| 4972 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO, |
| 4973 | PMAPP_CLOCK_VOTE_ON); |
| 4974 | if (rc < 0) |
| 4975 | return -EIO; |
| 4976 | |
| 4977 | if (machine_is_msm8x55_svlte_surf() || |
| 4978 | machine_is_msm8x55_svlte_ffa()) { |
| 4979 | rc = marimba_gpio_config(1); |
| 4980 | if (rc < 0) |
| 4981 | return -EIO; |
| 4982 | } |
| 4983 | |
| 4984 | rc = (bahama_not_marimba ? bahama_bt(on) : marimba_bt(on)); |
| 4985 | if (rc < 0) |
| 4986 | return -EIO; |
| 4987 | |
| 4988 | msleep(10); |
| 4989 | |
| 4990 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO, |
| 4991 | PMAPP_CLOCK_VOTE_PIN_CTRL); |
| 4992 | if (rc < 0) |
| 4993 | return -EIO; |
| 4994 | |
| 4995 | if (machine_is_msm8x55_svlte_surf() || |
| 4996 | machine_is_msm8x55_svlte_ffa()) { |
| 4997 | rc = marimba_gpio_config(0); |
| 4998 | if (rc < 0) |
| 4999 | return -EIO; |
| 5000 | } |
| 5001 | |
| 5002 | rc = msm_gpios_enable(bt_config_power_on, |
| 5003 | ARRAY_SIZE(bt_config_power_on)); |
| 5004 | |
| 5005 | if (rc < 0) |
| 5006 | return rc; |
| 5007 | |
| 5008 | } else { |
| 5009 | rc = msm_gpios_enable(bt_config_power_off, |
| 5010 | ARRAY_SIZE(bt_config_power_off)); |
| 5011 | if (rc < 0) |
| 5012 | return rc; |
| 5013 | |
| 5014 | /* check for initial RFKILL block (power off) */ |
| 5015 | if (platform_get_drvdata(&msm_bt_power_device) == NULL) |
| 5016 | goto out; |
| 5017 | |
| 5018 | rc = (bahama_not_marimba ? bahama_bt(on) : marimba_bt(on)); |
| 5019 | if (rc < 0) |
| 5020 | return -EIO; |
| 5021 | |
| 5022 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO, |
| 5023 | PMAPP_CLOCK_VOTE_OFF); |
| 5024 | if (rc < 0) |
| 5025 | return -EIO; |
| 5026 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5027 | rc = regulator_bulk_disable(regs_bt_count, regs_bt); |
| 5028 | if (rc) |
| 5029 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5030 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5031 | } |
| 5032 | |
| 5033 | out: |
| 5034 | printk(KERN_DEBUG "Bluetooth power switch: %d\n", on); |
| 5035 | |
| 5036 | return 0; |
| 5037 | } |
| 5038 | |
| 5039 | static void __init bt_power_init(void) |
| 5040 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5041 | msm_bt_power_device.dev.platform_data = &bluetooth_power; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5042 | } |
| 5043 | #else |
| 5044 | #define bt_power_init(x) do {} while (0) |
| 5045 | #endif |
| 5046 | |
| 5047 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 5048 | .voltage_min_design = 2800, |
| 5049 | .voltage_max_design = 4300, |
| 5050 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 5051 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 5052 | }; |
| 5053 | |
| 5054 | static struct platform_device msm_batt_device = { |
| 5055 | .name = "msm-battery", |
| 5056 | .id = -1, |
| 5057 | .dev.platform_data = &msm_psy_batt_data, |
| 5058 | }; |
| 5059 | |
| 5060 | static char *msm_adc_fluid_device_names[] = { |
| 5061 | "LTC_ADC1", |
| 5062 | "LTC_ADC2", |
| 5063 | "LTC_ADC3", |
| 5064 | }; |
| 5065 | |
| 5066 | static char *msm_adc_surf_device_names[] = { |
| 5067 | "XO_ADC", |
| 5068 | }; |
| 5069 | |
| 5070 | static struct msm_adc_platform_data msm_adc_pdata; |
| 5071 | |
| 5072 | static struct platform_device msm_adc_device = { |
| 5073 | .name = "msm_adc", |
| 5074 | .id = -1, |
| 5075 | .dev = { |
| 5076 | .platform_data = &msm_adc_pdata, |
| 5077 | }, |
| 5078 | }; |
| 5079 | |
| 5080 | #ifdef CONFIG_MSM_SDIO_AL |
| 5081 | static struct msm_gpio mdm2ap_status = { |
| 5082 | GPIO_CFG(77, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5083 | "mdm2ap_status" |
| 5084 | }; |
| 5085 | |
| 5086 | |
| 5087 | static int configure_mdm2ap_status(int on) |
| 5088 | { |
| 5089 | if (on) |
| 5090 | return msm_gpios_request_enable(&mdm2ap_status, 1); |
| 5091 | else { |
| 5092 | msm_gpios_disable_free(&mdm2ap_status, 1); |
| 5093 | return 0; |
| 5094 | } |
| 5095 | } |
| 5096 | |
| 5097 | static int get_mdm2ap_status(void) |
| 5098 | { |
| 5099 | return gpio_get_value(GPIO_PIN(mdm2ap_status.gpio_cfg)); |
| 5100 | } |
| 5101 | |
| 5102 | static struct sdio_al_platform_data sdio_al_pdata = { |
| 5103 | .config_mdm2ap_status = configure_mdm2ap_status, |
| 5104 | .get_mdm2ap_status = get_mdm2ap_status, |
| 5105 | .allow_sdioc_version_major_2 = 1, |
| 5106 | .peer_sdioc_version_minor = 0x0001, |
| 5107 | .peer_sdioc_version_major = 0x0003, |
| 5108 | .peer_sdioc_boot_version_minor = 0x0001, |
| 5109 | .peer_sdioc_boot_version_major = 0x0003, |
| 5110 | }; |
| 5111 | |
| 5112 | struct platform_device msm_device_sdio_al = { |
| 5113 | .name = "msm_sdio_al", |
| 5114 | .id = -1, |
| 5115 | .dev = { |
| 5116 | .platform_data = &sdio_al_pdata, |
| 5117 | }, |
| 5118 | }; |
| 5119 | |
| 5120 | #endif /* CONFIG_MSM_SDIO_AL */ |
| 5121 | |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 5122 | static struct platform_device *devices[] __initdata = { |
Daniel Walker | 90e37c5 | 2010-05-12 14:24:15 -0700 | [diff] [blame] | 5123 | #if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5124 | &msm_device_uart2, |
| 5125 | #endif |
Justin Paupore | 637a25d | 2011-07-14 17:11:04 -0700 | [diff] [blame] | 5126 | #ifdef CONFIG_MSM_PROC_COMM_REGULATOR |
| 5127 | &msm_proccomm_regulator_dev, |
| 5128 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5129 | &asoc_msm_pcm, |
| 5130 | &asoc_msm_dai0, |
| 5131 | &asoc_msm_dai1, |
| 5132 | #if defined (CONFIG_SND_MSM_MVS_DAI_SOC) |
| 5133 | &asoc_msm_mvs, |
| 5134 | &asoc_mvs_dai0, |
| 5135 | &asoc_mvs_dai1, |
Daniel Walker | 90e37c5 | 2010-05-12 14:24:15 -0700 | [diff] [blame] | 5136 | #endif |
Niranjana Vishwanathapura | a8855e9 | 2010-10-06 13:52:10 -0700 | [diff] [blame] | 5137 | &msm_device_smd, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5138 | &msm_device_dmov, |
| 5139 | &smc91x_device, |
| 5140 | &smsc911x_device, |
| 5141 | &msm_device_nand, |
| 5142 | #ifdef CONFIG_USB_MSM_OTG_72K |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 5143 | &msm_device_otg, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5144 | #ifdef CONFIG_USB_GADGET |
| 5145 | &msm_device_gadget_peripheral, |
| 5146 | #endif |
| 5147 | #endif |
| 5148 | #ifdef CONFIG_USB_G_ANDROID |
| 5149 | &android_usb_device, |
| 5150 | #endif |
| 5151 | &qsd_device_spi, |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 5152 | |
| 5153 | #ifdef CONFIG_MSM_SSBI |
| 5154 | &msm_device_ssbi_pmic1, |
| 5155 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5156 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5157 | &msm_device_ssbi7, |
| 5158 | #endif |
| 5159 | &android_pmem_device, |
| 5160 | &msm_fb_device, |
| 5161 | &msm_migrate_pages_device, |
| 5162 | &mddi_toshiba_device, |
| 5163 | &lcdc_toshiba_panel_device, |
| 5164 | #ifdef CONFIG_MSM_ROTATOR |
| 5165 | &msm_rotator_device, |
| 5166 | #endif |
| 5167 | &lcdc_sharp_panel_device, |
| 5168 | &android_pmem_adsp_device, |
| 5169 | &android_pmem_audio_device, |
| 5170 | &msm_device_i2c, |
| 5171 | &msm_device_i2c_2, |
| 5172 | &msm_device_uart_dm1, |
| 5173 | &hs_device, |
| 5174 | #ifdef CONFIG_MSM7KV2_AUDIO |
| 5175 | &msm_aictl_device, |
| 5176 | &msm_mi2s_device, |
| 5177 | &msm_lpa_device, |
| 5178 | &msm_aux_pcm_device, |
| 5179 | #endif |
| 5180 | &msm_device_adspdec, |
| 5181 | &qup_device_i2c, |
| 5182 | #if defined(CONFIG_MARIMBA_CORE) && \ |
| 5183 | (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE)) |
| 5184 | &msm_bt_power_device, |
| 5185 | #endif |
| 5186 | &msm_kgsl_3d0, |
| 5187 | &msm_kgsl_2d0, |
| 5188 | #ifdef CONFIG_MT9T013 |
| 5189 | &msm_camera_sensor_mt9t013, |
| 5190 | #endif |
| 5191 | #ifdef CONFIG_MT9D112 |
| 5192 | &msm_camera_sensor_mt9d112, |
| 5193 | #endif |
| 5194 | #ifdef CONFIG_WEBCAM_OV9726 |
| 5195 | &msm_camera_sensor_ov9726, |
| 5196 | #endif |
| 5197 | #ifdef CONFIG_S5K3E2FX |
| 5198 | &msm_camera_sensor_s5k3e2fx, |
| 5199 | #endif |
| 5200 | #ifdef CONFIG_MT9P012 |
| 5201 | &msm_camera_sensor_mt9p012, |
| 5202 | #endif |
| 5203 | #ifdef CONFIG_MT9E013 |
| 5204 | &msm_camera_sensor_mt9e013, |
| 5205 | #endif |
| 5206 | #ifdef CONFIG_VX6953 |
| 5207 | &msm_camera_sensor_vx6953, |
| 5208 | #endif |
| 5209 | #ifdef CONFIG_SN12M0PZ |
| 5210 | &msm_camera_sensor_sn12m0pz, |
| 5211 | #endif |
| 5212 | &msm_device_vidc_720p, |
| 5213 | #ifdef CONFIG_MSM_GEMINI |
| 5214 | &msm_gemini_device, |
| 5215 | #endif |
| 5216 | #ifdef CONFIG_MSM_VPE |
| 5217 | &msm_vpe_device, |
| 5218 | #endif |
| 5219 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) |
| 5220 | &msm_device_tsif, |
| 5221 | #endif |
| 5222 | #ifdef CONFIG_MSM_SDIO_AL |
| 5223 | &msm_device_sdio_al, |
| 5224 | #endif |
| 5225 | |
| 5226 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 5227 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 5228 | &qcrypto_device, |
| 5229 | #endif |
| 5230 | |
| 5231 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 5232 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 5233 | &qcedev_device, |
| 5234 | #endif |
| 5235 | |
| 5236 | &msm_batt_device, |
| 5237 | &msm_adc_device, |
| 5238 | &msm_ebi0_thermal, |
Laxminath Kasam | 1d8255d | 2012-02-15 13:10:19 +0530 | [diff] [blame^] | 5239 | &msm_ebi1_thermal, |
| 5240 | &msm_adsp_device |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5241 | }; |
| 5242 | |
| 5243 | static struct msm_gpio msm_i2c_gpios_hw[] = { |
| 5244 | { GPIO_CFG(70, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_scl" }, |
| 5245 | { GPIO_CFG(71, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_sda" }, |
| 5246 | }; |
| 5247 | |
| 5248 | static struct msm_gpio msm_i2c_gpios_io[] = { |
| 5249 | { GPIO_CFG(70, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_scl" }, |
| 5250 | { GPIO_CFG(71, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_sda" }, |
| 5251 | }; |
| 5252 | |
| 5253 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 5254 | { GPIO_CFG(16, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_scl" }, |
| 5255 | { GPIO_CFG(17, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_sda" }, |
| 5256 | }; |
| 5257 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 5258 | { GPIO_CFG(16, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_scl" }, |
| 5259 | { GPIO_CFG(17, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_sda" }, |
| 5260 | }; |
| 5261 | |
| 5262 | static void |
| 5263 | msm_i2c_gpio_config(int adap_id, int config_type) |
| 5264 | { |
| 5265 | struct msm_gpio *msm_i2c_table; |
| 5266 | |
| 5267 | /* Each adapter gets 2 lines from the table */ |
| 5268 | if (adap_id > 0) |
| 5269 | return; |
| 5270 | if (config_type) |
| 5271 | msm_i2c_table = &msm_i2c_gpios_hw[adap_id*2]; |
| 5272 | else |
| 5273 | msm_i2c_table = &msm_i2c_gpios_io[adap_id*2]; |
| 5274 | msm_gpios_enable(msm_i2c_table, 2); |
| 5275 | } |
| 5276 | /*This needs to be enabled only for OEMS*/ |
| 5277 | #ifndef CONFIG_QUP_EXCLUSIVE_TO_CAMERA |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5278 | static struct regulator *qup_vreg; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5279 | #endif |
| 5280 | static void |
| 5281 | qup_i2c_gpio_config(int adap_id, int config_type) |
| 5282 | { |
| 5283 | int rc = 0; |
| 5284 | struct msm_gpio *qup_i2c_table; |
| 5285 | /* Each adapter gets 2 lines from the table */ |
| 5286 | if (adap_id != 4) |
| 5287 | return; |
| 5288 | if (config_type) |
| 5289 | qup_i2c_table = qup_i2c_gpios_hw; |
| 5290 | else |
| 5291 | qup_i2c_table = qup_i2c_gpios_io; |
| 5292 | rc = msm_gpios_enable(qup_i2c_table, 2); |
| 5293 | if (rc < 0) |
| 5294 | printk(KERN_ERR "QUP GPIO enable failed: %d\n", rc); |
| 5295 | /*This needs to be enabled only for OEMS*/ |
| 5296 | #ifndef CONFIG_QUP_EXCLUSIVE_TO_CAMERA |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5297 | if (!IS_ERR_OR_NULL(qup_vreg)) { |
| 5298 | rc = regulator_enable(qup_vreg); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5299 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5300 | pr_err("%s: regulator_enable failed: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5301 | __func__, rc); |
| 5302 | } |
| 5303 | } |
| 5304 | #endif |
| 5305 | } |
| 5306 | |
| 5307 | static struct msm_i2c_platform_data msm_i2c_pdata = { |
| 5308 | .clk_freq = 100000, |
| 5309 | .pri_clk = 70, |
| 5310 | .pri_dat = 71, |
| 5311 | .rmutex = 1, |
| 5312 | .rsl_id = "D:I2C02000021", |
| 5313 | .msm_i2c_config_gpio = msm_i2c_gpio_config, |
| 5314 | }; |
| 5315 | |
| 5316 | static void __init msm_device_i2c_init(void) |
| 5317 | { |
| 5318 | if (msm_gpios_request(msm_i2c_gpios_hw, ARRAY_SIZE(msm_i2c_gpios_hw))) |
| 5319 | pr_err("failed to request I2C gpios\n"); |
| 5320 | |
| 5321 | msm_device_i2c.dev.platform_data = &msm_i2c_pdata; |
| 5322 | } |
| 5323 | |
| 5324 | static struct msm_i2c_platform_data msm_i2c_2_pdata = { |
| 5325 | .clk_freq = 100000, |
| 5326 | .rmutex = 1, |
| 5327 | .rsl_id = "D:I2C02000022", |
| 5328 | .msm_i2c_config_gpio = msm_i2c_gpio_config, |
| 5329 | }; |
| 5330 | |
| 5331 | static void __init msm_device_i2c_2_init(void) |
| 5332 | { |
| 5333 | msm_device_i2c_2.dev.platform_data = &msm_i2c_2_pdata; |
| 5334 | } |
| 5335 | |
| 5336 | static struct msm_i2c_platform_data qup_i2c_pdata = { |
| 5337 | .clk_freq = 384000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5338 | .msm_i2c_config_gpio = qup_i2c_gpio_config, |
| 5339 | }; |
| 5340 | |
| 5341 | static void __init qup_device_i2c_init(void) |
| 5342 | { |
| 5343 | if (msm_gpios_request(qup_i2c_gpios_hw, ARRAY_SIZE(qup_i2c_gpios_hw))) |
| 5344 | pr_err("failed to request I2C gpios\n"); |
| 5345 | |
| 5346 | qup_device_i2c.dev.platform_data = &qup_i2c_pdata; |
| 5347 | /*This needs to be enabled only for OEMS*/ |
| 5348 | #ifndef CONFIG_QUP_EXCLUSIVE_TO_CAMERA |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5349 | qup_vreg = regulator_get(&qup_device_i2c.dev, "lvsw1"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5350 | if (IS_ERR(qup_vreg)) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5351 | dev_err(&qup_device_i2c.dev, |
| 5352 | "%s: regulator_get failed: %ld\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5353 | __func__, PTR_ERR(qup_vreg)); |
| 5354 | } |
| 5355 | #endif |
| 5356 | } |
| 5357 | |
| 5358 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5359 | static struct msm_i2c_ssbi_platform_data msm_i2c_ssbi7_pdata = { |
| 5360 | .rsl_id = "D:CODEC_SSBI", |
| 5361 | .controller_type = MSM_SBI_CTRL_SSBI, |
| 5362 | }; |
| 5363 | #endif |
| 5364 | |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 5365 | static void __init msm7x30_init_irq(void) |
| 5366 | { |
| 5367 | msm_init_irq(); |
| 5368 | } |
| 5369 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5370 | static struct msm_gpio msm_nand_ebi2_cfg_data[] = { |
| 5371 | {GPIO_CFG(86, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "ebi2_cs1"}, |
| 5372 | {GPIO_CFG(115, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "ebi2_busy1"}, |
| 5373 | }; |
| 5374 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5375 | #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ |
| 5376 | || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\ |
| 5377 | || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\ |
| 5378 | || defined(CONFIG_MMC_MSM_SDC4_SUPPORT)) |
| 5379 | |
| 5380 | struct sdcc_gpio { |
| 5381 | struct msm_gpio *cfg_data; |
| 5382 | uint32_t size; |
| 5383 | struct msm_gpio *sleep_cfg_data; |
| 5384 | }; |
| 5385 | #if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) |
| 5386 | static struct msm_gpio sdc1_lvlshft_cfg_data[] = { |
| 5387 | {GPIO_CFG(35, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_16MA), "sdc1_lvlshft"}, |
| 5388 | }; |
| 5389 | #endif |
| 5390 | static struct msm_gpio sdc1_cfg_data[] = { |
| 5391 | {GPIO_CFG(38, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc1_clk"}, |
| 5392 | {GPIO_CFG(39, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_cmd"}, |
| 5393 | {GPIO_CFG(40, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_3"}, |
| 5394 | {GPIO_CFG(41, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_2"}, |
| 5395 | {GPIO_CFG(42, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_1"}, |
| 5396 | {GPIO_CFG(43, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_0"}, |
| 5397 | }; |
| 5398 | |
| 5399 | static struct msm_gpio sdc2_cfg_data[] = { |
| 5400 | {GPIO_CFG(64, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc2_clk"}, |
| 5401 | {GPIO_CFG(65, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_cmd"}, |
| 5402 | {GPIO_CFG(66, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_3"}, |
| 5403 | {GPIO_CFG(67, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_2"}, |
| 5404 | {GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_1"}, |
| 5405 | {GPIO_CFG(69, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_0"}, |
| 5406 | |
| 5407 | #ifdef CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT |
| 5408 | {GPIO_CFG(115, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_4"}, |
| 5409 | {GPIO_CFG(114, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_5"}, |
| 5410 | {GPIO_CFG(113, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_6"}, |
| 5411 | {GPIO_CFG(112, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_7"}, |
| 5412 | #endif |
| 5413 | }; |
| 5414 | |
| 5415 | static struct msm_gpio sdc3_cfg_data[] = { |
| 5416 | {GPIO_CFG(110, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc3_clk"}, |
| 5417 | {GPIO_CFG(111, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_cmd"}, |
| 5418 | {GPIO_CFG(116, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_3"}, |
| 5419 | {GPIO_CFG(117, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_2"}, |
| 5420 | {GPIO_CFG(118, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_1"}, |
| 5421 | {GPIO_CFG(119, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_0"}, |
| 5422 | }; |
| 5423 | |
| 5424 | static struct msm_gpio sdc3_sleep_cfg_data[] = { |
| 5425 | {GPIO_CFG(110, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5426 | "sdc3_clk"}, |
| 5427 | {GPIO_CFG(111, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5428 | "sdc3_cmd"}, |
| 5429 | {GPIO_CFG(116, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5430 | "sdc3_dat_3"}, |
| 5431 | {GPIO_CFG(117, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5432 | "sdc3_dat_2"}, |
| 5433 | {GPIO_CFG(118, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5434 | "sdc3_dat_1"}, |
| 5435 | {GPIO_CFG(119, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 5436 | "sdc3_dat_0"}, |
| 5437 | }; |
| 5438 | |
| 5439 | static struct msm_gpio sdc4_cfg_data[] = { |
| 5440 | {GPIO_CFG(58, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc4_clk"}, |
| 5441 | {GPIO_CFG(59, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_cmd"}, |
| 5442 | {GPIO_CFG(60, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_3"}, |
| 5443 | {GPIO_CFG(61, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_2"}, |
| 5444 | {GPIO_CFG(62, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_1"}, |
| 5445 | {GPIO_CFG(63, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_0"}, |
| 5446 | }; |
| 5447 | |
| 5448 | static struct sdcc_gpio sdcc_cfg_data[] = { |
| 5449 | { |
| 5450 | .cfg_data = sdc1_cfg_data, |
| 5451 | .size = ARRAY_SIZE(sdc1_cfg_data), |
| 5452 | .sleep_cfg_data = NULL, |
| 5453 | }, |
| 5454 | { |
| 5455 | .cfg_data = sdc2_cfg_data, |
| 5456 | .size = ARRAY_SIZE(sdc2_cfg_data), |
| 5457 | .sleep_cfg_data = NULL, |
| 5458 | }, |
| 5459 | { |
| 5460 | .cfg_data = sdc3_cfg_data, |
| 5461 | .size = ARRAY_SIZE(sdc3_cfg_data), |
| 5462 | .sleep_cfg_data = sdc3_sleep_cfg_data, |
| 5463 | }, |
| 5464 | { |
| 5465 | .cfg_data = sdc4_cfg_data, |
| 5466 | .size = ARRAY_SIZE(sdc4_cfg_data), |
| 5467 | .sleep_cfg_data = NULL, |
| 5468 | }, |
| 5469 | }; |
| 5470 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5471 | static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5472 | |
| 5473 | static unsigned long vreg_sts, gpio_sts; |
| 5474 | |
| 5475 | static uint32_t msm_sdcc_setup_gpio(int dev_id, unsigned int enable) |
| 5476 | { |
| 5477 | int rc = 0; |
| 5478 | struct sdcc_gpio *curr; |
| 5479 | |
| 5480 | curr = &sdcc_cfg_data[dev_id - 1]; |
| 5481 | |
| 5482 | if (!(test_bit(dev_id, &gpio_sts)^enable)) |
| 5483 | return rc; |
| 5484 | |
| 5485 | if (enable) { |
| 5486 | set_bit(dev_id, &gpio_sts); |
| 5487 | rc = msm_gpios_request_enable(curr->cfg_data, curr->size); |
| 5488 | if (rc) |
| 5489 | printk(KERN_ERR "%s: Failed to turn on GPIOs for slot %d\n", |
| 5490 | __func__, dev_id); |
| 5491 | } else { |
| 5492 | clear_bit(dev_id, &gpio_sts); |
| 5493 | if (curr->sleep_cfg_data) { |
| 5494 | msm_gpios_enable(curr->sleep_cfg_data, curr->size); |
| 5495 | msm_gpios_free(curr->sleep_cfg_data, curr->size); |
| 5496 | } else { |
| 5497 | msm_gpios_disable_free(curr->cfg_data, curr->size); |
| 5498 | } |
| 5499 | } |
| 5500 | |
| 5501 | return rc; |
| 5502 | } |
| 5503 | |
| 5504 | static uint32_t msm_sdcc_setup_vreg(int dev_id, unsigned int enable) |
| 5505 | { |
| 5506 | int rc = 0; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5507 | struct regulator *curr = sdcc_vreg_data[dev_id - 1]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5508 | static int enabled_once[] = {0, 0, 0, 0}; |
| 5509 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5510 | if (test_bit(dev_id, &vreg_sts) == enable) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5511 | return rc; |
| 5512 | |
Asutosh Das | 853bbcd | 2012-02-01 10:40:05 +0530 | [diff] [blame] | 5513 | if (dev_id == 4) { |
| 5514 | if (enable) { |
| 5515 | pr_debug("Enable Vdd dev_%d\n", dev_id); |
| 5516 | gpio_set_value_cansleep( |
| 5517 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_PWR_EN_N), |
| 5518 | 0); |
| 5519 | set_bit(dev_id, &vreg_sts); |
| 5520 | } else { |
| 5521 | pr_debug("Disable Vdd dev_%d\n", dev_id); |
| 5522 | gpio_set_value_cansleep( |
| 5523 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_PWR_EN_N), |
| 5524 | 1); |
| 5525 | clear_bit(dev_id, &vreg_sts); |
| 5526 | } |
| 5527 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5528 | |
Asutosh Das | 853bbcd | 2012-02-01 10:40:05 +0530 | [diff] [blame] | 5529 | if (!enable || enabled_once[dev_id - 1]) |
| 5530 | return 0; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5531 | if (!curr) |
| 5532 | return -ENODEV; |
| 5533 | |
| 5534 | if (IS_ERR(curr)) |
| 5535 | return PTR_ERR(curr); |
| 5536 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5537 | if (enable) { |
| 5538 | set_bit(dev_id, &vreg_sts); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5539 | |
| 5540 | rc = regulator_enable(curr); |
| 5541 | if (rc) |
| 5542 | pr_err("%s: could not enable regulator: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5543 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5544 | enabled_once[dev_id - 1] = 1; |
| 5545 | } else { |
| 5546 | clear_bit(dev_id, &vreg_sts); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5547 | |
| 5548 | rc = regulator_disable(curr); |
| 5549 | if (rc) |
| 5550 | pr_err("%s: could not disable regulator: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5551 | __func__, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5552 | } |
| 5553 | return rc; |
| 5554 | } |
| 5555 | |
| 5556 | static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd) |
| 5557 | { |
| 5558 | int rc = 0; |
| 5559 | struct platform_device *pdev; |
| 5560 | |
| 5561 | pdev = container_of(dv, struct platform_device, dev); |
| 5562 | rc = msm_sdcc_setup_gpio(pdev->id, (vdd ? 1 : 0)); |
| 5563 | if (rc) |
| 5564 | goto out; |
| 5565 | |
| 5566 | if (pdev->id == 4) /* S3 is always ON and cannot be disabled */ |
| 5567 | rc = msm_sdcc_setup_vreg(pdev->id, (vdd ? 1 : 0)); |
| 5568 | out: |
| 5569 | return rc; |
| 5570 | } |
| 5571 | |
| 5572 | #if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) && \ |
| 5573 | defined(CONFIG_CSDIO_VENDOR_ID) && \ |
| 5574 | defined(CONFIG_CSDIO_DEVICE_ID) && \ |
| 5575 | (CONFIG_CSDIO_VENDOR_ID == 0x70 && CONFIG_CSDIO_DEVICE_ID == 0x1117) |
| 5576 | |
| 5577 | #define MBP_ON 1 |
| 5578 | #define MBP_OFF 0 |
| 5579 | |
| 5580 | #define MBP_RESET_N \ |
| 5581 | GPIO_CFG(44, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA) |
| 5582 | #define MBP_INT0 \ |
| 5583 | GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA) |
| 5584 | |
| 5585 | #define MBP_MODE_CTRL_0 \ |
| 5586 | GPIO_CFG(35, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA) |
| 5587 | #define MBP_MODE_CTRL_1 \ |
| 5588 | GPIO_CFG(36, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA) |
| 5589 | #define MBP_MODE_CTRL_2 \ |
| 5590 | GPIO_CFG(34, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA) |
| 5591 | #define TSIF_EN \ |
| 5592 | GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 5593 | #define TSIF_DATA \ |
| 5594 | GPIO_CFG(36, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 5595 | #define TSIF_CLK \ |
| 5596 | GPIO_CFG(34, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 5597 | |
| 5598 | static struct msm_gpio mbp_cfg_data[] = { |
| 5599 | {GPIO_CFG(44, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), |
| 5600 | "mbp_reset"}, |
| 5601 | {GPIO_CFG(85, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), |
| 5602 | "mbp_io_voltage"}, |
| 5603 | }; |
| 5604 | |
| 5605 | static int mbp_config_gpios_pre_init(int enable) |
| 5606 | { |
| 5607 | int rc = 0; |
| 5608 | |
| 5609 | if (enable) { |
| 5610 | rc = msm_gpios_request_enable(mbp_cfg_data, |
| 5611 | ARRAY_SIZE(mbp_cfg_data)); |
| 5612 | if (rc) { |
| 5613 | printk(KERN_ERR |
| 5614 | "%s: Failed to turnon GPIOs for mbp chip(%d)\n", |
| 5615 | __func__, rc); |
| 5616 | } |
| 5617 | } else |
| 5618 | msm_gpios_disable_free(mbp_cfg_data, ARRAY_SIZE(mbp_cfg_data)); |
| 5619 | return rc; |
| 5620 | } |
| 5621 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5622 | static struct regulator_bulk_data mbp_regs_io[2]; |
| 5623 | static struct regulator_bulk_data mbp_regs_rf[2]; |
| 5624 | static struct regulator_bulk_data mbp_regs_adc[1]; |
| 5625 | static struct regulator_bulk_data mbp_regs_core[1]; |
| 5626 | |
| 5627 | static int mbp_init_regs(struct device *dev) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5628 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5629 | struct regulator_bulk_data regs[] = { |
| 5630 | /* Analog and I/O regs */ |
| 5631 | { .supply = "gp4", .min_uV = 2600000, .max_uV = 2600000 }, |
| 5632 | { .supply = "s3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 5633 | /* RF regs */ |
| 5634 | { .supply = "s2", .min_uV = 1300000, .max_uV = 1300000 }, |
| 5635 | { .supply = "rf", .min_uV = 2600000, .max_uV = 2600000 }, |
| 5636 | /* ADC regs */ |
| 5637 | { .supply = "s4", .min_uV = 2200000, .max_uV = 2200000 }, |
| 5638 | /* Core regs */ |
| 5639 | { .supply = "gp16", .min_uV = 1200000, .max_uV = 1200000 }, |
| 5640 | }; |
| 5641 | |
| 5642 | struct regulator_bulk_data *regptr = regs; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5643 | int rc; |
| 5644 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5645 | rc = regulator_bulk_get(dev, ARRAY_SIZE(regs), regs); |
| 5646 | |
| 5647 | if (rc) { |
| 5648 | dev_err(dev, "%s: could not get regulators: %d\n", |
| 5649 | __func__, rc); |
| 5650 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5651 | } |
| 5652 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5653 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs), regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5654 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5655 | if (rc) { |
| 5656 | dev_err(dev, "%s: could not set voltages: %d\n", |
| 5657 | __func__, rc); |
| 5658 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5659 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5660 | |
| 5661 | memcpy(mbp_regs_io, regptr, sizeof(mbp_regs_io)); |
| 5662 | regptr += ARRAY_SIZE(mbp_regs_io); |
| 5663 | |
| 5664 | memcpy(mbp_regs_rf, regptr, sizeof(mbp_regs_rf)); |
| 5665 | regptr += ARRAY_SIZE(mbp_regs_rf); |
| 5666 | |
| 5667 | memcpy(mbp_regs_adc, regptr, sizeof(mbp_regs_adc)); |
| 5668 | regptr += ARRAY_SIZE(mbp_regs_adc); |
| 5669 | |
| 5670 | memcpy(mbp_regs_core, regptr, sizeof(mbp_regs_core)); |
| 5671 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5672 | return 0; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5673 | |
| 5674 | reg_free: |
| 5675 | regulator_bulk_free(ARRAY_SIZE(regs), regs); |
| 5676 | out: |
| 5677 | return rc; |
| 5678 | } |
| 5679 | |
| 5680 | static int mbp_setup_rf_vregs(int state) |
| 5681 | { |
| 5682 | return state ? |
| 5683 | regulator_bulk_enable(ARRAY_SIZE(mbp_regs_rf), mbp_regs_rf) : |
| 5684 | regulator_bulk_disable(ARRAY_SIZE(mbp_regs_rf), mbp_regs_rf); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5685 | } |
| 5686 | |
| 5687 | static int mbp_setup_vregs(int state) |
| 5688 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5689 | return state ? |
| 5690 | regulator_bulk_enable(ARRAY_SIZE(mbp_regs_io), mbp_regs_io) : |
| 5691 | regulator_bulk_disable(ARRAY_SIZE(mbp_regs_io), mbp_regs_io); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5692 | } |
| 5693 | |
| 5694 | static int mbp_set_tcxo_en(int enable) |
| 5695 | { |
| 5696 | int rc; |
| 5697 | const char *id = "UBMC"; |
| 5698 | struct vreg *vreg_analog = NULL; |
| 5699 | |
| 5700 | rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_A1, |
| 5701 | enable ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF); |
| 5702 | if (rc < 0) { |
| 5703 | printk(KERN_ERR "%s: unable to %svote for a1 clk\n", |
| 5704 | __func__, enable ? "" : "de-"); |
| 5705 | return -EIO; |
| 5706 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5707 | return rc; |
| 5708 | } |
| 5709 | |
| 5710 | static void mbp_set_freeze_io(int state) |
| 5711 | { |
| 5712 | if (state) |
| 5713 | gpio_set_value(85, 0); |
| 5714 | else |
| 5715 | gpio_set_value(85, 1); |
| 5716 | } |
| 5717 | |
| 5718 | static int mbp_set_core_voltage_en(int enable) |
| 5719 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5720 | static bool is_enabled; |
| 5721 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5722 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5723 | if (enable && !is_enabled) { |
| 5724 | rc = regulator_bulk_enable(ARRAY_SIZE(mbp_regs_core), |
| 5725 | mbp_regs_core); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5726 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5727 | pr_err("%s: could not enable regulators: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5728 | __func__, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5729 | } else { |
| 5730 | is_enabled = true; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5731 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5732 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5733 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5734 | return rc; |
| 5735 | } |
| 5736 | |
| 5737 | static void mbp_set_reset(int state) |
| 5738 | { |
| 5739 | if (state) |
| 5740 | gpio_set_value(GPIO_PIN(MBP_RESET_N), 0); |
| 5741 | else |
| 5742 | gpio_set_value(GPIO_PIN(MBP_RESET_N), 1); |
| 5743 | } |
| 5744 | |
| 5745 | static int mbp_config_interface_mode(int state) |
| 5746 | { |
| 5747 | if (state) { |
| 5748 | gpio_tlmm_config(MBP_MODE_CTRL_0, GPIO_CFG_ENABLE); |
| 5749 | gpio_tlmm_config(MBP_MODE_CTRL_1, GPIO_CFG_ENABLE); |
| 5750 | gpio_tlmm_config(MBP_MODE_CTRL_2, GPIO_CFG_ENABLE); |
| 5751 | gpio_set_value(GPIO_PIN(MBP_MODE_CTRL_0), 0); |
| 5752 | gpio_set_value(GPIO_PIN(MBP_MODE_CTRL_1), 1); |
| 5753 | gpio_set_value(GPIO_PIN(MBP_MODE_CTRL_2), 0); |
| 5754 | } else { |
| 5755 | gpio_tlmm_config(MBP_MODE_CTRL_0, GPIO_CFG_DISABLE); |
| 5756 | gpio_tlmm_config(MBP_MODE_CTRL_1, GPIO_CFG_DISABLE); |
| 5757 | gpio_tlmm_config(MBP_MODE_CTRL_2, GPIO_CFG_DISABLE); |
| 5758 | } |
| 5759 | return 0; |
| 5760 | } |
| 5761 | |
| 5762 | static int mbp_setup_adc_vregs(int state) |
| 5763 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5764 | return state ? |
| 5765 | regulator_bulk_enable(ARRAY_SIZE(mbp_regs_adc), mbp_regs_adc) : |
| 5766 | regulator_bulk_disable(ARRAY_SIZE(mbp_regs_adc), mbp_regs_adc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5767 | } |
| 5768 | |
| 5769 | static int mbp_power_up(void) |
| 5770 | { |
| 5771 | int rc; |
| 5772 | |
| 5773 | rc = mbp_config_gpios_pre_init(MBP_ON); |
| 5774 | if (rc) |
| 5775 | goto exit; |
| 5776 | pr_debug("%s: mbp_config_gpios_pre_init() done\n", __func__); |
| 5777 | |
| 5778 | rc = mbp_setup_vregs(MBP_ON); |
| 5779 | if (rc) |
| 5780 | goto exit; |
| 5781 | pr_debug("%s: gp4 (2.6) and s3 (1.8) done\n", __func__); |
| 5782 | |
| 5783 | rc = mbp_set_tcxo_en(MBP_ON); |
| 5784 | if (rc) |
| 5785 | goto exit; |
| 5786 | pr_debug("%s: tcxo clock done\n", __func__); |
| 5787 | |
| 5788 | mbp_set_freeze_io(MBP_OFF); |
| 5789 | pr_debug("%s: set gpio 85 to 1 done\n", __func__); |
| 5790 | |
| 5791 | udelay(100); |
| 5792 | mbp_set_reset(MBP_ON); |
| 5793 | |
| 5794 | udelay(300); |
| 5795 | rc = mbp_config_interface_mode(MBP_ON); |
| 5796 | if (rc) |
| 5797 | goto exit; |
| 5798 | pr_debug("%s: mbp_config_interface_mode() done\n", __func__); |
| 5799 | |
| 5800 | udelay(100 + mbp_set_core_voltage_en(MBP_ON)); |
| 5801 | pr_debug("%s: power gp16 1.2V done\n", __func__); |
| 5802 | |
| 5803 | mbp_set_freeze_io(MBP_ON); |
| 5804 | pr_debug("%s: set gpio 85 to 0 done\n", __func__); |
| 5805 | |
| 5806 | udelay(100); |
| 5807 | |
| 5808 | rc = mbp_setup_rf_vregs(MBP_ON); |
| 5809 | if (rc) |
| 5810 | goto exit; |
| 5811 | pr_debug("%s: s2 1.3V and rf 2.6V done\n", __func__); |
| 5812 | |
| 5813 | rc = mbp_setup_adc_vregs(MBP_ON); |
| 5814 | if (rc) |
| 5815 | goto exit; |
| 5816 | pr_debug("%s: s4 2.2V done\n", __func__); |
| 5817 | |
| 5818 | udelay(200); |
| 5819 | |
| 5820 | mbp_set_reset(MBP_OFF); |
| 5821 | pr_debug("%s: close gpio 44 done\n", __func__); |
| 5822 | |
| 5823 | msleep(20); |
| 5824 | exit: |
| 5825 | return rc; |
| 5826 | } |
| 5827 | |
| 5828 | static int mbp_power_down(void) |
| 5829 | { |
| 5830 | int rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5831 | |
| 5832 | mbp_set_reset(MBP_ON); |
| 5833 | pr_debug("%s: mbp_set_reset(MBP_ON) done\n", __func__); |
| 5834 | |
| 5835 | udelay(100); |
| 5836 | |
| 5837 | rc = mbp_setup_adc_vregs(MBP_OFF); |
| 5838 | if (rc) |
| 5839 | goto exit; |
| 5840 | pr_debug("%s: vreg_disable(vreg_adc) done\n", __func__); |
| 5841 | |
| 5842 | udelay(5); |
| 5843 | |
| 5844 | rc = mbp_setup_rf_vregs(MBP_OFF); |
| 5845 | if (rc) |
| 5846 | goto exit; |
| 5847 | pr_debug("%s: mbp_setup_rf_vregs(MBP_OFF) done\n", __func__); |
| 5848 | |
| 5849 | udelay(5); |
| 5850 | |
| 5851 | mbp_set_freeze_io(MBP_OFF); |
| 5852 | pr_debug("%s: mbp_set_freeze_io(MBP_OFF) done\n", __func__); |
| 5853 | |
| 5854 | udelay(100); |
| 5855 | rc = mbp_set_core_voltage_en(MBP_OFF); |
| 5856 | if (rc) |
| 5857 | goto exit; |
| 5858 | pr_debug("%s: mbp_set_core_voltage_en(MBP_OFF) done\n", __func__); |
| 5859 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5860 | rc = mbp_set_tcxo_en(MBP_OFF); |
| 5861 | if (rc) |
| 5862 | goto exit; |
| 5863 | pr_debug("%s: mbp_set_tcxo_en(MBP_OFF) done\n", __func__); |
| 5864 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5865 | rc = mbp_setup_vregs(MBP_OFF); |
| 5866 | if (rc) |
| 5867 | goto exit; |
| 5868 | pr_debug("%s: mbp_setup_vregs(MBP_OFF) done\n", __func__); |
| 5869 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5870 | rc = mbp_config_gpios_pre_init(MBP_OFF); |
| 5871 | if (rc) |
| 5872 | goto exit; |
| 5873 | exit: |
| 5874 | return rc; |
| 5875 | } |
| 5876 | |
| 5877 | static void (*mbp_status_notify_cb)(int card_present, void *dev_id); |
| 5878 | static void *mbp_status_notify_cb_devid; |
| 5879 | static int mbp_power_status; |
| 5880 | static int mbp_power_init_done; |
| 5881 | |
| 5882 | static uint32_t mbp_setup_power(struct device *dv, |
| 5883 | unsigned int power_status) |
| 5884 | { |
| 5885 | int rc = 0; |
| 5886 | struct platform_device *pdev; |
| 5887 | |
| 5888 | pdev = container_of(dv, struct platform_device, dev); |
| 5889 | |
| 5890 | if (power_status == mbp_power_status) |
| 5891 | goto exit; |
| 5892 | if (power_status) { |
| 5893 | pr_debug("turn on power of mbp slot"); |
| 5894 | rc = mbp_power_up(); |
| 5895 | mbp_power_status = 1; |
| 5896 | } else { |
| 5897 | pr_debug("turn off power of mbp slot"); |
| 5898 | rc = mbp_power_down(); |
| 5899 | mbp_power_status = 0; |
| 5900 | } |
| 5901 | exit: |
| 5902 | return rc; |
| 5903 | }; |
| 5904 | |
| 5905 | int mbp_register_status_notify(void (*callback)(int, void *), |
| 5906 | void *dev_id) |
| 5907 | { |
| 5908 | mbp_status_notify_cb = callback; |
| 5909 | mbp_status_notify_cb_devid = dev_id; |
| 5910 | return 0; |
| 5911 | } |
| 5912 | |
| 5913 | static unsigned int mbp_status(struct device *dev) |
| 5914 | { |
| 5915 | return mbp_power_status; |
| 5916 | } |
| 5917 | |
| 5918 | static uint32_t msm_sdcc_setup_power_mbp(struct device *dv, unsigned int vdd) |
| 5919 | { |
| 5920 | struct platform_device *pdev; |
| 5921 | uint32_t rc = 0; |
| 5922 | |
| 5923 | pdev = container_of(dv, struct platform_device, dev); |
| 5924 | rc = msm_sdcc_setup_power(dv, vdd); |
| 5925 | if (rc) { |
| 5926 | pr_err("%s: Failed to setup power (%d)\n", |
| 5927 | __func__, rc); |
| 5928 | goto out; |
| 5929 | } |
| 5930 | if (!mbp_power_init_done) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 5931 | rc = mbp_init_regs(dv); |
| 5932 | if (rc) { |
| 5933 | dev_err(dv, "%s: regulator init failed: %d\n", |
| 5934 | __func__, rc); |
| 5935 | goto out; |
| 5936 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5937 | mbp_setup_power(dv, 1); |
| 5938 | mbp_setup_power(dv, 0); |
| 5939 | mbp_power_init_done = 1; |
| 5940 | } |
| 5941 | if (vdd >= 0x8000) { |
| 5942 | rc = mbp_setup_power(dv, (0x8000 == vdd) ? 0 : 1); |
| 5943 | if (rc) { |
| 5944 | pr_err("%s: Failed to config mbp chip power (%d)\n", |
| 5945 | __func__, rc); |
| 5946 | goto out; |
| 5947 | } |
| 5948 | if (mbp_status_notify_cb) { |
| 5949 | mbp_status_notify_cb(mbp_power_status, |
| 5950 | mbp_status_notify_cb_devid); |
| 5951 | } |
| 5952 | } |
| 5953 | out: |
| 5954 | /* should return 0 only */ |
| 5955 | return 0; |
| 5956 | } |
| 5957 | |
| 5958 | #endif |
| 5959 | |
| 5960 | #endif |
| 5961 | |
| 5962 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 5963 | #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
| 5964 | static unsigned int msm7x30_sdcc_slot_status(struct device *dev) |
| 5965 | { |
| 5966 | return (unsigned int) |
| 5967 | gpio_get_value_cansleep( |
| 5968 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SD_DET - 1)); |
| 5969 | } |
| 5970 | #endif |
| 5971 | |
| 5972 | static int msm_sdcc_get_wpswitch(struct device *dv) |
| 5973 | { |
| 5974 | void __iomem *wp_addr = 0; |
| 5975 | uint32_t ret = 0; |
| 5976 | struct platform_device *pdev; |
| 5977 | |
| 5978 | if (!(machine_is_msm7x30_surf())) |
| 5979 | return -1; |
| 5980 | pdev = container_of(dv, struct platform_device, dev); |
| 5981 | |
| 5982 | wp_addr = ioremap(FPGA_SDCC_STATUS, 4); |
| 5983 | if (!wp_addr) { |
| 5984 | pr_err("%s: Could not remap %x\n", __func__, FPGA_SDCC_STATUS); |
| 5985 | return -ENOMEM; |
| 5986 | } |
| 5987 | |
| 5988 | ret = (((readl(wp_addr) >> 4) >> (pdev->id-1)) & 0x01); |
| 5989 | pr_info("%s: WP Status for Slot %d = 0x%x \n", __func__, |
| 5990 | pdev->id, ret); |
| 5991 | iounmap(wp_addr); |
| 5992 | |
| 5993 | return ret; |
| 5994 | } |
| 5995 | #endif |
| 5996 | |
| 5997 | #if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) |
| 5998 | #if defined(CONFIG_CSDIO_VENDOR_ID) && \ |
| 5999 | defined(CONFIG_CSDIO_DEVICE_ID) && \ |
| 6000 | (CONFIG_CSDIO_VENDOR_ID == 0x70 && CONFIG_CSDIO_DEVICE_ID == 0x1117) |
| 6001 | static struct mmc_platform_data msm7x30_sdc1_data = { |
| 6002 | .ocr_mask = MMC_VDD_165_195 | MMC_VDD_27_28 | MMC_VDD_28_29, |
| 6003 | .translate_vdd = msm_sdcc_setup_power_mbp, |
| 6004 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 6005 | .status = mbp_status, |
| 6006 | .register_status_notify = mbp_register_status_notify, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6007 | .msmsdcc_fmin = 144000, |
| 6008 | .msmsdcc_fmid = 24576000, |
| 6009 | .msmsdcc_fmax = 24576000, |
| 6010 | .nonremovable = 0, |
| 6011 | }; |
| 6012 | #else |
| 6013 | static struct mmc_platform_data msm7x30_sdc1_data = { |
| 6014 | .ocr_mask = MMC_VDD_165_195, |
| 6015 | .translate_vdd = msm_sdcc_setup_power, |
| 6016 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6017 | .msmsdcc_fmin = 144000, |
| 6018 | .msmsdcc_fmid = 24576000, |
| 6019 | .msmsdcc_fmax = 49152000, |
| 6020 | .nonremovable = 0, |
| 6021 | }; |
| 6022 | #endif |
| 6023 | #endif |
| 6024 | |
| 6025 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 6026 | static struct mmc_platform_data msm7x30_sdc2_data = { |
| 6027 | .ocr_mask = MMC_VDD_165_195 | MMC_VDD_27_28, |
| 6028 | .translate_vdd = msm_sdcc_setup_power, |
| 6029 | #ifdef CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT |
| 6030 | .mmc_bus_width = MMC_CAP_8_BIT_DATA, |
| 6031 | #else |
| 6032 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 6033 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6034 | .msmsdcc_fmin = 144000, |
| 6035 | .msmsdcc_fmid = 24576000, |
| 6036 | .msmsdcc_fmax = 49152000, |
| 6037 | .nonremovable = 1, |
| 6038 | }; |
| 6039 | #endif |
| 6040 | |
| 6041 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 6042 | static struct mmc_platform_data msm7x30_sdc3_data = { |
| 6043 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 6044 | .translate_vdd = msm_sdcc_setup_power, |
| 6045 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 6046 | #ifdef CONFIG_MMC_MSM_SDIO_SUPPORT |
| 6047 | .sdiowakeup_irq = MSM_GPIO_TO_INT(118), |
| 6048 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6049 | .msmsdcc_fmin = 144000, |
| 6050 | .msmsdcc_fmid = 24576000, |
| 6051 | .msmsdcc_fmax = 49152000, |
| 6052 | .nonremovable = 0, |
| 6053 | }; |
| 6054 | #endif |
| 6055 | |
| 6056 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 6057 | static struct mmc_platform_data msm7x30_sdc4_data = { |
| 6058 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 6059 | .translate_vdd = msm_sdcc_setup_power, |
| 6060 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 6061 | #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
| 6062 | .status = msm7x30_sdcc_slot_status, |
| 6063 | .status_irq = PM8058_GPIO_IRQ(PMIC8058_IRQ_BASE, PMIC_GPIO_SD_DET - 1), |
| 6064 | .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| 6065 | #endif |
| 6066 | .wpswitch = msm_sdcc_get_wpswitch, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6067 | .msmsdcc_fmin = 144000, |
| 6068 | .msmsdcc_fmid = 24576000, |
| 6069 | .msmsdcc_fmax = 49152000, |
| 6070 | .nonremovable = 0, |
| 6071 | }; |
| 6072 | #endif |
| 6073 | |
| 6074 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6075 | static int msm_sdc1_lvlshft_enable(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6076 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6077 | static struct regulator *ldo5; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6078 | int rc; |
| 6079 | |
| 6080 | /* Enable LDO5, an input to the FET that powers slot 1 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6081 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6082 | ldo5 = regulator_get(NULL, "ldo5"); |
| 6083 | |
| 6084 | if (IS_ERR(ldo5)) { |
| 6085 | rc = PTR_ERR(ldo5); |
| 6086 | pr_err("%s: could not get ldo5: %d\n", __func__, rc); |
| 6087 | goto out; |
| 6088 | } |
| 6089 | |
| 6090 | rc = regulator_set_voltage(ldo5, 2850000, 2850000); |
| 6091 | if (rc) { |
| 6092 | pr_err("%s: could not set ldo5 voltage: %d\n", __func__, rc); |
| 6093 | goto ldo5_free; |
| 6094 | } |
| 6095 | |
| 6096 | rc = regulator_enable(ldo5); |
| 6097 | if (rc) { |
| 6098 | pr_err("%s: could not enable ldo5: %d\n", __func__, rc); |
| 6099 | goto ldo5_free; |
| 6100 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6101 | |
| 6102 | /* Enable GPIO 35, to turn on the FET that powers slot 1 */ |
| 6103 | rc = msm_gpios_request_enable(sdc1_lvlshft_cfg_data, |
| 6104 | ARRAY_SIZE(sdc1_lvlshft_cfg_data)); |
| 6105 | if (rc) |
| 6106 | printk(KERN_ERR "%s: Failed to enable GPIO 35\n", __func__); |
| 6107 | |
| 6108 | rc = gpio_direction_output(GPIO_PIN(sdc1_lvlshft_cfg_data[0].gpio_cfg), |
| 6109 | 1); |
| 6110 | if (rc) |
| 6111 | printk(KERN_ERR "%s: Failed to turn on GPIO 35\n", __func__); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6112 | |
| 6113 | return 0; |
| 6114 | |
| 6115 | ldo5_free: |
| 6116 | regulator_put(ldo5); |
| 6117 | out: |
| 6118 | ldo5 = NULL; |
| 6119 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6120 | } |
| 6121 | #endif |
| 6122 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6123 | static int mmc_regulator_init(int sdcc_no, const char *supply, int uV) |
| 6124 | { |
| 6125 | int rc; |
| 6126 | |
| 6127 | BUG_ON(sdcc_no < 1 || sdcc_no > 4); |
| 6128 | |
| 6129 | sdcc_no--; |
| 6130 | |
| 6131 | sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply); |
| 6132 | |
| 6133 | if (IS_ERR(sdcc_vreg_data[sdcc_no])) { |
| 6134 | rc = PTR_ERR(sdcc_vreg_data[sdcc_no]); |
| 6135 | pr_err("%s: could not get regulator \"%s\": %d\n", |
| 6136 | __func__, supply, rc); |
| 6137 | goto out; |
| 6138 | } |
| 6139 | |
| 6140 | rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV); |
| 6141 | |
| 6142 | if (rc) { |
| 6143 | pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n", |
| 6144 | __func__, supply, uV, rc); |
| 6145 | goto reg_free; |
| 6146 | } |
| 6147 | |
| 6148 | return rc; |
| 6149 | |
| 6150 | reg_free: |
| 6151 | regulator_put(sdcc_vreg_data[sdcc_no]); |
| 6152 | out: |
| 6153 | sdcc_vreg_data[sdcc_no] = NULL; |
| 6154 | return rc; |
| 6155 | } |
| 6156 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6157 | static void __init msm7x30_init_mmc(void) |
| 6158 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6159 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6160 | if (mmc_regulator_init(1, "s3", 1800000)) |
| 6161 | goto out1; |
| 6162 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6163 | if (machine_is_msm7x30_fluid()) { |
| 6164 | msm7x30_sdc1_data.ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6165 | if (msm_sdc1_lvlshft_enable()) { |
| 6166 | pr_err("%s: could not enable level shift\n"); |
| 6167 | goto out1; |
| 6168 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6169 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6170 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6171 | msm_add_sdcc(1, &msm7x30_sdc1_data); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6172 | out1: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6173 | #endif |
| 6174 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6175 | if (mmc_regulator_init(2, "s3", 1800000)) |
| 6176 | goto out2; |
| 6177 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6178 | if (machine_is_msm8x55_svlte_surf()) |
| 6179 | msm7x30_sdc2_data.msmsdcc_fmax = 24576000; |
Sujith Reddy Thumma | 84a0f51 | 2011-08-29 09:57:03 +0530 | [diff] [blame] | 6180 | if (machine_is_msm8x55_svlte_surf() || |
| 6181 | machine_is_msm8x55_svlte_ffa()) { |
| 6182 | msm7x30_sdc2_data.sdiowakeup_irq = MSM_GPIO_TO_INT(68); |
| 6183 | msm7x30_sdc2_data.is_sdio_al_client = 1; |
| 6184 | } |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6185 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6186 | msm_add_sdcc(2, &msm7x30_sdc2_data); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6187 | out2: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6188 | #endif |
| 6189 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6190 | if (mmc_regulator_init(3, "s3", 1800000)) |
| 6191 | goto out3; |
| 6192 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6193 | msm_sdcc_setup_gpio(3, 1); |
| 6194 | msm_add_sdcc(3, &msm7x30_sdc3_data); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6195 | out3: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6196 | #endif |
| 6197 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6198 | if (mmc_regulator_init(4, "mmc", 2850000)) |
| 6199 | return; |
| 6200 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6201 | msm_add_sdcc(4, &msm7x30_sdc4_data); |
| 6202 | #endif |
| 6203 | |
| 6204 | } |
| 6205 | |
| 6206 | static void __init msm7x30_init_nand(void) |
| 6207 | { |
| 6208 | char *build_id; |
| 6209 | struct flash_platform_data *plat_data; |
| 6210 | |
| 6211 | build_id = socinfo_get_build_id(); |
| 6212 | if (build_id == NULL) { |
| 6213 | pr_err("%s: Build ID not available from socinfo\n", __func__); |
| 6214 | return; |
| 6215 | } |
| 6216 | |
| 6217 | if (build_id[8] == 'C' && |
| 6218 | !msm_gpios_request_enable(msm_nand_ebi2_cfg_data, |
| 6219 | ARRAY_SIZE(msm_nand_ebi2_cfg_data))) { |
| 6220 | plat_data = msm_device_nand.dev.platform_data; |
| 6221 | plat_data->interleave = 1; |
| 6222 | printk(KERN_INFO "%s: Interleave mode Build ID found\n", |
| 6223 | __func__); |
| 6224 | } |
| 6225 | } |
| 6226 | |
| 6227 | #ifdef CONFIG_SERIAL_MSM_CONSOLE |
| 6228 | static struct msm_gpio uart2_config_data[] = { |
| 6229 | { GPIO_CFG(49, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_RFR"}, |
| 6230 | { GPIO_CFG(50, 2, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_CTS"}, |
| 6231 | { GPIO_CFG(51, 2, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_Rx"}, |
| 6232 | { GPIO_CFG(52, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_Tx"}, |
| 6233 | }; |
| 6234 | |
| 6235 | static void msm7x30_init_uart2(void) |
| 6236 | { |
| 6237 | msm_gpios_request_enable(uart2_config_data, |
| 6238 | ARRAY_SIZE(uart2_config_data)); |
| 6239 | |
| 6240 | } |
| 6241 | #endif |
| 6242 | |
| 6243 | /* TSIF begin */ |
| 6244 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) |
| 6245 | |
| 6246 | #define TSIF_B_SYNC GPIO_CFG(37, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 6247 | #define TSIF_B_DATA GPIO_CFG(36, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 6248 | #define TSIF_B_EN GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 6249 | #define TSIF_B_CLK GPIO_CFG(34, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA) |
| 6250 | |
| 6251 | static const struct msm_gpio tsif_gpios[] = { |
| 6252 | { .gpio_cfg = TSIF_B_CLK, .label = "tsif_clk", }, |
| 6253 | { .gpio_cfg = TSIF_B_EN, .label = "tsif_en", }, |
| 6254 | { .gpio_cfg = TSIF_B_DATA, .label = "tsif_data", }, |
| 6255 | { .gpio_cfg = TSIF_B_SYNC, .label = "tsif_sync", }, |
| 6256 | }; |
| 6257 | |
| 6258 | static struct msm_tsif_platform_data tsif_platform_data = { |
| 6259 | .num_gpios = ARRAY_SIZE(tsif_gpios), |
| 6260 | .gpios = tsif_gpios, |
Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 6261 | .tsif_pclk = "iface_clk", |
| 6262 | .tsif_ref_clk = "ref_clk", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6263 | }; |
| 6264 | #endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */ |
| 6265 | /* TSIF end */ |
| 6266 | |
| 6267 | static void __init pmic8058_leds_init(void) |
| 6268 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6269 | if (machine_is_msm7x30_surf()) |
| 6270 | pm8058_7x30_data.leds_pdata = &pm8058_surf_leds_data; |
| 6271 | else if (!machine_is_msm7x30_fluid()) |
| 6272 | pm8058_7x30_data.leds_pdata = &pm8058_ffa_leds_data; |
| 6273 | else if (machine_is_msm7x30_fluid()) |
| 6274 | pm8058_7x30_data.leds_pdata = &pm8058_fluid_leds_data; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6275 | } |
| 6276 | |
| 6277 | static struct msm_spm_platform_data msm_spm_data __initdata = { |
| 6278 | .reg_base_addr = MSM_SAW_BASE, |
| 6279 | |
| 6280 | .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x05, |
| 6281 | .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x18, |
| 6282 | .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0x00006666, |
| 6283 | .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0xFF000666, |
| 6284 | |
| 6285 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x01, |
| 6286 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x03, |
| 6287 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00, |
| 6288 | |
| 6289 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01, |
| 6290 | .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00, |
| 6291 | .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00, |
| 6292 | |
| 6293 | .awake_vlevel = 0xF2, |
| 6294 | .retention_vlevel = 0xE0, |
| 6295 | .collapse_vlevel = 0x72, |
| 6296 | .retention_mid_vlevel = 0xE0, |
| 6297 | .collapse_mid_vlevel = 0xE0, |
| 6298 | |
| 6299 | .vctl_timeout_us = 50, |
| 6300 | }; |
| 6301 | |
| 6302 | #if defined(CONFIG_TOUCHSCREEN_TSC2007) || \ |
| 6303 | defined(CONFIG_TOUCHSCREEN_TSC2007_MODULE) |
| 6304 | |
| 6305 | #define TSC2007_TS_PEN_INT 20 |
| 6306 | |
| 6307 | static struct msm_gpio tsc2007_config_data[] = { |
| 6308 | { GPIO_CFG(TSC2007_TS_PEN_INT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 6309 | "tsc2007_irq" }, |
| 6310 | }; |
| 6311 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6312 | static struct regulator_bulk_data tsc2007_regs[] = { |
| 6313 | { .supply = "s3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 6314 | { .supply = "s2", .min_uV = 1300000, .max_uV = 1300000 }, |
| 6315 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6316 | |
| 6317 | static int tsc2007_init(void) |
| 6318 | { |
| 6319 | int rc; |
| 6320 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6321 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6322 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6323 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6324 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 6325 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6326 | } |
| 6327 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6328 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
| 6329 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6330 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6331 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 6332 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6333 | } |
| 6334 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6335 | rc = regulator_bulk_enable(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6336 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6337 | if (rc) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6338 | pr_err("%s: could not enable regulators: %d\n", __func__, rc); |
| 6339 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6340 | } |
| 6341 | |
| 6342 | rc = msm_gpios_request_enable(tsc2007_config_data, |
| 6343 | ARRAY_SIZE(tsc2007_config_data)); |
| 6344 | if (rc) { |
| 6345 | pr_err("%s: Unable to request gpios\n", __func__); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6346 | goto reg_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6347 | } |
| 6348 | |
| 6349 | return 0; |
| 6350 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6351 | reg_disable: |
| 6352 | regulator_bulk_disable(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
| 6353 | reg_free: |
| 6354 | regulator_bulk_free(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
| 6355 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6356 | return rc; |
| 6357 | } |
| 6358 | |
| 6359 | static int tsc2007_get_pendown_state(void) |
| 6360 | { |
| 6361 | int rc; |
| 6362 | |
| 6363 | rc = gpio_get_value(TSC2007_TS_PEN_INT); |
| 6364 | if (rc < 0) { |
| 6365 | pr_err("%s: MSM GPIO %d read failed\n", __func__, |
| 6366 | TSC2007_TS_PEN_INT); |
| 6367 | return rc; |
| 6368 | } |
| 6369 | |
| 6370 | return (rc == 0 ? 1 : 0); |
| 6371 | } |
| 6372 | |
| 6373 | static void tsc2007_exit(void) |
| 6374 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6375 | |
| 6376 | regulator_bulk_disable(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
| 6377 | regulator_bulk_free(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6378 | |
| 6379 | msm_gpios_disable_free(tsc2007_config_data, |
| 6380 | ARRAY_SIZE(tsc2007_config_data)); |
| 6381 | } |
| 6382 | |
| 6383 | static int tsc2007_power_shutdown(bool enable) |
| 6384 | { |
| 6385 | int rc; |
| 6386 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6387 | rc = (enable == false) ? |
| 6388 | regulator_bulk_enable(ARRAY_SIZE(tsc2007_regs), tsc2007_regs) : |
| 6389 | regulator_bulk_disable(ARRAY_SIZE(tsc2007_regs), tsc2007_regs); |
| 6390 | |
| 6391 | if (rc) { |
| 6392 | pr_err("%s: could not %sable regulators: %d\n", |
| 6393 | __func__, enable ? "dis" : "en", rc); |
| 6394 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6395 | } |
| 6396 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6397 | if (enable == false) |
| 6398 | msleep(20); |
| 6399 | |
| 6400 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6401 | } |
| 6402 | |
| 6403 | static struct tsc2007_platform_data tsc2007_ts_data = { |
| 6404 | .model = 2007, |
| 6405 | .x_plate_ohms = 300, |
Anirudh Ghayal | a2cf2e2 | 2012-01-25 12:29:42 +0530 | [diff] [blame] | 6406 | .min_x = 210, |
| 6407 | .max_x = 3832, |
| 6408 | .min_y = 150, |
| 6409 | .max_y = 3936, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6410 | .irq_flags = IRQF_TRIGGER_LOW, |
| 6411 | .init_platform_hw = tsc2007_init, |
| 6412 | .exit_platform_hw = tsc2007_exit, |
| 6413 | .power_shutdown = tsc2007_power_shutdown, |
| 6414 | .invert_x = true, |
| 6415 | .invert_y = true, |
| 6416 | /* REVISIT: Temporary fix for reversed pressure */ |
| 6417 | .invert_z1 = true, |
| 6418 | .invert_z2 = true, |
| 6419 | .get_pendown_state = tsc2007_get_pendown_state, |
| 6420 | }; |
| 6421 | |
| 6422 | static struct i2c_board_info tsc_i2c_board_info[] = { |
| 6423 | { |
| 6424 | I2C_BOARD_INFO("tsc2007", 0x48), |
| 6425 | .irq = MSM_GPIO_TO_INT(TSC2007_TS_PEN_INT), |
| 6426 | .platform_data = &tsc2007_ts_data, |
| 6427 | }, |
| 6428 | }; |
| 6429 | #endif |
| 6430 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6431 | static struct regulator_bulk_data regs_isa1200[] = { |
| 6432 | { .supply = "gp7", .min_uV = 1800000, .max_uV = 1800000 }, |
| 6433 | { .supply = "gp10", .min_uV = 2600000, .max_uV = 2600000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6434 | }; |
| 6435 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6436 | static int isa1200_power(int vreg_on) |
| 6437 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6438 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6439 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6440 | rc = vreg_on ? |
| 6441 | regulator_bulk_enable(ARRAY_SIZE(regs_isa1200), regs_isa1200) : |
| 6442 | regulator_bulk_disable(ARRAY_SIZE(regs_isa1200), regs_isa1200); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6443 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6444 | if (rc) { |
| 6445 | pr_err("%s: could not %sable regulators: %d\n", |
| 6446 | __func__, vreg_on ? "en" : "dis", rc); |
| 6447 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6448 | } |
| 6449 | |
| 6450 | /* vote for DO buffer */ |
| 6451 | rc = pmapp_clock_vote("VIBR", PMAPP_CLOCK_ID_DO, |
| 6452 | vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF); |
| 6453 | if (rc) { |
| 6454 | pr_err("%s: unable to %svote for d0 clk\n", |
| 6455 | __func__, vreg_on ? "" : "de-"); |
| 6456 | goto vreg_fail; |
| 6457 | } |
| 6458 | |
| 6459 | return 0; |
| 6460 | |
| 6461 | vreg_fail: |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6462 | if (vreg_on) |
| 6463 | regulator_bulk_disable(ARRAY_SIZE(regs_isa1200), regs_isa1200); |
| 6464 | else |
| 6465 | regulator_bulk_enable(ARRAY_SIZE(regs_isa1200), regs_isa1200); |
| 6466 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6467 | return rc; |
| 6468 | } |
| 6469 | |
| 6470 | static int isa1200_dev_setup(bool enable) |
| 6471 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6472 | int rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6473 | |
| 6474 | if (enable == true) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6475 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_isa1200), |
| 6476 | regs_isa1200); |
| 6477 | |
| 6478 | if (rc) { |
| 6479 | pr_err("%s: could not get regulators: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6480 | __func__, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6481 | goto out; |
| 6482 | } |
| 6483 | |
| 6484 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_isa1200), |
| 6485 | regs_isa1200); |
| 6486 | if (rc) { |
| 6487 | pr_err("%s: could not set voltages: %d\n", |
| 6488 | __func__, rc); |
| 6489 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6490 | } |
| 6491 | |
| 6492 | rc = gpio_tlmm_config(GPIO_CFG(HAP_LVL_SHFT_MSM_GPIO, 0, |
| 6493 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 6494 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 6495 | if (rc) { |
| 6496 | pr_err("%s: Could not configure gpio %d\n", |
| 6497 | __func__, HAP_LVL_SHFT_MSM_GPIO); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6498 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6499 | } |
| 6500 | |
| 6501 | rc = gpio_request(HAP_LVL_SHFT_MSM_GPIO, "haptics_shft_lvl_oe"); |
| 6502 | if (rc) { |
| 6503 | pr_err("%s: unable to request gpio %d (%d)\n", |
| 6504 | __func__, HAP_LVL_SHFT_MSM_GPIO, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6505 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6506 | } |
| 6507 | |
| 6508 | gpio_set_value(HAP_LVL_SHFT_MSM_GPIO, 1); |
| 6509 | } else { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6510 | regulator_bulk_free(ARRAY_SIZE(regs_isa1200), regs_isa1200); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6511 | gpio_free(HAP_LVL_SHFT_MSM_GPIO); |
| 6512 | } |
| 6513 | |
| 6514 | return 0; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6515 | |
| 6516 | reg_free: |
| 6517 | regulator_bulk_free(ARRAY_SIZE(regs_isa1200), regs_isa1200); |
| 6518 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6519 | return rc; |
| 6520 | } |
| 6521 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 6522 | .name = "vibrator", |
| 6523 | .power_on = isa1200_power, |
| 6524 | .dev_setup = isa1200_dev_setup, |
| 6525 | .pwm_ch_id = 1, /*channel id*/ |
| 6526 | /*gpio to enable haptic*/ |
| 6527 | .hap_en_gpio = PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_ENABLE), |
Mohan Pallaka | 0312232 | 2011-09-09 15:15:43 +0530 | [diff] [blame] | 6528 | .hap_len_gpio = -1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6529 | .max_timeout = 15000, |
| 6530 | .mode_ctrl = PWM_GEN_MODE, |
| 6531 | .pwm_fd = { |
| 6532 | .pwm_div = 256, |
| 6533 | }, |
| 6534 | .is_erm = false, |
| 6535 | .smart_en = true, |
| 6536 | .ext_clk_en = true, |
| 6537 | .chip_en = 1, |
| 6538 | }; |
| 6539 | |
| 6540 | static struct i2c_board_info msm_isa1200_board_info[] = { |
| 6541 | { |
| 6542 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 6543 | .platform_data = &isa1200_1_pdata, |
| 6544 | }, |
| 6545 | }; |
| 6546 | |
| 6547 | |
| 6548 | static int kp_flip_mpp_config(void) |
| 6549 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6550 | struct pm8xxx_mpp_config_data kp_flip_mpp = { |
| 6551 | .type = PM8XXX_MPP_TYPE_D_INPUT, |
| 6552 | .level = PM8018_MPP_DIG_LEVEL_S3, |
| 6553 | .control = PM8XXX_MPP_DIN_TO_INT, |
| 6554 | }; |
| 6555 | |
| 6556 | return pm8xxx_mpp_config(PM8058_MPP_PM_TO_SYS(PM_FLIP_MPP), |
| 6557 | &kp_flip_mpp); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6558 | } |
| 6559 | |
| 6560 | static struct flip_switch_pdata flip_switch_data = { |
| 6561 | .name = "kp_flip_switch", |
| 6562 | .flip_gpio = PM8058_GPIO_PM_TO_SYS(PM8058_GPIOS) + PM_FLIP_MPP, |
| 6563 | .left_key = KEY_OPEN, |
| 6564 | .right_key = KEY_CLOSE, |
| 6565 | .active_low = 0, |
| 6566 | .wakeup = 1, |
| 6567 | .flip_mpp_config = kp_flip_mpp_config, |
| 6568 | }; |
| 6569 | |
| 6570 | static struct platform_device flip_switch_device = { |
| 6571 | .name = "kp_flip_switch", |
| 6572 | .id = -1, |
| 6573 | .dev = { |
| 6574 | .platform_data = &flip_switch_data, |
| 6575 | } |
| 6576 | }; |
| 6577 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6578 | static struct regulator_bulk_data regs_tma300[] = { |
| 6579 | { .supply = "gp6", .min_uV = 3050000, .max_uV = 3100000 }, |
| 6580 | { .supply = "gp7", .min_uV = 1800000, .max_uV = 1800000 }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6581 | }; |
| 6582 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6583 | static int tma300_power(int vreg_on) |
| 6584 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6585 | int rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6586 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6587 | rc = vreg_on ? |
| 6588 | regulator_bulk_enable(ARRAY_SIZE(regs_tma300), regs_tma300) : |
| 6589 | regulator_bulk_disable(ARRAY_SIZE(regs_tma300), regs_tma300); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6590 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6591 | if (rc) |
| 6592 | pr_err("%s: could not %sable regulators: %d\n", |
| 6593 | __func__, vreg_on ? "en" : "dis", rc); |
| 6594 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6595 | } |
| 6596 | |
| 6597 | #define TS_GPIO_IRQ 150 |
| 6598 | |
| 6599 | static int tma300_dev_setup(bool enable) |
| 6600 | { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6601 | int rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6602 | |
| 6603 | if (enable) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6604 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_tma300), |
| 6605 | regs_tma300); |
| 6606 | |
| 6607 | if (rc) { |
| 6608 | pr_err("%s: could not get regulators: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6609 | __func__, rc); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6610 | goto out; |
| 6611 | } |
| 6612 | |
| 6613 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_tma300), |
| 6614 | regs_tma300); |
| 6615 | |
| 6616 | if (rc) { |
| 6617 | pr_err("%s: could not set voltages: %d\n", |
| 6618 | __func__, rc); |
| 6619 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6620 | } |
| 6621 | |
| 6622 | /* enable interrupt gpio */ |
| 6623 | rc = gpio_tlmm_config(GPIO_CFG(TS_GPIO_IRQ, 0, GPIO_CFG_INPUT, |
| 6624 | GPIO_CFG_PULL_UP, GPIO_CFG_6MA), GPIO_CFG_ENABLE); |
| 6625 | if (rc) { |
| 6626 | pr_err("%s: Could not configure gpio %d\n", |
| 6627 | __func__, TS_GPIO_IRQ); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6628 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6629 | } |
| 6630 | |
| 6631 | /* virtual keys */ |
| 6632 | tma300_vkeys_attr.attr.name = "virtualkeys.msm_tma300_ts"; |
| 6633 | properties_kobj = kobject_create_and_add("board_properties", |
| 6634 | NULL); |
| 6635 | if (!properties_kobj) { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6636 | pr_err("%s: failed to create a kobject " |
| 6637 | "for board_properties\n", __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6638 | rc = -ENOMEM; |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6639 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6640 | } |
| 6641 | rc = sysfs_create_group(properties_kobj, |
| 6642 | &tma300_properties_attr_group); |
| 6643 | if (rc) { |
| 6644 | pr_err("%s: failed to create a sysfs entry %s\n", |
| 6645 | __func__, tma300_vkeys_attr.attr.name); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6646 | goto kobj_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6647 | } |
| 6648 | } else { |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6649 | regulator_bulk_free(ARRAY_SIZE(regs_tma300), regs_tma300); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6650 | /* destroy virtual keys */ |
| 6651 | if (properties_kobj) { |
| 6652 | sysfs_remove_group(properties_kobj, |
| 6653 | &tma300_properties_attr_group); |
| 6654 | kobject_put(properties_kobj); |
| 6655 | } |
| 6656 | } |
| 6657 | return 0; |
| 6658 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6659 | kobj_free: |
| 6660 | kobject_put(properties_kobj); |
| 6661 | properties_kobj = NULL; |
| 6662 | reg_free: |
| 6663 | regulator_bulk_free(ARRAY_SIZE(regs_tma300), regs_tma300); |
| 6664 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6665 | return rc; |
| 6666 | } |
| 6667 | |
| 6668 | static struct cy8c_ts_platform_data cy8ctma300_pdata = { |
| 6669 | .power_on = tma300_power, |
| 6670 | .dev_setup = tma300_dev_setup, |
| 6671 | .ts_name = "msm_tma300_ts", |
| 6672 | .dis_min_x = 0, |
| 6673 | .dis_max_x = 479, |
| 6674 | .dis_min_y = 0, |
| 6675 | .dis_max_y = 799, |
| 6676 | .res_x = 479, |
| 6677 | .res_y = 1009, |
| 6678 | .min_tid = 1, |
| 6679 | .max_tid = 255, |
| 6680 | .min_touch = 0, |
| 6681 | .max_touch = 255, |
| 6682 | .min_width = 0, |
| 6683 | .max_width = 255, |
| 6684 | .invert_y = 1, |
| 6685 | .nfingers = 4, |
| 6686 | .irq_gpio = TS_GPIO_IRQ, |
| 6687 | .resout_gpio = -1, |
| 6688 | }; |
| 6689 | |
| 6690 | static struct i2c_board_info cy8ctma300_board_info[] = { |
| 6691 | { |
| 6692 | I2C_BOARD_INFO("cy8ctma300", 0x2), |
| 6693 | .platform_data = &cy8ctma300_pdata, |
| 6694 | } |
| 6695 | }; |
| 6696 | |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 6697 | static void __init msm7x30_init(void) |
| 6698 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6699 | int rc; |
| 6700 | unsigned smem_size; |
| 6701 | uint32_t usb_hub_gpio_cfg_value = GPIO_CFG(56, |
| 6702 | 0, |
| 6703 | GPIO_CFG_OUTPUT, |
| 6704 | GPIO_CFG_NO_PULL, |
| 6705 | GPIO_CFG_2MA); |
| 6706 | uint32_t soc_version = 0; |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 6707 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6708 | soc_version = socinfo_get_version(); |
| 6709 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 6710 | msm_clock_init(&msm7x30_clock_init_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6711 | #ifdef CONFIG_SERIAL_MSM_CONSOLE |
| 6712 | msm7x30_init_uart2(); |
| 6713 | #endif |
| 6714 | msm_spm_init(&msm_spm_data, 1); |
Matt Wagantall | ec57f06 | 2011-08-16 23:54:46 -0700 | [diff] [blame] | 6715 | acpuclk_init(&acpuclk_7x30_soc_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6716 | if (machine_is_msm7x30_surf() || machine_is_msm7x30_fluid()) |
| 6717 | msm7x30_cfg_smsc911x(); |
| 6718 | |
| 6719 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 6720 | if (SOCINFO_VERSION_MAJOR(soc_version) >= 2 && |
| 6721 | SOCINFO_VERSION_MINOR(soc_version) >= 1) { |
| 6722 | pr_debug("%s: SOC Version:2.(1 or more)\n", __func__); |
| 6723 | msm_otg_pdata.ldo_set_voltage = 0; |
| 6724 | } |
| 6725 | |
| 6726 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 6727 | #ifdef CONFIG_USB_GADGET |
| 6728 | msm_otg_pdata.swfi_latency = |
| 6729 | msm_pm_data |
| 6730 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 6731 | msm_device_gadget_peripheral.dev.platform_data = &msm_gadget_pdata; |
| 6732 | #endif |
| 6733 | #endif |
| 6734 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(136); |
| 6735 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 6736 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) |
| 6737 | msm_device_tsif.dev.platform_data = &tsif_platform_data; |
| 6738 | #endif |
| 6739 | if (machine_is_msm7x30_fluid()) { |
| 6740 | msm_adc_pdata.dev_names = msm_adc_fluid_device_names; |
| 6741 | msm_adc_pdata.num_adc = ARRAY_SIZE(msm_adc_fluid_device_names); |
| 6742 | } else { |
| 6743 | msm_adc_pdata.dev_names = msm_adc_surf_device_names; |
| 6744 | msm_adc_pdata.num_adc = ARRAY_SIZE(msm_adc_surf_device_names); |
| 6745 | } |
| 6746 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6747 | pmic8058_leds_init(); |
| 6748 | |
| 6749 | buses_init(); |
| 6750 | |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 6751 | #ifdef CONFIG_MSM_SSBI |
| 6752 | msm_device_ssbi_pmic1.dev.platform_data = |
| 6753 | &msm7x30_ssbi_pm8058_pdata; |
| 6754 | #endif |
| 6755 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6756 | platform_add_devices(msm_footswitch_devices, |
| 6757 | msm_num_footswitch_devices); |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 6758 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6759 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 6760 | msm_add_host(0, &msm_usb_host_pdata); |
| 6761 | #endif |
| 6762 | msm7x30_init_mmc(); |
| 6763 | msm7x30_init_nand(); |
| 6764 | msm_qsd_spi_init(); |
| 6765 | |
| 6766 | #ifdef CONFIG_SPI_QSD |
| 6767 | if (machine_is_msm7x30_fluid()) |
| 6768 | spi_register_board_info(lcdc_sharp_spi_board_info, |
| 6769 | ARRAY_SIZE(lcdc_sharp_spi_board_info)); |
| 6770 | else |
| 6771 | spi_register_board_info(lcdc_toshiba_spi_board_info, |
| 6772 | ARRAY_SIZE(lcdc_toshiba_spi_board_info)); |
| 6773 | #endif |
| 6774 | |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6775 | atv_dac_power_init(); |
| 6776 | sensors_ldo_init(); |
| 6777 | hdmi_init_regs(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6778 | msm_fb_add_devices(); |
| 6779 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 6780 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6781 | msm_device_i2c_init(); |
| 6782 | msm_device_i2c_2_init(); |
| 6783 | qup_device_i2c_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6784 | msm7x30_init_marimba(); |
| 6785 | #ifdef CONFIG_MSM7KV2_AUDIO |
| 6786 | snddev_poweramp_gpio_init(); |
Justin Paupore | 3f40f34 | 2011-08-10 18:52:16 -0700 | [diff] [blame] | 6787 | snddev_hsed_voltage_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6788 | aux_pcm_gpio_init(); |
| 6789 | #endif |
| 6790 | |
| 6791 | i2c_register_board_info(0, msm_i2c_board_info, |
| 6792 | ARRAY_SIZE(msm_i2c_board_info)); |
| 6793 | |
| 6794 | if (!machine_is_msm8x55_svlte_ffa() && !machine_is_msm7x30_fluid()) |
| 6795 | marimba_pdata.tsadc = &marimba_tsadc_pdata; |
| 6796 | |
| 6797 | if (machine_is_msm7x30_fluid()) |
| 6798 | i2c_register_board_info(0, cy8info, |
| 6799 | ARRAY_SIZE(cy8info)); |
| 6800 | #ifdef CONFIG_BOSCH_BMA150 |
| 6801 | if (machine_is_msm7x30_fluid()) |
| 6802 | i2c_register_board_info(0, bma150_board_info, |
| 6803 | ARRAY_SIZE(bma150_board_info)); |
| 6804 | #endif |
| 6805 | |
| 6806 | i2c_register_board_info(2, msm_marimba_board_info, |
| 6807 | ARRAY_SIZE(msm_marimba_board_info)); |
| 6808 | |
| 6809 | i2c_register_board_info(2, msm_i2c_gsbi7_timpani_info, |
| 6810 | ARRAY_SIZE(msm_i2c_gsbi7_timpani_info)); |
| 6811 | |
| 6812 | i2c_register_board_info(4 /* QUP ID */, msm_camera_boardinfo, |
| 6813 | ARRAY_SIZE(msm_camera_boardinfo)); |
| 6814 | |
| 6815 | bt_power_init(); |
| 6816 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6817 | msm_device_ssbi7.dev.platform_data = &msm_i2c_ssbi7_pdata; |
| 6818 | #endif |
| 6819 | if (machine_is_msm7x30_fluid()) |
| 6820 | i2c_register_board_info(0, msm_isa1200_board_info, |
| 6821 | ARRAY_SIZE(msm_isa1200_board_info)); |
| 6822 | |
| 6823 | #if defined(CONFIG_TOUCHSCREEN_TSC2007) || \ |
| 6824 | defined(CONFIG_TOUCHSCREEN_TSC2007_MODULE) |
| 6825 | if (machine_is_msm8x55_svlte_ffa()) |
| 6826 | i2c_register_board_info(2, tsc_i2c_board_info, |
| 6827 | ARRAY_SIZE(tsc_i2c_board_info)); |
| 6828 | #endif |
| 6829 | |
| 6830 | if (machine_is_msm7x30_surf()) |
| 6831 | platform_device_register(&flip_switch_device); |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6832 | |
| 6833 | pm8058_gpios_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6834 | |
| 6835 | if (machine_is_msm7x30_fluid()) { |
| 6836 | /* Initialize platform data for fluid v2 hardware */ |
| 6837 | if (SOCINFO_VERSION_MAJOR( |
| 6838 | socinfo_get_platform_version()) == 2) { |
| 6839 | cy8ctma300_pdata.res_y = 920; |
| 6840 | cy8ctma300_pdata.invert_y = 0; |
| 6841 | } |
| 6842 | i2c_register_board_info(0, cy8ctma300_board_info, |
| 6843 | ARRAY_SIZE(cy8ctma300_board_info)); |
| 6844 | } |
| 6845 | |
| 6846 | if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) { |
| 6847 | rc = gpio_tlmm_config(usb_hub_gpio_cfg_value, GPIO_CFG_ENABLE); |
| 6848 | if (rc) |
| 6849 | pr_err("%s: gpio_tlmm_config(%#x)=%d\n", |
| 6850 | __func__, usb_hub_gpio_cfg_value, rc); |
| 6851 | } |
| 6852 | |
| 6853 | boot_reason = *(unsigned int *) |
| 6854 | (smem_get_entry(SMEM_POWER_ON_STATUS_INFO, &smem_size)); |
| 6855 | printk(KERN_NOTICE "Boot Reason = 0x%02x\n", boot_reason); |
| 6856 | } |
| 6857 | |
| 6858 | static unsigned pmem_sf_size = MSM_PMEM_SF_SIZE; |
| 6859 | static int __init pmem_sf_size_setup(char *p) |
| 6860 | { |
| 6861 | pmem_sf_size = memparse(p, NULL); |
| 6862 | return 0; |
| 6863 | } |
| 6864 | early_param("pmem_sf_size", pmem_sf_size_setup); |
| 6865 | |
| 6866 | static unsigned fb_size = MSM_FB_SIZE; |
| 6867 | static int __init fb_size_setup(char *p) |
| 6868 | { |
| 6869 | fb_size = memparse(p, NULL); |
| 6870 | return 0; |
| 6871 | } |
| 6872 | early_param("fb_size", fb_size_setup); |
| 6873 | |
| 6874 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 6875 | static int __init pmem_adsp_size_setup(char *p) |
| 6876 | { |
| 6877 | pmem_adsp_size = memparse(p, NULL); |
| 6878 | return 0; |
| 6879 | } |
| 6880 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 6881 | |
| 6882 | static unsigned fluid_pmem_adsp_size = MSM_FLUID_PMEM_ADSP_SIZE; |
| 6883 | static int __init fluid_pmem_adsp_size_setup(char *p) |
| 6884 | { |
| 6885 | fluid_pmem_adsp_size = memparse(p, NULL); |
| 6886 | return 0; |
| 6887 | } |
| 6888 | early_param("fluid_pmem_adsp_size", fluid_pmem_adsp_size_setup); |
| 6889 | |
| 6890 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 6891 | static int __init pmem_audio_size_setup(char *p) |
| 6892 | { |
| 6893 | pmem_audio_size = memparse(p, NULL); |
| 6894 | return 0; |
| 6895 | } |
| 6896 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 6897 | |
| 6898 | static unsigned pmem_kernel_ebi0_size = PMEM_KERNEL_EBI0_SIZE; |
| 6899 | static int __init pmem_kernel_ebi0_size_setup(char *p) |
| 6900 | { |
| 6901 | pmem_kernel_ebi0_size = memparse(p, NULL); |
| 6902 | return 0; |
| 6903 | } |
| 6904 | early_param("pmem_kernel_ebi0_size", pmem_kernel_ebi0_size_setup); |
| 6905 | |
| 6906 | static struct memtype_reserve msm7x30_reserve_table[] __initdata = { |
| 6907 | [MEMTYPE_SMI] = { |
| 6908 | }, |
| 6909 | [MEMTYPE_EBI0] = { |
| 6910 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 6911 | }, |
| 6912 | [MEMTYPE_EBI1] = { |
| 6913 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 6914 | }, |
| 6915 | }; |
| 6916 | |
| 6917 | static void __init size_pmem_devices(void) |
| 6918 | { |
| 6919 | #ifdef CONFIG_ANDROID_PMEM |
| 6920 | unsigned long size; |
| 6921 | |
| 6922 | if machine_is_msm7x30_fluid() |
| 6923 | size = fluid_pmem_adsp_size; |
| 6924 | else |
| 6925 | size = pmem_adsp_size; |
| 6926 | android_pmem_adsp_pdata.size = size; |
| 6927 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 6928 | android_pmem_pdata.size = pmem_sf_size; |
| 6929 | #endif |
| 6930 | } |
| 6931 | |
| 6932 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 6933 | { |
| 6934 | msm7x30_reserve_table[p->memory_type].size += p->size; |
| 6935 | } |
| 6936 | |
| 6937 | static void __init reserve_pmem_memory(void) |
| 6938 | { |
| 6939 | #ifdef CONFIG_ANDROID_PMEM |
| 6940 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 6941 | reserve_memory_for(&android_pmem_audio_pdata); |
| 6942 | reserve_memory_for(&android_pmem_pdata); |
| 6943 | msm7x30_reserve_table[MEMTYPE_EBI0].size += pmem_kernel_ebi0_size; |
| 6944 | #endif |
| 6945 | } |
| 6946 | |
| 6947 | static void __init msm7x30_calculate_reserve_sizes(void) |
| 6948 | { |
| 6949 | size_pmem_devices(); |
| 6950 | reserve_pmem_memory(); |
| 6951 | } |
| 6952 | |
| 6953 | static int msm7x30_paddr_to_memtype(unsigned int paddr) |
| 6954 | { |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 6955 | if (paddr < phys_add) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6956 | return MEMTYPE_EBI0; |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 6957 | if (paddr >= phys_add && paddr < 0x80000000) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6958 | return MEMTYPE_EBI1; |
| 6959 | return MEMTYPE_NONE; |
| 6960 | } |
| 6961 | |
| 6962 | static struct reserve_info msm7x30_reserve_info __initdata = { |
| 6963 | .memtype_reserve_table = msm7x30_reserve_table, |
| 6964 | .calculate_reserve_sizes = msm7x30_calculate_reserve_sizes, |
| 6965 | .paddr_to_memtype = msm7x30_paddr_to_memtype, |
| 6966 | }; |
| 6967 | |
| 6968 | static void __init msm7x30_reserve(void) |
| 6969 | { |
| 6970 | reserve_info = &msm7x30_reserve_info; |
| 6971 | msm_reserve(); |
| 6972 | } |
| 6973 | |
| 6974 | static void __init msm7x30_allocate_memory_regions(void) |
| 6975 | { |
| 6976 | void *addr; |
| 6977 | unsigned long size; |
| 6978 | |
| 6979 | size = fb_size ? : MSM_FB_SIZE; |
| 6980 | addr = alloc_bootmem_align(size, 0x1000); |
| 6981 | msm_fb_resources[0].start = __pa(addr); |
| 6982 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 6983 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 6984 | size, addr, __pa(addr)); |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 6985 | } |
| 6986 | |
| 6987 | static void __init msm7x30_map_io(void) |
| 6988 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6989 | msm_shared_ram_phys = 0x00100000; |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 6990 | msm_map_msm7x30_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 6991 | if (socinfo_init() < 0) |
| 6992 | printk(KERN_ERR "%s: socinfo_init() failed!\n", |
| 6993 | __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6994 | } |
| 6995 | |
| 6996 | static void __init msm7x30_init_early(void) |
| 6997 | { |
| 6998 | msm7x30_allocate_memory_regions(); |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 6999 | } |
| 7000 | |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7001 | static void __init msm7x30_fixup(struct machine_desc *desc, struct tag *tags, |
| 7002 | char **cmdline, struct meminfo *mi) |
| 7003 | { |
| 7004 | for (; tags->hdr.size; tags = tag_next(tags)) { |
| 7005 | if (tags->hdr.tag == ATAG_MEM && tags->u.mem.start == |
| 7006 | DDR1_BANK_BASE) { |
| 7007 | ebi1_phys_offset = DDR1_BANK_BASE; |
| 7008 | phys_add = DDR1_BANK_BASE; |
| 7009 | break; |
| 7010 | } |
| 7011 | } |
| 7012 | } |
| 7013 | |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7014 | MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF") |
Russell King | b75c178 | 2011-01-04 19:03:16 +0000 | [diff] [blame] | 7015 | .boot_params = PLAT_PHYS_OFFSET + 0x100, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7016 | .map_io = msm7x30_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7017 | .reserve = msm7x30_reserve, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7018 | .init_irq = msm7x30_init_irq, |
| 7019 | .init_machine = msm7x30_init, |
| 7020 | .timer = &msm_timer, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7021 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7022 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7023 | .fixup = msm7x30_fixup, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7024 | MACHINE_END |
| 7025 | |
| 7026 | MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA") |
Russell King | b75c178 | 2011-01-04 19:03:16 +0000 | [diff] [blame] | 7027 | .boot_params = PLAT_PHYS_OFFSET + 0x100, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7028 | .map_io = msm7x30_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7029 | .reserve = msm7x30_reserve, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7030 | .init_irq = msm7x30_init_irq, |
| 7031 | .init_machine = msm7x30_init, |
| 7032 | .timer = &msm_timer, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7033 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7034 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7035 | .fixup = msm7x30_fixup, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7036 | MACHINE_END |
| 7037 | |
| 7038 | MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID") |
Russell King | b75c178 | 2011-01-04 19:03:16 +0000 | [diff] [blame] | 7039 | .boot_params = PLAT_PHYS_OFFSET + 0x100, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7040 | .map_io = msm7x30_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7041 | .reserve = msm7x30_reserve, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7042 | .init_irq = msm7x30_init_irq, |
| 7043 | .init_machine = msm7x30_init, |
| 7044 | .timer = &msm_timer, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7045 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7046 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7047 | .fixup = msm7x30_fixup, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7048 | MACHINE_END |
| 7049 | |
| 7050 | MACHINE_START(MSM8X55_SURF, "QCT MSM8X55 SURF") |
| 7051 | .boot_params = PHYS_OFFSET + 0x100, |
| 7052 | .map_io = msm7x30_map_io, |
| 7053 | .reserve = msm7x30_reserve, |
| 7054 | .init_irq = msm7x30_init_irq, |
| 7055 | .init_machine = msm7x30_init, |
| 7056 | .timer = &msm_timer, |
| 7057 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7058 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7059 | .fixup = msm7x30_fixup, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7060 | MACHINE_END |
| 7061 | |
| 7062 | MACHINE_START(MSM8X55_FFA, "QCT MSM8X55 FFA") |
| 7063 | .boot_params = PHYS_OFFSET + 0x100, |
| 7064 | .map_io = msm7x30_map_io, |
| 7065 | .reserve = msm7x30_reserve, |
| 7066 | .init_irq = msm7x30_init_irq, |
| 7067 | .init_machine = msm7x30_init, |
| 7068 | .timer = &msm_timer, |
| 7069 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7070 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7071 | .fixup = msm7x30_fixup, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7072 | MACHINE_END |
| 7073 | MACHINE_START(MSM8X55_SVLTE_SURF, "QCT MSM8X55 SVLTE SURF") |
| 7074 | .boot_params = PHYS_OFFSET + 0x100, |
| 7075 | .map_io = msm7x30_map_io, |
| 7076 | .reserve = msm7x30_reserve, |
| 7077 | .init_irq = msm7x30_init_irq, |
| 7078 | .init_machine = msm7x30_init, |
| 7079 | .timer = &msm_timer, |
| 7080 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7081 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7082 | .fixup = msm7x30_fixup, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7083 | MACHINE_END |
| 7084 | MACHINE_START(MSM8X55_SVLTE_FFA, "QCT MSM8X55 SVLTE FFA") |
| 7085 | .boot_params = PHYS_OFFSET + 0x100, |
| 7086 | .map_io = msm7x30_map_io, |
| 7087 | .reserve = msm7x30_reserve, |
| 7088 | .init_irq = msm7x30_init_irq, |
| 7089 | .init_machine = msm7x30_init, |
| 7090 | .timer = &msm_timer, |
| 7091 | .init_early = msm7x30_init_early, |
Taniya Das | bae99fb | 2011-10-12 09:55:13 +0530 | [diff] [blame] | 7092 | .handle_irq = vic_handle_irq, |
Pankaj Kumar | ac69ee6 | 2012-01-26 00:21:56 +0530 | [diff] [blame] | 7093 | .fixup = msm7x30_fixup, |
Daniel Walker | 8d747cd | 2010-02-25 11:37:43 -0800 | [diff] [blame] | 7094 | MACHINE_END |