Nagamalleswararao Ganji | 70fac1e | 2011-12-29 19:06:37 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -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 | * |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/platform_device.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 17 | #include <linux/irq.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 18 | #include <linux/io.h> |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 19 | #include <linux/msm_ssbi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #include <linux/mfd/pmic8058.h> |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 21 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 22 | #include <linux/leds.h> |
| 23 | #include <linux/pmic8058-othc.h> |
| 24 | #include <linux/mfd/pmic8901.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 25 | #include <linux/regulator/msm-gpio-regulator.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | #include <linux/regulator/pmic8901-regulator.h> |
| 27 | #include <linux/bootmem.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 28 | #include <linux/msm_adc.h> |
| 29 | #include <linux/m_adcproc.h> |
| 30 | #include <linux/mfd/marimba.h> |
| 31 | #include <linux/msm-charger.h> |
| 32 | #include <linux/i2c.h> |
| 33 | #include <linux/i2c/sx150x.h> |
| 34 | #include <linux/smsc911x.h> |
| 35 | #include <linux/spi/spi.h> |
| 36 | #include <linux/input/tdisc_shinetsu.h> |
| 37 | #include <linux/input/cy8c_ts.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 38 | #include <linux/cyttsp-qc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 39 | #include <linux/i2c/isa1200.h> |
| 40 | #include <linux/dma-mapping.h> |
| 41 | #include <linux/i2c/bq27520.h> |
| 42 | |
| 43 | #ifdef CONFIG_ANDROID_PMEM |
| 44 | #include <linux/android_pmem.h> |
| 45 | #endif |
| 46 | |
| 47 | #if defined(CONFIG_SMB137B_CHARGER) || defined(CONFIG_SMB137B_CHARGER_MODULE) |
| 48 | #include <linux/i2c/smb137b.h> |
| 49 | #endif |
Lei Zhou | 338cab8 | 2011-08-19 13:38:17 -0400 | [diff] [blame] | 50 | #ifdef CONFIG_SND_SOC_WM8903 |
| 51 | #include <sound/wm8903.h> |
| 52 | #endif |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 53 | #include <asm/mach-types.h> |
| 54 | #include <asm/mach/arch.h> |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 55 | #include <asm/setup.h> |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 56 | #include <asm/hardware/gic.h> |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 57 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 58 | #include <mach/dma.h> |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 59 | #include <mach/board.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 60 | #include <mach/irqs.h> |
| 61 | #include <mach/msm_spi.h> |
| 62 | #include <mach/msm_serial_hs.h> |
| 63 | #include <mach/msm_serial_hs_lite.h> |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 64 | #include <mach/msm_iomap.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 65 | #include <mach/msm_memtypes.h> |
| 66 | #include <asm/mach/mmc.h> |
| 67 | #include <mach/msm_battery.h> |
| 68 | #include <mach/msm_hsusb.h> |
Rohit Vaswani | a513aa8d | 2011-07-18 15:14:28 -0700 | [diff] [blame] | 69 | #include <mach/gpiomux.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 70 | #ifdef CONFIG_MSM_DSPS |
| 71 | #include <mach/msm_dsps.h> |
| 72 | #endif |
| 73 | #include <mach/msm_xo.h> |
| 74 | #include <mach/msm_bus_board.h> |
| 75 | #include <mach/socinfo.h> |
| 76 | #include <linux/i2c/isl9519.h> |
| 77 | #ifdef CONFIG_USB_G_ANDROID |
| 78 | #include <linux/usb/android.h> |
| 79 | #include <mach/usbdiag.h> |
| 80 | #endif |
| 81 | #include <linux/regulator/consumer.h> |
| 82 | #include <linux/regulator/machine.h> |
| 83 | #include <mach/sdio_al.h> |
| 84 | #include <mach/rpm.h> |
| 85 | #include <mach/rpm-regulator.h> |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 86 | #include <mach/restart.h> |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 87 | #include <mach/board-msm8660.h> |
Olav Haugan | 8726caf | 2012-05-10 15:11:35 -0700 | [diff] [blame] | 88 | #include <mach/iommu_domains.h> |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 89 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 90 | #include "devices.h" |
| 91 | #include "devices-msm8x60.h" |
Abhijeet Dharmapurikar | efaca4f | 2011-12-27 16:24:07 -0800 | [diff] [blame] | 92 | #include <mach/cpuidle.h> |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 93 | #include "pm.h" |
Subhash Jadavani | 909e04f | 2012-04-12 10:52:50 +0530 | [diff] [blame] | 94 | #include <mach/mpm.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | #include "spm.h" |
| 96 | #include "rpm_log.h" |
| 97 | #include "timer.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 98 | #include "gpiomux-8x60.h" |
| 99 | #include "rpm_stats.h" |
| 100 | #include "peripheral-loader.h" |
| 101 | #include <linux/platform_data/qcom_crypto_device.h> |
| 102 | #include "rpm_resources.h" |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 103 | #include "pm-boot.h" |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 104 | #include "board-storage-common-a.h" |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 105 | |
| 106 | #include <linux/ion.h> |
| 107 | #include <mach/ion.h> |
Adinarayana Gupta Grandhi | 4ed4ad8 | 2012-04-03 17:11:56 +0530 | [diff] [blame] | 108 | #include <mach/msm_rtb.h> |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 109 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 110 | #define MSM_SHARED_RAM_PHYS 0x40000000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 111 | #define MDM2AP_SYNC 129 |
| 112 | |
Terence Hampson | 1c73fef | 2011-07-19 17:10:49 -0400 | [diff] [blame] | 113 | #define GPIO_ETHERNET_RESET_N_DRAGON 30 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 114 | #define LCDC_SPI_GPIO_CLK 73 |
| 115 | #define LCDC_SPI_GPIO_CS 72 |
| 116 | #define LCDC_SPI_GPIO_MOSI 70 |
| 117 | #define LCDC_AUO_PANEL_NAME "lcdc_auo_wvga" |
| 118 | #define LCDC_SAMSUNG_OLED_PANEL_NAME "lcdc_samsung_oled" |
| 119 | #define LCDC_SAMSUNG_WSVGA_PANEL_NAME "lcdc_samsung_wsvga" |
| 120 | #define LCDC_SAMSUNG_SPI_DEVICE_NAME "lcdc_samsung_ams367pe02" |
| 121 | #define LCDC_AUO_SPI_DEVICE_NAME "lcdc_auo_nt35582" |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 122 | #define LCDC_NT35582_PANEL_NAME "lcdc_nt35582_wvga" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 123 | |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 124 | #define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd" |
| 125 | #define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd" |
| 126 | #define MIPI_VIDEO_TOSHIBA_WVGA_PANEL_NAME "mipi_video_toshiba_wvga" |
| 127 | #define HDMI_PANEL_NAME "hdmi_msm" |
| 128 | #define TVOUT_PANEL_NAME "tvout_msm" |
| 129 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 130 | #define DSPS_PIL_GENERIC_NAME "dsps" |
| 131 | #define DSPS_PIL_FLUID_NAME "dsps_fluid" |
| 132 | |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 133 | #ifdef CONFIG_ION_MSM |
| 134 | static struct platform_device ion_dev; |
| 135 | #endif |
| 136 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 137 | enum { |
| 138 | GPIO_EXPANDER_IRQ_BASE = PM8901_IRQ_BASE + NR_PMIC8901_IRQS, |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 139 | GPIO_EXPANDER_GPIO_BASE = PM8901_MPP_BASE + PM8901_MPPS, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 140 | /* CORE expander */ |
| 141 | GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE, |
| 142 | GPIO_CLASS_D1_EN = GPIO_CORE_EXPANDER_BASE, |
| 143 | GPIO_WLAN_DEEP_SLEEP_N, |
| 144 | GPIO_LVDS_SHUTDOWN_N, |
| 145 | GPIO_DISP_RESX_N = GPIO_LVDS_SHUTDOWN_N, |
| 146 | GPIO_MS_SYS_RESET_N, |
| 147 | GPIO_CAP_TS_RESOUT_N, |
| 148 | GPIO_CAP_GAUGE_BI_TOUT, |
| 149 | GPIO_ETHERNET_PME, |
| 150 | GPIO_EXT_GPS_LNA_EN, |
| 151 | GPIO_MSM_WAKES_BT, |
| 152 | GPIO_ETHERNET_RESET_N, |
| 153 | GPIO_HEADSET_DET_N, |
| 154 | GPIO_USB_UICC_EN, |
| 155 | GPIO_BACKLIGHT_EN, |
| 156 | GPIO_EXT_CAMIF_PWR_EN, |
| 157 | GPIO_BATT_GAUGE_INT_N, |
| 158 | GPIO_BATT_GAUGE_EN, |
| 159 | /* DOCKING expander */ |
| 160 | GPIO_DOCKING_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE + 16, |
| 161 | GPIO_MIPI_DSI_RST_N = GPIO_DOCKING_EXPANDER_BASE, |
| 162 | GPIO_AUX_JTAG_DET_N, |
| 163 | GPIO_DONGLE_DET_N, |
| 164 | GPIO_SVIDEO_LOAD_DET, |
| 165 | GPIO_SVID_AMP_SHUTDOWN1_N, |
| 166 | GPIO_SVID_AMP_SHUTDOWN0_N, |
| 167 | GPIO_SDC_WP, |
| 168 | GPIO_IRDA_PWDN, |
| 169 | GPIO_IRDA_RESET_N, |
| 170 | GPIO_DONGLE_GPIO0, |
| 171 | GPIO_DONGLE_GPIO1, |
| 172 | GPIO_DONGLE_GPIO2, |
| 173 | GPIO_DONGLE_GPIO3, |
| 174 | GPIO_DONGLE_PWR_EN, |
| 175 | GPIO_EMMC_RESET_N, |
| 176 | GPIO_TP_EXP2_IO15, |
| 177 | /* SURF expander */ |
| 178 | GPIO_SURF_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE + (16 * 2), |
| 179 | GPIO_SD_CARD_DET_1 = GPIO_SURF_EXPANDER_BASE, |
| 180 | GPIO_SD_CARD_DET_2, |
| 181 | GPIO_SD_CARD_DET_4, |
| 182 | GPIO_SD_CARD_DET_5, |
| 183 | GPIO_UIM3_RST, |
| 184 | GPIO_SURF_EXPANDER_IO5, |
| 185 | GPIO_SURF_EXPANDER_IO6, |
| 186 | GPIO_ADC_I2C_EN, |
| 187 | GPIO_SURF_EXPANDER_IO8, |
| 188 | GPIO_SURF_EXPANDER_IO9, |
| 189 | GPIO_SURF_EXPANDER_IO10, |
| 190 | GPIO_SURF_EXPANDER_IO11, |
| 191 | GPIO_SURF_EXPANDER_IO12, |
| 192 | GPIO_SURF_EXPANDER_IO13, |
| 193 | GPIO_SURF_EXPANDER_IO14, |
| 194 | GPIO_SURF_EXPANDER_IO15, |
| 195 | /* LEFT KB IO expander */ |
| 196 | GPIO_LEFT_KB_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE + (16 * 3), |
| 197 | GPIO_LEFT_LED_1 = GPIO_LEFT_KB_EXPANDER_BASE, |
| 198 | GPIO_LEFT_LED_2, |
| 199 | GPIO_LEFT_LED_3, |
| 200 | GPIO_LEFT_LED_WLAN, |
| 201 | GPIO_JOYSTICK_EN, |
| 202 | GPIO_CAP_TS_SLEEP, |
| 203 | GPIO_LEFT_KB_IO6, |
| 204 | GPIO_LEFT_LED_5, |
| 205 | /* RIGHT KB IO expander */ |
| 206 | GPIO_RIGHT_KB_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE + (16 * 3) + 8, |
| 207 | GPIO_RIGHT_LED_1 = GPIO_RIGHT_KB_EXPANDER_BASE, |
| 208 | GPIO_RIGHT_LED_2, |
| 209 | GPIO_RIGHT_LED_3, |
| 210 | GPIO_RIGHT_LED_BT, |
| 211 | GPIO_WEB_CAMIF_STANDBY, |
| 212 | GPIO_COMPASS_RST_N, |
| 213 | GPIO_WEB_CAMIF_RESET_N, |
| 214 | GPIO_RIGHT_LED_5, |
| 215 | GPIO_R_ALTIMETER_RESET_N, |
| 216 | /* FLUID S IO expander */ |
| 217 | GPIO_SOUTH_EXPANDER_BASE, |
| 218 | GPIO_MIC2_ANCR_SEL = GPIO_SOUTH_EXPANDER_BASE, |
| 219 | GPIO_MIC1_ANCL_SEL, |
| 220 | GPIO_HS_MIC4_SEL, |
| 221 | GPIO_FML_MIC3_SEL, |
| 222 | GPIO_FMR_MIC5_SEL, |
| 223 | GPIO_TS_SLEEP, |
| 224 | GPIO_HAP_SHIFT_LVL_OE, |
| 225 | GPIO_HS_SW_DIR, |
| 226 | /* FLUID N IO expander */ |
| 227 | GPIO_NORTH_EXPANDER_BASE, |
| 228 | GPIO_EPM_3_3V_EN = GPIO_NORTH_EXPANDER_BASE, |
| 229 | GPIO_EPM_5V_BOOST_EN, |
| 230 | GPIO_AUX_CAM_2P7_EN, |
| 231 | GPIO_LED_FLASH_EN, |
| 232 | GPIO_LED1_GREEN_N, |
| 233 | GPIO_LED2_RED_N, |
| 234 | GPIO_FRONT_CAM_RESET_N, |
| 235 | GPIO_EPM_LVLSFT_EN, |
| 236 | GPIO_N_ALTIMETER_RESET_N, |
| 237 | /* EPM expander */ |
| 238 | GPIO_EPM_EXPANDER_BASE, |
| 239 | GPIO_PWR_MON_START = GPIO_EPM_EXPANDER_BASE, |
| 240 | GPIO_PWR_MON_RESET_N, |
| 241 | GPIO_ADC1_PWDN_N, |
| 242 | GPIO_ADC2_PWDN_N, |
| 243 | GPIO_EPM_EXPANDER_IO4, |
| 244 | GPIO_ADC1_MUX_SPI_INT_N_3_3V, |
| 245 | GPIO_ADC2_MUX_SPI_INT_N, |
| 246 | GPIO_EPM_EXPANDER_IO7, |
| 247 | GPIO_PWR_MON_ENABLE, |
| 248 | GPIO_EPM_SPI_ADC1_CS_N, |
| 249 | GPIO_EPM_SPI_ADC2_CS_N, |
| 250 | GPIO_EPM_EXPANDER_IO11, |
| 251 | GPIO_EPM_EXPANDER_IO12, |
| 252 | GPIO_EPM_EXPANDER_IO13, |
| 253 | GPIO_EPM_EXPANDER_IO14, |
| 254 | GPIO_EPM_EXPANDER_IO15, |
| 255 | }; |
| 256 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 257 | struct pm8xxx_mpp_init_info { |
| 258 | unsigned mpp; |
| 259 | struct pm8xxx_mpp_config_data config; |
| 260 | }; |
| 261 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 262 | #define PM8058_MPP_INIT(_mpp, _type, _level, _control) \ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 263 | { \ |
| 264 | .mpp = PM8058_MPP_PM_TO_SYS(_mpp), \ |
| 265 | .config = { \ |
| 266 | .type = PM8XXX_MPP_TYPE_##_type, \ |
| 267 | .level = _level, \ |
| 268 | .control = PM8XXX_MPP_##_control, \ |
| 269 | } \ |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 270 | } |
| 271 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 272 | #define PM8901_MPP_INIT(_mpp, _type, _level, _control) \ |
| 273 | { \ |
| 274 | .mpp = PM8901_MPP_PM_TO_SYS(_mpp), \ |
| 275 | .config = { \ |
| 276 | .type = PM8XXX_MPP_TYPE_##_type, \ |
| 277 | .level = _level, \ |
| 278 | .control = PM8XXX_MPP_##_control, \ |
| 279 | } \ |
| 280 | } |
| 281 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 282 | /* |
| 283 | * The UI_INTx_N lines are pmic gpio lines which connect i2c |
| 284 | * gpio expanders to the pm8058. |
| 285 | */ |
| 286 | #define UI_INT1_N 25 |
| 287 | #define UI_INT2_N 34 |
| 288 | #define UI_INT3_N 14 |
| 289 | /* |
| 290 | FM GPIO is GPIO 18 on PMIC 8058. |
| 291 | As the index starts from 0 in the PMIC driver, and hence 17 |
| 292 | corresponds to GPIO 18 on PMIC 8058. |
| 293 | */ |
| 294 | #define FM_GPIO 17 |
| 295 | |
| 296 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 297 | static void (*sdc2_status_notify_cb)(int card_present, void *dev_id); |
| 298 | static void *sdc2_status_notify_cb_devid; |
| 299 | #endif |
| 300 | |
| 301 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 302 | static void (*sdc5_status_notify_cb)(int card_present, void *dev_id); |
| 303 | static void *sdc5_status_notify_cb_devid; |
| 304 | #endif |
| 305 | |
| 306 | static struct msm_spm_platform_data msm_spm_data_v1[] __initdata = { |
| 307 | [0] = { |
| 308 | .reg_base_addr = MSM_SAW0_BASE, |
| 309 | |
| 310 | #ifdef CONFIG_MSM_AVS_HW |
| 311 | .reg_init_values[MSM_SPM_REG_SAW_AVS_CTL] = 0x586020FF, |
| 312 | #endif |
| 313 | .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x0F, |
| 314 | .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x68, |
| 315 | .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0xFFFFFFFF, |
| 316 | .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0xFFFFFFFF, |
| 317 | |
| 318 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x01, |
| 319 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x07, |
| 320 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00, |
| 321 | |
| 322 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01, |
| 323 | .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00, |
| 324 | .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00, |
| 325 | |
| 326 | .awake_vlevel = 0x94, |
| 327 | .retention_vlevel = 0x81, |
| 328 | .collapse_vlevel = 0x20, |
| 329 | .retention_mid_vlevel = 0x94, |
| 330 | .collapse_mid_vlevel = 0x8C, |
| 331 | |
| 332 | .vctl_timeout_us = 50, |
| 333 | }, |
| 334 | |
| 335 | [1] = { |
| 336 | .reg_base_addr = MSM_SAW1_BASE, |
| 337 | |
| 338 | #ifdef CONFIG_MSM_AVS_HW |
| 339 | .reg_init_values[MSM_SPM_REG_SAW_AVS_CTL] = 0x586020FF, |
| 340 | #endif |
| 341 | .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x0F, |
| 342 | .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x68, |
| 343 | .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0xFFFFFFFF, |
| 344 | .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0xFFFFFFFF, |
| 345 | |
| 346 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x13, |
| 347 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x07, |
| 348 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00, |
| 349 | |
| 350 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01, |
| 351 | .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00, |
| 352 | .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00, |
| 353 | |
| 354 | .awake_vlevel = 0x94, |
| 355 | .retention_vlevel = 0x81, |
| 356 | .collapse_vlevel = 0x20, |
| 357 | .retention_mid_vlevel = 0x94, |
| 358 | .collapse_mid_vlevel = 0x8C, |
| 359 | |
| 360 | .vctl_timeout_us = 50, |
| 361 | }, |
| 362 | }; |
| 363 | |
| 364 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 365 | [0] = { |
| 366 | .reg_base_addr = MSM_SAW0_BASE, |
| 367 | |
| 368 | #ifdef CONFIG_MSM_AVS_HW |
| 369 | .reg_init_values[MSM_SPM_REG_SAW_AVS_CTL] = 0x586020FF, |
| 370 | #endif |
| 371 | .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x1C, |
| 372 | .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x68, |
| 373 | .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0x0C0CFFFF, |
| 374 | .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0x78780FFF, |
| 375 | |
| 376 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x01, |
| 377 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x07, |
| 378 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00, |
| 379 | |
| 380 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01, |
| 381 | .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00, |
| 382 | .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00, |
| 383 | |
| 384 | .awake_vlevel = 0xA0, |
| 385 | .retention_vlevel = 0x89, |
| 386 | .collapse_vlevel = 0x20, |
| 387 | .retention_mid_vlevel = 0x89, |
| 388 | .collapse_mid_vlevel = 0x89, |
| 389 | |
| 390 | .vctl_timeout_us = 50, |
| 391 | }, |
| 392 | |
| 393 | [1] = { |
| 394 | .reg_base_addr = MSM_SAW1_BASE, |
| 395 | |
| 396 | #ifdef CONFIG_MSM_AVS_HW |
| 397 | .reg_init_values[MSM_SPM_REG_SAW_AVS_CTL] = 0x586020FF, |
| 398 | #endif |
| 399 | .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x1C, |
| 400 | .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x68, |
| 401 | .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0x0C0CFFFF, |
| 402 | .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0x78780FFF, |
| 403 | |
| 404 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x13, |
| 405 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x07, |
| 406 | .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00, |
| 407 | |
| 408 | .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01, |
| 409 | .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00, |
| 410 | .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00, |
| 411 | |
| 412 | .awake_vlevel = 0xA0, |
| 413 | .retention_vlevel = 0x89, |
| 414 | .collapse_vlevel = 0x20, |
| 415 | .retention_mid_vlevel = 0x89, |
| 416 | .collapse_mid_vlevel = 0x89, |
| 417 | |
| 418 | .vctl_timeout_us = 50, |
| 419 | }, |
| 420 | }; |
| 421 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 422 | /* |
| 423 | * Consumer specific regulator names: |
| 424 | * regulator name consumer dev_name |
| 425 | */ |
| 426 | static struct regulator_consumer_supply vreg_consumers_8901_S0[] = { |
| 427 | REGULATOR_SUPPLY("8901_s0", NULL), |
| 428 | }; |
| 429 | static struct regulator_consumer_supply vreg_consumers_8901_S1[] = { |
| 430 | REGULATOR_SUPPLY("8901_s1", NULL), |
| 431 | }; |
| 432 | |
| 433 | static struct regulator_init_data saw_s0_init_data = { |
| 434 | .constraints = { |
| 435 | .name = "8901_s0", |
| 436 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
Tianyi Gou | 7c81dfa | 2011-07-27 12:15:24 -0700 | [diff] [blame] | 437 | .min_uV = 800000, |
Matt Wagantall | 2ecbec2 | 2012-03-13 23:18:07 -0700 | [diff] [blame] | 438 | .max_uV = 1325000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 439 | }, |
| 440 | .consumer_supplies = vreg_consumers_8901_S0, |
| 441 | .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_8901_S0), |
| 442 | }; |
| 443 | |
| 444 | static struct regulator_init_data saw_s1_init_data = { |
| 445 | .constraints = { |
| 446 | .name = "8901_s1", |
| 447 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
Tianyi Gou | 7c81dfa | 2011-07-27 12:15:24 -0700 | [diff] [blame] | 448 | .min_uV = 800000, |
Matt Wagantall | 2ecbec2 | 2012-03-13 23:18:07 -0700 | [diff] [blame] | 449 | .max_uV = 1325000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 450 | }, |
| 451 | .consumer_supplies = vreg_consumers_8901_S1, |
| 452 | .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_8901_S1), |
| 453 | }; |
| 454 | |
| 455 | static struct platform_device msm_device_saw_s0 = { |
| 456 | .name = "saw-regulator", |
| 457 | .id = 0, |
| 458 | .dev = { |
| 459 | .platform_data = &saw_s0_init_data, |
| 460 | }, |
| 461 | }; |
| 462 | |
| 463 | static struct platform_device msm_device_saw_s1 = { |
| 464 | .name = "saw-regulator", |
| 465 | .id = 1, |
| 466 | .dev = { |
| 467 | .platform_data = &saw_s1_init_data, |
| 468 | }, |
| 469 | }; |
| 470 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 471 | static struct resource smsc911x_resources[] = { |
| 472 | [0] = { |
| 473 | .flags = IORESOURCE_MEM, |
| 474 | .start = 0x1b800000, |
| 475 | .end = 0x1b8000ff |
| 476 | }, |
| 477 | [1] = { |
| 478 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 479 | }, |
| 480 | }; |
| 481 | |
| 482 | static struct smsc911x_platform_config smsc911x_config = { |
| 483 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 484 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 485 | .flags = SMSC911X_USE_16BIT, |
| 486 | .has_reset_gpio = 1, |
| 487 | .reset_gpio = GPIO_ETHERNET_RESET_N |
| 488 | }; |
| 489 | |
| 490 | static struct platform_device smsc911x_device = { |
| 491 | .name = "smsc911x", |
| 492 | .id = 0, |
| 493 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 494 | .resource = smsc911x_resources, |
| 495 | .dev = { |
| 496 | .platform_data = &smsc911x_config |
| 497 | } |
| 498 | }; |
| 499 | |
| 500 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 501 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 502 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 503 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 504 | |
| 505 | #define QCE_SIZE 0x10000 |
| 506 | #define QCE_0_BASE 0x18500000 |
| 507 | |
| 508 | #define QCE_HW_KEY_SUPPORT 0 |
| 509 | #define QCE_SHA_HMAC_SUPPORT 0 |
| 510 | #define QCE_SHARE_CE_RESOURCE 2 |
| 511 | #define QCE_CE_SHARED 1 |
| 512 | |
| 513 | static struct resource qcrypto_resources[] = { |
| 514 | [0] = { |
| 515 | .start = QCE_0_BASE, |
| 516 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 517 | .flags = IORESOURCE_MEM, |
| 518 | }, |
| 519 | [1] = { |
| 520 | .name = "crypto_channels", |
| 521 | .start = DMOV_CE_IN_CHAN, |
| 522 | .end = DMOV_CE_OUT_CHAN, |
| 523 | .flags = IORESOURCE_DMA, |
| 524 | }, |
| 525 | [2] = { |
| 526 | .name = "crypto_crci_in", |
| 527 | .start = DMOV_CE_IN_CRCI, |
| 528 | .end = DMOV_CE_IN_CRCI, |
| 529 | .flags = IORESOURCE_DMA, |
| 530 | }, |
| 531 | [3] = { |
| 532 | .name = "crypto_crci_out", |
| 533 | .start = DMOV_CE_OUT_CRCI, |
| 534 | .end = DMOV_CE_OUT_CRCI, |
| 535 | .flags = IORESOURCE_DMA, |
| 536 | }, |
| 537 | [4] = { |
| 538 | .name = "crypto_crci_hash", |
| 539 | .start = DMOV_CE_HASH_CRCI, |
| 540 | .end = DMOV_CE_HASH_CRCI, |
| 541 | .flags = IORESOURCE_DMA, |
| 542 | }, |
| 543 | }; |
| 544 | |
| 545 | static struct resource qcedev_resources[] = { |
| 546 | [0] = { |
| 547 | .start = QCE_0_BASE, |
| 548 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 549 | .flags = IORESOURCE_MEM, |
| 550 | }, |
| 551 | [1] = { |
| 552 | .name = "crypto_channels", |
| 553 | .start = DMOV_CE_IN_CHAN, |
| 554 | .end = DMOV_CE_OUT_CHAN, |
| 555 | .flags = IORESOURCE_DMA, |
| 556 | }, |
| 557 | [2] = { |
| 558 | .name = "crypto_crci_in", |
| 559 | .start = DMOV_CE_IN_CRCI, |
| 560 | .end = DMOV_CE_IN_CRCI, |
| 561 | .flags = IORESOURCE_DMA, |
| 562 | }, |
| 563 | [3] = { |
| 564 | .name = "crypto_crci_out", |
| 565 | .start = DMOV_CE_OUT_CRCI, |
| 566 | .end = DMOV_CE_OUT_CRCI, |
| 567 | .flags = IORESOURCE_DMA, |
| 568 | }, |
| 569 | [4] = { |
| 570 | .name = "crypto_crci_hash", |
| 571 | .start = DMOV_CE_HASH_CRCI, |
| 572 | .end = DMOV_CE_HASH_CRCI, |
| 573 | .flags = IORESOURCE_DMA, |
| 574 | }, |
| 575 | }; |
| 576 | |
| 577 | #endif |
| 578 | |
| 579 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 580 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 581 | |
| 582 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 583 | .ce_shared = QCE_CE_SHARED, |
| 584 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 585 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 586 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 587 | .bus_scale_table = NULL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 588 | }; |
| 589 | |
| 590 | static struct platform_device qcrypto_device = { |
| 591 | .name = "qcrypto", |
| 592 | .id = 0, |
| 593 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 594 | .resource = qcrypto_resources, |
| 595 | .dev = { |
| 596 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 597 | .platform_data = &qcrypto_ce_hw_suppport, |
| 598 | }, |
| 599 | }; |
| 600 | #endif |
| 601 | |
| 602 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 603 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 604 | |
| 605 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 606 | .ce_shared = QCE_CE_SHARED, |
| 607 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 608 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 609 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 610 | .bus_scale_table = NULL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 611 | }; |
| 612 | |
| 613 | static struct platform_device qcedev_device = { |
| 614 | .name = "qce", |
| 615 | .id = 0, |
| 616 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 617 | .resource = qcedev_resources, |
| 618 | .dev = { |
| 619 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 620 | .platform_data = &qcedev_ce_hw_suppport, |
| 621 | }, |
| 622 | }; |
| 623 | #endif |
| 624 | |
| 625 | #if defined(CONFIG_HAPTIC_ISA1200) || \ |
| 626 | defined(CONFIG_HAPTIC_ISA1200_MODULE) |
| 627 | |
| 628 | static const char *vregs_isa1200_name[] = { |
| 629 | "8058_s3", |
| 630 | "8901_l4", |
| 631 | }; |
| 632 | |
| 633 | static const int vregs_isa1200_val[] = { |
| 634 | 1800000,/* uV */ |
| 635 | 2600000, |
| 636 | }; |
| 637 | static struct regulator *vregs_isa1200[ARRAY_SIZE(vregs_isa1200_name)]; |
| 638 | static struct msm_xo_voter *xo_handle_a1; |
| 639 | |
| 640 | static int isa1200_power(int vreg_on) |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 641 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 642 | int i, rc = 0; |
| 643 | |
| 644 | for (i = 0; i < ARRAY_SIZE(vregs_isa1200_name); i++) { |
| 645 | rc = vreg_on ? regulator_enable(vregs_isa1200[i]) : |
| 646 | regulator_disable(vregs_isa1200[i]); |
| 647 | if (rc < 0) { |
| 648 | pr_err("%s: vreg %s %s failed (%d)\n", |
| 649 | __func__, vregs_isa1200_name[i], |
| 650 | vreg_on ? "enable" : "disable", rc); |
| 651 | goto vreg_fail; |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | rc = vreg_on ? msm_xo_mode_vote(xo_handle_a1, MSM_XO_MODE_ON) : |
| 656 | msm_xo_mode_vote(xo_handle_a1, MSM_XO_MODE_OFF); |
| 657 | if (rc < 0) { |
| 658 | pr_err("%s: failed to %svote for TCXO A1 buffer%d\n", |
| 659 | __func__, vreg_on ? "" : "de-", rc); |
| 660 | goto vreg_fail; |
| 661 | } |
| 662 | return 0; |
| 663 | |
| 664 | vreg_fail: |
| 665 | while (i--) |
| 666 | !vreg_on ? regulator_enable(vregs_isa1200[i]) : |
| 667 | regulator_disable(vregs_isa1200[i]); |
| 668 | return rc; |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 669 | } |
| 670 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 671 | static int isa1200_dev_setup(bool enable) |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 672 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 673 | int i, rc; |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 674 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 675 | if (enable == true) { |
| 676 | for (i = 0; i < ARRAY_SIZE(vregs_isa1200_name); i++) { |
| 677 | vregs_isa1200[i] = regulator_get(NULL, |
| 678 | vregs_isa1200_name[i]); |
| 679 | if (IS_ERR(vregs_isa1200[i])) { |
| 680 | pr_err("%s: regulator get of %s failed (%ld)\n", |
| 681 | __func__, vregs_isa1200_name[i], |
| 682 | PTR_ERR(vregs_isa1200[i])); |
| 683 | rc = PTR_ERR(vregs_isa1200[i]); |
| 684 | goto vreg_get_fail; |
| 685 | } |
| 686 | rc = regulator_set_voltage(vregs_isa1200[i], |
| 687 | vregs_isa1200_val[i], vregs_isa1200_val[i]); |
| 688 | if (rc) { |
| 689 | pr_err("%s: regulator_set_voltage(%s) failed\n", |
| 690 | __func__, vregs_isa1200_name[i]); |
| 691 | goto vreg_get_fail; |
| 692 | } |
| 693 | } |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 694 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 695 | rc = gpio_request(GPIO_HAP_SHIFT_LVL_OE, "haptics_shft_lvl_oe"); |
| 696 | if (rc) { |
| 697 | pr_err("%s: unable to request gpio %d (%d)\n", |
| 698 | __func__, GPIO_HAP_SHIFT_LVL_OE, rc); |
| 699 | goto vreg_get_fail; |
| 700 | } |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 701 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 702 | rc = gpio_direction_output(GPIO_HAP_SHIFT_LVL_OE, 1); |
| 703 | if (rc) { |
| 704 | pr_err("%s: Unable to set direction\n", __func__);; |
| 705 | goto free_gpio; |
| 706 | } |
| 707 | |
| 708 | xo_handle_a1 = msm_xo_get(MSM_XO_TCXO_A1, "isa1200"); |
| 709 | if (IS_ERR(xo_handle_a1)) { |
| 710 | rc = PTR_ERR(xo_handle_a1); |
| 711 | pr_err("%s: failed to get the handle for A1(%d)\n", |
| 712 | __func__, rc); |
| 713 | goto gpio_set_dir; |
| 714 | } |
| 715 | } else { |
| 716 | gpio_set_value(GPIO_HAP_SHIFT_LVL_OE, 0); |
| 717 | gpio_free(GPIO_HAP_SHIFT_LVL_OE); |
| 718 | |
| 719 | for (i = 0; i < ARRAY_SIZE(vregs_isa1200_name); i++) |
| 720 | regulator_put(vregs_isa1200[i]); |
| 721 | |
| 722 | msm_xo_put(xo_handle_a1); |
| 723 | } |
| 724 | |
| 725 | return 0; |
| 726 | gpio_set_dir: |
| 727 | gpio_set_value(GPIO_HAP_SHIFT_LVL_OE, 0); |
| 728 | free_gpio: |
| 729 | gpio_free(GPIO_HAP_SHIFT_LVL_OE); |
| 730 | vreg_get_fail: |
| 731 | while (i) |
| 732 | regulator_put(vregs_isa1200[--i]); |
| 733 | return rc; |
| 734 | } |
| 735 | |
| 736 | #define PMIC_GPIO_HAP_ENABLE 18 /* PMIC GPIO Number 19 */ |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 737 | #define PMIC_GPIO_HAP_LDO_ENABLE 5 /* PMIC GPIO Number 6 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 738 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 739 | .name = "vibrator", |
| 740 | .power_on = isa1200_power, |
| 741 | .dev_setup = isa1200_dev_setup, |
| 742 | /*gpio to enable haptic*/ |
| 743 | .hap_en_gpio = PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_ENABLE), |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 744 | .hap_len_gpio = PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_LDO_ENABLE), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 745 | .max_timeout = 15000, |
| 746 | .mode_ctrl = PWM_GEN_MODE, |
| 747 | .pwm_fd = { |
| 748 | .pwm_div = 256, |
| 749 | }, |
| 750 | .is_erm = false, |
| 751 | .smart_en = true, |
| 752 | .ext_clk_en = true, |
| 753 | .chip_en = 1, |
| 754 | }; |
| 755 | |
| 756 | static struct i2c_board_info msm_isa1200_board_info[] = { |
| 757 | { |
| 758 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 759 | .platform_data = &isa1200_1_pdata, |
| 760 | }, |
| 761 | }; |
| 762 | #endif |
| 763 | |
| 764 | #if defined(CONFIG_BATTERY_BQ27520) || \ |
| 765 | defined(CONFIG_BATTERY_BQ27520_MODULE) |
| 766 | static struct bq27520_platform_data bq27520_pdata = { |
| 767 | .name = "fuel-gauge", |
| 768 | .vreg_name = "8058_s3", |
| 769 | .vreg_value = 1800000, |
| 770 | .soc_int = GPIO_BATT_GAUGE_INT_N, |
| 771 | .bi_tout = GPIO_CAP_GAUGE_BI_TOUT, |
| 772 | .chip_en = GPIO_BATT_GAUGE_EN, |
| 773 | .enable_dlog = 0, /* if enable coulomb counter logger */ |
| 774 | }; |
| 775 | |
| 776 | static struct i2c_board_info msm_bq27520_board_info[] = { |
| 777 | { |
| 778 | I2C_BOARD_INFO("bq27520", 0xaa>>1), |
| 779 | .platform_data = &bq27520_pdata, |
| 780 | }, |
| 781 | }; |
| 782 | #endif |
| 783 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 784 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 785 | { |
| 786 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 787 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 788 | true, |
| 789 | 1, 8000, 100000, 1, |
| 790 | }, |
| 791 | |
| 792 | { |
| 793 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 794 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 795 | true, |
| 796 | 1500, 5000, 60100000, 3000, |
| 797 | }, |
| 798 | |
| 799 | { |
| 800 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 801 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 802 | false, |
| 803 | 1800, 5000, 60350000, 3500, |
| 804 | }, |
| 805 | { |
| 806 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 807 | MSM_RPMRS_LIMITS(OFF, ACTIVE, MAX, ACTIVE), |
| 808 | false, |
| 809 | 3800, 4500, 65350000, 5500, |
| 810 | }, |
| 811 | |
| 812 | { |
| 813 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 814 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), |
| 815 | false, |
| 816 | 2800, 2500, 66850000, 4800, |
| 817 | }, |
| 818 | |
| 819 | { |
| 820 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 821 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 822 | false, |
| 823 | 4800, 2000, 71850000, 6800, |
| 824 | }, |
| 825 | |
| 826 | { |
| 827 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 828 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 829 | false, |
| 830 | 6800, 500, 75850000, 8800, |
| 831 | }, |
| 832 | |
| 833 | { |
| 834 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 835 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 836 | false, |
| 837 | 7800, 0, 76350000, 9800, |
| 838 | }, |
| 839 | }; |
| 840 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 841 | static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = { |
| 842 | .levels = &msm_rpmrs_levels[0], |
| 843 | .num_levels = ARRAY_SIZE(msm_rpmrs_levels), |
| 844 | .vdd_mem_levels = { |
| 845 | [MSM_RPMRS_VDD_MEM_RET_LOW] = 500, |
| 846 | [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750, |
| 847 | [MSM_RPMRS_VDD_MEM_ACTIVE] = 1000, |
Matt Wagantall | 2ecbec2 | 2012-03-13 23:18:07 -0700 | [diff] [blame] | 848 | [MSM_RPMRS_VDD_MEM_MAX] = 1325, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 849 | }, |
| 850 | .vdd_dig_levels = { |
| 851 | [MSM_RPMRS_VDD_DIG_RET_LOW] = 500, |
| 852 | [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750, |
| 853 | [MSM_RPMRS_VDD_DIG_ACTIVE] = 1000, |
| 854 | [MSM_RPMRS_VDD_DIG_MAX] = 1250, |
| 855 | }, |
| 856 | .vdd_mask = 0xFFF, |
| 857 | .rpmrs_target_id = { |
| 858 | [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK, |
| 859 | [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_APPS_L2_CACHE_CTL, |
| 860 | [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_SMPS1_0, |
| 861 | [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_SMPS1_1, |
| 862 | [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_SMPS0_0, |
| 863 | [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_SMPS0_1, |
| 864 | [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_TRIGGER_SET_FROM, |
| 865 | }, |
| 866 | }; |
| 867 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 868 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 869 | .mode = MSM_PM_BOOT_CONFIG_TZ, |
| 870 | }; |
| 871 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 872 | #if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE) |
| 873 | |
| 874 | #define ISP1763_INT_GPIO 117 |
| 875 | #define ISP1763_RST_GPIO 152 |
| 876 | static struct resource isp1763_resources[] = { |
| 877 | [0] = { |
| 878 | .flags = IORESOURCE_MEM, |
| 879 | .start = 0x1D000000, |
| 880 | .end = 0x1D005FFF, /* 24KB */ |
| 881 | }, |
| 882 | [1] = { |
| 883 | .flags = IORESOURCE_IRQ, |
| 884 | }, |
| 885 | }; |
| 886 | static void __init msm8x60_cfg_isp1763(void) |
| 887 | { |
| 888 | isp1763_resources[1].start = gpio_to_irq(ISP1763_INT_GPIO); |
| 889 | isp1763_resources[1].end = gpio_to_irq(ISP1763_INT_GPIO); |
| 890 | } |
| 891 | |
| 892 | static int isp1763_setup_gpio(int enable) |
| 893 | { |
| 894 | int status = 0; |
| 895 | |
| 896 | if (enable) { |
| 897 | status = gpio_request(ISP1763_INT_GPIO, "isp1763_usb"); |
| 898 | if (status) { |
| 899 | pr_err("%s:Failed to request GPIO %d\n", |
| 900 | __func__, ISP1763_INT_GPIO); |
| 901 | return status; |
| 902 | } |
| 903 | status = gpio_direction_input(ISP1763_INT_GPIO); |
| 904 | if (status) { |
| 905 | pr_err("%s:Failed to configure GPIO %d\n", |
| 906 | __func__, ISP1763_INT_GPIO); |
| 907 | goto gpio_free_int; |
| 908 | } |
| 909 | status = gpio_request(ISP1763_RST_GPIO, "isp1763_usb"); |
| 910 | if (status) { |
| 911 | pr_err("%s:Failed to request GPIO %d\n", |
| 912 | __func__, ISP1763_RST_GPIO); |
| 913 | goto gpio_free_int; |
| 914 | } |
| 915 | status = gpio_direction_output(ISP1763_RST_GPIO, 1); |
| 916 | if (status) { |
| 917 | pr_err("%s:Failed to configure GPIO %d\n", |
| 918 | __func__, ISP1763_RST_GPIO); |
| 919 | goto gpio_free_rst; |
| 920 | } |
| 921 | pr_debug("\nISP GPIO configuration done\n"); |
| 922 | return status; |
| 923 | } |
| 924 | |
| 925 | gpio_free_rst: |
| 926 | gpio_free(ISP1763_RST_GPIO); |
| 927 | gpio_free_int: |
| 928 | gpio_free(ISP1763_INT_GPIO); |
| 929 | |
| 930 | return status; |
| 931 | } |
| 932 | static struct isp1763_platform_data isp1763_pdata = { |
| 933 | .reset_gpio = ISP1763_RST_GPIO, |
| 934 | .setup_gpio = isp1763_setup_gpio |
| 935 | }; |
| 936 | |
| 937 | static struct platform_device isp1763_device = { |
| 938 | .name = "isp1763_usb", |
| 939 | .num_resources = ARRAY_SIZE(isp1763_resources), |
| 940 | .resource = isp1763_resources, |
| 941 | .dev = { |
| 942 | .platform_data = &isp1763_pdata |
| 943 | } |
| 944 | }; |
| 945 | #endif |
| 946 | |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 947 | #if defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_EHCI_MSM_72K) |
Anji jonnala | eb9e60d | 2011-10-05 12:19:46 +0530 | [diff] [blame] | 948 | static struct msm_otg_platform_data msm_otg_pdata; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 949 | static struct regulator *ldo6_3p3; |
| 950 | static struct regulator *ldo7_1p8; |
| 951 | static struct regulator *vdd_cx; |
| 952 | #define PMICID_INT PM8058_GPIO_IRQ(PM8058_IRQ_BASE, 36) |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 953 | #define PMIC_ID_GPIO 36 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 954 | notify_vbus_state notify_vbus_state_func_ptr; |
| 955 | static int usb_phy_susp_dig_vol = 750000; |
| 956 | static int pmic_id_notif_supported; |
| 957 | |
| 958 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 959 | #define USB_PMIC_ID_DET_DELAY msecs_to_jiffies(100) |
| 960 | struct delayed_work pmic_id_det; |
| 961 | |
| 962 | static int __init usb_id_pin_rework_setup(char *support) |
| 963 | { |
| 964 | if (strncmp(support, "true", 4) == 0) |
| 965 | pmic_id_notif_supported = 1; |
| 966 | |
| 967 | return 1; |
| 968 | } |
| 969 | __setup("usb_id_pin_rework=", usb_id_pin_rework_setup); |
| 970 | |
| 971 | static void pmic_id_detect(struct work_struct *w) |
| 972 | { |
| 973 | int val = gpio_get_value_cansleep(PM8058_GPIO_PM_TO_SYS(36)); |
| 974 | pr_debug("%s(): gpio_read_value = %d\n", __func__, val); |
| 975 | |
| 976 | if (notify_vbus_state_func_ptr) |
| 977 | (*notify_vbus_state_func_ptr) (val); |
| 978 | } |
| 979 | |
| 980 | static irqreturn_t pmic_id_on_irq(int irq, void *data) |
| 981 | { |
| 982 | /* |
| 983 | * Spurious interrupts are observed on pmic gpio line |
| 984 | * even though there is no state change on USB ID. Schedule the |
| 985 | * work to to allow debounce on gpio |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 986 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 987 | schedule_delayed_work(&pmic_id_det, USB_PMIC_ID_DET_DELAY); |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 988 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 989 | return IRQ_HANDLED; |
| 990 | } |
| 991 | |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 992 | static int msm_hsusb_phy_id_setup_init(int init) |
| 993 | { |
| 994 | unsigned ret; |
| 995 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 996 | struct pm8xxx_mpp_config_data hsusb_phy_mpp = { |
| 997 | .type = PM8XXX_MPP_TYPE_D_OUTPUT, |
| 998 | .level = PM8901_MPP_DIG_LEVEL_L5, |
| 999 | }; |
| 1000 | |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1001 | if (init) { |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 1002 | hsusb_phy_mpp.control = PM8XXX_MPP_DOUT_CTRL_HIGH; |
| 1003 | ret = pm8xxx_mpp_config(PM8901_MPP_PM_TO_SYS(1), |
| 1004 | &hsusb_phy_mpp); |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1005 | if (ret < 0) |
| 1006 | pr_err("%s:MPP2 configuration failed\n", __func__); |
| 1007 | } else { |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 1008 | hsusb_phy_mpp.control = PM8XXX_MPP_DOUT_CTRL_LOW; |
| 1009 | ret = pm8xxx_mpp_config(PM8901_MPP_PM_TO_SYS(1), |
| 1010 | &hsusb_phy_mpp); |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1011 | if (ret < 0) |
| 1012 | pr_err("%s:MPP2 un config failed\n", __func__); |
| 1013 | } |
| 1014 | return ret; |
| 1015 | } |
| 1016 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1017 | static int msm_hsusb_pmic_id_notif_init(void (*callback)(int online), int init) |
| 1018 | { |
| 1019 | unsigned ret = -ENODEV; |
| 1020 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1021 | struct pm_gpio pmic_id_cfg = { |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1022 | .direction = PM_GPIO_DIR_IN, |
| 1023 | .pull = PM_GPIO_PULL_UP_1P5, |
| 1024 | .function = PM_GPIO_FUNC_NORMAL, |
| 1025 | .vin_sel = 2, |
| 1026 | .inv_int_pol = 0, |
| 1027 | }; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1028 | struct pm_gpio pmic_id_uncfg = { |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1029 | .direction = PM_GPIO_DIR_IN, |
| 1030 | .pull = PM_GPIO_PULL_NO, |
| 1031 | .function = PM_GPIO_FUNC_NORMAL, |
| 1032 | .vin_sel = 2, |
| 1033 | .inv_int_pol = 0, |
| 1034 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1035 | if (!callback) |
| 1036 | return -EINVAL; |
| 1037 | |
| 1038 | if (machine_is_msm8x60_fluid()) |
| 1039 | return -ENOTSUPP; |
| 1040 | |
| 1041 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) != 2) { |
| 1042 | pr_debug("%s: USB_ID pin is not routed to PMIC" |
| 1043 | "on V1 surf/ffa\n", __func__); |
| 1044 | return -ENOTSUPP; |
| 1045 | } |
| 1046 | |
Manu Gautam | 62158eb | 2011-11-24 16:20:46 +0530 | [diff] [blame] | 1047 | if ((machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa() || |
| 1048 | machine_is_msm8x60_ffa()) && !pmic_id_notif_supported) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1049 | pr_debug("%s: USB_ID is not routed to PMIC" |
| 1050 | "on V2 ffa\n", __func__); |
| 1051 | return -ENOTSUPP; |
| 1052 | } |
| 1053 | |
| 1054 | usb_phy_susp_dig_vol = 500000; |
| 1055 | |
| 1056 | if (init) { |
| 1057 | notify_vbus_state_func_ptr = callback; |
Manu Gautam | e8420ef | 2011-11-11 15:37:21 +0530 | [diff] [blame] | 1058 | INIT_DELAYED_WORK(&pmic_id_det, pmic_id_detect); |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1059 | ret = pm8xxx_gpio_config(PM8058_GPIO_PM_TO_SYS(PMIC_ID_GPIO), |
| 1060 | &pmic_id_cfg); |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1061 | if (ret) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1062 | pr_err("%s:return val of pm8xxx_gpio_config: %d\n", |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1063 | __func__, ret); |
| 1064 | return ret; |
| 1065 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1066 | ret = request_threaded_irq(PMICID_INT, NULL, pmic_id_on_irq, |
| 1067 | (IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING), |
| 1068 | "msm_otg_id", NULL); |
| 1069 | if (ret) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1070 | pr_err("%s:pmic_usb_id interrupt registration failed", |
| 1071 | __func__); |
| 1072 | return ret; |
| 1073 | } |
Anji jonnala | eb9e60d | 2011-10-05 12:19:46 +0530 | [diff] [blame] | 1074 | msm_otg_pdata.pmic_id_irq = PMICID_INT; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1075 | } else { |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1076 | usb_phy_susp_dig_vol = 750000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1077 | free_irq(PMICID_INT, 0); |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1078 | ret = pm8xxx_gpio_config(PM8058_GPIO_PM_TO_SYS(PMIC_ID_GPIO), |
| 1079 | &pmic_id_uncfg); |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1080 | if (ret) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1081 | pr_err("%s: return val of pm8xxx_gpio_config: %d\n", |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1082 | __func__, ret); |
| 1083 | return ret; |
| 1084 | } |
Anji jonnala | eb9e60d | 2011-10-05 12:19:46 +0530 | [diff] [blame] | 1085 | msm_otg_pdata.pmic_id_irq = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1086 | cancel_delayed_work_sync(&pmic_id_det); |
| 1087 | notify_vbus_state_func_ptr = NULL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1088 | } |
| 1089 | return 0; |
| 1090 | } |
| 1091 | #endif |
| 1092 | |
| 1093 | #define USB_PHY_OPERATIONAL_MIN_VDD_DIG_VOL 1000000 |
| 1094 | #define USB_PHY_MAX_VDD_DIG_VOL 1320000 |
| 1095 | static int msm_hsusb_init_vddcx(int init) |
| 1096 | { |
| 1097 | int ret = 0; |
| 1098 | |
| 1099 | if (init) { |
| 1100 | vdd_cx = regulator_get(NULL, "8058_s1"); |
| 1101 | if (IS_ERR(vdd_cx)) { |
| 1102 | return PTR_ERR(vdd_cx); |
| 1103 | } |
| 1104 | |
| 1105 | ret = regulator_set_voltage(vdd_cx, |
| 1106 | USB_PHY_OPERATIONAL_MIN_VDD_DIG_VOL, |
| 1107 | USB_PHY_MAX_VDD_DIG_VOL); |
| 1108 | if (ret) { |
| 1109 | pr_err("%s: unable to set the voltage for regulator" |
| 1110 | "vdd_cx\n", __func__); |
| 1111 | regulator_put(vdd_cx); |
| 1112 | return ret; |
| 1113 | } |
| 1114 | |
| 1115 | ret = regulator_enable(vdd_cx); |
| 1116 | if (ret) { |
| 1117 | pr_err("%s: unable to enable regulator" |
| 1118 | "vdd_cx\n", __func__); |
| 1119 | regulator_put(vdd_cx); |
| 1120 | } |
| 1121 | } else { |
| 1122 | ret = regulator_disable(vdd_cx); |
| 1123 | if (ret) { |
| 1124 | pr_err("%s: Unable to disable the regulator:" |
| 1125 | "vdd_cx\n", __func__); |
| 1126 | return ret; |
| 1127 | } |
| 1128 | |
| 1129 | regulator_put(vdd_cx); |
| 1130 | } |
| 1131 | |
| 1132 | return ret; |
| 1133 | } |
| 1134 | |
| 1135 | static int msm_hsusb_config_vddcx(int high) |
| 1136 | { |
| 1137 | int max_vol = USB_PHY_MAX_VDD_DIG_VOL; |
| 1138 | int min_vol; |
| 1139 | int ret; |
| 1140 | |
| 1141 | if (high) |
| 1142 | min_vol = USB_PHY_OPERATIONAL_MIN_VDD_DIG_VOL; |
| 1143 | else |
| 1144 | min_vol = usb_phy_susp_dig_vol; |
| 1145 | |
| 1146 | ret = regulator_set_voltage(vdd_cx, min_vol, max_vol); |
| 1147 | if (ret) { |
| 1148 | pr_err("%s: unable to set the voltage for regulator" |
| 1149 | "vdd_cx\n", __func__); |
| 1150 | return ret; |
| 1151 | } |
| 1152 | |
| 1153 | pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol); |
| 1154 | |
| 1155 | return ret; |
| 1156 | } |
| 1157 | |
| 1158 | #define USB_PHY_3P3_VOL_MIN 3050000 /* uV */ |
| 1159 | #define USB_PHY_3P3_VOL_MAX 3050000 /* uV */ |
| 1160 | #define USB_PHY_3P3_HPM_LOAD 50000 /* uA */ |
| 1161 | #define USB_PHY_3P3_LPM_LOAD 4000 /* uA */ |
| 1162 | |
| 1163 | #define USB_PHY_1P8_VOL_MIN 1800000 /* uV */ |
| 1164 | #define USB_PHY_1P8_VOL_MAX 1800000 /* uV */ |
| 1165 | #define USB_PHY_1P8_HPM_LOAD 50000 /* uA */ |
| 1166 | #define USB_PHY_1P8_LPM_LOAD 4000 /* uA */ |
| 1167 | static int msm_hsusb_ldo_init(int init) |
| 1168 | { |
| 1169 | int rc = 0; |
| 1170 | |
| 1171 | if (init) { |
| 1172 | ldo6_3p3 = regulator_get(NULL, "8058_l6"); |
| 1173 | if (IS_ERR(ldo6_3p3)) |
| 1174 | return PTR_ERR(ldo6_3p3); |
| 1175 | |
| 1176 | ldo7_1p8 = regulator_get(NULL, "8058_l7"); |
| 1177 | if (IS_ERR(ldo7_1p8)) { |
| 1178 | rc = PTR_ERR(ldo7_1p8); |
| 1179 | goto put_3p3; |
| 1180 | } |
| 1181 | |
| 1182 | rc = regulator_set_voltage(ldo6_3p3, USB_PHY_3P3_VOL_MIN, |
| 1183 | USB_PHY_3P3_VOL_MAX); |
| 1184 | if (rc) { |
| 1185 | pr_err("%s: Unable to set voltage level for" |
| 1186 | "ldo6_3p3 regulator\n", __func__); |
| 1187 | goto put_1p8; |
| 1188 | } |
| 1189 | rc = regulator_enable(ldo6_3p3); |
| 1190 | if (rc) { |
| 1191 | pr_err("%s: Unable to enable the regulator:" |
| 1192 | "ldo6_3p3\n", __func__); |
| 1193 | goto put_1p8; |
| 1194 | } |
| 1195 | rc = regulator_set_voltage(ldo7_1p8, USB_PHY_1P8_VOL_MIN, |
| 1196 | USB_PHY_1P8_VOL_MAX); |
| 1197 | if (rc) { |
| 1198 | pr_err("%s: Unable to set voltage level for" |
| 1199 | "ldo7_1p8 regulator\n", __func__); |
| 1200 | goto disable_3p3; |
| 1201 | } |
| 1202 | rc = regulator_enable(ldo7_1p8); |
| 1203 | if (rc) { |
| 1204 | pr_err("%s: Unable to enable the regulator:" |
| 1205 | "ldo7_1p8\n", __func__); |
| 1206 | goto disable_3p3; |
| 1207 | } |
| 1208 | |
| 1209 | return 0; |
| 1210 | } |
| 1211 | |
| 1212 | regulator_disable(ldo7_1p8); |
| 1213 | disable_3p3: |
| 1214 | regulator_disable(ldo6_3p3); |
| 1215 | put_1p8: |
| 1216 | regulator_put(ldo7_1p8); |
| 1217 | put_3p3: |
| 1218 | regulator_put(ldo6_3p3); |
| 1219 | return rc; |
| 1220 | } |
| 1221 | |
| 1222 | static int msm_hsusb_ldo_enable(int on) |
| 1223 | { |
| 1224 | int ret = 0; |
| 1225 | |
| 1226 | if (!ldo7_1p8 || IS_ERR(ldo7_1p8)) { |
| 1227 | pr_err("%s: ldo7_1p8 is not initialized\n", __func__); |
| 1228 | return -ENODEV; |
| 1229 | } |
| 1230 | |
| 1231 | if (!ldo6_3p3 || IS_ERR(ldo6_3p3)) { |
| 1232 | pr_err("%s: ldo6_3p3 is not initialized\n", __func__); |
| 1233 | return -ENODEV; |
| 1234 | } |
| 1235 | |
| 1236 | if (on) { |
| 1237 | ret = regulator_set_optimum_mode(ldo7_1p8, |
| 1238 | USB_PHY_1P8_HPM_LOAD); |
| 1239 | if (ret < 0) { |
| 1240 | pr_err("%s: Unable to set HPM of the regulator:" |
| 1241 | "ldo7_1p8\n", __func__); |
| 1242 | return ret; |
| 1243 | } |
| 1244 | ret = regulator_set_optimum_mode(ldo6_3p3, |
| 1245 | USB_PHY_3P3_HPM_LOAD); |
| 1246 | if (ret < 0) { |
| 1247 | pr_err("%s: Unable to set HPM of the regulator:" |
| 1248 | "ldo6_3p3\n", __func__); |
| 1249 | regulator_set_optimum_mode(ldo7_1p8, |
| 1250 | USB_PHY_1P8_LPM_LOAD); |
| 1251 | return ret; |
| 1252 | } |
| 1253 | } else { |
| 1254 | ret = regulator_set_optimum_mode(ldo7_1p8, |
| 1255 | USB_PHY_1P8_LPM_LOAD); |
| 1256 | if (ret < 0) |
| 1257 | pr_err("%s: Unable to set LPM of the regulator:" |
| 1258 | "ldo7_1p8\n", __func__); |
| 1259 | ret = regulator_set_optimum_mode(ldo6_3p3, |
| 1260 | USB_PHY_3P3_LPM_LOAD); |
| 1261 | if (ret < 0) |
| 1262 | pr_err("%s: Unable to set LPM of the regulator:" |
| 1263 | "ldo6_3p3\n", __func__); |
| 1264 | } |
| 1265 | |
| 1266 | pr_debug("reg (%s)\n", on ? "HPM" : "LPM"); |
| 1267 | return ret < 0 ? ret : 0; |
| 1268 | } |
| 1269 | #endif |
| 1270 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 1271 | #if defined(CONFIG_SMB137B_CHARGER) || defined(CONFIG_SMB137B_CHARGER_MODULE) |
| 1272 | static void msm_hsusb_smb137b_vbus_power(unsigned phy_info, int on) |
| 1273 | { |
| 1274 | static int vbus_is_on; |
| 1275 | |
| 1276 | /* If VBUS is already on (or off), do nothing. */ |
| 1277 | if (on == vbus_is_on) |
| 1278 | return; |
| 1279 | smb137b_otg_power(on); |
| 1280 | vbus_is_on = on; |
| 1281 | } |
| 1282 | #endif |
| 1283 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 1284 | { |
| 1285 | static struct regulator *votg_5v_switch; |
| 1286 | static struct regulator *ext_5v_reg; |
| 1287 | static int vbus_is_on; |
| 1288 | |
| 1289 | /* If VBUS is already on (or off), do nothing. */ |
| 1290 | if (on == vbus_is_on) |
| 1291 | return; |
| 1292 | |
| 1293 | if (!votg_5v_switch) { |
| 1294 | votg_5v_switch = regulator_get(NULL, "8901_usb_otg"); |
| 1295 | if (IS_ERR(votg_5v_switch)) { |
| 1296 | pr_err("%s: unable to get votg_5v_switch\n", __func__); |
| 1297 | return; |
| 1298 | } |
| 1299 | } |
| 1300 | if (!ext_5v_reg) { |
| 1301 | ext_5v_reg = regulator_get(NULL, "8901_mpp0"); |
| 1302 | if (IS_ERR(ext_5v_reg)) { |
| 1303 | pr_err("%s: unable to get ext_5v_reg\n", __func__); |
| 1304 | return; |
| 1305 | } |
| 1306 | } |
| 1307 | if (on) { |
| 1308 | if (regulator_enable(ext_5v_reg)) { |
| 1309 | pr_err("%s: Unable to enable the regulator:" |
| 1310 | " ext_5v_reg\n", __func__); |
| 1311 | return; |
| 1312 | } |
| 1313 | if (regulator_enable(votg_5v_switch)) { |
| 1314 | pr_err("%s: Unable to enable the regulator:" |
| 1315 | " votg_5v_switch\n", __func__); |
| 1316 | return; |
| 1317 | } |
| 1318 | } else { |
| 1319 | if (regulator_disable(votg_5v_switch)) |
| 1320 | pr_err("%s: Unable to enable the regulator:" |
| 1321 | " votg_5v_switch\n", __func__); |
| 1322 | if (regulator_disable(ext_5v_reg)) |
| 1323 | pr_err("%s: Unable to enable the regulator:" |
| 1324 | " ext_5v_reg\n", __func__); |
| 1325 | } |
| 1326 | |
| 1327 | vbus_is_on = on; |
| 1328 | } |
| 1329 | |
| 1330 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 1331 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 1332 | .power_budget = 390, |
| 1333 | }; |
| 1334 | #endif |
| 1335 | |
| 1336 | #ifdef CONFIG_BATTERY_MSM8X60 |
| 1337 | static int msm_hsusb_pmic_vbus_notif_init(void (*callback)(int online), |
| 1338 | int init) |
| 1339 | { |
| 1340 | int ret = -ENOTSUPP; |
| 1341 | |
| 1342 | #if defined(CONFIG_SMB137B_CHARGER) || defined(CONFIG_SMB137B_CHARGER_MODULE) |
| 1343 | if (machine_is_msm8x60_fluid()) { |
| 1344 | if (init) |
| 1345 | msm_charger_register_vbus_sn(callback); |
| 1346 | else |
| 1347 | msm_charger_unregister_vbus_sn(callback); |
| 1348 | return 0; |
| 1349 | } |
| 1350 | #endif |
| 1351 | /* ID and VBUS lines are connected to pmic on 8660.V2.SURF, |
| 1352 | * hence, irrespective of either peripheral only mode or |
| 1353 | * OTG (host and peripheral) modes, can depend on pmic for |
| 1354 | * vbus notifications |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 1355 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1356 | if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) |
| 1357 | && (machine_is_msm8x60_surf() || |
| 1358 | pmic_id_notif_supported)) { |
| 1359 | if (init) |
| 1360 | ret = msm_charger_register_vbus_sn(callback); |
| 1361 | else { |
| 1362 | msm_charger_unregister_vbus_sn(callback); |
| 1363 | ret = 0; |
| 1364 | } |
| 1365 | } else { |
| 1366 | #if !defined(CONFIG_USB_EHCI_MSM_72K) |
| 1367 | if (init) |
| 1368 | ret = msm_charger_register_vbus_sn(callback); |
| 1369 | else { |
| 1370 | msm_charger_unregister_vbus_sn(callback); |
| 1371 | ret = 0; |
| 1372 | } |
| 1373 | #endif |
| 1374 | } |
| 1375 | return ret; |
| 1376 | } |
| 1377 | #endif |
| 1378 | |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 1379 | #if defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_EHCI_MSM_72K) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1380 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 1381 | /* if usb link is in sps there is no need for |
| 1382 | * usb pclk as dayatona fabric clock will be |
| 1383 | * used instead |
| 1384 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1385 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 1386 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 1387 | .se1_gating = SE1_GATING_DISABLE, |
Chandra Devireddy | b3fc78c | 2011-08-30 17:25:55 +0530 | [diff] [blame] | 1388 | .bam_disable = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1389 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 1390 | .pmic_id_notif_init = msm_hsusb_pmic_id_notif_init, |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 1391 | .phy_id_setup_init = msm_hsusb_phy_id_setup_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1392 | #endif |
| 1393 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 1394 | .vbus_power = msm_hsusb_vbus_power, |
| 1395 | #endif |
| 1396 | #ifdef CONFIG_BATTERY_MSM8X60 |
| 1397 | .pmic_vbus_notif_init = msm_hsusb_pmic_vbus_notif_init, |
| 1398 | #endif |
| 1399 | .ldo_init = msm_hsusb_ldo_init, |
| 1400 | .ldo_enable = msm_hsusb_ldo_enable, |
| 1401 | .config_vddcx = msm_hsusb_config_vddcx, |
| 1402 | .init_vddcx = msm_hsusb_init_vddcx, |
| 1403 | #ifdef CONFIG_BATTERY_MSM8X60 |
| 1404 | .chg_vbus_draw = msm_charger_vbus_draw, |
| 1405 | #endif |
| 1406 | }; |
| 1407 | #endif |
| 1408 | |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 1409 | #ifdef CONFIG_USB_MSM_72K |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1410 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 1411 | .is_phy_status_timer_on = 1, |
| 1412 | }; |
| 1413 | #endif |
| 1414 | |
| 1415 | #ifdef CONFIG_USB_G_ANDROID |
| 1416 | |
| 1417 | #define PID_MAGIC_ID 0x71432909 |
| 1418 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 1419 | #define SERIAL_NUMBER_LENGTH 127 |
| 1420 | #define DLOAD_USB_BASE_ADD 0x2A05F0C8 |
| 1421 | |
| 1422 | struct magic_num_struct { |
| 1423 | uint32_t pid; |
| 1424 | uint32_t serial_num; |
| 1425 | }; |
| 1426 | |
| 1427 | struct dload_struct { |
| 1428 | uint32_t reserved1; |
| 1429 | uint32_t reserved2; |
| 1430 | uint32_t reserved3; |
| 1431 | uint16_t reserved4; |
| 1432 | uint16_t pid; |
| 1433 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 1434 | uint16_t reserved5; |
| 1435 | struct magic_num_struct |
| 1436 | magic_struct; |
| 1437 | }; |
| 1438 | |
| 1439 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 1440 | { |
| 1441 | struct dload_struct __iomem *dload = 0; |
| 1442 | |
| 1443 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 1444 | if (!dload) { |
| 1445 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 1446 | __func__, DLOAD_USB_BASE_ADD); |
| 1447 | return -ENXIO; |
| 1448 | } |
| 1449 | |
| 1450 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 1451 | __func__, dload, pid, snum); |
| 1452 | /* update pid */ |
| 1453 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 1454 | dload->pid = pid; |
| 1455 | |
| 1456 | /* update serial number */ |
| 1457 | dload->magic_struct.serial_num = 0; |
| 1458 | if (!snum) |
| 1459 | return 0; |
| 1460 | |
| 1461 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 1462 | strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 1463 | dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0'; |
| 1464 | |
| 1465 | iounmap(dload); |
| 1466 | |
| 1467 | return 0; |
| 1468 | } |
| 1469 | |
| 1470 | static struct android_usb_platform_data android_usb_pdata = { |
| 1471 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 1472 | }; |
| 1473 | |
| 1474 | static struct platform_device android_usb_device = { |
| 1475 | .name = "android_usb", |
| 1476 | .id = -1, |
| 1477 | .dev = { |
| 1478 | .platform_data = &android_usb_pdata, |
| 1479 | }, |
| 1480 | }; |
| 1481 | |
| 1482 | |
| 1483 | #endif |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 1484 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1485 | #ifdef CONFIG_MSM_VPE |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 1486 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1487 | static struct resource msm_vpe_resources[] = { |
| 1488 | { |
| 1489 | .start = 0x05300000, |
| 1490 | .end = 0x05300000 + SZ_1M - 1, |
| 1491 | .flags = IORESOURCE_MEM, |
| 1492 | }, |
| 1493 | { |
| 1494 | .start = INT_VPE, |
| 1495 | .end = INT_VPE, |
| 1496 | .flags = IORESOURCE_IRQ, |
| 1497 | }, |
| 1498 | }; |
| 1499 | |
| 1500 | static struct platform_device msm_vpe_device = { |
| 1501 | .name = "msm_vpe", |
| 1502 | .id = 0, |
| 1503 | .num_resources = ARRAY_SIZE(msm_vpe_resources), |
| 1504 | .resource = msm_vpe_resources, |
| 1505 | }; |
| 1506 | #endif |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 1507 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1508 | |
| 1509 | #ifdef CONFIG_MSM_CAMERA |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 1510 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1511 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 1512 | #define VFE_CAMIF_TIMER1_GPIO 29 |
| 1513 | #define VFE_CAMIF_TIMER2_GPIO 30 |
| 1514 | #define VFE_CAMIF_TIMER3_GPIO_INT 31 |
| 1515 | #define FUSION_VFE_CAMIF_TIMER1_GPIO 42 |
| 1516 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
| 1517 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_PMIC, |
| 1518 | ._fsrc.pmic_src.num_of_src = 2, |
| 1519 | ._fsrc.pmic_src.low_current = 100, |
| 1520 | ._fsrc.pmic_src.high_current = 300, |
| 1521 | ._fsrc.pmic_src.led_src_1 = PMIC8058_ID_FLASH_LED_0, |
| 1522 | ._fsrc.pmic_src.led_src_2 = PMIC8058_ID_FLASH_LED_1, |
| 1523 | ._fsrc.pmic_src.pmic_set_current = pm8058_set_flash_led_current, |
| 1524 | }; |
| 1525 | #ifdef CONFIG_IMX074 |
| 1526 | static struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = { |
| 1527 | .flash_trigger = VFE_CAMIF_TIMER2_GPIO, |
| 1528 | .flash_charge = VFE_CAMIF_TIMER1_GPIO, |
| 1529 | .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT, |
| 1530 | .flash_recharge_duration = 50000, |
| 1531 | .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT), |
| 1532 | }; |
| 1533 | #endif |
| 1534 | #endif |
| 1535 | |
| 1536 | int msm_cam_gpio_tbl[] = { |
| 1537 | 32,/*CAMIF_MCLK*/ |
| 1538 | 47,/*CAMIF_I2C_DATA*/ |
| 1539 | 48,/*CAMIF_I2C_CLK*/ |
| 1540 | 105,/*STANDBY*/ |
| 1541 | }; |
| 1542 | |
| 1543 | enum msm_cam_stat{ |
| 1544 | MSM_CAM_OFF, |
| 1545 | MSM_CAM_ON, |
| 1546 | }; |
| 1547 | |
| 1548 | static int config_gpio_table(enum msm_cam_stat stat) |
| 1549 | { |
| 1550 | int rc = 0, i = 0; |
| 1551 | if (stat == MSM_CAM_ON) { |
| 1552 | for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++) { |
| 1553 | rc = gpio_request(msm_cam_gpio_tbl[i], "CAM_GPIO"); |
| 1554 | if (unlikely(rc < 0)) { |
| 1555 | pr_err("%s not able to get gpio\n", __func__); |
| 1556 | for (i--; i >= 0; i--) |
| 1557 | gpio_free(msm_cam_gpio_tbl[i]); |
| 1558 | break; |
| 1559 | } |
| 1560 | } |
| 1561 | } else { |
| 1562 | for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++) |
| 1563 | gpio_free(msm_cam_gpio_tbl[i]); |
| 1564 | } |
| 1565 | return rc; |
| 1566 | } |
| 1567 | |
| 1568 | static struct msm_camera_sensor_platform_info sensor_board_info = { |
| 1569 | .mount_angle = 0 |
| 1570 | }; |
| 1571 | |
| 1572 | /*external regulator VREG_5V*/ |
| 1573 | static struct regulator *reg_flash_5V; |
| 1574 | |
| 1575 | static int config_camera_on_gpios_fluid(void) |
| 1576 | { |
| 1577 | int rc = 0; |
| 1578 | |
| 1579 | reg_flash_5V = regulator_get(NULL, "8901_mpp0"); |
| 1580 | if (IS_ERR(reg_flash_5V)) { |
| 1581 | pr_err("'%s' regulator not found, rc=%ld\n", |
| 1582 | "8901_mpp0", IS_ERR(reg_flash_5V)); |
| 1583 | return -ENODEV; |
| 1584 | } |
| 1585 | |
| 1586 | rc = regulator_enable(reg_flash_5V); |
| 1587 | if (rc) { |
| 1588 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 1589 | "8901_mpp0", rc); |
| 1590 | regulator_put(reg_flash_5V); |
| 1591 | return rc; |
| 1592 | } |
| 1593 | |
| 1594 | #ifdef CONFIG_IMX074 |
| 1595 | sensor_board_info.mount_angle = 90; |
| 1596 | #endif |
| 1597 | rc = config_gpio_table(MSM_CAM_ON); |
| 1598 | if (rc < 0) { |
| 1599 | printk(KERN_ERR "%s: CAMSENSOR gpio table request" |
| 1600 | "failed\n", __func__); |
| 1601 | return rc; |
| 1602 | } |
| 1603 | |
| 1604 | rc = gpio_request(GPIO_EXT_CAMIF_PWR_EN, "CAM_EN"); |
| 1605 | if (rc < 0) { |
| 1606 | printk(KERN_ERR "%s: CAMSENSOR gpio %d request" |
| 1607 | "failed\n", __func__, GPIO_EXT_CAMIF_PWR_EN); |
| 1608 | regulator_disable(reg_flash_5V); |
| 1609 | regulator_put(reg_flash_5V); |
| 1610 | return rc; |
| 1611 | } |
| 1612 | gpio_direction_output(GPIO_EXT_CAMIF_PWR_EN, 0); |
| 1613 | msleep(20); |
| 1614 | gpio_set_value_cansleep(GPIO_EXT_CAMIF_PWR_EN, 1); |
| 1615 | |
| 1616 | |
| 1617 | /*Enable LED_FLASH_EN*/ |
| 1618 | rc = gpio_request(GPIO_LED_FLASH_EN, "LED_FLASH_EN"); |
| 1619 | if (rc < 0) { |
| 1620 | printk(KERN_ERR "%s: CAMSENSOR gpio %d request" |
| 1621 | "failed\n", __func__, GPIO_LED_FLASH_EN); |
| 1622 | |
| 1623 | regulator_disable(reg_flash_5V); |
| 1624 | regulator_put(reg_flash_5V); |
| 1625 | config_gpio_table(MSM_CAM_OFF); |
| 1626 | gpio_set_value_cansleep(GPIO_EXT_CAMIF_PWR_EN, 0); |
| 1627 | gpio_free(GPIO_EXT_CAMIF_PWR_EN); |
| 1628 | return rc; |
| 1629 | } |
| 1630 | gpio_direction_output(GPIO_LED_FLASH_EN, 1); |
| 1631 | msleep(20); |
| 1632 | return rc; |
| 1633 | } |
| 1634 | |
| 1635 | |
| 1636 | static void config_camera_off_gpios_fluid(void) |
| 1637 | { |
| 1638 | regulator_disable(reg_flash_5V); |
| 1639 | regulator_put(reg_flash_5V); |
| 1640 | |
| 1641 | gpio_direction_output(GPIO_LED_FLASH_EN, 0); |
| 1642 | gpio_free(GPIO_LED_FLASH_EN); |
| 1643 | |
| 1644 | config_gpio_table(MSM_CAM_OFF); |
| 1645 | |
| 1646 | gpio_set_value_cansleep(GPIO_EXT_CAMIF_PWR_EN, 0); |
| 1647 | gpio_free(GPIO_EXT_CAMIF_PWR_EN); |
| 1648 | } |
| 1649 | static int config_camera_on_gpios(void) |
| 1650 | { |
| 1651 | int rc = 0; |
| 1652 | |
| 1653 | if (machine_is_msm8x60_fluid()) |
| 1654 | return config_camera_on_gpios_fluid(); |
| 1655 | |
| 1656 | rc = config_gpio_table(MSM_CAM_ON); |
| 1657 | if (rc < 0) { |
| 1658 | printk(KERN_ERR "%s: CAMSENSOR gpio table request" |
| 1659 | "failed\n", __func__); |
| 1660 | return rc; |
| 1661 | } |
| 1662 | |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 1663 | if (!machine_is_msm8x60_dragon()) { |
| 1664 | rc = gpio_request(GPIO_EXT_CAMIF_PWR_EN, "CAM_EN"); |
| 1665 | if (rc < 0) { |
| 1666 | config_gpio_table(MSM_CAM_OFF); |
| 1667 | pr_err("%s: CAMSENSOR gpio %d request" |
| 1668 | "failed\n", __func__, GPIO_EXT_CAMIF_PWR_EN); |
| 1669 | return rc; |
| 1670 | } |
| 1671 | gpio_direction_output(GPIO_EXT_CAMIF_PWR_EN, 0); |
| 1672 | msleep(20); |
| 1673 | gpio_set_value_cansleep(GPIO_EXT_CAMIF_PWR_EN, 1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1674 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1675 | |
| 1676 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 1677 | #ifdef CONFIG_IMX074 |
| 1678 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) |
| 1679 | strobe_flash_xenon.flash_charge = FUSION_VFE_CAMIF_TIMER1_GPIO; |
| 1680 | #endif |
| 1681 | #endif |
| 1682 | return rc; |
| 1683 | } |
| 1684 | |
| 1685 | static void config_camera_off_gpios(void) |
| 1686 | { |
| 1687 | if (machine_is_msm8x60_fluid()) |
| 1688 | return config_camera_off_gpios_fluid(); |
| 1689 | |
| 1690 | |
| 1691 | config_gpio_table(MSM_CAM_OFF); |
| 1692 | |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 1693 | if (!machine_is_msm8x60_dragon()) { |
| 1694 | gpio_set_value_cansleep(GPIO_EXT_CAMIF_PWR_EN, 0); |
| 1695 | gpio_free(GPIO_EXT_CAMIF_PWR_EN); |
| 1696 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1697 | } |
| 1698 | |
| 1699 | #ifdef CONFIG_QS_S5K4E1 |
| 1700 | |
| 1701 | #define QS_CAM_HC37_CAM_PD PM8058_GPIO_PM_TO_SYS(26) |
| 1702 | |
| 1703 | static int config_camera_on_gpios_qs_cam_fluid(void) |
| 1704 | { |
| 1705 | int rc = 0; |
| 1706 | |
| 1707 | /* request QS_CAM_HC37_CAM_PD as an output to HC37 ASIC pin CAM_PD */ |
| 1708 | rc = gpio_request(QS_CAM_HC37_CAM_PD, "QS_CAM_HC37_CAM_PD"); |
| 1709 | if (rc < 0) { |
| 1710 | printk(KERN_ERR "%s: QS_CAM_HC37_CAM_PD gpio %d request" |
| 1711 | " failed\n", __func__, QS_CAM_HC37_CAM_PD); |
| 1712 | return rc; |
| 1713 | } |
| 1714 | gpio_direction_output(QS_CAM_HC37_CAM_PD, 0); |
| 1715 | msleep(20); |
| 1716 | gpio_set_value_cansleep(QS_CAM_HC37_CAM_PD, 1); |
| 1717 | msleep(20); |
| 1718 | |
| 1719 | /* |
| 1720 | * Set GPIO_AUX_CAM_2P7_EN to 1 on North Expander IO2 |
| 1721 | * to enable 2.7V power to Camera |
| 1722 | */ |
| 1723 | rc = gpio_request(GPIO_AUX_CAM_2P7_EN, "CAM_2P7_EN"); |
| 1724 | if (rc < 0) { |
| 1725 | printk(KERN_ERR "%s: CAMSENSOR gpio %d request" |
| 1726 | " failed\n", __func__, GPIO_AUX_CAM_2P7_EN); |
| 1727 | gpio_set_value_cansleep(QS_CAM_HC37_CAM_PD, 0); |
| 1728 | gpio_free(QS_CAM_HC37_CAM_PD); |
| 1729 | return rc; |
| 1730 | } |
| 1731 | gpio_direction_output(GPIO_AUX_CAM_2P7_EN, 0); |
| 1732 | msleep(20); |
| 1733 | gpio_set_value_cansleep(GPIO_AUX_CAM_2P7_EN, 1); |
| 1734 | msleep(20); |
| 1735 | |
| 1736 | rc = config_camera_on_gpios_fluid(); |
| 1737 | if (rc < 0) { |
| 1738 | printk(KERN_ERR "%s: config_camera_on_gpios_fluid" |
| 1739 | " failed\n", __func__); |
| 1740 | gpio_set_value_cansleep(QS_CAM_HC37_CAM_PD, 0); |
| 1741 | gpio_free(QS_CAM_HC37_CAM_PD); |
| 1742 | gpio_set_value_cansleep(GPIO_AUX_CAM_2P7_EN, 0); |
| 1743 | gpio_free(GPIO_AUX_CAM_2P7_EN); |
| 1744 | return rc; |
| 1745 | } |
| 1746 | return rc; |
| 1747 | } |
| 1748 | |
| 1749 | static void config_camera_off_gpios_qs_cam_fluid(void) |
| 1750 | { |
| 1751 | /* |
| 1752 | * Set GPIO_AUX_CAM_2P7_EN to 0 on North Expander IO2 |
| 1753 | * to disable 2.7V power to Camera |
| 1754 | */ |
| 1755 | gpio_set_value_cansleep(GPIO_AUX_CAM_2P7_EN, 0); |
| 1756 | gpio_free(GPIO_AUX_CAM_2P7_EN); |
| 1757 | |
| 1758 | /* set QS_CAM_HC37_CAM_PD to 0 to power off HC37 ASIC*/ |
| 1759 | gpio_set_value_cansleep(QS_CAM_HC37_CAM_PD, 0); |
| 1760 | gpio_free(QS_CAM_HC37_CAM_PD); |
| 1761 | |
| 1762 | config_camera_off_gpios_fluid(); |
| 1763 | return; |
| 1764 | } |
| 1765 | |
| 1766 | static int config_camera_on_gpios_qs_cam(void) |
| 1767 | { |
| 1768 | int rc = 0; |
| 1769 | |
| 1770 | if (machine_is_msm8x60_fluid()) |
| 1771 | return config_camera_on_gpios_qs_cam_fluid(); |
| 1772 | |
| 1773 | rc = config_camera_on_gpios(); |
| 1774 | return rc; |
| 1775 | } |
| 1776 | |
| 1777 | static void config_camera_off_gpios_qs_cam(void) |
| 1778 | { |
| 1779 | if (machine_is_msm8x60_fluid()) |
| 1780 | return config_camera_off_gpios_qs_cam_fluid(); |
| 1781 | |
| 1782 | config_camera_off_gpios(); |
| 1783 | return; |
| 1784 | } |
| 1785 | #endif |
| 1786 | |
| 1787 | static int config_camera_on_gpios_web_cam(void) |
| 1788 | { |
| 1789 | int rc = 0; |
| 1790 | rc = config_gpio_table(MSM_CAM_ON); |
| 1791 | if (rc < 0) { |
| 1792 | printk(KERN_ERR "%s: CAMSENSOR gpio table request" |
| 1793 | "failed\n", __func__); |
| 1794 | return rc; |
| 1795 | } |
| 1796 | |
Jilai Wang | 53d27a8 | 2011-07-13 14:32:58 -0400 | [diff] [blame] | 1797 | if (!(machine_is_msm8x60_fluid() || machine_is_msm8x60_dragon())) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1798 | rc = gpio_request(GPIO_WEB_CAMIF_STANDBY, "CAM_EN"); |
| 1799 | if (rc < 0) { |
| 1800 | config_gpio_table(MSM_CAM_OFF); |
| 1801 | pr_err(KERN_ERR "%s: CAMSENSOR gpio %d request" |
| 1802 | "failed\n", __func__, GPIO_WEB_CAMIF_STANDBY); |
| 1803 | return rc; |
| 1804 | } |
| 1805 | gpio_direction_output(GPIO_WEB_CAMIF_STANDBY, 0); |
| 1806 | } |
| 1807 | return rc; |
| 1808 | } |
| 1809 | |
| 1810 | static void config_camera_off_gpios_web_cam(void) |
| 1811 | { |
| 1812 | config_gpio_table(MSM_CAM_OFF); |
Jilai Wang | 53d27a8 | 2011-07-13 14:32:58 -0400 | [diff] [blame] | 1813 | if (!(machine_is_msm8x60_fluid() || machine_is_msm8x60_dragon())) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1814 | gpio_set_value_cansleep(GPIO_WEB_CAMIF_STANDBY, 1); |
| 1815 | gpio_free(GPIO_WEB_CAMIF_STANDBY); |
| 1816 | } |
| 1817 | return; |
| 1818 | } |
| 1819 | |
| 1820 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1821 | static struct msm_bus_vectors cam_init_vectors[] = { |
| 1822 | { |
| 1823 | .src = MSM_BUS_MASTER_VFE, |
| 1824 | .dst = MSM_BUS_SLAVE_SMI, |
| 1825 | .ab = 0, |
| 1826 | .ib = 0, |
| 1827 | }, |
| 1828 | { |
| 1829 | .src = MSM_BUS_MASTER_VFE, |
| 1830 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1831 | .ab = 0, |
| 1832 | .ib = 0, |
| 1833 | }, |
| 1834 | { |
| 1835 | .src = MSM_BUS_MASTER_VPE, |
| 1836 | .dst = MSM_BUS_SLAVE_SMI, |
| 1837 | .ab = 0, |
| 1838 | .ib = 0, |
| 1839 | }, |
| 1840 | { |
| 1841 | .src = MSM_BUS_MASTER_VPE, |
| 1842 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1843 | .ab = 0, |
| 1844 | .ib = 0, |
| 1845 | }, |
| 1846 | { |
| 1847 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1848 | .dst = MSM_BUS_SLAVE_SMI, |
| 1849 | .ab = 0, |
| 1850 | .ib = 0, |
| 1851 | }, |
| 1852 | { |
| 1853 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1854 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1855 | .ab = 0, |
| 1856 | .ib = 0, |
| 1857 | }, |
| 1858 | }; |
| 1859 | |
| 1860 | static struct msm_bus_vectors cam_preview_vectors[] = { |
| 1861 | { |
| 1862 | .src = MSM_BUS_MASTER_VFE, |
| 1863 | .dst = MSM_BUS_SLAVE_SMI, |
| 1864 | .ab = 0, |
| 1865 | .ib = 0, |
| 1866 | }, |
| 1867 | { |
| 1868 | .src = MSM_BUS_MASTER_VFE, |
| 1869 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1870 | .ab = 283115520, |
| 1871 | .ib = 452984832, |
| 1872 | }, |
| 1873 | { |
| 1874 | .src = MSM_BUS_MASTER_VPE, |
| 1875 | .dst = MSM_BUS_SLAVE_SMI, |
| 1876 | .ab = 0, |
| 1877 | .ib = 0, |
| 1878 | }, |
| 1879 | { |
| 1880 | .src = MSM_BUS_MASTER_VPE, |
| 1881 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1882 | .ab = 0, |
| 1883 | .ib = 0, |
| 1884 | }, |
| 1885 | { |
| 1886 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1887 | .dst = MSM_BUS_SLAVE_SMI, |
| 1888 | .ab = 0, |
| 1889 | .ib = 0, |
| 1890 | }, |
| 1891 | { |
| 1892 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1893 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1894 | .ab = 0, |
| 1895 | .ib = 0, |
| 1896 | }, |
| 1897 | }; |
| 1898 | |
| 1899 | static struct msm_bus_vectors cam_video_vectors[] = { |
| 1900 | { |
| 1901 | .src = MSM_BUS_MASTER_VFE, |
| 1902 | .dst = MSM_BUS_SLAVE_SMI, |
| 1903 | .ab = 283115520, |
| 1904 | .ib = 452984832, |
| 1905 | }, |
| 1906 | { |
| 1907 | .src = MSM_BUS_MASTER_VFE, |
| 1908 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1909 | .ab = 283115520, |
| 1910 | .ib = 452984832, |
| 1911 | }, |
| 1912 | { |
| 1913 | .src = MSM_BUS_MASTER_VPE, |
| 1914 | .dst = MSM_BUS_SLAVE_SMI, |
| 1915 | .ab = 319610880, |
| 1916 | .ib = 511377408, |
| 1917 | }, |
| 1918 | { |
| 1919 | .src = MSM_BUS_MASTER_VPE, |
| 1920 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1921 | .ab = 0, |
| 1922 | .ib = 0, |
| 1923 | }, |
| 1924 | { |
| 1925 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1926 | .dst = MSM_BUS_SLAVE_SMI, |
| 1927 | .ab = 0, |
| 1928 | .ib = 0, |
| 1929 | }, |
| 1930 | { |
| 1931 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1932 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1933 | .ab = 0, |
| 1934 | .ib = 0, |
| 1935 | }, |
| 1936 | }; |
| 1937 | |
| 1938 | static struct msm_bus_vectors cam_snapshot_vectors[] = { |
| 1939 | { |
| 1940 | .src = MSM_BUS_MASTER_VFE, |
| 1941 | .dst = MSM_BUS_SLAVE_SMI, |
| 1942 | .ab = 566231040, |
| 1943 | .ib = 905969664, |
| 1944 | }, |
| 1945 | { |
| 1946 | .src = MSM_BUS_MASTER_VFE, |
| 1947 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1948 | .ab = 69984000, |
| 1949 | .ib = 111974400, |
| 1950 | }, |
| 1951 | { |
| 1952 | .src = MSM_BUS_MASTER_VPE, |
| 1953 | .dst = MSM_BUS_SLAVE_SMI, |
| 1954 | .ab = 0, |
| 1955 | .ib = 0, |
| 1956 | }, |
| 1957 | { |
| 1958 | .src = MSM_BUS_MASTER_VPE, |
| 1959 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1960 | .ab = 0, |
| 1961 | .ib = 0, |
| 1962 | }, |
| 1963 | { |
| 1964 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1965 | .dst = MSM_BUS_SLAVE_SMI, |
| 1966 | .ab = 320864256, |
| 1967 | .ib = 513382810, |
| 1968 | }, |
| 1969 | { |
| 1970 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 1971 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1972 | .ab = 320864256, |
| 1973 | .ib = 513382810, |
| 1974 | }, |
| 1975 | }; |
| 1976 | |
| 1977 | static struct msm_bus_vectors cam_zsl_vectors[] = { |
| 1978 | { |
| 1979 | .src = MSM_BUS_MASTER_VFE, |
| 1980 | .dst = MSM_BUS_SLAVE_SMI, |
| 1981 | .ab = 566231040, |
| 1982 | .ib = 905969664, |
| 1983 | }, |
| 1984 | { |
| 1985 | .src = MSM_BUS_MASTER_VFE, |
| 1986 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1987 | .ab = 706199040, |
| 1988 | .ib = 1129918464, |
| 1989 | }, |
| 1990 | { |
| 1991 | .src = MSM_BUS_MASTER_VPE, |
| 1992 | .dst = MSM_BUS_SLAVE_SMI, |
| 1993 | .ab = 0, |
| 1994 | .ib = 0, |
| 1995 | }, |
| 1996 | { |
| 1997 | .src = MSM_BUS_MASTER_VPE, |
| 1998 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1999 | .ab = 0, |
| 2000 | .ib = 0, |
| 2001 | }, |
| 2002 | { |
| 2003 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 2004 | .dst = MSM_BUS_SLAVE_SMI, |
| 2005 | .ab = 320864256, |
| 2006 | .ib = 513382810, |
| 2007 | }, |
| 2008 | { |
| 2009 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 2010 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2011 | .ab = 320864256, |
| 2012 | .ib = 513382810, |
| 2013 | }, |
| 2014 | }; |
| 2015 | |
| 2016 | static struct msm_bus_vectors cam_stereo_video_vectors[] = { |
| 2017 | { |
| 2018 | .src = MSM_BUS_MASTER_VFE, |
| 2019 | .dst = MSM_BUS_SLAVE_SMI, |
| 2020 | .ab = 212336640, |
| 2021 | .ib = 339738624, |
| 2022 | }, |
| 2023 | { |
| 2024 | .src = MSM_BUS_MASTER_VFE, |
| 2025 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2026 | .ab = 25090560, |
| 2027 | .ib = 40144896, |
| 2028 | }, |
| 2029 | { |
| 2030 | .src = MSM_BUS_MASTER_VPE, |
| 2031 | .dst = MSM_BUS_SLAVE_SMI, |
| 2032 | .ab = 239708160, |
| 2033 | .ib = 383533056, |
| 2034 | }, |
| 2035 | { |
| 2036 | .src = MSM_BUS_MASTER_VPE, |
| 2037 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2038 | .ab = 79902720, |
| 2039 | .ib = 127844352, |
| 2040 | }, |
| 2041 | { |
| 2042 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 2043 | .dst = MSM_BUS_SLAVE_SMI, |
| 2044 | .ab = 0, |
| 2045 | .ib = 0, |
| 2046 | }, |
| 2047 | { |
| 2048 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 2049 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2050 | .ab = 0, |
| 2051 | .ib = 0, |
| 2052 | }, |
| 2053 | }; |
| 2054 | |
| 2055 | static struct msm_bus_vectors cam_stereo_snapshot_vectors[] = { |
| 2056 | { |
| 2057 | .src = MSM_BUS_MASTER_VFE, |
| 2058 | .dst = MSM_BUS_SLAVE_SMI, |
| 2059 | .ab = 0, |
| 2060 | .ib = 0, |
| 2061 | }, |
| 2062 | { |
| 2063 | .src = MSM_BUS_MASTER_VFE, |
| 2064 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2065 | .ab = 300902400, |
| 2066 | .ib = 481443840, |
| 2067 | }, |
| 2068 | { |
| 2069 | .src = MSM_BUS_MASTER_VPE, |
| 2070 | .dst = MSM_BUS_SLAVE_SMI, |
| 2071 | .ab = 230307840, |
| 2072 | .ib = 368492544, |
| 2073 | }, |
| 2074 | { |
| 2075 | .src = MSM_BUS_MASTER_VPE, |
| 2076 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2077 | .ab = 245113344, |
| 2078 | .ib = 392181351, |
| 2079 | }, |
| 2080 | { |
| 2081 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 2082 | .dst = MSM_BUS_SLAVE_SMI, |
| 2083 | .ab = 106536960, |
| 2084 | .ib = 170459136, |
| 2085 | }, |
| 2086 | { |
| 2087 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 2088 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 2089 | .ab = 106536960, |
| 2090 | .ib = 170459136, |
| 2091 | }, |
| 2092 | }; |
| 2093 | |
| 2094 | static struct msm_bus_paths cam_bus_client_config[] = { |
| 2095 | { |
| 2096 | ARRAY_SIZE(cam_init_vectors), |
| 2097 | cam_init_vectors, |
| 2098 | }, |
| 2099 | { |
| 2100 | ARRAY_SIZE(cam_preview_vectors), |
| 2101 | cam_preview_vectors, |
| 2102 | }, |
| 2103 | { |
| 2104 | ARRAY_SIZE(cam_video_vectors), |
| 2105 | cam_video_vectors, |
| 2106 | }, |
| 2107 | { |
| 2108 | ARRAY_SIZE(cam_snapshot_vectors), |
| 2109 | cam_snapshot_vectors, |
| 2110 | }, |
| 2111 | { |
| 2112 | ARRAY_SIZE(cam_zsl_vectors), |
| 2113 | cam_zsl_vectors, |
| 2114 | }, |
| 2115 | { |
| 2116 | ARRAY_SIZE(cam_stereo_video_vectors), |
| 2117 | cam_stereo_video_vectors, |
| 2118 | }, |
| 2119 | { |
| 2120 | ARRAY_SIZE(cam_stereo_snapshot_vectors), |
| 2121 | cam_stereo_snapshot_vectors, |
| 2122 | }, |
| 2123 | }; |
| 2124 | |
| 2125 | static struct msm_bus_scale_pdata cam_bus_client_pdata = { |
| 2126 | cam_bus_client_config, |
| 2127 | ARRAY_SIZE(cam_bus_client_config), |
| 2128 | .name = "msm_camera", |
| 2129 | }; |
| 2130 | #endif |
| 2131 | |
| 2132 | struct msm_camera_device_platform_data msm_camera_device_data = { |
| 2133 | .camera_gpio_on = config_camera_on_gpios, |
| 2134 | .camera_gpio_off = config_camera_off_gpios, |
| 2135 | .ioext.csiphy = 0x04800000, |
| 2136 | .ioext.csisz = 0x00000400, |
| 2137 | .ioext.csiirq = CSI_0_IRQ, |
| 2138 | .ioclk.mclk_clk_rate = 24000000, |
| 2139 | .ioclk.vfe_clk_rate = 228570000, |
| 2140 | #ifdef CONFIG_MSM_BUS_SCALING |
| 2141 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 2142 | #endif |
| 2143 | }; |
| 2144 | |
| 2145 | #ifdef CONFIG_QS_S5K4E1 |
| 2146 | struct msm_camera_device_platform_data msm_camera_device_data_qs_cam = { |
| 2147 | .camera_gpio_on = config_camera_on_gpios_qs_cam, |
| 2148 | .camera_gpio_off = config_camera_off_gpios_qs_cam, |
| 2149 | .ioext.csiphy = 0x04800000, |
| 2150 | .ioext.csisz = 0x00000400, |
| 2151 | .ioext.csiirq = CSI_0_IRQ, |
| 2152 | .ioclk.mclk_clk_rate = 24000000, |
| 2153 | .ioclk.vfe_clk_rate = 228570000, |
| 2154 | #ifdef CONFIG_MSM_BUS_SCALING |
| 2155 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 2156 | #endif |
| 2157 | }; |
| 2158 | #endif |
| 2159 | |
| 2160 | struct msm_camera_device_platform_data msm_camera_device_data_web_cam = { |
| 2161 | .camera_gpio_on = config_camera_on_gpios_web_cam, |
| 2162 | .camera_gpio_off = config_camera_off_gpios_web_cam, |
| 2163 | .ioext.csiphy = 0x04900000, |
| 2164 | .ioext.csisz = 0x00000400, |
| 2165 | .ioext.csiirq = CSI_1_IRQ, |
| 2166 | .ioclk.mclk_clk_rate = 24000000, |
| 2167 | .ioclk.vfe_clk_rate = 228570000, |
| 2168 | #ifdef CONFIG_MSM_BUS_SCALING |
| 2169 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 2170 | #endif |
| 2171 | }; |
| 2172 | |
| 2173 | struct resource msm_camera_resources[] = { |
| 2174 | { |
| 2175 | .start = 0x04500000, |
| 2176 | .end = 0x04500000 + SZ_1M - 1, |
| 2177 | .flags = IORESOURCE_MEM, |
| 2178 | }, |
| 2179 | { |
| 2180 | .start = VFE_IRQ, |
| 2181 | .end = VFE_IRQ, |
| 2182 | .flags = IORESOURCE_IRQ, |
| 2183 | }, |
| 2184 | }; |
| 2185 | #ifdef CONFIG_MT9E013 |
| 2186 | static struct msm_camera_sensor_platform_info mt9e013_sensor_8660_info = { |
| 2187 | .mount_angle = 0 |
| 2188 | }; |
| 2189 | |
| 2190 | static struct msm_camera_sensor_flash_data flash_mt9e013 = { |
| 2191 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2192 | .flash_src = &msm_flash_src |
| 2193 | }; |
| 2194 | |
| 2195 | static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = { |
| 2196 | .sensor_name = "mt9e013", |
| 2197 | .sensor_reset = 106, |
| 2198 | .sensor_pwd = 85, |
| 2199 | .vcm_pwd = 1, |
| 2200 | .vcm_enable = 0, |
| 2201 | .pdata = &msm_camera_device_data, |
| 2202 | .resource = msm_camera_resources, |
| 2203 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 2204 | .flash_data = &flash_mt9e013, |
| 2205 | .strobe_flash_data = &strobe_flash_xenon, |
| 2206 | .sensor_platform_info = &mt9e013_sensor_8660_info, |
| 2207 | .csi_if = 1 |
| 2208 | }; |
| 2209 | struct platform_device msm_camera_sensor_mt9e013 = { |
| 2210 | .name = "msm_camera_mt9e013", |
| 2211 | .dev = { |
| 2212 | .platform_data = &msm_camera_sensor_mt9e013_data, |
| 2213 | }, |
| 2214 | }; |
| 2215 | #endif |
| 2216 | |
| 2217 | #ifdef CONFIG_IMX074 |
Roja Rani Yarubandi | 68ebb4d | 2011-10-20 10:33:16 +0530 | [diff] [blame] | 2218 | static struct msm_camera_sensor_platform_info imx074_sensor_board_info = { |
| 2219 | .mount_angle = 180 |
| 2220 | }; |
| 2221 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2222 | static struct msm_camera_sensor_flash_data flash_imx074 = { |
| 2223 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2224 | .flash_src = &msm_flash_src |
| 2225 | }; |
| 2226 | |
| 2227 | static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = { |
| 2228 | .sensor_name = "imx074", |
| 2229 | .sensor_reset = 106, |
| 2230 | .sensor_pwd = 85, |
| 2231 | .vcm_pwd = GPIO_AUX_CAM_2P7_EN, |
| 2232 | .vcm_enable = 1, |
| 2233 | .pdata = &msm_camera_device_data, |
| 2234 | .resource = msm_camera_resources, |
| 2235 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 2236 | .flash_data = &flash_imx074, |
| 2237 | .strobe_flash_data = &strobe_flash_xenon, |
Roja Rani Yarubandi | 68ebb4d | 2011-10-20 10:33:16 +0530 | [diff] [blame] | 2238 | .sensor_platform_info = &imx074_sensor_board_info, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2239 | .csi_if = 1 |
| 2240 | }; |
| 2241 | struct platform_device msm_camera_sensor_imx074 = { |
| 2242 | .name = "msm_camera_imx074", |
| 2243 | .dev = { |
| 2244 | .platform_data = &msm_camera_sensor_imx074_data, |
| 2245 | }, |
| 2246 | }; |
| 2247 | #endif |
| 2248 | #ifdef CONFIG_WEBCAM_OV9726 |
| 2249 | |
| 2250 | static struct msm_camera_sensor_platform_info ov9726_sensor_8660_info = { |
| 2251 | .mount_angle = 0 |
| 2252 | }; |
| 2253 | |
| 2254 | static struct msm_camera_sensor_flash_data flash_ov9726 = { |
| 2255 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2256 | .flash_src = &msm_flash_src |
| 2257 | }; |
| 2258 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = { |
| 2259 | .sensor_name = "ov9726", |
Kevin Chan | 3382c51 | 2011-07-19 21:00:45 -0700 | [diff] [blame] | 2260 | .sensor_reset_enable = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2261 | .sensor_reset = GPIO_FRONT_CAM_RESET_N, |
| 2262 | .sensor_pwd = 85, |
| 2263 | .vcm_pwd = 1, |
| 2264 | .vcm_enable = 0, |
| 2265 | .pdata = &msm_camera_device_data_web_cam, |
| 2266 | .resource = msm_camera_resources, |
| 2267 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 2268 | .flash_data = &flash_ov9726, |
| 2269 | .sensor_platform_info = &ov9726_sensor_8660_info, |
| 2270 | .csi_if = 1 |
| 2271 | }; |
| 2272 | struct platform_device msm_camera_sensor_webcam_ov9726 = { |
| 2273 | .name = "msm_camera_ov9726", |
| 2274 | .dev = { |
| 2275 | .platform_data = &msm_camera_sensor_ov9726_data, |
| 2276 | }, |
| 2277 | }; |
| 2278 | #endif |
| 2279 | #ifdef CONFIG_WEBCAM_OV7692 |
| 2280 | static struct msm_camera_sensor_flash_data flash_ov7692 = { |
| 2281 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2282 | .flash_src = &msm_flash_src |
| 2283 | }; |
| 2284 | static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = { |
| 2285 | .sensor_name = "ov7692", |
| 2286 | .sensor_reset = GPIO_WEB_CAMIF_RESET_N, |
| 2287 | .sensor_pwd = 85, |
| 2288 | .vcm_pwd = 1, |
| 2289 | .vcm_enable = 0, |
| 2290 | .pdata = &msm_camera_device_data_web_cam, |
| 2291 | .resource = msm_camera_resources, |
| 2292 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 2293 | .flash_data = &flash_ov7692, |
| 2294 | .csi_if = 1 |
| 2295 | }; |
| 2296 | |
| 2297 | static struct platform_device msm_camera_sensor_webcam_ov7692 = { |
| 2298 | .name = "msm_camera_ov7692", |
| 2299 | .dev = { |
| 2300 | .platform_data = &msm_camera_sensor_ov7692_data, |
| 2301 | }, |
| 2302 | }; |
| 2303 | #endif |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 2304 | #ifdef CONFIG_VX6953 |
| 2305 | static struct msm_camera_sensor_platform_info vx6953_sensor_8660_info = { |
| 2306 | .mount_angle = 270 |
| 2307 | }; |
| 2308 | |
| 2309 | static struct msm_camera_sensor_flash_data flash_vx6953 = { |
| 2310 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 2311 | .flash_src = &msm_flash_src |
| 2312 | }; |
| 2313 | |
| 2314 | static struct msm_camera_sensor_info msm_camera_sensor_vx6953_data = { |
| 2315 | .sensor_name = "vx6953", |
| 2316 | .sensor_reset = 63, |
| 2317 | .sensor_pwd = 63, |
| 2318 | .vcm_pwd = GPIO_AUX_CAM_2P7_EN, |
| 2319 | .vcm_enable = 1, |
| 2320 | .pdata = &msm_camera_device_data, |
| 2321 | .resource = msm_camera_resources, |
| 2322 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 2323 | .flash_data = &flash_vx6953, |
| 2324 | .sensor_platform_info = &vx6953_sensor_8660_info, |
| 2325 | .csi_if = 1 |
| 2326 | }; |
| 2327 | struct platform_device msm_camera_sensor_vx6953 = { |
| 2328 | .name = "msm_camera_vx6953", |
| 2329 | .dev = { |
| 2330 | .platform_data = &msm_camera_sensor_vx6953_data, |
| 2331 | }, |
| 2332 | }; |
| 2333 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2334 | #ifdef CONFIG_QS_S5K4E1 |
| 2335 | |
Nishant Pandit | 613ab7a | 2011-09-02 03:36:01 +0530 | [diff] [blame] | 2336 | static struct msm_camera_sensor_platform_info qs_s5k4e1_sensor_8660_info = { |
| 2337 | #ifdef CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT |
| 2338 | .mount_angle = 90 |
| 2339 | #else |
| 2340 | .mount_angle = 0 |
| 2341 | #endif |
| 2342 | }; |
| 2343 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2344 | static char eeprom_data[864]; |
| 2345 | static struct msm_camera_sensor_flash_data flash_qs_s5k4e1 = { |
| 2346 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 2347 | .flash_src = &msm_flash_src |
| 2348 | }; |
| 2349 | |
| 2350 | static struct msm_camera_sensor_info msm_camera_sensor_qs_s5k4e1_data = { |
| 2351 | .sensor_name = "qs_s5k4e1", |
| 2352 | .sensor_reset = 106, |
| 2353 | .sensor_pwd = 85, |
| 2354 | .vcm_pwd = 1, |
| 2355 | .vcm_enable = 0, |
| 2356 | .pdata = &msm_camera_device_data_qs_cam, |
| 2357 | .resource = msm_camera_resources, |
| 2358 | .num_resources = ARRAY_SIZE(msm_camera_resources), |
| 2359 | .flash_data = &flash_qs_s5k4e1, |
| 2360 | .strobe_flash_data = &strobe_flash_xenon, |
Nishant Pandit | 613ab7a | 2011-09-02 03:36:01 +0530 | [diff] [blame] | 2361 | .sensor_platform_info = &qs_s5k4e1_sensor_8660_info, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2362 | .csi_if = 1, |
| 2363 | .eeprom_data = eeprom_data, |
| 2364 | }; |
| 2365 | struct platform_device msm_camera_sensor_qs_s5k4e1 = { |
| 2366 | .name = "msm_camera_qs_s5k4e1", |
| 2367 | .dev = { |
| 2368 | .platform_data = &msm_camera_sensor_qs_s5k4e1_data, |
| 2369 | }, |
| 2370 | }; |
| 2371 | #endif |
| 2372 | static struct i2c_board_info msm_camera_boardinfo[] __initdata = { |
| 2373 | #ifdef CONFIG_MT9E013 |
| 2374 | { |
| 2375 | I2C_BOARD_INFO("mt9e013", 0x6C >> 2), |
| 2376 | }, |
| 2377 | #endif |
| 2378 | #ifdef CONFIG_IMX074 |
| 2379 | { |
| 2380 | I2C_BOARD_INFO("imx074", 0x1A), |
| 2381 | }, |
| 2382 | #endif |
| 2383 | #ifdef CONFIG_WEBCAM_OV7692 |
| 2384 | { |
| 2385 | I2C_BOARD_INFO("ov7692", 0x78), |
| 2386 | }, |
| 2387 | #endif |
| 2388 | #ifdef CONFIG_WEBCAM_OV9726 |
| 2389 | { |
| 2390 | I2C_BOARD_INFO("ov9726", 0x10), |
| 2391 | }, |
| 2392 | #endif |
| 2393 | #ifdef CONFIG_QS_S5K4E1 |
| 2394 | { |
| 2395 | I2C_BOARD_INFO("qs_s5k4e1", 0x20), |
| 2396 | }, |
| 2397 | #endif |
| 2398 | }; |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 2399 | |
| 2400 | static struct i2c_board_info msm_camera_dragon_boardinfo[] __initdata = { |
Jilai Wang | 53d27a8 | 2011-07-13 14:32:58 -0400 | [diff] [blame] | 2401 | #ifdef CONFIG_WEBCAM_OV9726 |
| 2402 | { |
| 2403 | I2C_BOARD_INFO("ov9726", 0x10), |
| 2404 | }, |
| 2405 | #endif |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 2406 | #ifdef CONFIG_VX6953 |
| 2407 | { |
| 2408 | I2C_BOARD_INFO("vx6953", 0x20), |
| 2409 | }, |
| 2410 | #endif |
| 2411 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2412 | #endif |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 2413 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2414 | |
| 2415 | #ifdef CONFIG_MSM_GEMINI |
| 2416 | static struct resource msm_gemini_resources[] = { |
| 2417 | { |
| 2418 | .start = 0x04600000, |
| 2419 | .end = 0x04600000 + SZ_1M - 1, |
| 2420 | .flags = IORESOURCE_MEM, |
| 2421 | }, |
| 2422 | { |
| 2423 | .start = INT_JPEG, |
| 2424 | .end = INT_JPEG, |
| 2425 | .flags = IORESOURCE_IRQ, |
| 2426 | }, |
| 2427 | }; |
| 2428 | |
| 2429 | static struct platform_device msm_gemini_device = { |
| 2430 | .name = "msm_gemini", |
| 2431 | .resource = msm_gemini_resources, |
| 2432 | .num_resources = ARRAY_SIZE(msm_gemini_resources), |
| 2433 | }; |
| 2434 | #endif |
| 2435 | |
| 2436 | #ifdef CONFIG_I2C_QUP |
| 2437 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 2438 | { |
| 2439 | } |
| 2440 | |
| 2441 | static struct msm_i2c_platform_data msm_gsbi3_qup_i2c_pdata = { |
| 2442 | .clk_freq = 384000, |
| 2443 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2444 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 2445 | }; |
| 2446 | |
| 2447 | static struct msm_i2c_platform_data msm_gsbi4_qup_i2c_pdata = { |
| 2448 | .clk_freq = 100000, |
| 2449 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2450 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 2451 | }; |
| 2452 | |
| 2453 | static struct msm_i2c_platform_data msm_gsbi7_qup_i2c_pdata = { |
| 2454 | .clk_freq = 100000, |
| 2455 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2456 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 2457 | }; |
| 2458 | |
| 2459 | static struct msm_i2c_platform_data msm_gsbi8_qup_i2c_pdata = { |
| 2460 | .clk_freq = 100000, |
| 2461 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2462 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 2463 | }; |
| 2464 | |
| 2465 | static struct msm_i2c_platform_data msm_gsbi9_qup_i2c_pdata = { |
| 2466 | .clk_freq = 100000, |
| 2467 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2468 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 2469 | }; |
| 2470 | |
| 2471 | static struct msm_i2c_platform_data msm_gsbi12_qup_i2c_pdata = { |
| 2472 | .clk_freq = 100000, |
| 2473 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2474 | .use_gsbi_shared_mode = 1, |
| 2475 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 2476 | }; |
| 2477 | #endif |
| 2478 | |
| 2479 | #if defined(CONFIG_SPI_QUP) || defined(CONFIG_SPI_QUP_MODULE) |
| 2480 | static struct msm_spi_platform_data msm_gsbi1_qup_spi_pdata = { |
| 2481 | .max_clock_speed = 24000000, |
| 2482 | }; |
| 2483 | |
| 2484 | static struct msm_spi_platform_data msm_gsbi10_qup_spi_pdata = { |
| 2485 | .max_clock_speed = 24000000, |
| 2486 | }; |
| 2487 | #endif |
| 2488 | |
| 2489 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2490 | /* CODEC/TSSC SSBI */ |
| 2491 | static struct msm_i2c_ssbi_platform_data msm_ssbi3_pdata = { |
| 2492 | .controller_type = MSM_SBI_CTRL_SSBI, |
| 2493 | }; |
| 2494 | #endif |
| 2495 | |
| 2496 | #ifdef CONFIG_BATTERY_MSM |
| 2497 | /* Use basic value for fake MSM battery */ |
| 2498 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 2499 | .avail_chg_sources = AC_CHG, |
| 2500 | }; |
| 2501 | |
| 2502 | static struct platform_device msm_batt_device = { |
| 2503 | .name = "msm-battery", |
| 2504 | .id = -1, |
| 2505 | .dev.platform_data = &msm_psy_batt_data, |
| 2506 | }; |
| 2507 | #endif |
| 2508 | |
| 2509 | #ifdef CONFIG_FB_MSM_LCDC_DSUB |
| 2510 | /* VGA = 1440 x 900 x 4(bpp) x 2(pages) |
| 2511 | prim = 1024 x 600 x 4(bpp) x 2(pages) |
| 2512 | This is the difference. */ |
| 2513 | #define MSM_FB_DSUB_PMEM_ADDER (0xA32000-0x4B0000) |
| 2514 | #else |
| 2515 | #define MSM_FB_DSUB_PMEM_ADDER (0) |
| 2516 | #endif |
| 2517 | |
| 2518 | /* Sensors DSPS platform data */ |
| 2519 | #ifdef CONFIG_MSM_DSPS |
| 2520 | |
| 2521 | static struct dsps_gpio_info dsps_surf_gpios[] = { |
| 2522 | { |
| 2523 | .name = "compass_rst_n", |
| 2524 | .num = GPIO_COMPASS_RST_N, |
| 2525 | .on_val = 1, /* device not in reset */ |
| 2526 | .off_val = 0, /* device in reset */ |
| 2527 | }, |
| 2528 | { |
| 2529 | .name = "gpio_r_altimeter_reset_n", |
| 2530 | .num = GPIO_R_ALTIMETER_RESET_N, |
| 2531 | .on_val = 1, /* device not in reset */ |
| 2532 | .off_val = 0, /* device in reset */ |
| 2533 | } |
| 2534 | }; |
| 2535 | |
| 2536 | static struct dsps_gpio_info dsps_fluid_gpios[] = { |
| 2537 | { |
| 2538 | .name = "gpio_n_altimeter_reset_n", |
| 2539 | .num = GPIO_N_ALTIMETER_RESET_N, |
| 2540 | .on_val = 1, /* device not in reset */ |
| 2541 | .off_val = 0, /* device in reset */ |
| 2542 | } |
| 2543 | }; |
| 2544 | |
| 2545 | static void __init msm8x60_init_dsps(void) |
| 2546 | { |
| 2547 | struct msm_dsps_platform_data *pdata = |
| 2548 | msm_dsps_device.dev.platform_data; |
| 2549 | /* |
| 2550 | * On Fluid the Compass sensor Chip-Select (CS) is directly connected |
| 2551 | * to the power supply and not controled via GPIOs. Fluid uses a |
| 2552 | * different IO-Expender (north) than used on surf/ffa. |
| 2553 | */ |
| 2554 | if (machine_is_msm8x60_fluid()) { |
| 2555 | /* fluid has different firmware, gpios */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2556 | pdata->pil_name = DSPS_PIL_FLUID_NAME; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 2557 | msm_pil_dsps.dev.platform_data = DSPS_PIL_FLUID_NAME; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2558 | pdata->gpios = dsps_fluid_gpios; |
| 2559 | pdata->gpios_num = ARRAY_SIZE(dsps_fluid_gpios); |
| 2560 | } else { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2561 | pdata->pil_name = DSPS_PIL_GENERIC_NAME; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 2562 | msm_pil_dsps.dev.platform_data = DSPS_PIL_GENERIC_NAME; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2563 | pdata->gpios = dsps_surf_gpios; |
| 2564 | pdata->gpios_num = ARRAY_SIZE(dsps_surf_gpios); |
| 2565 | } |
| 2566 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2567 | platform_device_register(&msm_dsps_device); |
| 2568 | } |
| 2569 | #endif /* CONFIG_MSM_DSPS */ |
| 2570 | |
| 2571 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 2572 | #define MSM_FB_PRIM_BUF_SIZE \ |
| 2573 | (roundup((1024 * 600 * 4), 4096) * 3) /* 4 bpp x 3 pages */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2574 | #else |
Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 2575 | #define MSM_FB_PRIM_BUF_SIZE \ |
| 2576 | (roundup((1024 * 600 * 4), 4096) * 2) /* 4 bpp x 2 pages */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2577 | #endif |
| 2578 | |
kuogee hsieh | c9a2e6d | 2011-09-12 15:27:01 -0700 | [diff] [blame] | 2579 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 2580 | #define MSM_FB_EXT_BUF_SIZE \ |
| 2581 | (roundup((1920 * 1080 * 2), 4096) * 1) /* 2 bpp x 1 page */ |
kuogee hsieh | c9a2e6d | 2011-09-12 15:27:01 -0700 | [diff] [blame] | 2582 | #elif defined(CONFIG_FB_MSM_TVOUT) |
Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 2583 | #define MSM_FB_EXT_BUF_SIZE \ |
| 2584 | (roundup((720 * 576 * 2), 4096) * 2) /* 2 bpp x 2 pages */ |
kuogee hsieh | c9a2e6d | 2011-09-12 15:27:01 -0700 | [diff] [blame] | 2585 | #else |
Ajay Singh Parmar | df69456 | 2012-06-05 15:06:21 +0530 | [diff] [blame] | 2586 | #define MSM_FB_EXT_BUF_SIZE 0 |
kuogee hsieh | c9a2e6d | 2011-09-12 15:27:01 -0700 | [diff] [blame] | 2587 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2588 | |
kuogee hsieh | c9a2e6d | 2011-09-12 15:27:01 -0700 | [diff] [blame] | 2589 | /* Note: must be multiple of 4096 */ |
| 2590 | #define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \ |
kuogee hsieh | c9a2e6d | 2011-09-12 15:27:01 -0700 | [diff] [blame] | 2591 | MSM_FB_DSUB_PMEM_ADDER, 4096) |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 2592 | |
| 2593 | #define MSM_PMEM_SF_SIZE 0x4000000 /* 64 Mbytes */ |
Sravan Kumar D.V.N | b4d77dd | 2012-03-16 12:25:37 +0530 | [diff] [blame] | 2594 | #define MSM_HDMI_PRIM_PMEM_SF_SIZE 0x8000000 /* 128 Mbytes */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2595 | |
Ravishangar Kalyanam | 75f3732 | 2011-10-14 12:15:40 -0700 | [diff] [blame] | 2596 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 2597 | unsigned char hdmi_is_primary = 1; |
Ravishangar Kalyanam | 75f3732 | 2011-10-14 12:15:40 -0700 | [diff] [blame] | 2598 | #else |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 2599 | unsigned char hdmi_is_primary; |
Ravishangar Kalyanam | 75f3732 | 2011-10-14 12:15:40 -0700 | [diff] [blame] | 2600 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2601 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 2602 | #ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK |
| 2603 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((1376 * 768 * 3 * 2), 4096) |
| 2604 | #else |
| 2605 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0) |
| 2606 | #endif /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */ |
| 2607 | |
| 2608 | #ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK |
| 2609 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096) |
| 2610 | #else |
| 2611 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0) |
| 2612 | #endif /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */ |
| 2613 | |
Chaithanya Krishna Bacharaju | 1844c7c | 2012-03-19 11:25:43 +0530 | [diff] [blame] | 2614 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x3BC000 |
Ankit Premrajka | aee8f56 | 2012-04-09 03:57:53 -0700 | [diff] [blame] | 2615 | #define MSM_PMEM_ADSP_SIZE 0x4200000 |
Chaithanya Krishna Bacharaju | 1844c7c | 2012-03-19 11:25:43 +0530 | [diff] [blame] | 2616 | #define MSM_PMEM_AUDIO_SIZE 0x4CF000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2617 | |
| 2618 | #define MSM_SMI_BASE 0x38000000 |
| 2619 | #define MSM_SMI_SIZE 0x4000000 |
| 2620 | |
| 2621 | #define KERNEL_SMI_BASE (MSM_SMI_BASE) |
Sravan Kumar D.V.N | ad04670 | 2012-05-23 11:25:42 +0530 | [diff] [blame] | 2622 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 2623 | #define KERNEL_SMI_SIZE 0x000000 |
| 2624 | #else |
Maheshwar Ajja | c60c046 | 2011-11-29 17:46:57 -0800 | [diff] [blame] | 2625 | #define KERNEL_SMI_SIZE 0x600000 |
Sravan Kumar D.V.N | ad04670 | 2012-05-23 11:25:42 +0530 | [diff] [blame] | 2626 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2627 | |
| 2628 | #define USER_SMI_BASE (KERNEL_SMI_BASE + KERNEL_SMI_SIZE) |
| 2629 | #define USER_SMI_SIZE (MSM_SMI_SIZE - KERNEL_SMI_SIZE) |
| 2630 | #define MSM_PMEM_SMIPOOL_SIZE USER_SMI_SIZE |
| 2631 | |
Chintan Pandya | 490c971 | 2012-08-07 17:19:59 +0530 | [diff] [blame^] | 2632 | #ifdef CONFIG_MSM_CP |
Chintan Pandya | fda5bc4 | 2012-05-08 14:15:33 +0530 | [diff] [blame] | 2633 | #define MSM_ION_HOLE_SIZE SZ_128K /* (128KB) */ |
Chintan Pandya | 490c971 | 2012-08-07 17:19:59 +0530 | [diff] [blame^] | 2634 | #else |
| 2635 | #define MSM_ION_HOLE_SIZE 0 |
| 2636 | #endif |
| 2637 | |
Chintan Pandya | fda5bc4 | 2012-05-08 14:15:33 +0530 | [diff] [blame] | 2638 | #define MSM_MM_FW_SIZE (0x200000 - MSM_ION_HOLE_SIZE) /*(2MB-128KB)*/ |
| 2639 | #define MSM_ION_MM_SIZE 0x3800000 /* (56MB) */ |
| 2640 | #define MSM_ION_MFC_SIZE SZ_8K |
| 2641 | |
| 2642 | #define MSM_MM_FW_BASE MSM_SMI_BASE |
| 2643 | #define MSM_ION_HOLE_BASE (MSM_MM_FW_BASE + MSM_MM_FW_SIZE) |
| 2644 | #define MSM_ION_MM_BASE (MSM_ION_HOLE_BASE + MSM_ION_HOLE_SIZE) |
| 2645 | #define MSM_ION_MFC_BASE (MSM_ION_MM_BASE + MSM_ION_MM_SIZE) |
| 2646 | |
Chintan Pandya | 490c971 | 2012-08-07 17:19:59 +0530 | [diff] [blame^] | 2647 | #ifdef CONFIG_MSM_CP |
| 2648 | #define SECURE_BASE (MSM_ION_HOLE_BASE) |
| 2649 | #define SECURE_SIZE (MSM_ION_MM_SIZE + MSM_ION_HOLE_SIZE) |
| 2650 | #else |
| 2651 | #define SECURE_BASE (MSM_MM_FW_BASE) |
| 2652 | #define SECURE_SIZE (MSM_ION_MM_SIZE + MSM_MM_FW_SIZE) |
| 2653 | #endif |
| 2654 | |
Naseer Ahmed | 51860b0 | 2012-02-07 18:53:29 +0530 | [diff] [blame] | 2655 | #define MSM_ION_SF_SIZE 0x4000000 /* 64MB */ |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 2656 | #define MSM_ION_CAMERA_SIZE MSM_PMEM_ADSP_SIZE |
Chintan Pandya | fda5bc4 | 2012-05-08 14:15:33 +0530 | [diff] [blame] | 2657 | |
Mayank Chopra | c22ace3 | 2012-03-03 00:45:04 +0530 | [diff] [blame] | 2658 | #ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK |
| 2659 | #define MSM_ION_WB_SIZE 0xC00000 /* 12MB */ |
| 2660 | #else |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 2661 | #define MSM_ION_WB_SIZE 0x600000 /* 6MB */ |
Mayank Chopra | c22ace3 | 2012-03-03 00:45:04 +0530 | [diff] [blame] | 2662 | #endif |
| 2663 | |
Olav Haugan | 424ff49 | 2012-03-13 11:41:23 -0700 | [diff] [blame] | 2664 | #define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */ |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 2665 | |
| 2666 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Chaithanya Krishna Bacharaju | 1844c7c | 2012-03-19 11:25:43 +0530 | [diff] [blame] | 2667 | #define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE |
Olav Haugan | 6ab4725 | 2012-02-15 14:46:49 -0800 | [diff] [blame] | 2668 | #define MSM_ION_HEAP_NUM 9 |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 2669 | #define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SF_SIZE |
| 2670 | static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE; |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 2671 | #else |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 2672 | #define MSM_ION_HEAP_NUM 1 |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 2673 | #endif |
| 2674 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2675 | static unsigned fb_size; |
| 2676 | static int __init fb_size_setup(char *p) |
| 2677 | { |
| 2678 | fb_size = memparse(p, NULL); |
| 2679 | return 0; |
| 2680 | } |
| 2681 | early_param("fb_size", fb_size_setup); |
| 2682 | |
| 2683 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 2684 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 2685 | { |
| 2686 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 2687 | return 0; |
| 2688 | } |
| 2689 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 2690 | |
| 2691 | #ifdef CONFIG_ANDROID_PMEM |
| 2692 | static unsigned pmem_sf_size = MSM_PMEM_SF_SIZE; |
| 2693 | static int __init pmem_sf_size_setup(char *p) |
| 2694 | { |
| 2695 | pmem_sf_size = memparse(p, NULL); |
| 2696 | return 0; |
| 2697 | } |
| 2698 | early_param("pmem_sf_size", pmem_sf_size_setup); |
| 2699 | |
| 2700 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 2701 | |
| 2702 | static int __init pmem_adsp_size_setup(char *p) |
| 2703 | { |
| 2704 | pmem_adsp_size = memparse(p, NULL); |
| 2705 | return 0; |
| 2706 | } |
| 2707 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 2708 | |
| 2709 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 2710 | |
| 2711 | static int __init pmem_audio_size_setup(char *p) |
| 2712 | { |
| 2713 | pmem_audio_size = memparse(p, NULL); |
| 2714 | return 0; |
| 2715 | } |
| 2716 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 2717 | #endif |
| 2718 | |
| 2719 | static struct resource msm_fb_resources[] = { |
| 2720 | { |
| 2721 | .flags = IORESOURCE_DMA, |
| 2722 | } |
| 2723 | }; |
| 2724 | |
Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 2725 | static void set_mdp_clocks_for_wuxga(void); |
| 2726 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2727 | static int msm_fb_detect_panel(const char *name) |
| 2728 | { |
| 2729 | if (machine_is_msm8x60_fluid()) { |
| 2730 | uint32_t soc_platform_version = socinfo_get_platform_version(); |
| 2731 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) < 3) { |
| 2732 | #ifdef CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT |
| 2733 | if (!strncmp(name, LCDC_SAMSUNG_OLED_PANEL_NAME, |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2734 | strnlen(LCDC_SAMSUNG_OLED_PANEL_NAME, |
| 2735 | PANEL_NAME_MAX_LEN))) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2736 | return 0; |
| 2737 | #endif |
| 2738 | } else { /*P3 and up use AUO panel */ |
| 2739 | #ifdef CONFIG_FB_MSM_LCDC_AUO_WVGA |
| 2740 | if (!strncmp(name, LCDC_AUO_PANEL_NAME, |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2741 | strnlen(LCDC_AUO_PANEL_NAME, |
| 2742 | PANEL_NAME_MAX_LEN))) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2743 | return 0; |
| 2744 | #endif |
| 2745 | } |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 2746 | #ifdef CONFIG_FB_MSM_LCDC_NT35582_WVGA |
| 2747 | } else if machine_is_msm8x60_dragon() { |
| 2748 | if (!strncmp(name, LCDC_NT35582_PANEL_NAME, |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2749 | strnlen(LCDC_NT35582_PANEL_NAME, |
| 2750 | PANEL_NAME_MAX_LEN))) |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 2751 | return 0; |
| 2752 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2753 | } else { |
| 2754 | if (!strncmp(name, LCDC_SAMSUNG_WSVGA_PANEL_NAME, |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2755 | strnlen(LCDC_SAMSUNG_WSVGA_PANEL_NAME, |
| 2756 | PANEL_NAME_MAX_LEN))) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2757 | return 0; |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2758 | |
| 2759 | #if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \ |
| 2760 | !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \ |
| 2761 | !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT) |
| 2762 | if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WVGA_PANEL_NAME, |
| 2763 | strnlen(MIPI_VIDEO_TOSHIBA_WVGA_PANEL_NAME, |
| 2764 | PANEL_NAME_MAX_LEN))) |
| 2765 | return 0; |
| 2766 | |
| 2767 | if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME, |
| 2768 | strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME, |
| 2769 | PANEL_NAME_MAX_LEN))) |
| 2770 | return 0; |
| 2771 | |
| 2772 | if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME, |
| 2773 | strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME, |
| 2774 | PANEL_NAME_MAX_LEN))) |
| 2775 | return 0; |
| 2776 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2777 | } |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2778 | |
| 2779 | if (!strncmp(name, HDMI_PANEL_NAME, |
| 2780 | strnlen(HDMI_PANEL_NAME, |
Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 2781 | PANEL_NAME_MAX_LEN))) { |
| 2782 | if (hdmi_is_primary) |
| 2783 | set_mdp_clocks_for_wuxga(); |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2784 | return 0; |
Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 2785 | } |
Ravishangar Kalyanam | 61a7bd1 | 2011-07-28 16:48:36 -0700 | [diff] [blame] | 2786 | |
| 2787 | if (!strncmp(name, TVOUT_PANEL_NAME, |
| 2788 | strnlen(TVOUT_PANEL_NAME, |
| 2789 | PANEL_NAME_MAX_LEN))) |
| 2790 | return 0; |
| 2791 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2792 | pr_warning("%s: not supported '%s'", __func__, name); |
| 2793 | return -ENODEV; |
| 2794 | } |
| 2795 | |
| 2796 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 2797 | .detect_client = msm_fb_detect_panel, |
| 2798 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2799 | |
| 2800 | static struct platform_device msm_fb_device = { |
| 2801 | .name = "msm_fb", |
| 2802 | .id = 0, |
| 2803 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 2804 | .resource = msm_fb_resources, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2805 | .dev.platform_data = &msm_fb_pdata, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2806 | }; |
| 2807 | |
| 2808 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 2809 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2810 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 2811 | .name = "pmem", |
| 2812 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 2813 | .cached = 1, |
| 2814 | .memory_type = MEMTYPE_EBI1, |
| 2815 | }; |
| 2816 | |
| 2817 | static struct platform_device android_pmem_device = { |
| 2818 | .name = "android_pmem", |
| 2819 | .id = 0, |
| 2820 | .dev = {.platform_data = &android_pmem_pdata}, |
| 2821 | }; |
| 2822 | |
| 2823 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 2824 | .name = "pmem_adsp", |
| 2825 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 2826 | .cached = 0, |
| 2827 | .memory_type = MEMTYPE_EBI1, |
| 2828 | }; |
| 2829 | |
| 2830 | static struct platform_device android_pmem_adsp_device = { |
| 2831 | .name = "android_pmem", |
| 2832 | .id = 2, |
| 2833 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 2834 | }; |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 2835 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2836 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 2837 | .name = "pmem_audio", |
| 2838 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 2839 | .cached = 0, |
| 2840 | .memory_type = MEMTYPE_EBI1, |
| 2841 | }; |
| 2842 | |
| 2843 | static struct platform_device android_pmem_audio_device = { |
| 2844 | .name = "android_pmem", |
| 2845 | .id = 4, |
| 2846 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 2847 | }; |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 2848 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2849 | #define PMEM_BUS_WIDTH(_bw) \ |
| 2850 | { \ |
| 2851 | .vectors = &(struct msm_bus_vectors){ \ |
| 2852 | .src = MSM_BUS_MASTER_AMPSS_M0, \ |
| 2853 | .dst = MSM_BUS_SLAVE_SMI, \ |
| 2854 | .ib = (_bw), \ |
| 2855 | .ab = 0, \ |
| 2856 | }, \ |
| 2857 | .num_paths = 1, \ |
| 2858 | } |
Olav Haugan | ee0f780 | 2011-12-19 13:28:57 -0800 | [diff] [blame] | 2859 | |
| 2860 | static struct msm_bus_paths mem_smi_table[] = { |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2861 | [0] = PMEM_BUS_WIDTH(0), /* Off */ |
| 2862 | [1] = PMEM_BUS_WIDTH(1), /* On */ |
| 2863 | }; |
| 2864 | |
| 2865 | static struct msm_bus_scale_pdata smi_client_pdata = { |
Olav Haugan | ee0f780 | 2011-12-19 13:28:57 -0800 | [diff] [blame] | 2866 | .usecase = mem_smi_table, |
| 2867 | .num_usecases = ARRAY_SIZE(mem_smi_table), |
| 2868 | .name = "mem_smi", |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2869 | }; |
| 2870 | |
Laura Abbott | 72ae4bf | 2011-12-14 14:01:43 -0800 | [diff] [blame] | 2871 | int request_smi_region(void *data) |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2872 | { |
| 2873 | int bus_id = (int) data; |
| 2874 | |
| 2875 | msm_bus_scale_client_update_request(bus_id, 1); |
Laura Abbott | 72ae4bf | 2011-12-14 14:01:43 -0800 | [diff] [blame] | 2876 | return 0; |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2877 | } |
| 2878 | |
Laura Abbott | 72ae4bf | 2011-12-14 14:01:43 -0800 | [diff] [blame] | 2879 | int release_smi_region(void *data) |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2880 | { |
| 2881 | int bus_id = (int) data; |
| 2882 | |
| 2883 | msm_bus_scale_client_update_request(bus_id, 0); |
Laura Abbott | 72ae4bf | 2011-12-14 14:01:43 -0800 | [diff] [blame] | 2884 | return 0; |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2885 | } |
| 2886 | |
Alex Bird | 199980e | 2011-10-21 11:29:27 -0700 | [diff] [blame] | 2887 | void *setup_smi_region(void) |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2888 | { |
| 2889 | return (void *)msm_bus_scale_register_client(&smi_client_pdata); |
| 2890 | } |
Olav Haugan | ee0f780 | 2011-12-19 13:28:57 -0800 | [diff] [blame] | 2891 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2892 | static struct android_pmem_platform_data android_pmem_smipool_pdata = { |
| 2893 | .name = "pmem_smipool", |
| 2894 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 2895 | .cached = 0, |
| 2896 | .memory_type = MEMTYPE_SMI, |
Alex Bird | 199980e | 2011-10-21 11:29:27 -0700 | [diff] [blame] | 2897 | .request_region = request_smi_region, |
| 2898 | .release_region = release_smi_region, |
| 2899 | .setup_region = setup_smi_region, |
Laura Abbott | 1e36a02 | 2011-06-22 17:08:13 -0700 | [diff] [blame] | 2900 | .map_on_demand = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2901 | }; |
| 2902 | static struct platform_device android_pmem_smipool_device = { |
| 2903 | .name = "android_pmem", |
| 2904 | .id = 7, |
| 2905 | .dev = { .platform_data = &android_pmem_smipool_pdata }, |
| 2906 | }; |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 2907 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 2908 | #endif /*CONFIG_ANDROID_PMEM*/ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2909 | |
| 2910 | #define GPIO_DONGLE_PWR_EN 258 |
| 2911 | static void setup_display_power(void); |
| 2912 | static int lcdc_vga_enabled; |
| 2913 | static int vga_enable_request(int enable) |
| 2914 | { |
| 2915 | if (enable) |
| 2916 | lcdc_vga_enabled = 1; |
| 2917 | else |
| 2918 | lcdc_vga_enabled = 0; |
| 2919 | setup_display_power(); |
| 2920 | |
| 2921 | return 0; |
| 2922 | } |
| 2923 | |
| 2924 | #define GPIO_BACKLIGHT_PWM0 0 |
| 2925 | #define GPIO_BACKLIGHT_PWM1 1 |
| 2926 | |
| 2927 | static int pmic_backlight_gpio[2] |
| 2928 | = { GPIO_BACKLIGHT_PWM0, GPIO_BACKLIGHT_PWM1 }; |
| 2929 | static struct msm_panel_common_pdata lcdc_samsung_panel_data = { |
| 2930 | .gpio_num = pmic_backlight_gpio, /* two LPG CHANNELS for backlight */ |
| 2931 | .vga_switch = vga_enable_request, |
| 2932 | }; |
| 2933 | |
| 2934 | static struct platform_device lcdc_samsung_panel_device = { |
| 2935 | .name = LCDC_SAMSUNG_WSVGA_PANEL_NAME, |
| 2936 | .id = 0, |
| 2937 | .dev = { |
| 2938 | .platform_data = &lcdc_samsung_panel_data, |
| 2939 | } |
| 2940 | }; |
| 2941 | #if (!defined(CONFIG_SPI_QUP)) && \ |
| 2942 | (defined(CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT) || \ |
| 2943 | defined(CONFIG_FB_MSM_LCDC_AUO_WVGA)) |
| 2944 | |
| 2945 | static int lcdc_spi_gpio_array_num[] = { |
| 2946 | LCDC_SPI_GPIO_CLK, |
| 2947 | LCDC_SPI_GPIO_CS, |
| 2948 | LCDC_SPI_GPIO_MOSI, |
| 2949 | }; |
| 2950 | |
| 2951 | static uint32_t lcdc_spi_gpio_config_data[] = { |
| 2952 | GPIO_CFG(LCDC_SPI_GPIO_CLK, 0, |
| 2953 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2954 | GPIO_CFG(LCDC_SPI_GPIO_CS, 0, |
| 2955 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2956 | GPIO_CFG(LCDC_SPI_GPIO_MOSI, 0, |
| 2957 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 2958 | }; |
| 2959 | |
| 2960 | static void lcdc_config_spi_gpios(int enable) |
| 2961 | { |
| 2962 | int n; |
| 2963 | for (n = 0; n < ARRAY_SIZE(lcdc_spi_gpio_config_data); ++n) |
| 2964 | gpio_tlmm_config(lcdc_spi_gpio_config_data[n], 0); |
| 2965 | } |
| 2966 | #endif |
| 2967 | |
| 2968 | #ifdef CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT |
| 2969 | #ifdef CONFIG_SPI_QUP |
| 2970 | static struct spi_board_info lcdc_samsung_spi_board_info[] __initdata = { |
| 2971 | { |
| 2972 | .modalias = LCDC_SAMSUNG_SPI_DEVICE_NAME, |
| 2973 | .mode = SPI_MODE_3, |
| 2974 | .bus_num = 1, |
| 2975 | .chip_select = 0, |
| 2976 | .max_speed_hz = 10800000, |
| 2977 | } |
| 2978 | }; |
| 2979 | #endif /* CONFIG_SPI_QUP */ |
| 2980 | |
| 2981 | static struct msm_panel_common_pdata lcdc_samsung_oled_panel_data = { |
| 2982 | #ifndef CONFIG_SPI_QUP |
| 2983 | .panel_config_gpio = lcdc_config_spi_gpios, |
| 2984 | .gpio_num = lcdc_spi_gpio_array_num, |
| 2985 | #endif |
| 2986 | }; |
| 2987 | |
| 2988 | static struct platform_device lcdc_samsung_oled_panel_device = { |
| 2989 | .name = LCDC_SAMSUNG_OLED_PANEL_NAME, |
| 2990 | .id = 0, |
| 2991 | .dev.platform_data = &lcdc_samsung_oled_panel_data, |
| 2992 | }; |
| 2993 | #endif /*CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT */ |
| 2994 | |
| 2995 | #ifdef CONFIG_FB_MSM_LCDC_AUO_WVGA |
| 2996 | #ifdef CONFIG_SPI_QUP |
| 2997 | static struct spi_board_info lcdc_auo_spi_board_info[] __initdata = { |
| 2998 | { |
| 2999 | .modalias = LCDC_AUO_SPI_DEVICE_NAME, |
| 3000 | .mode = SPI_MODE_3, |
| 3001 | .bus_num = 1, |
| 3002 | .chip_select = 0, |
| 3003 | .max_speed_hz = 10800000, |
| 3004 | } |
| 3005 | }; |
| 3006 | #endif |
| 3007 | |
| 3008 | static struct msm_panel_common_pdata lcdc_auo_wvga_panel_data = { |
| 3009 | #ifndef CONFIG_SPI_QUP |
| 3010 | .panel_config_gpio = lcdc_config_spi_gpios, |
| 3011 | .gpio_num = lcdc_spi_gpio_array_num, |
| 3012 | #endif |
| 3013 | }; |
| 3014 | |
| 3015 | static struct platform_device lcdc_auo_wvga_panel_device = { |
| 3016 | .name = LCDC_AUO_PANEL_NAME, |
| 3017 | .id = 0, |
| 3018 | .dev.platform_data = &lcdc_auo_wvga_panel_data, |
| 3019 | }; |
| 3020 | #endif /*CONFIG_FB_MSM_LCDC_AUO_WVGA*/ |
| 3021 | |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 3022 | #ifdef CONFIG_FB_MSM_LCDC_NT35582_WVGA |
| 3023 | |
| 3024 | #define GPIO_NT35582_RESET 94 |
| 3025 | #define GPIO_NT35582_BL_EN_HW_PIN 24 |
| 3026 | #define GPIO_NT35582_BL_EN \ |
| 3027 | PM8058_GPIO_PM_TO_SYS(GPIO_NT35582_BL_EN_HW_PIN - 1) |
| 3028 | |
| 3029 | static int lcdc_nt35582_pmic_gpio[] = {GPIO_NT35582_BL_EN }; |
| 3030 | |
| 3031 | static struct msm_panel_common_pdata lcdc_nt35582_panel_data = { |
| 3032 | .gpio_num = lcdc_nt35582_pmic_gpio, |
| 3033 | }; |
| 3034 | |
| 3035 | static struct platform_device lcdc_nt35582_panel_device = { |
| 3036 | .name = LCDC_NT35582_PANEL_NAME, |
| 3037 | .id = 0, |
| 3038 | .dev = { |
| 3039 | .platform_data = &lcdc_nt35582_panel_data, |
| 3040 | } |
| 3041 | }; |
| 3042 | |
| 3043 | static struct spi_board_info lcdc_nt35582_spi_board_info[] __initdata = { |
| 3044 | { |
| 3045 | .modalias = "lcdc_nt35582_spi", |
| 3046 | .mode = SPI_MODE_0, |
| 3047 | .bus_num = 0, |
| 3048 | .chip_select = 0, |
| 3049 | .max_speed_hz = 1100000, |
| 3050 | } |
| 3051 | }; |
| 3052 | #endif |
| 3053 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3054 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 3055 | static struct resource hdmi_msm_resources[] = { |
| 3056 | { |
| 3057 | .name = "hdmi_msm_qfprom_addr", |
| 3058 | .start = 0x00700000, |
| 3059 | .end = 0x007060FF, |
| 3060 | .flags = IORESOURCE_MEM, |
| 3061 | }, |
| 3062 | { |
| 3063 | .name = "hdmi_msm_hdmi_addr", |
| 3064 | .start = 0x04A00000, |
| 3065 | .end = 0x04A00FFF, |
| 3066 | .flags = IORESOURCE_MEM, |
| 3067 | }, |
| 3068 | { |
| 3069 | .name = "hdmi_msm_irq", |
| 3070 | .start = HDMI_IRQ, |
| 3071 | .end = HDMI_IRQ, |
| 3072 | .flags = IORESOURCE_IRQ, |
| 3073 | }, |
| 3074 | }; |
| 3075 | |
| 3076 | static int hdmi_enable_5v(int on); |
| 3077 | static int hdmi_core_power(int on, int show); |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 3078 | static int hdmi_gpio_config(int on); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3079 | static int hdmi_cec_power(int on); |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 3080 | static int hdmi_panel_power(int on); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3081 | |
| 3082 | static struct msm_hdmi_platform_data hdmi_msm_data = { |
| 3083 | .irq = HDMI_IRQ, |
| 3084 | .enable_5v = hdmi_enable_5v, |
| 3085 | .core_power = hdmi_core_power, |
| 3086 | .cec_power = hdmi_cec_power, |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 3087 | .panel_power = hdmi_panel_power, |
| 3088 | .gpio_config = hdmi_gpio_config, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3089 | }; |
| 3090 | |
| 3091 | static struct platform_device hdmi_msm_device = { |
| 3092 | .name = "hdmi_msm", |
| 3093 | .id = 0, |
| 3094 | .num_resources = ARRAY_SIZE(hdmi_msm_resources), |
| 3095 | .resource = hdmi_msm_resources, |
| 3096 | .dev.platform_data = &hdmi_msm_data, |
| 3097 | }; |
| 3098 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 3099 | |
| 3100 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 3101 | static struct platform_device mipi_dsi_toshiba_panel_device = { |
| 3102 | .name = "mipi_toshiba", |
| 3103 | .id = 0, |
| 3104 | }; |
| 3105 | |
| 3106 | #define FPGA_3D_GPIO_CONFIG_ADDR 0x1D00017A |
| 3107 | |
Nagamalleswararao Ganji | eac5dfa | 2011-07-23 17:31:16 -0700 | [diff] [blame] | 3108 | static struct mipi_dsi_panel_platform_data novatek_pdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3109 | .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR, |
Chandan Uddaraju | 83eac3c | 2011-09-11 18:32:23 -0700 | [diff] [blame] | 3110 | .fpga_ctrl_mode = FPGA_EBI2_INTF, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3111 | }; |
| 3112 | |
| 3113 | static struct platform_device mipi_dsi_novatek_panel_device = { |
| 3114 | .name = "mipi_novatek", |
| 3115 | .id = 0, |
| 3116 | .dev = { |
| 3117 | .platform_data = &novatek_pdata, |
| 3118 | } |
| 3119 | }; |
| 3120 | #endif |
| 3121 | |
| 3122 | static void __init msm8x60_allocate_memory_regions(void) |
| 3123 | { |
| 3124 | void *addr; |
| 3125 | unsigned long size; |
| 3126 | |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 3127 | if (hdmi_is_primary) |
| 3128 | size = roundup((1920 * 1088 * 4 * 2), 4096); |
| 3129 | else |
| 3130 | size = MSM_FB_SIZE; |
| 3131 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3132 | addr = alloc_bootmem_align(size, 0x1000); |
| 3133 | msm_fb_resources[0].start = __pa(addr); |
| 3134 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 3135 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 3136 | size, addr, __pa(addr)); |
| 3137 | |
| 3138 | } |
| 3139 | |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 3140 | void __init msm8x60_set_display_params(char *prim_panel, char *ext_panel) |
| 3141 | { |
| 3142 | if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) { |
| 3143 | strlcpy(msm_fb_pdata.prim_panel_name, prim_panel, |
| 3144 | PANEL_NAME_MAX_LEN); |
| 3145 | pr_debug("msm_fb_pdata.prim_panel_name %s\n", |
| 3146 | msm_fb_pdata.prim_panel_name); |
| 3147 | |
| 3148 | if (!strncmp((char *)msm_fb_pdata.prim_panel_name, |
| 3149 | HDMI_PANEL_NAME, strnlen(HDMI_PANEL_NAME, |
| 3150 | PANEL_NAME_MAX_LEN))) { |
| 3151 | pr_debug("HDMI is the primary display by" |
| 3152 | " boot parameter\n"); |
| 3153 | hdmi_is_primary = 1; |
Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 3154 | set_mdp_clocks_for_wuxga(); |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 3155 | } |
| 3156 | } |
| 3157 | if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) { |
| 3158 | strlcpy(msm_fb_pdata.ext_panel_name, ext_panel, |
| 3159 | PANEL_NAME_MAX_LEN); |
| 3160 | pr_debug("msm_fb_pdata.ext_panel_name %s\n", |
| 3161 | msm_fb_pdata.ext_panel_name); |
| 3162 | } |
| 3163 | } |
| 3164 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3165 | #if defined(CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC) || \ |
| 3166 | defined(CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC_MODULE) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3167 | /*virtual key support */ |
| 3168 | static ssize_t tma300_vkeys_show(struct kobject *kobj, |
| 3169 | struct kobj_attribute *attr, char *buf) |
| 3170 | { |
| 3171 | return sprintf(buf, |
| 3172 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":60:900:90:120" |
| 3173 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":180:900:90:120" |
| 3174 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":300:900:90:120" |
| 3175 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":420:900:90:120" |
| 3176 | "\n"); |
| 3177 | } |
| 3178 | |
| 3179 | static struct kobj_attribute tma300_vkeys_attr = { |
| 3180 | .attr = { |
| 3181 | .mode = S_IRUGO, |
| 3182 | }, |
| 3183 | .show = &tma300_vkeys_show, |
| 3184 | }; |
| 3185 | |
| 3186 | static struct attribute *tma300_properties_attrs[] = { |
| 3187 | &tma300_vkeys_attr.attr, |
| 3188 | NULL |
| 3189 | }; |
| 3190 | |
| 3191 | static struct attribute_group tma300_properties_attr_group = { |
| 3192 | .attrs = tma300_properties_attrs, |
| 3193 | }; |
| 3194 | |
| 3195 | static struct kobject *properties_kobj; |
| 3196 | |
| 3197 | |
| 3198 | |
| 3199 | #define CYTTSP_TS_GPIO_IRQ 61 |
| 3200 | static int cyttsp_platform_init(struct i2c_client *client) |
| 3201 | { |
| 3202 | int rc = -EINVAL; |
| 3203 | struct regulator *pm8058_l5 = NULL, *pm8058_s3; |
| 3204 | |
| 3205 | if (machine_is_msm8x60_fluid()) { |
| 3206 | pm8058_l5 = regulator_get(NULL, "8058_l5"); |
| 3207 | if (IS_ERR(pm8058_l5)) { |
| 3208 | pr_err("%s: regulator get of 8058_l5 failed (%ld)\n", |
| 3209 | __func__, PTR_ERR(pm8058_l5)); |
| 3210 | rc = PTR_ERR(pm8058_l5); |
| 3211 | return rc; |
| 3212 | } |
| 3213 | rc = regulator_set_voltage(pm8058_l5, 2850000, 2850000); |
| 3214 | if (rc) { |
| 3215 | pr_err("%s: regulator_set_voltage of 8058_l5 failed(%d)\n", |
| 3216 | __func__, rc); |
| 3217 | goto reg_l5_put; |
| 3218 | } |
| 3219 | |
| 3220 | rc = regulator_enable(pm8058_l5); |
| 3221 | if (rc) { |
| 3222 | pr_err("%s: regulator_enable of 8058_l5 failed(%d)\n", |
| 3223 | __func__, rc); |
| 3224 | goto reg_l5_put; |
| 3225 | } |
| 3226 | } |
| 3227 | /* vote for s3 to enable i2c communication lines */ |
| 3228 | pm8058_s3 = regulator_get(NULL, "8058_s3"); |
| 3229 | if (IS_ERR(pm8058_s3)) { |
| 3230 | pr_err("%s: regulator get of 8058_s3 failed (%ld)\n", |
| 3231 | __func__, PTR_ERR(pm8058_s3)); |
| 3232 | rc = PTR_ERR(pm8058_s3); |
| 3233 | goto reg_l5_disable; |
| 3234 | } |
| 3235 | |
| 3236 | rc = regulator_set_voltage(pm8058_s3, 1800000, 1800000); |
| 3237 | if (rc) { |
| 3238 | pr_err("%s: regulator_set_voltage() = %d\n", |
| 3239 | __func__, rc); |
| 3240 | goto reg_s3_put; |
| 3241 | } |
| 3242 | |
| 3243 | rc = regulator_enable(pm8058_s3); |
| 3244 | if (rc) { |
| 3245 | pr_err("%s: regulator_enable of 8058_l5 failed(%d)\n", |
| 3246 | __func__, rc); |
| 3247 | goto reg_s3_put; |
| 3248 | } |
| 3249 | |
| 3250 | /* wait for vregs to stabilize */ |
| 3251 | usleep_range(10000, 10000); |
| 3252 | |
| 3253 | /* check this device active by reading first byte/register */ |
| 3254 | rc = i2c_smbus_read_byte_data(client, 0x01); |
| 3255 | if (rc < 0) { |
| 3256 | pr_err("%s: i2c sanity check failed\n", __func__); |
| 3257 | goto reg_s3_disable; |
| 3258 | } |
| 3259 | |
| 3260 | /* virtual keys */ |
| 3261 | if (machine_is_msm8x60_fluid()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3262 | properties_kobj = kobject_create_and_add("board_properties", |
| 3263 | NULL); |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3264 | if (properties_kobj); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3265 | if (!properties_kobj || rc) |
| 3266 | pr_err("%s: failed to create board_properties\n", |
| 3267 | __func__); |
| 3268 | } |
| 3269 | return CY_OK; |
| 3270 | |
| 3271 | reg_s3_disable: |
| 3272 | regulator_disable(pm8058_s3); |
| 3273 | reg_s3_put: |
| 3274 | regulator_put(pm8058_s3); |
| 3275 | reg_l5_disable: |
| 3276 | if (machine_is_msm8x60_fluid()) |
| 3277 | regulator_disable(pm8058_l5); |
| 3278 | reg_l5_put: |
| 3279 | if (machine_is_msm8x60_fluid()) |
| 3280 | regulator_put(pm8058_l5); |
| 3281 | return rc; |
| 3282 | } |
| 3283 | |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 3284 | /* TODO: Put the regulator to LPM / HPM in suspend/resume*/ |
| 3285 | static int cyttsp_platform_suspend(struct i2c_client *client) |
| 3286 | { |
| 3287 | msleep(20); |
| 3288 | |
| 3289 | return CY_OK; |
| 3290 | } |
| 3291 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3292 | static int cyttsp_platform_resume(struct i2c_client *client) |
| 3293 | { |
| 3294 | /* add any special code to strobe a wakeup pin or chip reset */ |
| 3295 | msleep(10); |
| 3296 | |
| 3297 | return CY_OK; |
| 3298 | } |
| 3299 | |
| 3300 | static struct cyttsp_platform_data cyttsp_fluid_pdata = { |
| 3301 | .flags = 0x04, |
| 3302 | .gen = CY_GEN3, /* or */ |
| 3303 | .use_st = CY_USE_ST, |
| 3304 | .use_mt = CY_USE_MT, |
| 3305 | .use_hndshk = CY_SEND_HNDSHK, |
| 3306 | .use_trk_id = CY_USE_TRACKING_ID, |
Anirudh Ghayal | 1518777 | 2011-06-22 17:39:41 +0530 | [diff] [blame] | 3307 | .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3308 | .use_gestures = CY_USE_GESTURES, |
| 3309 | /* activate up to 4 groups |
| 3310 | * and set active distance |
| 3311 | */ |
| 3312 | .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 | |
| 3313 | CY_GEST_GRP3 | CY_GEST_GRP4 | |
| 3314 | CY_ACT_DIST, |
| 3315 | /* change act_intrvl to customize the Active power state |
| 3316 | * scanning/processing refresh interval for Operating mode |
| 3317 | */ |
| 3318 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 3319 | /* change tch_tmout to customize the touch timeout for the |
| 3320 | * Active power state for Operating mode |
| 3321 | */ |
| 3322 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 3323 | /* change lp_intrvl to customize the Low Power power state |
| 3324 | * scanning/processing refresh interval for Operating mode |
| 3325 | */ |
| 3326 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 3327 | .sleep_gpio = -1, |
| 3328 | .resout_gpio = -1, |
| 3329 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
| 3330 | .resume = cyttsp_platform_resume, |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 3331 | .suspend = cyttsp_platform_suspend, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3332 | .init = cyttsp_platform_init, |
| 3333 | }; |
| 3334 | |
| 3335 | static struct cyttsp_platform_data cyttsp_tmg240_pdata = { |
| 3336 | .panel_maxx = 1083, |
| 3337 | .panel_maxy = 659, |
| 3338 | .disp_minx = 30, |
| 3339 | .disp_maxx = 1053, |
| 3340 | .disp_miny = 30, |
| 3341 | .disp_maxy = 629, |
| 3342 | .correct_fw_ver = 8, |
| 3343 | .fw_fname = "cyttsp_8660_ffa.hex", |
| 3344 | .flags = 0x00, |
| 3345 | .gen = CY_GEN2, /* or */ |
| 3346 | .use_st = CY_USE_ST, |
| 3347 | .use_mt = CY_USE_MT, |
| 3348 | .use_hndshk = CY_SEND_HNDSHK, |
| 3349 | .use_trk_id = CY_USE_TRACKING_ID, |
Anirudh Ghayal | 1518777 | 2011-06-22 17:39:41 +0530 | [diff] [blame] | 3350 | .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3351 | .use_gestures = CY_USE_GESTURES, |
| 3352 | /* activate up to 4 groups |
| 3353 | * and set active distance |
| 3354 | */ |
| 3355 | .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 | |
| 3356 | CY_GEST_GRP3 | CY_GEST_GRP4 | |
| 3357 | CY_ACT_DIST, |
| 3358 | /* change act_intrvl to customize the Active power state |
| 3359 | * scanning/processing refresh interval for Operating mode |
| 3360 | */ |
| 3361 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 3362 | /* change tch_tmout to customize the touch timeout for the |
| 3363 | * Active power state for Operating mode |
| 3364 | */ |
| 3365 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 3366 | /* change lp_intrvl to customize the Low Power power state |
| 3367 | * scanning/processing refresh interval for Operating mode |
| 3368 | */ |
| 3369 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 3370 | .sleep_gpio = -1, |
| 3371 | .resout_gpio = -1, |
| 3372 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
| 3373 | .resume = cyttsp_platform_resume, |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 3374 | .suspend = cyttsp_platform_suspend, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3375 | .init = cyttsp_platform_init, |
Mohan Pallaka | 1ea7d8a | 2011-08-18 15:06:00 +0530 | [diff] [blame] | 3376 | .disable_ghost_det = true, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3377 | }; |
| 3378 | static void cyttsp_set_params(void) |
| 3379 | { |
| 3380 | if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) < 3) { |
| 3381 | cyttsp_fluid_pdata.fw_fname = "cyttsp_8660_fluid_p2.hex"; |
| 3382 | cyttsp_fluid_pdata.panel_maxx = 539; |
| 3383 | cyttsp_fluid_pdata.panel_maxy = 994; |
| 3384 | cyttsp_fluid_pdata.disp_minx = 30; |
| 3385 | cyttsp_fluid_pdata.disp_maxx = 509; |
| 3386 | cyttsp_fluid_pdata.disp_miny = 60; |
| 3387 | cyttsp_fluid_pdata.disp_maxy = 859; |
| 3388 | cyttsp_fluid_pdata.correct_fw_ver = 4; |
| 3389 | } else { |
| 3390 | cyttsp_fluid_pdata.fw_fname = "cyttsp_8660_fluid_p3.hex"; |
| 3391 | cyttsp_fluid_pdata.panel_maxx = 550; |
| 3392 | cyttsp_fluid_pdata.panel_maxy = 1013; |
| 3393 | cyttsp_fluid_pdata.disp_minx = 35; |
| 3394 | cyttsp_fluid_pdata.disp_maxx = 515; |
| 3395 | cyttsp_fluid_pdata.disp_miny = 69; |
| 3396 | cyttsp_fluid_pdata.disp_maxy = 869; |
| 3397 | cyttsp_fluid_pdata.correct_fw_ver = 5; |
| 3398 | } |
| 3399 | |
| 3400 | } |
| 3401 | |
| 3402 | static struct i2c_board_info cyttsp_fluid_info[] __initdata = { |
| 3403 | { |
| 3404 | I2C_BOARD_INFO(CY_I2C_NAME, 0x24), |
| 3405 | .platform_data = &cyttsp_fluid_pdata, |
| 3406 | #ifndef CY_USE_TIMER |
| 3407 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 3408 | #endif /* CY_USE_TIMER */ |
| 3409 | }, |
| 3410 | }; |
| 3411 | |
| 3412 | static struct i2c_board_info cyttsp_ffa_info[] __initdata = { |
| 3413 | { |
| 3414 | I2C_BOARD_INFO(CY_I2C_NAME, 0x3b), |
| 3415 | .platform_data = &cyttsp_tmg240_pdata, |
| 3416 | #ifndef CY_USE_TIMER |
| 3417 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 3418 | #endif /* CY_USE_TIMER */ |
| 3419 | }, |
| 3420 | }; |
| 3421 | #endif |
| 3422 | |
| 3423 | static struct regulator *vreg_tmg200; |
| 3424 | |
| 3425 | #define TS_PEN_IRQ_GPIO 61 |
| 3426 | static int tmg200_power(int vreg_on) |
| 3427 | { |
| 3428 | int rc = -EINVAL; |
| 3429 | |
| 3430 | if (!vreg_tmg200) { |
| 3431 | printk(KERN_ERR "%s: regulator 8058_s3 not found (%d)\n", |
| 3432 | __func__, rc); |
| 3433 | return rc; |
| 3434 | } |
| 3435 | |
| 3436 | rc = vreg_on ? regulator_enable(vreg_tmg200) : |
| 3437 | regulator_disable(vreg_tmg200); |
| 3438 | if (rc < 0) |
| 3439 | printk(KERN_ERR "%s: vreg 8058_s3 %s failed (%d)\n", |
| 3440 | __func__, vreg_on ? "enable" : "disable", rc); |
| 3441 | |
| 3442 | /* wait for vregs to stabilize */ |
Amy Maloche | 12b5d4e | 2011-08-03 15:42:28 -0700 | [diff] [blame] | 3443 | msleep(20); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3444 | |
| 3445 | return rc; |
| 3446 | } |
| 3447 | |
| 3448 | static int tmg200_dev_setup(bool enable) |
| 3449 | { |
| 3450 | int rc; |
| 3451 | |
| 3452 | if (enable) { |
| 3453 | vreg_tmg200 = regulator_get(NULL, "8058_s3"); |
| 3454 | if (IS_ERR(vreg_tmg200)) { |
| 3455 | pr_err("%s: regulator get of 8058_s3 failed (%ld)\n", |
| 3456 | __func__, PTR_ERR(vreg_tmg200)); |
| 3457 | rc = PTR_ERR(vreg_tmg200); |
| 3458 | return rc; |
| 3459 | } |
| 3460 | |
| 3461 | rc = regulator_set_voltage(vreg_tmg200, 1800000, 1800000); |
| 3462 | if (rc) { |
| 3463 | pr_err("%s: regulator_set_voltage() = %d\n", |
| 3464 | __func__, rc); |
| 3465 | goto reg_put; |
| 3466 | } |
| 3467 | } else { |
| 3468 | /* put voltage sources */ |
| 3469 | regulator_put(vreg_tmg200); |
| 3470 | } |
| 3471 | return 0; |
| 3472 | reg_put: |
| 3473 | regulator_put(vreg_tmg200); |
| 3474 | return rc; |
| 3475 | } |
| 3476 | |
| 3477 | static struct cy8c_ts_platform_data cy8ctmg200_pdata = { |
| 3478 | .ts_name = "msm_tmg200_ts", |
| 3479 | .dis_min_x = 0, |
| 3480 | .dis_max_x = 1023, |
| 3481 | .dis_min_y = 0, |
| 3482 | .dis_max_y = 599, |
| 3483 | .min_tid = 0, |
| 3484 | .max_tid = 255, |
| 3485 | .min_touch = 0, |
| 3486 | .max_touch = 255, |
| 3487 | .min_width = 0, |
| 3488 | .max_width = 255, |
| 3489 | .power_on = tmg200_power, |
| 3490 | .dev_setup = tmg200_dev_setup, |
| 3491 | .nfingers = 2, |
| 3492 | .irq_gpio = TS_PEN_IRQ_GPIO, |
| 3493 | .resout_gpio = GPIO_CAP_TS_RESOUT_N, |
| 3494 | }; |
| 3495 | |
| 3496 | static struct i2c_board_info cy8ctmg200_board_info[] = { |
| 3497 | { |
| 3498 | I2C_BOARD_INFO("cy8ctmg200", 0x2), |
| 3499 | .platform_data = &cy8ctmg200_pdata, |
| 3500 | } |
| 3501 | }; |
| 3502 | |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 3503 | static struct regulator *vreg_tma340; |
| 3504 | |
| 3505 | static int tma340_power(int vreg_on) |
| 3506 | { |
| 3507 | int rc = -EINVAL; |
| 3508 | |
| 3509 | if (!vreg_tma340) { |
| 3510 | pr_err("%s: regulator 8901_l2 not found (%d)\n", |
| 3511 | __func__, rc); |
| 3512 | return rc; |
| 3513 | } |
| 3514 | |
| 3515 | rc = vreg_on ? regulator_enable(vreg_tma340) : |
| 3516 | regulator_disable(vreg_tma340); |
| 3517 | if (rc < 0) |
| 3518 | pr_err("%s: vreg 8901_l2 %s failed (%d)\n", |
| 3519 | __func__, vreg_on ? "enable" : "disable", rc); |
| 3520 | |
| 3521 | /* wait for vregs to stabilize */ |
Amy Maloche | b5c67e8d | 2011-08-18 16:39:35 -0700 | [diff] [blame] | 3522 | msleep(100); |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 3523 | |
| 3524 | return rc; |
| 3525 | } |
| 3526 | |
| 3527 | static struct kobject *tma340_prop_kobj; |
| 3528 | |
| 3529 | static int tma340_dragon_dev_setup(bool enable) |
| 3530 | { |
| 3531 | int rc; |
| 3532 | |
| 3533 | if (enable) { |
| 3534 | vreg_tma340 = regulator_get(NULL, "8901_l2"); |
| 3535 | if (IS_ERR(vreg_tma340)) { |
| 3536 | pr_err("%s: regulator get of 8901_l2 failed (%ld)\n", |
| 3537 | __func__, PTR_ERR(vreg_tma340)); |
| 3538 | rc = PTR_ERR(vreg_tma340); |
| 3539 | return rc; |
| 3540 | } |
| 3541 | |
| 3542 | rc = regulator_set_voltage(vreg_tma340, 3300000, 3300000); |
| 3543 | if (rc) { |
| 3544 | pr_err("%s: regulator_set_voltage() = %d\n", |
| 3545 | __func__, rc); |
| 3546 | goto reg_put; |
| 3547 | } |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 3548 | tma340_prop_kobj = kobject_create_and_add("board_properties", |
| 3549 | NULL); |
| 3550 | if (tma340_prop_kobj) { |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3551 | ; |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 3552 | if (rc) { |
| 3553 | kobject_put(tma340_prop_kobj); |
| 3554 | pr_err("%s: failed to create board_properties\n", |
| 3555 | __func__); |
| 3556 | goto reg_put; |
| 3557 | } |
| 3558 | } |
| 3559 | |
| 3560 | } else { |
| 3561 | /* put voltage sources */ |
| 3562 | regulator_put(vreg_tma340); |
| 3563 | /* destroy virtual keys */ |
| 3564 | if (tma340_prop_kobj) { |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 3565 | kobject_put(tma340_prop_kobj); |
| 3566 | } |
| 3567 | } |
| 3568 | return 0; |
| 3569 | reg_put: |
| 3570 | regulator_put(vreg_tma340); |
| 3571 | return rc; |
| 3572 | } |
| 3573 | |
| 3574 | |
| 3575 | static struct cy8c_ts_platform_data cy8ctma340_dragon_pdata = { |
| 3576 | .ts_name = "cy8ctma340", |
| 3577 | .dis_min_x = 0, |
| 3578 | .dis_max_x = 479, |
| 3579 | .dis_min_y = 0, |
| 3580 | .dis_max_y = 799, |
| 3581 | .min_tid = 0, |
| 3582 | .max_tid = 255, |
| 3583 | .min_touch = 0, |
| 3584 | .max_touch = 255, |
| 3585 | .min_width = 0, |
| 3586 | .max_width = 255, |
| 3587 | .power_on = tma340_power, |
| 3588 | .dev_setup = tma340_dragon_dev_setup, |
| 3589 | .nfingers = 2, |
| 3590 | .irq_gpio = TS_PEN_IRQ_GPIO, |
| 3591 | .resout_gpio = -1, |
| 3592 | }; |
| 3593 | |
| 3594 | static struct i2c_board_info cy8ctma340_dragon_board_info[] = { |
| 3595 | { |
| 3596 | I2C_BOARD_INFO("cy8ctma340", 0x24), |
| 3597 | .platform_data = &cy8ctma340_dragon_pdata, |
| 3598 | } |
| 3599 | }; |
| 3600 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3601 | #ifdef CONFIG_SERIAL_MSM_HS |
| 3602 | static int configure_uart_gpios(int on) |
| 3603 | { |
| 3604 | int ret = 0, i; |
| 3605 | int uart_gpios[] = {53, 54, 55, 56}; |
| 3606 | for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) { |
| 3607 | if (on) { |
| 3608 | ret = msm_gpiomux_get(uart_gpios[i]); |
| 3609 | if (unlikely(ret)) |
| 3610 | break; |
| 3611 | } else { |
| 3612 | ret = msm_gpiomux_put(uart_gpios[i]); |
| 3613 | if (unlikely(ret)) |
| 3614 | return ret; |
| 3615 | } |
| 3616 | } |
| 3617 | if (ret) |
| 3618 | for (; i >= 0; i--) |
| 3619 | msm_gpiomux_put(uart_gpios[i]); |
| 3620 | return ret; |
| 3621 | } |
| 3622 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 3623 | .inject_rx_on_wakeup = 1, |
| 3624 | .rx_to_inject = 0xFD, |
| 3625 | .gpio_config = configure_uart_gpios, |
| 3626 | }; |
| 3627 | #endif |
| 3628 | |
| 3629 | |
| 3630 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 3631 | |
| 3632 | static struct gpio_led gpio_exp_leds_config[] = { |
| 3633 | { |
| 3634 | .name = "left_led1:green", |
| 3635 | .gpio = GPIO_LEFT_LED_1, |
| 3636 | .active_low = 1, |
| 3637 | .retain_state_suspended = 0, |
| 3638 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3639 | }, |
| 3640 | { |
| 3641 | .name = "left_led2:red", |
| 3642 | .gpio = GPIO_LEFT_LED_2, |
| 3643 | .active_low = 1, |
| 3644 | .retain_state_suspended = 0, |
| 3645 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3646 | }, |
| 3647 | { |
| 3648 | .name = "left_led3:green", |
| 3649 | .gpio = GPIO_LEFT_LED_3, |
| 3650 | .active_low = 1, |
| 3651 | .retain_state_suspended = 0, |
| 3652 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3653 | }, |
| 3654 | { |
| 3655 | .name = "wlan_led:orange", |
| 3656 | .gpio = GPIO_LEFT_LED_WLAN, |
| 3657 | .active_low = 1, |
| 3658 | .retain_state_suspended = 0, |
| 3659 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3660 | }, |
| 3661 | { |
| 3662 | .name = "left_led5:green", |
| 3663 | .gpio = GPIO_LEFT_LED_5, |
| 3664 | .active_low = 1, |
| 3665 | .retain_state_suspended = 0, |
| 3666 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3667 | }, |
| 3668 | { |
| 3669 | .name = "right_led1:green", |
| 3670 | .gpio = GPIO_RIGHT_LED_1, |
| 3671 | .active_low = 1, |
| 3672 | .retain_state_suspended = 0, |
| 3673 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3674 | }, |
| 3675 | { |
| 3676 | .name = "right_led2:red", |
| 3677 | .gpio = GPIO_RIGHT_LED_2, |
| 3678 | .active_low = 1, |
| 3679 | .retain_state_suspended = 0, |
| 3680 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3681 | }, |
| 3682 | { |
| 3683 | .name = "right_led3:green", |
| 3684 | .gpio = GPIO_RIGHT_LED_3, |
| 3685 | .active_low = 1, |
| 3686 | .retain_state_suspended = 0, |
| 3687 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3688 | }, |
| 3689 | { |
| 3690 | .name = "bt_led:blue", |
| 3691 | .gpio = GPIO_RIGHT_LED_BT, |
| 3692 | .active_low = 1, |
| 3693 | .retain_state_suspended = 0, |
| 3694 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3695 | }, |
| 3696 | { |
| 3697 | .name = "right_led5:green", |
| 3698 | .gpio = GPIO_RIGHT_LED_5, |
| 3699 | .active_low = 1, |
| 3700 | .retain_state_suspended = 0, |
| 3701 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3702 | }, |
| 3703 | }; |
| 3704 | |
| 3705 | static struct gpio_led_platform_data gpio_leds_pdata = { |
| 3706 | .num_leds = ARRAY_SIZE(gpio_exp_leds_config), |
| 3707 | .leds = gpio_exp_leds_config, |
| 3708 | }; |
| 3709 | |
| 3710 | static struct platform_device gpio_leds = { |
| 3711 | .name = "leds-gpio", |
| 3712 | .id = -1, |
| 3713 | .dev = { |
| 3714 | .platform_data = &gpio_leds_pdata, |
| 3715 | }, |
| 3716 | }; |
| 3717 | |
| 3718 | static struct gpio_led fluid_gpio_leds[] = { |
| 3719 | { |
| 3720 | .name = "dual_led:green", |
| 3721 | .gpio = GPIO_LED1_GREEN_N, |
| 3722 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3723 | .active_low = 1, |
| 3724 | .retain_state_suspended = 0, |
| 3725 | }, |
| 3726 | { |
| 3727 | .name = "dual_led:red", |
| 3728 | .gpio = GPIO_LED2_RED_N, |
| 3729 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 3730 | .active_low = 1, |
| 3731 | .retain_state_suspended = 0, |
| 3732 | }, |
| 3733 | }; |
| 3734 | |
| 3735 | static struct gpio_led_platform_data gpio_led_pdata = { |
| 3736 | .leds = fluid_gpio_leds, |
| 3737 | .num_leds = ARRAY_SIZE(fluid_gpio_leds), |
| 3738 | }; |
| 3739 | |
| 3740 | static struct platform_device fluid_leds_gpio = { |
| 3741 | .name = "leds-gpio", |
| 3742 | .id = -1, |
| 3743 | .dev = { |
| 3744 | .platform_data = &gpio_led_pdata, |
| 3745 | }, |
| 3746 | }; |
| 3747 | |
| 3748 | #endif |
| 3749 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3750 | #ifdef CONFIG_BATTERY_MSM8X60 |
| 3751 | static struct msm_charger_platform_data msm_charger_data = { |
| 3752 | .safety_time = 180, |
| 3753 | .update_time = 1, |
| 3754 | .max_voltage = 4200, |
| 3755 | .min_voltage = 3200, |
| 3756 | }; |
| 3757 | |
| 3758 | static struct platform_device msm_charger_device = { |
| 3759 | .name = "msm-charger", |
| 3760 | .id = -1, |
| 3761 | .dev = { |
| 3762 | .platform_data = &msm_charger_data, |
| 3763 | } |
| 3764 | }; |
| 3765 | #endif |
| 3766 | |
| 3767 | /* |
| 3768 | * Consumer specific regulator names: |
| 3769 | * regulator name consumer dev_name |
| 3770 | */ |
| 3771 | static struct regulator_consumer_supply vreg_consumers_PM8058_L0[] = { |
| 3772 | REGULATOR_SUPPLY("8058_l0", NULL), |
| 3773 | }; |
| 3774 | static struct regulator_consumer_supply vreg_consumers_PM8058_L1[] = { |
| 3775 | REGULATOR_SUPPLY("8058_l1", NULL), |
| 3776 | }; |
| 3777 | static struct regulator_consumer_supply vreg_consumers_PM8058_L2[] = { |
| 3778 | REGULATOR_SUPPLY("8058_l2", NULL), |
| 3779 | }; |
| 3780 | static struct regulator_consumer_supply vreg_consumers_PM8058_L3[] = { |
| 3781 | REGULATOR_SUPPLY("8058_l3", NULL), |
| 3782 | }; |
| 3783 | static struct regulator_consumer_supply vreg_consumers_PM8058_L4[] = { |
| 3784 | REGULATOR_SUPPLY("8058_l4", NULL), |
| 3785 | }; |
| 3786 | static struct regulator_consumer_supply vreg_consumers_PM8058_L5[] = { |
| 3787 | REGULATOR_SUPPLY("8058_l5", NULL), |
| 3788 | }; |
| 3789 | static struct regulator_consumer_supply vreg_consumers_PM8058_L6[] = { |
| 3790 | REGULATOR_SUPPLY("8058_l6", NULL), |
| 3791 | }; |
| 3792 | static struct regulator_consumer_supply vreg_consumers_PM8058_L7[] = { |
| 3793 | REGULATOR_SUPPLY("8058_l7", NULL), |
| 3794 | }; |
| 3795 | static struct regulator_consumer_supply vreg_consumers_PM8058_L8[] = { |
| 3796 | REGULATOR_SUPPLY("8058_l8", NULL), |
| 3797 | }; |
| 3798 | static struct regulator_consumer_supply vreg_consumers_PM8058_L9[] = { |
| 3799 | REGULATOR_SUPPLY("8058_l9", NULL), |
| 3800 | }; |
| 3801 | static struct regulator_consumer_supply vreg_consumers_PM8058_L10[] = { |
| 3802 | REGULATOR_SUPPLY("8058_l10", NULL), |
| 3803 | }; |
| 3804 | static struct regulator_consumer_supply vreg_consumers_PM8058_L11[] = { |
| 3805 | REGULATOR_SUPPLY("8058_l11", NULL), |
| 3806 | }; |
| 3807 | static struct regulator_consumer_supply vreg_consumers_PM8058_L12[] = { |
| 3808 | REGULATOR_SUPPLY("8058_l12", NULL), |
| 3809 | }; |
| 3810 | static struct regulator_consumer_supply vreg_consumers_PM8058_L13[] = { |
| 3811 | REGULATOR_SUPPLY("8058_l13", NULL), |
| 3812 | }; |
| 3813 | static struct regulator_consumer_supply vreg_consumers_PM8058_L14[] = { |
| 3814 | REGULATOR_SUPPLY("8058_l14", NULL), |
| 3815 | }; |
| 3816 | static struct regulator_consumer_supply vreg_consumers_PM8058_L15[] = { |
| 3817 | REGULATOR_SUPPLY("8058_l15", NULL), |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 3818 | REGULATOR_SUPPLY("cam_vana", "1-001a"), |
Sreesudhan Ramakrish Ramkumar | 93701d3 | 2012-04-26 15:04:05 -0700 | [diff] [blame] | 3819 | REGULATOR_SUPPLY("cam_vana", "1-006c"), |
Sreesudhan Ramakrish Ramkumar | 9719a99 | 2012-04-16 15:28:05 -0700 | [diff] [blame] | 3820 | REGULATOR_SUPPLY("cam_vana", "1-0078"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3821 | }; |
| 3822 | static struct regulator_consumer_supply vreg_consumers_PM8058_L16[] = { |
| 3823 | REGULATOR_SUPPLY("8058_l16", NULL), |
| 3824 | }; |
| 3825 | static struct regulator_consumer_supply vreg_consumers_PM8058_L17[] = { |
| 3826 | REGULATOR_SUPPLY("8058_l17", NULL), |
| 3827 | }; |
| 3828 | static struct regulator_consumer_supply vreg_consumers_PM8058_L18[] = { |
| 3829 | REGULATOR_SUPPLY("8058_l18", NULL), |
| 3830 | }; |
| 3831 | static struct regulator_consumer_supply vreg_consumers_PM8058_L19[] = { |
| 3832 | REGULATOR_SUPPLY("8058_l19", NULL), |
| 3833 | }; |
| 3834 | static struct regulator_consumer_supply vreg_consumers_PM8058_L20[] = { |
| 3835 | REGULATOR_SUPPLY("8058_l20", NULL), |
| 3836 | }; |
| 3837 | static struct regulator_consumer_supply vreg_consumers_PM8058_L21[] = { |
| 3838 | REGULATOR_SUPPLY("8058_l21", NULL), |
| 3839 | }; |
| 3840 | static struct regulator_consumer_supply vreg_consumers_PM8058_L22[] = { |
| 3841 | REGULATOR_SUPPLY("8058_l22", NULL), |
| 3842 | }; |
| 3843 | static struct regulator_consumer_supply vreg_consumers_PM8058_L23[] = { |
| 3844 | REGULATOR_SUPPLY("8058_l23", NULL), |
| 3845 | }; |
| 3846 | static struct regulator_consumer_supply vreg_consumers_PM8058_L24[] = { |
| 3847 | REGULATOR_SUPPLY("8058_l24", NULL), |
| 3848 | }; |
| 3849 | static struct regulator_consumer_supply vreg_consumers_PM8058_L25[] = { |
| 3850 | REGULATOR_SUPPLY("8058_l25", NULL), |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 3851 | REGULATOR_SUPPLY("cam_vdig", "1-001a"), |
Sreesudhan Ramakrish Ramkumar | 93701d3 | 2012-04-26 15:04:05 -0700 | [diff] [blame] | 3852 | REGULATOR_SUPPLY("cam_vdig", "1-006c"), |
Sreesudhan Ramakrish Ramkumar | 9719a99 | 2012-04-16 15:28:05 -0700 | [diff] [blame] | 3853 | REGULATOR_SUPPLY("cam_vdig", "1-0078"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3854 | }; |
| 3855 | static struct regulator_consumer_supply vreg_consumers_PM8058_S0[] = { |
| 3856 | REGULATOR_SUPPLY("8058_s0", NULL), |
| 3857 | }; |
| 3858 | static struct regulator_consumer_supply vreg_consumers_PM8058_S1[] = { |
| 3859 | REGULATOR_SUPPLY("8058_s1", NULL), |
| 3860 | }; |
| 3861 | static struct regulator_consumer_supply vreg_consumers_PM8058_S2[] = { |
| 3862 | REGULATOR_SUPPLY("8058_s2", NULL), |
| 3863 | }; |
| 3864 | static struct regulator_consumer_supply vreg_consumers_PM8058_S3[] = { |
| 3865 | REGULATOR_SUPPLY("8058_s3", NULL), |
| 3866 | }; |
| 3867 | static struct regulator_consumer_supply vreg_consumers_PM8058_S4[] = { |
| 3868 | REGULATOR_SUPPLY("8058_s4", NULL), |
| 3869 | }; |
| 3870 | static struct regulator_consumer_supply vreg_consumers_PM8058_LVS0[] = { |
| 3871 | REGULATOR_SUPPLY("8058_lvs0", NULL), |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 3872 | REGULATOR_SUPPLY("cam_vio", "1-001a"), |
Sreesudhan Ramakrish Ramkumar | 93701d3 | 2012-04-26 15:04:05 -0700 | [diff] [blame] | 3873 | REGULATOR_SUPPLY("cam_vio", "1-006c"), |
Sreesudhan Ramakrish Ramkumar | 9719a99 | 2012-04-16 15:28:05 -0700 | [diff] [blame] | 3874 | REGULATOR_SUPPLY("cam_vio", "1-0078"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3875 | }; |
| 3876 | static struct regulator_consumer_supply vreg_consumers_PM8058_LVS1[] = { |
| 3877 | REGULATOR_SUPPLY("8058_lvs1", NULL), |
| 3878 | }; |
| 3879 | static struct regulator_consumer_supply vreg_consumers_PM8058_NCP[] = { |
| 3880 | REGULATOR_SUPPLY("8058_ncp", NULL), |
| 3881 | }; |
| 3882 | |
| 3883 | static struct regulator_consumer_supply vreg_consumers_PM8901_L0[] = { |
| 3884 | REGULATOR_SUPPLY("8901_l0", NULL), |
| 3885 | }; |
| 3886 | static struct regulator_consumer_supply vreg_consumers_PM8901_L1[] = { |
| 3887 | REGULATOR_SUPPLY("8901_l1", NULL), |
| 3888 | }; |
| 3889 | static struct regulator_consumer_supply vreg_consumers_PM8901_L2[] = { |
| 3890 | REGULATOR_SUPPLY("8901_l2", NULL), |
| 3891 | }; |
| 3892 | static struct regulator_consumer_supply vreg_consumers_PM8901_L3[] = { |
| 3893 | REGULATOR_SUPPLY("8901_l3", NULL), |
| 3894 | }; |
| 3895 | static struct regulator_consumer_supply vreg_consumers_PM8901_L4[] = { |
| 3896 | REGULATOR_SUPPLY("8901_l4", NULL), |
| 3897 | }; |
| 3898 | static struct regulator_consumer_supply vreg_consumers_PM8901_L5[] = { |
| 3899 | REGULATOR_SUPPLY("8901_l5", NULL), |
| 3900 | }; |
| 3901 | static struct regulator_consumer_supply vreg_consumers_PM8901_L6[] = { |
| 3902 | REGULATOR_SUPPLY("8901_l6", NULL), |
| 3903 | }; |
| 3904 | static struct regulator_consumer_supply vreg_consumers_PM8901_S2[] = { |
| 3905 | REGULATOR_SUPPLY("8901_s2", NULL), |
| 3906 | }; |
| 3907 | static struct regulator_consumer_supply vreg_consumers_PM8901_S3[] = { |
| 3908 | REGULATOR_SUPPLY("8901_s3", NULL), |
| 3909 | }; |
| 3910 | static struct regulator_consumer_supply vreg_consumers_PM8901_S4[] = { |
| 3911 | REGULATOR_SUPPLY("8901_s4", NULL), |
| 3912 | }; |
| 3913 | static struct regulator_consumer_supply vreg_consumers_PM8901_LVS0[] = { |
| 3914 | REGULATOR_SUPPLY("8901_lvs0", NULL), |
| 3915 | }; |
| 3916 | static struct regulator_consumer_supply vreg_consumers_PM8901_LVS1[] = { |
| 3917 | REGULATOR_SUPPLY("8901_lvs1", NULL), |
| 3918 | }; |
| 3919 | static struct regulator_consumer_supply vreg_consumers_PM8901_LVS2[] = { |
| 3920 | REGULATOR_SUPPLY("8901_lvs2", NULL), |
| 3921 | }; |
| 3922 | static struct regulator_consumer_supply vreg_consumers_PM8901_LVS3[] = { |
| 3923 | REGULATOR_SUPPLY("8901_lvs3", NULL), |
| 3924 | }; |
| 3925 | static struct regulator_consumer_supply vreg_consumers_PM8901_MVS0[] = { |
| 3926 | REGULATOR_SUPPLY("8901_mvs0", NULL), |
| 3927 | }; |
| 3928 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 3929 | /* Pin control regulators */ |
| 3930 | static struct regulator_consumer_supply vreg_consumers_PM8058_L8_PC[] = { |
| 3931 | REGULATOR_SUPPLY("8058_l8_pc", NULL), |
| 3932 | }; |
| 3933 | static struct regulator_consumer_supply vreg_consumers_PM8058_L20_PC[] = { |
| 3934 | REGULATOR_SUPPLY("8058_l20_pc", NULL), |
| 3935 | }; |
| 3936 | static struct regulator_consumer_supply vreg_consumers_PM8058_L21_PC[] = { |
| 3937 | REGULATOR_SUPPLY("8058_l21_pc", NULL), |
| 3938 | }; |
| 3939 | static struct regulator_consumer_supply vreg_consumers_PM8058_S2_PC[] = { |
| 3940 | REGULATOR_SUPPLY("8058_s2_pc", NULL), |
| 3941 | }; |
| 3942 | static struct regulator_consumer_supply vreg_consumers_PM8901_L0_PC[] = { |
| 3943 | REGULATOR_SUPPLY("8901_l0_pc", NULL), |
| 3944 | }; |
| 3945 | static struct regulator_consumer_supply vreg_consumers_PM8901_S4_PC[] = { |
| 3946 | REGULATOR_SUPPLY("8901_s4_pc", NULL), |
| 3947 | }; |
| 3948 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3949 | #define RPM_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \ |
| 3950 | _default_uV, _peak_uA, _avg_uA, _pull_down, _pin_ctrl, \ |
David Collins | 1578904 | 2012-03-19 10:44:36 -0700 | [diff] [blame] | 3951 | _freq, _pin_fn, _force_mode, _sleep_set_force_mode, \ |
| 3952 | _state, _sleep_selectable, _always_on) \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 3953 | { \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3954 | .init_data = { \ |
| 3955 | .constraints = { \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 3956 | .valid_modes_mask = _modes, \ |
| 3957 | .valid_ops_mask = _ops, \ |
| 3958 | .min_uV = _min_uV, \ |
| 3959 | .max_uV = _max_uV, \ |
| 3960 | .input_uV = _min_uV, \ |
| 3961 | .apply_uV = _apply_uV, \ |
| 3962 | .always_on = _always_on, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3963 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 3964 | .consumer_supplies = vreg_consumers_##_id, \ |
| 3965 | .num_consumer_supplies = \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3966 | ARRAY_SIZE(vreg_consumers_##_id), \ |
| 3967 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 3968 | .id = RPM_VREG_ID_##_id, \ |
| 3969 | .default_uV = _default_uV, \ |
| 3970 | .peak_uA = _peak_uA, \ |
| 3971 | .avg_uA = _avg_uA, \ |
| 3972 | .pull_down_enable = _pull_down, \ |
| 3973 | .pin_ctrl = _pin_ctrl, \ |
| 3974 | .freq = RPM_VREG_FREQ_##_freq, \ |
| 3975 | .pin_fn = _pin_fn, \ |
| 3976 | .force_mode = _force_mode, \ |
David Collins | 1578904 | 2012-03-19 10:44:36 -0700 | [diff] [blame] | 3977 | .sleep_set_force_mode = _sleep_set_force_mode, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 3978 | .state = _state, \ |
| 3979 | .sleep_selectable = _sleep_selectable, \ |
| 3980 | } |
| 3981 | |
| 3982 | /* Pin control initialization */ |
| 3983 | #define RPM_PC(_id, _always_on, _pin_fn, _pin_ctrl) \ |
| 3984 | { \ |
| 3985 | .init_data = { \ |
| 3986 | .constraints = { \ |
| 3987 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ |
| 3988 | .always_on = _always_on, \ |
| 3989 | }, \ |
| 3990 | .num_consumer_supplies = \ |
| 3991 | ARRAY_SIZE(vreg_consumers_##_id##_PC), \ |
| 3992 | .consumer_supplies = vreg_consumers_##_id##_PC, \ |
| 3993 | }, \ |
| 3994 | .id = RPM_VREG_ID_##_id##_PC, \ |
| 3995 | .pin_fn = RPM_VREG_PIN_FN_8660_##_pin_fn, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3996 | .pin_ctrl = _pin_ctrl, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3997 | } |
| 3998 | |
| 3999 | /* |
| 4000 | * The default LPM/HPM state of an RPM controlled regulator can be controlled |
| 4001 | * via the peak_uA value specified in the table below. If the value is less |
| 4002 | * than the high power min threshold for the regulator, then the regulator will |
| 4003 | * be set to LPM. Otherwise, it will be set to HPM. |
| 4004 | * |
| 4005 | * This value can be further overridden by specifying an initial mode via |
| 4006 | * .init_data.constraints.initial_mode. |
| 4007 | */ |
| 4008 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4009 | #define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \ |
| 4010 | _init_peak_uA) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4011 | RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_FAST | \ |
| 4012 | REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | \ |
| 4013 | REGULATOR_MODE_STANDBY, REGULATOR_CHANGE_VOLTAGE | \ |
| 4014 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \ |
| 4015 | REGULATOR_CHANGE_DRMS, 0, _min_uV, _init_peak_uA, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4016 | _init_peak_uA, _pd, RPM_VREG_PIN_CTRL_NONE, NONE, \ |
| 4017 | RPM_VREG_PIN_FN_8660_ENABLE, \ |
David Collins | 1578904 | 2012-03-19 10:44:36 -0700 | [diff] [blame] | 4018 | RPM_VREG_FORCE_MODE_8660_NONE, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4019 | RPM_VREG_FORCE_MODE_8660_NONE, RPM_VREG_STATE_OFF, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4020 | _sleep_selectable, _always_on) |
| 4021 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4022 | #define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \ |
| 4023 | _init_peak_uA, _freq) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4024 | RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_FAST | \ |
| 4025 | REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | \ |
| 4026 | REGULATOR_MODE_STANDBY, REGULATOR_CHANGE_VOLTAGE | \ |
| 4027 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \ |
| 4028 | REGULATOR_CHANGE_DRMS, 0, _min_uV, _init_peak_uA, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4029 | _init_peak_uA, _pd, RPM_VREG_PIN_CTRL_NONE, _freq, \ |
| 4030 | RPM_VREG_PIN_FN_8660_ENABLE, \ |
David Collins | 1578904 | 2012-03-19 10:44:36 -0700 | [diff] [blame] | 4031 | RPM_VREG_FORCE_MODE_8660_NONE, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4032 | RPM_VREG_FORCE_MODE_8660_NONE, RPM_VREG_STATE_OFF, \ |
| 4033 | _sleep_selectable, _always_on) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4034 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4035 | #define RPM_VS(_id, _always_on, _pd, _sleep_selectable) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4036 | RPM_VREG_INIT(_id, 0, 0, REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE, \ |
| 4037 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE, 0, 0, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4038 | 1000, 1000, _pd, RPM_VREG_PIN_CTRL_NONE, NONE, \ |
| 4039 | RPM_VREG_PIN_FN_8660_ENABLE, \ |
David Collins | 1578904 | 2012-03-19 10:44:36 -0700 | [diff] [blame] | 4040 | RPM_VREG_FORCE_MODE_8660_NONE, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4041 | RPM_VREG_FORCE_MODE_8660_NONE, RPM_VREG_STATE_OFF, \ |
| 4042 | _sleep_selectable, _always_on) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4043 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4044 | #define RPM_NCP(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4045 | RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \ |
| 4046 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4047 | _min_uV, 1000, 1000, _pd, RPM_VREG_PIN_CTRL_NONE, NONE, \ |
| 4048 | RPM_VREG_PIN_FN_8660_ENABLE, \ |
David Collins | 1578904 | 2012-03-19 10:44:36 -0700 | [diff] [blame] | 4049 | RPM_VREG_FORCE_MODE_8660_NONE, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4050 | RPM_VREG_FORCE_MODE_8660_NONE, RPM_VREG_STATE_OFF, \ |
| 4051 | _sleep_selectable, _always_on) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4052 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4053 | #define LDO50HMIN RPM_VREG_8660_LDO_50_HPM_MIN_LOAD |
| 4054 | #define LDO150HMIN RPM_VREG_8660_LDO_150_HPM_MIN_LOAD |
| 4055 | #define LDO300HMIN RPM_VREG_8660_LDO_300_HPM_MIN_LOAD |
| 4056 | #define SMPS_HMIN RPM_VREG_8660_SMPS_HPM_MIN_LOAD |
| 4057 | #define FTS_HMIN RPM_VREG_8660_FTSMPS_HPM_MIN_LOAD |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4058 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4059 | /* RPM early regulator constraints */ |
| 4060 | static struct rpm_regulator_init_data rpm_regulator_early_init_data[] = { |
| 4061 | /* ID a_on pd ss min_uV max_uV init_ip freq */ |
Matt Wagantall | 2ecbec2 | 2012-03-13 23:18:07 -0700 | [diff] [blame] | 4062 | RPM_SMPS(PM8058_S0, 0, 1, 1, 500000, 1325000, SMPS_HMIN, 1p60), |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4063 | RPM_SMPS(PM8058_S1, 0, 1, 1, 500000, 1250000, SMPS_HMIN, 1p60), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4064 | }; |
| 4065 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4066 | /* RPM regulator constraints */ |
| 4067 | static struct rpm_regulator_init_data rpm_regulator_init_data[] = { |
| 4068 | /* ID a_on pd ss min_uV max_uV init_ip */ |
| 4069 | RPM_LDO(PM8058_L0, 0, 1, 0, 1200000, 1200000, LDO150HMIN), |
| 4070 | RPM_LDO(PM8058_L1, 0, 1, 0, 1200000, 1200000, LDO300HMIN), |
| 4071 | RPM_LDO(PM8058_L2, 0, 1, 0, 1800000, 2600000, LDO300HMIN), |
| 4072 | RPM_LDO(PM8058_L3, 0, 1, 0, 1800000, 1800000, LDO150HMIN), |
| 4073 | RPM_LDO(PM8058_L4, 0, 1, 0, 2850000, 2850000, LDO50HMIN), |
| 4074 | RPM_LDO(PM8058_L5, 0, 1, 0, 2850000, 2850000, LDO300HMIN), |
| 4075 | RPM_LDO(PM8058_L6, 0, 1, 0, 3000000, 3600000, LDO50HMIN), |
| 4076 | RPM_LDO(PM8058_L7, 0, 1, 0, 1800000, 1800000, LDO50HMIN), |
| 4077 | RPM_LDO(PM8058_L8, 0, 1, 0, 2900000, 3050000, LDO300HMIN), |
| 4078 | RPM_LDO(PM8058_L9, 0, 1, 0, 1800000, 1800000, LDO300HMIN), |
| 4079 | RPM_LDO(PM8058_L10, 0, 1, 0, 2600000, 2600000, LDO300HMIN), |
| 4080 | RPM_LDO(PM8058_L11, 0, 1, 0, 1500000, 1500000, LDO150HMIN), |
| 4081 | RPM_LDO(PM8058_L12, 0, 1, 0, 2900000, 2900000, LDO150HMIN), |
| 4082 | RPM_LDO(PM8058_L13, 0, 1, 0, 2050000, 2050000, LDO300HMIN), |
| 4083 | RPM_LDO(PM8058_L14, 0, 0, 0, 2850000, 2850000, LDO300HMIN), |
| 4084 | RPM_LDO(PM8058_L15, 0, 1, 0, 2850000, 2850000, LDO300HMIN), |
| 4085 | RPM_LDO(PM8058_L16, 1, 1, 0, 1800000, 1800000, LDO300HMIN), |
| 4086 | RPM_LDO(PM8058_L17, 0, 1, 0, 2600000, 2600000, LDO150HMIN), |
| 4087 | RPM_LDO(PM8058_L18, 0, 1, 0, 2200000, 2200000, LDO150HMIN), |
| 4088 | RPM_LDO(PM8058_L19, 0, 1, 0, 2500000, 2500000, LDO150HMIN), |
| 4089 | RPM_LDO(PM8058_L20, 0, 1, 0, 1800000, 1800000, LDO150HMIN), |
| 4090 | RPM_LDO(PM8058_L21, 1, 1, 0, 1200000, 1200000, LDO150HMIN), |
| 4091 | RPM_LDO(PM8058_L22, 0, 1, 0, 1150000, 1150000, LDO300HMIN), |
| 4092 | RPM_LDO(PM8058_L23, 0, 1, 0, 1200000, 1200000, LDO300HMIN), |
| 4093 | RPM_LDO(PM8058_L24, 0, 1, 0, 1200000, 1200000, LDO150HMIN), |
| 4094 | RPM_LDO(PM8058_L25, 0, 1, 0, 1200000, 1200000, LDO150HMIN), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4095 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4096 | /* ID a_on pd ss min_uV max_uV init_ip freq */ |
| 4097 | RPM_SMPS(PM8058_S2, 0, 1, 1, 1200000, 1400000, SMPS_HMIN, 1p60), |
| 4098 | RPM_SMPS(PM8058_S3, 1, 1, 0, 1800000, 1800000, SMPS_HMIN, 1p60), |
| 4099 | RPM_SMPS(PM8058_S4, 1, 1, 0, 2200000, 2200000, SMPS_HMIN, 1p60), |
| 4100 | |
| 4101 | /* ID a_on pd ss */ |
| 4102 | RPM_VS(PM8058_LVS0, 0, 1, 0), |
| 4103 | RPM_VS(PM8058_LVS1, 0, 1, 0), |
| 4104 | |
| 4105 | /* ID a_on pd ss min_uV max_uV */ |
| 4106 | RPM_NCP(PM8058_NCP, 0, 1, 0, 1800000, 1800000), |
| 4107 | |
| 4108 | /* ID a_on pd ss min_uV max_uV init_ip */ |
| 4109 | RPM_LDO(PM8901_L0, 0, 1, 0, 1200000, 1200000, LDO300HMIN), |
| 4110 | RPM_LDO(PM8901_L1, 0, 1, 0, 3300000, 3300000, LDO300HMIN), |
| 4111 | RPM_LDO(PM8901_L2, 0, 1, 0, 2850000, 3300000, LDO300HMIN), |
| 4112 | RPM_LDO(PM8901_L3, 0, 1, 0, 3300000, 3300000, LDO300HMIN), |
| 4113 | RPM_LDO(PM8901_L4, 0, 1, 0, 2600000, 2600000, LDO300HMIN), |
| 4114 | RPM_LDO(PM8901_L5, 0, 1, 0, 2850000, 2850000, LDO300HMIN), |
| 4115 | RPM_LDO(PM8901_L6, 0, 1, 0, 2200000, 2200000, LDO300HMIN), |
| 4116 | |
| 4117 | /* ID a_on pd ss min_uV max_uV init_ip freq */ |
| 4118 | RPM_SMPS(PM8901_S2, 0, 1, 0, 1300000, 1300000, FTS_HMIN, 1p60), |
| 4119 | RPM_SMPS(PM8901_S3, 0, 1, 0, 1100000, 1100000, FTS_HMIN, 1p60), |
| 4120 | RPM_SMPS(PM8901_S4, 0, 1, 0, 1225000, 1225000, FTS_HMIN, 1p60), |
| 4121 | |
| 4122 | /* ID a_on pd ss */ |
| 4123 | RPM_VS(PM8901_LVS0, 1, 1, 0), |
| 4124 | RPM_VS(PM8901_LVS1, 0, 1, 0), |
| 4125 | RPM_VS(PM8901_LVS2, 0, 1, 0), |
| 4126 | RPM_VS(PM8901_LVS3, 0, 1, 0), |
| 4127 | RPM_VS(PM8901_MVS0, 0, 1, 0), |
| 4128 | |
| 4129 | /* ID a_on pin_func pin_ctrl */ |
| 4130 | RPM_PC(PM8058_L8, 0, SLEEP_B, RPM_VREG_PIN_CTRL_NONE), |
| 4131 | RPM_PC(PM8058_L20, 0, SLEEP_B, RPM_VREG_PIN_CTRL_NONE), |
| 4132 | RPM_PC(PM8058_L21, 1, SLEEP_B, RPM_VREG_PIN_CTRL_NONE), |
| 4133 | RPM_PC(PM8058_S2, 0, ENABLE, RPM_VREG_PIN_CTRL_PM8058_A0), |
| 4134 | RPM_PC(PM8901_L0, 0, ENABLE, RPM_VREG_PIN_CTRL_PM8901_A0), |
| 4135 | RPM_PC(PM8901_S4, 0, ENABLE, RPM_VREG_PIN_CTRL_PM8901_A0), |
| 4136 | }; |
| 4137 | |
| 4138 | static struct rpm_regulator_platform_data rpm_regulator_early_pdata = { |
| 4139 | .init_data = rpm_regulator_early_init_data, |
| 4140 | .num_regulators = ARRAY_SIZE(rpm_regulator_early_init_data), |
| 4141 | .version = RPM_VREG_VERSION_8660, |
| 4142 | .vreg_id_vdd_mem = RPM_VREG_ID_PM8058_S0, |
| 4143 | .vreg_id_vdd_dig = RPM_VREG_ID_PM8058_S1, |
| 4144 | }; |
| 4145 | |
| 4146 | static struct rpm_regulator_platform_data rpm_regulator_pdata = { |
| 4147 | .init_data = rpm_regulator_init_data, |
| 4148 | .num_regulators = ARRAY_SIZE(rpm_regulator_init_data), |
| 4149 | .version = RPM_VREG_VERSION_8660, |
| 4150 | }; |
| 4151 | |
| 4152 | static struct platform_device rpm_regulator_early_device = { |
| 4153 | .name = "rpm-regulator", |
| 4154 | .id = 0, |
| 4155 | .dev = { |
| 4156 | .platform_data = &rpm_regulator_early_pdata, |
| 4157 | }, |
| 4158 | }; |
| 4159 | |
| 4160 | static struct platform_device rpm_regulator_device = { |
| 4161 | .name = "rpm-regulator", |
| 4162 | .id = 1, |
| 4163 | .dev = { |
| 4164 | .platform_data = &rpm_regulator_pdata, |
| 4165 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4166 | }; |
| 4167 | |
| 4168 | static struct platform_device *early_regulators[] __initdata = { |
| 4169 | &msm_device_saw_s0, |
| 4170 | &msm_device_saw_s1, |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 4171 | &rpm_regulator_early_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4172 | }; |
| 4173 | |
| 4174 | static struct platform_device *early_devices[] __initdata = { |
| 4175 | #ifdef CONFIG_MSM_BUS_SCALING |
| 4176 | &msm_bus_apps_fabric, |
| 4177 | &msm_bus_sys_fabric, |
| 4178 | &msm_bus_mm_fabric, |
| 4179 | &msm_bus_sys_fpb, |
| 4180 | &msm_bus_cpss_fpb, |
| 4181 | #endif |
| 4182 | &msm_device_dmov_adm0, |
| 4183 | &msm_device_dmov_adm1, |
| 4184 | }; |
| 4185 | |
| 4186 | #if (defined(CONFIG_MARIMBA_CORE)) && \ |
| 4187 | (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE)) |
| 4188 | |
| 4189 | static int bluetooth_power(int); |
| 4190 | static struct platform_device msm_bt_power_device = { |
| 4191 | .name = "bt_power", |
| 4192 | .id = -1, |
| 4193 | .dev = { |
| 4194 | .platform_data = &bluetooth_power, |
| 4195 | }, |
| 4196 | }; |
| 4197 | #endif |
| 4198 | |
| 4199 | static struct platform_device msm_tsens_device = { |
| 4200 | .name = "tsens-tm", |
| 4201 | .id = -1, |
| 4202 | }; |
| 4203 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4204 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 4205 | enum { |
| 4206 | SX150X_CORE, |
| 4207 | SX150X_DOCKING, |
| 4208 | SX150X_SURF, |
| 4209 | SX150X_LEFT_FHA, |
| 4210 | SX150X_RIGHT_FHA, |
| 4211 | SX150X_SOUTH, |
| 4212 | SX150X_NORTH, |
| 4213 | SX150X_CORE_FLUID, |
| 4214 | }; |
| 4215 | |
| 4216 | static struct sx150x_platform_data sx150x_data[] __initdata = { |
| 4217 | [SX150X_CORE] = { |
| 4218 | .gpio_base = GPIO_CORE_EXPANDER_BASE, |
| 4219 | .oscio_is_gpo = false, |
| 4220 | .io_pullup_ena = 0x0c08, |
| 4221 | .io_pulldn_ena = 0x4060, |
| 4222 | .io_open_drain_ena = 0x000c, |
| 4223 | .io_polarity = 0, |
| 4224 | .irq_summary = -1, /* see fixup_i2c_configs() */ |
| 4225 | .irq_base = GPIO_EXPANDER_IRQ_BASE, |
| 4226 | }, |
| 4227 | [SX150X_DOCKING] = { |
| 4228 | .gpio_base = GPIO_DOCKING_EXPANDER_BASE, |
| 4229 | .oscio_is_gpo = false, |
| 4230 | .io_pullup_ena = 0x5e06, |
| 4231 | .io_pulldn_ena = 0x81b8, |
| 4232 | .io_open_drain_ena = 0, |
| 4233 | .io_polarity = 0, |
| 4234 | .irq_summary = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, |
| 4235 | UI_INT2_N), |
| 4236 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4237 | GPIO_DOCKING_EXPANDER_BASE - |
| 4238 | GPIO_EXPANDER_GPIO_BASE, |
| 4239 | }, |
| 4240 | [SX150X_SURF] = { |
| 4241 | .gpio_base = GPIO_SURF_EXPANDER_BASE, |
| 4242 | .oscio_is_gpo = false, |
| 4243 | .io_pullup_ena = 0, |
| 4244 | .io_pulldn_ena = 0, |
| 4245 | .io_open_drain_ena = 0, |
| 4246 | .io_polarity = 0, |
| 4247 | .irq_summary = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, |
| 4248 | UI_INT1_N), |
| 4249 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4250 | GPIO_SURF_EXPANDER_BASE - |
| 4251 | GPIO_EXPANDER_GPIO_BASE, |
| 4252 | }, |
| 4253 | [SX150X_LEFT_FHA] = { |
| 4254 | .gpio_base = GPIO_LEFT_KB_EXPANDER_BASE, |
| 4255 | .oscio_is_gpo = false, |
| 4256 | .io_pullup_ena = 0, |
| 4257 | .io_pulldn_ena = 0x40, |
| 4258 | .io_open_drain_ena = 0, |
| 4259 | .io_polarity = 0, |
| 4260 | .irq_summary = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, |
| 4261 | UI_INT3_N), |
| 4262 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4263 | GPIO_LEFT_KB_EXPANDER_BASE - |
| 4264 | GPIO_EXPANDER_GPIO_BASE, |
| 4265 | }, |
| 4266 | [SX150X_RIGHT_FHA] = { |
| 4267 | .gpio_base = GPIO_RIGHT_KB_EXPANDER_BASE, |
| 4268 | .oscio_is_gpo = true, |
| 4269 | .io_pullup_ena = 0, |
| 4270 | .io_pulldn_ena = 0, |
| 4271 | .io_open_drain_ena = 0, |
| 4272 | .io_polarity = 0, |
| 4273 | .irq_summary = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, |
| 4274 | UI_INT3_N), |
| 4275 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4276 | GPIO_RIGHT_KB_EXPANDER_BASE - |
| 4277 | GPIO_EXPANDER_GPIO_BASE, |
| 4278 | }, |
| 4279 | [SX150X_SOUTH] = { |
| 4280 | .gpio_base = GPIO_SOUTH_EXPANDER_BASE, |
| 4281 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4282 | GPIO_SOUTH_EXPANDER_BASE - |
| 4283 | GPIO_EXPANDER_GPIO_BASE, |
| 4284 | .irq_summary = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, UI_INT3_N), |
| 4285 | }, |
| 4286 | [SX150X_NORTH] = { |
| 4287 | .gpio_base = GPIO_NORTH_EXPANDER_BASE, |
| 4288 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4289 | GPIO_NORTH_EXPANDER_BASE - |
| 4290 | GPIO_EXPANDER_GPIO_BASE, |
| 4291 | .irq_summary = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, UI_INT3_N), |
| 4292 | .oscio_is_gpo = true, |
| 4293 | .io_open_drain_ena = 0x30, |
| 4294 | }, |
| 4295 | [SX150X_CORE_FLUID] = { |
| 4296 | .gpio_base = GPIO_CORE_EXPANDER_BASE, |
| 4297 | .oscio_is_gpo = false, |
| 4298 | .io_pullup_ena = 0x0408, |
| 4299 | .io_pulldn_ena = 0x4060, |
| 4300 | .io_open_drain_ena = 0x0008, |
| 4301 | .io_polarity = 0, |
| 4302 | .irq_summary = -1, /* see fixup_i2c_configs() */ |
| 4303 | .irq_base = GPIO_EXPANDER_IRQ_BASE, |
| 4304 | }, |
| 4305 | }; |
| 4306 | |
| 4307 | #ifdef CONFIG_SENSORS_MSM_ADC |
| 4308 | /* Configuration of EPM expander is done when client |
| 4309 | * request an adc read |
| 4310 | */ |
| 4311 | static struct sx150x_platform_data sx150x_epmdata = { |
| 4312 | .gpio_base = GPIO_EPM_EXPANDER_BASE, |
| 4313 | .irq_base = GPIO_EXPANDER_IRQ_BASE + |
| 4314 | GPIO_EPM_EXPANDER_BASE - |
| 4315 | GPIO_EXPANDER_GPIO_BASE, |
| 4316 | .irq_summary = -1, |
| 4317 | }; |
| 4318 | #endif |
| 4319 | |
| 4320 | /* sx150x_low_power_cfg |
| 4321 | * |
| 4322 | * This data and init function are used to put unused gpio-expander output |
| 4323 | * lines into their low-power states at boot. The init |
| 4324 | * function must be deferred until a later init stage because the i2c |
| 4325 | * gpio expander drivers do not probe until after they are registered |
| 4326 | * (see register_i2c_devices) and the work-queues for those registrations |
| 4327 | * are processed. Because these lines are unused, there is no risk of |
| 4328 | * competing with a device driver for the gpio. |
| 4329 | * |
| 4330 | * gpio lines whose low-power states are input are naturally in their low- |
| 4331 | * power configurations once probed, see the platform data structures above. |
| 4332 | */ |
| 4333 | struct sx150x_low_power_cfg { |
| 4334 | unsigned gpio; |
| 4335 | unsigned val; |
| 4336 | }; |
| 4337 | |
| 4338 | static struct sx150x_low_power_cfg |
| 4339 | common_sx150x_lp_cfgs[] __initdata = { |
| 4340 | {GPIO_WLAN_DEEP_SLEEP_N, 0}, |
| 4341 | {GPIO_EXT_GPS_LNA_EN, 0}, |
| 4342 | {GPIO_MSM_WAKES_BT, 0}, |
| 4343 | {GPIO_USB_UICC_EN, 0}, |
| 4344 | {GPIO_BATT_GAUGE_EN, 0}, |
| 4345 | }; |
| 4346 | |
| 4347 | static struct sx150x_low_power_cfg |
| 4348 | surf_ffa_sx150x_lp_cfgs[] __initdata = { |
| 4349 | {GPIO_MIPI_DSI_RST_N, 0}, |
| 4350 | {GPIO_DONGLE_PWR_EN, 0}, |
| 4351 | {GPIO_CAP_TS_SLEEP, 1}, |
| 4352 | {GPIO_WEB_CAMIF_RESET_N, 0}, |
| 4353 | }; |
| 4354 | |
| 4355 | static void __init |
| 4356 | cfg_gpio_low_power(struct sx150x_low_power_cfg *cfgs, unsigned nelems) |
| 4357 | { |
| 4358 | unsigned n; |
| 4359 | int rc; |
| 4360 | |
| 4361 | for (n = 0; n < nelems; ++n) { |
| 4362 | rc = gpio_request(cfgs[n].gpio, NULL); |
| 4363 | if (!rc) { |
| 4364 | rc = gpio_direction_output(cfgs[n].gpio, cfgs[n].val); |
| 4365 | gpio_free(cfgs[n].gpio); |
| 4366 | } |
| 4367 | |
| 4368 | if (rc) { |
| 4369 | printk(KERN_NOTICE "%s: failed to sleep gpio %d: %d\n", |
| 4370 | __func__, cfgs[n].gpio, rc); |
| 4371 | } |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 4372 | } |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 4373 | } |
| 4374 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4375 | static int __init cfg_sx150xs_low_power(void) |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 4376 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4377 | cfg_gpio_low_power(common_sx150x_lp_cfgs, |
| 4378 | ARRAY_SIZE(common_sx150x_lp_cfgs)); |
| 4379 | if (!machine_is_msm8x60_fluid()) |
| 4380 | cfg_gpio_low_power(surf_ffa_sx150x_lp_cfgs, |
| 4381 | ARRAY_SIZE(surf_ffa_sx150x_lp_cfgs)); |
| 4382 | return 0; |
| 4383 | } |
| 4384 | module_init(cfg_sx150xs_low_power); |
| 4385 | |
| 4386 | #ifdef CONFIG_I2C |
| 4387 | static struct i2c_board_info core_expander_i2c_info[] __initdata = { |
| 4388 | { |
| 4389 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 4390 | .platform_data = &sx150x_data[SX150X_CORE] |
| 4391 | }, |
| 4392 | }; |
| 4393 | |
| 4394 | static struct i2c_board_info docking_expander_i2c_info[] __initdata = { |
| 4395 | { |
| 4396 | I2C_BOARD_INFO("sx1509q", 0x3f), |
| 4397 | .platform_data = &sx150x_data[SX150X_DOCKING] |
| 4398 | }, |
| 4399 | }; |
| 4400 | |
| 4401 | static struct i2c_board_info surf_expanders_i2c_info[] __initdata = { |
| 4402 | { |
| 4403 | I2C_BOARD_INFO("sx1509q", 0x70), |
| 4404 | .platform_data = &sx150x_data[SX150X_SURF] |
| 4405 | } |
| 4406 | }; |
| 4407 | |
| 4408 | static struct i2c_board_info fha_expanders_i2c_info[] __initdata = { |
| 4409 | { |
| 4410 | I2C_BOARD_INFO("sx1508q", 0x21), |
| 4411 | .platform_data = &sx150x_data[SX150X_LEFT_FHA] |
| 4412 | }, |
| 4413 | { |
| 4414 | I2C_BOARD_INFO("sx1508q", 0x22), |
| 4415 | .platform_data = &sx150x_data[SX150X_RIGHT_FHA] |
| 4416 | } |
| 4417 | }; |
| 4418 | |
| 4419 | static struct i2c_board_info fluid_expanders_i2c_info[] __initdata = { |
| 4420 | { |
| 4421 | I2C_BOARD_INFO("sx1508q", 0x23), |
| 4422 | .platform_data = &sx150x_data[SX150X_SOUTH] |
| 4423 | }, |
| 4424 | { |
| 4425 | I2C_BOARD_INFO("sx1508q", 0x20), |
| 4426 | .platform_data = &sx150x_data[SX150X_NORTH] |
| 4427 | } |
| 4428 | }; |
| 4429 | |
| 4430 | static struct i2c_board_info fluid_core_expander_i2c_info[] __initdata = { |
| 4431 | { |
| 4432 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 4433 | .platform_data = &sx150x_data[SX150X_CORE_FLUID] |
| 4434 | }, |
| 4435 | }; |
| 4436 | |
| 4437 | #ifdef CONFIG_SENSORS_MSM_ADC |
| 4438 | static struct i2c_board_info fluid_expanders_i2c_epm_info[] = { |
| 4439 | { |
| 4440 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 4441 | .platform_data = &sx150x_epmdata |
| 4442 | }, |
| 4443 | }; |
| 4444 | #endif |
| 4445 | #endif |
| 4446 | #endif |
| 4447 | |
| 4448 | #ifdef CONFIG_SENSORS_MSM_ADC |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4449 | |
| 4450 | static struct adc_access_fn xoadc_fn = { |
| 4451 | pm8058_xoadc_select_chan_and_start_conv, |
| 4452 | pm8058_xoadc_read_adc_code, |
| 4453 | pm8058_xoadc_get_properties, |
| 4454 | pm8058_xoadc_slot_request, |
| 4455 | pm8058_xoadc_restore_slot, |
| 4456 | pm8058_xoadc_calibrate, |
| 4457 | }; |
| 4458 | |
| 4459 | #if defined(CONFIG_I2C) && \ |
| 4460 | (defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)) |
| 4461 | static struct regulator *vreg_adc_epm1; |
| 4462 | |
| 4463 | static struct i2c_client *epm_expander_i2c_register_board(void) |
| 4464 | |
| 4465 | { |
| 4466 | struct i2c_adapter *i2c_adap; |
| 4467 | struct i2c_client *client = NULL; |
| 4468 | i2c_adap = i2c_get_adapter(0x0); |
| 4469 | |
| 4470 | if (i2c_adap == NULL) |
| 4471 | printk(KERN_ERR "\nepm_expander_i2c_adapter is NULL\n"); |
| 4472 | |
| 4473 | if (i2c_adap != NULL) |
| 4474 | client = i2c_new_device(i2c_adap, |
| 4475 | &fluid_expanders_i2c_epm_info[0]); |
| 4476 | return client; |
| 4477 | |
| 4478 | } |
| 4479 | |
| 4480 | static unsigned int msm_adc_gpio_configure_expander_enable(void) |
| 4481 | { |
| 4482 | int rc = 0; |
| 4483 | static struct i2c_client *epm_i2c_client; |
| 4484 | |
| 4485 | printk(KERN_DEBUG "Enter msm_adc_gpio_configure_expander_enable\n"); |
| 4486 | |
| 4487 | vreg_adc_epm1 = regulator_get(NULL, "8058_s3"); |
| 4488 | |
| 4489 | if (IS_ERR(vreg_adc_epm1)) { |
| 4490 | printk(KERN_ERR "%s: Unable to get 8058_s3\n", __func__); |
| 4491 | return 0; |
| 4492 | } |
| 4493 | |
| 4494 | rc = regulator_set_voltage(vreg_adc_epm1, 1800000, 1800000); |
| 4495 | if (rc) |
| 4496 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable: " |
| 4497 | "regulator set voltage failed\n"); |
| 4498 | |
| 4499 | rc = regulator_enable(vreg_adc_epm1); |
| 4500 | if (rc) { |
| 4501 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable: " |
| 4502 | "Error while enabling regulator for epm s3 %d\n", rc); |
| 4503 | return rc; |
| 4504 | } |
| 4505 | |
| 4506 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_enable: Start" |
| 4507 | " setting the value of the EPM 3.3, 5v and lvlsft\n"); |
| 4508 | |
| 4509 | msleep(1000); |
| 4510 | |
| 4511 | rc = gpio_request(GPIO_EPM_5V_BOOST_EN, "boost_epm_5v"); |
| 4512 | if (!rc) { |
| 4513 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_enable: " |
| 4514 | "Configure 5v boost\n"); |
| 4515 | gpio_direction_output(GPIO_EPM_5V_BOOST_EN, 1); |
| 4516 | } else { |
| 4517 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable: " |
| 4518 | "Error for epm 5v boost en\n"); |
| 4519 | goto exit_vreg_epm; |
| 4520 | } |
| 4521 | |
| 4522 | msleep(500); |
| 4523 | |
| 4524 | rc = gpio_request(GPIO_EPM_3_3V_EN, "epm_3_3v"); |
| 4525 | if (!rc) { |
| 4526 | gpio_direction_output(GPIO_EPM_3_3V_EN, 1); |
| 4527 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_enable: " |
| 4528 | "Configure epm 3.3v\n"); |
| 4529 | } else { |
| 4530 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable: " |
| 4531 | "Error for gpio 3.3ven\n"); |
| 4532 | goto exit_vreg_epm; |
| 4533 | } |
| 4534 | msleep(500); |
| 4535 | |
| 4536 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_enable: " |
| 4537 | "Trying to request EPM LVLSFT_EN\n"); |
| 4538 | rc = gpio_request(GPIO_EPM_LVLSFT_EN, "lvsft_en"); |
| 4539 | if (!rc) { |
| 4540 | gpio_direction_output(GPIO_EPM_LVLSFT_EN, 1); |
| 4541 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_enable: " |
| 4542 | "Configure the lvlsft\n"); |
| 4543 | } else { |
| 4544 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable: " |
| 4545 | "Error for epm lvlsft_en\n"); |
| 4546 | goto exit_vreg_epm; |
| 4547 | } |
| 4548 | |
| 4549 | msleep(500); |
| 4550 | |
| 4551 | if (!epm_i2c_client) |
| 4552 | epm_i2c_client = epm_expander_i2c_register_board(); |
| 4553 | |
| 4554 | rc = gpio_request(GPIO_PWR_MON_ENABLE, "pwr_mon_enable"); |
| 4555 | if (!rc) |
| 4556 | rc = gpio_direction_output(GPIO_PWR_MON_ENABLE, 1); |
| 4557 | if (rc) { |
| 4558 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4559 | ": GPIO PWR MON Enable issue\n"); |
| 4560 | goto exit_vreg_epm; |
| 4561 | } |
| 4562 | |
| 4563 | msleep(1000); |
| 4564 | |
| 4565 | rc = gpio_request(GPIO_ADC1_PWDN_N, "adc1_pwdn"); |
| 4566 | if (!rc) { |
| 4567 | rc = gpio_direction_output(GPIO_ADC1_PWDN_N, 1); |
| 4568 | if (rc) { |
| 4569 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4570 | ": ADC1_PWDN error direction out\n"); |
| 4571 | goto exit_vreg_epm; |
| 4572 | } |
| 4573 | } |
| 4574 | |
| 4575 | msleep(100); |
| 4576 | |
| 4577 | rc = gpio_request(GPIO_ADC2_PWDN_N, "adc2_pwdn"); |
| 4578 | if (!rc) { |
| 4579 | rc = gpio_direction_output(GPIO_ADC2_PWDN_N, 1); |
| 4580 | if (rc) { |
| 4581 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4582 | ": ADC2_PWD error direction out\n"); |
| 4583 | goto exit_vreg_epm; |
| 4584 | } |
| 4585 | } |
| 4586 | |
| 4587 | msleep(1000); |
| 4588 | |
| 4589 | rc = gpio_request(GPIO_PWR_MON_START, "pwr_mon_start"); |
| 4590 | if (!rc) { |
| 4591 | rc = gpio_direction_output(GPIO_PWR_MON_START, 0); |
| 4592 | if (rc) { |
| 4593 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4594 | "Gpio request problem %d\n", rc); |
| 4595 | goto exit_vreg_epm; |
| 4596 | } |
| 4597 | } |
| 4598 | |
| 4599 | rc = gpio_request(GPIO_EPM_SPI_ADC1_CS_N, "spi_adc1_cs"); |
| 4600 | if (!rc) { |
| 4601 | rc = gpio_direction_output(GPIO_EPM_SPI_ADC1_CS_N, 0); |
| 4602 | if (rc) { |
| 4603 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4604 | ": EPM_SPI_ADC1_CS_N error\n"); |
| 4605 | goto exit_vreg_epm; |
| 4606 | } |
| 4607 | } |
| 4608 | |
| 4609 | rc = gpio_request(GPIO_EPM_SPI_ADC2_CS_N, "spi_adc2_cs"); |
| 4610 | if (!rc) { |
| 4611 | rc = gpio_direction_output(GPIO_EPM_SPI_ADC2_CS_N, 0); |
| 4612 | if (rc) { |
| 4613 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4614 | ": EPM_SPI_ADC2_Cs_N error\n"); |
| 4615 | goto exit_vreg_epm; |
| 4616 | } |
| 4617 | } |
| 4618 | |
| 4619 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_enable: Set " |
| 4620 | "the power monitor reset for epm\n"); |
| 4621 | |
| 4622 | rc = gpio_request(GPIO_PWR_MON_RESET_N, "pwr_mon_reset_n"); |
| 4623 | if (!rc) { |
| 4624 | gpio_direction_output(GPIO_PWR_MON_RESET_N, 0); |
| 4625 | if (rc) { |
| 4626 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable" |
| 4627 | ": Error in the power mon reset\n"); |
| 4628 | goto exit_vreg_epm; |
| 4629 | } |
| 4630 | } |
| 4631 | |
| 4632 | msleep(1000); |
| 4633 | |
| 4634 | gpio_set_value_cansleep(GPIO_PWR_MON_RESET_N, 1); |
| 4635 | |
| 4636 | msleep(500); |
| 4637 | |
| 4638 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC1_CS_N, 1); |
| 4639 | |
| 4640 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC2_CS_N, 1); |
| 4641 | |
| 4642 | return rc; |
| 4643 | |
| 4644 | exit_vreg_epm: |
| 4645 | regulator_disable(vreg_adc_epm1); |
| 4646 | |
| 4647 | printk(KERN_ERR "msm_adc_gpio_configure_expander_enable: Exit." |
| 4648 | " rc = %d.\n", rc); |
| 4649 | return rc; |
| 4650 | }; |
| 4651 | |
| 4652 | static unsigned int msm_adc_gpio_configure_expander_disable(void) |
| 4653 | { |
| 4654 | int rc = 0; |
| 4655 | |
| 4656 | gpio_set_value_cansleep(GPIO_PWR_MON_RESET_N, 0); |
| 4657 | gpio_free(GPIO_PWR_MON_RESET_N); |
| 4658 | |
| 4659 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC1_CS_N, 0); |
| 4660 | gpio_free(GPIO_EPM_SPI_ADC1_CS_N); |
| 4661 | |
| 4662 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC2_CS_N, 0); |
| 4663 | gpio_free(GPIO_EPM_SPI_ADC2_CS_N); |
| 4664 | |
| 4665 | gpio_set_value_cansleep(GPIO_PWR_MON_START, 0); |
| 4666 | gpio_free(GPIO_PWR_MON_START); |
| 4667 | |
| 4668 | gpio_direction_output(GPIO_ADC1_PWDN_N, 0); |
| 4669 | gpio_free(GPIO_ADC1_PWDN_N); |
| 4670 | |
| 4671 | gpio_direction_output(GPIO_ADC2_PWDN_N, 0); |
| 4672 | gpio_free(GPIO_ADC2_PWDN_N); |
| 4673 | |
| 4674 | gpio_set_value_cansleep(GPIO_PWR_MON_ENABLE, 0); |
| 4675 | gpio_free(GPIO_PWR_MON_ENABLE); |
| 4676 | |
| 4677 | gpio_set_value_cansleep(GPIO_EPM_LVLSFT_EN, 0); |
| 4678 | gpio_free(GPIO_EPM_LVLSFT_EN); |
| 4679 | |
| 4680 | gpio_set_value_cansleep(GPIO_EPM_5V_BOOST_EN, 0); |
| 4681 | gpio_free(GPIO_EPM_5V_BOOST_EN); |
| 4682 | |
| 4683 | gpio_set_value_cansleep(GPIO_EPM_3_3V_EN, 0); |
| 4684 | gpio_free(GPIO_EPM_3_3V_EN); |
| 4685 | |
| 4686 | rc = regulator_disable(vreg_adc_epm1); |
| 4687 | if (rc) |
| 4688 | printk(KERN_DEBUG "msm_adc_gpio_configure_expander_disable: " |
| 4689 | "Error while enabling regulator for epm s3 %d\n", rc); |
| 4690 | regulator_put(vreg_adc_epm1); |
| 4691 | |
| 4692 | printk(KERN_DEBUG "Exi msm_adc_gpio_configure_expander_disable\n"); |
| 4693 | return rc; |
| 4694 | }; |
| 4695 | |
| 4696 | unsigned int msm_adc_gpio_expander_enable(int cs_enable) |
| 4697 | { |
| 4698 | int rc = 0; |
| 4699 | |
| 4700 | printk(KERN_DEBUG "msm_adc_gpio_expander_enable: cs_enable = %d", |
| 4701 | cs_enable); |
| 4702 | |
| 4703 | if (cs_enable < 16) { |
| 4704 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC1_CS_N, 0); |
| 4705 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC2_CS_N, 1); |
| 4706 | } else { |
| 4707 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC2_CS_N, 0); |
| 4708 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC1_CS_N, 1); |
| 4709 | } |
| 4710 | return rc; |
| 4711 | }; |
| 4712 | |
| 4713 | unsigned int msm_adc_gpio_expander_disable(int cs_disable) |
| 4714 | { |
| 4715 | int rc = 0; |
| 4716 | |
| 4717 | printk(KERN_DEBUG "Enter msm_adc_gpio_expander_disable.\n"); |
| 4718 | |
| 4719 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC1_CS_N, 1); |
| 4720 | |
| 4721 | gpio_set_value_cansleep(GPIO_EPM_SPI_ADC2_CS_N, 1); |
| 4722 | |
| 4723 | return rc; |
| 4724 | }; |
| 4725 | #endif |
| 4726 | |
| 4727 | static struct msm_adc_channels msm_adc_channels_data[] = { |
| 4728 | {"vbatt", CHANNEL_ADC_VBATT, 0, &xoadc_fn, CHAN_PATH_TYPE2, |
| 4729 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE3, scale_default}, |
| 4730 | {"vcoin", CHANNEL_ADC_VCOIN, 0, &xoadc_fn, CHAN_PATH_TYPE1, |
| 4731 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_default}, |
| 4732 | {"vcharger_channel", CHANNEL_ADC_VCHG, 0, &xoadc_fn, CHAN_PATH_TYPE3, |
| 4733 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE4, scale_default}, |
| 4734 | {"charger_current_monitor", CHANNEL_ADC_CHG_MONITOR, 0, &xoadc_fn, |
| 4735 | CHAN_PATH_TYPE4, |
| 4736 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE1, scale_default}, |
| 4737 | {"vph_pwr", CHANNEL_ADC_VPH_PWR, 0, &xoadc_fn, CHAN_PATH_TYPE5, |
| 4738 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE3, scale_default}, |
| 4739 | {"usb_vbus", CHANNEL_ADC_USB_VBUS, 0, &xoadc_fn, CHAN_PATH_TYPE11, |
| 4740 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE3, scale_default}, |
| 4741 | {"pmic_therm", CHANNEL_ADC_DIE_TEMP, 0, &xoadc_fn, CHAN_PATH_TYPE12, |
| 4742 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE1, scale_pmic_therm}, |
| 4743 | {"pmic_therm_4K", CHANNEL_ADC_DIE_TEMP_4K, 0, &xoadc_fn, |
| 4744 | CHAN_PATH_TYPE12, |
| 4745 | ADC_CONFIG_TYPE1, ADC_CALIB_CONFIG_TYPE7, scale_pmic_therm}, |
| 4746 | {"xo_therm", CHANNEL_ADC_XOTHERM, 0, &xoadc_fn, CHAN_PATH_TYPE_NONE, |
| 4747 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE5, tdkntcgtherm}, |
| 4748 | {"xo_therm_4K", CHANNEL_ADC_XOTHERM_4K, 0, &xoadc_fn, |
| 4749 | CHAN_PATH_TYPE_NONE, |
| 4750 | ADC_CONFIG_TYPE1, ADC_CALIB_CONFIG_TYPE6, tdkntcgtherm}, |
| 4751 | {"hdset_detect", CHANNEL_ADC_HDSET, 0, &xoadc_fn, CHAN_PATH_TYPE6, |
| 4752 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE1, scale_default}, |
| 4753 | {"chg_batt_amon", CHANNEL_ADC_BATT_AMON, 0, &xoadc_fn, CHAN_PATH_TYPE10, |
| 4754 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE1, |
| 4755 | scale_xtern_chgr_cur}, |
| 4756 | {"msm_therm", CHANNEL_ADC_MSM_THERM, 0, &xoadc_fn, CHAN_PATH_TYPE8, |
| 4757 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_msm_therm}, |
| 4758 | {"batt_therm", CHANNEL_ADC_BATT_THERM, 0, &xoadc_fn, CHAN_PATH_TYPE7, |
| 4759 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_batt_therm}, |
| 4760 | {"batt_id", CHANNEL_ADC_BATT_ID, 0, &xoadc_fn, CHAN_PATH_TYPE9, |
| 4761 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_default}, |
| 4762 | {"ref_625mv", CHANNEL_ADC_625_REF, 0, &xoadc_fn, CHAN_PATH_TYPE15, |
| 4763 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_default}, |
| 4764 | {"ref_1250mv", CHANNEL_ADC_1250_REF, 0, &xoadc_fn, CHAN_PATH_TYPE13, |
| 4765 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_default}, |
| 4766 | {"ref_325mv", CHANNEL_ADC_325_REF, 0, &xoadc_fn, CHAN_PATH_TYPE14, |
| 4767 | ADC_CONFIG_TYPE2, ADC_CALIB_CONFIG_TYPE2, scale_default}, |
| 4768 | }; |
| 4769 | |
| 4770 | static char *msm_adc_fluid_device_names[] = { |
| 4771 | "ADS_ADC1", |
| 4772 | "ADS_ADC2", |
| 4773 | }; |
| 4774 | |
| 4775 | static struct msm_adc_platform_data msm_adc_pdata = { |
| 4776 | .channel = msm_adc_channels_data, |
| 4777 | .num_chan_supported = ARRAY_SIZE(msm_adc_channels_data), |
| 4778 | #if defined(CONFIG_I2C) && \ |
| 4779 | (defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)) |
| 4780 | .adc_gpio_enable = msm_adc_gpio_expander_enable, |
| 4781 | .adc_gpio_disable = msm_adc_gpio_expander_disable, |
| 4782 | .adc_fluid_enable = msm_adc_gpio_configure_expander_enable, |
| 4783 | .adc_fluid_disable = msm_adc_gpio_configure_expander_disable, |
| 4784 | #endif |
| 4785 | }; |
| 4786 | |
| 4787 | static struct platform_device msm_adc_device = { |
| 4788 | .name = "msm_adc", |
| 4789 | .id = -1, |
| 4790 | .dev = { |
| 4791 | .platform_data = &msm_adc_pdata, |
| 4792 | }, |
| 4793 | }; |
| 4794 | |
Adinarayana Gupta Grandhi | 4ed4ad8 | 2012-04-03 17:11:56 +0530 | [diff] [blame] | 4795 | static struct msm_rtb_platform_data msm_rtb_pdata = { |
| 4796 | .size = SZ_1M, |
| 4797 | }; |
| 4798 | |
| 4799 | static int __init msm_rtb_set_buffer_size(char *p) |
| 4800 | { |
| 4801 | int s; |
| 4802 | |
| 4803 | s = memparse(p, NULL); |
| 4804 | msm_rtb_pdata.size = ALIGN(s, SZ_4K); |
| 4805 | return 0; |
| 4806 | } |
| 4807 | early_param("msm_rtb_size", msm_rtb_set_buffer_size); |
| 4808 | |
| 4809 | |
| 4810 | static struct platform_device msm_rtb_device = { |
| 4811 | .name = "msm_rtb", |
| 4812 | .id = -1, |
| 4813 | .dev = { |
| 4814 | .platform_data = &msm_rtb_pdata, |
| 4815 | }, |
| 4816 | }; |
| 4817 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4818 | static void pmic8058_xoadc_mpp_config(void) |
| 4819 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4820 | int rc, i; |
| 4821 | struct pm8xxx_mpp_init_info xoadc_mpps[] = { |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4822 | PM8058_MPP_INIT(XOADC_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH5, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4823 | AOUT_CTRL_DISABLE), |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4824 | PM8058_MPP_INIT(XOADC_MPP_5, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH9, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4825 | AOUT_CTRL_DISABLE), |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4826 | PM8058_MPP_INIT(XOADC_MPP_7, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4827 | AOUT_CTRL_DISABLE), |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4828 | PM8058_MPP_INIT(XOADC_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4829 | AOUT_CTRL_DISABLE), |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4830 | PM8058_MPP_INIT(XOADC_MPP_10, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH7, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4831 | AOUT_CTRL_DISABLE), |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4832 | PM8901_MPP_INIT(XOADC_MPP_4, D_OUTPUT, PM8901_MPP_DIG_LEVEL_S4, |
| 4833 | DOUT_CTRL_LOW), |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4834 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4835 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4836 | for (i = 0; i < ARRAY_SIZE(xoadc_mpps); i++) { |
| 4837 | rc = pm8xxx_mpp_config(xoadc_mpps[i].mpp, |
| 4838 | &xoadc_mpps[i].config); |
| 4839 | if (rc) { |
| 4840 | pr_err("%s: Config MPP %d of PM8058 failed\n", |
| 4841 | __func__, xoadc_mpps[i].mpp); |
| 4842 | } |
| 4843 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4844 | } |
| 4845 | |
| 4846 | static struct regulator *vreg_ldo18_adc; |
| 4847 | |
| 4848 | static int pmic8058_xoadc_vreg_config(int on) |
| 4849 | { |
| 4850 | int rc; |
| 4851 | |
| 4852 | if (on) { |
| 4853 | rc = regulator_enable(vreg_ldo18_adc); |
| 4854 | if (rc) |
| 4855 | pr_err("%s: Enable of regulator ldo18_adc " |
| 4856 | "failed\n", __func__); |
| 4857 | } else { |
| 4858 | rc = regulator_disable(vreg_ldo18_adc); |
| 4859 | if (rc) |
| 4860 | pr_err("%s: Disable of regulator ldo18_adc " |
| 4861 | "failed\n", __func__); |
| 4862 | } |
| 4863 | |
| 4864 | return rc; |
| 4865 | } |
| 4866 | |
| 4867 | static int pmic8058_xoadc_vreg_setup(void) |
| 4868 | { |
| 4869 | int rc; |
| 4870 | |
| 4871 | vreg_ldo18_adc = regulator_get(NULL, "8058_l18"); |
| 4872 | if (IS_ERR(vreg_ldo18_adc)) { |
| 4873 | printk(KERN_ERR "%s: vreg get failed (%ld)\n", |
| 4874 | __func__, PTR_ERR(vreg_ldo18_adc)); |
| 4875 | rc = PTR_ERR(vreg_ldo18_adc); |
| 4876 | goto fail; |
| 4877 | } |
| 4878 | |
| 4879 | rc = regulator_set_voltage(vreg_ldo18_adc, 2200000, 2200000); |
| 4880 | if (rc) { |
| 4881 | pr_err("%s: unable to set ldo18 voltage to 2.2V\n", __func__); |
| 4882 | goto fail; |
| 4883 | } |
| 4884 | |
| 4885 | return rc; |
| 4886 | fail: |
| 4887 | regulator_put(vreg_ldo18_adc); |
| 4888 | return rc; |
| 4889 | } |
| 4890 | |
| 4891 | static void pmic8058_xoadc_vreg_shutdown(void) |
| 4892 | { |
| 4893 | regulator_put(vreg_ldo18_adc); |
| 4894 | } |
| 4895 | |
| 4896 | /* usec. For this ADC, |
| 4897 | * this time represents clk rate @ txco w/ 1024 decimation ratio. |
| 4898 | * Each channel has different configuration, thus at the time of starting |
| 4899 | * the conversion, xoadc will return actual conversion time |
| 4900 | * */ |
| 4901 | static struct adc_properties pm8058_xoadc_data = { |
| 4902 | .adc_reference = 2200, /* milli-voltage for this adc */ |
| 4903 | .bitresolution = 15, |
| 4904 | .bipolar = 0, |
| 4905 | .conversiontime = 54, |
| 4906 | }; |
| 4907 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 4908 | static struct xoadc_platform_data pm8058_xoadc_pdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4909 | .xoadc_prop = &pm8058_xoadc_data, |
| 4910 | .xoadc_mpp_config = pmic8058_xoadc_mpp_config, |
| 4911 | .xoadc_vreg_set = pmic8058_xoadc_vreg_config, |
| 4912 | .xoadc_num = XOADC_PMIC_0, |
| 4913 | .xoadc_vreg_setup = pmic8058_xoadc_vreg_setup, |
| 4914 | .xoadc_vreg_shutdown = pmic8058_xoadc_vreg_shutdown, |
| 4915 | }; |
| 4916 | #endif |
| 4917 | |
| 4918 | #ifdef CONFIG_MSM_SDIO_AL |
| 4919 | |
| 4920 | static unsigned mdm2ap_status = 140; |
| 4921 | |
| 4922 | static int configure_mdm2ap_status(int on) |
| 4923 | { |
| 4924 | int ret = 0; |
| 4925 | if (on) |
| 4926 | ret = msm_gpiomux_get(mdm2ap_status); |
| 4927 | else |
| 4928 | ret = msm_gpiomux_put(mdm2ap_status); |
| 4929 | |
| 4930 | if (ret) |
| 4931 | pr_err("%s: mdm2ap_status config failed, on = %d\n", __func__, |
| 4932 | on); |
| 4933 | |
| 4934 | return ret; |
| 4935 | } |
| 4936 | |
| 4937 | |
| 4938 | static int get_mdm2ap_status(void) |
| 4939 | { |
| 4940 | return gpio_get_value(mdm2ap_status); |
| 4941 | } |
| 4942 | |
| 4943 | static struct sdio_al_platform_data sdio_al_pdata = { |
| 4944 | .config_mdm2ap_status = configure_mdm2ap_status, |
| 4945 | .get_mdm2ap_status = get_mdm2ap_status, |
| 4946 | .allow_sdioc_version_major_2 = 0, |
Konstantin Dorfman | ee2e308 | 2011-08-16 15:12:01 +0300 | [diff] [blame] | 4947 | .peer_sdioc_version_minor = 0x0202, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4948 | .peer_sdioc_version_major = 0x0004, |
| 4949 | .peer_sdioc_boot_version_minor = 0x0001, |
| 4950 | .peer_sdioc_boot_version_major = 0x0003 |
| 4951 | }; |
| 4952 | |
| 4953 | struct platform_device msm_device_sdio_al = { |
| 4954 | .name = "msm_sdio_al", |
| 4955 | .id = -1, |
| 4956 | .dev = { |
Maya Erez | 6862b14 | 2011-08-22 09:07:07 +0300 | [diff] [blame] | 4957 | .parent = &msm_charm_modem.dev, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4958 | .platform_data = &sdio_al_pdata, |
| 4959 | }, |
| 4960 | }; |
| 4961 | |
| 4962 | #endif /* CONFIG_MSM_SDIO_AL */ |
| 4963 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 4964 | #define GPIO_VREG_ID_EXT_5V 0 |
| 4965 | |
| 4966 | static struct regulator_consumer_supply vreg_consumers_EXT_5V[] = { |
| 4967 | REGULATOR_SUPPLY("ext_5v", NULL), |
| 4968 | REGULATOR_SUPPLY("8901_mpp0", NULL), |
| 4969 | }; |
| 4970 | |
| 4971 | #define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio, _active_low) \ |
| 4972 | [GPIO_VREG_ID_##_id] = { \ |
| 4973 | .init_data = { \ |
| 4974 | .constraints = { \ |
| 4975 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ |
| 4976 | }, \ |
| 4977 | .num_consumer_supplies = \ |
| 4978 | ARRAY_SIZE(vreg_consumers_##_id), \ |
| 4979 | .consumer_supplies = vreg_consumers_##_id, \ |
| 4980 | }, \ |
| 4981 | .regulator_name = _reg_name, \ |
| 4982 | .active_low = _active_low, \ |
| 4983 | .gpio_label = _gpio_label, \ |
| 4984 | .gpio = _gpio, \ |
| 4985 | } |
| 4986 | |
| 4987 | /* GPIO regulator constraints */ |
| 4988 | static struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] = { |
| 4989 | GPIO_VREG_INIT(EXT_5V, "ext_5v", "ext_5v_en", |
| 4990 | PM8901_MPP_PM_TO_SYS(0), 0), |
| 4991 | }; |
| 4992 | |
| 4993 | /* GPIO regulator */ |
| 4994 | static struct platform_device msm8x60_8901_mpp_vreg __devinitdata = { |
| 4995 | .name = GPIO_REGULATOR_DEV_NAME, |
| 4996 | .id = PM8901_MPP_PM_TO_SYS(0), |
| 4997 | .dev = { |
| 4998 | .platform_data = |
| 4999 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 5000 | }, |
| 5001 | }; |
| 5002 | |
| 5003 | static void __init pm8901_vreg_mpp0_init(void) |
| 5004 | { |
| 5005 | int rc; |
| 5006 | |
| 5007 | struct pm8xxx_mpp_init_info pm8901_vreg_mpp0 = { |
| 5008 | .mpp = PM8901_MPP_PM_TO_SYS(0), |
| 5009 | .config = { |
| 5010 | .type = PM8XXX_MPP_TYPE_D_OUTPUT, |
| 5011 | .level = PM8901_MPP_DIG_LEVEL_VPH, |
| 5012 | }, |
| 5013 | }; |
| 5014 | |
| 5015 | /* |
| 5016 | * Set PMIC 8901 MPP0 active_high to 0 for surf and charm_surf. This |
| 5017 | * implies that the regulator connected to MPP0 is enabled when |
| 5018 | * MPP0 is low. |
| 5019 | */ |
| 5020 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_fusion()) { |
| 5021 | msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V].active_low = 1; |
| 5022 | pm8901_vreg_mpp0.config.control = PM8XXX_MPP_DOUT_CTRL_HIGH; |
| 5023 | } else { |
| 5024 | msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V].active_low = 0; |
| 5025 | pm8901_vreg_mpp0.config.control = PM8XXX_MPP_DOUT_CTRL_LOW; |
| 5026 | } |
| 5027 | |
| 5028 | rc = pm8xxx_mpp_config(pm8901_vreg_mpp0.mpp, &pm8901_vreg_mpp0.config); |
| 5029 | if (rc) |
| 5030 | pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc); |
| 5031 | } |
| 5032 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5033 | static struct platform_device *charm_devices[] __initdata = { |
| 5034 | &msm_charm_modem, |
| 5035 | #ifdef CONFIG_MSM_SDIO_AL |
| 5036 | &msm_device_sdio_al, |
| 5037 | #endif |
| 5038 | }; |
| 5039 | |
Lei Zhou | 338cab8 | 2011-08-19 13:38:17 -0400 | [diff] [blame] | 5040 | #ifdef CONFIG_SND_SOC_MSM8660_APQ |
| 5041 | static struct platform_device *dragon_alsa_devices[] __initdata = { |
| 5042 | &msm_pcm, |
| 5043 | &msm_pcm_routing, |
| 5044 | &msm_cpudai0, |
| 5045 | &msm_cpudai1, |
| 5046 | &msm_cpudai_hdmi_rx, |
| 5047 | &msm_cpudai_bt_rx, |
| 5048 | &msm_cpudai_bt_tx, |
| 5049 | &msm_cpudai_fm_rx, |
| 5050 | &msm_cpudai_fm_tx, |
| 5051 | &msm_cpu_fe, |
| 5052 | &msm_stub_codec, |
| 5053 | &msm_lpa_pcm, |
| 5054 | }; |
| 5055 | #endif |
| 5056 | |
| 5057 | static struct platform_device *asoc_devices[] __initdata = { |
| 5058 | &asoc_msm_pcm, |
| 5059 | &asoc_msm_dai0, |
| 5060 | &asoc_msm_dai1, |
| 5061 | }; |
| 5062 | |
Riaz Rahaman | 0bd7217 | 2012-06-26 18:42:36 +0530 | [diff] [blame] | 5063 | /* qseecom bus scaling */ |
| 5064 | static struct msm_bus_vectors qseecom_clks_init_vectors[] = { |
| 5065 | { |
| 5066 | .src = MSM_BUS_MASTER_SPS, |
| 5067 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 5068 | .ib = 0, |
| 5069 | .ab = 0, |
| 5070 | }, |
| 5071 | { |
| 5072 | .src = MSM_BUS_MASTER_SPDM, |
| 5073 | .dst = MSM_BUS_SLAVE_SPDM, |
| 5074 | .ib = 0, |
| 5075 | .ab = 0, |
| 5076 | }, |
| 5077 | }; |
| 5078 | |
| 5079 | static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = { |
| 5080 | { |
| 5081 | .src = MSM_BUS_MASTER_SPS, |
| 5082 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 5083 | .ib = (492 * 8) * 1000000UL, |
| 5084 | .ab = (492 * 8) * 100000UL, |
| 5085 | }, |
| 5086 | { |
| 5087 | .src = MSM_BUS_MASTER_SPDM, |
| 5088 | .dst = MSM_BUS_SLAVE_SPDM, |
| 5089 | .ib = 0, |
| 5090 | .ab = 0, |
| 5091 | }, |
| 5092 | }; |
| 5093 | |
| 5094 | static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = { |
| 5095 | { |
| 5096 | .src = MSM_BUS_MASTER_SPS, |
| 5097 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 5098 | .ib = 0, |
| 5099 | .ab = 0, |
| 5100 | }, |
| 5101 | { |
| 5102 | .src = MSM_BUS_MASTER_SPDM, |
| 5103 | .dst = MSM_BUS_SLAVE_SPDM, |
| 5104 | .ib = (64 * 8) * 1000000UL, |
| 5105 | .ab = (64 * 8) * 100000UL, |
| 5106 | }, |
| 5107 | }; |
| 5108 | |
| 5109 | static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = { |
| 5110 | { |
| 5111 | ARRAY_SIZE(qseecom_clks_init_vectors), |
| 5112 | qseecom_clks_init_vectors, |
| 5113 | }, |
| 5114 | { |
| 5115 | ARRAY_SIZE(qseecom_enable_dfab_vectors), |
| 5116 | qseecom_enable_sfpb_vectors, |
| 5117 | }, |
| 5118 | { |
| 5119 | ARRAY_SIZE(qseecom_enable_sfpb_vectors), |
| 5120 | qseecom_enable_sfpb_vectors, |
| 5121 | }, |
| 5122 | }; |
| 5123 | |
| 5124 | static struct msm_bus_scale_pdata qseecom_bus_pdata = { |
| 5125 | .usecase = qseecom_hw_bus_scale_usecases, |
| 5126 | .num_usecases = ARRAY_SIZE(qseecom_hw_bus_scale_usecases), |
| 5127 | .name = "qsee", |
| 5128 | }; |
| 5129 | |
| 5130 | static struct platform_device qseecom_device = { |
| 5131 | .name = "qseecom", |
| 5132 | .id = -1, |
| 5133 | .dev = { |
| 5134 | .platform_data = &qseecom_bus_pdata, |
| 5135 | }, |
| 5136 | }; |
| 5137 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5138 | static struct platform_device *surf_devices[] __initdata = { |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 5139 | &msm8x60_device_acpuclk, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5140 | &msm_device_smd, |
| 5141 | &msm_device_uart_dm12, |
Stephen Boyd | 3acc9e4 | 2011-09-28 16:46:40 -0700 | [diff] [blame] | 5142 | &msm_pil_q6v3, |
Stephen Boyd | 4eb885b | 2011-09-29 01:16:03 -0700 | [diff] [blame] | 5143 | &msm_pil_modem, |
Stephen Boyd | d89eebe | 2011-09-28 23:28:11 -0700 | [diff] [blame] | 5144 | &msm_pil_tzapps, |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 5145 | &msm_pil_dsps, |
Riaz Rahaman | dd18ebf | 2012-06-27 16:06:34 +0530 | [diff] [blame] | 5146 | &msm_pil_vidc, |
Riaz Rahaman | 0bd7217 | 2012-06-26 18:42:36 +0530 | [diff] [blame] | 5147 | &qseecom_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5148 | #ifdef CONFIG_I2C_QUP |
| 5149 | &msm_gsbi3_qup_i2c_device, |
| 5150 | &msm_gsbi4_qup_i2c_device, |
| 5151 | &msm_gsbi7_qup_i2c_device, |
| 5152 | &msm_gsbi8_qup_i2c_device, |
| 5153 | &msm_gsbi9_qup_i2c_device, |
| 5154 | &msm_gsbi12_qup_i2c_device, |
| 5155 | #endif |
| 5156 | #ifdef CONFIG_SERIAL_MSM_HS |
| 5157 | &msm_device_uart_dm1, |
| 5158 | #endif |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 5159 | #ifdef CONFIG_MSM_SSBI |
| 5160 | &msm_device_ssbi_pmic1, |
Anirudh Ghayal | c49157f | 2011-11-09 14:49:59 +0530 | [diff] [blame] | 5161 | &msm_device_ssbi_pmic2, |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 5162 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5163 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5164 | &msm_device_ssbi3, |
| 5165 | #endif |
| 5166 | #if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE) |
| 5167 | &isp1763_device, |
| 5168 | #endif |
| 5169 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5170 | #if defined (CONFIG_MSM_8x60_VOIP) |
| 5171 | &asoc_msm_mvs, |
| 5172 | &asoc_mvs_dai0, |
| 5173 | &asoc_mvs_dai1, |
| 5174 | #endif |
Lei Zhou | 338cab8 | 2011-08-19 13:38:17 -0400 | [diff] [blame] | 5175 | |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 5176 | #if defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_EHCI_HCD) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5177 | &msm_device_otg, |
| 5178 | #endif |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 5179 | #ifdef CONFIG_USB_MSM_72K |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5180 | &msm_device_gadget_peripheral, |
| 5181 | #endif |
| 5182 | #ifdef CONFIG_USB_G_ANDROID |
| 5183 | &android_usb_device, |
| 5184 | #endif |
| 5185 | #ifdef CONFIG_BATTERY_MSM |
| 5186 | &msm_batt_device, |
| 5187 | #endif |
| 5188 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5189 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5190 | &android_pmem_device, |
| 5191 | &android_pmem_adsp_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5192 | &android_pmem_smipool_device, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5193 | &android_pmem_audio_device, |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 5194 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 5195 | #endif /*CONFIG_ANDROID_PMEM*/ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5196 | #ifdef CONFIG_MSM_ROTATOR |
| 5197 | &msm_rotator_device, |
| 5198 | #endif |
| 5199 | &msm_fb_device, |
| 5200 | &msm_kgsl_3d0, |
| 5201 | &msm_kgsl_2d0, |
| 5202 | &msm_kgsl_2d1, |
| 5203 | &lcdc_samsung_panel_device, |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 5204 | #ifdef CONFIG_FB_MSM_LCDC_NT35582_WVGA |
| 5205 | &lcdc_nt35582_panel_device, |
| 5206 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5207 | #ifdef CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT |
| 5208 | &lcdc_samsung_oled_panel_device, |
| 5209 | #endif |
| 5210 | #ifdef CONFIG_FB_MSM_LCDC_AUO_WVGA |
| 5211 | &lcdc_auo_wvga_panel_device, |
| 5212 | #endif |
| 5213 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 5214 | &hdmi_msm_device, |
| 5215 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 5216 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 5217 | &mipi_dsi_toshiba_panel_device, |
| 5218 | &mipi_dsi_novatek_panel_device, |
| 5219 | #endif |
| 5220 | #ifdef CONFIG_MSM_CAMERA |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 5221 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5222 | #ifdef CONFIG_MT9E013 |
| 5223 | &msm_camera_sensor_mt9e013, |
| 5224 | #endif |
| 5225 | #ifdef CONFIG_IMX074 |
| 5226 | &msm_camera_sensor_imx074, |
| 5227 | #endif |
| 5228 | #ifdef CONFIG_WEBCAM_OV7692 |
| 5229 | &msm_camera_sensor_webcam_ov7692, |
| 5230 | #endif |
| 5231 | #ifdef CONFIG_WEBCAM_OV9726 |
| 5232 | &msm_camera_sensor_webcam_ov9726, |
| 5233 | #endif |
| 5234 | #ifdef CONFIG_QS_S5K4E1 |
| 5235 | &msm_camera_sensor_qs_s5k4e1, |
| 5236 | #endif |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 5237 | #ifdef CONFIG_VX6953 |
| 5238 | &msm_camera_sensor_vx6953, |
| 5239 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5240 | #endif |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 5241 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5242 | #ifdef CONFIG_MSM_GEMINI |
| 5243 | &msm_gemini_device, |
| 5244 | #endif |
| 5245 | #ifdef CONFIG_MSM_VPE |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 5246 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5247 | &msm_vpe_device, |
| 5248 | #endif |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 5249 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5250 | |
| 5251 | #if defined(CONFIG_MSM_RPM_LOG) || defined(CONFIG_MSM_RPM_LOG_MODULE) |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 5252 | &msm8660_rpm_log_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5253 | #endif |
| 5254 | #if defined(CONFIG_MSM_RPM_STATS_LOG) |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 5255 | &msm8660_rpm_stat_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5256 | #endif |
| 5257 | &msm_device_vidc, |
| 5258 | #if (defined(CONFIG_MARIMBA_CORE)) && \ |
| 5259 | (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE)) |
| 5260 | &msm_bt_power_device, |
| 5261 | #endif |
| 5262 | #ifdef CONFIG_SENSORS_MSM_ADC |
| 5263 | &msm_adc_device, |
| 5264 | #endif |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 5265 | &rpm_regulator_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5266 | |
| 5267 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 5268 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 5269 | &qcrypto_device, |
| 5270 | #endif |
| 5271 | |
| 5272 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 5273 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 5274 | &qcedev_device, |
| 5275 | #endif |
| 5276 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5277 | |
| 5278 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) |
| 5279 | #ifdef CONFIG_MSM_USE_TSIF1 |
| 5280 | &msm_device_tsif[1], |
| 5281 | #else |
| 5282 | &msm_device_tsif[0], |
| 5283 | #endif /* CONFIG_MSM_USE_TSIF1 */ |
| 5284 | #endif /* CONFIG_TSIF */ |
| 5285 | |
| 5286 | #ifdef CONFIG_HW_RANDOM_MSM |
| 5287 | &msm_device_rng, |
| 5288 | #endif |
| 5289 | |
| 5290 | &msm_tsens_device, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 5291 | &msm8660_rpm_device, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5292 | #ifdef CONFIG_ION_MSM |
| 5293 | &ion_dev, |
| 5294 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 5295 | &msm8660_device_watchdog, |
Mona Hossain | ceca615 | 2012-04-10 09:55:41 -0700 | [diff] [blame] | 5296 | &msm_device_tz_log, |
Adinarayana Gupta Grandhi | 4ed4ad8 | 2012-04-03 17:11:56 +0530 | [diff] [blame] | 5297 | &msm_rtb_device, |
Laura Abbott | d92be42 | 2012-06-04 15:11:09 -0700 | [diff] [blame] | 5298 | &msm8660_iommu_domain_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5299 | }; |
| 5300 | |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5301 | #ifdef CONFIG_ION_MSM |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5302 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 5303 | static struct ion_cp_heap_pdata cp_mm_ion_pdata = { |
| 5304 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
Olav Haugan | 8726caf | 2012-05-10 15:11:35 -0700 | [diff] [blame] | 5305 | .align = SZ_64K, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5306 | .request_region = request_smi_region, |
| 5307 | .release_region = release_smi_region, |
| 5308 | .setup_region = setup_smi_region, |
Chintan Pandya | 490c971 | 2012-08-07 17:19:59 +0530 | [diff] [blame^] | 5309 | .secure_base = SECURE_BASE, |
| 5310 | .secure_size = SECURE_SIZE, |
Olav Haugan | 8726caf | 2012-05-10 15:11:35 -0700 | [diff] [blame] | 5311 | .iommu_map_all = 1, |
| 5312 | .iommu_2x_map_domain = VIDEO_DOMAIN, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5313 | }; |
| 5314 | |
| 5315 | static struct ion_cp_heap_pdata cp_mfc_ion_pdata = { |
| 5316 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5317 | .align = PAGE_SIZE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5318 | .request_region = request_smi_region, |
| 5319 | .release_region = release_smi_region, |
| 5320 | .setup_region = setup_smi_region, |
| 5321 | }; |
| 5322 | |
| 5323 | static struct ion_cp_heap_pdata cp_wb_ion_pdata = { |
| 5324 | .permission_type = IPT_TYPE_MDP_WRITEBACK, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5325 | .align = PAGE_SIZE, |
| 5326 | }; |
| 5327 | |
Chintan Pandya | 7c2b9cb | 2012-06-25 14:35:02 +0530 | [diff] [blame] | 5328 | static struct ion_co_heap_pdata mm_fw_co_ion_pdata = { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5329 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5330 | }; |
| 5331 | |
| 5332 | static struct ion_co_heap_pdata co_ion_pdata = { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5333 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 5334 | .align = PAGE_SIZE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5335 | }; |
| 5336 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 5337 | |
| 5338 | /** |
| 5339 | * These heaps are listed in the order they will be allocated. Due to |
| 5340 | * video hardware restrictions and content protection the FW heap has to |
| 5341 | * be allocated adjacent (below) the MM heap and the MFC heap has to be |
| 5342 | * allocated after the MM heap to ensure MFC heap is not more than 256MB |
| 5343 | * away from the base address of the FW heap. |
| 5344 | * However, the order of FW heap and MM heap doesn't matter since these |
| 5345 | * two heaps are taken care of by separate code to ensure they are adjacent |
| 5346 | * to each other. |
| 5347 | * Don't swap the order unless you know what you are doing! |
| 5348 | */ |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 5349 | static struct ion_platform_data ion_pdata = { |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5350 | .nr = MSM_ION_HEAP_NUM, |
| 5351 | .heaps = { |
| 5352 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5353 | .id = ION_SYSTEM_HEAP_ID, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5354 | .type = ION_HEAP_TYPE_SYSTEM, |
| 5355 | .name = ION_VMALLOC_HEAP_NAME, |
| 5356 | }, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5357 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 5358 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5359 | .id = ION_CP_MM_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 5360 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5361 | .name = ION_MM_HEAP_NAME, |
Chintan Pandya | fda5bc4 | 2012-05-08 14:15:33 +0530 | [diff] [blame] | 5362 | .base = MSM_ION_MM_BASE, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5363 | .size = MSM_ION_MM_SIZE, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5364 | .memory_type = ION_SMI_TYPE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5365 | .extra_data = (void *) &cp_mm_ion_pdata, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5366 | }, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5367 | { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5368 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 5369 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 5370 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
Chintan Pandya | 7c2b9cb | 2012-06-25 14:35:02 +0530 | [diff] [blame] | 5371 | .base = MSM_MM_FW_BASE, |
| 5372 | .size = MSM_MM_FW_SIZE, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5373 | .memory_type = ION_SMI_TYPE, |
Chintan Pandya | 7c2b9cb | 2012-06-25 14:35:02 +0530 | [diff] [blame] | 5374 | .extra_data = (void *) &mm_fw_co_ion_pdata, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 5375 | }, |
| 5376 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5377 | .id = ION_CP_MFC_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 5378 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5379 | .name = ION_MFC_HEAP_NAME, |
Chintan Pandya | fda5bc4 | 2012-05-08 14:15:33 +0530 | [diff] [blame] | 5380 | .base = MSM_ION_MFC_BASE, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5381 | .size = MSM_ION_MFC_SIZE, |
| 5382 | .memory_type = ION_SMI_TYPE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5383 | .extra_data = (void *) &cp_mfc_ion_pdata, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5384 | }, |
| 5385 | { |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 5386 | .id = ION_SF_HEAP_ID, |
| 5387 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 5388 | .name = ION_SF_HEAP_NAME, |
| 5389 | .size = MSM_ION_SF_SIZE, |
| 5390 | .memory_type = ION_EBI_TYPE, |
| 5391 | .extra_data = (void *)&co_ion_pdata, |
| 5392 | }, |
| 5393 | { |
| 5394 | .id = ION_CAMERA_HEAP_ID, |
| 5395 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 5396 | .name = ION_CAMERA_HEAP_NAME, |
| 5397 | .size = MSM_ION_CAMERA_SIZE, |
| 5398 | .memory_type = ION_EBI_TYPE, |
| 5399 | .extra_data = &co_ion_pdata, |
| 5400 | }, |
| 5401 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5402 | .id = ION_CP_WB_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 5403 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5404 | .name = ION_WB_HEAP_NAME, |
| 5405 | .size = MSM_ION_WB_SIZE, |
| 5406 | .memory_type = ION_EBI_TYPE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 5407 | .extra_data = (void *) &cp_wb_ion_pdata, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5408 | }, |
Olav Haugan | 3a55e32 | 2012-01-23 14:24:01 -0800 | [diff] [blame] | 5409 | { |
Olav Haugan | 6ab4725 | 2012-02-15 14:46:49 -0800 | [diff] [blame] | 5410 | .id = ION_QSECOM_HEAP_ID, |
| 5411 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 5412 | .name = ION_QSECOM_HEAP_NAME, |
| 5413 | .size = MSM_ION_QSECOM_SIZE, |
| 5414 | .memory_type = ION_EBI_TYPE, |
| 5415 | .extra_data = (void *) &co_ion_pdata, |
| 5416 | }, |
| 5417 | { |
Olav Haugan | 3a55e32 | 2012-01-23 14:24:01 -0800 | [diff] [blame] | 5418 | .id = ION_AUDIO_HEAP_ID, |
| 5419 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 5420 | .name = ION_AUDIO_HEAP_NAME, |
| 5421 | .size = MSM_ION_AUDIO_SIZE, |
| 5422 | .memory_type = ION_EBI_TYPE, |
| 5423 | .extra_data = (void *)&co_ion_pdata, |
| 5424 | }, |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5425 | #endif |
| 5426 | } |
| 5427 | }; |
| 5428 | |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 5429 | static struct platform_device ion_dev = { |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5430 | .name = "ion-msm", |
| 5431 | .id = 1, |
| 5432 | .dev = { .platform_data = &ion_pdata }, |
| 5433 | }; |
| 5434 | #endif |
| 5435 | |
| 5436 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5437 | static struct memtype_reserve msm8x60_reserve_table[] __initdata = { |
| 5438 | /* Kernel SMI memory pool for video core, used for firmware */ |
| 5439 | /* and encoder, decoder scratch buffers */ |
| 5440 | /* Kernel SMI memory pool should always precede the user space */ |
| 5441 | /* SMI memory pool, as the video core will use offset address */ |
| 5442 | /* from the Firmware base */ |
| 5443 | [MEMTYPE_SMI_KERNEL] = { |
| 5444 | .start = KERNEL_SMI_BASE, |
| 5445 | .limit = KERNEL_SMI_SIZE, |
| 5446 | .size = KERNEL_SMI_SIZE, |
| 5447 | .flags = MEMTYPE_FLAGS_FIXED, |
| 5448 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5449 | [MEMTYPE_SMI] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5450 | }, |
| 5451 | [MEMTYPE_EBI0] = { |
| 5452 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 5453 | }, |
| 5454 | [MEMTYPE_EBI1] = { |
| 5455 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 5456 | }, |
| 5457 | }; |
| 5458 | |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 5459 | static void __init reserve_ion_memory(void) |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5460 | { |
| 5461 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 5462 | unsigned int i; |
| 5463 | |
| 5464 | if (hdmi_is_primary) { |
| 5465 | msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE; |
| 5466 | for (i = 0; i < ion_pdata.nr; i++) { |
| 5467 | if (ion_pdata.heaps[i].id == ION_SF_HEAP_ID) { |
| 5468 | ion_pdata.heaps[i].size = msm_ion_sf_size; |
| 5469 | pr_debug("msm_ion_sf_size 0x%x\n", |
| 5470 | msm_ion_sf_size); |
| 5471 | break; |
| 5472 | } |
| 5473 | } |
| 5474 | } |
| 5475 | |
Olav Haugan | 8726caf | 2012-05-10 15:11:35 -0700 | [diff] [blame] | 5476 | /* Verify size of heap is a multiple of 64K */ |
| 5477 | for (i = 0; i < ion_pdata.nr; i++) { |
| 5478 | struct ion_platform_heap *heap = &(ion_pdata.heaps[i]); |
| 5479 | |
| 5480 | if (heap->extra_data && heap->type == ION_HEAP_TYPE_CP) { |
| 5481 | int map_all = ((struct ion_cp_heap_pdata *) |
| 5482 | heap->extra_data)->iommu_map_all; |
| 5483 | |
| 5484 | if (map_all && (heap->size & (SZ_64K-1))) { |
| 5485 | heap->size = ALIGN(heap->size, SZ_64K); |
| 5486 | pr_err("Heap %s size is not a multiple of 64K. Adjusting size to %x\n", |
| 5487 | heap->name, heap->size); |
| 5488 | |
| 5489 | } |
| 5490 | } |
| 5491 | } |
| 5492 | |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 5493 | msm8x60_reserve_table[MEMTYPE_EBI1].size += msm_ion_sf_size; |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 5494 | msm8x60_reserve_table[MEMTYPE_EBI1].size += MSM_ION_CAMERA_SIZE; |
| 5495 | msm8x60_reserve_table[MEMTYPE_EBI1].size += MSM_ION_WB_SIZE; |
Olav Haugan | 3a55e32 | 2012-01-23 14:24:01 -0800 | [diff] [blame] | 5496 | msm8x60_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE; |
Olav Haugan | 8d8c2d1 | 2012-04-02 12:01:44 -0700 | [diff] [blame] | 5497 | msm8x60_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE; |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5498 | #endif |
| 5499 | } |
| 5500 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5501 | static void __init size_pmem_devices(void) |
| 5502 | { |
| 5503 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5504 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5505 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 5506 | android_pmem_smipool_pdata.size = MSM_PMEM_SMIPOOL_SIZE; |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 5507 | |
| 5508 | if (hdmi_is_primary) |
| 5509 | pmem_sf_size = MSM_HDMI_PRIM_PMEM_SF_SIZE; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5510 | android_pmem_pdata.size = pmem_sf_size; |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5511 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 5512 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 5513 | #endif /*CONFIG_ANDROID_PMEM*/ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5514 | } |
| 5515 | |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 5516 | #ifdef CONFIG_ANDROID_PMEM |
| 5517 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5518 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 5519 | { |
| 5520 | msm8x60_reserve_table[p->memory_type].size += p->size; |
| 5521 | } |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 5522 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 5523 | #endif /*CONFIG_ANDROID_PMEM*/ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5524 | |
| 5525 | static void __init reserve_pmem_memory(void) |
| 5526 | { |
| 5527 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5528 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5529 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 5530 | reserve_memory_for(&android_pmem_smipool_pdata); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5531 | reserve_memory_for(&android_pmem_pdata); |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5532 | reserve_memory_for(&android_pmem_audio_pdata); |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 5533 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5534 | msm8x60_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
Chaithanya Krishna Bacharaju | 23685fb | 2012-03-19 11:43:53 +0530 | [diff] [blame] | 5535 | #endif /*CONFIG_ANDROID_PMEM*/ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5536 | } |
| 5537 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 5538 | static void __init reserve_mdp_memory(void); |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5539 | |
Adinarayana Gupta Grandhi | 4ed4ad8 | 2012-04-03 17:11:56 +0530 | [diff] [blame] | 5540 | static void __init reserve_rtb_memory(void) |
| 5541 | { |
| 5542 | #if defined(CONFIG_MSM_RTB) |
| 5543 | msm8x60_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size; |
| 5544 | #endif |
| 5545 | } |
| 5546 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5547 | static void __init msm8x60_calculate_reserve_sizes(void) |
| 5548 | { |
| 5549 | size_pmem_devices(); |
| 5550 | reserve_pmem_memory(); |
Laura Abbott | 63cfd7e | 2011-10-10 18:21:01 -0700 | [diff] [blame] | 5551 | reserve_ion_memory(); |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 5552 | reserve_mdp_memory(); |
Adinarayana Gupta Grandhi | 4ed4ad8 | 2012-04-03 17:11:56 +0530 | [diff] [blame] | 5553 | reserve_rtb_memory(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5554 | } |
| 5555 | |
| 5556 | static int msm8x60_paddr_to_memtype(unsigned int paddr) |
| 5557 | { |
| 5558 | if (paddr >= 0x40000000 && paddr < 0x60000000) |
| 5559 | return MEMTYPE_EBI1; |
| 5560 | if (paddr >= 0x38000000 && paddr < 0x40000000) |
| 5561 | return MEMTYPE_SMI; |
| 5562 | return MEMTYPE_NONE; |
| 5563 | } |
| 5564 | |
| 5565 | static struct reserve_info msm8x60_reserve_info __initdata = { |
| 5566 | .memtype_reserve_table = msm8x60_reserve_table, |
| 5567 | .calculate_reserve_sizes = msm8x60_calculate_reserve_sizes, |
| 5568 | .paddr_to_memtype = msm8x60_paddr_to_memtype, |
| 5569 | }; |
| 5570 | |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 5571 | static char prim_panel_name[PANEL_NAME_MAX_LEN]; |
| 5572 | static char ext_panel_name[PANEL_NAME_MAX_LEN]; |
| 5573 | static int __init prim_display_setup(char *param) |
| 5574 | { |
| 5575 | if (strnlen(param, PANEL_NAME_MAX_LEN)) |
| 5576 | strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN); |
| 5577 | return 0; |
| 5578 | } |
| 5579 | early_param("prim_display", prim_display_setup); |
| 5580 | |
| 5581 | static int __init ext_display_setup(char *param) |
| 5582 | { |
| 5583 | if (strnlen(param, PANEL_NAME_MAX_LEN)) |
| 5584 | strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN); |
| 5585 | return 0; |
| 5586 | } |
| 5587 | early_param("ext_display", ext_display_setup); |
| 5588 | |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 5589 | static void __init msm8x60_reserve(void) |
| 5590 | { |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 5591 | msm8x60_set_display_params(prim_panel_name, ext_panel_name); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5592 | reserve_info = &msm8x60_reserve_info; |
| 5593 | msm_reserve(); |
| 5594 | } |
| 5595 | |
| 5596 | #define EXT_CHG_VALID_MPP 10 |
| 5597 | #define EXT_CHG_VALID_MPP_2 11 |
| 5598 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5599 | static struct pm8xxx_mpp_init_info isl_mpp[] = { |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 5600 | PM8058_MPP_INIT(EXT_CHG_VALID_MPP, D_INPUT, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5601 | PM8058_MPP_DIG_LEVEL_S3, DIN_TO_INT), |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 5602 | PM8058_MPP_INIT(EXT_CHG_VALID_MPP_2, D_BI_DIR, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5603 | PM8058_MPP_DIG_LEVEL_S3, BI_PULLUP_10KOHM), |
| 5604 | }; |
| 5605 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5606 | #ifdef CONFIG_ISL9519_CHARGER |
| 5607 | static int isl_detection_setup(void) |
| 5608 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5609 | int ret = 0, i; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5610 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5611 | for (i = 0; i < ARRAY_SIZE(isl_mpp); i++) { |
| 5612 | ret = pm8xxx_mpp_config(isl_mpp[i].mpp, |
| 5613 | &isl_mpp[i].config); |
| 5614 | if (ret) { |
| 5615 | pr_err("%s: Config MPP %d of PM8058 failed\n", |
| 5616 | __func__, isl_mpp[i].mpp); |
| 5617 | return ret; |
| 5618 | } |
| 5619 | } |
| 5620 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5621 | return ret; |
| 5622 | } |
| 5623 | |
| 5624 | static struct isl_platform_data isl_data __initdata = { |
| 5625 | .chgcurrent = 700, |
| 5626 | .valid_n_gpio = PM8058_MPP_PM_TO_SYS(10), |
| 5627 | .chg_detection_config = isl_detection_setup, |
| 5628 | .max_system_voltage = 4200, |
| 5629 | .min_system_voltage = 3200, |
| 5630 | .term_current = 120, |
| 5631 | .input_current = 2048, |
| 5632 | }; |
| 5633 | |
| 5634 | static struct i2c_board_info isl_charger_i2c_info[] __initdata = { |
| 5635 | { |
| 5636 | I2C_BOARD_INFO("isl9519q", 0x9), |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5637 | .irq = PM8058_IRQ_BASE + PM8058_CBLPWR_IRQ, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5638 | .platform_data = &isl_data, |
| 5639 | }, |
| 5640 | }; |
| 5641 | #endif |
| 5642 | |
| 5643 | #if defined(CONFIG_SMB137B_CHARGER) || defined(CONFIG_SMB137B_CHARGER_MODULE) |
| 5644 | static int smb137b_detection_setup(void) |
| 5645 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5646 | int ret = 0, i; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5647 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5648 | for (i = 0; i < ARRAY_SIZE(isl_mpp); i++) { |
| 5649 | ret = pm8xxx_mpp_config(isl_mpp[i].mpp, |
| 5650 | &isl_mpp[i].config); |
| 5651 | if (ret) { |
| 5652 | pr_err("%s: Config MPP %d of PM8058 failed\n", |
| 5653 | __func__, isl_mpp[i].mpp); |
| 5654 | return ret; |
| 5655 | } |
| 5656 | } |
| 5657 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5658 | return ret; |
| 5659 | } |
| 5660 | |
| 5661 | static struct smb137b_platform_data smb137b_data __initdata = { |
| 5662 | .chg_detection_config = smb137b_detection_setup, |
| 5663 | .valid_n_gpio = PM8058_MPP_PM_TO_SYS(10), |
| 5664 | .batt_mah_rating = 950, |
| 5665 | }; |
| 5666 | |
| 5667 | static struct i2c_board_info smb137b_charger_i2c_info[] __initdata = { |
| 5668 | { |
| 5669 | I2C_BOARD_INFO("smb137b", 0x08), |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5670 | .irq = PM8058_IRQ_BASE + PM8058_CBLPWR_IRQ, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5671 | .platform_data = &smb137b_data, |
| 5672 | }, |
| 5673 | }; |
| 5674 | #endif |
| 5675 | |
| 5676 | #ifdef CONFIG_PMIC8058 |
| 5677 | #define PMIC_GPIO_SDC3_DET 22 |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5678 | #define PMIC_GPIO_TOUCH_DISC_INTR 5 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5679 | |
| 5680 | static int pm8058_gpios_init(void) |
| 5681 | { |
| 5682 | int i; |
| 5683 | int rc; |
| 5684 | struct pm8058_gpio_cfg { |
| 5685 | int gpio; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5686 | struct pm_gpio cfg; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5687 | }; |
| 5688 | |
| 5689 | struct pm8058_gpio_cfg gpio_cfgs[] = { |
| 5690 | { /* FFA ethernet */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5691 | PM8058_GPIO_PM_TO_SYS(6), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5692 | { |
| 5693 | .direction = PM_GPIO_DIR_IN, |
| 5694 | .pull = PM_GPIO_PULL_DN, |
| 5695 | .vin_sel = 2, |
| 5696 | .function = PM_GPIO_FUNC_NORMAL, |
| 5697 | .inv_int_pol = 0, |
| 5698 | }, |
| 5699 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5700 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5701 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC3_DET - 1), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5702 | { |
| 5703 | .direction = PM_GPIO_DIR_IN, |
| 5704 | .pull = PM_GPIO_PULL_UP_30, |
| 5705 | .vin_sel = 2, |
| 5706 | .function = PM_GPIO_FUNC_NORMAL, |
| 5707 | .inv_int_pol = 0, |
| 5708 | }, |
| 5709 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5710 | { /* core&surf gpio expander */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5711 | PM8058_GPIO_PM_TO_SYS(UI_INT1_N), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5712 | { |
| 5713 | .direction = PM_GPIO_DIR_IN, |
| 5714 | .pull = PM_GPIO_PULL_NO, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5715 | .vin_sel = PM8058_GPIO_VIN_S3, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5716 | .function = PM_GPIO_FUNC_NORMAL, |
| 5717 | .inv_int_pol = 0, |
| 5718 | }, |
| 5719 | }, |
| 5720 | { /* docking gpio expander */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5721 | PM8058_GPIO_PM_TO_SYS(UI_INT2_N), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5722 | { |
| 5723 | .direction = PM_GPIO_DIR_IN, |
| 5724 | .pull = PM_GPIO_PULL_NO, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5725 | .vin_sel = PM8058_GPIO_VIN_S3, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5726 | .function = PM_GPIO_FUNC_NORMAL, |
| 5727 | .inv_int_pol = 0, |
| 5728 | }, |
| 5729 | }, |
| 5730 | { /* FHA/keypad gpio expanders */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5731 | PM8058_GPIO_PM_TO_SYS(UI_INT3_N), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5732 | { |
| 5733 | .direction = PM_GPIO_DIR_IN, |
| 5734 | .pull = PM_GPIO_PULL_NO, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5735 | .vin_sel = PM8058_GPIO_VIN_S3, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5736 | .function = PM_GPIO_FUNC_NORMAL, |
| 5737 | .inv_int_pol = 0, |
| 5738 | }, |
| 5739 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5740 | { /* Timpani Reset */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5741 | PM8058_GPIO_PM_TO_SYS(20), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5742 | { |
| 5743 | .direction = PM_GPIO_DIR_OUT, |
| 5744 | .output_value = 1, |
| 5745 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 5746 | .pull = PM_GPIO_PULL_DN, |
| 5747 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 5748 | .function = PM_GPIO_FUNC_NORMAL, |
| 5749 | .vin_sel = 2, |
| 5750 | .inv_int_pol = 0, |
| 5751 | } |
| 5752 | }, |
| 5753 | { /* PMIC ID interrupt */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5754 | PM8058_GPIO_PM_TO_SYS(36), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5755 | { |
| 5756 | .direction = PM_GPIO_DIR_IN, |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 5757 | .pull = PM_GPIO_PULL_NO, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5758 | .function = PM_GPIO_FUNC_NORMAL, |
| 5759 | .vin_sel = 2, |
| 5760 | .inv_int_pol = 0, |
| 5761 | } |
| 5762 | }, |
| 5763 | }; |
| 5764 | |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5765 | #if defined(CONFIG_TOUCHDISC_VTD518_SHINETSU) || \ |
| 5766 | defined(CONFIG_TOUCHDISC_VTD518_SHINETSU_MODULE) |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5767 | struct pm_gpio touchdisc_intr_gpio_cfg = { |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5768 | .direction = PM_GPIO_DIR_IN, |
| 5769 | .pull = PM_GPIO_PULL_UP_1P5, |
| 5770 | .vin_sel = 2, |
| 5771 | .function = PM_GPIO_FUNC_NORMAL, |
| 5772 | }; |
| 5773 | #endif |
| 5774 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5775 | #if defined(CONFIG_HAPTIC_ISA1200) || \ |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5776 | defined(CONFIG_HAPTIC_ISA1200_MODULE) |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5777 | struct pm_gpio en_hap_gpio_cfg = { |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5778 | .direction = PM_GPIO_DIR_OUT, |
| 5779 | .pull = PM_GPIO_PULL_NO, |
| 5780 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 5781 | .function = PM_GPIO_FUNC_NORMAL, |
| 5782 | .inv_int_pol = 0, |
| 5783 | .vin_sel = 2, |
| 5784 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 5785 | .output_value = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5786 | }; |
| 5787 | #endif |
| 5788 | |
| 5789 | #if defined(CONFIG_PMIC8058_OTHC) || defined(CONFIG_PMIC8058_OTHC_MODULE) |
| 5790 | struct pm8058_gpio_cfg line_in_gpio_cfg = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5791 | PM8058_GPIO_PM_TO_SYS(18), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5792 | { |
| 5793 | .direction = PM_GPIO_DIR_IN, |
| 5794 | .pull = PM_GPIO_PULL_UP_1P5, |
| 5795 | .vin_sel = 2, |
| 5796 | .function = PM_GPIO_FUNC_NORMAL, |
| 5797 | .inv_int_pol = 0, |
| 5798 | } |
| 5799 | }; |
| 5800 | #endif |
| 5801 | |
| 5802 | #if defined(CONFIG_QS_S5K4E1) |
| 5803 | { |
| 5804 | struct pm8058_gpio_cfg qs_hc37_cam_pd_gpio_cfg = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5805 | PM8058_GPIO_PM_TO_SYS(26), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5806 | { |
| 5807 | .direction = PM_GPIO_DIR_OUT, |
| 5808 | .output_value = 0, |
| 5809 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 5810 | .pull = PM_GPIO_PULL_DN, |
| 5811 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 5812 | .function = PM_GPIO_FUNC_NORMAL, |
| 5813 | .vin_sel = 2, |
| 5814 | .inv_int_pol = 0, |
| 5815 | } |
| 5816 | }; |
| 5817 | #endif |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 5818 | #ifdef CONFIG_FB_MSM_LCDC_NT35582_WVGA |
| 5819 | struct pm8058_gpio_cfg pmic_lcdc_nt35582_gpio_cfg = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5820 | PM8058_GPIO_PM_TO_SYS(GPIO_NT35582_BL_EN_HW_PIN - 1), |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 5821 | { |
| 5822 | .direction = PM_GPIO_DIR_OUT, |
| 5823 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 5824 | .output_value = 1, |
| 5825 | .pull = PM_GPIO_PULL_UP_30, |
| 5826 | /* 2.9V PM_GPIO_VIN_L2, which gives 2.6V */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5827 | .vin_sel = PM8058_GPIO_VIN_L5, |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 5828 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 5829 | .function = PM_GPIO_FUNC_NORMAL, |
| 5830 | .inv_int_pol = 0, |
| 5831 | } |
| 5832 | }; |
| 5833 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5834 | #if defined(CONFIG_HAPTIC_ISA1200) || \ |
| 5835 | defined(CONFIG_HAPTIC_ISA1200_MODULE) |
| 5836 | if (machine_is_msm8x60_fluid()) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5837 | rc = pm8xxx_gpio_config( |
| 5838 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_ENABLE), |
| 5839 | &en_hap_gpio_cfg); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5840 | if (rc < 0) { |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5841 | pr_err("%s: pmic haptics gpio config failed\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5842 | __func__); |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5843 | } |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5844 | rc = pm8xxx_gpio_config( |
| 5845 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_LDO_ENABLE), |
| 5846 | &en_hap_gpio_cfg); |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5847 | if (rc < 0) { |
| 5848 | pr_err("%s: pmic haptics ldo gpio config failed\n", |
| 5849 | __func__); |
| 5850 | } |
| 5851 | |
| 5852 | } |
| 5853 | #endif |
| 5854 | |
| 5855 | #if defined(CONFIG_TOUCHDISC_VTD518_SHINETSU) || \ |
| 5856 | defined(CONFIG_TOUCHDISC_VTD518_SHINETSU_MODULE) |
| 5857 | if (machine_is_msm8x60_ffa() || machine_is_msm8x60_surf() || |
| 5858 | machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5859 | rc = pm8xxx_gpio_config( |
| 5860 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_TOUCH_DISC_INTR), |
| 5861 | &touchdisc_intr_gpio_cfg); |
Mohan Pallaka | 4a1160d | 2011-09-09 15:17:45 +0530 | [diff] [blame] | 5862 | if (rc < 0) { |
| 5863 | pr_err("%s: Touchdisc interrupt gpio config failed\n", |
| 5864 | __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5865 | } |
| 5866 | } |
| 5867 | #endif |
| 5868 | |
| 5869 | #if defined(CONFIG_PMIC8058_OTHC) || defined(CONFIG_PMIC8058_OTHC_MODULE) |
| 5870 | /* Line_in only for 8660 ffa & surf */ |
| 5871 | if (machine_is_msm8x60_ffa() || machine_is_msm8x60_surf() || |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 5872 | machine_is_msm8x60_fusion() || machine_is_msm8x60_dragon() || |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5873 | machine_is_msm8x60_fusn_ffa()) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5874 | rc = pm8xxx_gpio_config(line_in_gpio_cfg.gpio, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5875 | &line_in_gpio_cfg.cfg); |
| 5876 | if (rc < 0) { |
| 5877 | pr_err("%s pmic line_in gpio config failed\n", |
| 5878 | __func__); |
| 5879 | return rc; |
| 5880 | } |
| 5881 | } |
| 5882 | #endif |
| 5883 | |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 5884 | #ifdef CONFIG_FB_MSM_LCDC_NT35582_WVGA |
| 5885 | if (machine_is_msm8x60_dragon()) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5886 | rc = pm8xxx_gpio_config(pmic_lcdc_nt35582_gpio_cfg.gpio, |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 5887 | &pmic_lcdc_nt35582_gpio_cfg.cfg); |
| 5888 | if (rc < 0) { |
| 5889 | pr_err("%s pmic gpio config failed\n", __func__); |
| 5890 | return rc; |
| 5891 | } |
| 5892 | } |
| 5893 | #endif |
| 5894 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5895 | #if defined(CONFIG_QS_S5K4E1) |
| 5896 | /* qs_cam_hc37_cam_pd only for 8660 fluid qs camera*/ |
| 5897 | if (machine_is_msm8x60_fluid()) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5898 | rc = pm8xxx_gpio_config(qs_hc37_cam_pd_gpio_cfg.gpio, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5899 | &qs_hc37_cam_pd_gpio_cfg.cfg); |
| 5900 | if (rc < 0) { |
| 5901 | pr_err("%s pmic qs_hc37_cam_pd gpio config failed\n", |
| 5902 | __func__); |
| 5903 | return rc; |
| 5904 | } |
| 5905 | } |
| 5906 | } |
| 5907 | #endif |
| 5908 | |
| 5909 | for (i = 0; i < ARRAY_SIZE(gpio_cfgs); ++i) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5910 | rc = pm8xxx_gpio_config(gpio_cfgs[i].gpio, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5911 | &gpio_cfgs[i].cfg); |
| 5912 | if (rc < 0) { |
| 5913 | pr_err("%s pmic gpio config failed\n", |
| 5914 | __func__); |
| 5915 | return rc; |
| 5916 | } |
| 5917 | } |
| 5918 | |
| 5919 | return 0; |
| 5920 | } |
| 5921 | |
| 5922 | static const unsigned int ffa_keymap[] = { |
| 5923 | KEY(0, 0, KEY_FN_F1), /* LS - PUSH1 */ |
| 5924 | KEY(0, 1, KEY_UP), /* NAV - UP */ |
| 5925 | KEY(0, 2, KEY_LEFT), /* NAV - LEFT */ |
| 5926 | KEY(0, 3, KEY_VOLUMEUP), /* Shuttle SW_UP */ |
| 5927 | |
| 5928 | KEY(1, 0, KEY_FN_F2), /* LS - PUSH2 */ |
| 5929 | KEY(1, 1, KEY_RIGHT), /* NAV - RIGHT */ |
| 5930 | KEY(1, 2, KEY_DOWN), /* NAV - DOWN */ |
| 5931 | KEY(1, 3, KEY_VOLUMEDOWN), |
| 5932 | |
| 5933 | KEY(2, 3, KEY_ENTER), /* SW_PUSH key */ |
| 5934 | |
| 5935 | KEY(4, 0, KEY_CAMERA_FOCUS), /* RS - PUSH1 */ |
| 5936 | KEY(4, 1, KEY_UP), /* USER_UP */ |
| 5937 | KEY(4, 2, KEY_LEFT), /* USER_LEFT */ |
| 5938 | KEY(4, 3, KEY_HOME), /* Right switch: MIC Bd */ |
| 5939 | KEY(4, 4, KEY_FN_F3), /* Reserved MIC */ |
| 5940 | |
| 5941 | KEY(5, 0, KEY_CAMERA), /* RS - PUSH2 */ |
| 5942 | KEY(5, 1, KEY_RIGHT), /* USER_RIGHT */ |
| 5943 | KEY(5, 2, KEY_DOWN), /* USER_DOWN */ |
| 5944 | KEY(5, 3, KEY_BACK), /* Left switch: MIC */ |
| 5945 | KEY(5, 4, KEY_MENU), /* Center switch: MIC */ |
| 5946 | }; |
| 5947 | |
Zhang Chang Ken | 683be17 | 2011-08-10 17:45:34 -0400 | [diff] [blame] | 5948 | static const unsigned int dragon_keymap[] = { |
| 5949 | KEY(0, 0, KEY_MENU), |
| 5950 | KEY(0, 2, KEY_1), |
| 5951 | KEY(0, 3, KEY_4), |
| 5952 | KEY(0, 4, KEY_7), |
| 5953 | |
| 5954 | KEY(1, 0, KEY_UP), |
| 5955 | KEY(1, 1, KEY_LEFT), |
| 5956 | KEY(1, 2, KEY_DOWN), |
| 5957 | KEY(1, 3, KEY_5), |
| 5958 | KEY(1, 4, KEY_8), |
| 5959 | |
| 5960 | KEY(2, 0, KEY_HOME), |
| 5961 | KEY(2, 1, KEY_REPLY), |
| 5962 | KEY(2, 2, KEY_2), |
| 5963 | KEY(2, 3, KEY_6), |
| 5964 | KEY(2, 4, KEY_0), |
| 5965 | |
| 5966 | KEY(3, 0, KEY_VOLUMEUP), |
| 5967 | KEY(3, 1, KEY_RIGHT), |
| 5968 | KEY(3, 2, KEY_3), |
| 5969 | KEY(3, 3, KEY_9), |
| 5970 | KEY(3, 4, KEY_SWITCHVIDEOMODE), |
| 5971 | |
| 5972 | KEY(4, 0, KEY_VOLUMEDOWN), |
| 5973 | KEY(4, 1, KEY_BACK), |
| 5974 | KEY(4, 2, KEY_CAMERA), |
| 5975 | KEY(4, 3, KEY_KBDILLUMTOGGLE), |
| 5976 | }; |
| 5977 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5978 | static struct matrix_keymap_data ffa_keymap_data = { |
| 5979 | .keymap_size = ARRAY_SIZE(ffa_keymap), |
| 5980 | .keymap = ffa_keymap, |
| 5981 | }; |
| 5982 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5983 | static struct pm8xxx_keypad_platform_data ffa_keypad_data = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5984 | .input_name = "ffa-keypad", |
| 5985 | .input_phys_device = "ffa-keypad/input0", |
| 5986 | .num_rows = 6, |
| 5987 | .num_cols = 5, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 5988 | .rows_gpio_start = PM8058_GPIO_PM_TO_SYS(8), |
| 5989 | .cols_gpio_start = PM8058_GPIO_PM_TO_SYS(0), |
| 5990 | .debounce_ms = 15, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5991 | .scan_delay_ms = 32, |
| 5992 | .row_hold_ns = 91500, |
| 5993 | .wakeup = 1, |
| 5994 | .keymap_data = &ffa_keymap_data, |
| 5995 | }; |
| 5996 | |
Zhang Chang Ken | 683be17 | 2011-08-10 17:45:34 -0400 | [diff] [blame] | 5997 | static struct matrix_keymap_data dragon_keymap_data = { |
| 5998 | .keymap_size = ARRAY_SIZE(dragon_keymap), |
| 5999 | .keymap = dragon_keymap, |
| 6000 | }; |
| 6001 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6002 | static struct pm8xxx_keypad_platform_data dragon_keypad_data = { |
Zhang Chang Ken | 683be17 | 2011-08-10 17:45:34 -0400 | [diff] [blame] | 6003 | .input_name = "dragon-keypad", |
| 6004 | .input_phys_device = "dragon-keypad/input0", |
| 6005 | .num_rows = 6, |
| 6006 | .num_cols = 5, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6007 | .rows_gpio_start = PM8058_GPIO_PM_TO_SYS(8), |
| 6008 | .cols_gpio_start = PM8058_GPIO_PM_TO_SYS(0), |
| 6009 | .debounce_ms = 15, |
Zhang Chang Ken | 683be17 | 2011-08-10 17:45:34 -0400 | [diff] [blame] | 6010 | .scan_delay_ms = 32, |
| 6011 | .row_hold_ns = 91500, |
| 6012 | .wakeup = 1, |
| 6013 | .keymap_data = &dragon_keymap_data, |
| 6014 | }; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6015 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6016 | static const unsigned int fluid_keymap[] = { |
| 6017 | KEY(0, 0, KEY_FN_F1), /* LS - PUSH1 */ |
| 6018 | KEY(0, 1, KEY_UP), /* NAV - UP */ |
| 6019 | KEY(0, 2, KEY_LEFT), /* NAV - LEFT */ |
| 6020 | KEY(0, 3, KEY_VOLUMEDOWN), /* Shuttle SW_UP */ |
| 6021 | |
| 6022 | KEY(1, 0, KEY_FN_F2), /* LS - PUSH2 */ |
| 6023 | KEY(1, 1, KEY_RIGHT), /* NAV - RIGHT */ |
| 6024 | KEY(1, 2, KEY_DOWN), /* NAV - DOWN */ |
| 6025 | KEY(1, 3, KEY_VOLUMEUP), |
| 6026 | |
| 6027 | KEY(2, 3, KEY_ENTER), /* SW_PUSH key */ |
| 6028 | |
| 6029 | KEY(4, 0, KEY_CAMERA_FOCUS), /* RS - PUSH1 */ |
| 6030 | KEY(4, 1, KEY_UP), /* USER_UP */ |
| 6031 | KEY(4, 2, KEY_LEFT), /* USER_LEFT */ |
| 6032 | KEY(4, 3, KEY_HOME), /* Right switch: MIC Bd */ |
| 6033 | KEY(4, 4, KEY_FN_F3), /* Reserved MIC */ |
| 6034 | |
Jilai Wang | 9a89510 | 2011-07-12 14:00:35 -0400 | [diff] [blame] | 6035 | KEY(5, 0, KEY_CAMERA), /* RS - PUSH2 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6036 | KEY(5, 1, KEY_RIGHT), /* USER_RIGHT */ |
| 6037 | KEY(5, 2, KEY_DOWN), /* USER_DOWN */ |
| 6038 | KEY(5, 3, KEY_BACK), /* Left switch: MIC */ |
| 6039 | KEY(5, 4, KEY_MENU), /* Center switch: MIC */ |
| 6040 | }; |
| 6041 | |
| 6042 | static struct matrix_keymap_data fluid_keymap_data = { |
| 6043 | .keymap_size = ARRAY_SIZE(fluid_keymap), |
| 6044 | .keymap = fluid_keymap, |
| 6045 | }; |
| 6046 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6047 | static struct pm8xxx_keypad_platform_data fluid_keypad_data = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6048 | .input_name = "fluid-keypad", |
| 6049 | .input_phys_device = "fluid-keypad/input0", |
| 6050 | .num_rows = 6, |
| 6051 | .num_cols = 5, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6052 | .rows_gpio_start = PM8058_GPIO_PM_TO_SYS(8), |
| 6053 | .cols_gpio_start = PM8058_GPIO_PM_TO_SYS(0), |
| 6054 | .debounce_ms = 15, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6055 | .scan_delay_ms = 32, |
| 6056 | .row_hold_ns = 91500, |
| 6057 | .wakeup = 1, |
| 6058 | .keymap_data = &fluid_keymap_data, |
| 6059 | }; |
| 6060 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6061 | static struct pm8xxx_vibrator_platform_data pm8058_vib_pdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6062 | .initial_vibrate_ms = 500, |
| 6063 | .level_mV = 3000, |
| 6064 | .max_timeout_ms = 15000, |
| 6065 | }; |
| 6066 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6067 | static struct pm8xxx_rtc_platform_data pm8058_rtc_pdata = { |
| 6068 | .rtc_write_enable = false, |
| 6069 | .rtc_alarm_powerup = false, |
| 6070 | }; |
| 6071 | |
| 6072 | static struct pm8xxx_pwrkey_platform_data pm8058_pwrkey_pdata = { |
| 6073 | .pull_up = 1, |
Jing Lin | eecdc06 | 2011-11-17 09:47:09 -0800 | [diff] [blame] | 6074 | .kpd_trigger_delay_us = 15625, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6075 | .wakeup = 1, |
| 6076 | }; |
| 6077 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6078 | #define PM8058_LINE_IN_DET_GPIO PM8058_GPIO_PM_TO_SYS(18) |
| 6079 | |
| 6080 | static struct othc_accessory_info othc_accessories[] = { |
| 6081 | { |
| 6082 | .accessory = OTHC_SVIDEO_OUT, |
| 6083 | .detect_flags = OTHC_MICBIAS_DETECT | OTHC_SWITCH_DETECT |
| 6084 | | OTHC_ADC_DETECT, |
| 6085 | .key_code = SW_VIDEOOUT_INSERT, |
| 6086 | .enabled = false, |
| 6087 | .adc_thres = { |
| 6088 | .min_threshold = 20, |
| 6089 | .max_threshold = 40, |
| 6090 | }, |
| 6091 | }, |
| 6092 | { |
| 6093 | .accessory = OTHC_ANC_HEADPHONE, |
| 6094 | .detect_flags = OTHC_MICBIAS_DETECT | OTHC_GPIO_DETECT | |
| 6095 | OTHC_SWITCH_DETECT, |
| 6096 | .gpio = PM8058_LINE_IN_DET_GPIO, |
| 6097 | .active_low = 1, |
| 6098 | .key_code = SW_HEADPHONE_INSERT, |
| 6099 | .enabled = true, |
| 6100 | }, |
| 6101 | { |
| 6102 | .accessory = OTHC_ANC_HEADSET, |
| 6103 | .detect_flags = OTHC_MICBIAS_DETECT | OTHC_GPIO_DETECT, |
| 6104 | .gpio = PM8058_LINE_IN_DET_GPIO, |
| 6105 | .active_low = 1, |
| 6106 | .key_code = SW_HEADPHONE_INSERT, |
| 6107 | .enabled = true, |
| 6108 | }, |
| 6109 | { |
| 6110 | .accessory = OTHC_HEADPHONE, |
| 6111 | .detect_flags = OTHC_MICBIAS_DETECT | OTHC_SWITCH_DETECT, |
| 6112 | .key_code = SW_HEADPHONE_INSERT, |
| 6113 | .enabled = true, |
| 6114 | }, |
| 6115 | { |
| 6116 | .accessory = OTHC_MICROPHONE, |
| 6117 | .detect_flags = OTHC_GPIO_DETECT, |
| 6118 | .gpio = PM8058_LINE_IN_DET_GPIO, |
| 6119 | .active_low = 1, |
| 6120 | .key_code = SW_MICROPHONE_INSERT, |
| 6121 | .enabled = true, |
| 6122 | }, |
| 6123 | { |
| 6124 | .accessory = OTHC_HEADSET, |
| 6125 | .detect_flags = OTHC_MICBIAS_DETECT, |
| 6126 | .key_code = SW_HEADPHONE_INSERT, |
| 6127 | .enabled = true, |
| 6128 | }, |
| 6129 | }; |
| 6130 | |
| 6131 | static struct othc_switch_info switch_info[] = { |
| 6132 | { |
| 6133 | .min_adc_threshold = 0, |
| 6134 | .max_adc_threshold = 100, |
| 6135 | .key_code = KEY_PLAYPAUSE, |
| 6136 | }, |
| 6137 | { |
| 6138 | .min_adc_threshold = 100, |
| 6139 | .max_adc_threshold = 200, |
| 6140 | .key_code = KEY_REWIND, |
| 6141 | }, |
| 6142 | { |
| 6143 | .min_adc_threshold = 200, |
| 6144 | .max_adc_threshold = 500, |
| 6145 | .key_code = KEY_FASTFORWARD, |
| 6146 | }, |
| 6147 | }; |
| 6148 | |
| 6149 | static struct othc_n_switch_config switch_config = { |
| 6150 | .voltage_settling_time_ms = 0, |
| 6151 | .num_adc_samples = 3, |
| 6152 | .adc_channel = CHANNEL_ADC_HDSET, |
| 6153 | .switch_info = switch_info, |
| 6154 | .num_keys = ARRAY_SIZE(switch_info), |
| 6155 | .default_sw_en = true, |
| 6156 | .default_sw_idx = 0, |
| 6157 | }; |
| 6158 | |
| 6159 | static struct hsed_bias_config hsed_bias_config = { |
| 6160 | /* HSED mic bias config info */ |
| 6161 | .othc_headset = OTHC_HEADSET_NO, |
| 6162 | .othc_lowcurr_thresh_uA = 100, |
| 6163 | .othc_highcurr_thresh_uA = 600, |
| 6164 | .othc_hyst_prediv_us = 7800, |
| 6165 | .othc_period_clkdiv_us = 62500, |
| 6166 | .othc_hyst_clk_us = 121000, |
| 6167 | .othc_period_clk_us = 312500, |
| 6168 | .othc_wakeup = 1, |
| 6169 | }; |
| 6170 | |
| 6171 | static struct othc_hsed_config hsed_config_1 = { |
| 6172 | .hsed_bias_config = &hsed_bias_config, |
| 6173 | /* |
| 6174 | * The detection delay and switch reporting delay are |
| 6175 | * required to encounter a hardware bug (spurious switch |
| 6176 | * interrupts on slow insertion/removal of the headset). |
| 6177 | * This will introduce a delay in reporting the accessory |
| 6178 | * insertion and removal to the userspace. |
| 6179 | */ |
| 6180 | .detection_delay_ms = 1500, |
| 6181 | /* Switch info */ |
| 6182 | .switch_debounce_ms = 1500, |
| 6183 | .othc_support_n_switch = false, |
| 6184 | .switch_config = &switch_config, |
| 6185 | .ir_gpio = -1, |
| 6186 | /* Accessory info */ |
| 6187 | .accessories_support = true, |
| 6188 | .accessories = othc_accessories, |
| 6189 | .othc_num_accessories = ARRAY_SIZE(othc_accessories), |
| 6190 | }; |
| 6191 | |
| 6192 | static struct othc_regulator_config othc_reg = { |
| 6193 | .regulator = "8058_l5", |
| 6194 | .max_uV = 2850000, |
| 6195 | .min_uV = 2850000, |
| 6196 | }; |
| 6197 | |
| 6198 | /* MIC_BIAS0 is configured as normal MIC BIAS */ |
| 6199 | static struct pmic8058_othc_config_pdata othc_config_pdata_0 = { |
| 6200 | .micbias_select = OTHC_MICBIAS_0, |
| 6201 | .micbias_capability = OTHC_MICBIAS, |
| 6202 | .micbias_enable = OTHC_SIGNAL_OFF, |
| 6203 | .micbias_regulator = &othc_reg, |
| 6204 | }; |
| 6205 | |
| 6206 | /* MIC_BIAS1 is configured as HSED_BIAS for OTHC */ |
| 6207 | static struct pmic8058_othc_config_pdata othc_config_pdata_1 = { |
| 6208 | .micbias_select = OTHC_MICBIAS_1, |
| 6209 | .micbias_capability = OTHC_MICBIAS_HSED, |
| 6210 | .micbias_enable = OTHC_SIGNAL_PWM_TCXO, |
| 6211 | .micbias_regulator = &othc_reg, |
| 6212 | .hsed_config = &hsed_config_1, |
| 6213 | .hsed_name = "8660_handset", |
| 6214 | }; |
| 6215 | |
| 6216 | /* MIC_BIAS2 is configured as normal MIC BIAS */ |
| 6217 | static struct pmic8058_othc_config_pdata othc_config_pdata_2 = { |
| 6218 | .micbias_select = OTHC_MICBIAS_2, |
| 6219 | .micbias_capability = OTHC_MICBIAS, |
| 6220 | .micbias_enable = OTHC_SIGNAL_OFF, |
| 6221 | .micbias_regulator = &othc_reg, |
| 6222 | }; |
| 6223 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6224 | |
| 6225 | static void __init msm8x60_init_pm8058_othc(void) |
| 6226 | { |
| 6227 | int i; |
| 6228 | |
| 6229 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2 || |
| 6230 | machine_is_msm8x60_fluid() || machine_is_msm8x60_fusion() || |
| 6231 | machine_is_msm8x60_fusn_ffa()) { |
| 6232 | /* 3-switch headset supported only by V2 FFA and FLUID */ |
| 6233 | hsed_config_1.accessories_adc_support = true, |
| 6234 | /* ADC based accessory detection works only on V2 and FLUID */ |
| 6235 | hsed_config_1.accessories_adc_channel = CHANNEL_ADC_HDSET, |
| 6236 | hsed_config_1.othc_support_n_switch = true; |
| 6237 | } |
| 6238 | |
| 6239 | /* IR GPIO is absent on FLUID */ |
| 6240 | if (machine_is_msm8x60_fluid()) |
| 6241 | hsed_config_1.ir_gpio = -1; |
| 6242 | |
| 6243 | for (i = 0; i < ARRAY_SIZE(othc_accessories); i++) { |
| 6244 | if (machine_is_msm8x60_fluid()) { |
| 6245 | switch (othc_accessories[i].accessory) { |
| 6246 | case OTHC_ANC_HEADPHONE: |
| 6247 | case OTHC_ANC_HEADSET: |
| 6248 | othc_accessories[i].gpio = GPIO_HEADSET_DET_N; |
| 6249 | break; |
| 6250 | case OTHC_MICROPHONE: |
| 6251 | othc_accessories[i].enabled = false; |
| 6252 | break; |
| 6253 | case OTHC_SVIDEO_OUT: |
| 6254 | othc_accessories[i].enabled = true; |
| 6255 | hsed_config_1.video_out_gpio = GPIO_HS_SW_DIR; |
| 6256 | break; |
| 6257 | } |
| 6258 | } |
| 6259 | } |
| 6260 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6261 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6262 | |
| 6263 | static int pm8058_pwm_config(struct pwm_device *pwm, int ch, int on) |
| 6264 | { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6265 | struct pm_gpio pwm_gpio_config = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6266 | .direction = PM_GPIO_DIR_OUT, |
| 6267 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 6268 | .output_value = 0, |
| 6269 | .pull = PM_GPIO_PULL_NO, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6270 | .vin_sel = PM8058_GPIO_VIN_VPH, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6271 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 6272 | .function = PM_GPIO_FUNC_2, |
| 6273 | }; |
| 6274 | |
| 6275 | int rc = -EINVAL; |
| 6276 | int id, mode, max_mA; |
| 6277 | |
| 6278 | id = mode = max_mA = 0; |
| 6279 | switch (ch) { |
| 6280 | case 0: |
| 6281 | case 1: |
| 6282 | case 2: |
| 6283 | if (on) { |
| 6284 | id = 24 + ch; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6285 | rc = pm8xxx_gpio_config(PM8058_GPIO_PM_TO_SYS(id - 1), |
| 6286 | &pwm_gpio_config); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6287 | if (rc) |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6288 | pr_err("%s: pm8xxx_gpio_config(%d): rc=%d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6289 | __func__, id, rc); |
| 6290 | } |
| 6291 | break; |
| 6292 | |
| 6293 | case 6: |
| 6294 | id = PM_PWM_LED_FLASH; |
| 6295 | mode = PM_PWM_CONF_PWM1; |
| 6296 | max_mA = 300; |
| 6297 | break; |
| 6298 | |
| 6299 | case 7: |
| 6300 | id = PM_PWM_LED_FLASH1; |
| 6301 | mode = PM_PWM_CONF_PWM1; |
| 6302 | max_mA = 300; |
| 6303 | break; |
| 6304 | |
| 6305 | default: |
| 6306 | break; |
| 6307 | } |
| 6308 | |
| 6309 | if (ch >= 6 && ch <= 7) { |
| 6310 | if (!on) { |
| 6311 | mode = PM_PWM_CONF_NONE; |
| 6312 | max_mA = 0; |
| 6313 | } |
| 6314 | rc = pm8058_pwm_config_led(pwm, id, mode, max_mA); |
| 6315 | if (rc) |
| 6316 | pr_err("%s: pm8058_pwm_config_led(ch=%d): rc=%d\n", |
| 6317 | __func__, ch, rc); |
| 6318 | } |
| 6319 | return rc; |
| 6320 | |
| 6321 | } |
| 6322 | |
| 6323 | static struct pm8058_pwm_pdata pm8058_pwm_data = { |
| 6324 | .config = pm8058_pwm_config, |
| 6325 | }; |
| 6326 | |
| 6327 | #define PM8058_GPIO_INT 88 |
| 6328 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6329 | static struct pmic8058_led pmic8058_flash_leds[] = { |
| 6330 | [0] = { |
| 6331 | .name = "camera:flash0", |
| 6332 | .max_brightness = 15, |
| 6333 | .id = PMIC8058_ID_FLASH_LED_0, |
| 6334 | }, |
| 6335 | [1] = { |
| 6336 | .name = "camera:flash1", |
| 6337 | .max_brightness = 15, |
| 6338 | .id = PMIC8058_ID_FLASH_LED_1, |
| 6339 | }, |
| 6340 | }; |
| 6341 | |
| 6342 | static struct pmic8058_leds_platform_data pm8058_flash_leds_data = { |
| 6343 | .num_leds = ARRAY_SIZE(pmic8058_flash_leds), |
| 6344 | .leds = pmic8058_flash_leds, |
| 6345 | }; |
| 6346 | |
Terence Hampson | c0b6dfb | 2011-07-15 11:07:17 -0400 | [diff] [blame] | 6347 | static struct pmic8058_led pmic8058_dragon_leds[] = { |
| 6348 | [0] = { |
| 6349 | /* RED */ |
| 6350 | .name = "led_drv0", |
| 6351 | .max_brightness = 15, |
| 6352 | .id = PMIC8058_ID_LED_0, |
| 6353 | },/* 300 mA flash led0 drv sink */ |
| 6354 | [1] = { |
| 6355 | /* Yellow */ |
| 6356 | .name = "led_drv1", |
| 6357 | .max_brightness = 15, |
| 6358 | .id = PMIC8058_ID_LED_1, |
| 6359 | },/* 300 mA flash led0 drv sink */ |
| 6360 | [2] = { |
| 6361 | /* Green */ |
| 6362 | .name = "led_drv2", |
| 6363 | .max_brightness = 15, |
| 6364 | .id = PMIC8058_ID_LED_2, |
| 6365 | },/* 300 mA flash led0 drv sink */ |
| 6366 | [3] = { |
| 6367 | .name = "led_psensor", |
| 6368 | .max_brightness = 15, |
| 6369 | .id = PMIC8058_ID_LED_KB_LIGHT, |
| 6370 | },/* 300 mA flash led0 drv sink */ |
| 6371 | }; |
| 6372 | |
| 6373 | static struct pmic8058_leds_platform_data pm8058_dragon_leds_data = { |
| 6374 | .num_leds = ARRAY_SIZE(pmic8058_dragon_leds), |
| 6375 | .leds = pmic8058_dragon_leds, |
| 6376 | }; |
| 6377 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6378 | static struct pmic8058_led pmic8058_fluid_flash_leds[] = { |
| 6379 | [0] = { |
| 6380 | .name = "led:drv0", |
| 6381 | .max_brightness = 15, |
| 6382 | .id = PMIC8058_ID_FLASH_LED_0, |
| 6383 | },/* 300 mA flash led0 drv sink */ |
| 6384 | [1] = { |
| 6385 | .name = "led:drv1", |
| 6386 | .max_brightness = 15, |
| 6387 | .id = PMIC8058_ID_FLASH_LED_1, |
| 6388 | },/* 300 mA flash led1 sink */ |
| 6389 | [2] = { |
| 6390 | .name = "led:drv2", |
| 6391 | .max_brightness = 20, |
| 6392 | .id = PMIC8058_ID_LED_0, |
| 6393 | },/* 40 mA led0 sink */ |
| 6394 | [3] = { |
| 6395 | .name = "keypad:drv", |
| 6396 | .max_brightness = 15, |
| 6397 | .id = PMIC8058_ID_LED_KB_LIGHT, |
| 6398 | },/* 300 mA keypad drv sink */ |
| 6399 | }; |
| 6400 | |
| 6401 | static struct pmic8058_leds_platform_data pm8058_fluid_flash_leds_data = { |
| 6402 | .num_leds = ARRAY_SIZE(pmic8058_fluid_flash_leds), |
| 6403 | .leds = pmic8058_fluid_flash_leds, |
| 6404 | }; |
| 6405 | |
Terence Hampson | 90508a9 | 2011-08-09 10:40:08 -0400 | [diff] [blame] | 6406 | static struct pmic8058_charger_data pmic8058_charger_dragon = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6407 | .charger_data_valid = true, |
Terence Hampson | 90508a9 | 2011-08-09 10:40:08 -0400 | [diff] [blame] | 6408 | .max_source_current = 1800, |
| 6409 | .charger_type = CHG_TYPE_AC, |
| 6410 | }; |
| 6411 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6412 | static struct pmic8058_charger_data pmic8058_charger_ffa_surf = { |
| 6413 | .charger_data_valid = false, |
| 6414 | }; |
| 6415 | |
| 6416 | static struct pm8xxx_misc_platform_data pm8058_misc_pdata = { |
| 6417 | .priority = 0, |
| 6418 | }; |
| 6419 | |
| 6420 | static struct pm8xxx_irq_platform_data pm8058_irq_pdata = { |
| 6421 | .irq_base = PM8058_IRQ_BASE, |
| 6422 | .devirq = MSM_GPIO_TO_INT(PM8058_GPIO_INT), |
| 6423 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 6424 | }; |
| 6425 | |
| 6426 | static struct pm8xxx_gpio_platform_data pm8058_gpio_pdata = { |
| 6427 | .gpio_base = PM8058_GPIO_PM_TO_SYS(0), |
| 6428 | }; |
| 6429 | |
| 6430 | static struct pm8xxx_mpp_platform_data pm8058_mpp_pdata = { |
| 6431 | .mpp_base = PM8058_MPP_PM_TO_SYS(0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6432 | }; |
| 6433 | |
| 6434 | static struct pm8058_platform_data pm8058_platform_data = { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 6435 | .irq_pdata = &pm8058_irq_pdata, |
| 6436 | .gpio_pdata = &pm8058_gpio_pdata, |
| 6437 | .mpp_pdata = &pm8058_mpp_pdata, |
| 6438 | .rtc_pdata = &pm8058_rtc_pdata, |
| 6439 | .pwrkey_pdata = &pm8058_pwrkey_pdata, |
| 6440 | .othc0_pdata = &othc_config_pdata_0, |
| 6441 | .othc1_pdata = &othc_config_pdata_1, |
| 6442 | .othc2_pdata = &othc_config_pdata_2, |
| 6443 | .pwm_pdata = &pm8058_pwm_data, |
| 6444 | .misc_pdata = &pm8058_misc_pdata, |
| 6445 | #ifdef CONFIG_SENSORS_MSM_ADC |
| 6446 | .xoadc_pdata = &pm8058_xoadc_pdata, |
| 6447 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6448 | }; |
| 6449 | |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 6450 | #ifdef CONFIG_MSM_SSBI |
| 6451 | static struct msm_ssbi_platform_data msm8x60_ssbi_pm8058_pdata __devinitdata = { |
| 6452 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 6453 | .slave = { |
| 6454 | .name = "pm8058-core", |
| 6455 | .platform_data = &pm8058_platform_data, |
| 6456 | }, |
| 6457 | }; |
| 6458 | #endif |
| 6459 | #endif /* CONFIG_PMIC8058 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6460 | |
| 6461 | #if defined(CONFIG_TOUCHDISC_VTD518_SHINETSU) || \ |
| 6462 | defined(CONFIG_TOUCHDISC_VTD518_SHINETSU_MODULE) |
| 6463 | #define TDISC_I2C_SLAVE_ADDR 0x67 |
| 6464 | #define PMIC_GPIO_TDISC PM8058_GPIO_PM_TO_SYS(5) |
| 6465 | #define TDISC_INT PM8058_GPIO_IRQ(PM8058_IRQ_BASE, 5) |
| 6466 | |
| 6467 | static const char *vregs_tdisc_name[] = { |
| 6468 | "8058_l5", |
| 6469 | "8058_s3", |
| 6470 | }; |
| 6471 | |
| 6472 | static const int vregs_tdisc_val[] = { |
| 6473 | 2850000,/* uV */ |
| 6474 | 1800000, |
| 6475 | }; |
| 6476 | static struct regulator *vregs_tdisc[ARRAY_SIZE(vregs_tdisc_name)]; |
| 6477 | |
| 6478 | static int tdisc_shinetsu_setup(void) |
| 6479 | { |
| 6480 | int rc, i; |
| 6481 | |
| 6482 | rc = gpio_request(PMIC_GPIO_TDISC, "tdisc_interrupt"); |
| 6483 | if (rc) { |
| 6484 | pr_err("%s: gpio_request failed for PMIC_GPIO_TDISC\n", |
| 6485 | __func__); |
| 6486 | return rc; |
| 6487 | } |
| 6488 | |
| 6489 | rc = gpio_request(GPIO_JOYSTICK_EN, "tdisc_oe"); |
| 6490 | if (rc) { |
| 6491 | pr_err("%s: gpio_request failed for GPIO_JOYSTICK_EN\n", |
| 6492 | __func__); |
| 6493 | goto fail_gpio_oe; |
| 6494 | } |
| 6495 | |
| 6496 | rc = gpio_direction_output(GPIO_JOYSTICK_EN, 1); |
| 6497 | if (rc) { |
| 6498 | pr_err("%s: gpio_direction_output failed for GPIO_JOYSTICK_EN\n", |
| 6499 | __func__); |
| 6500 | gpio_free(GPIO_JOYSTICK_EN); |
| 6501 | goto fail_gpio_oe; |
| 6502 | } |
| 6503 | |
| 6504 | for (i = 0; i < ARRAY_SIZE(vregs_tdisc_name); i++) { |
| 6505 | vregs_tdisc[i] = regulator_get(NULL, vregs_tdisc_name[i]); |
| 6506 | if (IS_ERR(vregs_tdisc[i])) { |
| 6507 | printk(KERN_ERR "%s: regulator get %s failed (%ld)\n", |
| 6508 | __func__, vregs_tdisc_name[i], |
| 6509 | PTR_ERR(vregs_tdisc[i])); |
| 6510 | rc = PTR_ERR(vregs_tdisc[i]); |
| 6511 | goto vreg_get_fail; |
| 6512 | } |
| 6513 | |
| 6514 | rc = regulator_set_voltage(vregs_tdisc[i], |
| 6515 | vregs_tdisc_val[i], vregs_tdisc_val[i]); |
| 6516 | if (rc) { |
| 6517 | printk(KERN_ERR "%s: regulator_set_voltage() = %d\n", |
| 6518 | __func__, rc); |
| 6519 | goto vreg_set_voltage_fail; |
| 6520 | } |
| 6521 | } |
| 6522 | |
| 6523 | return rc; |
| 6524 | vreg_set_voltage_fail: |
| 6525 | i++; |
| 6526 | vreg_get_fail: |
| 6527 | while (i) |
| 6528 | regulator_put(vregs_tdisc[--i]); |
| 6529 | fail_gpio_oe: |
| 6530 | gpio_free(PMIC_GPIO_TDISC); |
| 6531 | return rc; |
| 6532 | } |
| 6533 | |
| 6534 | static void tdisc_shinetsu_release(void) |
| 6535 | { |
| 6536 | int i; |
| 6537 | |
| 6538 | for (i = 0; i < ARRAY_SIZE(vregs_tdisc_name); i++) |
| 6539 | regulator_put(vregs_tdisc[i]); |
| 6540 | |
| 6541 | gpio_free(PMIC_GPIO_TDISC); |
| 6542 | gpio_free(GPIO_JOYSTICK_EN); |
| 6543 | } |
| 6544 | |
| 6545 | static int tdisc_shinetsu_enable(void) |
| 6546 | { |
| 6547 | int i, rc = -EINVAL; |
| 6548 | |
| 6549 | for (i = 0; i < ARRAY_SIZE(vregs_tdisc_name); i++) { |
| 6550 | rc = regulator_enable(vregs_tdisc[i]); |
| 6551 | if (rc < 0) { |
| 6552 | printk(KERN_ERR "%s: vreg %s enable failed (%d)\n", |
| 6553 | __func__, vregs_tdisc_name[i], rc); |
| 6554 | goto vreg_fail; |
| 6555 | } |
| 6556 | } |
| 6557 | |
| 6558 | /* Enable the OE (output enable) gpio */ |
| 6559 | gpio_set_value_cansleep(GPIO_JOYSTICK_EN, 1); |
| 6560 | /* voltage and gpio stabilization delay */ |
| 6561 | msleep(50); |
| 6562 | |
| 6563 | return 0; |
| 6564 | vreg_fail: |
| 6565 | while (i) |
| 6566 | regulator_disable(vregs_tdisc[--i]); |
| 6567 | return rc; |
| 6568 | } |
| 6569 | |
| 6570 | static int tdisc_shinetsu_disable(void) |
| 6571 | { |
| 6572 | int i, rc; |
| 6573 | |
| 6574 | for (i = 0; i < ARRAY_SIZE(vregs_tdisc_name); i++) { |
| 6575 | rc = regulator_disable(vregs_tdisc[i]); |
| 6576 | if (rc < 0) { |
| 6577 | printk(KERN_ERR "%s: vreg %s disable failed (%d)\n", |
| 6578 | __func__, vregs_tdisc_name[i], rc); |
| 6579 | goto tdisc_reg_fail; |
| 6580 | } |
| 6581 | } |
| 6582 | |
| 6583 | /* Disable the OE (output enable) gpio */ |
| 6584 | gpio_set_value_cansleep(GPIO_JOYSTICK_EN, 0); |
| 6585 | |
| 6586 | return 0; |
| 6587 | |
| 6588 | tdisc_reg_fail: |
| 6589 | while (i) |
| 6590 | regulator_enable(vregs_tdisc[--i]); |
| 6591 | return rc; |
| 6592 | } |
| 6593 | |
| 6594 | static struct tdisc_abs_values tdisc_abs = { |
| 6595 | .x_max = 32, |
| 6596 | .y_max = 32, |
| 6597 | .x_min = -32, |
| 6598 | .y_min = -32, |
| 6599 | .pressure_max = 32, |
| 6600 | .pressure_min = 0, |
| 6601 | }; |
| 6602 | |
| 6603 | static struct tdisc_platform_data tdisc_data = { |
| 6604 | .tdisc_setup = tdisc_shinetsu_setup, |
| 6605 | .tdisc_release = tdisc_shinetsu_release, |
| 6606 | .tdisc_enable = tdisc_shinetsu_enable, |
| 6607 | .tdisc_disable = tdisc_shinetsu_disable, |
| 6608 | .tdisc_wakeup = 0, |
| 6609 | .tdisc_gpio = PMIC_GPIO_TDISC, |
| 6610 | .tdisc_report_keys = true, |
| 6611 | .tdisc_report_relative = true, |
| 6612 | .tdisc_report_absolute = false, |
| 6613 | .tdisc_report_wheel = false, |
| 6614 | .tdisc_reverse_x = false, |
| 6615 | .tdisc_reverse_y = true, |
| 6616 | .tdisc_abs = &tdisc_abs, |
| 6617 | }; |
| 6618 | |
| 6619 | static struct i2c_board_info msm_i2c_gsbi3_tdisc_info[] = { |
| 6620 | { |
| 6621 | I2C_BOARD_INFO("vtd518", TDISC_I2C_SLAVE_ADDR), |
| 6622 | .irq = TDISC_INT, |
| 6623 | .platform_data = &tdisc_data, |
| 6624 | }, |
| 6625 | }; |
| 6626 | #endif |
| 6627 | |
| 6628 | #define PM_GPIO_CDC_RST_N 20 |
| 6629 | #define GPIO_CDC_RST_N PM8058_GPIO_PM_TO_SYS(PM_GPIO_CDC_RST_N) |
| 6630 | |
| 6631 | static struct regulator *vreg_timpani_1; |
| 6632 | static struct regulator *vreg_timpani_2; |
| 6633 | |
| 6634 | static unsigned int msm_timpani_setup_power(void) |
| 6635 | { |
| 6636 | int rc; |
| 6637 | |
| 6638 | vreg_timpani_1 = regulator_get(NULL, "8058_l0"); |
| 6639 | if (IS_ERR(vreg_timpani_1)) { |
| 6640 | pr_err("%s: Unable to get 8058_l0\n", __func__); |
| 6641 | return -ENODEV; |
| 6642 | } |
| 6643 | |
| 6644 | vreg_timpani_2 = regulator_get(NULL, "8058_s3"); |
| 6645 | if (IS_ERR(vreg_timpani_2)) { |
| 6646 | pr_err("%s: Unable to get 8058_s3\n", __func__); |
| 6647 | regulator_put(vreg_timpani_1); |
| 6648 | return -ENODEV; |
| 6649 | } |
| 6650 | |
| 6651 | rc = regulator_set_voltage(vreg_timpani_1, 1200000, 1200000); |
| 6652 | if (rc) { |
| 6653 | pr_err("%s: unable to set L0 voltage to 1.2V\n", __func__); |
| 6654 | goto fail; |
| 6655 | } |
| 6656 | |
| 6657 | rc = regulator_set_voltage(vreg_timpani_2, 1800000, 1800000); |
| 6658 | if (rc) { |
| 6659 | pr_err("%s: unable to set S3 voltage to 1.8V\n", __func__); |
| 6660 | goto fail; |
| 6661 | } |
| 6662 | |
| 6663 | rc = regulator_enable(vreg_timpani_1); |
| 6664 | if (rc) { |
| 6665 | pr_err("%s: Enable regulator 8058_l0 failed\n", __func__); |
| 6666 | goto fail; |
| 6667 | } |
| 6668 | |
| 6669 | /* The settings for LDO0 should be set such that |
| 6670 | * it doesn't require to reset the timpani. */ |
| 6671 | rc = regulator_set_optimum_mode(vreg_timpani_1, 5000); |
| 6672 | if (rc < 0) { |
| 6673 | pr_err("Timpani regulator optimum mode setting failed\n"); |
| 6674 | goto fail; |
| 6675 | } |
| 6676 | |
| 6677 | rc = regulator_enable(vreg_timpani_2); |
| 6678 | if (rc) { |
| 6679 | pr_err("%s: Enable regulator 8058_s3 failed\n", __func__); |
| 6680 | regulator_disable(vreg_timpani_1); |
| 6681 | goto fail; |
| 6682 | } |
| 6683 | |
| 6684 | rc = gpio_request(GPIO_CDC_RST_N, "CDC_RST_N"); |
| 6685 | if (rc) { |
| 6686 | pr_err("%s: GPIO Request %d failed\n", __func__, |
| 6687 | GPIO_CDC_RST_N); |
| 6688 | regulator_disable(vreg_timpani_1); |
| 6689 | regulator_disable(vreg_timpani_2); |
| 6690 | goto fail; |
| 6691 | } else { |
| 6692 | gpio_direction_output(GPIO_CDC_RST_N, 1); |
| 6693 | usleep_range(1000, 1050); |
| 6694 | gpio_direction_output(GPIO_CDC_RST_N, 0); |
| 6695 | usleep_range(1000, 1050); |
| 6696 | gpio_direction_output(GPIO_CDC_RST_N, 1); |
| 6697 | gpio_free(GPIO_CDC_RST_N); |
| 6698 | } |
| 6699 | return rc; |
| 6700 | |
| 6701 | fail: |
| 6702 | regulator_put(vreg_timpani_1); |
| 6703 | regulator_put(vreg_timpani_2); |
| 6704 | return rc; |
| 6705 | } |
| 6706 | |
| 6707 | static void msm_timpani_shutdown_power(void) |
| 6708 | { |
| 6709 | int rc; |
| 6710 | |
| 6711 | rc = regulator_disable(vreg_timpani_1); |
| 6712 | if (rc) |
| 6713 | pr_err("%s: Disable regulator 8058_l0 failed\n", __func__); |
| 6714 | |
| 6715 | regulator_put(vreg_timpani_1); |
| 6716 | |
| 6717 | rc = regulator_disable(vreg_timpani_2); |
| 6718 | if (rc) |
| 6719 | pr_err("%s: Disable regulator 8058_s3 failed\n", __func__); |
| 6720 | |
| 6721 | regulator_put(vreg_timpani_2); |
| 6722 | } |
| 6723 | |
| 6724 | /* Power analog function of codec */ |
| 6725 | static struct regulator *vreg_timpani_cdc_apwr; |
| 6726 | static int msm_timpani_codec_power(int vreg_on) |
| 6727 | { |
| 6728 | int rc = 0; |
| 6729 | |
| 6730 | if (!vreg_timpani_cdc_apwr) { |
| 6731 | |
| 6732 | vreg_timpani_cdc_apwr = regulator_get(NULL, "8058_s4"); |
| 6733 | |
| 6734 | if (IS_ERR(vreg_timpani_cdc_apwr)) { |
| 6735 | pr_err("%s: vreg_get failed (%ld)\n", |
| 6736 | __func__, PTR_ERR(vreg_timpani_cdc_apwr)); |
| 6737 | rc = PTR_ERR(vreg_timpani_cdc_apwr); |
| 6738 | return rc; |
| 6739 | } |
| 6740 | } |
| 6741 | |
| 6742 | if (vreg_on) { |
| 6743 | |
| 6744 | rc = regulator_set_voltage(vreg_timpani_cdc_apwr, |
| 6745 | 2200000, 2200000); |
| 6746 | if (rc) { |
| 6747 | pr_err("%s: unable to set 8058_s4 voltage to 2.2 V\n", |
| 6748 | __func__); |
| 6749 | goto vreg_fail; |
| 6750 | } |
| 6751 | |
| 6752 | rc = regulator_enable(vreg_timpani_cdc_apwr); |
| 6753 | if (rc) { |
| 6754 | pr_err("%s: vreg_enable failed %d\n", __func__, rc); |
| 6755 | goto vreg_fail; |
| 6756 | } |
| 6757 | } else { |
| 6758 | rc = regulator_disable(vreg_timpani_cdc_apwr); |
| 6759 | if (rc) { |
| 6760 | pr_err("%s: vreg_disable failed %d\n", |
| 6761 | __func__, rc); |
| 6762 | goto vreg_fail; |
| 6763 | } |
| 6764 | } |
| 6765 | |
| 6766 | return 0; |
| 6767 | |
| 6768 | vreg_fail: |
| 6769 | regulator_put(vreg_timpani_cdc_apwr); |
| 6770 | vreg_timpani_cdc_apwr = NULL; |
| 6771 | return rc; |
| 6772 | } |
| 6773 | |
| 6774 | static struct marimba_codec_platform_data timpani_codec_pdata = { |
| 6775 | .marimba_codec_power = msm_timpani_codec_power, |
| 6776 | }; |
| 6777 | |
| 6778 | #define TIMPANI_SLAVE_ID_CDC_ADDR 0X77 |
| 6779 | #define TIMPANI_SLAVE_ID_QMEMBIST_ADDR 0X66 |
| 6780 | |
| 6781 | static struct marimba_platform_data timpani_pdata = { |
| 6782 | .slave_id[MARIMBA_SLAVE_ID_CDC] = TIMPANI_SLAVE_ID_CDC_ADDR, |
| 6783 | .slave_id[MARIMBA_SLAVE_ID_QMEMBIST] = TIMPANI_SLAVE_ID_QMEMBIST_ADDR, |
| 6784 | .marimba_setup = msm_timpani_setup_power, |
| 6785 | .marimba_shutdown = msm_timpani_shutdown_power, |
| 6786 | .codec = &timpani_codec_pdata, |
| 6787 | .tsadc_ssbi_adap = MARIMBA_SSBI_ADAP, |
| 6788 | }; |
| 6789 | |
| 6790 | #define TIMPANI_I2C_SLAVE_ADDR 0xD |
| 6791 | |
| 6792 | static struct i2c_board_info msm_i2c_gsbi7_timpani_info[] = { |
| 6793 | { |
| 6794 | I2C_BOARD_INFO("timpani", TIMPANI_I2C_SLAVE_ADDR), |
| 6795 | .platform_data = &timpani_pdata, |
| 6796 | }, |
| 6797 | }; |
| 6798 | |
Lei Zhou | 338cab8 | 2011-08-19 13:38:17 -0400 | [diff] [blame] | 6799 | #ifdef CONFIG_SND_SOC_WM8903 |
| 6800 | static struct wm8903_platform_data wm8903_pdata = { |
| 6801 | .gpio_cfg[2] = 0x3A8, |
| 6802 | }; |
| 6803 | |
| 6804 | #define WM8903_I2C_SLAVE_ADDR 0x34 |
| 6805 | static struct i2c_board_info wm8903_codec_i2c_info[] = { |
| 6806 | { |
| 6807 | I2C_BOARD_INFO("wm8903", WM8903_I2C_SLAVE_ADDR >> 1), |
| 6808 | .platform_data = &wm8903_pdata, |
| 6809 | }, |
| 6810 | }; |
| 6811 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6812 | #ifdef CONFIG_PMIC8901 |
| 6813 | |
| 6814 | #define PM8901_GPIO_INT 91 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6815 | /* |
| 6816 | * Consumer specific regulator names: |
| 6817 | * regulator name consumer dev_name |
| 6818 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6819 | static struct regulator_consumer_supply vreg_consumers_8901_USB_OTG[] = { |
| 6820 | REGULATOR_SUPPLY("8901_usb_otg", NULL), |
| 6821 | }; |
| 6822 | static struct regulator_consumer_supply vreg_consumers_8901_HDMI_MVS[] = { |
| 6823 | REGULATOR_SUPPLY("8901_hdmi_mvs", NULL), |
| 6824 | }; |
| 6825 | |
| 6826 | #define PM8901_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \ |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6827 | _always_on) \ |
| 6828 | { \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6829 | .init_data = { \ |
| 6830 | .constraints = { \ |
| 6831 | .valid_modes_mask = _modes, \ |
| 6832 | .valid_ops_mask = _ops, \ |
| 6833 | .min_uV = _min_uV, \ |
| 6834 | .max_uV = _max_uV, \ |
| 6835 | .input_uV = _min_uV, \ |
| 6836 | .apply_uV = _apply_uV, \ |
| 6837 | .always_on = _always_on, \ |
| 6838 | }, \ |
| 6839 | .consumer_supplies = vreg_consumers_8901_##_id, \ |
| 6840 | .num_consumer_supplies = \ |
| 6841 | ARRAY_SIZE(vreg_consumers_8901_##_id), \ |
| 6842 | }, \ |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6843 | .id = PM8901_VREG_ID_##_id, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6844 | } |
| 6845 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6846 | #define PM8901_VREG_INIT_VS(_id) \ |
| 6847 | PM8901_VREG_INIT(_id, 0, 0, REGULATOR_MODE_NORMAL, \ |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6848 | REGULATOR_CHANGE_STATUS, 0, 0) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6849 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6850 | static struct pm8901_vreg_pdata pm8901_vreg_init[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6851 | PM8901_VREG_INIT_VS(USB_OTG), |
| 6852 | PM8901_VREG_INIT_VS(HDMI_MVS), |
| 6853 | }; |
| 6854 | |
Anirudh Ghayal | b6c9809 | 2011-12-13 14:06:48 +0530 | [diff] [blame] | 6855 | static struct pm8xxx_misc_platform_data pm8901_misc_pdata = { |
| 6856 | .priority = 1, |
| 6857 | }; |
| 6858 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6859 | static struct pm8xxx_irq_platform_data pm8901_irq_pdata = { |
| 6860 | .irq_base = PM8901_IRQ_BASE, |
| 6861 | .devirq = MSM_GPIO_TO_INT(PM8901_GPIO_INT), |
| 6862 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 6863 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6864 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6865 | static struct pm8xxx_mpp_platform_data pm8901_mpp_pdata = { |
| 6866 | .mpp_base = PM8901_MPP_PM_TO_SYS(0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6867 | }; |
| 6868 | |
| 6869 | static struct pm8901_platform_data pm8901_platform_data = { |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 6870 | .irq_pdata = &pm8901_irq_pdata, |
| 6871 | .mpp_pdata = &pm8901_mpp_pdata, |
| 6872 | .regulator_pdatas = pm8901_vreg_init, |
| 6873 | .num_regulators = ARRAY_SIZE(pm8901_vreg_init), |
Anirudh Ghayal | b6c9809 | 2011-12-13 14:06:48 +0530 | [diff] [blame] | 6874 | .misc_pdata = &pm8901_misc_pdata, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6875 | }; |
| 6876 | |
Anirudh Ghayal | c49157f | 2011-11-09 14:49:59 +0530 | [diff] [blame] | 6877 | static struct msm_ssbi_platform_data msm8x60_ssbi_pm8901_pdata __devinitdata = { |
| 6878 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 6879 | .slave = { |
| 6880 | .name = "pm8901-core", |
| 6881 | .platform_data = &pm8901_platform_data, |
| 6882 | }, |
| 6883 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6884 | #endif /* CONFIG_PMIC8901 */ |
| 6885 | |
| 6886 | #if defined(CONFIG_MARIMBA_CORE) && (defined(CONFIG_GPIO_SX150X) \ |
| 6887 | || defined(CONFIG_GPIO_SX150X_MODULE)) |
| 6888 | |
| 6889 | static struct regulator *vreg_bahama; |
Zhang Chang Ken | e1fd3da | 2011-08-10 08:25:57 -0400 | [diff] [blame] | 6890 | static int msm_bahama_sys_rst = GPIO_MS_SYS_RESET_N; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6891 | |
| 6892 | struct bahama_config_register{ |
| 6893 | u8 reg; |
| 6894 | u8 value; |
| 6895 | u8 mask; |
| 6896 | }; |
| 6897 | |
| 6898 | enum version{ |
| 6899 | VER_1_0, |
| 6900 | VER_2_0, |
| 6901 | VER_UNSUPPORTED = 0xFF |
| 6902 | }; |
| 6903 | |
| 6904 | static u8 read_bahama_ver(void) |
| 6905 | { |
| 6906 | int rc; |
| 6907 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA }; |
| 6908 | u8 bahama_version; |
| 6909 | |
| 6910 | rc = marimba_read_bit_mask(&config, 0x00, &bahama_version, 1, 0x1F); |
| 6911 | if (rc < 0) { |
| 6912 | printk(KERN_ERR |
| 6913 | "%s: version read failed: %d\n", |
| 6914 | __func__, rc); |
| 6915 | return VER_UNSUPPORTED; |
| 6916 | } else { |
| 6917 | printk(KERN_INFO |
| 6918 | "%s: version read got: 0x%x\n", |
| 6919 | __func__, bahama_version); |
| 6920 | } |
| 6921 | |
| 6922 | switch (bahama_version) { |
| 6923 | case 0x08: /* varient of bahama v1 */ |
| 6924 | case 0x10: |
| 6925 | case 0x00: |
| 6926 | return VER_1_0; |
| 6927 | case 0x09: /* variant of bahama v2 */ |
| 6928 | return VER_2_0; |
| 6929 | default: |
| 6930 | return VER_UNSUPPORTED; |
| 6931 | } |
| 6932 | } |
| 6933 | |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6934 | static int msm_bahama_setup_power_enable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6935 | static unsigned int msm_bahama_setup_power(void) |
| 6936 | { |
| 6937 | int rc = 0; |
| 6938 | const char *msm_bahama_regulator = "8058_s3"; |
Zhang Chang Ken | e1fd3da | 2011-08-10 08:25:57 -0400 | [diff] [blame] | 6939 | |
| 6940 | if (machine_is_msm8x60_dragon()) |
| 6941 | msm_bahama_sys_rst = GPIO_CDC_RST_N; |
| 6942 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6943 | vreg_bahama = regulator_get(NULL, msm_bahama_regulator); |
| 6944 | |
| 6945 | if (IS_ERR(vreg_bahama)) { |
| 6946 | rc = PTR_ERR(vreg_bahama); |
| 6947 | pr_err("%s: regulator_get %s = %d\n", __func__, |
| 6948 | msm_bahama_regulator, rc); |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6949 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6950 | } |
| 6951 | |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6952 | rc = regulator_set_voltage(vreg_bahama, 1800000, 1800000); |
| 6953 | if (rc) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6954 | pr_err("%s: regulator_set_voltage %s = %d\n", __func__, |
| 6955 | msm_bahama_regulator, rc); |
| 6956 | goto unget; |
| 6957 | } |
| 6958 | |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6959 | rc = regulator_enable(vreg_bahama); |
| 6960 | if (rc) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6961 | pr_err("%s: regulator_enable %s = %d\n", __func__, |
| 6962 | msm_bahama_regulator, rc); |
| 6963 | goto unget; |
| 6964 | } |
| 6965 | |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6966 | rc = gpio_request(msm_bahama_sys_rst, "bahama sys_rst_n"); |
| 6967 | if (rc) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6968 | pr_err("%s: gpio_request %d = %d\n", __func__, |
Zhang Chang Ken | e1fd3da | 2011-08-10 08:25:57 -0400 | [diff] [blame] | 6969 | msm_bahama_sys_rst, rc); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6970 | goto unenable; |
| 6971 | } |
| 6972 | |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6973 | gpio_direction_output(msm_bahama_sys_rst, 0); |
| 6974 | usleep_range(1000, 1050); |
| 6975 | gpio_set_value_cansleep(msm_bahama_sys_rst, 1); |
| 6976 | usleep_range(1000, 1050); |
| 6977 | msm_bahama_setup_power_enable = 1; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6978 | return rc; |
| 6979 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6980 | unenable: |
| 6981 | regulator_disable(vreg_bahama); |
| 6982 | unget: |
| 6983 | regulator_put(vreg_bahama); |
| 6984 | return rc; |
| 6985 | }; |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6986 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6987 | static unsigned int msm_bahama_shutdown_power(int value) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6988 | { |
Siddartha Mohanadoss | 7e8e9dd | 2011-09-27 19:04:58 -0700 | [diff] [blame] | 6989 | if (msm_bahama_setup_power_enable) { |
| 6990 | gpio_set_value_cansleep(msm_bahama_sys_rst, 0); |
| 6991 | gpio_free(msm_bahama_sys_rst); |
| 6992 | regulator_disable(vreg_bahama); |
| 6993 | regulator_put(vreg_bahama); |
| 6994 | msm_bahama_setup_power_enable = 0; |
| 6995 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6996 | |
| 6997 | return 0; |
| 6998 | }; |
| 6999 | |
| 7000 | static unsigned int msm_bahama_core_config(int type) |
| 7001 | { |
| 7002 | int rc = 0; |
| 7003 | |
| 7004 | if (type == BAHAMA_ID) { |
| 7005 | |
| 7006 | int i; |
| 7007 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA }; |
| 7008 | |
| 7009 | const struct bahama_config_register v20_init[] = { |
| 7010 | /* reg, value, mask */ |
| 7011 | { 0xF4, 0x84, 0xFF }, /* AREG */ |
| 7012 | { 0xF0, 0x04, 0xFF } /* DREG */ |
| 7013 | }; |
| 7014 | |
| 7015 | if (read_bahama_ver() == VER_2_0) { |
| 7016 | for (i = 0; i < ARRAY_SIZE(v20_init); i++) { |
| 7017 | u8 value = v20_init[i].value; |
| 7018 | rc = marimba_write_bit_mask(&config, |
| 7019 | v20_init[i].reg, |
| 7020 | &value, |
| 7021 | sizeof(v20_init[i].value), |
| 7022 | v20_init[i].mask); |
| 7023 | if (rc < 0) { |
| 7024 | printk(KERN_ERR |
| 7025 | "%s: reg %d write failed: %d\n", |
| 7026 | __func__, v20_init[i].reg, rc); |
| 7027 | return rc; |
| 7028 | } |
| 7029 | printk(KERN_INFO "%s: reg 0x%02x value 0x%02x" |
| 7030 | " mask 0x%02x\n", |
| 7031 | __func__, v20_init[i].reg, |
| 7032 | v20_init[i].value, v20_init[i].mask); |
| 7033 | } |
| 7034 | } |
| 7035 | } |
| 7036 | printk(KERN_INFO "core type: %d\n", type); |
| 7037 | |
| 7038 | return rc; |
| 7039 | } |
| 7040 | |
| 7041 | static struct regulator *fm_regulator_s3; |
| 7042 | static struct msm_xo_voter *fm_clock; |
| 7043 | |
| 7044 | static int fm_radio_setup(struct marimba_fm_platform_data *pdata) |
| 7045 | { |
| 7046 | int rc = 0; |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 7047 | struct pm_gpio cfg = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7048 | .direction = PM_GPIO_DIR_IN, |
| 7049 | .pull = PM_GPIO_PULL_NO, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 7050 | .vin_sel = PM8058_GPIO_VIN_S3, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7051 | .function = PM_GPIO_FUNC_NORMAL, |
| 7052 | .inv_int_pol = 0, |
| 7053 | }; |
| 7054 | |
| 7055 | if (!fm_regulator_s3) { |
| 7056 | fm_regulator_s3 = regulator_get(NULL, "8058_s3"); |
| 7057 | if (IS_ERR(fm_regulator_s3)) { |
| 7058 | rc = PTR_ERR(fm_regulator_s3); |
| 7059 | printk(KERN_ERR "%s: regulator get s3 (%d)\n", |
| 7060 | __func__, rc); |
| 7061 | goto out; |
| 7062 | } |
| 7063 | } |
| 7064 | |
| 7065 | |
| 7066 | rc = regulator_set_voltage(fm_regulator_s3, 1800000, 1800000); |
| 7067 | if (rc < 0) { |
| 7068 | printk(KERN_ERR "%s: regulator set voltage failed (%d)\n", |
| 7069 | __func__, rc); |
| 7070 | goto fm_fail_put; |
| 7071 | } |
| 7072 | |
| 7073 | rc = regulator_enable(fm_regulator_s3); |
| 7074 | if (rc < 0) { |
| 7075 | printk(KERN_ERR "%s: regulator s3 enable failed (%d)\n", |
| 7076 | __func__, rc); |
| 7077 | goto fm_fail_put; |
| 7078 | } |
| 7079 | |
| 7080 | /*Vote for XO clock*/ |
| 7081 | fm_clock = msm_xo_get(MSM_XO_TCXO_D0, "fm_power"); |
| 7082 | |
| 7083 | if (IS_ERR(fm_clock)) { |
| 7084 | rc = PTR_ERR(fm_clock); |
| 7085 | printk(KERN_ERR "%s: Couldn't get TCXO_D0 vote for FM (%d)\n", |
| 7086 | __func__, rc); |
| 7087 | goto fm_fail_switch; |
| 7088 | } |
| 7089 | |
| 7090 | rc = msm_xo_mode_vote(fm_clock, MSM_XO_MODE_ON); |
| 7091 | if (rc < 0) { |
| 7092 | printk(KERN_ERR "%s: Failed to vote for TCX0_D0 ON (%d)\n", |
| 7093 | __func__, rc); |
| 7094 | goto fm_fail_vote; |
| 7095 | } |
| 7096 | |
| 7097 | /*GPIO 18 on PMIC is FM_IRQ*/ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 7098 | rc = pm8xxx_gpio_config(PM8058_GPIO_PM_TO_SYS(FM_GPIO), &cfg); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7099 | if (rc) { |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 7100 | printk(KERN_ERR "%s: return val of pm8xxx_gpio_config: %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7101 | __func__, rc); |
| 7102 | goto fm_fail_clock; |
| 7103 | } |
| 7104 | goto out; |
| 7105 | |
| 7106 | fm_fail_clock: |
| 7107 | msm_xo_mode_vote(fm_clock, MSM_XO_MODE_OFF); |
| 7108 | fm_fail_vote: |
| 7109 | msm_xo_put(fm_clock); |
| 7110 | fm_fail_switch: |
| 7111 | regulator_disable(fm_regulator_s3); |
| 7112 | fm_fail_put: |
| 7113 | regulator_put(fm_regulator_s3); |
| 7114 | out: |
| 7115 | return rc; |
| 7116 | }; |
| 7117 | |
| 7118 | static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata) |
| 7119 | { |
| 7120 | int rc = 0; |
| 7121 | if (fm_regulator_s3 != NULL) { |
| 7122 | rc = regulator_disable(fm_regulator_s3); |
| 7123 | if (rc < 0) { |
| 7124 | printk(KERN_ERR "%s: regulator s3 disable (%d)\n", |
| 7125 | __func__, rc); |
| 7126 | } |
| 7127 | regulator_put(fm_regulator_s3); |
| 7128 | fm_regulator_s3 = NULL; |
| 7129 | } |
| 7130 | printk(KERN_ERR "%s: Voting off for XO", __func__); |
| 7131 | |
| 7132 | if (fm_clock != NULL) { |
| 7133 | rc = msm_xo_mode_vote(fm_clock, MSM_XO_MODE_OFF); |
| 7134 | if (rc < 0) { |
| 7135 | printk(KERN_ERR "%s: Voting off XO clock (%d)\n", |
| 7136 | __func__, rc); |
| 7137 | } |
| 7138 | msm_xo_put(fm_clock); |
| 7139 | } |
| 7140 | printk(KERN_ERR "%s: coming out of fm_radio_shutdown", __func__); |
| 7141 | } |
| 7142 | |
| 7143 | /* Slave id address for FM/CDC/QMEMBIST |
| 7144 | * Values can be programmed using Marimba slave id 0 |
| 7145 | * should there be a conflict with other I2C devices |
| 7146 | * */ |
| 7147 | #define BAHAMA_SLAVE_ID_FM_ADDR 0x2A |
| 7148 | #define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B |
| 7149 | |
| 7150 | static struct marimba_fm_platform_data marimba_fm_pdata = { |
| 7151 | .fm_setup = fm_radio_setup, |
| 7152 | .fm_shutdown = fm_radio_shutdown, |
| 7153 | .irq = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, FM_GPIO), |
| 7154 | .is_fm_soc_i2s_master = false, |
| 7155 | .config_i2s_gpio = NULL, |
| 7156 | }; |
| 7157 | |
| 7158 | /* |
| 7159 | Just initializing the BAHAMA related slave |
| 7160 | */ |
| 7161 | static struct marimba_platform_data marimba_pdata = { |
| 7162 | .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR, |
| 7163 | .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR, |
| 7164 | .bahama_setup = msm_bahama_setup_power, |
| 7165 | .bahama_shutdown = msm_bahama_shutdown_power, |
| 7166 | .bahama_core_config = msm_bahama_core_config, |
| 7167 | .fm = &marimba_fm_pdata, |
| 7168 | .tsadc_ssbi_adap = MARIMBA_SSBI_ADAP, |
| 7169 | }; |
| 7170 | |
| 7171 | |
| 7172 | static struct i2c_board_info msm_marimba_board_info[] = { |
| 7173 | { |
| 7174 | I2C_BOARD_INFO("marimba", 0xc), |
| 7175 | .platform_data = &marimba_pdata, |
| 7176 | } |
| 7177 | }; |
| 7178 | #endif /* CONFIG_MAIMBA_CORE */ |
| 7179 | |
| 7180 | #ifdef CONFIG_I2C |
| 7181 | #define I2C_SURF 1 |
| 7182 | #define I2C_FFA (1 << 1) |
| 7183 | #define I2C_RUMI (1 << 2) |
| 7184 | #define I2C_SIM (1 << 3) |
| 7185 | #define I2C_FLUID (1 << 4) |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7186 | #define I2C_DRAGON (1 << 5) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7187 | |
| 7188 | struct i2c_registry { |
| 7189 | u8 machs; |
| 7190 | int bus; |
| 7191 | struct i2c_board_info *info; |
| 7192 | int len; |
| 7193 | }; |
| 7194 | |
| 7195 | static struct i2c_registry msm8x60_i2c_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7196 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 7197 | { |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7198 | I2C_SURF | I2C_FFA | I2C_DRAGON, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7199 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7200 | core_expander_i2c_info, |
| 7201 | ARRAY_SIZE(core_expander_i2c_info), |
| 7202 | }, |
| 7203 | { |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7204 | I2C_SURF | I2C_FFA | I2C_DRAGON, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7205 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7206 | docking_expander_i2c_info, |
| 7207 | ARRAY_SIZE(docking_expander_i2c_info), |
| 7208 | }, |
| 7209 | { |
| 7210 | I2C_SURF, |
| 7211 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7212 | surf_expanders_i2c_info, |
| 7213 | ARRAY_SIZE(surf_expanders_i2c_info), |
| 7214 | }, |
| 7215 | { |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7216 | I2C_SURF | I2C_FFA | I2C_DRAGON, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7217 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7218 | fha_expanders_i2c_info, |
| 7219 | ARRAY_SIZE(fha_expanders_i2c_info), |
| 7220 | }, |
| 7221 | { |
| 7222 | I2C_FLUID, |
| 7223 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7224 | fluid_expanders_i2c_info, |
| 7225 | ARRAY_SIZE(fluid_expanders_i2c_info), |
| 7226 | }, |
| 7227 | { |
| 7228 | I2C_FLUID, |
| 7229 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7230 | fluid_core_expander_i2c_info, |
| 7231 | ARRAY_SIZE(fluid_core_expander_i2c_info), |
| 7232 | }, |
| 7233 | #endif |
| 7234 | #if defined(CONFIG_TOUCHDISC_VTD518_SHINETSU) || \ |
| 7235 | defined(CONFIG_TOUCHDISC_VTD518_SHINETSU_MODULE) |
| 7236 | { |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7237 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_DRAGON, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7238 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7239 | msm_i2c_gsbi3_tdisc_info, |
| 7240 | ARRAY_SIZE(msm_i2c_gsbi3_tdisc_info), |
| 7241 | }, |
| 7242 | #endif |
| 7243 | { |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 7244 | I2C_SURF | I2C_FFA | I2C_FLUID, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7245 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7246 | cy8ctmg200_board_info, |
| 7247 | ARRAY_SIZE(cy8ctmg200_board_info), |
| 7248 | }, |
Zhang Chang Ken | 211df57 | 2011-07-05 19:16:39 -0400 | [diff] [blame] | 7249 | { |
| 7250 | I2C_DRAGON, |
| 7251 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7252 | cy8ctma340_dragon_board_info, |
| 7253 | ARRAY_SIZE(cy8ctma340_dragon_board_info), |
| 7254 | }, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 7255 | #if defined(CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC) || \ |
| 7256 | defined(CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC_MODULE) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7257 | { |
| 7258 | I2C_FLUID, |
| 7259 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7260 | cyttsp_fluid_info, |
| 7261 | ARRAY_SIZE(cyttsp_fluid_info), |
| 7262 | }, |
| 7263 | { |
| 7264 | I2C_FFA | I2C_SURF, |
| 7265 | MSM_GSBI3_QUP_I2C_BUS_ID, |
| 7266 | cyttsp_ffa_info, |
| 7267 | ARRAY_SIZE(cyttsp_ffa_info), |
| 7268 | }, |
| 7269 | #endif |
| 7270 | #ifdef CONFIG_MSM_CAMERA |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 7271 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 7272 | { |
| 7273 | I2C_SURF | I2C_FFA | I2C_FLUID , |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7274 | MSM_GSBI4_QUP_I2C_BUS_ID, |
| 7275 | msm_camera_boardinfo, |
| 7276 | ARRAY_SIZE(msm_camera_boardinfo), |
| 7277 | }, |
Jilai Wang | 971f97f | 2011-07-13 14:25:25 -0400 | [diff] [blame] | 7278 | { |
| 7279 | I2C_DRAGON, |
| 7280 | MSM_GSBI4_QUP_I2C_BUS_ID, |
| 7281 | msm_camera_dragon_boardinfo, |
| 7282 | ARRAY_SIZE(msm_camera_dragon_boardinfo), |
| 7283 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7284 | #endif |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 7285 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7286 | { |
| 7287 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 7288 | MSM_GSBI7_QUP_I2C_BUS_ID, |
| 7289 | msm_i2c_gsbi7_timpani_info, |
| 7290 | ARRAY_SIZE(msm_i2c_gsbi7_timpani_info), |
| 7291 | }, |
| 7292 | #if defined(CONFIG_MARIMBA_CORE) |
| 7293 | { |
Zhang Chang Ken | e1fd3da | 2011-08-10 08:25:57 -0400 | [diff] [blame] | 7294 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_DRAGON, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7295 | MSM_GSBI7_QUP_I2C_BUS_ID, |
| 7296 | msm_marimba_board_info, |
| 7297 | ARRAY_SIZE(msm_marimba_board_info), |
| 7298 | }, |
| 7299 | #endif /* CONFIG_MARIMBA_CORE */ |
| 7300 | #ifdef CONFIG_ISL9519_CHARGER |
| 7301 | { |
| 7302 | I2C_SURF | I2C_FFA, |
| 7303 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7304 | isl_charger_i2c_info, |
| 7305 | ARRAY_SIZE(isl_charger_i2c_info), |
| 7306 | }, |
| 7307 | #endif |
| 7308 | #if defined(CONFIG_HAPTIC_ISA1200) || \ |
| 7309 | defined(CONFIG_HAPTIC_ISA1200_MODULE) |
| 7310 | { |
| 7311 | I2C_FLUID, |
| 7312 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7313 | msm_isa1200_board_info, |
| 7314 | ARRAY_SIZE(msm_isa1200_board_info), |
| 7315 | }, |
| 7316 | #endif |
| 7317 | #if defined(CONFIG_SMB137B_CHARGER) || defined(CONFIG_SMB137B_CHARGER_MODULE) |
| 7318 | { |
| 7319 | I2C_FLUID, |
| 7320 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7321 | smb137b_charger_i2c_info, |
| 7322 | ARRAY_SIZE(smb137b_charger_i2c_info), |
| 7323 | }, |
| 7324 | #endif |
| 7325 | #if defined(CONFIG_BATTERY_BQ27520) || \ |
| 7326 | defined(CONFIG_BATTERY_BQ27520_MODULE) |
| 7327 | { |
| 7328 | I2C_FLUID, |
| 7329 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7330 | msm_bq27520_board_info, |
| 7331 | ARRAY_SIZE(msm_bq27520_board_info), |
| 7332 | }, |
| 7333 | #endif |
Lei Zhou | 338cab8 | 2011-08-19 13:38:17 -0400 | [diff] [blame] | 7334 | #if defined(CONFIG_SND_SOC_WM8903) || defined(CONFIG_SND_SOC_WM8903_MODULE) |
| 7335 | { |
| 7336 | I2C_DRAGON, |
| 7337 | MSM_GSBI8_QUP_I2C_BUS_ID, |
| 7338 | wm8903_codec_i2c_info, |
| 7339 | ARRAY_SIZE(wm8903_codec_i2c_info), |
| 7340 | }, |
| 7341 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7342 | }; |
| 7343 | #endif /* CONFIG_I2C */ |
| 7344 | |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 7345 | static void __init fixup_i2c_configs(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7346 | { |
| 7347 | #ifdef CONFIG_I2C |
| 7348 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 7349 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_fusion()) |
| 7350 | sx150x_data[SX150X_CORE].irq_summary = |
| 7351 | PM8058_GPIO_IRQ(PM8058_IRQ_BASE, UI_INT2_N); |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7352 | else if (machine_is_msm8x60_ffa() || machine_is_msm8x60_fusn_ffa() || |
| 7353 | machine_is_msm8x60_dragon()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7354 | sx150x_data[SX150X_CORE].irq_summary = |
| 7355 | PM8058_GPIO_IRQ(PM8058_IRQ_BASE, UI_INT1_N); |
| 7356 | else if (machine_is_msm8x60_fluid()) |
| 7357 | sx150x_data[SX150X_CORE_FLUID].irq_summary = |
| 7358 | PM8058_GPIO_IRQ(PM8058_IRQ_BASE, UI_INT1_N); |
| 7359 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7360 | #endif |
| 7361 | } |
| 7362 | |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 7363 | static void __init register_i2c_devices(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7364 | { |
| 7365 | #ifdef CONFIG_I2C |
| 7366 | u8 mach_mask = 0; |
| 7367 | int i; |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 7368 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
| 7369 | struct i2c_registry msm8x60_camera_i2c_devices = { |
| 7370 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 7371 | MSM_GSBI4_QUP_I2C_BUS_ID, |
| 7372 | msm8x60_camera_board_info.board_info, |
| 7373 | msm8x60_camera_board_info.num_i2c_board_info, |
| 7374 | }; |
| 7375 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7376 | |
| 7377 | /* Build the matching 'supported_machs' bitmask */ |
| 7378 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_fusion()) |
| 7379 | mach_mask = I2C_SURF; |
| 7380 | else if (machine_is_msm8x60_ffa() || machine_is_msm8x60_fusn_ffa()) |
| 7381 | mach_mask = I2C_FFA; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7382 | else if (machine_is_msm8x60_fluid()) |
| 7383 | mach_mask = I2C_FLUID; |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7384 | else if (machine_is_msm8x60_dragon()) |
| 7385 | mach_mask = I2C_DRAGON; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7386 | else |
| 7387 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 7388 | |
| 7389 | /* Run the array and install devices as appropriate */ |
| 7390 | for (i = 0; i < ARRAY_SIZE(msm8x60_i2c_devices); ++i) { |
| 7391 | if (msm8x60_i2c_devices[i].machs & mach_mask) |
| 7392 | i2c_register_board_info(msm8x60_i2c_devices[i].bus, |
| 7393 | msm8x60_i2c_devices[i].info, |
| 7394 | msm8x60_i2c_devices[i].len); |
| 7395 | } |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 7396 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
| 7397 | if (msm8x60_camera_i2c_devices.machs & mach_mask) |
| 7398 | i2c_register_board_info(msm8x60_camera_i2c_devices.bus, |
| 7399 | msm8x60_camera_i2c_devices.info, |
| 7400 | msm8x60_camera_i2c_devices.len); |
| 7401 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7402 | #endif |
| 7403 | } |
| 7404 | |
| 7405 | static void __init msm8x60_init_uart12dm(void) |
| 7406 | { |
| 7407 | #if !defined(CONFIG_USB_PEHCI_HCD) && !defined(CONFIG_USB_PEHCI_HCD_MODULE) |
| 7408 | /* 0x1D000000 now belongs to EBI2:CS3 i.e. USB ISP Controller */ |
| 7409 | void *fpga_mem = ioremap_nocache(0x1D000000, SZ_4K); |
| 7410 | |
| 7411 | if (!fpga_mem) |
| 7412 | pr_err("%s(): Error getting memory\n", __func__); |
| 7413 | |
| 7414 | /* Advanced mode */ |
| 7415 | writew(0xFFFF, fpga_mem + 0x15C); |
| 7416 | /* FPGA_UART_SEL */ |
| 7417 | writew(0, fpga_mem + 0x172); |
| 7418 | /* FPGA_GPIO_CONFIG_117 */ |
| 7419 | writew(1, fpga_mem + 0xEA); |
| 7420 | /* FPGA_GPIO_CONFIG_118 */ |
| 7421 | writew(1, fpga_mem + 0xEC); |
| 7422 | mb(); |
| 7423 | iounmap(fpga_mem); |
| 7424 | #endif |
| 7425 | } |
| 7426 | |
| 7427 | #define MSM_GSBI9_PHYS 0x19900000 |
| 7428 | #define GSBI_DUAL_MODE_CODE 0x60 |
| 7429 | |
| 7430 | static void __init msm8x60_init_buses(void) |
| 7431 | { |
| 7432 | #ifdef CONFIG_I2C_QUP |
| 7433 | void *gsbi_mem = ioremap_nocache(0x19C00000, 4); |
| 7434 | /* Setting protocol code to 0x60 for dual UART/I2C in GSBI12 */ |
| 7435 | writel_relaxed(0x6 << 4, gsbi_mem); |
| 7436 | /* Ensure protocol code is written before proceeding further */ |
| 7437 | mb(); |
| 7438 | iounmap(gsbi_mem); |
| 7439 | |
| 7440 | msm_gsbi3_qup_i2c_device.dev.platform_data = &msm_gsbi3_qup_i2c_pdata; |
| 7441 | msm_gsbi4_qup_i2c_device.dev.platform_data = &msm_gsbi4_qup_i2c_pdata; |
| 7442 | msm_gsbi7_qup_i2c_device.dev.platform_data = &msm_gsbi7_qup_i2c_pdata; |
| 7443 | msm_gsbi8_qup_i2c_device.dev.platform_data = &msm_gsbi8_qup_i2c_pdata; |
| 7444 | |
| 7445 | #ifdef CONFIG_MSM_GSBI9_UART |
| 7446 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) { |
| 7447 | /* Setting protocol code to 0x60 for dual UART/I2C in GSBI9 */ |
| 7448 | gsbi_mem = ioremap_nocache(MSM_GSBI9_PHYS, 4); |
| 7449 | writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem); |
| 7450 | iounmap(gsbi_mem); |
| 7451 | msm_gsbi9_qup_i2c_pdata.use_gsbi_shared_mode = 1; |
| 7452 | } |
| 7453 | #endif |
| 7454 | msm_gsbi9_qup_i2c_device.dev.platform_data = &msm_gsbi9_qup_i2c_pdata; |
| 7455 | msm_gsbi12_qup_i2c_device.dev.platform_data = &msm_gsbi12_qup_i2c_pdata; |
| 7456 | #endif |
| 7457 | #if defined(CONFIG_SPI_QUP) || defined(CONFIG_SPI_QUP_MODULE) |
| 7458 | msm_gsbi1_qup_spi_device.dev.platform_data = &msm_gsbi1_qup_spi_pdata; |
| 7459 | #endif |
| 7460 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7461 | msm_device_ssbi3.dev.platform_data = &msm_ssbi3_pdata; |
| 7462 | #endif |
| 7463 | |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 7464 | #ifdef CONFIG_MSM_SSBI |
| 7465 | msm_device_ssbi_pmic1.dev.platform_data = |
| 7466 | &msm8x60_ssbi_pm8058_pdata; |
Anirudh Ghayal | c49157f | 2011-11-09 14:49:59 +0530 | [diff] [blame] | 7467 | msm_device_ssbi_pmic2.dev.platform_data = |
| 7468 | &msm8x60_ssbi_pm8901_pdata; |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 7469 | #endif |
| 7470 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7471 | if (machine_is_msm8x60_fluid()) { |
| 7472 | #if (defined(CONFIG_USB_EHCI_MSM_72K) && \ |
| 7473 | (defined(CONFIG_SMB137B_CHARGER) || \ |
| 7474 | defined(CONFIG_SMB137B_CHARGER_MODULE))) |
| 7475 | msm_otg_pdata.vbus_power = msm_hsusb_smb137b_vbus_power; |
| 7476 | #endif |
| 7477 | #if defined(CONFIG_SPI_QUP) || defined(CONFIG_SPI_QUP_MODULE) |
| 7478 | msm_gsbi10_qup_spi_device.dev.platform_data = |
| 7479 | &msm_gsbi10_qup_spi_pdata; |
| 7480 | #endif |
| 7481 | } |
| 7482 | |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 7483 | #if defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_EHCI_HCD) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7484 | /* |
| 7485 | * We can not put USB regulators (8058_l6 and 8058_l7) in LPM |
| 7486 | * when we depend on USB PHY for VBUS/ID notifications. VBUS |
| 7487 | * and ID notifications are available only on V2 surf and FFA |
| 7488 | * with a hardware workaround. |
| 7489 | */ |
| 7490 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2 && |
| 7491 | (machine_is_msm8x60_surf() || |
| 7492 | (machine_is_msm8x60_ffa() && |
| 7493 | pmic_id_notif_supported))) |
| 7494 | msm_otg_pdata.phy_can_powercollapse = 1; |
| 7495 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 7496 | #endif |
| 7497 | |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 7498 | #ifdef CONFIG_USB_MSM_72K |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7499 | msm_device_gadget_peripheral.dev.platform_data = &msm_gadget_pdata; |
| 7500 | #endif |
| 7501 | |
| 7502 | #ifdef CONFIG_SERIAL_MSM_HS |
| 7503 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(54); /* GSBI6(2) */ |
| 7504 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 7505 | #endif |
| 7506 | #ifdef CONFIG_MSM_GSBI9_UART |
| 7507 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) { |
| 7508 | msm_device_uart_gsbi9 = msm_add_gsbi9_uart(); |
| 7509 | if (IS_ERR(msm_device_uart_gsbi9)) |
| 7510 | pr_err("%s(): Failed to create uart gsbi9 device\n", |
| 7511 | __func__); |
| 7512 | } |
| 7513 | #endif |
| 7514 | |
| 7515 | #ifdef CONFIG_MSM_BUS_SCALING |
| 7516 | |
| 7517 | /* RPM calls are only enabled on V2 */ |
| 7518 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) { |
| 7519 | msm_bus_apps_fabric_pdata.rpm_enabled = 1; |
| 7520 | msm_bus_sys_fabric_pdata.rpm_enabled = 1; |
| 7521 | msm_bus_mm_fabric_pdata.rpm_enabled = 1; |
| 7522 | msm_bus_sys_fpb_pdata.rpm_enabled = 1; |
| 7523 | msm_bus_cpss_fpb_pdata.rpm_enabled = 1; |
| 7524 | } |
| 7525 | |
| 7526 | msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata; |
| 7527 | msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata; |
| 7528 | msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata; |
| 7529 | msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata; |
| 7530 | msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata; |
| 7531 | #endif |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 7532 | } |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7533 | |
| 7534 | static void __init msm8x60_map_io(void) |
| 7535 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7536 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7537 | msm_map_msm8x60_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 7538 | |
| 7539 | if (socinfo_init() < 0) |
| 7540 | pr_err("socinfo_init() failed!\n"); |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7541 | } |
| 7542 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7543 | /* |
| 7544 | * Most segments of the EBI2 bus are disabled by default. |
| 7545 | */ |
| 7546 | static void __init msm8x60_init_ebi2(void) |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7547 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7548 | uint32_t ebi2_cfg; |
| 7549 | void *ebi2_cfg_ptr; |
Terence Hampson | b36a38c | 2011-09-19 19:10:40 -0400 | [diff] [blame] | 7550 | struct clk *mem_clk = clk_get_sys("msm_ebi2", "mem_clk"); |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7551 | |
Terence Hampson | b36a38c | 2011-09-19 19:10:40 -0400 | [diff] [blame] | 7552 | if (IS_ERR(mem_clk)) { |
| 7553 | pr_err("%s: clk_get_sys(%s,%s), failed", __func__, |
| 7554 | "msm_ebi2", "mem_clk"); |
| 7555 | return; |
| 7556 | } |
Stephen Boyd | 818a3f6 | 2012-05-08 12:12:18 -0700 | [diff] [blame] | 7557 | clk_prepare_enable(mem_clk); |
Terence Hampson | b36a38c | 2011-09-19 19:10:40 -0400 | [diff] [blame] | 7558 | clk_put(mem_clk); |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7559 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7560 | ebi2_cfg_ptr = ioremap_nocache(0x1a100000, sizeof(uint32_t)); |
| 7561 | if (ebi2_cfg_ptr != 0) { |
| 7562 | ebi2_cfg = readl_relaxed(ebi2_cfg_ptr); |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7563 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7564 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7565 | machine_is_msm8x60_fluid() || |
| 7566 | machine_is_msm8x60_dragon()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7567 | ebi2_cfg |= (1 << 4) | (1 << 5); /* CS2, CS3 */ |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 7568 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7569 | writel_relaxed(ebi2_cfg, ebi2_cfg_ptr); |
| 7570 | iounmap(ebi2_cfg_ptr); |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 7571 | } |
| 7572 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7573 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 7574 | machine_is_msm8x60_fluid() || machine_is_msm8x60_dragon()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7575 | ebi2_cfg_ptr = ioremap_nocache(0x1a110000, SZ_4K); |
| 7576 | if (ebi2_cfg_ptr != 0) { |
| 7577 | /* EBI2_XMEM_CFG:PWRSAVE_MODE off */ |
| 7578 | writel_relaxed(0UL, ebi2_cfg_ptr); |
| 7579 | |
| 7580 | /* CS2: Delay 9 cycles (140ns@64MHz) between SMSC |
| 7581 | * LAN9221 Ethernet controller reads and writes. |
| 7582 | * The lowest 4 bits are the read delay, the next |
| 7583 | * 4 are the write delay. */ |
| 7584 | writel_relaxed(0x031F1C99, ebi2_cfg_ptr + 0x10); |
| 7585 | #if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE) |
| 7586 | /* |
| 7587 | * RECOVERY=5, HOLD_WR=1 |
| 7588 | * INIT_LATENCY_WR=1, INIT_LATENCY_RD=1 |
| 7589 | * WAIT_WR=1, WAIT_RD=2 |
| 7590 | */ |
| 7591 | writel_relaxed(0x51010112, ebi2_cfg_ptr + 0x14); |
| 7592 | /* |
| 7593 | * HOLD_RD=1 |
| 7594 | * ADV_OE_RECOVERY=0, ADDR_HOLD_ENA=1 |
| 7595 | */ |
| 7596 | writel_relaxed(0x01000020, ebi2_cfg_ptr + 0x34); |
| 7597 | #else |
| 7598 | /* EBI2 CS3 muxed address/data, |
| 7599 | * two cyc addr enable */ |
| 7600 | writel_relaxed(0xA3030020, ebi2_cfg_ptr + 0x34); |
| 7601 | |
| 7602 | #endif |
| 7603 | iounmap(ebi2_cfg_ptr); |
| 7604 | } |
| 7605 | } |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 7606 | } |
| 7607 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7608 | #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ |
| 7609 | || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\ |
| 7610 | || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\ |
| 7611 | || defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\ |
| 7612 | || defined(CONFIG_MMC_MSM_SDC5_SUPPORT)) |
| 7613 | |
Stepan Moskovchenko | 73b943b | 2011-10-31 22:43:00 -0700 | [diff] [blame] | 7614 | /* 8x60 has 5 SDCC controllers */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7615 | #define MAX_SDCC_CONTROLLER 5 |
| 7616 | |
| 7617 | struct msm_sdcc_gpio { |
| 7618 | /* maximum 10 GPIOs per SDCC controller */ |
| 7619 | s16 no; |
| 7620 | /* name of this GPIO */ |
| 7621 | const char *name; |
| 7622 | bool always_on; |
| 7623 | bool is_enabled; |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 7624 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7625 | |
| 7626 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 7627 | static struct msm_sdcc_gpio sdc1_gpio_cfg[] = { |
| 7628 | {159, "sdc1_dat_0"}, |
| 7629 | {160, "sdc1_dat_1"}, |
| 7630 | {161, "sdc1_dat_2"}, |
| 7631 | {162, "sdc1_dat_3"}, |
| 7632 | #ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT |
| 7633 | {163, "sdc1_dat_4"}, |
| 7634 | {164, "sdc1_dat_5"}, |
| 7635 | {165, "sdc1_dat_6"}, |
| 7636 | {166, "sdc1_dat_7"}, |
| 7637 | #endif |
| 7638 | {167, "sdc1_clk"}, |
| 7639 | {168, "sdc1_cmd"} |
| 7640 | }; |
| 7641 | #endif |
| 7642 | |
| 7643 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 7644 | static struct msm_sdcc_gpio sdc2_gpio_cfg[] = { |
| 7645 | {143, "sdc2_dat_0"}, |
| 7646 | {144, "sdc2_dat_1", 1}, |
| 7647 | {145, "sdc2_dat_2"}, |
| 7648 | {146, "sdc2_dat_3"}, |
| 7649 | #ifdef CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT |
| 7650 | {147, "sdc2_dat_4"}, |
| 7651 | {148, "sdc2_dat_5"}, |
| 7652 | {149, "sdc2_dat_6"}, |
| 7653 | {150, "sdc2_dat_7"}, |
| 7654 | #endif |
| 7655 | {151, "sdc2_cmd"}, |
| 7656 | {152, "sdc2_clk", 1} |
| 7657 | }; |
| 7658 | #endif |
| 7659 | |
| 7660 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 7661 | static struct msm_sdcc_gpio sdc5_gpio_cfg[] = { |
| 7662 | {95, "sdc5_cmd"}, |
| 7663 | {96, "sdc5_dat_3"}, |
| 7664 | {97, "sdc5_clk", 1}, |
| 7665 | {98, "sdc5_dat_2"}, |
| 7666 | {99, "sdc5_dat_1", 1}, |
| 7667 | {100, "sdc5_dat_0"} |
| 7668 | }; |
| 7669 | #endif |
| 7670 | |
| 7671 | struct msm_sdcc_pad_pull_cfg { |
| 7672 | enum msm_tlmm_pull_tgt pull; |
| 7673 | u32 pull_val; |
| 7674 | }; |
| 7675 | |
| 7676 | struct msm_sdcc_pad_drv_cfg { |
| 7677 | enum msm_tlmm_hdrive_tgt drv; |
| 7678 | u32 drv_val; |
| 7679 | }; |
| 7680 | |
| 7681 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 7682 | static struct msm_sdcc_pad_drv_cfg sdc3_pad_on_drv_cfg[] = { |
| 7683 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA}, |
| 7684 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA}, |
| 7685 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA} |
| 7686 | }; |
| 7687 | |
| 7688 | static struct msm_sdcc_pad_pull_cfg sdc3_pad_on_pull_cfg[] = { |
| 7689 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP}, |
| 7690 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP} |
| 7691 | }; |
| 7692 | |
| 7693 | static struct msm_sdcc_pad_drv_cfg sdc3_pad_off_drv_cfg[] = { |
| 7694 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA}, |
| 7695 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA}, |
| 7696 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA} |
| 7697 | }; |
| 7698 | |
| 7699 | static struct msm_sdcc_pad_pull_cfg sdc3_pad_off_pull_cfg[] = { |
| 7700 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN}, |
| 7701 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN} |
| 7702 | }; |
| 7703 | #endif |
| 7704 | |
| 7705 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 7706 | static struct msm_sdcc_pad_drv_cfg sdc4_pad_on_drv_cfg[] = { |
| 7707 | {TLMM_HDRV_SDC4_CLK, GPIO_CFG_8MA}, |
| 7708 | {TLMM_HDRV_SDC4_CMD, GPIO_CFG_8MA}, |
| 7709 | {TLMM_HDRV_SDC4_DATA, GPIO_CFG_8MA} |
| 7710 | }; |
| 7711 | |
| 7712 | static struct msm_sdcc_pad_pull_cfg sdc4_pad_on_pull_cfg[] = { |
| 7713 | {TLMM_PULL_SDC4_CMD, GPIO_CFG_PULL_UP}, |
| 7714 | {TLMM_PULL_SDC4_DATA, GPIO_CFG_PULL_UP} |
| 7715 | }; |
| 7716 | |
| 7717 | static struct msm_sdcc_pad_drv_cfg sdc4_pad_off_drv_cfg[] = { |
| 7718 | {TLMM_HDRV_SDC4_CLK, GPIO_CFG_2MA}, |
| 7719 | {TLMM_HDRV_SDC4_CMD, GPIO_CFG_2MA}, |
| 7720 | {TLMM_HDRV_SDC4_DATA, GPIO_CFG_2MA} |
| 7721 | }; |
| 7722 | |
| 7723 | static struct msm_sdcc_pad_pull_cfg sdc4_pad_off_pull_cfg[] = { |
| 7724 | {TLMM_PULL_SDC4_CMD, GPIO_CFG_PULL_DOWN}, |
| 7725 | {TLMM_PULL_SDC4_DATA, GPIO_CFG_PULL_DOWN} |
| 7726 | }; |
| 7727 | #endif |
| 7728 | |
| 7729 | struct msm_sdcc_pin_cfg { |
| 7730 | /* |
| 7731 | * = 1 if controller pins are using gpios |
| 7732 | * = 0 if controller has dedicated MSM pins |
| 7733 | */ |
| 7734 | u8 is_gpio; |
| 7735 | u8 cfg_sts; |
| 7736 | u8 gpio_data_size; |
| 7737 | struct msm_sdcc_gpio *gpio_data; |
| 7738 | struct msm_sdcc_pad_drv_cfg *pad_drv_on_data; |
| 7739 | struct msm_sdcc_pad_drv_cfg *pad_drv_off_data; |
| 7740 | struct msm_sdcc_pad_pull_cfg *pad_pull_on_data; |
| 7741 | struct msm_sdcc_pad_pull_cfg *pad_pull_off_data; |
| 7742 | u8 pad_drv_data_size; |
| 7743 | u8 pad_pull_data_size; |
| 7744 | u8 sdio_lpm_gpio_cfg; |
| 7745 | }; |
| 7746 | |
| 7747 | |
| 7748 | static struct msm_sdcc_pin_cfg sdcc_pin_cfg_data[MAX_SDCC_CONTROLLER] = { |
| 7749 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 7750 | [0] = { |
| 7751 | .is_gpio = 1, |
| 7752 | .gpio_data_size = ARRAY_SIZE(sdc1_gpio_cfg), |
| 7753 | .gpio_data = sdc1_gpio_cfg |
| 7754 | }, |
| 7755 | #endif |
| 7756 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 7757 | [1] = { |
| 7758 | .is_gpio = 1, |
| 7759 | .gpio_data_size = ARRAY_SIZE(sdc2_gpio_cfg), |
| 7760 | .gpio_data = sdc2_gpio_cfg |
| 7761 | }, |
| 7762 | #endif |
| 7763 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 7764 | [2] = { |
| 7765 | .is_gpio = 0, |
| 7766 | .pad_drv_on_data = sdc3_pad_on_drv_cfg, |
| 7767 | .pad_drv_off_data = sdc3_pad_off_drv_cfg, |
| 7768 | .pad_pull_on_data = sdc3_pad_on_pull_cfg, |
| 7769 | .pad_pull_off_data = sdc3_pad_off_pull_cfg, |
| 7770 | .pad_drv_data_size = ARRAY_SIZE(sdc3_pad_on_drv_cfg), |
| 7771 | .pad_pull_data_size = ARRAY_SIZE(sdc3_pad_on_pull_cfg) |
| 7772 | }, |
| 7773 | #endif |
| 7774 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 7775 | [3] = { |
| 7776 | .is_gpio = 0, |
| 7777 | .pad_drv_on_data = sdc4_pad_on_drv_cfg, |
| 7778 | .pad_drv_off_data = sdc4_pad_off_drv_cfg, |
| 7779 | .pad_pull_on_data = sdc4_pad_on_pull_cfg, |
| 7780 | .pad_pull_off_data = sdc4_pad_off_pull_cfg, |
| 7781 | .pad_drv_data_size = ARRAY_SIZE(sdc4_pad_on_drv_cfg), |
| 7782 | .pad_pull_data_size = ARRAY_SIZE(sdc4_pad_on_pull_cfg) |
| 7783 | }, |
| 7784 | #endif |
| 7785 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 7786 | [4] = { |
| 7787 | .is_gpio = 1, |
| 7788 | .gpio_data_size = ARRAY_SIZE(sdc5_gpio_cfg), |
| 7789 | .gpio_data = sdc5_gpio_cfg |
| 7790 | } |
| 7791 | #endif |
| 7792 | }; |
| 7793 | |
| 7794 | static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable) |
| 7795 | { |
| 7796 | int rc = 0; |
| 7797 | struct msm_sdcc_pin_cfg *curr; |
| 7798 | int n; |
| 7799 | |
| 7800 | curr = &sdcc_pin_cfg_data[dev_id - 1]; |
| 7801 | if (!curr->gpio_data) |
| 7802 | goto out; |
| 7803 | |
| 7804 | for (n = 0; n < curr->gpio_data_size; n++) { |
| 7805 | if (enable) { |
| 7806 | |
| 7807 | if (curr->gpio_data[n].always_on && |
| 7808 | curr->gpio_data[n].is_enabled) |
| 7809 | continue; |
| 7810 | pr_debug("%s: enable: %s\n", __func__, |
| 7811 | curr->gpio_data[n].name); |
| 7812 | rc = gpio_request(curr->gpio_data[n].no, |
| 7813 | curr->gpio_data[n].name); |
| 7814 | if (rc) { |
| 7815 | pr_err("%s: gpio_request(%d, %s)" |
| 7816 | "failed", __func__, |
| 7817 | curr->gpio_data[n].no, |
| 7818 | curr->gpio_data[n].name); |
| 7819 | goto free_gpios; |
| 7820 | } |
| 7821 | /* set direction as output for all GPIOs */ |
| 7822 | rc = gpio_direction_output( |
| 7823 | curr->gpio_data[n].no, 1); |
| 7824 | if (rc) { |
| 7825 | pr_err("%s: gpio_direction_output" |
| 7826 | "(%d, 1) failed\n", __func__, |
| 7827 | curr->gpio_data[n].no); |
| 7828 | goto free_gpios; |
| 7829 | } |
| 7830 | curr->gpio_data[n].is_enabled = 1; |
| 7831 | } else { |
| 7832 | /* |
| 7833 | * now free this GPIO which will put GPIO |
| 7834 | * in low power mode and will also put GPIO |
| 7835 | * in input mode |
| 7836 | */ |
| 7837 | if (curr->gpio_data[n].always_on) |
| 7838 | continue; |
| 7839 | pr_debug("%s: disable: %s\n", __func__, |
| 7840 | curr->gpio_data[n].name); |
| 7841 | gpio_free(curr->gpio_data[n].no); |
| 7842 | curr->gpio_data[n].is_enabled = 0; |
| 7843 | } |
| 7844 | } |
| 7845 | curr->cfg_sts = enable; |
| 7846 | goto out; |
| 7847 | |
| 7848 | free_gpios: |
| 7849 | for (; n >= 0; n--) |
| 7850 | gpio_free(curr->gpio_data[n].no); |
| 7851 | out: |
| 7852 | return rc; |
| 7853 | } |
| 7854 | |
| 7855 | static int msm_sdcc_setup_pad(int dev_id, unsigned int enable) |
| 7856 | { |
| 7857 | int rc = 0; |
| 7858 | struct msm_sdcc_pin_cfg *curr; |
| 7859 | int n; |
| 7860 | |
| 7861 | curr = &sdcc_pin_cfg_data[dev_id - 1]; |
| 7862 | if (!curr->pad_drv_on_data || !curr->pad_pull_on_data) |
| 7863 | goto out; |
| 7864 | |
| 7865 | if (enable) { |
| 7866 | /* |
| 7867 | * set up the normal driver strength and |
| 7868 | * pull config for pads |
| 7869 | */ |
| 7870 | for (n = 0; n < curr->pad_drv_data_size; n++) { |
| 7871 | if (curr->sdio_lpm_gpio_cfg) { |
| 7872 | if (curr->pad_drv_on_data[n].drv == |
| 7873 | TLMM_HDRV_SDC4_DATA) |
| 7874 | continue; |
| 7875 | } |
| 7876 | msm_tlmm_set_hdrive(curr->pad_drv_on_data[n].drv, |
| 7877 | curr->pad_drv_on_data[n].drv_val); |
| 7878 | } |
| 7879 | for (n = 0; n < curr->pad_pull_data_size; n++) { |
| 7880 | if (curr->sdio_lpm_gpio_cfg) { |
| 7881 | if (curr->pad_pull_on_data[n].pull == |
| 7882 | TLMM_PULL_SDC4_DATA) |
| 7883 | continue; |
| 7884 | } |
| 7885 | msm_tlmm_set_pull(curr->pad_pull_on_data[n].pull, |
| 7886 | curr->pad_pull_on_data[n].pull_val); |
| 7887 | } |
| 7888 | } else { |
| 7889 | /* set the low power config for pads */ |
| 7890 | for (n = 0; n < curr->pad_drv_data_size; n++) { |
| 7891 | if (curr->sdio_lpm_gpio_cfg) { |
| 7892 | if (curr->pad_drv_off_data[n].drv == |
| 7893 | TLMM_HDRV_SDC4_DATA) |
| 7894 | continue; |
| 7895 | } |
| 7896 | msm_tlmm_set_hdrive( |
| 7897 | curr->pad_drv_off_data[n].drv, |
| 7898 | curr->pad_drv_off_data[n].drv_val); |
| 7899 | } |
| 7900 | for (n = 0; n < curr->pad_pull_data_size; n++) { |
| 7901 | if (curr->sdio_lpm_gpio_cfg) { |
| 7902 | if (curr->pad_pull_off_data[n].pull == |
| 7903 | TLMM_PULL_SDC4_DATA) |
| 7904 | continue; |
| 7905 | } |
| 7906 | msm_tlmm_set_pull( |
| 7907 | curr->pad_pull_off_data[n].pull, |
| 7908 | curr->pad_pull_off_data[n].pull_val); |
| 7909 | } |
| 7910 | } |
| 7911 | curr->cfg_sts = enable; |
| 7912 | out: |
| 7913 | return rc; |
| 7914 | } |
| 7915 | |
| 7916 | struct sdcc_reg { |
| 7917 | /* VDD/VCC/VCCQ regulator name on PMIC8058/PMIC8089*/ |
| 7918 | const char *reg_name; |
| 7919 | /* |
| 7920 | * is set voltage supported for this regulator? |
| 7921 | * 0 = not supported, 1 = supported |
| 7922 | */ |
| 7923 | unsigned char set_voltage_sup; |
| 7924 | /* voltage level to be set */ |
| 7925 | unsigned int level; |
| 7926 | /* VDD/VCC/VCCQ voltage regulator handle */ |
| 7927 | struct regulator *reg; |
| 7928 | /* is this regulator enabled? */ |
| 7929 | bool enabled; |
| 7930 | /* is this regulator needs to be always on? */ |
| 7931 | bool always_on; |
| 7932 | /* is operating power mode setting required for this regulator? */ |
| 7933 | bool op_pwr_mode_sup; |
| 7934 | /* Load values for low power and high power mode */ |
| 7935 | unsigned int lpm_uA; |
| 7936 | unsigned int hpm_uA; |
| 7937 | }; |
Stepan Moskovchenko | 73b943b | 2011-10-31 22:43:00 -0700 | [diff] [blame] | 7938 | /* all SDCC controllers require VDD/VCC voltage */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7939 | static struct sdcc_reg sdcc_vdd_reg_data[MAX_SDCC_CONTROLLER]; |
| 7940 | /* only SDCC1 requires VCCQ voltage */ |
| 7941 | static struct sdcc_reg sdcc_vccq_reg_data[1]; |
| 7942 | /* all SDCC controllers may require voting for VDD PAD voltage */ |
| 7943 | static struct sdcc_reg sdcc_vddp_reg_data[MAX_SDCC_CONTROLLER]; |
| 7944 | |
| 7945 | struct sdcc_reg_data { |
| 7946 | struct sdcc_reg *vdd_data; /* keeps VDD/VCC regulator info */ |
| 7947 | struct sdcc_reg *vccq_data; /* keeps VCCQ regulator info */ |
| 7948 | struct sdcc_reg *vddp_data; /* keeps VDD Pad regulator info */ |
| 7949 | unsigned char sts; /* regulator enable/disable status */ |
| 7950 | }; |
Stepan Moskovchenko | 73b943b | 2011-10-31 22:43:00 -0700 | [diff] [blame] | 7951 | /* msm8x60 has 5 SDCC controllers */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 7952 | static struct sdcc_reg_data sdcc_vreg_data[MAX_SDCC_CONTROLLER]; |
| 7953 | |
| 7954 | static int msm_sdcc_vreg_init_reg(struct sdcc_reg *vreg) |
| 7955 | { |
| 7956 | int rc = 0; |
| 7957 | |
| 7958 | /* Get the regulator handle */ |
| 7959 | vreg->reg = regulator_get(NULL, vreg->reg_name); |
| 7960 | if (IS_ERR(vreg->reg)) { |
| 7961 | rc = PTR_ERR(vreg->reg); |
| 7962 | pr_err("%s: regulator_get(%s) failed. rc=%d\n", |
| 7963 | __func__, vreg->reg_name, rc); |
| 7964 | goto out; |
| 7965 | } |
| 7966 | |
| 7967 | /* Set the voltage level if required */ |
| 7968 | if (vreg->set_voltage_sup) { |
| 7969 | rc = regulator_set_voltage(vreg->reg, vreg->level, |
| 7970 | vreg->level); |
| 7971 | if (rc) { |
| 7972 | pr_err("%s: regulator_set_voltage(%s) failed rc=%d\n", |
| 7973 | __func__, vreg->reg_name, rc); |
| 7974 | goto vreg_put; |
| 7975 | } |
| 7976 | } |
| 7977 | goto out; |
| 7978 | |
| 7979 | vreg_put: |
| 7980 | regulator_put(vreg->reg); |
| 7981 | out: |
| 7982 | return rc; |
| 7983 | } |
| 7984 | |
| 7985 | static inline void msm_sdcc_vreg_deinit_reg(struct sdcc_reg *vreg) |
| 7986 | { |
| 7987 | regulator_put(vreg->reg); |
| 7988 | } |
| 7989 | |
| 7990 | /* this init function should be called only once for each SDCC */ |
| 7991 | static int msm_sdcc_vreg_init(int dev_id, unsigned char init) |
| 7992 | { |
| 7993 | int rc = 0; |
| 7994 | struct sdcc_reg *curr_vdd_reg, *curr_vccq_reg, *curr_vddp_reg; |
| 7995 | struct sdcc_reg_data *curr; |
| 7996 | |
| 7997 | curr = &sdcc_vreg_data[dev_id - 1]; |
| 7998 | curr_vdd_reg = curr->vdd_data; |
| 7999 | curr_vccq_reg = curr->vccq_data; |
| 8000 | curr_vddp_reg = curr->vddp_data; |
| 8001 | |
| 8002 | if (init) { |
| 8003 | /* |
| 8004 | * get the regulator handle from voltage regulator framework |
| 8005 | * and then try to set the voltage level for the regulator |
| 8006 | */ |
| 8007 | if (curr_vdd_reg) { |
| 8008 | rc = msm_sdcc_vreg_init_reg(curr_vdd_reg); |
| 8009 | if (rc) |
| 8010 | goto out; |
| 8011 | } |
| 8012 | if (curr_vccq_reg) { |
| 8013 | rc = msm_sdcc_vreg_init_reg(curr_vccq_reg); |
| 8014 | if (rc) |
| 8015 | goto vdd_reg_deinit; |
| 8016 | } |
| 8017 | if (curr_vddp_reg) { |
| 8018 | rc = msm_sdcc_vreg_init_reg(curr_vddp_reg); |
| 8019 | if (rc) |
| 8020 | goto vccq_reg_deinit; |
| 8021 | } |
| 8022 | goto out; |
| 8023 | } else |
| 8024 | /* deregister with all regulators from regulator framework */ |
| 8025 | goto vddp_reg_deinit; |
| 8026 | |
| 8027 | vddp_reg_deinit: |
| 8028 | if (curr_vddp_reg) |
| 8029 | msm_sdcc_vreg_deinit_reg(curr_vddp_reg); |
| 8030 | vccq_reg_deinit: |
| 8031 | if (curr_vccq_reg) |
| 8032 | msm_sdcc_vreg_deinit_reg(curr_vccq_reg); |
| 8033 | vdd_reg_deinit: |
| 8034 | if (curr_vdd_reg) |
| 8035 | msm_sdcc_vreg_deinit_reg(curr_vdd_reg); |
| 8036 | out: |
| 8037 | return rc; |
| 8038 | } |
| 8039 | |
| 8040 | static int msm_sdcc_vreg_enable(struct sdcc_reg *vreg) |
| 8041 | { |
| 8042 | int rc; |
| 8043 | |
| 8044 | if (!vreg->enabled) { |
| 8045 | rc = regulator_enable(vreg->reg); |
| 8046 | if (rc) { |
| 8047 | pr_err("%s: regulator_enable(%s) failed. rc=%d\n", |
| 8048 | __func__, vreg->reg_name, rc); |
| 8049 | goto out; |
| 8050 | } |
| 8051 | vreg->enabled = 1; |
| 8052 | } |
| 8053 | |
| 8054 | /* Put always_on regulator in HPM (high power mode) */ |
| 8055 | if (vreg->always_on && vreg->op_pwr_mode_sup) { |
| 8056 | rc = regulator_set_optimum_mode(vreg->reg, vreg->hpm_uA); |
| 8057 | if (rc < 0) { |
| 8058 | pr_err("%s: reg=%s: HPM setting failed" |
| 8059 | " hpm_uA=%d, rc=%d\n", |
| 8060 | __func__, vreg->reg_name, |
| 8061 | vreg->hpm_uA, rc); |
| 8062 | goto vreg_disable; |
| 8063 | } |
| 8064 | rc = 0; |
| 8065 | } |
| 8066 | goto out; |
| 8067 | |
| 8068 | vreg_disable: |
| 8069 | regulator_disable(vreg->reg); |
| 8070 | vreg->enabled = 0; |
| 8071 | out: |
| 8072 | return rc; |
| 8073 | } |
| 8074 | |
| 8075 | static int msm_sdcc_vreg_disable(struct sdcc_reg *vreg) |
| 8076 | { |
| 8077 | int rc; |
| 8078 | |
| 8079 | /* Never disable always_on regulator */ |
| 8080 | if (!vreg->always_on) { |
| 8081 | rc = regulator_disable(vreg->reg); |
| 8082 | if (rc) { |
| 8083 | pr_err("%s: regulator_disable(%s) failed. rc=%d\n", |
| 8084 | __func__, vreg->reg_name, rc); |
| 8085 | goto out; |
| 8086 | } |
| 8087 | vreg->enabled = 0; |
| 8088 | } |
| 8089 | |
| 8090 | /* Put always_on regulator in LPM (low power mode) */ |
| 8091 | if (vreg->always_on && vreg->op_pwr_mode_sup) { |
| 8092 | rc = regulator_set_optimum_mode(vreg->reg, vreg->lpm_uA); |
| 8093 | if (rc < 0) { |
| 8094 | pr_err("%s: reg=%s: LPM setting failed" |
| 8095 | " lpm_uA=%d, rc=%d\n", |
| 8096 | __func__, |
| 8097 | vreg->reg_name, |
| 8098 | vreg->lpm_uA, rc); |
| 8099 | goto out; |
| 8100 | } |
| 8101 | rc = 0; |
| 8102 | } |
| 8103 | |
| 8104 | out: |
| 8105 | return rc; |
| 8106 | } |
| 8107 | |
| 8108 | static int msm_sdcc_setup_vreg(int dev_id, unsigned char enable) |
| 8109 | { |
| 8110 | int rc = 0; |
| 8111 | struct sdcc_reg *curr_vdd_reg, *curr_vccq_reg, *curr_vddp_reg; |
| 8112 | struct sdcc_reg_data *curr; |
| 8113 | |
| 8114 | curr = &sdcc_vreg_data[dev_id - 1]; |
| 8115 | curr_vdd_reg = curr->vdd_data; |
| 8116 | curr_vccq_reg = curr->vccq_data; |
| 8117 | curr_vddp_reg = curr->vddp_data; |
| 8118 | |
| 8119 | /* check if regulators are initialized or not? */ |
| 8120 | if ((curr_vdd_reg && !curr_vdd_reg->reg) || |
| 8121 | (curr_vccq_reg && !curr_vccq_reg->reg) || |
| 8122 | (curr_vddp_reg && !curr_vddp_reg->reg)) { |
| 8123 | /* initialize voltage regulators required for this SDCC */ |
| 8124 | rc = msm_sdcc_vreg_init(dev_id, 1); |
| 8125 | if (rc) { |
| 8126 | pr_err("%s: regulator init failed = %d\n", |
| 8127 | __func__, rc); |
| 8128 | goto out; |
| 8129 | } |
| 8130 | } |
| 8131 | |
| 8132 | if (curr->sts == enable) |
| 8133 | goto out; |
| 8134 | |
| 8135 | if (curr_vdd_reg) { |
| 8136 | if (enable) |
| 8137 | rc = msm_sdcc_vreg_enable(curr_vdd_reg); |
| 8138 | else |
| 8139 | rc = msm_sdcc_vreg_disable(curr_vdd_reg); |
| 8140 | if (rc) |
| 8141 | goto out; |
| 8142 | } |
| 8143 | |
| 8144 | if (curr_vccq_reg) { |
| 8145 | if (enable) |
| 8146 | rc = msm_sdcc_vreg_enable(curr_vccq_reg); |
| 8147 | else |
| 8148 | rc = msm_sdcc_vreg_disable(curr_vccq_reg); |
| 8149 | if (rc) |
| 8150 | goto out; |
| 8151 | } |
| 8152 | |
| 8153 | if (curr_vddp_reg) { |
| 8154 | if (enable) |
| 8155 | rc = msm_sdcc_vreg_enable(curr_vddp_reg); |
| 8156 | else |
| 8157 | rc = msm_sdcc_vreg_disable(curr_vddp_reg); |
| 8158 | if (rc) |
| 8159 | goto out; |
| 8160 | } |
| 8161 | curr->sts = enable; |
| 8162 | |
| 8163 | out: |
| 8164 | return rc; |
| 8165 | } |
| 8166 | |
| 8167 | static u32 msm_sdcc_setup_power(struct device *dv, unsigned int vdd) |
| 8168 | { |
| 8169 | u32 rc_pin_cfg = 0; |
| 8170 | u32 rc_vreg_cfg = 0; |
| 8171 | u32 rc = 0; |
| 8172 | struct platform_device *pdev; |
| 8173 | struct msm_sdcc_pin_cfg *curr_pin_cfg; |
| 8174 | |
| 8175 | pdev = container_of(dv, struct platform_device, dev); |
| 8176 | |
| 8177 | /* setup gpio/pad */ |
| 8178 | curr_pin_cfg = &sdcc_pin_cfg_data[pdev->id - 1]; |
| 8179 | if (curr_pin_cfg->cfg_sts == !!vdd) |
| 8180 | goto setup_vreg; |
| 8181 | |
| 8182 | if (curr_pin_cfg->is_gpio) |
| 8183 | rc_pin_cfg = msm_sdcc_setup_gpio(pdev->id, !!vdd); |
| 8184 | else |
| 8185 | rc_pin_cfg = msm_sdcc_setup_pad(pdev->id, !!vdd); |
| 8186 | |
| 8187 | setup_vreg: |
| 8188 | /* setup voltage regulators */ |
| 8189 | rc_vreg_cfg = msm_sdcc_setup_vreg(pdev->id, !!vdd); |
| 8190 | |
| 8191 | if (rc_pin_cfg || rc_vreg_cfg) |
| 8192 | rc = rc_pin_cfg ? rc_pin_cfg : rc_vreg_cfg; |
| 8193 | |
| 8194 | return rc; |
| 8195 | } |
| 8196 | |
| 8197 | static void msm_sdcc_sdio_lpm_gpio(struct device *dv, unsigned int active) |
| 8198 | { |
| 8199 | struct msm_sdcc_pin_cfg *curr_pin_cfg; |
| 8200 | struct platform_device *pdev; |
| 8201 | |
| 8202 | pdev = container_of(dv, struct platform_device, dev); |
| 8203 | /* setup gpio/pad */ |
| 8204 | curr_pin_cfg = &sdcc_pin_cfg_data[pdev->id - 1]; |
| 8205 | |
| 8206 | if (curr_pin_cfg->cfg_sts == active) |
| 8207 | return; |
| 8208 | |
| 8209 | curr_pin_cfg->sdio_lpm_gpio_cfg = 1; |
| 8210 | if (curr_pin_cfg->is_gpio) |
| 8211 | msm_sdcc_setup_gpio(pdev->id, active); |
| 8212 | else |
| 8213 | msm_sdcc_setup_pad(pdev->id, active); |
| 8214 | curr_pin_cfg->sdio_lpm_gpio_cfg = 0; |
| 8215 | } |
| 8216 | |
| 8217 | static int msm_sdc3_get_wpswitch(struct device *dev) |
| 8218 | { |
| 8219 | struct platform_device *pdev; |
| 8220 | int status; |
| 8221 | pdev = container_of(dev, struct platform_device, dev); |
| 8222 | |
| 8223 | status = gpio_request(GPIO_SDC_WP, "SD_WP_Switch"); |
| 8224 | if (status) { |
| 8225 | pr_err("%s:Failed to request GPIO %d\n", |
| 8226 | __func__, GPIO_SDC_WP); |
| 8227 | } else { |
| 8228 | status = gpio_direction_input(GPIO_SDC_WP); |
| 8229 | if (!status) { |
| 8230 | status = gpio_get_value_cansleep(GPIO_SDC_WP); |
| 8231 | pr_info("%s: WP Status for Slot %d = %d\n", |
| 8232 | __func__, pdev->id, status); |
| 8233 | } |
| 8234 | gpio_free(GPIO_SDC_WP); |
| 8235 | } |
| 8236 | return status; |
| 8237 | } |
| 8238 | |
| 8239 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 8240 | int sdc5_register_status_notify(void (*callback)(int, void *), |
| 8241 | void *dev_id) |
| 8242 | { |
| 8243 | sdc5_status_notify_cb = callback; |
| 8244 | sdc5_status_notify_cb_devid = dev_id; |
| 8245 | return 0; |
| 8246 | } |
| 8247 | #endif |
| 8248 | |
| 8249 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 8250 | int sdc2_register_status_notify(void (*callback)(int, void *), |
| 8251 | void *dev_id) |
| 8252 | { |
| 8253 | sdc2_status_notify_cb = callback; |
| 8254 | sdc2_status_notify_cb_devid = dev_id; |
| 8255 | return 0; |
| 8256 | } |
| 8257 | #endif |
| 8258 | |
| 8259 | /* Interrupt handler for SDC2 and SDC5 detection |
| 8260 | * This function uses dual-edge interrputs settings in order |
| 8261 | * to get SDIO detection when the GPIO is rising and SDIO removal |
| 8262 | * when the GPIO is falling */ |
| 8263 | static irqreturn_t msm8x60_multi_sdio_slot_status_irq(int irq, void *dev_id) |
| 8264 | { |
| 8265 | int status; |
| 8266 | |
| 8267 | if (!machine_is_msm8x60_fusion() && |
| 8268 | !machine_is_msm8x60_fusn_ffa()) |
| 8269 | return IRQ_NONE; |
| 8270 | |
| 8271 | status = gpio_get_value(MDM2AP_SYNC); |
| 8272 | pr_info("%s: MDM2AP_SYNC Status = %d\n", |
| 8273 | __func__, status); |
| 8274 | |
| 8275 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 8276 | if (sdc2_status_notify_cb) { |
| 8277 | pr_info("%s: calling sdc2_status_notify_cb\n", __func__); |
| 8278 | sdc2_status_notify_cb(status, |
| 8279 | sdc2_status_notify_cb_devid); |
| 8280 | } |
| 8281 | #endif |
| 8282 | |
| 8283 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 8284 | if (sdc5_status_notify_cb) { |
| 8285 | pr_info("%s: calling sdc5_status_notify_cb\n", __func__); |
| 8286 | sdc5_status_notify_cb(status, |
| 8287 | sdc5_status_notify_cb_devid); |
| 8288 | } |
| 8289 | #endif |
| 8290 | return IRQ_HANDLED; |
| 8291 | } |
| 8292 | |
| 8293 | static int msm8x60_multi_sdio_init(void) |
| 8294 | { |
| 8295 | int ret, irq_num; |
| 8296 | |
| 8297 | if (!machine_is_msm8x60_fusion() && |
| 8298 | !machine_is_msm8x60_fusn_ffa()) |
| 8299 | return 0; |
| 8300 | |
| 8301 | ret = msm_gpiomux_get(MDM2AP_SYNC); |
| 8302 | if (ret) { |
| 8303 | pr_err("%s:Failed to request GPIO %d, ret=%d\n", |
| 8304 | __func__, MDM2AP_SYNC, ret); |
| 8305 | return ret; |
| 8306 | } |
| 8307 | |
| 8308 | irq_num = gpio_to_irq(MDM2AP_SYNC); |
| 8309 | |
| 8310 | ret = request_irq(irq_num, |
| 8311 | msm8x60_multi_sdio_slot_status_irq, |
| 8312 | IRQ_TYPE_EDGE_BOTH, |
| 8313 | "sdio_multidetection", NULL); |
| 8314 | |
| 8315 | if (ret) { |
| 8316 | pr_err("%s:Failed to request irq, ret=%d\n", |
| 8317 | __func__, ret); |
| 8318 | return ret; |
| 8319 | } |
| 8320 | |
| 8321 | return ret; |
| 8322 | } |
| 8323 | |
| 8324 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8325 | static unsigned int msm8x60_sdcc_slot_status(struct device *dev) |
| 8326 | { |
| 8327 | int status; |
| 8328 | |
| 8329 | status = gpio_request(PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC3_DET - 1) |
| 8330 | , "SD_HW_Detect"); |
| 8331 | if (status) { |
| 8332 | pr_err("%s:Failed to request GPIO %d\n", __func__, |
| 8333 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC3_DET - 1)); |
| 8334 | } else { |
| 8335 | status = gpio_direction_input( |
| 8336 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC3_DET - 1)); |
| 8337 | if (!status) |
| 8338 | status = !(gpio_get_value_cansleep( |
| 8339 | PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC3_DET - 1))); |
| 8340 | gpio_free(PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC3_DET - 1)); |
| 8341 | } |
| 8342 | return (unsigned int) status; |
| 8343 | } |
| 8344 | #endif |
| 8345 | #endif |
| 8346 | |
Subhash Jadavani | c9b8575 | 2012-04-13 11:16:49 +0530 | [diff] [blame] | 8347 | #define MSM_MPM_PIN_SDC3_DAT1 21 |
Subhash Jadavani | fe608a2 | 2012-04-13 10:45:53 +0530 | [diff] [blame] | 8348 | #define MSM_MPM_PIN_SDC4_DAT1 23 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8349 | |
| 8350 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 8351 | static struct mmc_platform_data msm8x60_sdc1_data = { |
| 8352 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 8353 | .translate_vdd = msm_sdcc_setup_power, |
| 8354 | #ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT |
| 8355 | .mmc_bus_width = MMC_CAP_8_BIT_DATA, |
| 8356 | #else |
| 8357 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 8358 | #endif |
| 8359 | .msmsdcc_fmin = 400000, |
| 8360 | .msmsdcc_fmid = 24000000, |
| 8361 | .msmsdcc_fmax = 48000000, |
| 8362 | .nonremovable = 1, |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 8363 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8364 | }; |
| 8365 | #endif |
| 8366 | |
| 8367 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 8368 | static struct mmc_platform_data msm8x60_sdc2_data = { |
| 8369 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_165_195, |
| 8370 | .translate_vdd = msm_sdcc_setup_power, |
| 8371 | .sdio_lpm_gpio_setup = msm_sdcc_sdio_lpm_gpio, |
| 8372 | .mmc_bus_width = MMC_CAP_8_BIT_DATA, |
| 8373 | .msmsdcc_fmin = 400000, |
| 8374 | .msmsdcc_fmid = 24000000, |
| 8375 | .msmsdcc_fmax = 48000000, |
| 8376 | .nonremovable = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8377 | .register_status_notify = sdc2_register_status_notify, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8378 | #ifdef CONFIG_MSM_SDIO_AL |
| 8379 | .is_sdio_al_client = 1, |
| 8380 | #endif |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 8381 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8382 | }; |
| 8383 | #endif |
| 8384 | |
| 8385 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 8386 | static struct mmc_platform_data msm8x60_sdc3_data = { |
| 8387 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 8388 | .translate_vdd = msm_sdcc_setup_power, |
| 8389 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 8390 | .wpswitch = msm_sdc3_get_wpswitch, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8391 | .status = msm8x60_sdcc_slot_status, |
| 8392 | .status_irq = PM8058_GPIO_IRQ(PM8058_IRQ_BASE, |
| 8393 | PMIC_GPIO_SDC3_DET - 1), |
| 8394 | .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8395 | .msmsdcc_fmin = 400000, |
| 8396 | .msmsdcc_fmid = 24000000, |
| 8397 | .msmsdcc_fmax = 48000000, |
| 8398 | .nonremovable = 0, |
Subhash Jadavani | 55e188e | 2012-04-13 11:31:08 +0530 | [diff] [blame] | 8399 | .mpm_sdiowakeup_int = MSM_MPM_PIN_SDC3_DAT1, |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 8400 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8401 | }; |
| 8402 | #endif |
| 8403 | |
| 8404 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 8405 | static struct mmc_platform_data msm8x60_sdc4_data = { |
| 8406 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 8407 | .translate_vdd = msm_sdcc_setup_power, |
| 8408 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 8409 | .msmsdcc_fmin = 400000, |
| 8410 | .msmsdcc_fmid = 24000000, |
| 8411 | .msmsdcc_fmax = 48000000, |
| 8412 | .nonremovable = 0, |
Subhash Jadavani | c9b8575 | 2012-04-13 11:16:49 +0530 | [diff] [blame] | 8413 | .mpm_sdiowakeup_int = MSM_MPM_PIN_SDC4_DAT1, |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 8414 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8415 | }; |
| 8416 | #endif |
| 8417 | |
| 8418 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 8419 | static struct mmc_platform_data msm8x60_sdc5_data = { |
| 8420 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_165_195, |
| 8421 | .translate_vdd = msm_sdcc_setup_power, |
| 8422 | .sdio_lpm_gpio_setup = msm_sdcc_sdio_lpm_gpio, |
| 8423 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 8424 | .msmsdcc_fmin = 400000, |
| 8425 | .msmsdcc_fmid = 24000000, |
| 8426 | .msmsdcc_fmax = 48000000, |
| 8427 | .nonremovable = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8428 | .register_status_notify = sdc5_register_status_notify, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8429 | #ifdef CONFIG_MSM_SDIO_AL |
| 8430 | .is_sdio_al_client = 1, |
| 8431 | #endif |
Subhash Jadavani | bcd435f | 2012-04-24 18:26:49 +0530 | [diff] [blame] | 8432 | .msm_bus_voting_data = &sps_to_ddr_bus_voting_data, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8433 | }; |
| 8434 | #endif |
| 8435 | |
| 8436 | static void __init msm8x60_init_mmc(void) |
| 8437 | { |
| 8438 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 8439 | /* SDCC1 : eMMC card connected */ |
| 8440 | sdcc_vreg_data[0].vdd_data = &sdcc_vdd_reg_data[0]; |
| 8441 | sdcc_vreg_data[0].vdd_data->reg_name = "8901_l5"; |
| 8442 | sdcc_vreg_data[0].vdd_data->set_voltage_sup = 1; |
| 8443 | sdcc_vreg_data[0].vdd_data->level = 2850000; |
Subhash Jadavani | a8482a3 | 2011-08-08 11:01:44 +0530 | [diff] [blame] | 8444 | sdcc_vreg_data[0].vdd_data->always_on = 1; |
| 8445 | sdcc_vreg_data[0].vdd_data->op_pwr_mode_sup = 1; |
| 8446 | sdcc_vreg_data[0].vdd_data->lpm_uA = 9000; |
| 8447 | sdcc_vreg_data[0].vdd_data->hpm_uA = 200000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8448 | |
| 8449 | sdcc_vreg_data[0].vccq_data = &sdcc_vccq_reg_data[0]; |
| 8450 | sdcc_vreg_data[0].vccq_data->reg_name = "8901_lvs0"; |
| 8451 | sdcc_vreg_data[0].vccq_data->set_voltage_sup = 0; |
| 8452 | sdcc_vreg_data[0].vccq_data->always_on = 1; |
| 8453 | |
| 8454 | msm_add_sdcc(1, &msm8x60_sdc1_data); |
| 8455 | #endif |
| 8456 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 8457 | /* |
| 8458 | * MDM SDIO client is connected to SDC2 on charm SURF/FFA |
| 8459 | * and no card is connected on 8660 SURF/FFA/FLUID. |
| 8460 | */ |
| 8461 | sdcc_vreg_data[1].vdd_data = &sdcc_vdd_reg_data[1]; |
| 8462 | sdcc_vreg_data[1].vdd_data->reg_name = "8058_s3"; |
| 8463 | sdcc_vreg_data[1].vdd_data->set_voltage_sup = 1; |
| 8464 | sdcc_vreg_data[1].vdd_data->level = 1800000; |
| 8465 | |
| 8466 | sdcc_vreg_data[1].vccq_data = NULL; |
| 8467 | |
| 8468 | if (machine_is_msm8x60_fusion()) |
| 8469 | msm8x60_sdc2_data.msmsdcc_fmax = 24000000; |
| 8470 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8471 | msm8x60_sdc2_data.sdiowakeup_irq = gpio_to_irq(144); |
| 8472 | msm_sdcc_setup_gpio(2, 1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8473 | msm_add_sdcc(2, &msm8x60_sdc2_data); |
| 8474 | } |
| 8475 | #endif |
| 8476 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 8477 | /* SDCC3 : External card slot connected */ |
| 8478 | sdcc_vreg_data[2].vdd_data = &sdcc_vdd_reg_data[2]; |
| 8479 | sdcc_vreg_data[2].vdd_data->reg_name = "8058_l14"; |
| 8480 | sdcc_vreg_data[2].vdd_data->set_voltage_sup = 1; |
| 8481 | sdcc_vreg_data[2].vdd_data->level = 2850000; |
| 8482 | sdcc_vreg_data[2].vdd_data->always_on = 1; |
| 8483 | sdcc_vreg_data[2].vdd_data->op_pwr_mode_sup = 1; |
| 8484 | sdcc_vreg_data[2].vdd_data->lpm_uA = 9000; |
| 8485 | sdcc_vreg_data[2].vdd_data->hpm_uA = 200000; |
| 8486 | |
| 8487 | sdcc_vreg_data[2].vccq_data = NULL; |
| 8488 | |
| 8489 | sdcc_vreg_data[2].vddp_data = &sdcc_vddp_reg_data[2]; |
| 8490 | sdcc_vreg_data[2].vddp_data->reg_name = "8058_l5"; |
| 8491 | sdcc_vreg_data[2].vddp_data->set_voltage_sup = 1; |
| 8492 | sdcc_vreg_data[2].vddp_data->level = 2850000; |
| 8493 | sdcc_vreg_data[2].vddp_data->always_on = 1; |
| 8494 | sdcc_vreg_data[2].vddp_data->op_pwr_mode_sup = 1; |
| 8495 | /* Sleep current required is ~300 uA. But min. RPM |
| 8496 | * vote can be in terms of mA (min. 1 mA). |
| 8497 | * So let's vote for 2 mA during sleep. |
| 8498 | */ |
| 8499 | sdcc_vreg_data[2].vddp_data->lpm_uA = 2000; |
| 8500 | /* Max. Active current required is 16 mA */ |
| 8501 | sdcc_vreg_data[2].vddp_data->hpm_uA = 16000; |
| 8502 | |
| 8503 | if (machine_is_msm8x60_fluid()) |
| 8504 | msm8x60_sdc3_data.wpswitch = NULL; |
| 8505 | msm_add_sdcc(3, &msm8x60_sdc3_data); |
| 8506 | #endif |
| 8507 | #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT |
| 8508 | /* SDCC4 : WLAN WCN1314 chip is connected */ |
| 8509 | sdcc_vreg_data[3].vdd_data = &sdcc_vdd_reg_data[3]; |
| 8510 | sdcc_vreg_data[3].vdd_data->reg_name = "8058_s3"; |
| 8511 | sdcc_vreg_data[3].vdd_data->set_voltage_sup = 1; |
| 8512 | sdcc_vreg_data[3].vdd_data->level = 1800000; |
| 8513 | |
| 8514 | sdcc_vreg_data[3].vccq_data = NULL; |
| 8515 | |
| 8516 | msm_add_sdcc(4, &msm8x60_sdc4_data); |
| 8517 | #endif |
| 8518 | #ifdef CONFIG_MMC_MSM_SDC5_SUPPORT |
| 8519 | /* |
| 8520 | * MDM SDIO client is connected to SDC5 on charm SURF/FFA |
| 8521 | * and no card is connected on 8660 SURF/FFA/FLUID. |
| 8522 | */ |
| 8523 | sdcc_vreg_data[4].vdd_data = &sdcc_vdd_reg_data[4]; |
| 8524 | sdcc_vreg_data[4].vdd_data->reg_name = "8058_s3"; |
| 8525 | sdcc_vreg_data[4].vdd_data->set_voltage_sup = 1; |
| 8526 | sdcc_vreg_data[4].vdd_data->level = 1800000; |
| 8527 | |
| 8528 | sdcc_vreg_data[4].vccq_data = NULL; |
| 8529 | |
| 8530 | if (machine_is_msm8x60_fusion()) |
| 8531 | msm8x60_sdc5_data.msmsdcc_fmax = 24000000; |
| 8532 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8533 | msm8x60_sdc5_data.sdiowakeup_irq = gpio_to_irq(99); |
| 8534 | msm_sdcc_setup_gpio(5, 1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8535 | msm_add_sdcc(5, &msm8x60_sdc5_data); |
| 8536 | } |
| 8537 | #endif |
| 8538 | } |
| 8539 | |
| 8540 | #if !defined(CONFIG_GPIO_SX150X) && !defined(CONFIG_GPIO_SX150X_MODULE) |
| 8541 | static inline void display_common_power(int on) {} |
| 8542 | #else |
| 8543 | |
| 8544 | #define _GET_REGULATOR(var, name) do { \ |
| 8545 | if (var == NULL) { \ |
| 8546 | var = regulator_get(NULL, name); \ |
| 8547 | if (IS_ERR(var)) { \ |
| 8548 | pr_err("'%s' regulator not found, rc=%ld\n", \ |
| 8549 | name, PTR_ERR(var)); \ |
| 8550 | var = NULL; \ |
| 8551 | } \ |
| 8552 | } \ |
| 8553 | } while (0) |
| 8554 | |
| 8555 | static int dsub_regulator(int on) |
| 8556 | { |
| 8557 | static struct regulator *dsub_reg; |
| 8558 | static struct regulator *mpp0_reg; |
| 8559 | static int dsub_reg_enabled; |
| 8560 | int rc = 0; |
| 8561 | |
| 8562 | _GET_REGULATOR(dsub_reg, "8901_l3"); |
| 8563 | if (IS_ERR(dsub_reg)) { |
| 8564 | printk(KERN_ERR "%s: failed to get reg 8901_l3 err=%ld", |
| 8565 | __func__, PTR_ERR(dsub_reg)); |
| 8566 | return PTR_ERR(dsub_reg); |
| 8567 | } |
| 8568 | |
| 8569 | _GET_REGULATOR(mpp0_reg, "8901_mpp0"); |
| 8570 | if (IS_ERR(mpp0_reg)) { |
| 8571 | printk(KERN_ERR "%s: failed to get reg 8901_mpp0 err=%ld", |
| 8572 | __func__, PTR_ERR(mpp0_reg)); |
| 8573 | return PTR_ERR(mpp0_reg); |
| 8574 | } |
| 8575 | |
| 8576 | if (on && !dsub_reg_enabled) { |
| 8577 | rc = regulator_set_voltage(dsub_reg, 3300000, 3300000); |
| 8578 | if (rc) { |
| 8579 | printk(KERN_ERR "%s: failed to set reg 8901_l3 voltage" |
| 8580 | " err=%d", __func__, rc); |
| 8581 | goto dsub_regulator_err; |
| 8582 | } |
| 8583 | rc = regulator_enable(dsub_reg); |
| 8584 | if (rc) { |
| 8585 | printk(KERN_ERR "%s: failed to enable reg 8901_l3" |
| 8586 | " err=%d", __func__, rc); |
| 8587 | goto dsub_regulator_err; |
| 8588 | } |
| 8589 | rc = regulator_enable(mpp0_reg); |
| 8590 | if (rc) { |
| 8591 | printk(KERN_ERR "%s: failed to enable reg 8901_mpp0" |
| 8592 | " err=%d", __func__, rc); |
| 8593 | goto dsub_regulator_err; |
| 8594 | } |
| 8595 | dsub_reg_enabled = 1; |
| 8596 | } else if (!on && dsub_reg_enabled) { |
| 8597 | rc = regulator_disable(dsub_reg); |
| 8598 | if (rc) |
| 8599 | printk(KERN_WARNING "%s: failed to disable reg 8901_l3" |
| 8600 | " err=%d", __func__, rc); |
| 8601 | rc = regulator_disable(mpp0_reg); |
| 8602 | if (rc) |
| 8603 | printk(KERN_WARNING "%s: failed to disable reg " |
| 8604 | "8901_mpp0 err=%d", __func__, rc); |
| 8605 | dsub_reg_enabled = 0; |
| 8606 | } |
| 8607 | |
| 8608 | return rc; |
| 8609 | |
| 8610 | dsub_regulator_err: |
| 8611 | regulator_put(mpp0_reg); |
| 8612 | regulator_put(dsub_reg); |
| 8613 | return rc; |
| 8614 | } |
| 8615 | |
| 8616 | static int display_power_on; |
| 8617 | static void setup_display_power(void) |
| 8618 | { |
| 8619 | if (display_power_on) |
| 8620 | if (lcdc_vga_enabled) { |
| 8621 | dsub_regulator(1); |
| 8622 | gpio_set_value_cansleep(GPIO_LVDS_SHUTDOWN_N, 0); |
| 8623 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, 0); |
| 8624 | if (machine_is_msm8x60_ffa() || |
| 8625 | machine_is_msm8x60_fusn_ffa()) |
| 8626 | gpio_set_value_cansleep(GPIO_DONGLE_PWR_EN, 1); |
| 8627 | } else { |
| 8628 | dsub_regulator(0); |
| 8629 | gpio_set_value_cansleep(GPIO_LVDS_SHUTDOWN_N, 1); |
| 8630 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, 1); |
| 8631 | if (machine_is_msm8x60_ffa() || |
| 8632 | machine_is_msm8x60_fusn_ffa()) |
| 8633 | gpio_set_value_cansleep(GPIO_DONGLE_PWR_EN, 0); |
| 8634 | } |
| 8635 | else { |
| 8636 | dsub_regulator(0); |
| 8637 | if (machine_is_msm8x60_ffa() || machine_is_msm8x60_fusn_ffa()) |
| 8638 | gpio_set_value_cansleep(GPIO_DONGLE_PWR_EN, 0); |
| 8639 | /* BACKLIGHT */ |
| 8640 | gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, 0); |
| 8641 | /* LVDS */ |
| 8642 | gpio_set_value_cansleep(GPIO_LVDS_SHUTDOWN_N, 0); |
| 8643 | } |
| 8644 | } |
| 8645 | |
| 8646 | #define _GET_REGULATOR(var, name) do { \ |
| 8647 | if (var == NULL) { \ |
| 8648 | var = regulator_get(NULL, name); \ |
| 8649 | if (IS_ERR(var)) { \ |
| 8650 | pr_err("'%s' regulator not found, rc=%ld\n", \ |
| 8651 | name, PTR_ERR(var)); \ |
| 8652 | var = NULL; \ |
| 8653 | } \ |
| 8654 | } \ |
| 8655 | } while (0) |
| 8656 | |
| 8657 | #define GPIO_RESX_N (GPIO_EXPANDER_GPIO_BASE + 2) |
| 8658 | |
| 8659 | static void display_common_power(int on) |
| 8660 | { |
| 8661 | int rc; |
| 8662 | static struct regulator *display_reg; |
| 8663 | |
| 8664 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
| 8665 | machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) { |
| 8666 | if (on) { |
| 8667 | /* LVDS */ |
| 8668 | _GET_REGULATOR(display_reg, "8901_l2"); |
| 8669 | if (!display_reg) |
| 8670 | return; |
| 8671 | rc = regulator_set_voltage(display_reg, |
| 8672 | 3300000, 3300000); |
| 8673 | if (rc) |
| 8674 | goto out; |
| 8675 | rc = regulator_enable(display_reg); |
| 8676 | if (rc) |
| 8677 | goto out; |
| 8678 | rc = gpio_request(GPIO_LVDS_SHUTDOWN_N, |
| 8679 | "LVDS_STDN_OUT_N"); |
| 8680 | if (rc) { |
| 8681 | printk(KERN_ERR "%s: LVDS gpio %d request" |
| 8682 | "failed\n", __func__, |
| 8683 | GPIO_LVDS_SHUTDOWN_N); |
| 8684 | goto out2; |
| 8685 | } |
| 8686 | |
| 8687 | /* BACKLIGHT */ |
| 8688 | rc = gpio_request(GPIO_BACKLIGHT_EN, "BACKLIGHT_EN"); |
| 8689 | if (rc) { |
| 8690 | printk(KERN_ERR "%s: BACKLIGHT gpio %d request" |
| 8691 | "failed\n", __func__, |
| 8692 | GPIO_BACKLIGHT_EN); |
| 8693 | goto out3; |
| 8694 | } |
| 8695 | |
| 8696 | if (machine_is_msm8x60_ffa() || |
| 8697 | machine_is_msm8x60_fusn_ffa()) { |
| 8698 | rc = gpio_request(GPIO_DONGLE_PWR_EN, |
| 8699 | "DONGLE_PWR_EN"); |
| 8700 | if (rc) { |
| 8701 | printk(KERN_ERR "%s: DONGLE_PWR_EN gpio" |
| 8702 | " %d request failed\n", __func__, |
| 8703 | GPIO_DONGLE_PWR_EN); |
| 8704 | goto out4; |
| 8705 | } |
| 8706 | } |
| 8707 | |
| 8708 | gpio_direction_output(GPIO_LVDS_SHUTDOWN_N, 0); |
| 8709 | gpio_direction_output(GPIO_BACKLIGHT_EN, 0); |
| 8710 | if (machine_is_msm8x60_ffa() || |
| 8711 | machine_is_msm8x60_fusn_ffa()) |
| 8712 | gpio_direction_output(GPIO_DONGLE_PWR_EN, 0); |
| 8713 | mdelay(20); |
| 8714 | display_power_on = 1; |
| 8715 | setup_display_power(); |
| 8716 | } else { |
| 8717 | if (display_power_on) { |
| 8718 | display_power_on = 0; |
| 8719 | setup_display_power(); |
| 8720 | mdelay(20); |
| 8721 | if (machine_is_msm8x60_ffa() || |
| 8722 | machine_is_msm8x60_fusn_ffa()) |
| 8723 | gpio_free(GPIO_DONGLE_PWR_EN); |
| 8724 | goto out4; |
| 8725 | } |
| 8726 | } |
| 8727 | } |
| 8728 | #if defined(CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT) || \ |
| 8729 | defined(CONFIG_FB_MSM_LCDC_AUO_WVGA) |
| 8730 | else if (machine_is_msm8x60_fluid()) { |
| 8731 | static struct regulator *fluid_reg; |
| 8732 | static struct regulator *fluid_reg2; |
| 8733 | |
| 8734 | if (on) { |
| 8735 | _GET_REGULATOR(fluid_reg, "8901_l2"); |
| 8736 | if (!fluid_reg) |
| 8737 | return; |
| 8738 | _GET_REGULATOR(fluid_reg2, "8058_s3"); |
| 8739 | if (!fluid_reg2) { |
| 8740 | regulator_put(fluid_reg); |
| 8741 | return; |
| 8742 | } |
| 8743 | rc = gpio_request(GPIO_RESX_N, "RESX_N"); |
| 8744 | if (rc) { |
| 8745 | regulator_put(fluid_reg2); |
| 8746 | regulator_put(fluid_reg); |
| 8747 | return; |
| 8748 | } |
| 8749 | regulator_set_voltage(fluid_reg, 2850000, 2850000); |
| 8750 | regulator_set_voltage(fluid_reg2, 1800000, 1800000); |
| 8751 | regulator_enable(fluid_reg); |
| 8752 | regulator_enable(fluid_reg2); |
| 8753 | msleep(20); |
| 8754 | gpio_direction_output(GPIO_RESX_N, 0); |
| 8755 | udelay(10); |
| 8756 | gpio_set_value_cansleep(GPIO_RESX_N, 1); |
| 8757 | display_power_on = 1; |
| 8758 | setup_display_power(); |
| 8759 | } else { |
| 8760 | gpio_set_value_cansleep(GPIO_RESX_N, 0); |
| 8761 | gpio_free(GPIO_RESX_N); |
| 8762 | msleep(20); |
| 8763 | regulator_disable(fluid_reg2); |
| 8764 | regulator_disable(fluid_reg); |
| 8765 | regulator_put(fluid_reg2); |
| 8766 | regulator_put(fluid_reg); |
| 8767 | display_power_on = 0; |
| 8768 | setup_display_power(); |
| 8769 | fluid_reg = NULL; |
| 8770 | fluid_reg2 = NULL; |
| 8771 | } |
| 8772 | } |
| 8773 | #endif |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 8774 | #if defined(CONFIG_FB_MSM_LCDC_NT35582_WVGA) |
| 8775 | else if (machine_is_msm8x60_dragon()) { |
| 8776 | static struct regulator *dragon_reg; |
| 8777 | static struct regulator *dragon_reg2; |
| 8778 | |
| 8779 | if (on) { |
| 8780 | _GET_REGULATOR(dragon_reg, "8901_l2"); |
| 8781 | if (!dragon_reg) |
| 8782 | return; |
| 8783 | _GET_REGULATOR(dragon_reg2, "8058_l16"); |
| 8784 | if (!dragon_reg2) { |
| 8785 | regulator_put(dragon_reg); |
| 8786 | dragon_reg = NULL; |
| 8787 | return; |
| 8788 | } |
| 8789 | |
| 8790 | rc = gpio_request(GPIO_NT35582_BL_EN, "lcdc_bl_en"); |
| 8791 | if (rc) { |
| 8792 | pr_err("%s: gpio %d request failed with rc=%d\n", |
| 8793 | __func__, GPIO_NT35582_BL_EN, rc); |
| 8794 | regulator_put(dragon_reg); |
| 8795 | regulator_put(dragon_reg2); |
| 8796 | dragon_reg = NULL; |
| 8797 | dragon_reg2 = NULL; |
| 8798 | return; |
| 8799 | } |
| 8800 | |
| 8801 | if (gpio_tlmm_config(GPIO_CFG(GPIO_NT35582_RESET, 0, |
| 8802 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 8803 | GPIO_CFG_16MA), GPIO_CFG_ENABLE)) { |
| 8804 | pr_err("%s: config gpio '%d' failed!\n", |
| 8805 | __func__, GPIO_NT35582_RESET); |
| 8806 | gpio_free(GPIO_NT35582_BL_EN); |
| 8807 | regulator_put(dragon_reg); |
| 8808 | regulator_put(dragon_reg2); |
| 8809 | dragon_reg = NULL; |
| 8810 | dragon_reg2 = NULL; |
| 8811 | return; |
| 8812 | } |
| 8813 | |
| 8814 | rc = gpio_request(GPIO_NT35582_RESET, "lcdc_reset"); |
| 8815 | if (rc) { |
| 8816 | pr_err("%s: unable to request gpio %d (rc=%d)\n", |
| 8817 | __func__, GPIO_NT35582_RESET, rc); |
| 8818 | gpio_free(GPIO_NT35582_BL_EN); |
| 8819 | regulator_put(dragon_reg); |
| 8820 | regulator_put(dragon_reg2); |
| 8821 | dragon_reg = NULL; |
| 8822 | dragon_reg2 = NULL; |
| 8823 | return; |
| 8824 | } |
| 8825 | |
| 8826 | regulator_set_voltage(dragon_reg, 3300000, 3300000); |
| 8827 | regulator_set_voltage(dragon_reg2, 1800000, 1800000); |
| 8828 | regulator_enable(dragon_reg); |
| 8829 | regulator_enable(dragon_reg2); |
| 8830 | msleep(20); |
| 8831 | |
| 8832 | gpio_set_value_cansleep(GPIO_NT35582_RESET, 1); |
| 8833 | msleep(20); |
| 8834 | gpio_set_value_cansleep(GPIO_NT35582_RESET, 0); |
| 8835 | msleep(20); |
| 8836 | gpio_set_value_cansleep(GPIO_NT35582_RESET, 1); |
| 8837 | msleep(50); |
| 8838 | |
| 8839 | gpio_set_value_cansleep(GPIO_NT35582_BL_EN, 1); |
| 8840 | |
| 8841 | display_power_on = 1; |
| 8842 | } else if ((dragon_reg != NULL) && (dragon_reg2 != NULL)) { |
| 8843 | gpio_free(GPIO_NT35582_RESET); |
| 8844 | gpio_free(GPIO_NT35582_BL_EN); |
| 8845 | regulator_disable(dragon_reg2); |
| 8846 | regulator_disable(dragon_reg); |
| 8847 | regulator_put(dragon_reg2); |
| 8848 | regulator_put(dragon_reg); |
| 8849 | display_power_on = 0; |
| 8850 | dragon_reg = NULL; |
| 8851 | dragon_reg2 = NULL; |
| 8852 | } |
| 8853 | } |
| 8854 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 8855 | return; |
| 8856 | |
| 8857 | out4: |
| 8858 | gpio_free(GPIO_BACKLIGHT_EN); |
| 8859 | out3: |
| 8860 | gpio_free(GPIO_LVDS_SHUTDOWN_N); |
| 8861 | out2: |
| 8862 | regulator_disable(display_reg); |
| 8863 | out: |
| 8864 | regulator_put(display_reg); |
| 8865 | display_reg = NULL; |
| 8866 | } |
| 8867 | #undef _GET_REGULATOR |
| 8868 | #endif |
| 8869 | |
| 8870 | static int mipi_dsi_panel_power(int on); |
| 8871 | |
| 8872 | #define LCDC_NUM_GPIO 28 |
| 8873 | #define LCDC_GPIO_START 0 |
| 8874 | |
| 8875 | static void lcdc_samsung_panel_power(int on) |
| 8876 | { |
| 8877 | int n, ret = 0; |
| 8878 | |
| 8879 | display_common_power(on); |
| 8880 | |
| 8881 | for (n = 0; n < LCDC_NUM_GPIO; n++) { |
| 8882 | if (on) { |
| 8883 | ret = gpio_request(LCDC_GPIO_START + n, "LCDC_GPIO"); |
| 8884 | if (unlikely(ret)) { |
| 8885 | pr_err("%s not able to get gpio\n", __func__); |
| 8886 | break; |
| 8887 | } |
| 8888 | } else |
| 8889 | gpio_free(LCDC_GPIO_START + n); |
| 8890 | } |
| 8891 | |
| 8892 | if (ret) { |
| 8893 | for (n--; n >= 0; n--) |
| 8894 | gpio_free(LCDC_GPIO_START + n); |
| 8895 | } |
| 8896 | |
| 8897 | mipi_dsi_panel_power(0); /* set 8058_ldo0 to LPM */ |
| 8898 | } |
| 8899 | |
| 8900 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 8901 | #define _GET_REGULATOR(var, name) do { \ |
| 8902 | var = regulator_get(NULL, name); \ |
| 8903 | if (IS_ERR(var)) { \ |
| 8904 | pr_err("'%s' regulator not found, rc=%ld\n", \ |
| 8905 | name, IS_ERR(var)); \ |
| 8906 | var = NULL; \ |
| 8907 | return -ENODEV; \ |
| 8908 | } \ |
| 8909 | } while (0) |
| 8910 | |
| 8911 | static int hdmi_enable_5v(int on) |
| 8912 | { |
| 8913 | static struct regulator *reg_8901_hdmi_mvs; /* HDMI_5V */ |
| 8914 | static struct regulator *reg_8901_mpp0; /* External 5V */ |
| 8915 | static int prev_on; |
| 8916 | int rc; |
| 8917 | |
| 8918 | if (on == prev_on) |
| 8919 | return 0; |
| 8920 | |
| 8921 | if (!reg_8901_hdmi_mvs) |
| 8922 | _GET_REGULATOR(reg_8901_hdmi_mvs, "8901_hdmi_mvs"); |
| 8923 | if (!reg_8901_mpp0) |
| 8924 | _GET_REGULATOR(reg_8901_mpp0, "8901_mpp0"); |
| 8925 | |
| 8926 | if (on) { |
| 8927 | rc = regulator_enable(reg_8901_mpp0); |
| 8928 | if (rc) { |
| 8929 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 8930 | "reg_8901_mpp0", rc); |
| 8931 | return rc; |
| 8932 | } |
| 8933 | rc = regulator_enable(reg_8901_hdmi_mvs); |
| 8934 | if (rc) { |
| 8935 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 8936 | "8901_hdmi_mvs", rc); |
| 8937 | return rc; |
| 8938 | } |
| 8939 | pr_info("%s(on): success\n", __func__); |
| 8940 | } else { |
| 8941 | rc = regulator_disable(reg_8901_hdmi_mvs); |
| 8942 | if (rc) |
| 8943 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
| 8944 | "8901_hdmi_mvs", rc); |
| 8945 | rc = regulator_disable(reg_8901_mpp0); |
| 8946 | if (rc) |
| 8947 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
| 8948 | "reg_8901_mpp0", rc); |
| 8949 | pr_info("%s(off): success\n", __func__); |
| 8950 | } |
| 8951 | |
| 8952 | prev_on = on; |
| 8953 | |
| 8954 | return 0; |
| 8955 | } |
| 8956 | |
| 8957 | static int hdmi_core_power(int on, int show) |
| 8958 | { |
| 8959 | static struct regulator *reg_8058_l16; /* VDD_HDMI */ |
| 8960 | static int prev_on; |
| 8961 | int rc; |
| 8962 | |
| 8963 | if (on == prev_on) |
| 8964 | return 0; |
| 8965 | |
| 8966 | if (!reg_8058_l16) |
| 8967 | _GET_REGULATOR(reg_8058_l16, "8058_l16"); |
| 8968 | |
| 8969 | if (on) { |
| 8970 | rc = regulator_set_voltage(reg_8058_l16, 1800000, 1800000); |
| 8971 | if (!rc) |
| 8972 | rc = regulator_enable(reg_8058_l16); |
| 8973 | if (rc) { |
| 8974 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 8975 | "8058_l16", rc); |
| 8976 | return rc; |
| 8977 | } |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 8978 | pr_debug("%s(on): success\n", __func__); |
| 8979 | } else { |
| 8980 | rc = regulator_disable(reg_8058_l16); |
| 8981 | if (rc) |
| 8982 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
| 8983 | "8058_l16", rc); |
| 8984 | pr_debug("%s(off): success\n", __func__); |
| 8985 | } |
| 8986 | |
| 8987 | prev_on = on; |
| 8988 | |
| 8989 | return 0; |
| 8990 | } |
| 8991 | |
| 8992 | static int hdmi_gpio_config(int on) |
| 8993 | { |
| 8994 | int rc = 0; |
| 8995 | static int prev_on; |
| 8996 | |
| 8997 | if (on == prev_on) |
| 8998 | return 0; |
| 8999 | |
| 9000 | if (on) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9001 | rc = gpio_request(170, "HDMI_DDC_CLK"); |
| 9002 | if (rc) { |
| 9003 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 9004 | "HDMI_DDC_CLK", 170, rc); |
| 9005 | goto error1; |
| 9006 | } |
| 9007 | rc = gpio_request(171, "HDMI_DDC_DATA"); |
| 9008 | if (rc) { |
| 9009 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 9010 | "HDMI_DDC_DATA", 171, rc); |
| 9011 | goto error2; |
| 9012 | } |
| 9013 | rc = gpio_request(172, "HDMI_HPD"); |
| 9014 | if (rc) { |
| 9015 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 9016 | "HDMI_HPD", 172, rc); |
| 9017 | goto error3; |
| 9018 | } |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 9019 | pr_debug("%s(on): success\n", __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9020 | } else { |
| 9021 | gpio_free(170); |
| 9022 | gpio_free(171); |
| 9023 | gpio_free(172); |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 9024 | pr_debug("%s(off): success\n", __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9025 | } |
| 9026 | |
| 9027 | prev_on = on; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9028 | return 0; |
| 9029 | |
| 9030 | error3: |
| 9031 | gpio_free(171); |
| 9032 | error2: |
| 9033 | gpio_free(170); |
| 9034 | error1: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9035 | return rc; |
| 9036 | } |
| 9037 | |
| 9038 | static int hdmi_cec_power(int on) |
| 9039 | { |
| 9040 | static struct regulator *reg_8901_l3; /* HDMI_CEC */ |
| 9041 | static int prev_on; |
| 9042 | int rc; |
| 9043 | |
| 9044 | if (on == prev_on) |
| 9045 | return 0; |
| 9046 | |
| 9047 | if (!reg_8901_l3) |
| 9048 | _GET_REGULATOR(reg_8901_l3, "8901_l3"); |
| 9049 | |
| 9050 | if (on) { |
| 9051 | rc = regulator_set_voltage(reg_8901_l3, 3300000, 3300000); |
| 9052 | if (!rc) |
| 9053 | rc = regulator_enable(reg_8901_l3); |
| 9054 | if (rc) { |
| 9055 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 9056 | "8901_l3", rc); |
| 9057 | return rc; |
| 9058 | } |
| 9059 | rc = gpio_request(169, "HDMI_CEC_VAR"); |
| 9060 | if (rc) { |
| 9061 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 9062 | "HDMI_CEC_VAR", 169, rc); |
| 9063 | goto error; |
| 9064 | } |
| 9065 | pr_info("%s(on): success\n", __func__); |
| 9066 | } else { |
| 9067 | gpio_free(169); |
| 9068 | rc = regulator_disable(reg_8901_l3); |
| 9069 | if (rc) |
| 9070 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
| 9071 | "8901_l3", rc); |
| 9072 | pr_info("%s(off): success\n", __func__); |
| 9073 | } |
| 9074 | |
| 9075 | prev_on = on; |
| 9076 | |
| 9077 | return 0; |
| 9078 | error: |
| 9079 | regulator_disable(reg_8901_l3); |
| 9080 | return rc; |
| 9081 | } |
| 9082 | |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 9083 | static int hdmi_panel_power(int on) |
| 9084 | { |
| 9085 | int rc; |
| 9086 | |
| 9087 | pr_debug("%s: HDMI Core: %s\n", __func__, (on ? "ON" : "OFF")); |
| 9088 | rc = hdmi_core_power(on, 1); |
| 9089 | if (rc) |
| 9090 | rc = hdmi_cec_power(on); |
| 9091 | |
| 9092 | pr_debug("%s: HDMI Core: %s Success\n", __func__, (on ? "ON" : "OFF")); |
| 9093 | return rc; |
| 9094 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9095 | #undef _GET_REGULATOR |
| 9096 | |
| 9097 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 9098 | |
| 9099 | static int lcdc_panel_power(int on) |
| 9100 | { |
| 9101 | int flag_on = !!on; |
| 9102 | static int lcdc_power_save_on; |
| 9103 | |
| 9104 | if (lcdc_power_save_on == flag_on) |
| 9105 | return 0; |
| 9106 | |
| 9107 | lcdc_power_save_on = flag_on; |
| 9108 | |
| 9109 | lcdc_samsung_panel_power(on); |
| 9110 | |
| 9111 | return 0; |
| 9112 | } |
| 9113 | |
| 9114 | #ifdef CONFIG_MSM_BUS_SCALING |
Nagamalleswararao Ganji | 5fabbd6 | 2011-11-06 23:10:43 -0800 | [diff] [blame] | 9115 | |
| 9116 | static struct msm_bus_vectors rotator_init_vectors[] = { |
| 9117 | { |
| 9118 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9119 | .dst = MSM_BUS_SLAVE_SMI, |
| 9120 | .ab = 0, |
| 9121 | .ib = 0, |
| 9122 | }, |
| 9123 | { |
| 9124 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9125 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9126 | .ab = 0, |
| 9127 | .ib = 0, |
| 9128 | }, |
| 9129 | }; |
| 9130 | |
| 9131 | static struct msm_bus_vectors rotator_ui_vectors[] = { |
| 9132 | { |
| 9133 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9134 | .dst = MSM_BUS_SLAVE_SMI, |
| 9135 | .ab = 0, |
| 9136 | .ib = 0, |
| 9137 | }, |
| 9138 | { |
| 9139 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9140 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9141 | .ab = (1024 * 600 * 4 * 2 * 60), |
| 9142 | .ib = (1024 * 600 * 4 * 2 * 60 * 1.5), |
| 9143 | }, |
| 9144 | }; |
| 9145 | |
| 9146 | static struct msm_bus_vectors rotator_vga_vectors[] = { |
| 9147 | { |
| 9148 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9149 | .dst = MSM_BUS_SLAVE_SMI, |
| 9150 | .ab = (640 * 480 * 2 * 2 * 30), |
| 9151 | .ib = (640 * 480 * 2 * 2 * 30 * 1.5), |
| 9152 | }, |
| 9153 | { |
| 9154 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9155 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9156 | .ab = (640 * 480 * 2 * 2 * 30), |
| 9157 | .ib = (640 * 480 * 2 * 2 * 30 * 1.5), |
| 9158 | }, |
| 9159 | }; |
| 9160 | |
| 9161 | static struct msm_bus_vectors rotator_720p_vectors[] = { |
| 9162 | { |
| 9163 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9164 | .dst = MSM_BUS_SLAVE_SMI, |
| 9165 | .ab = (1280 * 736 * 2 * 2 * 30), |
| 9166 | .ib = (1280 * 736 * 2 * 2 * 30 * 1.5), |
| 9167 | }, |
| 9168 | { |
| 9169 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9170 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9171 | .ab = (1280 * 736 * 2 * 2 * 30), |
| 9172 | .ib = (1280 * 736 * 2 * 2 * 30 * 1.5), |
| 9173 | }, |
| 9174 | }; |
| 9175 | |
| 9176 | static struct msm_bus_vectors rotator_1080p_vectors[] = { |
| 9177 | { |
| 9178 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9179 | .dst = MSM_BUS_SLAVE_SMI, |
| 9180 | .ab = (1920 * 1088 * 2 * 2 * 30), |
| 9181 | .ib = (1920 * 1088 * 2 * 2 * 30 * 1.5), |
| 9182 | }, |
| 9183 | { |
| 9184 | .src = MSM_BUS_MASTER_ROTATOR, |
| 9185 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9186 | .ab = (1920 * 1088 * 2 * 2 * 30), |
| 9187 | .ib = (1920 * 1088 * 2 * 2 * 30 * 1.5), |
| 9188 | }, |
| 9189 | }; |
| 9190 | |
| 9191 | static struct msm_bus_paths rotator_bus_scale_usecases[] = { |
| 9192 | { |
| 9193 | ARRAY_SIZE(rotator_init_vectors), |
| 9194 | rotator_init_vectors, |
| 9195 | }, |
| 9196 | { |
| 9197 | ARRAY_SIZE(rotator_ui_vectors), |
| 9198 | rotator_ui_vectors, |
| 9199 | }, |
| 9200 | { |
| 9201 | ARRAY_SIZE(rotator_vga_vectors), |
| 9202 | rotator_vga_vectors, |
| 9203 | }, |
| 9204 | { |
| 9205 | ARRAY_SIZE(rotator_720p_vectors), |
| 9206 | rotator_720p_vectors, |
| 9207 | }, |
| 9208 | { |
| 9209 | ARRAY_SIZE(rotator_1080p_vectors), |
| 9210 | rotator_1080p_vectors, |
| 9211 | }, |
| 9212 | }; |
| 9213 | |
| 9214 | struct msm_bus_scale_pdata rotator_bus_scale_pdata = { |
| 9215 | rotator_bus_scale_usecases, |
| 9216 | ARRAY_SIZE(rotator_bus_scale_usecases), |
| 9217 | .name = "rotator", |
| 9218 | }; |
| 9219 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9220 | static struct msm_bus_vectors mdp_init_vectors[] = { |
| 9221 | /* For now, 0th array entry is reserved. |
| 9222 | * Please leave 0 as is and don't use it |
| 9223 | */ |
| 9224 | { |
| 9225 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9226 | .dst = MSM_BUS_SLAVE_SMI, |
| 9227 | .ab = 0, |
| 9228 | .ib = 0, |
| 9229 | }, |
| 9230 | /* Master and slaves can be from different fabrics */ |
| 9231 | { |
| 9232 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9233 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9234 | .ab = 0, |
| 9235 | .ib = 0, |
| 9236 | }, |
| 9237 | }; |
| 9238 | |
Ravishangar Kalyanam | 75f3732 | 2011-10-14 12:15:40 -0700 | [diff] [blame] | 9239 | #ifdef CONFIG_FB_MSM_LCDC_DSUB |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9240 | static struct msm_bus_vectors mdp_sd_smi_vectors[] = { |
| 9241 | /* Default case static display/UI/2d/3d if FB SMI */ |
| 9242 | { |
| 9243 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9244 | .dst = MSM_BUS_SLAVE_SMI, |
| 9245 | .ab = 388800000, |
| 9246 | .ib = 486000000, |
| 9247 | }, |
| 9248 | /* Master and slaves can be from different fabrics */ |
| 9249 | { |
| 9250 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9251 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9252 | .ab = 0, |
| 9253 | .ib = 0, |
| 9254 | }, |
| 9255 | }; |
| 9256 | |
| 9257 | static struct msm_bus_vectors mdp_sd_ebi_vectors[] = { |
| 9258 | /* Default case static display/UI/2d/3d if FB SMI */ |
| 9259 | { |
| 9260 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9261 | .dst = MSM_BUS_SLAVE_SMI, |
| 9262 | .ab = 0, |
| 9263 | .ib = 0, |
| 9264 | }, |
| 9265 | /* Master and slaves can be from different fabrics */ |
| 9266 | { |
| 9267 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9268 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9269 | .ab = 388800000, |
| 9270 | .ib = 486000000 * 2, |
| 9271 | }, |
| 9272 | }; |
| 9273 | static struct msm_bus_vectors mdp_vga_vectors[] = { |
| 9274 | /* VGA and less video */ |
| 9275 | { |
| 9276 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9277 | .dst = MSM_BUS_SLAVE_SMI, |
| 9278 | .ab = 458092800, |
| 9279 | .ib = 572616000, |
| 9280 | }, |
| 9281 | { |
| 9282 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9283 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9284 | .ab = 458092800, |
| 9285 | .ib = 572616000 * 2, |
| 9286 | }, |
| 9287 | }; |
| 9288 | static struct msm_bus_vectors mdp_720p_vectors[] = { |
| 9289 | /* 720p and less video */ |
| 9290 | { |
| 9291 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9292 | .dst = MSM_BUS_SLAVE_SMI, |
| 9293 | .ab = 471744000, |
| 9294 | .ib = 589680000, |
| 9295 | }, |
| 9296 | /* Master and slaves can be from different fabrics */ |
| 9297 | { |
| 9298 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9299 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9300 | .ab = 471744000, |
| 9301 | .ib = 589680000 * 2, |
| 9302 | }, |
| 9303 | }; |
| 9304 | |
| 9305 | static struct msm_bus_vectors mdp_1080p_vectors[] = { |
| 9306 | /* 1080p and less video */ |
| 9307 | { |
| 9308 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9309 | .dst = MSM_BUS_SLAVE_SMI, |
| 9310 | .ab = 575424000, |
| 9311 | .ib = 719280000, |
| 9312 | }, |
| 9313 | /* Master and slaves can be from different fabrics */ |
| 9314 | { |
| 9315 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9316 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9317 | .ab = 575424000, |
| 9318 | .ib = 719280000 * 2, |
| 9319 | }, |
| 9320 | }; |
| 9321 | |
| 9322 | #else |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9323 | static struct msm_bus_vectors mdp_sd_smi_vectors[] = { |
| 9324 | /* Default case static display/UI/2d/3d if FB SMI */ |
| 9325 | { |
| 9326 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9327 | .dst = MSM_BUS_SLAVE_SMI, |
| 9328 | .ab = 175110000, |
| 9329 | .ib = 218887500, |
| 9330 | }, |
| 9331 | /* Master and slaves can be from different fabrics */ |
| 9332 | { |
| 9333 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9334 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9335 | .ab = 0, |
| 9336 | .ib = 0, |
| 9337 | }, |
| 9338 | }; |
| 9339 | |
| 9340 | static struct msm_bus_vectors mdp_sd_ebi_vectors[] = { |
| 9341 | /* Default case static display/UI/2d/3d if FB SMI */ |
| 9342 | { |
| 9343 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9344 | .dst = MSM_BUS_SLAVE_SMI, |
| 9345 | .ab = 0, |
| 9346 | .ib = 0, |
| 9347 | }, |
| 9348 | /* Master and slaves can be from different fabrics */ |
| 9349 | { |
| 9350 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9351 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9352 | .ab = 216000000, |
| 9353 | .ib = 270000000 * 2, |
| 9354 | }, |
| 9355 | }; |
| 9356 | static struct msm_bus_vectors mdp_vga_vectors[] = { |
| 9357 | /* VGA and less video */ |
| 9358 | { |
| 9359 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9360 | .dst = MSM_BUS_SLAVE_SMI, |
| 9361 | .ab = 216000000, |
| 9362 | .ib = 270000000, |
| 9363 | }, |
| 9364 | { |
| 9365 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9366 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9367 | .ab = 216000000, |
| 9368 | .ib = 270000000 * 2, |
| 9369 | }, |
| 9370 | }; |
| 9371 | |
| 9372 | static struct msm_bus_vectors mdp_720p_vectors[] = { |
| 9373 | /* 720p and less video */ |
| 9374 | { |
| 9375 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9376 | .dst = MSM_BUS_SLAVE_SMI, |
| 9377 | .ab = 230400000, |
| 9378 | .ib = 288000000, |
| 9379 | }, |
| 9380 | /* Master and slaves can be from different fabrics */ |
| 9381 | { |
| 9382 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9383 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9384 | .ab = 230400000, |
| 9385 | .ib = 288000000 * 2, |
| 9386 | }, |
| 9387 | }; |
| 9388 | |
| 9389 | static struct msm_bus_vectors mdp_1080p_vectors[] = { |
| 9390 | /* 1080p and less video */ |
| 9391 | { |
| 9392 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9393 | .dst = MSM_BUS_SLAVE_SMI, |
| 9394 | .ab = 334080000, |
| 9395 | .ib = 417600000, |
| 9396 | }, |
| 9397 | /* Master and slaves can be from different fabrics */ |
| 9398 | { |
| 9399 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9400 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9401 | .ab = 334080000, |
Ravishangar Kalyanam | 731beb9 | 2011-07-07 18:27:32 -0700 | [diff] [blame] | 9402 | .ib = 550000000 * 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9403 | }, |
| 9404 | }; |
| 9405 | |
| 9406 | #endif |
| 9407 | static struct msm_bus_paths mdp_bus_scale_usecases[] = { |
| 9408 | { |
| 9409 | ARRAY_SIZE(mdp_init_vectors), |
| 9410 | mdp_init_vectors, |
| 9411 | }, |
| 9412 | { |
| 9413 | ARRAY_SIZE(mdp_sd_smi_vectors), |
| 9414 | mdp_sd_smi_vectors, |
| 9415 | }, |
| 9416 | { |
| 9417 | ARRAY_SIZE(mdp_sd_ebi_vectors), |
| 9418 | mdp_sd_ebi_vectors, |
| 9419 | }, |
| 9420 | { |
| 9421 | ARRAY_SIZE(mdp_vga_vectors), |
| 9422 | mdp_vga_vectors, |
| 9423 | }, |
| 9424 | { |
| 9425 | ARRAY_SIZE(mdp_720p_vectors), |
| 9426 | mdp_720p_vectors, |
| 9427 | }, |
| 9428 | { |
| 9429 | ARRAY_SIZE(mdp_1080p_vectors), |
| 9430 | mdp_1080p_vectors, |
| 9431 | }, |
| 9432 | }; |
| 9433 | static struct msm_bus_scale_pdata mdp_bus_scale_pdata = { |
| 9434 | mdp_bus_scale_usecases, |
| 9435 | ARRAY_SIZE(mdp_bus_scale_usecases), |
| 9436 | .name = "mdp", |
| 9437 | }; |
| 9438 | |
| 9439 | #endif |
| 9440 | #ifdef CONFIG_MSM_BUS_SCALING |
| 9441 | static struct msm_bus_vectors dtv_bus_init_vectors[] = { |
| 9442 | /* For now, 0th array entry is reserved. |
| 9443 | * Please leave 0 as is and don't use it |
| 9444 | */ |
| 9445 | { |
| 9446 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9447 | .dst = MSM_BUS_SLAVE_SMI, |
| 9448 | .ab = 0, |
| 9449 | .ib = 0, |
| 9450 | }, |
| 9451 | /* Master and slaves can be from different fabrics */ |
| 9452 | { |
| 9453 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9454 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9455 | .ab = 0, |
| 9456 | .ib = 0, |
| 9457 | }, |
| 9458 | }; |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 9459 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9460 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { |
| 9461 | /* For now, 0th array entry is reserved. |
| 9462 | * Please leave 0 as is and don't use it |
| 9463 | */ |
| 9464 | { |
| 9465 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9466 | .dst = MSM_BUS_SLAVE_SMI, |
| 9467 | .ab = 566092800, |
| 9468 | .ib = 707616000, |
| 9469 | }, |
| 9470 | /* Master and slaves can be from different fabrics */ |
| 9471 | { |
| 9472 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9473 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9474 | .ab = 566092800, |
| 9475 | .ib = 707616000, |
| 9476 | }, |
| 9477 | }; |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 9478 | |
| 9479 | static struct msm_bus_vectors dtv_bus_hdmi_prim_vectors[] = { |
| 9480 | /* For now, 0th array entry is reserved. |
| 9481 | * Please leave 0 as is and don't use it |
| 9482 | */ |
| 9483 | { |
| 9484 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9485 | .dst = MSM_BUS_SLAVE_SMI, |
| 9486 | .ab = 2000000000, |
| 9487 | .ib = 2000000000, |
| 9488 | }, |
| 9489 | /* Master and slaves can be from different fabrics */ |
| 9490 | { |
| 9491 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9492 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9493 | .ab = 2000000000, |
| 9494 | .ib = 2000000000, |
| 9495 | }, |
| 9496 | }; |
| 9497 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9498 | static struct msm_bus_paths dtv_bus_scale_usecases[] = { |
| 9499 | { |
| 9500 | ARRAY_SIZE(dtv_bus_init_vectors), |
| 9501 | dtv_bus_init_vectors, |
| 9502 | }, |
| 9503 | { |
| 9504 | ARRAY_SIZE(dtv_bus_def_vectors), |
| 9505 | dtv_bus_def_vectors, |
| 9506 | }, |
| 9507 | }; |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 9508 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9509 | static struct msm_bus_scale_pdata dtv_bus_scale_pdata = { |
| 9510 | dtv_bus_scale_usecases, |
| 9511 | ARRAY_SIZE(dtv_bus_scale_usecases), |
| 9512 | .name = "dtv", |
| 9513 | }; |
| 9514 | |
| 9515 | static struct lcdc_platform_data dtv_pdata = { |
| 9516 | .bus_scale_table = &dtv_bus_scale_pdata, |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 9517 | .lcdc_power_save = hdmi_panel_power, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9518 | }; |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 9519 | |
| 9520 | static struct msm_bus_paths dtv_hdmi_prim_bus_scale_usecases[] = { |
| 9521 | { |
| 9522 | ARRAY_SIZE(dtv_bus_init_vectors), |
| 9523 | dtv_bus_init_vectors, |
| 9524 | }, |
| 9525 | { |
| 9526 | ARRAY_SIZE(dtv_bus_hdmi_prim_vectors), |
| 9527 | dtv_bus_hdmi_prim_vectors, |
| 9528 | }, |
| 9529 | }; |
| 9530 | |
| 9531 | static struct msm_bus_scale_pdata dtv_hdmi_prim_bus_scale_pdata = { |
| 9532 | dtv_hdmi_prim_bus_scale_usecases, |
| 9533 | ARRAY_SIZE(dtv_hdmi_prim_bus_scale_usecases), |
| 9534 | .name = "dtv", |
| 9535 | }; |
| 9536 | |
| 9537 | static struct lcdc_platform_data dtv_hdmi_prim_pdata = { |
| 9538 | .bus_scale_table = &dtv_hdmi_prim_bus_scale_pdata, |
| 9539 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9540 | #endif |
| 9541 | |
| 9542 | |
| 9543 | static struct lcdc_platform_data lcdc_pdata = { |
| 9544 | .lcdc_power_save = lcdc_panel_power, |
| 9545 | }; |
| 9546 | |
| 9547 | |
| 9548 | #define MDP_VSYNC_GPIO 28 |
| 9549 | |
| 9550 | /* |
| 9551 | * MIPI_DSI only use 8058_LDO0 which need always on |
| 9552 | * therefore it need to be put at low power mode if |
| 9553 | * it was not used instead of turn it off. |
| 9554 | */ |
| 9555 | static int mipi_dsi_panel_power(int on) |
| 9556 | { |
| 9557 | int flag_on = !!on; |
| 9558 | static int mipi_dsi_power_save_on; |
| 9559 | static struct regulator *ldo0; |
| 9560 | int rc = 0; |
| 9561 | |
| 9562 | if (mipi_dsi_power_save_on == flag_on) |
| 9563 | return 0; |
| 9564 | |
| 9565 | mipi_dsi_power_save_on = flag_on; |
| 9566 | |
| 9567 | if (ldo0 == NULL) { /* init */ |
| 9568 | ldo0 = regulator_get(NULL, "8058_l0"); |
| 9569 | if (IS_ERR(ldo0)) { |
| 9570 | pr_debug("%s: LDO0 failed\n", __func__); |
| 9571 | rc = PTR_ERR(ldo0); |
| 9572 | return rc; |
| 9573 | } |
| 9574 | |
| 9575 | rc = regulator_set_voltage(ldo0, 1200000, 1200000); |
| 9576 | if (rc) |
| 9577 | goto out; |
| 9578 | |
| 9579 | rc = regulator_enable(ldo0); |
| 9580 | if (rc) |
| 9581 | goto out; |
| 9582 | } |
| 9583 | |
| 9584 | if (on) { |
| 9585 | /* set ldo0 to HPM */ |
| 9586 | rc = regulator_set_optimum_mode(ldo0, 100000); |
| 9587 | if (rc < 0) |
| 9588 | goto out; |
| 9589 | } else { |
| 9590 | /* set ldo0 to LPM */ |
Padmanabhan Komanduru | 0b478ff | 2011-11-22 19:15:40 +0530 | [diff] [blame] | 9591 | rc = regulator_set_optimum_mode(ldo0, 1000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9592 | if (rc < 0) |
| 9593 | goto out; |
| 9594 | } |
| 9595 | |
| 9596 | return 0; |
| 9597 | out: |
| 9598 | regulator_disable(ldo0); |
| 9599 | regulator_put(ldo0); |
| 9600 | ldo0 = NULL; |
| 9601 | return rc; |
| 9602 | } |
| 9603 | |
| 9604 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 9605 | .vsync_gpio = MDP_VSYNC_GPIO, |
| 9606 | .dsi_power_save = mipi_dsi_panel_power, |
| 9607 | }; |
| 9608 | |
| 9609 | #ifdef CONFIG_FB_MSM_TVOUT |
| 9610 | static struct regulator *reg_8058_l13; |
| 9611 | |
| 9612 | static int atv_dac_power(int on) |
| 9613 | { |
| 9614 | int rc = 0; |
| 9615 | #define _GET_REGULATOR(var, name) do { \ |
| 9616 | var = regulator_get(NULL, name); \ |
| 9617 | if (IS_ERR(var)) { \ |
| 9618 | pr_info("'%s' regulator not found, rc=%ld\n", \ |
| 9619 | name, IS_ERR(var)); \ |
| 9620 | var = NULL; \ |
| 9621 | return -ENODEV; \ |
| 9622 | } \ |
| 9623 | } while (0) |
| 9624 | |
| 9625 | if (!reg_8058_l13) |
| 9626 | _GET_REGULATOR(reg_8058_l13, "8058_l13"); |
| 9627 | #undef _GET_REGULATOR |
| 9628 | |
| 9629 | if (on) { |
| 9630 | rc = regulator_set_voltage(reg_8058_l13, 2050000, 2050000); |
| 9631 | if (rc) { |
| 9632 | pr_info("%s: '%s' regulator set voltage failed,\ |
| 9633 | rc=%d\n", __func__, "8058_l13", rc); |
| 9634 | return rc; |
| 9635 | } |
| 9636 | |
| 9637 | rc = regulator_enable(reg_8058_l13); |
| 9638 | if (rc) { |
| 9639 | pr_err("%s: '%s' regulator enable failed,\ |
| 9640 | rc=%d\n", __func__, "8058_l13", rc); |
| 9641 | return rc; |
| 9642 | } |
| 9643 | } else { |
| 9644 | rc = regulator_force_disable(reg_8058_l13); |
| 9645 | if (rc) |
| 9646 | pr_warning("%s: '%s' regulator disable failed, rc=%d\n", |
| 9647 | __func__, "8058_l13", rc); |
| 9648 | } |
| 9649 | return rc; |
| 9650 | |
| 9651 | } |
| 9652 | #endif |
| 9653 | |
| 9654 | #ifdef CONFIG_FB_MSM_MIPI_DSI |
| 9655 | int mdp_core_clk_rate_table[] = { |
| 9656 | 85330000, |
Huaibin Yang | 1f180ee | 2012-01-30 16:23:06 -0800 | [diff] [blame] | 9657 | 128000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9658 | 160000000, |
| 9659 | 200000000, |
| 9660 | }; |
| 9661 | #else |
| 9662 | int mdp_core_clk_rate_table[] = { |
| 9663 | 59080000, |
Huaibin Yang | 1f180ee | 2012-01-30 16:23:06 -0800 | [diff] [blame] | 9664 | 128000000, |
kuogee hsieh | 26791a9 | 2011-08-01 18:35:58 -0700 | [diff] [blame] | 9665 | 128000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9666 | 200000000, |
| 9667 | }; |
| 9668 | #endif |
| 9669 | |
| 9670 | static struct msm_panel_common_pdata mdp_pdata = { |
| 9671 | .gpio = MDP_VSYNC_GPIO, |
| 9672 | .mdp_core_clk_rate = 59080000, |
| 9673 | .mdp_core_clk_table = mdp_core_clk_rate_table, |
| 9674 | .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table), |
| 9675 | #ifdef CONFIG_MSM_BUS_SCALING |
| 9676 | .mdp_bus_scale_table = &mdp_bus_scale_pdata, |
| 9677 | #endif |
| 9678 | .mdp_rev = MDP_REV_41, |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 9679 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Ravishangar Kalyanam | a3b168b | 2012-03-26 11:13:11 -0700 | [diff] [blame] | 9680 | .mem_hid = BIT(ION_CP_WB_HEAP_ID), |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 9681 | #else |
| 9682 | .mem_hid = MEMTYPE_EBI1, |
| 9683 | #endif |
Olav Haugan | ef95ae3 | 2012-05-15 09:50:30 -0700 | [diff] [blame] | 9684 | .mdp_iommu_split_domain = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9685 | }; |
| 9686 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 9687 | static void __init reserve_mdp_memory(void) |
| 9688 | { |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 9689 | mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE; |
| 9690 | mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE; |
| 9691 | #if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 9692 | msm8x60_reserve_table[mdp_pdata.mem_hid].size += |
| 9693 | mdp_pdata.ov0_wb_size; |
| 9694 | msm8x60_reserve_table[mdp_pdata.mem_hid].size += |
| 9695 | mdp_pdata.ov1_wb_size; |
| 9696 | #endif |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 9697 | } |
| 9698 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9699 | #ifdef CONFIG_FB_MSM_TVOUT |
| 9700 | |
| 9701 | #ifdef CONFIG_MSM_BUS_SCALING |
| 9702 | static struct msm_bus_vectors atv_bus_init_vectors[] = { |
| 9703 | /* For now, 0th array entry is reserved. |
| 9704 | * Please leave 0 as is and don't use it |
| 9705 | */ |
| 9706 | { |
| 9707 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9708 | .dst = MSM_BUS_SLAVE_SMI, |
| 9709 | .ab = 0, |
| 9710 | .ib = 0, |
| 9711 | }, |
| 9712 | /* Master and slaves can be from different fabrics */ |
| 9713 | { |
| 9714 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9715 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9716 | .ab = 0, |
| 9717 | .ib = 0, |
| 9718 | }, |
| 9719 | }; |
| 9720 | static struct msm_bus_vectors atv_bus_def_vectors[] = { |
| 9721 | /* For now, 0th array entry is reserved. |
| 9722 | * Please leave 0 as is and don't use it |
| 9723 | */ |
| 9724 | { |
| 9725 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9726 | .dst = MSM_BUS_SLAVE_SMI, |
| 9727 | .ab = 236390400, |
| 9728 | .ib = 265939200, |
| 9729 | }, |
| 9730 | /* Master and slaves can be from different fabrics */ |
| 9731 | { |
| 9732 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 9733 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 9734 | .ab = 236390400, |
| 9735 | .ib = 265939200, |
| 9736 | }, |
| 9737 | }; |
| 9738 | static struct msm_bus_paths atv_bus_scale_usecases[] = { |
| 9739 | { |
| 9740 | ARRAY_SIZE(atv_bus_init_vectors), |
| 9741 | atv_bus_init_vectors, |
| 9742 | }, |
| 9743 | { |
| 9744 | ARRAY_SIZE(atv_bus_def_vectors), |
| 9745 | atv_bus_def_vectors, |
| 9746 | }, |
| 9747 | }; |
| 9748 | static struct msm_bus_scale_pdata atv_bus_scale_pdata = { |
| 9749 | atv_bus_scale_usecases, |
| 9750 | ARRAY_SIZE(atv_bus_scale_usecases), |
| 9751 | .name = "atv", |
| 9752 | }; |
| 9753 | #endif |
| 9754 | |
| 9755 | static struct tvenc_platform_data atv_pdata = { |
| 9756 | .poll = 0, |
| 9757 | .pm_vid_en = atv_dac_power, |
| 9758 | #ifdef CONFIG_MSM_BUS_SCALING |
| 9759 | .bus_scale_table = &atv_bus_scale_pdata, |
| 9760 | #endif |
| 9761 | }; |
| 9762 | #endif |
| 9763 | |
| 9764 | static void __init msm_fb_add_devices(void) |
| 9765 | { |
| 9766 | #ifdef CONFIG_FB_MSM_LCDC_DSUB |
| 9767 | mdp_pdata.mdp_core_clk_table = NULL; |
| 9768 | mdp_pdata.num_mdp_clk = 0; |
| 9769 | mdp_pdata.mdp_core_clk_rate = 200000000; |
| 9770 | #endif |
Syed Rameez Mustafa | e4a6f8e | 2012-07-09 15:25:13 -0700 | [diff] [blame] | 9771 | msm_fb_register_device("mdp", &mdp_pdata); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9772 | |
| 9773 | msm_fb_register_device("lcdc", &lcdc_pdata); |
| 9774 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
| 9775 | #ifdef CONFIG_MSM_BUS_SCALING |
Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 9776 | if (hdmi_is_primary) |
| 9777 | msm_fb_register_device("dtv", &dtv_hdmi_prim_pdata); |
| 9778 | else |
| 9779 | msm_fb_register_device("dtv", &dtv_pdata); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9780 | #endif |
| 9781 | #ifdef CONFIG_FB_MSM_TVOUT |
| 9782 | msm_fb_register_device("tvenc", &atv_pdata); |
| 9783 | msm_fb_register_device("tvout_device", NULL); |
| 9784 | #endif |
| 9785 | } |
| 9786 | |
Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 9787 | /** |
| 9788 | * Set MDP clocks to high frequency to avoid underflow when |
| 9789 | * using high resolution 1200x1920 WUXGA/HDMI as primary panels |
| 9790 | */ |
| 9791 | static void set_mdp_clocks_for_wuxga(void) |
| 9792 | { |
| 9793 | int i; |
| 9794 | |
| 9795 | mdp_sd_smi_vectors[0].ab = 2000000000; |
| 9796 | mdp_sd_smi_vectors[0].ib = 2000000000; |
| 9797 | mdp_sd_smi_vectors[1].ab = 2000000000; |
| 9798 | mdp_sd_smi_vectors[1].ib = 2000000000; |
| 9799 | |
| 9800 | mdp_sd_ebi_vectors[0].ab = 2000000000; |
| 9801 | mdp_sd_ebi_vectors[0].ib = 2000000000; |
| 9802 | mdp_sd_ebi_vectors[1].ab = 2000000000; |
| 9803 | mdp_sd_ebi_vectors[1].ib = 2000000000; |
| 9804 | |
| 9805 | mdp_vga_vectors[0].ab = 2000000000; |
| 9806 | mdp_vga_vectors[0].ib = 2000000000; |
| 9807 | mdp_vga_vectors[1].ab = 2000000000; |
| 9808 | mdp_vga_vectors[1].ib = 2000000000; |
| 9809 | |
| 9810 | mdp_720p_vectors[0].ab = 2000000000; |
| 9811 | mdp_720p_vectors[0].ib = 2000000000; |
| 9812 | mdp_720p_vectors[1].ab = 2000000000; |
| 9813 | mdp_720p_vectors[1].ib = 2000000000; |
| 9814 | |
| 9815 | mdp_1080p_vectors[0].ab = 2000000000; |
| 9816 | mdp_1080p_vectors[0].ib = 2000000000; |
| 9817 | mdp_1080p_vectors[1].ab = 2000000000; |
| 9818 | mdp_1080p_vectors[1].ib = 2000000000; |
| 9819 | |
| 9820 | mdp_pdata.mdp_core_clk_rate = 200000000; |
| 9821 | |
| 9822 | for (i = 0; i < ARRAY_SIZE(mdp_core_clk_rate_table); i++) |
| 9823 | mdp_core_clk_rate_table[i] = 200000000; |
| 9824 | } |
| 9825 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 9826 | #if (defined(CONFIG_MARIMBA_CORE)) && \ |
| 9827 | (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE)) |
| 9828 | |
| 9829 | static const struct { |
| 9830 | char *name; |
| 9831 | int vmin; |
| 9832 | int vmax; |
| 9833 | } bt_regs_info[] = { |
| 9834 | { "8058_s3", 1800000, 1800000 }, |
| 9835 | { "8058_s2", 1300000, 1300000 }, |
| 9836 | { "8058_l8", 2900000, 3050000 }, |
| 9837 | }; |
| 9838 | |
| 9839 | static struct { |
| 9840 | bool enabled; |
| 9841 | } bt_regs_status[] = { |
| 9842 | { false }, |
| 9843 | { false }, |
| 9844 | { false }, |
| 9845 | }; |
| 9846 | static struct regulator *bt_regs[ARRAY_SIZE(bt_regs_info)]; |
| 9847 | |
| 9848 | static int bahama_bt(int on) |
| 9849 | { |
| 9850 | int rc; |
| 9851 | int i; |
| 9852 | struct marimba config = { .mod_id = SLAVE_ID_BAHAMA}; |
| 9853 | |
| 9854 | struct bahama_variant_register { |
| 9855 | const size_t size; |
| 9856 | const struct bahama_config_register *set; |
| 9857 | }; |
| 9858 | |
| 9859 | const struct bahama_config_register *p; |
| 9860 | |
| 9861 | u8 version; |
| 9862 | |
| 9863 | const struct bahama_config_register v10_bt_on[] = { |
| 9864 | { 0xE9, 0x00, 0xFF }, |
| 9865 | { 0xF4, 0x80, 0xFF }, |
| 9866 | { 0xE4, 0x00, 0xFF }, |
| 9867 | { 0xE5, 0x00, 0x0F }, |
| 9868 | #ifdef CONFIG_WLAN |
| 9869 | { 0xE6, 0x38, 0x7F }, |
| 9870 | { 0xE7, 0x06, 0xFF }, |
| 9871 | #endif |
| 9872 | { 0xE9, 0x21, 0xFF }, |
| 9873 | { 0x01, 0x0C, 0x1F }, |
| 9874 | { 0x01, 0x08, 0x1F }, |
| 9875 | }; |
| 9876 | |
| 9877 | const struct bahama_config_register v20_bt_on_fm_off[] = { |
| 9878 | { 0x11, 0x0C, 0xFF }, |
| 9879 | { 0x13, 0x01, 0xFF }, |
| 9880 | { 0xF4, 0x80, 0xFF }, |
| 9881 | { 0xF0, 0x00, 0xFF }, |
| 9882 | { 0xE9, 0x00, 0xFF }, |
| 9883 | #ifdef CONFIG_WLAN |
| 9884 | { 0x81, 0x00, 0x7F }, |
| 9885 | { 0x82, 0x00, 0xFF }, |
| 9886 | { 0xE6, 0x38, 0x7F }, |
| 9887 | { 0xE7, 0x06, 0xFF }, |
| 9888 | #endif |
| 9889 | { 0xE9, 0x21, 0xFF }, |
| 9890 | }; |
| 9891 | |
| 9892 | const struct bahama_config_register v20_bt_on_fm_on[] = { |
| 9893 | { 0x11, 0x0C, 0xFF }, |
| 9894 | { 0x13, 0x01, 0xFF }, |
| 9895 | { 0xF4, 0x86, 0xFF }, |
| 9896 | { 0xF0, 0x06, 0xFF }, |
| 9897 | { 0xE9, 0x00, 0xFF }, |
| 9898 | #ifdef CONFIG_WLAN |
| 9899 | { 0x81, 0x00, 0x7F }, |
| 9900 | { 0x82, 0x00, 0xFF }, |
| 9901 | { 0xE6, 0x38, 0x7F }, |
| 9902 | { 0xE7, 0x06, 0xFF }, |
| 9903 | #endif |
| 9904 | { 0xE9, 0x21, 0xFF }, |
| 9905 | }; |
| 9906 | |
| 9907 | const struct bahama_config_register v10_bt_off[] = { |
| 9908 | { 0xE9, 0x00, 0xFF }, |
| 9909 | }; |
| 9910 | |
| 9911 | const struct bahama_config_register v20_bt_off_fm_off[] = { |
| 9912 | { 0xF4, 0x84, 0xFF }, |
| 9913 | { 0xF0, 0x04, 0xFF }, |
| 9914 | { 0xE9, 0x00, 0xFF } |
| 9915 | }; |
| 9916 | |
| 9917 | const struct bahama_config_register v20_bt_off_fm_on[] = { |
| 9918 | { 0xF4, 0x86, 0xFF }, |
| 9919 | { 0xF0, 0x06, 0xFF }, |
| 9920 | { 0xE9, 0x00, 0xFF } |
| 9921 | }; |
| 9922 | const struct bahama_variant_register bt_bahama[2][3] = { |
| 9923 | { |
| 9924 | { ARRAY_SIZE(v10_bt_off), v10_bt_off }, |
| 9925 | { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off }, |
| 9926 | { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on } |
| 9927 | }, |
| 9928 | { |
| 9929 | { ARRAY_SIZE(v10_bt_on), v10_bt_on }, |
| 9930 | { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off }, |
| 9931 | { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on } |
| 9932 | } |
| 9933 | }; |
| 9934 | |
| 9935 | u8 offset = 0; /* index into bahama configs */ |
| 9936 | |
| 9937 | on = on ? 1 : 0; |
| 9938 | version = read_bahama_ver(); |
| 9939 | |
| 9940 | if (version == VER_UNSUPPORTED) { |
| 9941 | dev_err(&msm_bt_power_device.dev, |
| 9942 | "%s: unsupported version\n", |
| 9943 | __func__); |
| 9944 | return -EIO; |
| 9945 | } |
| 9946 | |
| 9947 | if (version == VER_2_0) { |
| 9948 | if (marimba_get_fm_status(&config)) |
| 9949 | offset = 0x01; |
| 9950 | } |
| 9951 | |
| 9952 | /* Voting off 1.3V S2 Regulator,BahamaV2 used in Normal mode */ |
| 9953 | if (on && (version == VER_2_0)) { |
| 9954 | for (i = 0; i < ARRAY_SIZE(bt_regs_info); i++) { |
| 9955 | if ((!strcmp(bt_regs_info[i].name, "8058_s2")) |
| 9956 | && (bt_regs_status[i].enabled == true)) { |
| 9957 | if (regulator_disable(bt_regs[i])) { |
| 9958 | dev_err(&msm_bt_power_device.dev, |
| 9959 | "%s: regulator disable failed", |
| 9960 | __func__); |
| 9961 | } |
| 9962 | bt_regs_status[i].enabled = false; |
| 9963 | break; |
| 9964 | } |
| 9965 | } |
| 9966 | } |
| 9967 | |
| 9968 | p = bt_bahama[on][version + offset].set; |
| 9969 | |
| 9970 | dev_info(&msm_bt_power_device.dev, |
| 9971 | "%s: found version %d\n", __func__, version); |
| 9972 | |
| 9973 | for (i = 0; i < bt_bahama[on][version + offset].size; i++) { |
| 9974 | u8 value = (p+i)->value; |
| 9975 | rc = marimba_write_bit_mask(&config, |
| 9976 | (p+i)->reg, |
| 9977 | &value, |
| 9978 | sizeof((p+i)->value), |
| 9979 | (p+i)->mask); |
| 9980 | if (rc < 0) { |
| 9981 | dev_err(&msm_bt_power_device.dev, |
| 9982 | "%s: reg %d write failed: %d\n", |
| 9983 | __func__, (p+i)->reg, rc); |
| 9984 | return rc; |
| 9985 | } |
| 9986 | dev_dbg(&msm_bt_power_device.dev, |
| 9987 | "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n", |
| 9988 | __func__, (p+i)->reg, |
| 9989 | value, (p+i)->mask); |
| 9990 | } |
| 9991 | /* Update BT Status */ |
| 9992 | if (on) |
| 9993 | marimba_set_bt_status(&config, true); |
| 9994 | else |
| 9995 | marimba_set_bt_status(&config, false); |
| 9996 | |
| 9997 | return 0; |
| 9998 | } |
| 9999 | |
| 10000 | static int bluetooth_use_regulators(int on) |
| 10001 | { |
| 10002 | int i, recover = -1, rc = 0; |
| 10003 | |
| 10004 | for (i = 0; i < ARRAY_SIZE(bt_regs_info); i++) { |
| 10005 | bt_regs[i] = on ? regulator_get(&msm_bt_power_device.dev, |
| 10006 | bt_regs_info[i].name) : |
| 10007 | (regulator_put(bt_regs[i]), NULL); |
| 10008 | if (IS_ERR(bt_regs[i])) { |
| 10009 | rc = PTR_ERR(bt_regs[i]); |
| 10010 | dev_err(&msm_bt_power_device.dev, |
| 10011 | "regulator %s get failed (%d)\n", |
| 10012 | bt_regs_info[i].name, rc); |
| 10013 | recover = i - 1; |
| 10014 | bt_regs[i] = NULL; |
| 10015 | break; |
| 10016 | } |
| 10017 | |
| 10018 | if (!on) |
| 10019 | continue; |
| 10020 | |
| 10021 | rc = regulator_set_voltage(bt_regs[i], |
| 10022 | bt_regs_info[i].vmin, |
| 10023 | bt_regs_info[i].vmax); |
| 10024 | if (rc < 0) { |
| 10025 | dev_err(&msm_bt_power_device.dev, |
| 10026 | "regulator %s voltage set (%d)\n", |
| 10027 | bt_regs_info[i].name, rc); |
| 10028 | recover = i; |
| 10029 | break; |
| 10030 | } |
| 10031 | } |
| 10032 | |
| 10033 | if (on && (recover > -1)) |
| 10034 | for (i = recover; i >= 0; i--) { |
| 10035 | regulator_put(bt_regs[i]); |
| 10036 | bt_regs[i] = NULL; |
| 10037 | } |
| 10038 | |
| 10039 | return rc; |
| 10040 | } |
| 10041 | |
| 10042 | static int bluetooth_switch_regulators(int on) |
| 10043 | { |
| 10044 | int i, rc = 0; |
| 10045 | |
| 10046 | for (i = 0; i < ARRAY_SIZE(bt_regs_info); i++) { |
| 10047 | if (on && (bt_regs_status[i].enabled == false)) { |
| 10048 | rc = regulator_enable(bt_regs[i]); |
| 10049 | if (rc < 0) { |
| 10050 | dev_err(&msm_bt_power_device.dev, |
| 10051 | "regulator %s %s failed (%d)\n", |
| 10052 | bt_regs_info[i].name, |
| 10053 | "enable", rc); |
| 10054 | if (i > 0) { |
| 10055 | while (--i) { |
| 10056 | regulator_disable(bt_regs[i]); |
| 10057 | bt_regs_status[i].enabled |
| 10058 | = false; |
| 10059 | } |
| 10060 | break; |
| 10061 | } |
| 10062 | } |
| 10063 | bt_regs_status[i].enabled = true; |
| 10064 | } else if (!on && (bt_regs_status[i].enabled == true)) { |
| 10065 | rc = regulator_disable(bt_regs[i]); |
| 10066 | if (rc < 0) { |
| 10067 | dev_err(&msm_bt_power_device.dev, |
| 10068 | "regulator %s %s failed (%d)\n", |
| 10069 | bt_regs_info[i].name, |
| 10070 | "disable", rc); |
| 10071 | break; |
| 10072 | } |
| 10073 | bt_regs_status[i].enabled = false; |
| 10074 | } |
| 10075 | } |
| 10076 | return rc; |
| 10077 | } |
| 10078 | |
| 10079 | static struct msm_xo_voter *bt_clock; |
| 10080 | |
| 10081 | static int bluetooth_power(int on) |
| 10082 | { |
| 10083 | int rc = 0; |
| 10084 | int id; |
| 10085 | |
| 10086 | /* In case probe function fails, cur_connv_type would be -1 */ |
| 10087 | id = adie_get_detected_connectivity_type(); |
| 10088 | if (id != BAHAMA_ID) { |
| 10089 | pr_err("%s: unexpected adie connectivity type: %d\n", |
| 10090 | __func__, id); |
| 10091 | return -ENODEV; |
| 10092 | } |
| 10093 | |
| 10094 | if (on) { |
| 10095 | |
| 10096 | rc = bluetooth_use_regulators(1); |
| 10097 | if (rc < 0) |
| 10098 | goto out; |
| 10099 | |
| 10100 | rc = bluetooth_switch_regulators(1); |
| 10101 | |
| 10102 | if (rc < 0) |
| 10103 | goto fail_put; |
| 10104 | |
| 10105 | bt_clock = msm_xo_get(MSM_XO_TCXO_D0, "bt_power"); |
| 10106 | |
| 10107 | if (IS_ERR(bt_clock)) { |
| 10108 | pr_err("Couldn't get TCXO_D0 voter\n"); |
| 10109 | goto fail_switch; |
| 10110 | } |
| 10111 | |
| 10112 | rc = msm_xo_mode_vote(bt_clock, MSM_XO_MODE_ON); |
| 10113 | |
| 10114 | if (rc < 0) { |
| 10115 | pr_err("Failed to vote for TCXO_DO ON\n"); |
| 10116 | goto fail_vote; |
| 10117 | } |
| 10118 | |
| 10119 | rc = bahama_bt(1); |
| 10120 | |
| 10121 | if (rc < 0) |
| 10122 | goto fail_clock; |
| 10123 | |
| 10124 | msleep(10); |
| 10125 | |
| 10126 | rc = msm_xo_mode_vote(bt_clock, MSM_XO_MODE_PIN_CTRL); |
| 10127 | |
| 10128 | if (rc < 0) { |
| 10129 | pr_err("Failed to vote for TCXO_DO pin control\n"); |
| 10130 | goto fail_vote; |
| 10131 | } |
| 10132 | } else { |
| 10133 | /* check for initial RFKILL block (power off) */ |
| 10134 | /* some RFKILL versions/configurations rfkill_register */ |
| 10135 | /* calls here for an initial set_block */ |
| 10136 | /* avoid calling i2c and regulator before unblock (on) */ |
| 10137 | if (platform_get_drvdata(&msm_bt_power_device) == NULL) { |
| 10138 | dev_info(&msm_bt_power_device.dev, |
| 10139 | "%s: initialized OFF/blocked\n", __func__); |
| 10140 | goto out; |
| 10141 | } |
| 10142 | |
| 10143 | bahama_bt(0); |
| 10144 | |
| 10145 | fail_clock: |
| 10146 | msm_xo_mode_vote(bt_clock, MSM_XO_MODE_OFF); |
| 10147 | fail_vote: |
| 10148 | msm_xo_put(bt_clock); |
| 10149 | fail_switch: |
| 10150 | bluetooth_switch_regulators(0); |
| 10151 | fail_put: |
| 10152 | bluetooth_use_regulators(0); |
| 10153 | } |
| 10154 | |
| 10155 | out: |
| 10156 | if (rc < 0) |
| 10157 | on = 0; |
| 10158 | dev_info(&msm_bt_power_device.dev, |
| 10159 | "Bluetooth power switch: state %d result %d\n", on, rc); |
| 10160 | |
| 10161 | return rc; |
| 10162 | } |
| 10163 | |
| 10164 | #endif /*CONFIG_MARIMBA_CORE, CONFIG_MSM_BT_POWER, CONFIG_MSM_BT_POWER_MODULE*/ |
| 10165 | |
| 10166 | static void __init msm8x60_cfg_smsc911x(void) |
| 10167 | { |
| 10168 | smsc911x_resources[1].start = |
| 10169 | PM8058_GPIO_IRQ(PM8058_IRQ_BASE, 6); |
| 10170 | smsc911x_resources[1].end = |
| 10171 | PM8058_GPIO_IRQ(PM8058_IRQ_BASE, 6); |
| 10172 | } |
| 10173 | |
Laura Abbott | 5d2d1e6 | 2011-08-10 16:27:35 -0700 | [diff] [blame] | 10174 | void msm_fusion_setup_pinctrl(void) |
| 10175 | { |
| 10176 | struct msm_xo_voter *a1; |
| 10177 | |
| 10178 | if (socinfo_get_platform_subtype() == 0x3) { |
| 10179 | /* |
| 10180 | * Vote for the A1 clock to be in pin control mode before |
| 10181 | * the external images are loaded. |
| 10182 | */ |
| 10183 | a1 = msm_xo_get(MSM_XO_TCXO_A1, "mdm"); |
| 10184 | BUG_ON(!a1); |
| 10185 | msm_xo_mode_vote(a1, MSM_XO_MODE_PIN_CTRL); |
| 10186 | } |
| 10187 | } |
| 10188 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10189 | struct msm_board_data { |
| 10190 | struct msm_gpiomux_configs *gpiomux_cfgs; |
| 10191 | }; |
| 10192 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10193 | static struct msm_board_data msm8x60_surf_board_data __initdata = { |
| 10194 | .gpiomux_cfgs = msm8x60_surf_ffa_gpiomux_cfgs, |
| 10195 | }; |
| 10196 | |
| 10197 | static struct msm_board_data msm8x60_ffa_board_data __initdata = { |
| 10198 | .gpiomux_cfgs = msm8x60_surf_ffa_gpiomux_cfgs, |
| 10199 | }; |
| 10200 | |
| 10201 | static struct msm_board_data msm8x60_fluid_board_data __initdata = { |
| 10202 | .gpiomux_cfgs = msm8x60_fluid_gpiomux_cfgs, |
| 10203 | }; |
| 10204 | |
| 10205 | static struct msm_board_data msm8x60_charm_surf_board_data __initdata = { |
| 10206 | .gpiomux_cfgs = msm8x60_charm_gpiomux_cfgs, |
| 10207 | }; |
| 10208 | |
| 10209 | static struct msm_board_data msm8x60_charm_ffa_board_data __initdata = { |
| 10210 | .gpiomux_cfgs = msm8x60_charm_gpiomux_cfgs, |
| 10211 | }; |
| 10212 | |
Zhang Chang Ken | ef05b17 | 2011-07-27 15:28:13 -0400 | [diff] [blame] | 10213 | static struct msm_board_data msm8x60_dragon_board_data __initdata = { |
| 10214 | .gpiomux_cfgs = msm8x60_dragon_gpiomux_cfgs, |
| 10215 | }; |
| 10216 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10217 | static void __init msm8x60_init(struct msm_board_data *board_data) |
| 10218 | { |
| 10219 | uint32_t soc_platform_version; |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 10220 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 10221 | struct pm8xxx_mpp_config_data hsusb_phy_mpp = { |
| 10222 | .type = PM8XXX_MPP_TYPE_D_OUTPUT, |
| 10223 | .level = PM8901_MPP_DIG_LEVEL_L5, |
| 10224 | .control = PM8XXX_MPP_DOUT_CTRL_HIGH, |
| 10225 | }; |
| 10226 | #endif |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 10227 | pmic_reset_irq = PM8058_IRQ_BASE + PM8058_RESOUT_IRQ; |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 10228 | |
Rohit Vaswani | b1cc493 | 2012-07-23 21:30:11 -0700 | [diff] [blame] | 10229 | platform_device_register(&msm_gpio_device); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10230 | /* |
| 10231 | * Initialize RPM first as other drivers and devices may need |
| 10232 | * it for their initialization. |
| 10233 | */ |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 10234 | BUG_ON(msm_rpm_init(&msm8660_rpm_data)); |
| 10235 | BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10236 | if (msm_xo_init()) |
| 10237 | pr_err("Failed to initialize XO votes\n"); |
| 10238 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10239 | msm8x60_check_2d_hardware(); |
| 10240 | |
| 10241 | /* Change SPM handling of core 1 if PMM 8160 is present. */ |
| 10242 | soc_platform_version = socinfo_get_platform_version(); |
| 10243 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1 && |
| 10244 | SOCINFO_VERSION_MINOR(soc_platform_version) >= 2) { |
| 10245 | struct msm_spm_platform_data *spm_data; |
| 10246 | |
| 10247 | spm_data = &msm_spm_data_v1[1]; |
| 10248 | spm_data->reg_init_values[MSM_SPM_REG_SAW_CFG] &= ~0x0F00UL; |
| 10249 | spm_data->reg_init_values[MSM_SPM_REG_SAW_CFG] |= 0x0100UL; |
| 10250 | |
| 10251 | spm_data = &msm_spm_data[1]; |
| 10252 | spm_data->reg_init_values[MSM_SPM_REG_SAW_CFG] &= ~0x0F00UL; |
| 10253 | spm_data->reg_init_values[MSM_SPM_REG_SAW_CFG] |= 0x0100UL; |
| 10254 | } |
| 10255 | |
| 10256 | /* |
| 10257 | * Initialize SPM before acpuclock as the latter calls into SPM |
| 10258 | * driver to set ACPU voltages. |
| 10259 | */ |
| 10260 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) != 1) |
| 10261 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 10262 | else |
| 10263 | msm_spm_init(msm_spm_data_v1, ARRAY_SIZE(msm_spm_data_v1)); |
| 10264 | |
| 10265 | /* |
| 10266 | * Set regulators 8901_l4 and 8901_l6 to be always on in HPM for SURF |
| 10267 | * devices so that the RPM doesn't drop into a low power mode that an |
| 10268 | * un-reworked SURF cannot resume from. |
| 10269 | */ |
| 10270 | if (machine_is_msm8x60_surf()) { |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame] | 10271 | int i; |
| 10272 | |
| 10273 | for (i = 0; i < ARRAY_SIZE(rpm_regulator_init_data); i++) |
| 10274 | if (rpm_regulator_init_data[i].id |
| 10275 | == RPM_VREG_ID_PM8901_L4 |
| 10276 | || rpm_regulator_init_data[i].id |
| 10277 | == RPM_VREG_ID_PM8901_L6) |
| 10278 | rpm_regulator_init_data[i] |
| 10279 | .init_data.constraints.always_on = 1; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10280 | } |
| 10281 | |
| 10282 | /* |
| 10283 | * Disable regulator info printing so that regulator registration |
| 10284 | * messages do not enter the kmsg log. |
| 10285 | */ |
| 10286 | regulator_suppress_info_printing(); |
| 10287 | |
| 10288 | /* Initialize regulators needed for clock_init. */ |
| 10289 | platform_add_devices(early_regulators, ARRAY_SIZE(early_regulators)); |
| 10290 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 10291 | msm_clock_init(&msm8x60_clock_init_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10292 | |
| 10293 | /* Buses need to be initialized before early-device registration |
| 10294 | * to get the platform data for fabrics. |
| 10295 | */ |
| 10296 | msm8x60_init_buses(); |
| 10297 | platform_add_devices(early_devices, ARRAY_SIZE(early_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10298 | |
Terence Hampson | b36a38c | 2011-09-19 19:10:40 -0400 | [diff] [blame] | 10299 | /* |
| 10300 | * Enable EBI2 only for boards which make use of it. Leave |
| 10301 | * it disabled for all others for additional power savings. |
| 10302 | */ |
| 10303 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
Terence Hampson | b36a38c | 2011-09-19 19:10:40 -0400 | [diff] [blame] | 10304 | machine_is_msm8x60_fluid() || |
| 10305 | machine_is_msm8x60_dragon()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10306 | msm8x60_init_ebi2(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10307 | msm8x60_init_gpiomux(board_data->gpiomux_cfgs); |
| 10308 | msm8x60_init_uart12dm(); |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 10309 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
| 10310 | msm8x60_init_cam(); |
| 10311 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10312 | msm8x60_init_mmc(); |
| 10313 | |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 10314 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10315 | #if defined(CONFIG_PMIC8058_OTHC) || defined(CONFIG_PMIC8058_OTHC_MODULE) |
| 10316 | msm8x60_init_pm8058_othc(); |
| 10317 | #endif |
| 10318 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 10319 | if (machine_is_msm8x60_fluid()) |
| 10320 | pm8058_platform_data.keypad_pdata = &fluid_keypad_data; |
| 10321 | else if (machine_is_msm8x60_dragon()) |
| 10322 | pm8058_platform_data.keypad_pdata = &dragon_keypad_data; |
| 10323 | else |
| 10324 | pm8058_platform_data.keypad_pdata = &ffa_keypad_data; |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 10325 | #if !defined(CONFIG_MSM_CAMERA_V4L2) && defined(CONFIG_WEBCAM_OV9726) |
Jilai Wang | 53d27a8 | 2011-07-13 14:32:58 -0400 | [diff] [blame] | 10326 | /* Specify reset pin for OV9726 */ |
| 10327 | if (machine_is_msm8x60_dragon()) { |
| 10328 | msm_camera_sensor_ov9726_data.sensor_reset = 62; |
| 10329 | ov9726_sensor_8660_info.mount_angle = 270; |
| 10330 | } |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 10331 | #endif |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 10332 | #ifdef CONFIG_BATTERY_MSM8X60 |
| 10333 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
| 10334 | machine_is_msm8x60_fusion() || machine_is_msm8x60_dragon() || |
| 10335 | machine_is_msm8x60_fusn_ffa() || machine_is_msm8x60_fluid()) |
| 10336 | platform_device_register(&msm_charger_device); |
| 10337 | #endif |
| 10338 | |
| 10339 | if (machine_is_msm8x60_dragon()) |
| 10340 | pm8058_platform_data.charger_pdata = &pmic8058_charger_dragon; |
| 10341 | if (!machine_is_msm8x60_fluid()) |
| 10342 | pm8058_platform_data.charger_pdata = &pmic8058_charger_ffa_surf; |
| 10343 | |
| 10344 | /* configure pmic leds */ |
| 10345 | if (machine_is_msm8x60_fluid()) |
| 10346 | pm8058_platform_data.leds_pdata = &pm8058_fluid_flash_leds_data; |
| 10347 | else if (machine_is_msm8x60_dragon()) |
| 10348 | pm8058_platform_data.leds_pdata = &pm8058_dragon_leds_data; |
| 10349 | else |
| 10350 | pm8058_platform_data.leds_pdata = &pm8058_flash_leds_data; |
| 10351 | |
| 10352 | if (machine_is_msm8x60_ffa() || machine_is_msm8x60_fusn_ffa() || |
| 10353 | machine_is_msm8x60_dragon()) { |
| 10354 | pm8058_platform_data.vibrator_pdata = &pm8058_vib_pdata; |
| 10355 | } |
| 10356 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10357 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
| 10358 | machine_is_msm8x60_fluid() || machine_is_msm8x60_fusion() || |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 10359 | machine_is_msm8x60_fusn_ffa() || machine_is_msm8x60_dragon()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10360 | msm8x60_cfg_smsc911x(); |
| 10361 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) != 1) |
Matt Wagantall | 1f65d9d | 2012-04-25 14:24:20 -0700 | [diff] [blame] | 10362 | platform_add_devices(msm8660_footswitch, |
| 10363 | msm8660_num_footswitch); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10364 | platform_add_devices(surf_devices, |
| 10365 | ARRAY_SIZE(surf_devices)); |
| 10366 | |
| 10367 | #ifdef CONFIG_MSM_DSPS |
| 10368 | if (machine_is_msm8x60_fluid()) { |
| 10369 | platform_device_unregister(&msm_gsbi12_qup_i2c_device); |
| 10370 | msm8x60_init_dsps(); |
| 10371 | } |
| 10372 | #endif |
| 10373 | |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 10374 | pm8901_vreg_mpp0_init(); |
| 10375 | |
| 10376 | platform_device_register(&msm8x60_8901_mpp_vreg); |
| 10377 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10378 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 10379 | /* |
| 10380 | * Drive MPP2 pin HIGH for PHY to generate ID interrupts on 8660 |
| 10381 | * fluid |
| 10382 | */ |
Anirudh Ghayal | 9f77e96 | 2011-12-06 12:38:21 +0530 | [diff] [blame] | 10383 | if (machine_is_msm8x60_fluid()) |
| 10384 | pm8xxx_mpp_config(PM8901_MPP_PM_TO_SYS(1), &hsusb_phy_mpp); |
| 10385 | msm_add_host(0, &msm_usb_host_pdata); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10386 | #endif |
Lei Zhou | 338cab8 | 2011-08-19 13:38:17 -0400 | [diff] [blame] | 10387 | |
| 10388 | #ifdef CONFIG_SND_SOC_MSM8660_APQ |
| 10389 | if (machine_is_msm8x60_dragon()) |
| 10390 | platform_add_devices(dragon_alsa_devices, |
| 10391 | ARRAY_SIZE(dragon_alsa_devices)); |
| 10392 | else |
| 10393 | #endif |
| 10394 | platform_add_devices(asoc_devices, |
| 10395 | ARRAY_SIZE(asoc_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10396 | } |
| 10397 | #if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE) |
Zhang Chang Ken | 6baadf0 | 2011-08-05 09:48:15 -0400 | [diff] [blame] | 10398 | if (machine_is_msm8x60_surf() || machine_is_msm8x60_ffa() || |
| 10399 | machine_is_msm8x60_dragon()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10400 | msm8x60_cfg_isp1763(); |
| 10401 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10402 | |
| 10403 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) |
| 10404 | platform_add_devices(charm_devices, ARRAY_SIZE(charm_devices)); |
| 10405 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10406 | |
| 10407 | #if defined(CONFIG_SPI_QUP) || defined(CONFIG_SPI_QUP_MODULE) |
| 10408 | if (machine_is_msm8x60_fluid()) |
| 10409 | platform_device_register(&msm_gsbi10_qup_spi_device); |
| 10410 | else |
| 10411 | platform_device_register(&msm_gsbi1_qup_spi_device); |
| 10412 | #endif |
| 10413 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 10414 | #if defined(CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC) || \ |
| 10415 | defined(CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC_MODULE) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10416 | if (machine_is_msm8x60_fluid()) |
| 10417 | cyttsp_set_params(); |
| 10418 | #endif |
Syed Rameez Mustafa | e4a6f8e | 2012-07-09 15:25:13 -0700 | [diff] [blame] | 10419 | msm_fb_add_devices(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10420 | fixup_i2c_configs(); |
| 10421 | register_i2c_devices(); |
| 10422 | |
Terence Hampson | 1c73fef | 2011-07-19 17:10:49 -0400 | [diff] [blame] | 10423 | if (machine_is_msm8x60_dragon()) |
| 10424 | smsc911x_config.reset_gpio |
| 10425 | = GPIO_ETHERNET_RESET_N_DRAGON; |
| 10426 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10427 | platform_device_register(&smsc911x_device); |
| 10428 | |
| 10429 | #if (defined(CONFIG_SPI_QUP)) && \ |
| 10430 | (defined(CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT) || \ |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 10431 | defined(CONFIG_FB_MSM_LCDC_AUO_WVGA) || \ |
| 10432 | defined(CONFIG_FB_MSM_LCDC_NT35582_WVGA)) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10433 | |
| 10434 | if (machine_is_msm8x60_fluid()) { |
| 10435 | #ifdef CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT |
| 10436 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) < 3) { |
| 10437 | spi_register_board_info(lcdc_samsung_spi_board_info, |
| 10438 | ARRAY_SIZE(lcdc_samsung_spi_board_info)); |
| 10439 | } else |
| 10440 | #endif |
| 10441 | { |
| 10442 | #ifdef CONFIG_FB_MSM_LCDC_AUO_WVGA |
| 10443 | spi_register_board_info(lcdc_auo_spi_board_info, |
| 10444 | ARRAY_SIZE(lcdc_auo_spi_board_info)); |
| 10445 | #endif |
| 10446 | } |
Zhang Chang Ken | 3a8b851 | 2011-08-04 18:41:39 -0400 | [diff] [blame] | 10447 | #ifdef CONFIG_FB_MSM_LCDC_NT35582_WVGA |
| 10448 | } else if (machine_is_msm8x60_dragon()) { |
| 10449 | spi_register_board_info(lcdc_nt35582_spi_board_info, |
| 10450 | ARRAY_SIZE(lcdc_nt35582_spi_board_info)); |
| 10451 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10452 | } |
| 10453 | #endif |
| 10454 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 10455 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10456 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 10457 | pm8058_gpios_init(); |
| 10458 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10459 | #ifdef CONFIG_SENSORS_MSM_ADC |
| 10460 | if (machine_is_msm8x60_fluid()) { |
| 10461 | msm_adc_pdata.dev_names = msm_adc_fluid_device_names; |
| 10462 | msm_adc_pdata.num_adc = ARRAY_SIZE(msm_adc_fluid_device_names); |
| 10463 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) < 3) |
| 10464 | msm_adc_pdata.gpio_config = APROC_CONFIG; |
| 10465 | else |
| 10466 | msm_adc_pdata.gpio_config = MPROC_CONFIG; |
| 10467 | } |
| 10468 | msm_adc_pdata.target_hw = MSM_8x60; |
| 10469 | #endif |
| 10470 | #ifdef CONFIG_MSM8X60_AUDIO |
| 10471 | msm_snddev_init(); |
| 10472 | #endif |
| 10473 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 10474 | if (machine_is_msm8x60_fluid()) |
| 10475 | platform_device_register(&fluid_leds_gpio); |
| 10476 | else |
| 10477 | platform_device_register(&gpio_leds); |
| 10478 | #endif |
| 10479 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10480 | msm8x60_multi_sdio_init(); |
Laura Abbott | 5d2d1e6 | 2011-08-10 16:27:35 -0700 | [diff] [blame] | 10481 | |
| 10482 | if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) |
| 10483 | msm_fusion_setup_pinctrl(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10484 | } |
| 10485 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10486 | static void __init msm8x60_surf_init(void) |
| 10487 | { |
| 10488 | msm8x60_init(&msm8x60_surf_board_data); |
| 10489 | } |
| 10490 | |
| 10491 | static void __init msm8x60_ffa_init(void) |
| 10492 | { |
| 10493 | msm8x60_init(&msm8x60_ffa_board_data); |
| 10494 | } |
| 10495 | |
| 10496 | static void __init msm8x60_fluid_init(void) |
| 10497 | { |
| 10498 | msm8x60_init(&msm8x60_fluid_board_data); |
| 10499 | } |
| 10500 | |
| 10501 | static void __init msm8x60_charm_surf_init(void) |
| 10502 | { |
| 10503 | msm8x60_init(&msm8x60_charm_surf_board_data); |
| 10504 | } |
| 10505 | |
| 10506 | static void __init msm8x60_charm_ffa_init(void) |
| 10507 | { |
| 10508 | msm8x60_init(&msm8x60_charm_ffa_board_data); |
| 10509 | } |
| 10510 | |
| 10511 | static void __init msm8x60_charm_init_early(void) |
| 10512 | { |
| 10513 | msm8x60_allocate_memory_regions(); |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 10514 | } |
| 10515 | |
Zhang Chang Ken | ef05b17 | 2011-07-27 15:28:13 -0400 | [diff] [blame] | 10516 | static void __init msm8x60_dragon_init(void) |
| 10517 | { |
| 10518 | msm8x60_init(&msm8x60_dragon_board_data); |
| 10519 | } |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 10520 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10521 | MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF") |
| 10522 | .map_io = msm8x60_map_io, |
| 10523 | .reserve = msm8x60_reserve, |
| 10524 | .init_irq = msm8x60_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 10525 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10526 | .init_machine = msm8x60_surf_init, |
| 10527 | .timer = &msm_timer, |
| 10528 | .init_early = msm8x60_charm_init_early, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 10529 | .restart = msm_restart, |
Steve Muckle | 57bbf1c | 2010-01-07 12:51:10 -0800 | [diff] [blame] | 10530 | MACHINE_END |
Gregory Bean | 69b7f6f | 2010-04-04 22:29:02 -0700 | [diff] [blame] | 10531 | |
| 10532 | MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA") |
| 10533 | .map_io = msm8x60_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10534 | .reserve = msm8x60_reserve, |
Gregory Bean | 69b7f6f | 2010-04-04 22:29:02 -0700 | [diff] [blame] | 10535 | .init_irq = msm8x60_init_irq, |
Marc Zyngier | 041f777 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 10536 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10537 | .init_machine = msm8x60_ffa_init, |
Gregory Bean | 69b7f6f | 2010-04-04 22:29:02 -0700 | [diff] [blame] | 10538 | .timer = &msm_timer, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10539 | .init_early = msm8x60_charm_init_early, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 10540 | .restart = msm_restart, |
Gregory Bean | 69b7f6f | 2010-04-04 22:29:02 -0700 | [diff] [blame] | 10541 | MACHINE_END |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 10542 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10543 | MACHINE_START(MSM8X60_FLUID, "QCT MSM8X60 FLUID") |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 10544 | .map_io = msm8x60_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10545 | .reserve = msm8x60_reserve, |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 10546 | .init_irq = msm8x60_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 10547 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10548 | .init_machine = msm8x60_fluid_init, |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 10549 | .timer = &msm_timer, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10550 | .init_early = msm8x60_charm_init_early, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 10551 | .restart = msm_restart, |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame] | 10552 | MACHINE_END |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10553 | |
| 10554 | MACHINE_START(MSM8X60_FUSION, "QCT MSM8X60 FUSION SURF") |
| 10555 | .map_io = msm8x60_map_io, |
| 10556 | .reserve = msm8x60_reserve, |
| 10557 | .init_irq = msm8x60_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 10558 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10559 | .init_machine = msm8x60_charm_surf_init, |
| 10560 | .timer = &msm_timer, |
| 10561 | .init_early = msm8x60_charm_init_early, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 10562 | .restart = msm_restart, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10563 | MACHINE_END |
| 10564 | |
| 10565 | MACHINE_START(MSM8X60_FUSN_FFA, "QCT MSM8X60 FUSION FFA") |
| 10566 | .map_io = msm8x60_map_io, |
| 10567 | .reserve = msm8x60_reserve, |
| 10568 | .init_irq = msm8x60_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 10569 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 10570 | .init_machine = msm8x60_charm_ffa_init, |
| 10571 | .timer = &msm_timer, |
| 10572 | .init_early = msm8x60_charm_init_early, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 10573 | .restart = msm_restart, |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 10574 | MACHINE_END |
Zhang Chang Ken | ef05b17 | 2011-07-27 15:28:13 -0400 | [diff] [blame] | 10575 | |
| 10576 | MACHINE_START(MSM8X60_DRAGON, "QCT MSM8X60 DRAGON") |
| 10577 | .map_io = msm8x60_map_io, |
| 10578 | .reserve = msm8x60_reserve, |
| 10579 | .init_irq = msm8x60_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 10580 | .handle_irq = gic_handle_irq, |
Zhang Chang Ken | ef05b17 | 2011-07-27 15:28:13 -0400 | [diff] [blame] | 10581 | .init_machine = msm8x60_dragon_init, |
| 10582 | .timer = &msm_timer, |
| 10583 | .init_early = msm8x60_charm_init_early, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 10584 | .restart = msm_restart, |
Zhang Chang Ken | ef05b17 | 2011-07-27 15:28:13 -0400 | [diff] [blame] | 10585 | MACHINE_END |