blob: fd3da765293d414a40a0b733de7e260b649c2946 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
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 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070046#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049
50#include <mach/board.h>
51#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <mach/msm_spi.h>
53#ifdef CONFIG_USB_MSM_OTG_72K
54#include <mach/msm_hsusb.h>
55#else
56#include <linux/usb/msm_hsusb.h>
57#endif
58#include <linux/usb/android.h>
59#include <mach/usbdiag.h>
60#include <mach/socinfo.h>
61#include <mach/rpm.h>
62#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070063#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#include <mach/msm_bus_board.h>
65#include <mach/msm_memtypes.h>
66#include <mach/dma.h>
67#include <mach/msm_dsps.h>
68#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070069#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080070
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
Laura Abbottd6183792011-08-19 13:42:24 -070077#include <linux/ion.h>
78#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080079#include <mach/mdm2.h>
Laura Abbottd6183792011-08-19 13:42:24 -070080
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080082#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070084#include "spm.h"
85#include "board-msm8960.h"
86#include "pm.h"
87#include "cpuidle.h"
88#include "rpm_resources.h"
89#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070090#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070091#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070092#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060093#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070094#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095
Joel Kingb8352a12011-11-15 18:46:24 -080096#define PLATFORM_IS_CHARM25() \
97 (machine_is_msm8960_cdp() && \
98 (socinfo_get_platform_subtype() == 1) \
99 )
100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700101static struct platform_device msm_fm_platform_init = {
102 .name = "iris_fm",
103 .id = -1,
104};
105
106struct pm8xxx_gpio_init {
107 unsigned gpio;
108 struct pm_gpio config;
109};
110
111struct pm8xxx_mpp_init {
112 unsigned mpp;
113 struct pm8xxx_mpp_config_data config;
114};
115
116#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
117 _func, _inv, _disable) \
118{ \
119 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
120 .config = { \
121 .direction = _dir, \
122 .output_buffer = _buf, \
123 .output_value = _val, \
124 .pull = _pull, \
125 .vin_sel = _vin, \
126 .out_strength = _out_strength, \
127 .function = _func, \
128 .inv_int_pol = _inv, \
129 .disable_pin = _disable, \
130 } \
131}
132
133#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
134{ \
135 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
136 .config = { \
137 .type = PM8XXX_MPP_TYPE_##_type, \
138 .level = _level, \
139 .control = PM8XXX_MPP_##_control, \
140 } \
141}
142
143#define PM8XXX_GPIO_DISABLE(_gpio) \
144 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
145 0, 0, 0, 1)
146
147#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
148 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
149 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
150 PM_GPIO_STRENGTH_HIGH, \
151 PM_GPIO_FUNC_NORMAL, 0, 0)
152
153#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
154 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
155 _pull, PM_GPIO_VIN_S4, \
156 PM_GPIO_STRENGTH_NO, \
157 PM_GPIO_FUNC_NORMAL, 0, 0)
158
159#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
160 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
161 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
162 PM_GPIO_STRENGTH_HIGH, \
163 _func, 0, 0)
164
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200165#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
166 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
167 PM_GPIO_PULL_NO, _vin, \
168 PM_GPIO_STRENGTH_HIGH, \
169 PM_GPIO_FUNC_NORMAL, 0, 0)
170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700171/* Initial PM8921 GPIO configurations */
172static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
173 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
174 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
175 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300176 /* External regulator shared by display and touchscreen on LiQUID */
177 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200178 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700179 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700180 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700181 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700182 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530183 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184};
185
186/* Initial PM8921 MPP configurations */
187static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
188 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
189 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700190 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
191 DOUT_CTRL_LOW),
192};
193
194static void __init pm8921_gpio_mpp_init(void)
195{
196 int i, rc;
197
198 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
199 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
200 &pm8921_gpios[i].config);
201 if (rc) {
202 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
203 break;
204 }
205 }
206
207 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
208 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
209 &pm8921_mpps[i].config);
210 if (rc) {
211 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
212 break;
213 }
214 }
215}
216
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217#define KS8851_RST_GPIO 89
218#define KS8851_IRQ_GPIO 90
219
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700220#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
221enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700222 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700223 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
224 /* CAM Expander */
225 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
226 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
227 GPIO_CAM_GP_AFBUSY,
228 GPIO_CAM_GP_STROBE_CE,
229 GPIO_CAM_GP_CAM1MP_XCLR,
230 GPIO_CAM_GP_CAMIF_RESET_N,
231 GPIO_CAM_GP_XMT_FLASH_INT,
232 GPIO_CAM_GP_LED_EN1,
233 GPIO_CAM_GP_LED_EN2,
234
235};
236#endif
237
Harini Jayaraman608d0462011-08-09 19:10:03 -0600238/* The SPI configurations apply to GSBI 1*/
239static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700240 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700241 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242 .pull = GPIOMUX_PULL_NONE,
243};
244
Harini Jayaraman608d0462011-08-09 19:10:03 -0600245static struct gpiomux_setting spi_suspended_config = {
246 .func = GPIOMUX_FUNC_GPIO,
247 .drv = GPIOMUX_DRV_2MA,
248 .pull = GPIOMUX_PULL_DOWN,
249};
250
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700251static struct gpiomux_setting spi_active_config2 = {
252 .func = GPIOMUX_FUNC_2,
253 .drv = GPIOMUX_DRV_8MA,
254 .pull = GPIOMUX_PULL_NONE,
255};
256
257static struct gpiomux_setting spi_suspended_config2 = {
258 .func = GPIOMUX_FUNC_GPIO,
259 .drv = GPIOMUX_DRV_2MA,
260 .pull = GPIOMUX_PULL_UP,
261};
262
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530263static struct gpiomux_setting gsbi3_suspended_cfg = {
264 .func = GPIOMUX_FUNC_1,
265 .drv = GPIOMUX_DRV_2MA,
266 .pull = GPIOMUX_PULL_KEEPER,
267};
268
269static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_8MA,
272 .pull = GPIOMUX_PULL_NONE,
273};
274
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700275static struct gpiomux_setting gsbi5 = {
276 .func = GPIOMUX_FUNC_1,
277 .drv = GPIOMUX_DRV_8MA,
278 .pull = GPIOMUX_PULL_NONE,
279};
280
281static struct gpiomux_setting gsbi10 = {
282 .func = GPIOMUX_FUNC_2,
283 .drv = GPIOMUX_DRV_8MA,
284 .pull = GPIOMUX_PULL_NONE,
285};
286
287static struct gpiomux_setting gsbi12 = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_8MA,
290 .pull = GPIOMUX_PULL_NONE,
291};
292
293static struct gpiomux_setting cdc_mclk = {
294 .func = GPIOMUX_FUNC_1,
295 .drv = GPIOMUX_DRV_8MA,
296 .pull = GPIOMUX_PULL_NONE,
297};
298
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700299static struct gpiomux_setting audio_auxpcm[] = {
300 /* Suspended state */
301 {
302 .func = GPIOMUX_FUNC_GPIO,
303 .drv = GPIOMUX_DRV_2MA,
304 .pull = GPIOMUX_PULL_NONE,
305 },
306 /* Active state */
307 {
308 .func = GPIOMUX_FUNC_1,
309 .drv = GPIOMUX_DRV_2MA,
310 .pull = GPIOMUX_PULL_NONE,
311 },
312};
313
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700314#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315static struct gpiomux_setting gpio_eth_config = {
316 .pull = GPIOMUX_PULL_NONE,
317 .drv = GPIOMUX_DRV_8MA,
318 .func = GPIOMUX_FUNC_GPIO,
319};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700320#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700321
322static struct gpiomux_setting slimbus = {
323 .func = GPIOMUX_FUNC_1,
324 .drv = GPIOMUX_DRV_8MA,
325 .pull = GPIOMUX_PULL_KEEPER,
326};
327
328struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700329#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 {
331 .gpio = KS8851_IRQ_GPIO,
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
334 }
335 },
336 {
337 .gpio = KS8851_RST_GPIO,
338 .settings = {
339 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
340 }
341 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700342#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343};
344
345static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
346 {
347 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
348 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600349 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
350 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700351 },
352 },
353 {
354 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
355 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600356 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
357 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 },
359 },
360 {
361 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
362 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600363 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
364 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365 },
366 },
367 {
368 .gpio = 9, /* GSBI1 QUP SPI_CLK */
369 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600370 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
371 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700372 },
373 },
374 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700375 .gpio = 14, /* GSBI1 SPI_CS_1 */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
378 [GPIOMUX_ACTIVE] = &spi_active_config2,
379 },
380 },
381 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700382 .gpio = 16, /* GSBI3 I2C QUP SDA */
383 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530384 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
385 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700386 },
387 },
388 {
389 .gpio = 17, /* GSBI3 I2C QUP SCL */
390 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530391 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
392 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700393 },
394 },
395 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396 .gpio = 22, /* GSBI5 UART2 */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi5,
399 },
400 },
401 {
402 .gpio = 23, /* GSBI5 UART2 */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi5,
405 },
406 },
407 {
408 .gpio = 24, /* GSBI5 UART2 */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi5,
411 },
412 },
413 {
414 .gpio = 25, /* GSBI5 UART2 */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi5,
417 },
418 },
419 {
420 .gpio = 44, /* GSBI12 I2C QUP SDA */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi12,
423 },
424 },
425 {
426 .gpio = 45, /* GSBI12 I2C QUP SCL */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &gsbi12,
429 },
430 },
431 {
432 .gpio = 73, /* GSBI10 I2C QUP SDA */
433 .settings = {
434 [GPIOMUX_SUSPENDED] = &gsbi10,
435 },
436 },
437 {
438 .gpio = 74, /* GSBI10 I2C QUP SCL */
439 .settings = {
440 [GPIOMUX_SUSPENDED] = &gsbi10,
441 },
442 },
443};
444
445static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
446 {
447 .gpio = 60, /* slimbus data */
448 .settings = {
449 [GPIOMUX_SUSPENDED] = &slimbus,
450 },
451 },
452 {
453 .gpio = 61, /* slimbus clk */
454 .settings = {
455 [GPIOMUX_SUSPENDED] = &slimbus,
456 },
457 },
458};
459
460static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
461 {
462 .gpio = 59,
463 .settings = {
464 [GPIOMUX_SUSPENDED] = &cdc_mclk,
465 },
466 },
467};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700468
469static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
470 {
471 .gpio = 63,
472 .settings = {
473 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
474 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
475 },
476 },
477 {
478 .gpio = 64,
479 .settings = {
480 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
481 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
482 },
483 },
484 {
485 .gpio = 65,
486 .settings = {
487 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
488 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
489 },
490 },
491 {
492 .gpio = 66,
493 .settings = {
494 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
495 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
496 },
497 },
498};
499
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700500static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
501 .func = GPIOMUX_FUNC_GPIO,
502 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700503 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504};
505
506static struct gpiomux_setting wcnss_5wire_active_cfg = {
507 .func = GPIOMUX_FUNC_1,
508 .drv = GPIOMUX_DRV_6MA,
509 .pull = GPIOMUX_PULL_DOWN,
510};
511
512static struct msm_gpiomux_config wcnss_5wire_interface[] = {
513 {
514 .gpio = 84,
515 .settings = {
516 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
517 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
518 },
519 },
520 {
521 .gpio = 85,
522 .settings = {
523 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
524 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
525 },
526 },
527 {
528 .gpio = 86,
529 .settings = {
530 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
531 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
532 },
533 },
534 {
535 .gpio = 87,
536 .settings = {
537 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
538 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
539 },
540 },
541 {
542 .gpio = 88,
543 .settings = {
544 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
545 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
546 },
547 },
548};
Nishant Pandit24153d82011-08-27 16:05:13 +0530549static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530550 {
551 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_DOWN,
554 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700555
Nishant Pandit474f2252011-07-23 23:17:56 +0530556 {
557 .func = GPIOMUX_FUNC_1, /*active 1*/
558 .drv = GPIOMUX_DRV_2MA,
559 .pull = GPIOMUX_PULL_NONE,
560 },
561
562 {
563 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
564 .drv = GPIOMUX_DRV_2MA,
565 .pull = GPIOMUX_PULL_NONE,
566 },
567
568 {
569 .func = GPIOMUX_FUNC_1, /*active 3*/
570 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700571 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530572 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530573
574 {
575 .func = GPIOMUX_FUNC_5, /*active 4*/
576 .drv = GPIOMUX_DRV_8MA,
577 .pull = GPIOMUX_PULL_UP,
578 },
579
580 {
581 .func = GPIOMUX_FUNC_6, /*active 5*/
582 .drv = GPIOMUX_DRV_8MA,
583 .pull = GPIOMUX_PULL_UP,
584 },
585
586 {
587 .func = GPIOMUX_FUNC_2, /*active 6*/
588 .drv = GPIOMUX_DRV_2MA,
589 .pull = GPIOMUX_PULL_UP,
590 },
591
592 {
593 .func = GPIOMUX_FUNC_3, /*active 7*/
594 .drv = GPIOMUX_DRV_8MA,
595 .pull = GPIOMUX_PULL_UP,
596 },
597
Kevin Chan4c58d292011-09-13 11:03:25 -0700598 {
599 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
600 .drv = GPIOMUX_DRV_2MA,
601 .pull = GPIOMUX_PULL_KEEPER,
602 },
603
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700604};
605
Nishant Pandit24153d82011-08-27 16:05:13 +0530606static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700607 {
608 .gpio = 2,
609 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530610 [GPIOMUX_ACTIVE] = &cam_settings[2],
611 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700612 },
613 },
614 {
615 .gpio = 3,
616 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530617 [GPIOMUX_ACTIVE] = &cam_settings[1],
618 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700619 },
620 },
621 {
622 .gpio = 4,
623 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530624 [GPIOMUX_ACTIVE] = &cam_settings[1],
625 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700626 },
627 },
628 {
629 .gpio = 5,
630 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530631 [GPIOMUX_ACTIVE] = &cam_settings[1],
632 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700633 },
634 },
635 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530636 .gpio = 76,
637 .settings = {
638 [GPIOMUX_ACTIVE] = &cam_settings[2],
639 [GPIOMUX_SUSPENDED] = &cam_settings[0],
640 },
641 },
642 {
643 .gpio = 107,
644 .settings = {
645 [GPIOMUX_ACTIVE] = &cam_settings[2],
646 [GPIOMUX_SUSPENDED] = &cam_settings[0],
647 },
648 },
649};
650
651static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
652 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653 .gpio = 18,
654 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530655 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700656 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700657 },
658 },
659 {
660 .gpio = 19,
661 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530662 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700663 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700664 },
665 },
666 {
667 .gpio = 20,
668 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530669 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700670 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700671 },
672 },
673 {
674 .gpio = 21,
675 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530676 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700677 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678 },
679 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680};
681
682static struct gpiomux_setting cyts_resout_sus_cfg = {
683 .func = GPIOMUX_FUNC_GPIO,
684 .drv = GPIOMUX_DRV_6MA,
685 .pull = GPIOMUX_PULL_UP,
686};
687
688static struct gpiomux_setting cyts_resout_act_cfg = {
689 .func = GPIOMUX_FUNC_GPIO,
690 .drv = GPIOMUX_DRV_6MA,
691 .pull = GPIOMUX_PULL_UP,
692};
693
694static struct gpiomux_setting cyts_sleep_sus_cfg = {
695 .func = GPIOMUX_FUNC_GPIO,
696 .drv = GPIOMUX_DRV_6MA,
697 .pull = GPIOMUX_PULL_DOWN,
698};
699
700static struct gpiomux_setting cyts_sleep_act_cfg = {
701 .func = GPIOMUX_FUNC_GPIO,
702 .drv = GPIOMUX_DRV_6MA,
703 .pull = GPIOMUX_PULL_DOWN,
704};
705
706static struct gpiomux_setting cyts_int_act_cfg = {
707 .func = GPIOMUX_FUNC_GPIO,
708 .drv = GPIOMUX_DRV_8MA,
709 .pull = GPIOMUX_PULL_UP,
710};
711
712static struct gpiomux_setting cyts_int_sus_cfg = {
713 .func = GPIOMUX_FUNC_GPIO,
714 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530715 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700716};
717
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700718static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
719 { /* TS INTERRUPT */
720 .gpio = 11,
721 .settings = {
722 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
723 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
724 },
725 },
726 { /* TS SLEEP */
727 .gpio = 50,
728 .settings = {
729 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
730 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
731 },
732 },
733 { /* TS RESOUT */
734 .gpio = 52,
735 .settings = {
736 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
737 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
738 },
739 },
740};
741
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530742#ifdef CONFIG_USB_EHCI_MSM_HSIC
743static struct gpiomux_setting hsic_act_cfg = {
744 .func = GPIOMUX_FUNC_1,
745 .drv = GPIOMUX_DRV_12MA,
746 .pull = GPIOMUX_PULL_NONE,
747};
748
749static struct gpiomux_setting hsic_sus_cfg = {
750 .func = GPIOMUX_FUNC_GPIO,
751 .drv = GPIOMUX_DRV_2MA,
752 .pull = GPIOMUX_PULL_DOWN,
Vamsi Krishnaf0f7f712011-11-17 18:15:07 -0800753 .dir = GPIOMUX_OUT_LOW,
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530754};
755
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530756static struct gpiomux_setting hsic_hub_act_cfg = {
757 .func = GPIOMUX_FUNC_GPIO,
758 .drv = GPIOMUX_DRV_2MA,
759 .pull = GPIOMUX_PULL_NONE,
760};
761
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530762static struct msm_gpiomux_config msm8960_hsic_configs[] = {
763 {
764 .gpio = 150, /*HSIC_STROBE */
765 .settings = {
766 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
767 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
768 },
769 },
770 {
771 .gpio = 151, /* HSIC_DATA */
772 .settings = {
773 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
774 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
775 },
776 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530777 {
778 .gpio = 91, /* HSIC_HUB_RESET */
779 .settings = {
780 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
781 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
782 },
783 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530784};
785#endif
786
Mohan Pallaka5e490392011-09-09 15:18:41 +0530787#define HAP_SHIFT_LVL_OE_GPIO 47
788
789static struct gpiomux_setting hap_lvl_shft_suspended_config = {
790 .func = GPIOMUX_FUNC_GPIO,
791 .drv = GPIOMUX_DRV_2MA,
792 .pull = GPIOMUX_PULL_DOWN,
793};
794
795static struct gpiomux_setting hap_lvl_shft_active_config = {
796 .func = GPIOMUX_FUNC_GPIO,
797 .drv = GPIOMUX_DRV_8MA,
798 .pull = GPIOMUX_PULL_UP,
799};
800
801static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
802 {
803 .gpio = HAP_SHIFT_LVL_OE_GPIO,
804 .settings = {
805 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
806 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
807 },
808 },
809};
810
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700811#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
812enum {
813 SX150X_CAM,
814};
815
Nishant Pandit474f2252011-07-23 23:17:56 +0530816static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700817 [SX150X_CAM] = {
818 .gpio_base = GPIO_CAM_EXPANDER_BASE,
819 .oscio_is_gpo = false,
820 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530821 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700822 .io_open_drain_ena = 0x0,
823 .irq_summary = -1,
824 },
825};
Nishant Pandit474f2252011-07-23 23:17:56 +0530826
827#endif
828
829#ifdef CONFIG_I2C
830
831#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
832#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300833#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530834
835#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
836
837static struct i2c_board_info cam_expander_i2c_info[] = {
838 {
839 I2C_BOARD_INFO("sx1508q", 0x22),
840 .platform_data = &sx150x_data[SX150X_CAM]
841 },
842};
843
844static struct msm_cam_expander_info cam_expander_info[] = {
845 {
846 cam_expander_i2c_info,
847 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
848 },
849};
850#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700851#endif
852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700854#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700855#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
856#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
857#else
Chetan Kalyana25d0762011-11-11 17:41:29 -0800858#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700859#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700860
861
862#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700863#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
864#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700865#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
866#define MSM_ION_HEAP_NUM 4
867#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700868#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700869#define MSM_ION_HEAP_NUM 2
870#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700871
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700872#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
873static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
874static int __init pmem_kernel_ebi1_size_setup(char *p)
875{
876 pmem_kernel_ebi1_size = memparse(p, NULL);
877 return 0;
878}
879early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
880#endif
881
882#ifdef CONFIG_ANDROID_PMEM
883static unsigned pmem_size = MSM_PMEM_SIZE;
884static int __init pmem_size_setup(char *p)
885{
886 pmem_size = memparse(p, NULL);
887 return 0;
888}
889early_param("pmem_size", pmem_size_setup);
890
891static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
892
893static int __init pmem_adsp_size_setup(char *p)
894{
895 pmem_adsp_size = memparse(p, NULL);
896 return 0;
897}
898early_param("pmem_adsp_size", pmem_adsp_size_setup);
899
900static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
901
902static int __init pmem_audio_size_setup(char *p)
903{
904 pmem_audio_size = memparse(p, NULL);
905 return 0;
906}
907early_param("pmem_audio_size", pmem_audio_size_setup);
908#endif
909
910#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700911#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700912static struct android_pmem_platform_data android_pmem_pdata = {
913 .name = "pmem",
914 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
915 .cached = 1,
916 .memory_type = MEMTYPE_EBI1,
917};
918
919static struct platform_device android_pmem_device = {
920 .name = "android_pmem",
921 .id = 0,
922 .dev = {.platform_data = &android_pmem_pdata},
923};
924
925static struct android_pmem_platform_data android_pmem_adsp_pdata = {
926 .name = "pmem_adsp",
927 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
928 .cached = 0,
929 .memory_type = MEMTYPE_EBI1,
930};
931static struct platform_device android_pmem_adsp_device = {
932 .name = "android_pmem",
933 .id = 2,
934 .dev = { .platform_data = &android_pmem_adsp_pdata },
935};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700936#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937
938static struct android_pmem_platform_data android_pmem_audio_pdata = {
939 .name = "pmem_audio",
940 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
941 .cached = 0,
942 .memory_type = MEMTYPE_EBI1,
943};
944
945static struct platform_device android_pmem_audio_device = {
946 .name = "android_pmem",
947 .id = 4,
948 .dev = { .platform_data = &android_pmem_audio_pdata },
949};
950#endif
951
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700952#define DSP_RAM_BASE_8960 0x8da00000
953#define DSP_RAM_SIZE_8960 0x1800000
954static int dspcrashd_pdata_8960 = 0xDEADDEAD;
955
956static struct resource resources_dspcrashd_8960[] = {
957 {
958 .name = "msm_dspcrashd",
959 .start = DSP_RAM_BASE_8960,
960 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
961 .flags = IORESOURCE_DMA,
962 },
963};
964
965struct platform_device msm_device_dspcrashd_8960 = {
966 .name = "msm_dspcrashd",
967 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
968 .resource = resources_dspcrashd_8960,
969 .dev = { .platform_data = &dspcrashd_pdata_8960 },
970};
971
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700972static struct memtype_reserve msm8960_reserve_table[] __initdata = {
973 [MEMTYPE_SMI] = {
974 },
975 [MEMTYPE_EBI0] = {
976 .flags = MEMTYPE_FLAGS_1M_ALIGN,
977 },
978 [MEMTYPE_EBI1] = {
979 .flags = MEMTYPE_FLAGS_1M_ALIGN,
980 },
981};
982
983static void __init size_pmem_devices(void)
984{
985#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700986#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700987 android_pmem_adsp_pdata.size = pmem_adsp_size;
988 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700989#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700990 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
991#endif
992}
993
994static void __init reserve_memory_for(struct android_pmem_platform_data *p)
995{
996 msm8960_reserve_table[p->memory_type].size += p->size;
997}
998
999static void __init reserve_pmem_memory(void)
1000{
1001#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001002#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001003 reserve_memory_for(&android_pmem_adsp_pdata);
1004 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -07001005#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001006 reserve_memory_for(&android_pmem_audio_pdata);
1007 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1008#endif
1009}
1010
Larry Basselb4126da2011-07-18 14:31:33 -07001011static int msm8960_paddr_to_memtype(unsigned int paddr)
1012{
1013 return MEMTYPE_EBI1;
1014}
1015
Laura Abbottd6183792011-08-19 13:42:24 -07001016#ifdef CONFIG_ION_MSM
1017struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001018 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001019 .heaps = {
1020 {
1021 .id = ION_HEAP_SYSTEM_ID,
1022 .type = ION_HEAP_TYPE_SYSTEM,
1023 .name = ION_KMALLOC_HEAP_NAME,
1024 },
1025 {
1026 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1027 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1028 .name = ION_VMALLOC_HEAP_NAME,
1029 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001030#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001031 {
1032 .id = ION_HEAP_EBI_ID,
1033 .type = ION_HEAP_TYPE_CARVEOUT,
1034 .name = ION_EBI1_HEAP_NAME,
1035 .size = MSM_ION_EBI_SIZE,
1036 .memory_type = ION_EBI_TYPE,
1037 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001038 {
1039 .id = ION_HEAP_ADSP_ID,
1040 .type = ION_HEAP_TYPE_CARVEOUT,
1041 .name = ION_ADSP_HEAP_NAME,
1042 .size = MSM_ION_ADSP_SIZE,
1043 .memory_type = ION_EBI_TYPE,
1044 },
1045#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001046 }
1047};
1048
1049struct platform_device ion_dev = {
1050 .name = "ion-msm",
1051 .id = 1,
1052 .dev = { .platform_data = &ion_pdata },
1053};
1054#endif
1055
1056static void reserve_ion_memory(void)
1057{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001058#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001059 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001060 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001061#endif
1062}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063static void __init msm8960_calculate_reserve_sizes(void)
1064{
1065 size_pmem_devices();
1066 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001067 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001068}
1069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070static struct reserve_info msm8960_reserve_info __initdata = {
1071 .memtype_reserve_table = msm8960_reserve_table,
1072 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1073 .paddr_to_memtype = msm8960_paddr_to_memtype,
1074};
1075
Larry Basselb4126da2011-07-18 14:31:33 -07001076static int msm8960_memory_bank_size(void)
1077{
1078 return 1<<29;
1079}
1080
1081static void __init locate_unstable_memory(void)
1082{
1083 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1084 unsigned long bank_size;
1085 unsigned long low, high;
1086
1087 bank_size = msm8960_memory_bank_size();
1088 low = meminfo.bank[0].start;
1089 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -07001090
1091 /* Check if 32 bit overflow occured */
1092 if (high < mb->start)
1093 high = ~0UL;
1094
Larry Basselb4126da2011-07-18 14:31:33 -07001095 low &= ~(bank_size - 1);
1096
1097 if (high - low <= bank_size)
1098 return;
1099 msm8960_reserve_info.low_unstable_address = low + bank_size;
Olav Haugan62052e42011-10-28 14:28:32 -07001100 /* To avoid overflow of u32 compute max_unstable_size
1101 * by first subtracting low from mb->start)
1102 * */
1103 msm8960_reserve_info.max_unstable_size = (mb->start - low) +
1104 mb->size - bank_size;
1105
Larry Basselb4126da2011-07-18 14:31:33 -07001106 msm8960_reserve_info.bank_size = bank_size;
1107 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1108 msm8960_reserve_info.low_unstable_address,
1109 msm8960_reserve_info.max_unstable_size,
1110 msm8960_reserve_info.bank_size);
1111}
1112
Larry Basselb830e182011-10-14 10:46:55 -07001113static void __init place_movable_zone(void)
1114{
1115 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1116 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1117 pr_info("movable zone start %lx size %lx\n",
1118 movable_reserved_start, movable_reserved_size);
1119}
1120
1121static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001122{
1123 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001124 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001125 place_movable_zone();
1126}
1127
1128static void __init msm8960_reserve(void)
1129{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001130 msm_reserve();
1131}
1132
Larry Bassela4414b12011-08-04 11:11:02 -07001133static int msm8960_change_memory_power(u64 start, u64 size,
1134 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001135{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001136 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001137}
1138
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001139#ifdef CONFIG_MSM_CAMERA
1140
Nishant Pandit24153d82011-08-27 16:05:13 +05301141static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001142 5, /*CAMIF_MCLK*/
1143 20, /*CAMIF_I2C_DATA*/
1144 21, /*CAMIF_I2C_CLK*/
1145};
1146
Nishant Pandit24153d82011-08-27 16:05:13 +05301147static struct msm_camera_gpio_conf gpio_conf = {
1148 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1149 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1150 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1151 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1152};
1153
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001154#define VFE_CAMIF_TIMER1_GPIO 2
1155#define VFE_CAMIF_TIMER2_GPIO 3
1156#define VFE_CAMIF_TIMER3_GPIO_INT 4
1157struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1158 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1159 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1160 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1161 .flash_recharge_duration = 50000,
1162 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1163};
1164
Nishant Pandit474f2252011-07-23 23:17:56 +05301165#ifdef CONFIG_MSM_CAMERA_FLASH
1166static struct msm_camera_sensor_flash_src msm_flash_src = {
1167 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1168 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1169 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1170#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1171 defined(CONFIG_GPIO_SX150X_MODULE))
1172 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1173#endif
1174};
1175#endif
1176
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001177static struct msm_bus_vectors cam_init_vectors[] = {
1178 {
1179 .src = MSM_BUS_MASTER_VFE,
1180 .dst = MSM_BUS_SLAVE_EBI_CH0,
1181 .ab = 0,
1182 .ib = 0,
1183 },
1184 {
1185 .src = MSM_BUS_MASTER_VPE,
1186 .dst = MSM_BUS_SLAVE_EBI_CH0,
1187 .ab = 0,
1188 .ib = 0,
1189 },
1190 {
1191 .src = MSM_BUS_MASTER_JPEG_ENC,
1192 .dst = MSM_BUS_SLAVE_EBI_CH0,
1193 .ab = 0,
1194 .ib = 0,
1195 },
1196};
1197
1198static struct msm_bus_vectors cam_preview_vectors[] = {
1199 {
1200 .src = MSM_BUS_MASTER_VFE,
1201 .dst = MSM_BUS_SLAVE_EBI_CH0,
1202 .ab = 27648000,
1203 .ib = 110592000,
1204 },
1205 {
1206 .src = MSM_BUS_MASTER_VPE,
1207 .dst = MSM_BUS_SLAVE_EBI_CH0,
1208 .ab = 0,
1209 .ib = 0,
1210 },
1211 {
1212 .src = MSM_BUS_MASTER_JPEG_ENC,
1213 .dst = MSM_BUS_SLAVE_EBI_CH0,
1214 .ab = 0,
1215 .ib = 0,
1216 },
1217};
1218
1219static struct msm_bus_vectors cam_video_vectors[] = {
1220 {
1221 .src = MSM_BUS_MASTER_VFE,
1222 .dst = MSM_BUS_SLAVE_EBI_CH0,
1223 .ab = 140451840,
1224 .ib = 561807360,
1225 },
1226 {
1227 .src = MSM_BUS_MASTER_VPE,
1228 .dst = MSM_BUS_SLAVE_EBI_CH0,
1229 .ab = 206807040,
1230 .ib = 488816640,
1231 },
1232 {
1233 .src = MSM_BUS_MASTER_JPEG_ENC,
1234 .dst = MSM_BUS_SLAVE_EBI_CH0,
1235 .ab = 0,
1236 .ib = 0,
1237 },
1238};
1239
1240static struct msm_bus_vectors cam_snapshot_vectors[] = {
1241 {
1242 .src = MSM_BUS_MASTER_VFE,
1243 .dst = MSM_BUS_SLAVE_EBI_CH0,
1244 .ab = 274423680,
1245 .ib = 1097694720,
1246 },
1247 {
1248 .src = MSM_BUS_MASTER_VPE,
1249 .dst = MSM_BUS_SLAVE_EBI_CH0,
1250 .ab = 0,
1251 .ib = 0,
1252 },
1253 {
1254 .src = MSM_BUS_MASTER_JPEG_ENC,
1255 .dst = MSM_BUS_SLAVE_EBI_CH0,
1256 .ab = 540000000,
1257 .ib = 1350000000,
1258 },
1259};
1260
1261static struct msm_bus_vectors cam_zsl_vectors[] = {
1262 {
1263 .src = MSM_BUS_MASTER_VFE,
1264 .dst = MSM_BUS_SLAVE_EBI_CH0,
1265 .ab = 302071680,
1266 .ib = 1208286720,
1267 },
1268 {
1269 .src = MSM_BUS_MASTER_VPE,
1270 .dst = MSM_BUS_SLAVE_EBI_CH0,
1271 .ab = 0,
1272 .ib = 0,
1273 },
1274 {
1275 .src = MSM_BUS_MASTER_JPEG_ENC,
1276 .dst = MSM_BUS_SLAVE_EBI_CH0,
1277 .ab = 540000000,
1278 .ib = 1350000000,
1279 },
1280};
1281
1282static struct msm_bus_paths cam_bus_client_config[] = {
1283 {
1284 ARRAY_SIZE(cam_init_vectors),
1285 cam_init_vectors,
1286 },
1287 {
1288 ARRAY_SIZE(cam_preview_vectors),
1289 cam_preview_vectors,
1290 },
1291 {
1292 ARRAY_SIZE(cam_video_vectors),
1293 cam_video_vectors,
1294 },
1295 {
1296 ARRAY_SIZE(cam_snapshot_vectors),
1297 cam_snapshot_vectors,
1298 },
1299 {
1300 ARRAY_SIZE(cam_zsl_vectors),
1301 cam_zsl_vectors,
1302 },
1303};
1304
1305static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1306 cam_bus_client_config,
1307 ARRAY_SIZE(cam_bus_client_config),
1308 .name = "msm_camera",
1309};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001310
Nishant Pandit24153d82011-08-27 16:05:13 +05301311struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1312 {
1313 .ioclk.mclk_clk_rate = 24000000,
1314 .ioclk.vfe_clk_rate = 228570000,
1315 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001316 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301317 },
1318 {
1319 .ioclk.mclk_clk_rate = 24000000,
1320 .ioclk.vfe_clk_rate = 228570000,
1321 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001322 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301323 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324};
1325
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001326#ifdef CONFIG_IMX074_ACT
1327static struct i2c_board_info imx074_actuator_i2c_info = {
1328 I2C_BOARD_INFO("imx074_act", 0x11),
1329};
1330
1331static struct msm_actuator_info imx074_actuator_info = {
1332 .board_info = &imx074_actuator_i2c_info,
1333 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1334 .vcm_pwd = 0,
1335 .vcm_enable = 1,
1336};
1337#endif
1338
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001339#ifdef CONFIG_IMX074
1340static struct msm_camera_sensor_flash_data flash_imx074 = {
1341 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301342#ifdef CONFIG_MSM_CAMERA_FLASH
1343 .flash_src = &msm_flash_src
1344#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001345};
1346
Nishant Pandit24153d82011-08-27 16:05:13 +05301347static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1348 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349 .sensor_reset = 107,
1350 .sensor_pwd = 85,
1351 .vcm_pwd = 0,
1352 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301353};
1354
1355static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1356 .sensor_name = "imx074",
1357 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 .flash_data = &flash_imx074,
1359 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301360 .sensor_platform_info = &sensor_board_info_imx074,
1361 .gpio_conf = &gpio_conf,
1362 .csi_if = 1,
1363 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001364#ifdef CONFIG_IMX074_ACT
1365 .actuator_info = &imx074_actuator_info
1366#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001367};
1368
1369struct platform_device msm8960_camera_sensor_imx074 = {
1370 .name = "msm_camera_imx074",
1371 .dev = {
1372 .platform_data = &msm_camera_sensor_imx074_data,
1373 },
1374};
1375#endif
1376#ifdef CONFIG_OV2720
1377static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001378 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001379};
1380
Nishant Pandit24153d82011-08-27 16:05:13 +05301381static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1382 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001383 .sensor_reset = 76,
1384 .sensor_pwd = 85,
1385 .vcm_pwd = 0,
1386 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301387};
1388
1389static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1390 .sensor_name = "ov2720",
1391 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001392 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301393 .sensor_platform_info = &sensor_board_info_ov2720,
1394 .gpio_conf = &gpio_conf,
1395 .csi_if = 1,
1396 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001397};
1398
1399struct platform_device msm8960_camera_sensor_ov2720 = {
1400 .name = "msm_camera_ov2720",
1401 .dev = {
1402 .platform_data = &msm_camera_sensor_ov2720_data,
1403 },
1404};
1405#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001406
Kevin Chan8b0d2322011-09-10 21:06:31 -07001407static struct msm8960_privacy_light_cfg privacy_light_info = {
1408 .mpp = PM8921_MPP_PM_TO_SYS(12),
1409};
1410
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001411static void __init msm8960_init_cam(void)
1412{
1413 int i;
1414 struct platform_device *cam_dev[] = {
1415 &msm8960_camera_sensor_imx074,
1416 &msm8960_camera_sensor_ov2720,
1417 };
1418
Kevin Chan8b0d2322011-09-10 21:06:31 -07001419 if (machine_is_msm8960_liquid()) {
1420 struct msm_camera_sensor_info *s_info;
1421 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1422 s_info->sensor_platform_info->mount_angle = 180;
1423 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1424 s_info->sensor_platform_info->privacy_light = 1;
1425 s_info->sensor_platform_info->privacy_light_info =
1426 &privacy_light_info;
1427 }
1428
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1430 struct msm_camera_sensor_info *s_info;
1431 s_info = cam_dev[i]->dev.platform_data;
1432 msm_get_cam_resources(s_info);
1433 platform_device_register(cam_dev[i]);
1434 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001435
1436 platform_device_register(&msm8960_device_csiphy0);
1437 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001438 platform_device_register(&msm8960_device_csid0);
1439 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001440 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001441 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001442 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443}
1444#endif
1445
1446#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001447#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001448#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001449#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001450#endif
1451
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452
1453#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001454#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001456#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1457#else
1458#define MSM_FB_EXT_BUF_SIZE 0
1459#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460
kuogee hsieh3830eb92011-09-12 15:25:57 -07001461#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1462/* width x height x 3 bpp x 2 frame buffer */
1463#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1464#define MSM_FB_WRITEBACK_OFFSET \
1465 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1466#else
1467#define MSM_FB_WRITEBACK_SIZE 0
1468#define MSM_FB_WRITEBACK_OFFSET 0
1469#endif
1470
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001471#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1472/* 4 bpp x 2 page HDMI case */
1473#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1474#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001475/* Note: must be multiple of 4096 */
1476#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1477 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001478#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001479
1480static int writeback_offset(void)
1481{
1482 return MSM_FB_WRITEBACK_OFFSET;
1483}
1484
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001485
1486#define MDP_VSYNC_GPIO 0
1487
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001488#define PANEL_NAME_MAX_LEN 30
1489#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1490#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1491#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1492#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1493#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1494#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1495#define HDMI_PANEL_NAME "hdmi_msm"
1496#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001497
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498static struct resource msm_fb_resources[] = {
1499 {
1500 .flags = IORESOURCE_DMA,
1501 }
1502};
1503
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001504static int msm_fb_detect_panel(const char *name)
1505{
1506 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001507 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1508 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1509 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001510 return 0;
1511 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001512 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1513 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1514 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001515 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001516
1517#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1518 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1519 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1520 PANEL_NAME_MAX_LEN)))
1521 return 0;
1522
1523 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1524 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1525 PANEL_NAME_MAX_LEN)))
1526 return 0;
1527
1528 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1529 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1530 PANEL_NAME_MAX_LEN)))
1531 return 0;
1532
1533 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1534 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1535 PANEL_NAME_MAX_LEN)))
1536 return 0;
1537#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001538 }
1539
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001540 if (!strncmp(name, HDMI_PANEL_NAME,
1541 strnlen(HDMI_PANEL_NAME,
1542 PANEL_NAME_MAX_LEN)))
1543 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001544
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001545 if (!strncmp(name, TVOUT_PANEL_NAME,
1546 strnlen(TVOUT_PANEL_NAME,
1547 PANEL_NAME_MAX_LEN)))
1548 return 0;
1549
1550 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001551 return -ENODEV;
1552}
1553
1554static struct msm_fb_platform_data msm_fb_pdata = {
1555 .detect_client = msm_fb_detect_panel,
1556};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001557
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558static struct platform_device msm_fb_device = {
1559 .name = "msm_fb",
1560 .id = 0,
1561 .num_resources = ARRAY_SIZE(msm_fb_resources),
1562 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001563 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001564};
1565
1566static bool dsi_power_on;
1567
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001568/**
1569 * LiQUID panel on/off
1570 *
1571 * @param on
1572 *
1573 * @return int
1574 */
1575static int mipi_dsi_liquid_panel_power(int on)
1576{
1577 static struct regulator *reg_l2, *reg_ext_3p3v;
1578 static int gpio21, gpio24, gpio43;
1579 int rc;
1580
1581 pr_info("%s: on=%d\n", __func__, on);
1582
1583 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1584 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1585 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1586
1587 if (!dsi_power_on) {
1588
1589 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1590 "dsi_vdda");
1591 if (IS_ERR(reg_l2)) {
1592 pr_err("could not get 8921_l2, rc = %ld\n",
1593 PTR_ERR(reg_l2));
1594 return -ENODEV;
1595 }
1596
1597 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1598 if (rc) {
1599 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1600 return -EINVAL;
1601 }
1602
1603 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1604 "vdd_lvds_3p3v");
1605 if (IS_ERR(reg_ext_3p3v)) {
1606 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1607 PTR_ERR(reg_ext_3p3v));
1608 return -ENODEV;
1609 }
1610
1611 rc = gpio_request(gpio21, "disp_pwr_en_n");
1612 if (rc) {
1613 pr_err("request gpio 21 failed, rc=%d\n", rc);
1614 return -ENODEV;
1615 }
1616
1617 rc = gpio_request(gpio43, "disp_rst_n");
1618 if (rc) {
1619 pr_err("request gpio 43 failed, rc=%d\n", rc);
1620 return -ENODEV;
1621 }
1622
1623 rc = gpio_request(gpio24, "disp_backlight_pwm");
1624 if (rc) {
1625 pr_err("request gpio 24 failed, rc=%d\n", rc);
1626 return -ENODEV;
1627 }
1628
1629 dsi_power_on = true;
1630 }
1631
1632 if (on) {
1633 rc = regulator_set_optimum_mode(reg_l2, 100000);
1634 if (rc < 0) {
1635 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1636 return -EINVAL;
1637 }
1638 rc = regulator_enable(reg_l2);
1639 if (rc) {
1640 pr_err("enable l2 failed, rc=%d\n", rc);
1641 return -ENODEV;
1642 }
1643
1644 rc = regulator_enable(reg_ext_3p3v);
1645 if (rc) {
1646 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1647 return -ENODEV;
1648 }
1649
1650 /* set reset pin before power enable */
1651 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1652
1653 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1654 msleep(20);
1655 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1656 msleep(20);
1657 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1658 msleep(20);
1659 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1660 msleep(20);
1661 } else {
1662 gpio_set_value_cansleep(gpio43, 0);
1663 gpio_set_value_cansleep(gpio21, 1);
1664
1665 rc = regulator_disable(reg_l2);
1666 if (rc) {
1667 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1668 return -ENODEV;
1669 }
1670 rc = regulator_disable(reg_ext_3p3v);
1671 if (rc) {
1672 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1673 return -ENODEV;
1674 }
1675 rc = regulator_set_optimum_mode(reg_l2, 100);
1676 if (rc < 0) {
1677 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1678 return -EINVAL;
1679 }
1680 }
1681
1682 return 0;
1683}
1684
1685static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001686{
1687 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001688 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689 int rc;
1690
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 pr_info("%s: state : %d\n", __func__, on);
1692
1693 if (!dsi_power_on) {
1694
1695 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1696 "dsi_vdc");
1697 if (IS_ERR(reg_l8)) {
1698 pr_err("could not get 8921_l8, rc = %ld\n",
1699 PTR_ERR(reg_l8));
1700 return -ENODEV;
1701 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1703 "dsi_vddio");
1704 if (IS_ERR(reg_l23)) {
1705 pr_err("could not get 8921_l23, rc = %ld\n",
1706 PTR_ERR(reg_l23));
1707 return -ENODEV;
1708 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1710 "dsi_vdda");
1711 if (IS_ERR(reg_l2)) {
1712 pr_err("could not get 8921_l2, rc = %ld\n",
1713 PTR_ERR(reg_l2));
1714 return -ENODEV;
1715 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1717 if (rc) {
1718 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1719 return -EINVAL;
1720 }
1721 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1722 if (rc) {
1723 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1724 return -EINVAL;
1725 }
1726 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1727 if (rc) {
1728 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1729 return -EINVAL;
1730 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001731 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1732 rc = gpio_request(gpio43, "disp_rst_n");
1733 if (rc) {
1734 pr_err("request gpio 43 failed, rc=%d\n", rc);
1735 return -ENODEV;
1736 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001737 dsi_power_on = true;
1738 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739 if (on) {
1740 rc = regulator_set_optimum_mode(reg_l8, 100000);
1741 if (rc < 0) {
1742 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1743 return -EINVAL;
1744 }
1745 rc = regulator_set_optimum_mode(reg_l23, 100000);
1746 if (rc < 0) {
1747 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1748 return -EINVAL;
1749 }
1750 rc = regulator_set_optimum_mode(reg_l2, 100000);
1751 if (rc < 0) {
1752 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1753 return -EINVAL;
1754 }
1755 rc = regulator_enable(reg_l8);
1756 if (rc) {
1757 pr_err("enable l8 failed, rc=%d\n", rc);
1758 return -ENODEV;
1759 }
1760 rc = regulator_enable(reg_l23);
1761 if (rc) {
1762 pr_err("enable l8 failed, rc=%d\n", rc);
1763 return -ENODEV;
1764 }
1765 rc = regulator_enable(reg_l2);
1766 if (rc) {
1767 pr_err("enable l2 failed, rc=%d\n", rc);
1768 return -ENODEV;
1769 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001770 gpio_set_value_cansleep(gpio43, 1);
1771 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001772 rc = regulator_disable(reg_l2);
1773 if (rc) {
1774 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1775 return -ENODEV;
1776 }
1777 rc = regulator_disable(reg_l8);
1778 if (rc) {
1779 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1780 return -ENODEV;
1781 }
1782 rc = regulator_disable(reg_l23);
1783 if (rc) {
1784 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1785 return -ENODEV;
1786 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001787 rc = regulator_set_optimum_mode(reg_l8, 100);
1788 if (rc < 0) {
1789 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1790 return -EINVAL;
1791 }
1792 rc = regulator_set_optimum_mode(reg_l23, 100);
1793 if (rc < 0) {
1794 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1795 return -EINVAL;
1796 }
1797 rc = regulator_set_optimum_mode(reg_l2, 100);
1798 if (rc < 0) {
1799 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1800 return -EINVAL;
1801 }
1802 gpio_set_value_cansleep(gpio43, 0);
1803 }
1804 return 0;
1805}
1806
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001807static int mipi_dsi_panel_power(int on)
1808{
1809 int ret;
1810
1811 pr_info("%s: on=%d\n", __func__, on);
1812
1813 if (machine_is_msm8960_liquid())
1814 ret = mipi_dsi_liquid_panel_power(on);
1815 else
1816 ret = mipi_dsi_cdp_panel_power(on);
1817
1818 return ret;
1819}
1820
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001821static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1822 .vsync_gpio = MDP_VSYNC_GPIO,
1823 .dsi_power_save = mipi_dsi_panel_power,
1824};
1825
1826#ifdef CONFIG_MSM_BUS_SCALING
1827
1828static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001829 {
1830 .src = MSM_BUS_MASTER_MDP_PORT0,
1831 .dst = MSM_BUS_SLAVE_EBI_CH0,
1832 .ab = 0,
1833 .ib = 0,
1834 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001835};
1836
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001837#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1838static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1839 /* If HDMI is used as primary */
1840 {
1841 .src = MSM_BUS_MASTER_MDP_PORT0,
1842 .dst = MSM_BUS_SLAVE_EBI_CH0,
1843 .ab = 2000000000,
1844 .ib = 2000000000,
1845 },
1846};
1847static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1848 {
1849 ARRAY_SIZE(mdp_init_vectors),
1850 mdp_init_vectors,
1851 },
1852 {
1853 ARRAY_SIZE(hdmi_as_primary_vectors),
1854 hdmi_as_primary_vectors,
1855 },
1856 {
1857 ARRAY_SIZE(hdmi_as_primary_vectors),
1858 hdmi_as_primary_vectors,
1859 },
1860 {
1861 ARRAY_SIZE(hdmi_as_primary_vectors),
1862 hdmi_as_primary_vectors,
1863 },
1864 {
1865 ARRAY_SIZE(hdmi_as_primary_vectors),
1866 hdmi_as_primary_vectors,
1867 },
1868 {
1869 ARRAY_SIZE(hdmi_as_primary_vectors),
1870 hdmi_as_primary_vectors,
1871 },
1872};
1873#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001874static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001875 {
1876 .src = MSM_BUS_MASTER_MDP_PORT0,
1877 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001878 .ab = 216000000 * 2,
1879 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001880 },
1881};
1882
1883static struct msm_bus_vectors mdp_vga_vectors[] = {
1884 /* VGA and less video */
1885 {
1886 .src = MSM_BUS_MASTER_MDP_PORT0,
1887 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001888 .ab = 216000000 * 2,
1889 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001890 },
1891};
1892
1893static struct msm_bus_vectors mdp_720p_vectors[] = {
1894 /* 720p and less video */
1895 {
1896 .src = MSM_BUS_MASTER_MDP_PORT0,
1897 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001898 .ab = 230400000 * 2,
1899 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001900 },
1901};
1902
1903static struct msm_bus_vectors mdp_1080p_vectors[] = {
1904 /* 1080p and less video */
1905 {
1906 .src = MSM_BUS_MASTER_MDP_PORT0,
1907 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001908 .ab = 334080000 * 2,
1909 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910 },
1911};
1912
1913static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1914 {
1915 ARRAY_SIZE(mdp_init_vectors),
1916 mdp_init_vectors,
1917 },
1918 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001919 ARRAY_SIZE(mdp_ui_vectors),
1920 mdp_ui_vectors,
1921 },
1922 {
1923 ARRAY_SIZE(mdp_ui_vectors),
1924 mdp_ui_vectors,
1925 },
1926 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001927 ARRAY_SIZE(mdp_vga_vectors),
1928 mdp_vga_vectors,
1929 },
1930 {
1931 ARRAY_SIZE(mdp_720p_vectors),
1932 mdp_720p_vectors,
1933 },
1934 {
1935 ARRAY_SIZE(mdp_1080p_vectors),
1936 mdp_1080p_vectors,
1937 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001938};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001939#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001940
1941static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1942 mdp_bus_scale_usecases,
1943 ARRAY_SIZE(mdp_bus_scale_usecases),
1944 .name = "mdp",
1945};
1946
1947#endif
1948
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001949#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1950int mdp_core_clk_rate_table[] = {
1951 200000000,
1952 200000000,
1953 200000000,
1954 200000000,
1955};
1956#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001957int mdp_core_clk_rate_table[] = {
1958 85330000,
1959 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001960 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961 200000000,
1962};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001963#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964
1965static struct msm_panel_common_pdata mdp_pdata = {
1966 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001967#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1968 .mdp_core_clk_rate = 200000000,
1969#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001970 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001971#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001972 .mdp_core_clk_table = mdp_core_clk_rate_table,
1973 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1974#ifdef CONFIG_MSM_BUS_SCALING
1975 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1976#endif
1977 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001978 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001979};
1980
1981static struct platform_device mipi_dsi_renesas_panel_device = {
1982 .name = "mipi_renesas",
1983 .id = 0,
1984};
1985
1986static struct platform_device mipi_dsi_simulator_panel_device = {
1987 .name = "mipi_simulator",
1988 .id = 0,
1989};
1990
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001991#define LPM_CHANNEL0 0
1992static int toshiba_gpio[] = {LPM_CHANNEL0};
1993
1994static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1995 .gpio = toshiba_gpio,
1996};
1997
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001998static struct platform_device mipi_dsi_toshiba_panel_device = {
1999 .name = "mipi_toshiba",
2000 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002001 .dev = {
2002 .platform_data = &toshiba_pdata,
2003 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002004};
2005
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002006#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002007static int dsi2lvds_gpio[2] = {
2008 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2009 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2010 };
2011
2012static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2013 .gpio_num = dsi2lvds_gpio,
2014};
2015
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002016static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2017
2018/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2019 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2020 /* timing */
2021 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2022 0x0c, 0x03, 0x04, 0xa0},
2023 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2024 {0xff, 0x00, 0x06, 0x00}, /* strength */
2025 /* pll control */
2026 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2027 0x40, 0x07, 0x03,
2028 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2029};
2030
2031static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002032 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2033 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002034 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2035};
2036
2037static struct platform_device mipi_dsi_novatek_panel_device = {
2038 .name = "mipi_novatek",
2039 .id = 0,
2040 .dev = {
2041 .platform_data = &novatek_pdata,
2042 }
2043};
2044
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002045static struct platform_device mipi_dsi2lvds_bridge_device = {
2046 .name = "mipi_tc358764",
2047 .id = 0,
2048 .dev.platform_data = &mipi_dsi2lvds_pdata,
2049};
2050
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002051#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2052static struct resource hdmi_msm_resources[] = {
2053 {
2054 .name = "hdmi_msm_qfprom_addr",
2055 .start = 0x00700000,
2056 .end = 0x007060FF,
2057 .flags = IORESOURCE_MEM,
2058 },
2059 {
2060 .name = "hdmi_msm_hdmi_addr",
2061 .start = 0x04A00000,
2062 .end = 0x04A00FFF,
2063 .flags = IORESOURCE_MEM,
2064 },
2065 {
2066 .name = "hdmi_msm_irq",
2067 .start = HDMI_IRQ,
2068 .end = HDMI_IRQ,
2069 .flags = IORESOURCE_IRQ,
2070 },
2071};
2072
2073static int hdmi_enable_5v(int on);
2074static int hdmi_core_power(int on, int show);
2075static int hdmi_cec_power(int on);
2076
2077static struct msm_hdmi_platform_data hdmi_msm_data = {
2078 .irq = HDMI_IRQ,
2079 .enable_5v = hdmi_enable_5v,
2080 .core_power = hdmi_core_power,
2081 .cec_power = hdmi_cec_power,
2082};
2083
2084static struct platform_device hdmi_msm_device = {
2085 .name = "hdmi_msm",
2086 .id = 0,
2087 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2088 .resource = hdmi_msm_resources,
2089 .dev.platform_data = &hdmi_msm_data,
2090};
2091#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2092
Vinay Kalia291263e2011-11-01 17:07:05 -07002093#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2094static struct platform_device wfd_panel_device = {
2095 .name = "wfd_panel",
2096 .id = 0,
2097 .dev.platform_data = NULL,
2098};
2099#endif
2100
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002101#ifdef CONFIG_MSM_BUS_SCALING
2102static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2103 {
2104 .src = MSM_BUS_MASTER_MDP_PORT0,
2105 .dst = MSM_BUS_SLAVE_EBI_CH0,
2106 .ab = 0,
2107 .ib = 0,
2108 },
2109};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002110
2111#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2112static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2113 {
2114 .src = MSM_BUS_MASTER_MDP_PORT0,
2115 .dst = MSM_BUS_SLAVE_EBI_CH0,
2116 .ab = 2000000000,
2117 .ib = 2000000000,
2118 },
2119};
2120#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002121static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2122 {
2123 .src = MSM_BUS_MASTER_MDP_PORT0,
2124 .dst = MSM_BUS_SLAVE_EBI_CH0,
2125 .ab = 566092800 * 2,
2126 .ib = 707616000 * 2,
2127 },
2128};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002129#endif
2130
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002131static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2132 {
2133 ARRAY_SIZE(dtv_bus_init_vectors),
2134 dtv_bus_init_vectors,
2135 },
2136 {
2137 ARRAY_SIZE(dtv_bus_def_vectors),
2138 dtv_bus_def_vectors,
2139 },
2140};
2141static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2142 dtv_bus_scale_usecases,
2143 ARRAY_SIZE(dtv_bus_scale_usecases),
2144 .name = "dtv",
2145};
2146
2147static struct lcdc_platform_data dtv_pdata = {
2148 .bus_scale_table = &dtv_bus_scale_pdata,
2149};
2150#endif
2151
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002152static void __init msm_fb_add_devices(void)
2153{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002154 struct platform_device *ptr = NULL;
2155
2156 if (machine_is_msm8960_liquid())
2157 ptr = &mipi_dsi2lvds_bridge_device;
2158 else
2159 ptr = &mipi_dsi_toshiba_panel_device;
2160 platform_add_devices(&ptr, 1);
2161
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162 if (machine_is_msm8x60_rumi3()) {
2163 msm_fb_register_device("mdp", NULL);
2164 mipi_dsi_pdata.target_type = 1;
2165 } else
2166 msm_fb_register_device("mdp", &mdp_pdata);
2167 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002168#ifdef CONFIG_MSM_BUS_SCALING
2169 msm_fb_register_device("dtv", &dtv_pdata);
2170#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171}
2172
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002173static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2174 .func = GPIOMUX_FUNC_GPIO,
2175 .drv = GPIOMUX_DRV_2MA,
2176 .pull = GPIOMUX_PULL_DOWN,
2177};
2178
2179static struct gpiomux_setting mdp_vsync_active_cfg = {
2180 .func = GPIOMUX_FUNC_1,
2181 .drv = GPIOMUX_DRV_2MA,
2182 .pull = GPIOMUX_PULL_DOWN,
2183};
2184
2185static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2186 {
2187 .gpio = MDP_VSYNC_GPIO,
2188 .settings = {
2189 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2190 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2191 },
2192 }
2193};
2194
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002195#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2196static struct gpiomux_setting hdmi_suspend_cfg = {
2197 .func = GPIOMUX_FUNC_GPIO,
2198 .drv = GPIOMUX_DRV_2MA,
2199 .pull = GPIOMUX_PULL_DOWN,
2200};
2201
2202static struct gpiomux_setting hdmi_active_1_cfg = {
2203 .func = GPIOMUX_FUNC_1,
2204 .drv = GPIOMUX_DRV_2MA,
2205 .pull = GPIOMUX_PULL_UP,
2206};
2207
2208static struct gpiomux_setting hdmi_active_2_cfg = {
2209 .func = GPIOMUX_FUNC_1,
2210 .drv = GPIOMUX_DRV_2MA,
2211 .pull = GPIOMUX_PULL_DOWN,
2212};
2213
2214static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2215 {
2216 .gpio = 99,
2217 .settings = {
2218 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2219 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2220 },
2221 },
2222 {
2223 .gpio = 100,
2224 .settings = {
2225 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2226 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2227 },
2228 },
2229 {
2230 .gpio = 101,
2231 .settings = {
2232 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2233 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2234 },
2235 },
2236 {
2237 .gpio = 102,
2238 .settings = {
2239 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2240 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2241 },
2242 },
2243};
2244
2245static int hdmi_enable_5v(int on)
2246{
2247 /* TBD: PM8921 regulator instead of 8901 */
2248 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2249 static int prev_on;
2250 int rc;
2251
2252 if (on == prev_on)
2253 return 0;
2254
2255 if (!reg_8921_hdmi_mvs)
2256 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2257 "hdmi_mvs");
2258
2259 if (on) {
2260 rc = regulator_enable(reg_8921_hdmi_mvs);
2261 if (rc) {
2262 pr_err("'%s' regulator enable failed, rc=%d\n",
2263 "8921_hdmi_mvs", rc);
2264 return rc;
2265 }
2266 pr_debug("%s(on): success\n", __func__);
2267 } else {
2268 rc = regulator_disable(reg_8921_hdmi_mvs);
2269 if (rc)
2270 pr_warning("'%s' regulator disable failed, rc=%d\n",
2271 "8921_hdmi_mvs", rc);
2272 pr_debug("%s(off): success\n", __func__);
2273 }
2274
2275 prev_on = on;
2276
2277 return 0;
2278}
2279
2280static int hdmi_core_power(int on, int show)
2281{
2282 static struct regulator *reg_8921_l23, *reg_8921_s4;
2283 static int prev_on;
2284 int rc;
2285
2286 if (on == prev_on)
2287 return 0;
2288
2289 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002290 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002292 if (IS_ERR(reg_8921_l23)) {
2293 pr_err("could not get reg_8921_l23, rc = %ld\n",
2294 PTR_ERR(reg_8921_l23));
2295 return -ENODEV;
2296 }
2297 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2298 if (rc) {
2299 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2300 return -EINVAL;
2301 }
2302 }
2303 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002305 if (IS_ERR(reg_8921_s4)) {
2306 pr_err("could not get reg_8921_s4, rc = %ld\n",
2307 PTR_ERR(reg_8921_s4));
2308 return -ENODEV;
2309 }
2310 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2311 if (rc) {
2312 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2313 return -EINVAL;
2314 }
2315 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002316
2317 if (on) {
2318 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2319 if (rc < 0) {
2320 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2321 return -EINVAL;
2322 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002323 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002324 if (rc) {
2325 pr_err("'%s' regulator enable failed, rc=%d\n",
2326 "hdmi_avdd", rc);
2327 return rc;
2328 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002329 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002330 if (rc) {
2331 pr_err("'%s' regulator enable failed, rc=%d\n",
2332 "hdmi_vcc", rc);
2333 return rc;
2334 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002335 rc = gpio_request(100, "HDMI_DDC_CLK");
2336 if (rc) {
2337 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2338 "HDMI_DDC_CLK", 100, rc);
2339 goto error1;
2340 }
2341 rc = gpio_request(101, "HDMI_DDC_DATA");
2342 if (rc) {
2343 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2344 "HDMI_DDC_DATA", 101, rc);
2345 goto error2;
2346 }
2347 rc = gpio_request(102, "HDMI_HPD");
2348 if (rc) {
2349 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2350 "HDMI_HPD", 102, rc);
2351 goto error3;
2352 }
2353 pr_debug("%s(on): success\n", __func__);
2354 } else {
2355 gpio_free(100);
2356 gpio_free(101);
2357 gpio_free(102);
2358
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002359 rc = regulator_disable(reg_8921_l23);
2360 if (rc) {
2361 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2362 return -ENODEV;
2363 }
2364 rc = regulator_disable(reg_8921_s4);
2365 if (rc) {
2366 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2367 return -ENODEV;
2368 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002369 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2370 if (rc < 0) {
2371 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2372 return -EINVAL;
2373 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002374 pr_debug("%s(off): success\n", __func__);
2375 }
2376
2377 prev_on = on;
2378
2379 return 0;
2380
2381error3:
2382 gpio_free(101);
2383error2:
2384 gpio_free(100);
2385error1:
2386 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002387 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002388 return rc;
2389}
2390
2391static int hdmi_cec_power(int on)
2392{
2393 static int prev_on;
2394 int rc;
2395
2396 if (on == prev_on)
2397 return 0;
2398
2399 if (on) {
2400 rc = gpio_request(99, "HDMI_CEC_VAR");
2401 if (rc) {
2402 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2403 "HDMI_CEC_VAR", 99, rc);
2404 goto error;
2405 }
2406 pr_debug("%s(on): success\n", __func__);
2407 } else {
2408 gpio_free(99);
2409 pr_debug("%s(off): success\n", __func__);
2410 }
2411
2412 prev_on = on;
2413
2414 return 0;
2415error:
2416 return rc;
2417}
2418#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2419
2420static void __init msm8960_allocate_memory_regions(void)
2421{
2422 void *addr;
2423 unsigned long size;
2424
2425 size = MSM_FB_SIZE;
2426 addr = alloc_bootmem_align(size, 0x1000);
2427 msm_fb_resources[0].start = __pa(addr);
2428 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2429 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2430 size, addr, __pa(addr));
2431
2432}
2433#ifdef CONFIG_WCD9310_CODEC
2434
2435#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2436
Patrick Lai3043fba2011-08-01 14:15:57 -07002437/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2438 * 4 micbiases are used to power various analog and digital
2439 * microphones operating at 1800 mV. Technically, all micbiases
2440 * can source from single cfilter since all microphones operate
2441 * at the same voltage level. The arrangement below is to make
2442 * sure all cfilters are exercised. LDO_H regulator ouput level
2443 * does not need to be as high as 2.85V. It is choosen for
2444 * microphone sensitivity purpose.
2445 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002446static struct tabla_pdata tabla_platform_data = {
2447 .slimbus_slave_device = {
2448 .name = "tabla-slave",
2449 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2450 },
2451 .irq = MSM_GPIO_TO_INT(62),
2452 .irq_base = TABLA_INTERRUPT_BASE,
2453 .num_irqs = NR_TABLA_IRQS,
2454 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002455 .micbias = {
2456 .ldoh_v = TABLA_LDOH_2P85_V,
2457 .cfilt1_mv = 1800,
2458 .cfilt2_mv = 1800,
2459 .cfilt3_mv = 1800,
2460 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2461 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2462 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2463 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2464 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002465};
2466
2467static struct slim_device msm_slim_tabla = {
2468 .name = "tabla-slim",
2469 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2470 .dev = {
2471 .platform_data = &tabla_platform_data,
2472 },
2473};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302474
2475static struct tabla_pdata tabla20_platform_data = {
2476 .slimbus_slave_device = {
2477 .name = "tabla-slave",
2478 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2479 },
2480 .irq = MSM_GPIO_TO_INT(62),
2481 .irq_base = TABLA_INTERRUPT_BASE,
2482 .num_irqs = NR_TABLA_IRQS,
2483 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2484 .micbias = {
2485 .ldoh_v = TABLA_LDOH_2P85_V,
2486 .cfilt1_mv = 1800,
2487 .cfilt2_mv = 1800,
2488 .cfilt3_mv = 1800,
2489 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2490 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2491 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2492 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2493 }
2494};
2495
2496static struct slim_device msm_slim_tabla20 = {
2497 .name = "tabla2x-slim",
2498 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2499 .dev = {
2500 .platform_data = &tabla20_platform_data,
2501 },
2502};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002503#endif
2504
2505static struct slim_boardinfo msm_slim_devices[] = {
2506#ifdef CONFIG_WCD9310_CODEC
2507 {
2508 .bus_num = 1,
2509 .slim_slave = &msm_slim_tabla,
2510 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302511 {
2512 .bus_num = 1,
2513 .slim_slave = &msm_slim_tabla20,
2514 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002515#endif
2516 /* add more slimbus slaves as needed */
2517};
2518
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002519#define MSM_WCNSS_PHYS 0x03000000
2520#define MSM_WCNSS_SIZE 0x280000
2521
2522static struct resource resources_wcnss_wlan[] = {
2523 {
2524 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2525 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2526 .name = "wcnss_wlanrx_irq",
2527 .flags = IORESOURCE_IRQ,
2528 },
2529 {
2530 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2531 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2532 .name = "wcnss_wlantx_irq",
2533 .flags = IORESOURCE_IRQ,
2534 },
2535 {
2536 .start = MSM_WCNSS_PHYS,
2537 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2538 .name = "wcnss_mmio",
2539 .flags = IORESOURCE_MEM,
2540 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002541 {
2542 .start = 84,
2543 .end = 88,
2544 .name = "wcnss_gpios_5wire",
2545 .flags = IORESOURCE_IO,
2546 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002547};
2548
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002549static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2550 .has_48mhz_xo = 1,
2551};
2552
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002553static struct platform_device msm_device_wcnss_wlan = {
2554 .name = "wcnss_wlan",
2555 .id = 0,
2556 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2557 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002558 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002559};
2560
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002561#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2562 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2563 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2564 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2565
2566#define QCE_SIZE 0x10000
2567#define QCE_0_BASE 0x18500000
2568
2569#define QCE_HW_KEY_SUPPORT 0
2570#define QCE_SHA_HMAC_SUPPORT 1
2571#define QCE_SHARE_CE_RESOURCE 1
2572#define QCE_CE_SHARED 0
2573
2574static struct resource qcrypto_resources[] = {
2575 [0] = {
2576 .start = QCE_0_BASE,
2577 .end = QCE_0_BASE + QCE_SIZE - 1,
2578 .flags = IORESOURCE_MEM,
2579 },
2580 [1] = {
2581 .name = "crypto_channels",
2582 .start = DMOV_CE_IN_CHAN,
2583 .end = DMOV_CE_OUT_CHAN,
2584 .flags = IORESOURCE_DMA,
2585 },
2586 [2] = {
2587 .name = "crypto_crci_in",
2588 .start = DMOV_CE_IN_CRCI,
2589 .end = DMOV_CE_IN_CRCI,
2590 .flags = IORESOURCE_DMA,
2591 },
2592 [3] = {
2593 .name = "crypto_crci_out",
2594 .start = DMOV_CE_OUT_CRCI,
2595 .end = DMOV_CE_OUT_CRCI,
2596 .flags = IORESOURCE_DMA,
2597 },
2598};
2599
2600static struct resource qcedev_resources[] = {
2601 [0] = {
2602 .start = QCE_0_BASE,
2603 .end = QCE_0_BASE + QCE_SIZE - 1,
2604 .flags = IORESOURCE_MEM,
2605 },
2606 [1] = {
2607 .name = "crypto_channels",
2608 .start = DMOV_CE_IN_CHAN,
2609 .end = DMOV_CE_OUT_CHAN,
2610 .flags = IORESOURCE_DMA,
2611 },
2612 [2] = {
2613 .name = "crypto_crci_in",
2614 .start = DMOV_CE_IN_CRCI,
2615 .end = DMOV_CE_IN_CRCI,
2616 .flags = IORESOURCE_DMA,
2617 },
2618 [3] = {
2619 .name = "crypto_crci_out",
2620 .start = DMOV_CE_OUT_CRCI,
2621 .end = DMOV_CE_OUT_CRCI,
2622 .flags = IORESOURCE_DMA,
2623 },
2624};
2625
2626#endif
2627
2628#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2629 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2630
2631static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2632 .ce_shared = QCE_CE_SHARED,
2633 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2634 .hw_key_support = QCE_HW_KEY_SUPPORT,
2635 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2636};
2637
2638static struct platform_device qcrypto_device = {
2639 .name = "qcrypto",
2640 .id = 0,
2641 .num_resources = ARRAY_SIZE(qcrypto_resources),
2642 .resource = qcrypto_resources,
2643 .dev = {
2644 .coherent_dma_mask = DMA_BIT_MASK(32),
2645 .platform_data = &qcrypto_ce_hw_suppport,
2646 },
2647};
2648#endif
2649
2650#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2651 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2652
2653static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2654 .ce_shared = QCE_CE_SHARED,
2655 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2656 .hw_key_support = QCE_HW_KEY_SUPPORT,
2657 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2658};
2659
2660static struct platform_device qcedev_device = {
2661 .name = "qce",
2662 .id = 0,
2663 .num_resources = ARRAY_SIZE(qcedev_resources),
2664 .resource = qcedev_resources,
2665 .dev = {
2666 .coherent_dma_mask = DMA_BIT_MASK(32),
2667 .platform_data = &qcedev_ce_hw_suppport,
2668 },
2669};
2670#endif
2671
Joel Kingb8352a12011-11-15 18:46:24 -08002672#define MDM2AP_ERRFATAL 70
2673#define AP2MDM_ERRFATAL 95
2674#define MDM2AP_STATUS 69
2675#define AP2MDM_STATUS 94
2676#define AP2MDM_PMIC_RESET_N 80
2677#define AP2MDM_KPDPWR_N 81
2678
2679static struct gpiomux_setting ap2mdm_cfg = {
2680 .func = GPIOMUX_FUNC_GPIO,
2681 .drv = GPIOMUX_DRV_8MA,
2682 .pull = GPIOMUX_PULL_DOWN,
2683};
2684
2685static struct gpiomux_setting mdm2ap_status_cfg = {
2686 .func = GPIOMUX_FUNC_GPIO,
2687 .drv = GPIOMUX_DRV_8MA,
2688 .pull = GPIOMUX_PULL_NONE,
2689};
2690
2691static struct gpiomux_setting mdm2ap_errfatal_cfg = {
2692 .func = GPIOMUX_FUNC_GPIO,
2693 .drv = GPIOMUX_DRV_16MA,
2694 .pull = GPIOMUX_PULL_DOWN,
2695};
2696
2697static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
2698 .func = GPIOMUX_FUNC_GPIO,
2699 .drv = GPIOMUX_DRV_8MA,
2700 .pull = GPIOMUX_PULL_NONE,
2701};
2702
2703static struct msm_gpiomux_config mdm_configs[] __initdata = {
2704 /* AP2MDM_STATUS */
2705 {
2706 .gpio = AP2MDM_STATUS,
2707 .settings = {
2708 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
2709 }
2710 },
2711 /* MDM2AP_STATUS */
2712 {
2713 .gpio = MDM2AP_STATUS,
2714 .settings = {
2715 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
2716 }
2717 },
2718 /* MDM2AP_ERRFATAL */
2719 {
2720 .gpio = MDM2AP_ERRFATAL,
2721 .settings = {
2722 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
2723 }
2724 },
2725 /* AP2MDM_ERRFATAL */
2726 {
2727 .gpio = AP2MDM_ERRFATAL,
2728 .settings = {
2729 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
2730 }
2731 },
2732 /* AP2MDM_KPDPWR_N */
2733 {
2734 .gpio = AP2MDM_KPDPWR_N,
2735 .settings = {
2736 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
2737 }
2738 },
2739 /* AP2MDM_PMIC_RESET_N */
2740 {
2741 .gpio = AP2MDM_PMIC_RESET_N,
2742 .settings = {
2743 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
2744 }
2745 }
2746};
2747
2748static struct resource mdm_resources[] = {
2749 {
2750 .start = MDM2AP_ERRFATAL,
2751 .end = MDM2AP_ERRFATAL,
2752 .name = "MDM2AP_ERRFATAL",
2753 .flags = IORESOURCE_IO,
2754 },
2755 {
2756 .start = AP2MDM_ERRFATAL,
2757 .end = AP2MDM_ERRFATAL,
2758 .name = "AP2MDM_ERRFATAL",
2759 .flags = IORESOURCE_IO,
2760 },
2761 {
2762 .start = MDM2AP_STATUS,
2763 .end = MDM2AP_STATUS,
2764 .name = "MDM2AP_STATUS",
2765 .flags = IORESOURCE_IO,
2766 },
2767 {
2768 .start = AP2MDM_STATUS,
2769 .end = AP2MDM_STATUS,
2770 .name = "AP2MDM_STATUS",
2771 .flags = IORESOURCE_IO,
2772 },
2773 {
2774 .start = AP2MDM_PMIC_RESET_N,
2775 .end = AP2MDM_PMIC_RESET_N,
2776 .name = "AP2MDM_PMIC_RESET_N",
2777 .flags = IORESOURCE_IO,
2778 },
2779 {
2780 .start = AP2MDM_KPDPWR_N,
2781 .end = AP2MDM_KPDPWR_N,
2782 .name = "AP2MDM_KPDPWR_N",
2783 .flags = IORESOURCE_IO,
2784 },
2785};
2786
2787static struct mdm_platform_data mdm_platform_data = {
2788 .mdm_version = "2.5",
2789};
2790
2791struct platform_device mdm_device = {
2792 .name = "mdm2_modem",
2793 .id = -1,
2794 .num_resources = ARRAY_SIZE(mdm_resources),
2795 .resource = mdm_resources,
2796 .dev = {
2797 .platform_data = &mdm_platform_data,
2798 },
2799};
2800
2801static struct platform_device *mdm_devices[] __initdata = {
2802 &mdm_device,
2803};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804
2805static int __init gpiomux_init(void)
2806{
2807 int rc;
2808
2809 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2810 if (rc) {
2811 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2812 return rc;
2813 }
2814
Nishant Pandit24153d82011-08-27 16:05:13 +05302815 msm_gpiomux_install(msm8960_cam_common_configs,
2816 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002817
2818 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002819 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002820
2821 msm_gpiomux_install(msm8960_gsbi_configs,
2822 ARRAY_SIZE(msm8960_gsbi_configs));
2823
2824 msm_gpiomux_install(msm8960_cyts_configs,
2825 ARRAY_SIZE(msm8960_cyts_configs));
2826
2827 msm_gpiomux_install(msm8960_slimbus_config,
2828 ARRAY_SIZE(msm8960_slimbus_config));
2829
2830 msm_gpiomux_install(msm8960_audio_codec_configs,
2831 ARRAY_SIZE(msm8960_audio_codec_configs));
2832
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002833 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2834 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2835
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2837 msm_gpiomux_install(msm8960_hdmi_configs,
2838 ARRAY_SIZE(msm8960_hdmi_configs));
2839#endif
2840
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002841 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2842 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844 msm_gpiomux_install(wcnss_5wire_interface,
2845 ARRAY_SIZE(wcnss_5wire_interface));
2846
Mohan Pallaka5e490392011-09-09 15:18:41 +05302847 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2848 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2849 msm_gpiomux_install(hap_lvl_shft_config,
2850 ARRAY_SIZE(hap_lvl_shft_config));
Joel Kingb8352a12011-11-15 18:46:24 -08002851
2852 if (PLATFORM_IS_CHARM25())
2853 msm_gpiomux_install(mdm_configs,
2854 ARRAY_SIZE(mdm_configs));
2855
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002856 return 0;
2857}
2858
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002859#define MSM_SHARED_RAM_PHYS 0x80000000
2860
2861static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2862 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2863 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2864 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2865 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2866 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2867 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2868 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2869 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2870 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2871 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2872 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2873 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002874 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2875 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2876 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2877 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2878 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2879 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2880 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2881 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2882 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2883 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2884 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2885 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2886 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2887 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002888 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002889 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2890 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2891 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002892 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2893 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002894};
2895
2896static struct pm8921_adc_properties pm8921_adc_data = {
2897 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2898 .bitresolution = 15,
2899 .bipolar = 0,
2900};
2901
2902static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2903 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002904 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002905 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002906 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002908
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002909static void __init msm8960_map_io(void)
2910{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002911 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002912 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002913
2914 if (socinfo_init() < 0)
2915 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002916}
2917
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002918#ifdef CONFIG_ARCH_MSM8930
2919static void __init msm8930_map_io(void)
2920{
2921 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2922 msm_map_msm8930_io();
2923
2924 if (socinfo_init() < 0)
2925 pr_err("socinfo_init() failed!\n");
2926}
2927#endif
2928
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002929static void __init msm8960_init_irq(void)
2930{
2931 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932
2933 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002934 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002935 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002936
2937 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002938 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002939
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2941 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002942
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002943 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2944 * as they are configured as level, which does not play nice with
2945 * handle_percpu_irq.
2946 */
2947 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2948 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002949 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002950 }
2951}
2952
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002953/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954enum sdcc_controllers {
2955 SDCC1,
2956 SDCC2,
2957 SDCC3,
2958 SDCC4,
2959 SDCC5,
2960 MAX_SDCC_CONTROLLER
2961};
2962
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002963/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002964static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2965 /* SDCC1 : eMMC card connected */
2966 [SDCC1] = {
2967 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302968 .high_vol_level = 2950000,
2969 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302970 .always_on = 1,
2971 .lpm_sup = 1,
2972 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002973 .hpm_uA = 200000, /* 200mA */
2974 },
2975 /* SDCC3 : External card slot connected */
2976 [SDCC3] = {
2977 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302978 .high_vol_level = 2950000,
2979 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002980 .hpm_uA = 600000, /* 600mA */
2981 }
2982};
2983
2984/* Only slots having eMMC card will require VCCQ voltage */
2985static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2986 /* SDCC1 : eMMC card connected */
2987 [SDCC1] = {
2988 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002989 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302990 .high_vol_level = 1800000,
2991 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002992 .hpm_uA = 200000, /* 200mA */
2993 }
2994};
2995
2996/* All SDCC controllers may require voting for VDD PAD voltage */
2997static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2998 /* SDCC3 : External card slot connected */
2999 [SDCC3] = {
3000 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05303001 .high_vol_level = 2950000,
3002 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003003 .always_on = 1,
3004 .lpm_sup = 1,
3005 /* Max. Active current required is 16 mA */
3006 .hpm_uA = 16000,
3007 /*
3008 * Sleep current required is ~300 uA. But min. vote can be
3009 * in terms of mA (min. 1 mA). So let's vote for 2 mA
3010 * during sleep.
3011 */
3012 .lpm_uA = 2000,
3013 }
3014};
3015
3016static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
3017 /* SDCC1 : eMMC card connected */
3018 [SDCC1] = {
3019 .vdd_data = &mmc_vdd_reg_data[SDCC1],
3020 .vccq_data = &mmc_vccq_reg_data[SDCC1],
3021 },
3022 /* SDCC3 : External card slot connected */
3023 [SDCC3] = {
3024 .vdd_data = &mmc_vdd_reg_data[SDCC3],
3025 .vddp_data = &mmc_vddp_reg_data[SDCC3],
3026 }
3027};
3028
3029/* SDC1 pad data */
3030static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
3031 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05303032 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
3033 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003034};
3035
3036static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
3037 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
3038 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
3039 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
3040};
3041
3042static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05303043 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003044 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
3045 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
3046};
3047
3048static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05303049 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003050 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
3051 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
3052};
3053
3054/* SDC3 pad data */
3055static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
3056 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
3057 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
3058 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
3059};
3060
3061static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
3062 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
3063 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
3064 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
3065};
3066
3067static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05303068 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003069 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
3070 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
3071};
3072
3073static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05303074 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05303075 /*
3076 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
3077 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
3078 * which would result in false card detection interrupts.
3079 */
3080 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
3081 /*
3082 * Keeping DATA lines status to PULL UP will make sure that
3083 * there is no current leak during sleep if external pull up
3084 * is connected to DATA lines.
3085 */
3086 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003087};
3088
3089struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
3090 [SDCC1] = {
3091 .on = sdc1_pad_pull_on_cfg,
3092 .off = sdc1_pad_pull_off_cfg,
3093 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
3094 },
3095 [SDCC3] = {
3096 .on = sdc3_pad_pull_on_cfg,
3097 .off = sdc3_pad_pull_off_cfg,
3098 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
3099 },
3100};
3101
3102struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
3103 [SDCC1] = {
3104 .on = sdc1_pad_drv_on_cfg,
3105 .off = sdc1_pad_drv_off_cfg,
3106 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
3107 },
3108 [SDCC3] = {
3109 .on = sdc3_pad_drv_on_cfg,
3110 .off = sdc3_pad_drv_off_cfg,
3111 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
3112 },
3113};
3114
3115struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
3116 [SDCC1] = {
3117 .pull = &mmc_pad_pull_data[SDCC1],
3118 .drv = &mmc_pad_drv_data[SDCC1]
3119 },
3120 [SDCC3] = {
3121 .pull = &mmc_pad_pull_data[SDCC3],
3122 .drv = &mmc_pad_drv_data[SDCC3]
3123 },
3124};
3125
3126struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
3127 [SDCC1] = {
3128 .pad_data = &mmc_pad_data[SDCC1],
3129 },
3130 [SDCC3] = {
3131 .pad_data = &mmc_pad_data[SDCC3],
3132 },
3133};
3134
3135static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303136 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137};
3138
3139static unsigned int sdc3_sup_clk_rates[] = {
3140 400000, 24000000, 48000000, 96000000
3141};
3142
3143#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3144static struct mmc_platform_data msm8960_sdc1_data = {
3145 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3146#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3147 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3148#else
3149 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3150#endif
3151 .sup_clk_table = sdc1_sup_clk_rates,
3152 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303153 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003154 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003155 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303156 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003157};
3158#endif
3159
3160#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3161static struct mmc_platform_data msm8960_sdc3_data = {
3162 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3163 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3164 .sup_clk_table = sdc3_sup_clk_rates,
3165 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303166 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303167#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003168 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303169#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003170 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3171 .pin_data = &mmc_slot_pin_data[SDCC3],
3172#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3173 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3174 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3175 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3176#endif
3177 .xpc_cap = 1,
3178 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3179 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303180 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003181};
3182#endif
3183
3184static void __init msm8960_init_mmc(void)
3185{
3186#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3187 /* SDC1 : eMMC card connected */
3188 msm_add_sdcc(1, &msm8960_sdc1_data);
3189#endif
3190#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3191 /* SDC3: External card slot */
3192 msm_add_sdcc(3, &msm8960_sdc3_data);
3193#endif
3194}
3195
3196static void __init msm8960_init_buses(void)
3197{
3198#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003199 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003200 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3201 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3202 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3203 msm_bus_apps_fabric.dev.platform_data =
3204 &msm_bus_8960_apps_fabric_pdata;
3205 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3206 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3207 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3208 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003209#endif
3210}
3211
3212static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3213 .max_clock_speed = 15060000,
3214};
3215
3216#ifdef CONFIG_USB_MSM_OTG_72K
3217static struct msm_otg_platform_data msm_otg_pdata;
3218#else
3219#define USB_5V_EN 42
3220static void msm_hsusb_vbus_power(bool on)
3221{
3222 int rc;
3223 static bool vbus_is_on;
3224 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225
3226 if (vbus_is_on == on)
3227 return;
3228
3229 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003230 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3231 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003232 if (IS_ERR(mvs_otg_switch)) {
3233 pr_err("Unable to get mvs_otg_switch\n");
3234 return;
3235 }
3236
3237 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3238 "usb_5v_en");
3239 if (rc < 0) {
3240 pr_err("failed to request usb_5v_en gpio\n");
3241 goto put_mvs_otg;
3242 }
3243
Anji jonnala2936fd92011-11-09 15:39:22 +05303244 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3245 if (rc) {
3246 pr_err("%s: unable to set_direction for gpio [%d]\n",
3247 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003248 goto free_usb_5v_en;
3249 }
3250
Anji jonnala2936fd92011-11-09 15:39:22 +05303251 if (regulator_enable(mvs_otg_switch)) {
3252 pr_err("unable to enable mvs_otg_switch\n");
3253 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003254 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303255
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003256 vbus_is_on = true;
3257 return;
3258 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303259 regulator_disable(mvs_otg_switch);
3260err_ldo_gpio_set_dir:
3261 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003262free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303263 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003264put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303265 regulator_put(mvs_otg_switch);
3266 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003267}
3268
3269static struct msm_otg_platform_data msm_otg_pdata = {
3270 .mode = USB_OTG,
3271 .otg_control = OTG_PMIC_CONTROL,
3272 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3273 .pclk_src_name = "dfab_usb_hs_clk",
3274 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3275 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303276 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003277};
3278#endif
3279
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303280#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303281#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303282static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3283 .strobe = 150,
3284 .data = 151,
3285};
3286#else
3287static struct msm_hsic_host_platform_data msm_hsic_pdata;
3288#endif
3289
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003290#define PID_MAGIC_ID 0x71432909
3291#define SERIAL_NUM_MAGIC_ID 0x61945374
3292#define SERIAL_NUMBER_LENGTH 127
3293#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3294
3295struct magic_num_struct {
3296 uint32_t pid;
3297 uint32_t serial_num;
3298};
3299
3300struct dload_struct {
3301 uint32_t reserved1;
3302 uint32_t reserved2;
3303 uint32_t reserved3;
3304 uint16_t reserved4;
3305 uint16_t pid;
3306 char serial_number[SERIAL_NUMBER_LENGTH];
3307 uint16_t reserved5;
3308 struct magic_num_struct magic_struct;
3309};
3310
3311static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3312{
3313 struct dload_struct __iomem *dload = 0;
3314
3315 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3316 if (!dload) {
3317 pr_err("%s: cannot remap I/O memory region: %08x\n",
3318 __func__, DLOAD_USB_BASE_ADD);
3319 return -ENXIO;
3320 }
3321
3322 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3323 __func__, dload, pid, snum);
3324 /* update pid */
3325 dload->magic_struct.pid = PID_MAGIC_ID;
3326 dload->pid = pid;
3327
3328 /* update serial number */
3329 dload->magic_struct.serial_num = 0;
3330 if (!snum) {
3331 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3332 goto out;
3333 }
3334
3335 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003336 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003337out:
3338 iounmap(dload);
3339 return 0;
3340}
3341
3342static struct android_usb_platform_data android_usb_pdata = {
3343 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3344};
3345
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003346static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003347 .name = "android_usb",
3348 .id = -1,
3349 .dev = {
3350 .platform_data = &android_usb_pdata,
3351 },
3352};
3353
3354static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3355 0x03, 0x0f,
3356};
3357
3358static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3359 0x00, 0x24, 0x54, 0x10,
3360 0x09, 0x03, 0x01,
3361 0x10, 0x54, 0x30, 0x0C,
3362 0x24, 0x30, 0x0f,
3363};
3364
3365static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3366 0x00, 0x24, 0x54, 0x10,
3367 0x09, 0x07, 0x01, 0x0B,
3368 0x10, 0x54, 0x30, 0x0C,
3369 0x24, 0x30, 0x0f,
3370};
3371
3372static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3373 [0] = {
3374 .mode = MSM_SPM_MODE_CLOCK_GATING,
3375 .notify_rpm = false,
3376 .cmd = spm_wfi_cmd_sequence,
3377 },
3378 [1] = {
3379 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3380 .notify_rpm = false,
3381 .cmd = spm_power_collapse_without_rpm,
3382 },
3383 [2] = {
3384 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3385 .notify_rpm = true,
3386 .cmd = spm_power_collapse_with_rpm,
3387 },
3388};
3389
3390static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3391 [0] = {
3392 .reg_base_addr = MSM_SAW0_BASE,
3393 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3394 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3395 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3396#if defined(CONFIG_MSM_AVS_HW)
3397 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3398 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3399#endif
3400 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3401 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3402 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3403 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3404 .vctl_timeout_us = 50,
3405 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3406 .modes = msm_spm_seq_list,
3407 },
3408 [1] = {
3409 .reg_base_addr = MSM_SAW1_BASE,
3410 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3411 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3412 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3413#if defined(CONFIG_MSM_AVS_HW)
3414 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3415 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3416#endif
3417 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3418 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3419 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3420 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3421 .vctl_timeout_us = 50,
3422 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3423 .modes = msm_spm_seq_list,
3424 },
3425};
3426
3427static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3428 0x00, 0x20, 0x03, 0x20,
3429 0x00, 0x0f,
3430};
3431
3432static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3433 0x00, 0x20, 0x34, 0x64,
3434 0x48, 0x07, 0x48, 0x20,
3435 0x50, 0x64, 0x04, 0x34,
3436 0x50, 0x0f,
3437};
3438static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3439 0x00, 0x10, 0x34, 0x64,
3440 0x48, 0x07, 0x48, 0x10,
3441 0x50, 0x64, 0x04, 0x34,
3442 0x50, 0x0F,
3443};
3444
3445static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3446 [0] = {
3447 .mode = MSM_SPM_L2_MODE_RETENTION,
3448 .notify_rpm = false,
3449 .cmd = l2_spm_wfi_cmd_sequence,
3450 },
3451 [1] = {
3452 .mode = MSM_SPM_L2_MODE_GDHS,
3453 .notify_rpm = true,
3454 .cmd = l2_spm_gdhs_cmd_sequence,
3455 },
3456 [2] = {
3457 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3458 .notify_rpm = true,
3459 .cmd = l2_spm_power_off_cmd_sequence,
3460 },
3461};
3462
3463
3464static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3465 [0] = {
3466 .reg_base_addr = MSM_SAW_L2_BASE,
3467 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3468 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3469 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3470 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3471 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3472 .modes = msm_spm_l2_seq_list,
3473 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3474 },
3475};
3476
Mohan Pallaka5e490392011-09-09 15:18:41 +05303477#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3478#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3479
3480static struct msm_xo_voter *xo_handle_d1;
3481
3482static int isa1200_power(int on)
3483{
3484 int rc = 0;
3485
3486 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3487
3488 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3489 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3490 if (rc < 0) {
3491 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3492 __func__, on ? "" : "de-", rc);
3493 goto err_xo_vote;
3494 }
3495
3496 return 0;
3497
3498err_xo_vote:
3499 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3500 return rc;
3501}
3502
3503static int isa1200_dev_setup(bool enable)
3504{
3505 int rc = 0;
3506
3507 struct pm_gpio hap_gpio_config = {
3508 .direction = PM_GPIO_DIR_OUT,
3509 .pull = PM_GPIO_PULL_NO,
3510 .out_strength = PM_GPIO_STRENGTH_HIGH,
3511 .function = PM_GPIO_FUNC_NORMAL,
3512 .inv_int_pol = 0,
3513 .vin_sel = 2,
3514 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3515 .output_value = 0,
3516 };
3517
3518 if (enable == true) {
3519 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3520 if (rc) {
3521 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3522 __func__, PM_HAP_EN_GPIO, rc);
3523 return rc;
3524 }
3525
3526 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3527 if (rc) {
3528 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3529 __func__, PM_HAP_LEN_GPIO, rc);
3530 return rc;
3531 }
3532
3533 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3534 if (rc) {
3535 pr_err("%s: unable to request gpio %d (%d)\n",
3536 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3537 return rc;
3538 }
3539
3540 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3541 if (rc) {
3542 pr_err("%s: Unable to set direction\n", __func__);
3543 goto free_gpio;
3544 }
3545
3546 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3547 if (IS_ERR(xo_handle_d1)) {
3548 rc = PTR_ERR(xo_handle_d1);
3549 pr_err("%s: failed to get the handle for D1(%d)\n",
3550 __func__, rc);
3551 goto gpio_set_dir;
3552 }
3553 } else {
3554 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3555
3556 msm_xo_put(xo_handle_d1);
3557 }
3558
3559 return 0;
3560
3561gpio_set_dir:
3562 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3563free_gpio:
3564 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3565 return rc;
3566}
3567
3568static struct isa1200_regulator isa1200_reg_data[] = {
3569 {
3570 .name = "vcc_i2c",
3571 .min_uV = ISA_I2C_VTG_MIN_UV,
3572 .max_uV = ISA_I2C_VTG_MAX_UV,
3573 .load_uA = ISA_I2C_CURR_UA,
3574 },
3575};
3576
3577static struct isa1200_platform_data isa1200_1_pdata = {
3578 .name = "vibrator",
3579 .dev_setup = isa1200_dev_setup,
3580 .power_on = isa1200_power,
3581 .hap_en_gpio = PM_HAP_EN_GPIO,
3582 .hap_len_gpio = PM_HAP_LEN_GPIO,
3583 .max_timeout = 15000,
3584 .mode_ctrl = PWM_GEN_MODE,
3585 .pwm_fd = {
3586 .pwm_div = 256,
3587 },
3588 .is_erm = false,
3589 .smart_en = true,
3590 .ext_clk_en = true,
3591 .chip_en = 1,
3592 .regulator_info = isa1200_reg_data,
3593 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3594};
3595
3596static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3597 {
3598 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3599 .platform_data = &isa1200_1_pdata,
3600 },
3601};
3602
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003603#define CYTTSP_TS_GPIO_IRQ 11
3604#define CYTTSP_TS_SLEEP_GPIO 50
3605#define CYTTSP_TS_RESOUT_N_GPIO 52
3606
3607/*virtual key support */
3608static ssize_t tma340_vkeys_show(struct kobject *kobj,
3609 struct kobj_attribute *attr, char *buf)
3610{
3611 return snprintf(buf, 200,
3612 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3613 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3614 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3615 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3616 "\n");
3617}
3618
3619static struct kobj_attribute tma340_vkeys_attr = {
3620 .attr = {
3621 .mode = S_IRUGO,
3622 },
3623 .show = &tma340_vkeys_show,
3624};
3625
3626static struct attribute *tma340_properties_attrs[] = {
3627 &tma340_vkeys_attr.attr,
3628 NULL
3629};
3630
3631static struct attribute_group tma340_properties_attr_group = {
3632 .attrs = tma340_properties_attrs,
3633};
3634
3635
3636static int cyttsp_platform_init(struct i2c_client *client)
3637{
3638 int rc = 0;
3639 static struct kobject *tma340_properties_kobj;
3640
3641 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3642 tma340_properties_kobj = kobject_create_and_add("board_properties",
3643 NULL);
3644 if (tma340_properties_kobj)
3645 rc = sysfs_create_group(tma340_properties_kobj,
3646 &tma340_properties_attr_group);
3647 if (!tma340_properties_kobj || rc)
3648 pr_err("%s: failed to create board_properties\n",
3649 __func__);
3650
3651 return 0;
3652}
3653
3654static struct cyttsp_regulator regulator_data[] = {
3655 {
3656 .name = "vdd",
3657 .min_uV = CY_TMA300_VTG_MIN_UV,
3658 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303659 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3660 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003661 },
3662 /* TODO: Remove after runtime PM is enabled in I2C driver */
3663 {
3664 .name = "vcc_i2c",
3665 .min_uV = CY_I2C_VTG_MIN_UV,
3666 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303667 .hpm_load_uA = CY_I2C_CURR_UA,
3668 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003669 },
3670};
3671
3672static struct cyttsp_platform_data cyttsp_pdata = {
3673 .panel_maxx = 634,
3674 .panel_maxy = 1166,
3675 .disp_maxx = 616,
3676 .disp_maxy = 1023,
3677 .disp_minx = 0,
3678 .disp_miny = 16,
3679 .flags = 0x01,
3680 .gen = CY_GEN3, /* or */
3681 .use_st = CY_USE_ST,
3682 .use_mt = CY_USE_MT,
3683 .use_hndshk = CY_SEND_HNDSHK,
3684 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303685 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003686 .use_gestures = CY_USE_GESTURES,
3687 .fw_fname = "cyttsp_8960_cdp.hex",
3688 /* activate up to 4 groups
3689 * and set active distance
3690 */
3691 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3692 CY_GEST_GRP3 | CY_GEST_GRP4 |
3693 CY_ACT_DIST,
3694 /* change act_intrvl to customize the Active power state
3695 * scanning/processing refresh interval for Operating mode
3696 */
3697 .act_intrvl = CY_ACT_INTRVL_DFLT,
3698 /* change tch_tmout to customize the touch timeout for the
3699 * Active power state for Operating mode
3700 */
3701 .tch_tmout = CY_TCH_TMOUT_DFLT,
3702 /* change lp_intrvl to customize the Low Power power state
3703 * scanning/processing refresh interval for Operating mode
3704 */
3705 .lp_intrvl = CY_LP_INTRVL_DFLT,
3706 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3707 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3708 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3709 .regulator_info = regulator_data,
3710 .num_regulators = ARRAY_SIZE(regulator_data),
3711 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303712 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003713};
3714
3715static struct i2c_board_info cyttsp_info[] __initdata = {
3716 {
3717 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3718 .platform_data = &cyttsp_pdata,
3719#ifndef CY_USE_TIMER
3720 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3721#endif /* CY_USE_TIMER */
3722 },
3723};
3724
Mohan Pallaka50837382011-09-07 11:00:57 +05303725/* configuration data */
3726static const u8 mxt_config_data[] = {
3727 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003728 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303729 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003730 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07003731 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3732 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3733 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3734 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3735 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3736 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303737 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003738 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303739 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003740 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05303741 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003742 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
3743 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
3744 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
3745 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303746 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003747 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3748 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303749 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003750 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3751 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303752 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003753 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3754 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303755 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003756 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3757 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303758 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003759 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303760 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003761 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303762 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003763 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303764 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003765 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303766 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003767 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303768};
3769
3770#define MXT_TS_GPIO_IRQ 11
3771#define MXT_TS_LDO_EN_GPIO 50
3772#define MXT_TS_RESET_GPIO 52
3773
3774static void mxt_init_hw_liquid(void)
3775{
3776 int rc;
3777
3778 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3779 if (rc) {
3780 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3781 __func__, MXT_TS_GPIO_IRQ);
3782 return;
3783 }
3784
3785 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3786 if (rc) {
3787 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3788 __func__, MXT_TS_GPIO_IRQ);
3789 goto err_irq_gpio_req;
3790 }
3791
3792 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3793 if (rc) {
3794 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3795 __func__, MXT_TS_LDO_EN_GPIO);
3796 goto err_irq_gpio_req;
3797 }
3798
3799 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3800 if (rc) {
3801 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3802 __func__, MXT_TS_LDO_EN_GPIO);
3803 goto err_ldo_gpio_req;
3804 }
3805
3806 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3807 if (rc) {
3808 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3809 __func__, MXT_TS_RESET_GPIO);
3810 goto err_ldo_gpio_set_dir;
3811 }
3812
3813 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3814 if (rc) {
3815 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3816 __func__, MXT_TS_RESET_GPIO);
3817 goto err_reset_gpio_req;
3818 }
3819
3820 return;
3821
3822err_reset_gpio_req:
3823 gpio_free(MXT_TS_RESET_GPIO);
3824err_ldo_gpio_set_dir:
3825 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3826err_ldo_gpio_req:
3827 gpio_free(MXT_TS_LDO_EN_GPIO);
3828err_irq_gpio_req:
3829 gpio_free(MXT_TS_GPIO_IRQ);
3830}
3831
3832static struct mxt_platform_data mxt_platform_data = {
3833 .config = mxt_config_data,
3834 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003835 .x_size = 1365,
3836 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303837 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003838 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303839};
3840
3841static struct i2c_board_info mxt_device_info[] __initdata = {
3842 {
3843 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3844 .platform_data = &mxt_platform_data,
3845 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3846 },
3847};
3848
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003849static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3850{
3851}
3852
3853static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3854 .clk_freq = 100000,
3855 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003856 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3857};
3858
3859static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3860 .clk_freq = 100000,
3861 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003862 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3863};
3864
3865static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3866 .clk_freq = 100000,
3867 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003868 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3869};
3870
3871static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3872 .clk_freq = 100000,
3873 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003874 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3875};
3876
3877static struct msm_rpm_platform_data msm_rpm_data = {
3878 .reg_base_addrs = {
3879 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3880 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3881 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3882 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3883 },
3884
3885 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3886 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3887 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3888 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3889 .msm_apps_ipc_rpm_val = 4,
3890};
3891
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003892static struct ks8851_pdata spi_eth_pdata = {
3893 .irq_gpio = KS8851_IRQ_GPIO,
3894 .rst_gpio = KS8851_RST_GPIO,
3895};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003896
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003897static struct spi_board_info spi_board_info[] __initdata = {
3898 {
3899 .modalias = "ks8851",
3900 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3901 .max_speed_hz = 19200000,
3902 .bus_num = 0,
3903 .chip_select = 0,
3904 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003905 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003906 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003907 {
3908 .modalias = "dsi_novatek_3d_panel_spi",
3909 .max_speed_hz = 10800000,
3910 .bus_num = 0,
3911 .chip_select = 1,
3912 .mode = SPI_MODE_0,
3913 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003914};
3915
3916static struct platform_device msm_device_saw_core0 = {
3917 .name = "saw-regulator",
3918 .id = 0,
3919 .dev = {
3920 .platform_data = &msm_saw_regulator_pdata_s5,
3921 },
3922};
3923
3924static struct platform_device msm_device_saw_core1 = {
3925 .name = "saw-regulator",
3926 .id = 1,
3927 .dev = {
3928 .platform_data = &msm_saw_regulator_pdata_s6,
3929 },
3930};
3931
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003932#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3933static struct platform_device wfd_device = {
3934 .name = "msm_wfd",
3935 .id = -1,
3936};
3937#endif
3938
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003939static struct tsens_platform_data msm_tsens_pdata = {
3940 .slope = 910,
3941 .tsens_factor = 1000,
3942 .hw_type = MSM_8960,
3943 .tsens_num_sensor = 5,
3944};
3945
3946static struct platform_device msm_tsens_device = {
3947 .name = "tsens8960-tm",
3948 .id = -1,
3949 .dev = {
3950 .platform_data = &msm_tsens_pdata,
3951 },
3952};
3953
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003954#ifdef CONFIG_MSM_FAKE_BATTERY
3955static struct platform_device fish_battery_device = {
3956 .name = "fish_battery",
3957};
3958#endif
3959
David Collins26f05562011-06-20 09:56:28 -07003960static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003961 .name = GPIO_REGULATOR_DEV_NAME,
3962 .id = PM8921_MPP_PM_TO_SYS(7),
3963 .dev = {
3964 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3965 },
3966};
3967
David Collins26f05562011-06-20 09:56:28 -07003968static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003969 .name = GPIO_REGULATOR_DEV_NAME,
3970 .id = 91,
3971 .dev = {
3972 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3973 },
3974};
3975
David Collinsb10be1d2011-09-02 10:29:31 -07003976static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3977 .name = GPIO_REGULATOR_DEV_NAME,
3978 .id = PM8921_GPIO_PM_TO_SYS(17),
3979 .dev = {
3980 .platform_data =
3981 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3982 },
3983};
3984
David Collins26f05562011-06-20 09:56:28 -07003985static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3986 .name = "rpm-regulator",
3987 .id = -1,
3988 .dev = {
3989 .platform_data = &msm_rpm_regulator_pdata,
3990 },
3991};
3992
David Collins4c31a872011-08-31 10:07:10 -07003993static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3994 .phys_addr_base = 0x0010C000,
3995 .reg_offsets = {
3996 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3997 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3998 },
3999 .phys_size = SZ_8K,
4000 .log_len = 4096, /* log's buffer length in bytes */
4001 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
4002};
4003
4004static struct platform_device msm_rpm_log_device = {
4005 .name = "msm_rpm_log",
4006 .id = -1,
4007 .dev = {
4008 .platform_data = &msm_rpm_log_pdata,
4009 },
4010};
4011
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004012static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07004013 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004014 &msm_device_smd,
4015 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05304016 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004017 &msm_device_saw_core0,
4018 &msm_device_saw_core1,
4019 &msm8960_device_ext_5v_vreg,
4020 &msm8960_device_ext_l2_vreg,
4021 &msm8960_device_ssbi_pm8921,
4022 &msm8960_device_qup_spi_gsbi1,
4023 &msm8960_device_qup_i2c_gsbi3,
4024 &msm8960_device_qup_i2c_gsbi4,
4025 &msm8960_device_qup_i2c_gsbi10,
4026#ifndef CONFIG_MSM_DSPS
4027 &msm8960_device_qup_i2c_gsbi12,
4028#endif
4029 &msm_slim_ctrl,
4030 &msm_device_wcnss_wlan,
4031#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
4032 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
4033 &qcrypto_device,
4034#endif
4035
4036#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
4037 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
4038 &qcedev_device,
4039#endif
4040#ifdef CONFIG_MSM_ROTATOR
4041 &msm_rotator_device,
4042#endif
4043 &msm_device_sps,
4044#ifdef CONFIG_MSM_FAKE_BATTERY
4045 &fish_battery_device,
4046#endif
4047#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07004048#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004049 &android_pmem_device,
4050 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07004051#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004052 &android_pmem_audio_device,
4053#endif
4054 &msm_fb_device,
4055 &msm_device_vidc,
4056 &msm_device_bam_dmux,
4057 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07004058
4059#ifdef CONFIG_HW_RANDOM_MSM
4060 &msm_device_rng,
4061#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06004062 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07004063#ifdef CONFIG_ION_MSM
4064 &ion_dev,
4065#endif
David Collins4c31a872011-08-31 10:07:10 -07004066 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06004067 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07004068 &msm_device_tz_log,
4069
Pratik Patel7831c082011-06-08 21:44:37 -07004070#ifdef CONFIG_MSM_QDSS
4071 &msm_etb_device,
4072 &msm_tpiu_device,
4073 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07004074 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07004075 &msm_ptm_device,
4076#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07004077 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004078 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07004079#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
4080 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07004081 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07004082#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004083};
4084
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004085static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004086 &msm8960_device_otg,
4087 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004088 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05304089 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004090 &android_usb_device,
4091 &msm_device_vidc,
4092 &mipi_dsi_simulator_panel_device,
4093 &msm_bus_apps_fabric,
4094 &msm_bus_sys_fabric,
4095 &msm_bus_mm_fabric,
4096 &msm_bus_sys_fpb,
4097 &msm_bus_cpss_fpb,
4098 &msm_pcm,
4099 &msm_pcm_routing,
4100 &msm_cpudai0,
4101 &msm_cpudai1,
4102 &msm_cpudai_hdmi_rx,
4103 &msm_cpudai_bt_rx,
4104 &msm_cpudai_bt_tx,
4105 &msm_cpudai_fm_rx,
4106 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004107 &msm_cpudai_auxpcm_rx,
4108 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004109 &msm_cpu_fe,
4110 &msm_stub_codec,
4111 &msm_voice,
4112 &msm_voip,
4113 &msm_lpa_pcm,
4114
4115#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
4116 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
4117 &qcrypto_device,
4118#endif
4119
4120#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
4121 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
4122 &qcedev_device,
4123#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004124};
4125
4126static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004127 &msm_kgsl_3d0,
4128 &msm_kgsl_2d0,
4129 &msm_kgsl_2d1,
4130 &mipi_dsi_renesas_panel_device,
4131#ifdef CONFIG_MSM_GEMINI
4132 &msm8960_gemini_device,
4133#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004134};
4135
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004136static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004137 &msm8960_device_otg,
4138 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004139 &msm_device_hsusb_host,
4140 &android_usb_device,
4141 &msm_pcm,
4142 &msm_pcm_routing,
4143 &msm_cpudai0,
4144 &msm_cpudai1,
4145 &msm_cpudai_hdmi_rx,
4146 &msm_cpudai_bt_rx,
4147 &msm_cpudai_bt_tx,
4148 &msm_cpudai_fm_rx,
4149 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004150 &msm_cpudai_auxpcm_rx,
4151 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004152 &msm_cpu_fe,
4153 &msm_stub_codec,
4154 &msm_kgsl_3d0,
4155#ifdef CONFIG_MSM_KGSL_2D
4156 &msm_kgsl_2d0,
4157 &msm_kgsl_2d1,
4158#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004159 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004160#ifdef CONFIG_MSM_GEMINI
4161 &msm8960_gemini_device,
4162#endif
4163 &msm_voice,
4164 &msm_voip,
4165 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304166 &msm_cpudai_afe_01_rx,
4167 &msm_cpudai_afe_01_tx,
4168 &msm_cpudai_afe_02_rx,
4169 &msm_cpudai_afe_02_tx,
4170 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004171#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4172 &hdmi_msm_device,
4173#endif
4174 &msm_pcm_hostless,
4175 &msm_bus_apps_fabric,
4176 &msm_bus_sys_fabric,
4177 &msm_bus_mm_fabric,
4178 &msm_bus_sys_fpb,
4179 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004180 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004181};
4182
4183static void __init msm8960_i2c_init(void)
4184{
4185 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4186 &msm8960_i2c_qup_gsbi4_pdata;
4187
4188 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4189 &msm8960_i2c_qup_gsbi3_pdata;
4190
4191 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4192 &msm8960_i2c_qup_gsbi10_pdata;
4193
4194 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4195 &msm8960_i2c_qup_gsbi12_pdata;
4196}
4197
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004198static void __init msm8960_gfx_init(void)
4199{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004200 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004201 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4202 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4203 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06004204 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
4205 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004206 }
4207}
4208
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004209static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4210 .irq_base = PM8921_IRQ_BASE,
4211 .devirq = MSM_GPIO_TO_INT(104),
4212 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4213};
4214
4215static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4216 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4217};
4218
4219static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4220 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4221};
4222
4223static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4224 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304225 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004226};
4227
4228static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4229 .pull_up = 1,
4230 .kpd_trigger_delay_us = 970,
4231 .wakeup = 1,
4232};
4233
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304234/* Rotate lock key is not available so use F1 */
4235#define KEY_ROTATE_LOCK KEY_F1
4236
4237static const unsigned int keymap_liquid[] = {
4238 KEY(0, 0, KEY_VOLUMEUP),
4239 KEY(0, 1, KEY_VOLUMEDOWN),
4240 KEY(1, 3, KEY_ROTATE_LOCK),
4241 KEY(1, 4, KEY_HOME),
4242};
4243
4244static struct matrix_keymap_data keymap_data_liquid = {
4245 .keymap_size = ARRAY_SIZE(keymap_liquid),
4246 .keymap = keymap_liquid,
4247};
4248
4249static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4250 .input_name = "keypad_8960_liquid",
4251 .input_phys_device = "keypad_8960/input0",
4252 .num_rows = 2,
4253 .num_cols = 5,
4254 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4255 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4256 .debounce_ms = 15,
4257 .scan_delay_ms = 32,
4258 .row_hold_ns = 91500,
4259 .wakeup = 1,
4260 .keymap_data = &keymap_data_liquid,
4261};
4262
4263
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004264static const unsigned int keymap[] = {
4265 KEY(0, 0, KEY_VOLUMEUP),
4266 KEY(0, 1, KEY_VOLUMEDOWN),
4267 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4268 KEY(0, 3, KEY_CAMERA_FOCUS),
4269};
4270
4271static struct matrix_keymap_data keymap_data = {
4272 .keymap_size = ARRAY_SIZE(keymap),
4273 .keymap = keymap,
4274};
4275
4276static struct pm8xxx_keypad_platform_data keypad_data = {
4277 .input_name = "keypad_8960",
4278 .input_phys_device = "keypad_8960/input0",
4279 .num_rows = 1,
4280 .num_cols = 5,
4281 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4282 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4283 .debounce_ms = 15,
4284 .scan_delay_ms = 32,
4285 .row_hold_ns = 91500,
4286 .wakeup = 1,
4287 .keymap_data = &keymap_data,
4288};
4289
4290static const unsigned int keymap_sim[] = {
4291 KEY(0, 0, KEY_7),
4292 KEY(0, 1, KEY_DOWN),
4293 KEY(0, 2, KEY_UP),
4294 KEY(0, 3, KEY_RIGHT),
4295 KEY(0, 4, KEY_ENTER),
4296 KEY(0, 5, KEY_L),
4297 KEY(0, 6, KEY_BACK),
4298 KEY(0, 7, KEY_M),
4299
4300 KEY(1, 0, KEY_LEFT),
4301 KEY(1, 1, KEY_SEND),
4302 KEY(1, 2, KEY_1),
4303 KEY(1, 3, KEY_4),
4304 KEY(1, 4, KEY_CLEAR),
4305 KEY(1, 5, KEY_MSDOS),
4306 KEY(1, 6, KEY_SPACE),
4307 KEY(1, 7, KEY_COMMA),
4308
4309 KEY(2, 0, KEY_6),
4310 KEY(2, 1, KEY_5),
4311 KEY(2, 2, KEY_8),
4312 KEY(2, 3, KEY_3),
4313 KEY(2, 4, KEY_NUMERIC_STAR),
4314 KEY(2, 5, KEY_UP),
4315 KEY(2, 6, KEY_DOWN),
4316 KEY(2, 7, KEY_LEFTSHIFT),
4317
4318 KEY(3, 0, KEY_9),
4319 KEY(3, 1, KEY_NUMERIC_POUND),
4320 KEY(3, 2, KEY_0),
4321 KEY(3, 3, KEY_2),
4322 KEY(3, 4, KEY_SLEEP),
4323 KEY(3, 5, KEY_F1),
4324 KEY(3, 6, KEY_F2),
4325 KEY(3, 7, KEY_F3),
4326
4327 KEY(4, 0, KEY_BACK),
4328 KEY(4, 1, KEY_HOME),
4329 KEY(4, 2, KEY_MENU),
4330 KEY(4, 3, KEY_VOLUMEUP),
4331 KEY(4, 4, KEY_VOLUMEDOWN),
4332 KEY(4, 5, KEY_F4),
4333 KEY(4, 6, KEY_F5),
4334 KEY(4, 7, KEY_F6),
4335
4336 KEY(5, 0, KEY_R),
4337 KEY(5, 1, KEY_T),
4338 KEY(5, 2, KEY_Y),
4339 KEY(5, 3, KEY_LEFTALT),
4340 KEY(5, 4, KEY_KPENTER),
4341 KEY(5, 5, KEY_Q),
4342 KEY(5, 6, KEY_W),
4343 KEY(5, 7, KEY_E),
4344
4345 KEY(6, 0, KEY_F),
4346 KEY(6, 1, KEY_G),
4347 KEY(6, 2, KEY_H),
4348 KEY(6, 3, KEY_CAPSLOCK),
4349 KEY(6, 4, KEY_PAGEUP),
4350 KEY(6, 5, KEY_A),
4351 KEY(6, 6, KEY_S),
4352 KEY(6, 7, KEY_D),
4353
4354 KEY(7, 0, KEY_V),
4355 KEY(7, 1, KEY_B),
4356 KEY(7, 2, KEY_N),
4357 KEY(7, 3, KEY_MENU),
4358 KEY(7, 4, KEY_PAGEDOWN),
4359 KEY(7, 5, KEY_Z),
4360 KEY(7, 6, KEY_X),
4361 KEY(7, 7, KEY_C),
4362
4363 KEY(8, 0, KEY_P),
4364 KEY(8, 1, KEY_J),
4365 KEY(8, 2, KEY_K),
4366 KEY(8, 3, KEY_INSERT),
4367 KEY(8, 4, KEY_LINEFEED),
4368 KEY(8, 5, KEY_U),
4369 KEY(8, 6, KEY_I),
4370 KEY(8, 7, KEY_O),
4371
4372 KEY(9, 0, KEY_4),
4373 KEY(9, 1, KEY_5),
4374 KEY(9, 2, KEY_6),
4375 KEY(9, 3, KEY_7),
4376 KEY(9, 4, KEY_8),
4377 KEY(9, 5, KEY_1),
4378 KEY(9, 6, KEY_2),
4379 KEY(9, 7, KEY_3),
4380
4381 KEY(10, 0, KEY_F7),
4382 KEY(10, 1, KEY_F8),
4383 KEY(10, 2, KEY_F9),
4384 KEY(10, 3, KEY_F10),
4385 KEY(10, 4, KEY_FN),
4386 KEY(10, 5, KEY_9),
4387 KEY(10, 6, KEY_0),
4388 KEY(10, 7, KEY_DOT),
4389
4390 KEY(11, 0, KEY_LEFTCTRL),
4391 KEY(11, 1, KEY_F11),
4392 KEY(11, 2, KEY_ENTER),
4393 KEY(11, 3, KEY_SEARCH),
4394 KEY(11, 4, KEY_DELETE),
4395 KEY(11, 5, KEY_RIGHT),
4396 KEY(11, 6, KEY_LEFT),
4397 KEY(11, 7, KEY_RIGHTSHIFT),
4398 KEY(0, 0, KEY_VOLUMEUP),
4399 KEY(0, 1, KEY_VOLUMEDOWN),
4400 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4401 KEY(0, 3, KEY_CAMERA_FOCUS),
4402};
4403
4404static struct matrix_keymap_data keymap_data_sim = {
4405 .keymap_size = ARRAY_SIZE(keymap_sim),
4406 .keymap = keymap_sim,
4407};
4408
4409static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4410 .input_name = "keypad_8960",
4411 .input_phys_device = "keypad_8960/input0",
4412 .num_rows = 12,
4413 .num_cols = 8,
4414 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4415 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4416 .debounce_ms = 15,
4417 .scan_delay_ms = 32,
4418 .row_hold_ns = 91500,
4419 .wakeup = 1,
4420 .keymap_data = &keymap_data_sim,
4421};
4422
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004423static int pm8921_therm_mitigation[] = {
4424 1100,
4425 700,
4426 600,
4427 325,
4428};
4429
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004430static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004431 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004432 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004433 .max_voltage = 4200,
4434 .min_voltage = 3200,
Abhijeet Dharmapurikard55878e2011-10-27 10:22:24 -07004435 .resume_voltage_delta = 100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004436 .term_current = 100,
4437 .cool_temp = 10,
4438 .warm_temp = 40,
4439 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004440 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004441 .cool_bat_chg_current = 350,
4442 .warm_bat_chg_current = 350,
4443 .cool_bat_voltage = 4100,
4444 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004445 .thermal_mitigation = pm8921_therm_mitigation,
4446 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004447};
4448
4449static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4450 .priority = 0,
4451};
4452
4453static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4454 .r_sense = 10,
4455 .i_test = 2500,
4456 .v_failure = 3000,
4457 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004458};
4459
Jay Chokshide4cefb2011-08-04 18:10:44 -07004460#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004461#define PM8XXX_LED_PWM_PERIOD 1000
4462#define PM8XXX_LED_PWM_DUTY_MS 20
4463/**
4464 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4465 * driven using PWM feature.
4466 */
4467#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004468
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004469static struct led_info pm8921_led_info[] = {
4470 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004471 .name = "led:battery_charging",
4472 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004473 },
4474 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004475 .name = "led:battery_full",
4476 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004477 },
4478};
4479
Jay Chokshi8994e392011-09-14 18:20:39 -07004480static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004481 .num_leds = ARRAY_SIZE(pm8921_led_info),
4482 .leds = pm8921_led_info,
4483};
4484
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004485static int pm8921_led0_pwm_duty_pcts[56] = {
4486 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4487 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4488 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4489 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4490 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4491 14, 10, 6, 4, 1
4492};
4493
4494static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4495 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4496 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4497 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4498 .start_idx = 0,
4499};
4500
Jay Chokshi8994e392011-09-14 18:20:39 -07004501static struct pm8xxx_led_config pm8921_led_configs[] = {
4502 [0] = {
4503 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004504 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004505 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004506 .pwm_channel = 5,
4507 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4508 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004509 },
4510 [1] = {
4511 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004512 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004513 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004514 .pwm_channel = 4,
4515 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004516 },
4517};
4518
4519static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4520 .led_core = &pm8921_led_core_pdata,
4521 .configs = pm8921_led_configs,
4522 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4523};
4524
Abhijeet Dharmapurikar82d93982011-11-09 15:52:25 -08004525static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
4526 .r_sense = 10,
4527};
4528
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004529static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4530 .irq_pdata = &pm8xxx_irq_pdata,
4531 .gpio_pdata = &pm8xxx_gpio_pdata,
4532 .mpp_pdata = &pm8xxx_mpp_pdata,
4533 .rtc_pdata = &pm8xxx_rtc_pdata,
4534 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4535 .keypad_pdata = &keypad_data,
4536 .misc_pdata = &pm8xxx_misc_pdata,
4537 .regulator_pdatas = msm_pm8921_regulator_pdata,
4538 .charger_pdata = &pm8921_chg_pdata,
4539 .bms_pdata = &pm8921_bms_pdata,
4540 .adc_pdata = &pm8921_adc_pdata,
4541 .leds_pdata = &pm8xxx_leds_pdata,
Abhijeet Dharmapurikar82d93982011-11-09 15:52:25 -08004542 .ccadc_pdata = &pm8xxx_ccadc_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004543};
4544
4545static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4546 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4547 .slave = {
4548 .name = "pm8921-core",
4549 .platform_data = &pm8921_platform_data,
4550 },
4551};
4552
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004553static struct msm_cpuidle_state msm_cstates[] __initdata = {
4554 {0, 0, "C0", "WFI",
4555 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4556
4557 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4558 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4559
4560 {0, 2, "C2", "POWER_COLLAPSE",
4561 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4562
4563 {1, 0, "C0", "WFI",
4564 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4565
4566 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4567 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4568};
4569
4570static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4571 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4572 .idle_supported = 1,
4573 .suspend_supported = 1,
4574 .idle_enabled = 0,
4575 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004576 },
4577
4578 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4579 .idle_supported = 1,
4580 .suspend_supported = 1,
4581 .idle_enabled = 0,
4582 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004583 },
4584
4585 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4586 .idle_supported = 1,
4587 .suspend_supported = 1,
4588 .idle_enabled = 1,
4589 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004590 },
4591
4592 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4593 .idle_supported = 0,
4594 .suspend_supported = 1,
4595 .idle_enabled = 0,
4596 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004597 },
4598
4599 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4600 .idle_supported = 1,
4601 .suspend_supported = 1,
4602 .idle_enabled = 0,
4603 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004604 },
4605
4606 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4607 .idle_supported = 1,
4608 .suspend_supported = 0,
4609 .idle_enabled = 1,
4610 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004611 },
4612};
4613
4614static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4615 {
4616 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4617 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4618 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004619 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004620 },
4621
4622 {
4623 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4624 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4625 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004626 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004627 },
4628
4629 {
4630 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4631 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4632 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004633 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004634 },
4635
4636 {
4637 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4638 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4639 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004640 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004641 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004642 {
4643 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4644 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4645 false,
4646 7000, 3500, 66600000, 5150,
4647 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004648
4649 {
4650 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4651 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4652 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004653 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004654 },
4655
4656 {
4657 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4658 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4659 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004660 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004661 },
4662
4663 {
4664 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4665 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4666 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004667 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004668 },
4669
4670 {
4671 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4672 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4673 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004674 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004675 },
4676};
4677
4678#ifdef CONFIG_I2C
4679#define I2C_SURF 1
4680#define I2C_FFA (1 << 1)
4681#define I2C_RUMI (1 << 2)
4682#define I2C_SIM (1 << 3)
4683#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004684#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004685
4686struct i2c_registry {
4687 u8 machs;
4688 int bus;
4689 struct i2c_board_info *info;
4690 int len;
4691};
4692
4693#ifdef CONFIG_MSM_CAMERA
4694static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4695#ifdef CONFIG_IMX074
4696 {
4697 I2C_BOARD_INFO("imx074", 0x1A),
4698 },
4699#endif
4700#ifdef CONFIG_OV2720
4701 {
4702 I2C_BOARD_INFO("ov2720", 0x6C),
4703 },
4704#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05304705#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4706 {
4707 I2C_BOARD_INFO("sc628a", 0x6E),
4708 },
4709#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004710};
4711#endif
4712
4713/* Sensors DSPS platform data */
4714#ifdef CONFIG_MSM_DSPS
4715#define DSPS_PIL_GENERIC_NAME "dsps"
4716#endif /* CONFIG_MSM_DSPS */
4717
4718static void __init msm8960_init_dsps(void)
4719{
4720#ifdef CONFIG_MSM_DSPS
4721 struct msm_dsps_platform_data *pdata =
4722 msm_dsps_device.dev.platform_data;
4723 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4724 pdata->gpios = NULL;
4725 pdata->gpios_num = 0;
4726
4727 platform_device_register(&msm_dsps_device);
4728#endif /* CONFIG_MSM_DSPS */
4729}
4730
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004731static void __init msm8960_init_hsic(void)
4732{
4733#ifdef CONFIG_USB_EHCI_MSM_HSIC
4734 uint32_t version = socinfo_get_version();
4735
4736 pr_info("%s: version:%d mtp:%d\n", __func__,
4737 SOCINFO_VERSION_MAJOR(version),
4738 machine_is_msm8960_mtp());
4739
4740 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4741 machine_is_msm8960_mtp() ||
4742 machine_is_msm8960_fluid())
4743 return;
4744
4745 msm_gpiomux_install(msm8960_hsic_configs,
4746 ARRAY_SIZE(msm8960_hsic_configs));
4747
4748 platform_device_register(&msm_device_hsic_host);
4749#endif
4750}
4751
4752
Amir Samuelov5137e392011-09-21 17:31:25 +03004753#ifdef CONFIG_ISL9519_CHARGER
4754static struct isl_platform_data isl_data __initdata = {
4755 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4756 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4757 .max_system_voltage = 4200,
4758 .min_system_voltage = 3200,
4759 .chgcurrent = 1000, /* 1900, */
4760 .term_current = 400, /* Need fine tuning */
4761 .input_current = 2048,
4762};
4763
4764static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4765 {
4766 I2C_BOARD_INFO("isl9519q", 0x9),
4767 .irq = 0, /* Not required when notify-by-pmic */
4768 .platform_data = &isl_data,
4769 },
4770};
4771#endif /* CONFIG_ISL9519_CHARGER */
4772
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004773static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4774#ifdef CONFIG_MSM_CAMERA
4775 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004776 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004777 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4778 msm_camera_boardinfo,
4779 ARRAY_SIZE(msm_camera_boardinfo),
4780 },
4781#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004782#ifdef CONFIG_ISL9519_CHARGER
4783 {
4784 I2C_LIQUID,
4785 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4786 isl_charger_i2c_info,
4787 ARRAY_SIZE(isl_charger_i2c_info),
4788 },
4789#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004790 {
4791 I2C_SURF | I2C_FFA | I2C_FLUID,
4792 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4793 cyttsp_info,
4794 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004795 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304796 {
4797 I2C_LIQUID,
4798 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4799 mxt_device_info,
4800 ARRAY_SIZE(mxt_device_info),
4801 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304802 {
4803 I2C_LIQUID,
4804 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4805 msm_isa1200_board_info,
4806 ARRAY_SIZE(msm_isa1200_board_info),
4807 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004808};
4809#endif /* CONFIG_I2C */
4810
4811static void __init register_i2c_devices(void)
4812{
4813#ifdef CONFIG_I2C
4814 u8 mach_mask = 0;
4815 int i;
4816
4817 /* Build the matching 'supported_machs' bitmask */
4818 if (machine_is_msm8960_cdp())
4819 mach_mask = I2C_SURF;
4820 else if (machine_is_msm8960_rumi3())
4821 mach_mask = I2C_RUMI;
4822 else if (machine_is_msm8960_sim())
4823 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004824 else if (machine_is_msm8960_fluid())
4825 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004826 else if (machine_is_msm8960_liquid())
4827 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004828 else if (machine_is_msm8960_mtp())
4829 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004830 else
4831 pr_err("unmatched machine ID in register_i2c_devices\n");
4832
4833 /* Run the array and install devices as appropriate */
4834 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4835 if (msm8960_i2c_devices[i].machs & mach_mask)
4836 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4837 msm8960_i2c_devices[i].info,
4838 msm8960_i2c_devices[i].len);
4839 }
4840#endif
4841}
4842
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004843static void __init msm8960_sim_init(void)
4844{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004845 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4846 &msm8960_device_watchdog.dev.platform_data;
4847
4848 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004849 BUG_ON(msm_rpm_init(&msm_rpm_data));
4850 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4851 ARRAY_SIZE(msm_rpmrs_levels)));
4852 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004853 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004854 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004855 msm8960_device_ssbi_pm8921.dev.platform_data =
4856 &msm8960_ssbi_pm8921_pdata;
4857 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004858
4859 /* Simulator supports a QWERTY keypad */
4860 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4861
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004862 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004863 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004864 msm8960_i2c_init();
4865 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4866 msm_spm_l2_init(msm_spm_l2_data);
4867 msm8960_init_buses();
4868 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4869 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004870 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004871 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004872
4873 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4874 &msm8960_qup_spi_gsbi1_pdata;
4875 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4876
4877 msm8960_init_mmc();
4878 msm_fb_add_devices();
4879 slim_register_board_info(msm_slim_devices,
4880 ARRAY_SIZE(msm_slim_devices));
4881 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4882 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4883 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4884 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004885 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004886}
4887
4888static void __init msm8960_rumi3_init(void)
4889{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004890 BUG_ON(msm_rpm_init(&msm_rpm_data));
4891 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4892 ARRAY_SIZE(msm_rpmrs_levels)));
4893 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004894 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004895 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004896 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004897 msm8960_device_ssbi_pm8921.dev.platform_data =
4898 &msm8960_ssbi_pm8921_pdata;
4899 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4900 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4901 &msm8960_qup_spi_gsbi1_pdata;
4902 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4903 msm8960_i2c_init();
4904 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4905 msm_spm_l2_init(msm_spm_l2_data);
4906 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4907 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004908 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004909 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004910 register_i2c_devices();
4911 msm_fb_add_devices();
4912 slim_register_board_info(msm_slim_devices,
4913 ARRAY_SIZE(msm_slim_devices));
4914 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4915 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4916 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4917 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004918 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004919}
4920
4921static void __init msm8960_cdp_init(void)
4922{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004923 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4924 pr_err("meminfo_init() failed!\n");
4925
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004926 BUG_ON(msm_rpm_init(&msm_rpm_data));
4927 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4928 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004929
4930 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004931 regulator_suppress_info_printing();
4932 if (msm_xo_init())
4933 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004934 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004935 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304936 if (machine_is_msm8960_liquid())
4937 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004938 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304939#ifdef CONFIG_USB_EHCI_MSM_HSIC
4940 if (machine_is_msm8960_liquid()) {
4941 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4942 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4943 }
4944#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304945 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004946 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304947 if (machine_is_msm8960_liquid())
4948 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004949 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4950 &msm8960_qup_spi_gsbi1_pdata;
4951 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4952 msm8960_device_ssbi_pm8921.dev.platform_data =
4953 &msm8960_ssbi_pm8921_pdata;
4954 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4955 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004956 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004957 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4958 msm_spm_l2_init(msm_spm_l2_data);
4959 msm8960_init_buses();
4960 platform_add_devices(msm_footswitch_devices,
4961 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004962 if (machine_is_msm8960_liquid())
4963 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004964 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4965 pm8921_gpio_mpp_init();
4966 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004967 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004968 msm8960_init_cam();
4969 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004970 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304971 if (machine_is_msm8960_liquid())
4972 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004973 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004974 msm_fb_add_devices();
4975 slim_register_board_info(msm_slim_devices,
4976 ARRAY_SIZE(msm_slim_devices));
4977 msm8960_init_dsps();
4978 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4979 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4980 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4981 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004982 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004983 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Joel Kingb8352a12011-11-15 18:46:24 -08004984
4985 if (PLATFORM_IS_CHARM25())
4986 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004987}
4988
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004989MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4990 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004991 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004992 .init_irq = msm8960_init_irq,
4993 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004994 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004995 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004996 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004997MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004998
4999MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
5000 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005001 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08005002 .init_irq = msm8960_init_irq,
5003 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08005004 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005005 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07005006 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08005007MACHINE_END
5008
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005009MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
5010 .map_io = msm8960_map_io,
5011 .reserve = msm8960_reserve,
5012 .init_irq = msm8960_init_irq,
5013 .timer = &msm_timer,
5014 .init_machine = msm8960_cdp_init,
5015 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07005016 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005017MACHINE_END
5018
5019MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
5020 .map_io = msm8960_map_io,
5021 .reserve = msm8960_reserve,
5022 .init_irq = msm8960_init_irq,
5023 .timer = &msm_timer,
5024 .init_machine = msm8960_cdp_init,
5025 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07005026 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005027MACHINE_END
5028
5029MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
5030 .map_io = msm8960_map_io,
5031 .reserve = msm8960_reserve,
5032 .init_irq = msm8960_init_irq,
5033 .timer = &msm_timer,
5034 .init_machine = msm8960_cdp_init,
5035 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07005036 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005037MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03005038
5039MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
5040 .map_io = msm8960_map_io,
5041 .reserve = msm8960_reserve,
5042 .init_irq = msm8960_init_irq,
5043 .timer = &msm_timer,
5044 .init_machine = msm8960_cdp_init,
5045 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07005046 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03005047MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07005048
5049#ifdef CONFIG_ARCH_MSM8930
5050MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
5051 .map_io = msm8930_map_io,
5052 .reserve = msm8960_reserve,
5053 .init_irq = msm8960_init_irq,
5054 .timer = &msm_timer,
5055 .init_machine = msm8960_cdp_init,
5056 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07005057 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07005058MACHINE_END
5059
5060MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
5061 .map_io = msm8930_map_io,
5062 .reserve = msm8960_reserve,
5063 .init_irq = msm8960_init_irq,
5064 .timer = &msm_timer,
5065 .init_machine = msm8960_cdp_init,
5066 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07005067 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07005068MACHINE_END
5069
5070MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
5071 .map_io = msm8930_map_io,
5072 .reserve = msm8960_reserve,
5073 .init_irq = msm8960_init_irq,
5074 .timer = &msm_timer,
5075 .init_machine = msm8960_cdp_init,
5076 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07005077 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07005078MACHINE_END
5079#endif