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