blob: ab45aca57d75aa75535fe2cae5334ff1591e2dbb [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>
79
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080081#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#include "spm.h"
84#include "board-msm8960.h"
85#include "pm.h"
86#include "cpuidle.h"
87#include "rpm_resources.h"
88#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070089#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070090#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070091#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060092#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070093#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094
95static struct platform_device msm_fm_platform_init = {
96 .name = "iris_fm",
97 .id = -1,
98};
99
100struct pm8xxx_gpio_init {
101 unsigned gpio;
102 struct pm_gpio config;
103};
104
105struct pm8xxx_mpp_init {
106 unsigned mpp;
107 struct pm8xxx_mpp_config_data config;
108};
109
110#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
111 _func, _inv, _disable) \
112{ \
113 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
114 .config = { \
115 .direction = _dir, \
116 .output_buffer = _buf, \
117 .output_value = _val, \
118 .pull = _pull, \
119 .vin_sel = _vin, \
120 .out_strength = _out_strength, \
121 .function = _func, \
122 .inv_int_pol = _inv, \
123 .disable_pin = _disable, \
124 } \
125}
126
127#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
128{ \
129 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
130 .config = { \
131 .type = PM8XXX_MPP_TYPE_##_type, \
132 .level = _level, \
133 .control = PM8XXX_MPP_##_control, \
134 } \
135}
136
137#define PM8XXX_GPIO_DISABLE(_gpio) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
139 0, 0, 0, 1)
140
141#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
142 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
143 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
144 PM_GPIO_STRENGTH_HIGH, \
145 PM_GPIO_FUNC_NORMAL, 0, 0)
146
147#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
148 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
149 _pull, PM_GPIO_VIN_S4, \
150 PM_GPIO_STRENGTH_NO, \
151 PM_GPIO_FUNC_NORMAL, 0, 0)
152
153#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
154 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
155 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
156 PM_GPIO_STRENGTH_HIGH, \
157 _func, 0, 0)
158
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200159#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
160 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
161 PM_GPIO_PULL_NO, _vin, \
162 PM_GPIO_STRENGTH_HIGH, \
163 PM_GPIO_FUNC_NORMAL, 0, 0)
164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165/* Initial PM8921 GPIO configurations */
166static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
167 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
168 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
169 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300170 /* External regulator shared by display and touchscreen on LiQUID */
171 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200172 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700174 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700176 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530177 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178};
179
180/* Initial PM8921 MPP configurations */
181static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
182 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
183 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
185 DOUT_CTRL_LOW),
186};
187
188static void __init pm8921_gpio_mpp_init(void)
189{
190 int i, rc;
191
192 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
193 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
194 &pm8921_gpios[i].config);
195 if (rc) {
196 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
197 break;
198 }
199 }
200
201 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
202 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
203 &pm8921_mpps[i].config);
204 if (rc) {
205 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
206 break;
207 }
208 }
209}
210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211#define KS8851_RST_GPIO 89
212#define KS8851_IRQ_GPIO 90
213
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700214#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
215enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700216 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700217 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
218 /* CAM Expander */
219 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
220 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
221 GPIO_CAM_GP_AFBUSY,
222 GPIO_CAM_GP_STROBE_CE,
223 GPIO_CAM_GP_CAM1MP_XCLR,
224 GPIO_CAM_GP_CAMIF_RESET_N,
225 GPIO_CAM_GP_XMT_FLASH_INT,
226 GPIO_CAM_GP_LED_EN1,
227 GPIO_CAM_GP_LED_EN2,
228
229};
230#endif
231
Harini Jayaraman608d0462011-08-09 19:10:03 -0600232/* The SPI configurations apply to GSBI 1*/
233static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700235 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 .pull = GPIOMUX_PULL_NONE,
237};
238
Harini Jayaraman608d0462011-08-09 19:10:03 -0600239static struct gpiomux_setting spi_suspended_config = {
240 .func = GPIOMUX_FUNC_GPIO,
241 .drv = GPIOMUX_DRV_2MA,
242 .pull = GPIOMUX_PULL_DOWN,
243};
244
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700245static struct gpiomux_setting spi_active_config2 = {
246 .func = GPIOMUX_FUNC_2,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_NONE,
249};
250
251static struct gpiomux_setting spi_suspended_config2 = {
252 .func = GPIOMUX_FUNC_GPIO,
253 .drv = GPIOMUX_DRV_2MA,
254 .pull = GPIOMUX_PULL_UP,
255};
256
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530257static struct gpiomux_setting gsbi3_suspended_cfg = {
258 .func = GPIOMUX_FUNC_1,
259 .drv = GPIOMUX_DRV_2MA,
260 .pull = GPIOMUX_PULL_KEEPER,
261};
262
263static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264 .func = GPIOMUX_FUNC_1,
265 .drv = GPIOMUX_DRV_8MA,
266 .pull = GPIOMUX_PULL_NONE,
267};
268
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700269static struct gpiomux_setting gsbi5 = {
270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_8MA,
272 .pull = GPIOMUX_PULL_NONE,
273};
274
275static struct gpiomux_setting gsbi10 = {
276 .func = GPIOMUX_FUNC_2,
277 .drv = GPIOMUX_DRV_8MA,
278 .pull = GPIOMUX_PULL_NONE,
279};
280
281static struct gpiomux_setting gsbi12 = {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_8MA,
284 .pull = GPIOMUX_PULL_NONE,
285};
286
287static struct gpiomux_setting cdc_mclk = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_8MA,
290 .pull = GPIOMUX_PULL_NONE,
291};
292
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700293static struct gpiomux_setting audio_auxpcm[] = {
294 /* Suspended state */
295 {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_NONE,
299 },
300 /* Active state */
301 {
302 .func = GPIOMUX_FUNC_1,
303 .drv = GPIOMUX_DRV_2MA,
304 .pull = GPIOMUX_PULL_NONE,
305 },
306};
307
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700308#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309static struct gpiomux_setting gpio_eth_config = {
310 .pull = GPIOMUX_PULL_NONE,
311 .drv = GPIOMUX_DRV_8MA,
312 .func = GPIOMUX_FUNC_GPIO,
313};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700314#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315
316static struct gpiomux_setting slimbus = {
317 .func = GPIOMUX_FUNC_1,
318 .drv = GPIOMUX_DRV_8MA,
319 .pull = GPIOMUX_PULL_KEEPER,
320};
321
322struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700323#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 {
325 .gpio = KS8851_IRQ_GPIO,
326 .settings = {
327 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
328 }
329 },
330 {
331 .gpio = KS8851_RST_GPIO,
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
334 }
335 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700336#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337};
338
339static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
340 {
341 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
349 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600350 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
351 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352 },
353 },
354 {
355 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
356 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600357 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
358 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 },
360 },
361 {
362 .gpio = 9, /* GSBI1 QUP SPI_CLK */
363 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600364 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
365 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 },
367 },
368 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700369 .gpio = 14, /* GSBI1 SPI_CS_1 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
372 [GPIOMUX_ACTIVE] = &spi_active_config2,
373 },
374 },
375 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700376 .gpio = 16, /* GSBI3 I2C QUP SDA */
377 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530378 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
379 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 },
381 },
382 {
383 .gpio = 17, /* GSBI3 I2C QUP SCL */
384 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530385 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
386 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387 },
388 },
389 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700390 .gpio = 22, /* GSBI5 UART2 */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi5,
393 },
394 },
395 {
396 .gpio = 23, /* GSBI5 UART2 */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi5,
399 },
400 },
401 {
402 .gpio = 24, /* GSBI5 UART2 */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi5,
405 },
406 },
407 {
408 .gpio = 25, /* GSBI5 UART2 */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi5,
411 },
412 },
413 {
414 .gpio = 44, /* GSBI12 I2C QUP SDA */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi12,
417 },
418 },
419 {
420 .gpio = 45, /* GSBI12 I2C QUP SCL */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi12,
423 },
424 },
425 {
426 .gpio = 73, /* GSBI10 I2C QUP SDA */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &gsbi10,
429 },
430 },
431 {
432 .gpio = 74, /* GSBI10 I2C QUP SCL */
433 .settings = {
434 [GPIOMUX_SUSPENDED] = &gsbi10,
435 },
436 },
437};
438
439static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
440 {
441 .gpio = 60, /* slimbus data */
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &slimbus,
444 },
445 },
446 {
447 .gpio = 61, /* slimbus clk */
448 .settings = {
449 [GPIOMUX_SUSPENDED] = &slimbus,
450 },
451 },
452};
453
454static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
455 {
456 .gpio = 59,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &cdc_mclk,
459 },
460 },
461};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700462
463static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
464 {
465 .gpio = 63,
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
468 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
469 },
470 },
471 {
472 .gpio = 64,
473 .settings = {
474 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
475 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
476 },
477 },
478 {
479 .gpio = 65,
480 .settings = {
481 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
482 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
483 },
484 },
485 {
486 .gpio = 66,
487 .settings = {
488 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
489 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
490 },
491 },
492};
493
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700494static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
495 .func = GPIOMUX_FUNC_GPIO,
496 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700497 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498};
499
500static struct gpiomux_setting wcnss_5wire_active_cfg = {
501 .func = GPIOMUX_FUNC_1,
502 .drv = GPIOMUX_DRV_6MA,
503 .pull = GPIOMUX_PULL_DOWN,
504};
505
506static struct msm_gpiomux_config wcnss_5wire_interface[] = {
507 {
508 .gpio = 84,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
511 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
512 },
513 },
514 {
515 .gpio = 85,
516 .settings = {
517 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
518 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
519 },
520 },
521 {
522 .gpio = 86,
523 .settings = {
524 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
525 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
526 },
527 },
528 {
529 .gpio = 87,
530 .settings = {
531 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
532 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
533 },
534 },
535 {
536 .gpio = 88,
537 .settings = {
538 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
539 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
540 },
541 },
542};
Nishant Pandit24153d82011-08-27 16:05:13 +0530543static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530544 {
545 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
546 .drv = GPIOMUX_DRV_2MA,
547 .pull = GPIOMUX_PULL_DOWN,
548 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549
Nishant Pandit474f2252011-07-23 23:17:56 +0530550 {
551 .func = GPIOMUX_FUNC_1, /*active 1*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_NONE,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
558 .drv = GPIOMUX_DRV_2MA,
559 .pull = GPIOMUX_PULL_NONE,
560 },
561
562 {
563 .func = GPIOMUX_FUNC_1, /*active 3*/
564 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700565 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530566 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530567
568 {
569 .func = GPIOMUX_FUNC_5, /*active 4*/
570 .drv = GPIOMUX_DRV_8MA,
571 .pull = GPIOMUX_PULL_UP,
572 },
573
574 {
575 .func = GPIOMUX_FUNC_6, /*active 5*/
576 .drv = GPIOMUX_DRV_8MA,
577 .pull = GPIOMUX_PULL_UP,
578 },
579
580 {
581 .func = GPIOMUX_FUNC_2, /*active 6*/
582 .drv = GPIOMUX_DRV_2MA,
583 .pull = GPIOMUX_PULL_UP,
584 },
585
586 {
587 .func = GPIOMUX_FUNC_3, /*active 7*/
588 .drv = GPIOMUX_DRV_8MA,
589 .pull = GPIOMUX_PULL_UP,
590 },
591
Kevin Chan4c58d292011-09-13 11:03:25 -0700592 {
593 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
594 .drv = GPIOMUX_DRV_2MA,
595 .pull = GPIOMUX_PULL_KEEPER,
596 },
597
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598};
599
Nishant Pandit24153d82011-08-27 16:05:13 +0530600static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700601 {
602 .gpio = 2,
603 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530604 [GPIOMUX_ACTIVE] = &cam_settings[2],
605 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 },
608 {
609 .gpio = 3,
610 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530611 [GPIOMUX_ACTIVE] = &cam_settings[1],
612 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613 },
614 },
615 {
616 .gpio = 4,
617 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530618 [GPIOMUX_ACTIVE] = &cam_settings[1],
619 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 },
621 },
622 {
623 .gpio = 5,
624 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530625 [GPIOMUX_ACTIVE] = &cam_settings[1],
626 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627 },
628 },
629 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530630 .gpio = 76,
631 .settings = {
632 [GPIOMUX_ACTIVE] = &cam_settings[2],
633 [GPIOMUX_SUSPENDED] = &cam_settings[0],
634 },
635 },
636 {
637 .gpio = 107,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &cam_settings[2],
640 [GPIOMUX_SUSPENDED] = &cam_settings[0],
641 },
642 },
643};
644
645static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
646 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700647 .gpio = 18,
648 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530649 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700650 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651 },
652 },
653 {
654 .gpio = 19,
655 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530656 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700657 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658 },
659 },
660 {
661 .gpio = 20,
662 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530663 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700664 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700665 },
666 },
667 {
668 .gpio = 21,
669 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530670 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700671 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672 },
673 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700674};
675
676static struct gpiomux_setting cyts_resout_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_6MA,
679 .pull = GPIOMUX_PULL_UP,
680};
681
682static struct gpiomux_setting cyts_resout_act_cfg = {
683 .func = GPIOMUX_FUNC_GPIO,
684 .drv = GPIOMUX_DRV_6MA,
685 .pull = GPIOMUX_PULL_UP,
686};
687
688static struct gpiomux_setting cyts_sleep_sus_cfg = {
689 .func = GPIOMUX_FUNC_GPIO,
690 .drv = GPIOMUX_DRV_6MA,
691 .pull = GPIOMUX_PULL_DOWN,
692};
693
694static struct gpiomux_setting cyts_sleep_act_cfg = {
695 .func = GPIOMUX_FUNC_GPIO,
696 .drv = GPIOMUX_DRV_6MA,
697 .pull = GPIOMUX_PULL_DOWN,
698};
699
700static struct gpiomux_setting cyts_int_act_cfg = {
701 .func = GPIOMUX_FUNC_GPIO,
702 .drv = GPIOMUX_DRV_8MA,
703 .pull = GPIOMUX_PULL_UP,
704};
705
706static struct gpiomux_setting cyts_int_sus_cfg = {
707 .func = GPIOMUX_FUNC_GPIO,
708 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530709 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700710};
711
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
713 { /* TS INTERRUPT */
714 .gpio = 11,
715 .settings = {
716 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
717 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
718 },
719 },
720 { /* TS SLEEP */
721 .gpio = 50,
722 .settings = {
723 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
724 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
725 },
726 },
727 { /* TS RESOUT */
728 .gpio = 52,
729 .settings = {
730 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
731 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
732 },
733 },
734};
735
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530736#ifdef CONFIG_USB_EHCI_MSM_HSIC
737static struct gpiomux_setting hsic_act_cfg = {
738 .func = GPIOMUX_FUNC_1,
739 .drv = GPIOMUX_DRV_12MA,
740 .pull = GPIOMUX_PULL_NONE,
741};
742
743static struct gpiomux_setting hsic_sus_cfg = {
744 .func = GPIOMUX_FUNC_GPIO,
745 .drv = GPIOMUX_DRV_2MA,
746 .pull = GPIOMUX_PULL_DOWN,
747};
748
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530749static struct gpiomux_setting hsic_hub_act_cfg = {
750 .func = GPIOMUX_FUNC_GPIO,
751 .drv = GPIOMUX_DRV_2MA,
752 .pull = GPIOMUX_PULL_NONE,
753};
754
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530755static struct msm_gpiomux_config msm8960_hsic_configs[] = {
756 {
757 .gpio = 150, /*HSIC_STROBE */
758 .settings = {
759 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
760 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
761 },
762 },
763 {
764 .gpio = 151, /* HSIC_DATA */
765 .settings = {
766 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
767 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
768 },
769 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530770 {
771 .gpio = 91, /* HSIC_HUB_RESET */
772 .settings = {
773 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
774 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
775 },
776 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530777};
778#endif
779
Mohan Pallaka5e490392011-09-09 15:18:41 +0530780#define HAP_SHIFT_LVL_OE_GPIO 47
781
782static struct gpiomux_setting hap_lvl_shft_suspended_config = {
783 .func = GPIOMUX_FUNC_GPIO,
784 .drv = GPIOMUX_DRV_2MA,
785 .pull = GPIOMUX_PULL_DOWN,
786};
787
788static struct gpiomux_setting hap_lvl_shft_active_config = {
789 .func = GPIOMUX_FUNC_GPIO,
790 .drv = GPIOMUX_DRV_8MA,
791 .pull = GPIOMUX_PULL_UP,
792};
793
794static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
795 {
796 .gpio = HAP_SHIFT_LVL_OE_GPIO,
797 .settings = {
798 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
799 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
800 },
801 },
802};
803
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700804#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
805enum {
806 SX150X_CAM,
807};
808
Nishant Pandit474f2252011-07-23 23:17:56 +0530809static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700810 [SX150X_CAM] = {
811 .gpio_base = GPIO_CAM_EXPANDER_BASE,
812 .oscio_is_gpo = false,
813 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530814 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700815 .io_open_drain_ena = 0x0,
816 .irq_summary = -1,
817 },
818};
Nishant Pandit474f2252011-07-23 23:17:56 +0530819
820#endif
821
822#ifdef CONFIG_I2C
823
824#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
825#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300826#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530827
828#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
829
830static struct i2c_board_info cam_expander_i2c_info[] = {
831 {
832 I2C_BOARD_INFO("sx1508q", 0x22),
833 .platform_data = &sx150x_data[SX150X_CAM]
834 },
835};
836
837static struct msm_cam_expander_info cam_expander_info[] = {
838 {
839 cam_expander_i2c_info,
840 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
841 },
842};
843#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700844#endif
845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
847#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700848#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700849#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
850#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
851#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700853#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700854
855
856#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
857#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
858#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
859#define MSM_ION_HEAP_NUM 4
860#else
861#define MSM_ION_HEAP_NUM 2
862#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700863
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
865static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
866static int __init pmem_kernel_ebi1_size_setup(char *p)
867{
868 pmem_kernel_ebi1_size = memparse(p, NULL);
869 return 0;
870}
871early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
872#endif
873
874#ifdef CONFIG_ANDROID_PMEM
875static unsigned pmem_size = MSM_PMEM_SIZE;
876static int __init pmem_size_setup(char *p)
877{
878 pmem_size = memparse(p, NULL);
879 return 0;
880}
881early_param("pmem_size", pmem_size_setup);
882
883static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
884
885static int __init pmem_adsp_size_setup(char *p)
886{
887 pmem_adsp_size = memparse(p, NULL);
888 return 0;
889}
890early_param("pmem_adsp_size", pmem_adsp_size_setup);
891
892static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
893
894static int __init pmem_audio_size_setup(char *p)
895{
896 pmem_audio_size = memparse(p, NULL);
897 return 0;
898}
899early_param("pmem_audio_size", pmem_audio_size_setup);
900#endif
901
902#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700903#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904static struct android_pmem_platform_data android_pmem_pdata = {
905 .name = "pmem",
906 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
907 .cached = 1,
908 .memory_type = MEMTYPE_EBI1,
909};
910
911static struct platform_device android_pmem_device = {
912 .name = "android_pmem",
913 .id = 0,
914 .dev = {.platform_data = &android_pmem_pdata},
915};
916
917static struct android_pmem_platform_data android_pmem_adsp_pdata = {
918 .name = "pmem_adsp",
919 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
920 .cached = 0,
921 .memory_type = MEMTYPE_EBI1,
922};
923static struct platform_device android_pmem_adsp_device = {
924 .name = "android_pmem",
925 .id = 2,
926 .dev = { .platform_data = &android_pmem_adsp_pdata },
927};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700928#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700929
930static struct android_pmem_platform_data android_pmem_audio_pdata = {
931 .name = "pmem_audio",
932 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
933 .cached = 0,
934 .memory_type = MEMTYPE_EBI1,
935};
936
937static struct platform_device android_pmem_audio_device = {
938 .name = "android_pmem",
939 .id = 4,
940 .dev = { .platform_data = &android_pmem_audio_pdata },
941};
942#endif
943
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700944#define DSP_RAM_BASE_8960 0x8da00000
945#define DSP_RAM_SIZE_8960 0x1800000
946static int dspcrashd_pdata_8960 = 0xDEADDEAD;
947
948static struct resource resources_dspcrashd_8960[] = {
949 {
950 .name = "msm_dspcrashd",
951 .start = DSP_RAM_BASE_8960,
952 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
953 .flags = IORESOURCE_DMA,
954 },
955};
956
957struct platform_device msm_device_dspcrashd_8960 = {
958 .name = "msm_dspcrashd",
959 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
960 .resource = resources_dspcrashd_8960,
961 .dev = { .platform_data = &dspcrashd_pdata_8960 },
962};
963
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700964static struct memtype_reserve msm8960_reserve_table[] __initdata = {
965 [MEMTYPE_SMI] = {
966 },
967 [MEMTYPE_EBI0] = {
968 .flags = MEMTYPE_FLAGS_1M_ALIGN,
969 },
970 [MEMTYPE_EBI1] = {
971 .flags = MEMTYPE_FLAGS_1M_ALIGN,
972 },
973};
974
975static void __init size_pmem_devices(void)
976{
977#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700978#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700979 android_pmem_adsp_pdata.size = pmem_adsp_size;
980 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700981#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700982 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
983#endif
984}
985
986static void __init reserve_memory_for(struct android_pmem_platform_data *p)
987{
988 msm8960_reserve_table[p->memory_type].size += p->size;
989}
990
991static void __init reserve_pmem_memory(void)
992{
993#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700994#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700995 reserve_memory_for(&android_pmem_adsp_pdata);
996 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700997#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998 reserve_memory_for(&android_pmem_audio_pdata);
999 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1000#endif
1001}
1002
Larry Basselb4126da2011-07-18 14:31:33 -07001003static int msm8960_paddr_to_memtype(unsigned int paddr)
1004{
1005 return MEMTYPE_EBI1;
1006}
1007
Laura Abbottd6183792011-08-19 13:42:24 -07001008#ifdef CONFIG_ION_MSM
1009struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001010 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001011 .heaps = {
1012 {
1013 .id = ION_HEAP_SYSTEM_ID,
1014 .type = ION_HEAP_TYPE_SYSTEM,
1015 .name = ION_KMALLOC_HEAP_NAME,
1016 },
1017 {
1018 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1019 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1020 .name = ION_VMALLOC_HEAP_NAME,
1021 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001022#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001023 {
1024 .id = ION_HEAP_EBI_ID,
1025 .type = ION_HEAP_TYPE_CARVEOUT,
1026 .name = ION_EBI1_HEAP_NAME,
1027 .size = MSM_ION_EBI_SIZE,
1028 .memory_type = ION_EBI_TYPE,
1029 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001030 {
1031 .id = ION_HEAP_ADSP_ID,
1032 .type = ION_HEAP_TYPE_CARVEOUT,
1033 .name = ION_ADSP_HEAP_NAME,
1034 .size = MSM_ION_ADSP_SIZE,
1035 .memory_type = ION_EBI_TYPE,
1036 },
1037#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001038 }
1039};
1040
1041struct platform_device ion_dev = {
1042 .name = "ion-msm",
1043 .id = 1,
1044 .dev = { .platform_data = &ion_pdata },
1045};
1046#endif
1047
1048static void reserve_ion_memory(void)
1049{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001050#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001051 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001052 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001053#endif
1054}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001055static void __init msm8960_calculate_reserve_sizes(void)
1056{
1057 size_pmem_devices();
1058 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001059 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001060}
1061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001062static struct reserve_info msm8960_reserve_info __initdata = {
1063 .memtype_reserve_table = msm8960_reserve_table,
1064 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1065 .paddr_to_memtype = msm8960_paddr_to_memtype,
1066};
1067
Larry Basselb4126da2011-07-18 14:31:33 -07001068static int msm8960_memory_bank_size(void)
1069{
1070 return 1<<29;
1071}
1072
1073static void __init locate_unstable_memory(void)
1074{
1075 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1076 unsigned long bank_size;
1077 unsigned long low, high;
1078
1079 bank_size = msm8960_memory_bank_size();
1080 low = meminfo.bank[0].start;
1081 high = mb->start + mb->size;
1082 low &= ~(bank_size - 1);
1083
1084 if (high - low <= bank_size)
1085 return;
1086 msm8960_reserve_info.low_unstable_address = low + bank_size;
1087 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1088 msm8960_reserve_info.bank_size = bank_size;
1089 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1090 msm8960_reserve_info.low_unstable_address,
1091 msm8960_reserve_info.max_unstable_size,
1092 msm8960_reserve_info.bank_size);
1093}
1094
Larry Basselb830e182011-10-14 10:46:55 -07001095static void __init place_movable_zone(void)
1096{
1097 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1098 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1099 pr_info("movable zone start %lx size %lx\n",
1100 movable_reserved_start, movable_reserved_size);
1101}
1102
1103static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001104{
1105 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001106 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001107 place_movable_zone();
1108}
1109
1110static void __init msm8960_reserve(void)
1111{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001112 msm_reserve();
1113}
1114
Larry Bassela4414b12011-08-04 11:11:02 -07001115static int msm8960_change_memory_power(u64 start, u64 size,
1116 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001117{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001118 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001119}
1120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001121#ifdef CONFIG_MSM_CAMERA
1122
Nishant Pandit24153d82011-08-27 16:05:13 +05301123static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001124 5, /*CAMIF_MCLK*/
1125 20, /*CAMIF_I2C_DATA*/
1126 21, /*CAMIF_I2C_CLK*/
1127};
1128
Nishant Pandit24153d82011-08-27 16:05:13 +05301129static struct msm_camera_gpio_conf gpio_conf = {
1130 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1131 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1132 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1133 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1134};
1135
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001136#define VFE_CAMIF_TIMER1_GPIO 2
1137#define VFE_CAMIF_TIMER2_GPIO 3
1138#define VFE_CAMIF_TIMER3_GPIO_INT 4
1139struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1140 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1141 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1142 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1143 .flash_recharge_duration = 50000,
1144 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1145};
1146
Nishant Pandit474f2252011-07-23 23:17:56 +05301147#ifdef CONFIG_MSM_CAMERA_FLASH
1148static struct msm_camera_sensor_flash_src msm_flash_src = {
1149 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1150 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1151 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1152#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1153 defined(CONFIG_GPIO_SX150X_MODULE))
1154 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1155#endif
1156};
1157#endif
1158
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001159static struct msm_bus_vectors cam_init_vectors[] = {
1160 {
1161 .src = MSM_BUS_MASTER_VFE,
1162 .dst = MSM_BUS_SLAVE_EBI_CH0,
1163 .ab = 0,
1164 .ib = 0,
1165 },
1166 {
1167 .src = MSM_BUS_MASTER_VPE,
1168 .dst = MSM_BUS_SLAVE_EBI_CH0,
1169 .ab = 0,
1170 .ib = 0,
1171 },
1172 {
1173 .src = MSM_BUS_MASTER_JPEG_ENC,
1174 .dst = MSM_BUS_SLAVE_EBI_CH0,
1175 .ab = 0,
1176 .ib = 0,
1177 },
1178};
1179
1180static struct msm_bus_vectors cam_preview_vectors[] = {
1181 {
1182 .src = MSM_BUS_MASTER_VFE,
1183 .dst = MSM_BUS_SLAVE_EBI_CH0,
1184 .ab = 27648000,
1185 .ib = 110592000,
1186 },
1187 {
1188 .src = MSM_BUS_MASTER_VPE,
1189 .dst = MSM_BUS_SLAVE_EBI_CH0,
1190 .ab = 0,
1191 .ib = 0,
1192 },
1193 {
1194 .src = MSM_BUS_MASTER_JPEG_ENC,
1195 .dst = MSM_BUS_SLAVE_EBI_CH0,
1196 .ab = 0,
1197 .ib = 0,
1198 },
1199};
1200
1201static struct msm_bus_vectors cam_video_vectors[] = {
1202 {
1203 .src = MSM_BUS_MASTER_VFE,
1204 .dst = MSM_BUS_SLAVE_EBI_CH0,
1205 .ab = 140451840,
1206 .ib = 561807360,
1207 },
1208 {
1209 .src = MSM_BUS_MASTER_VPE,
1210 .dst = MSM_BUS_SLAVE_EBI_CH0,
1211 .ab = 206807040,
1212 .ib = 488816640,
1213 },
1214 {
1215 .src = MSM_BUS_MASTER_JPEG_ENC,
1216 .dst = MSM_BUS_SLAVE_EBI_CH0,
1217 .ab = 0,
1218 .ib = 0,
1219 },
1220};
1221
1222static struct msm_bus_vectors cam_snapshot_vectors[] = {
1223 {
1224 .src = MSM_BUS_MASTER_VFE,
1225 .dst = MSM_BUS_SLAVE_EBI_CH0,
1226 .ab = 274423680,
1227 .ib = 1097694720,
1228 },
1229 {
1230 .src = MSM_BUS_MASTER_VPE,
1231 .dst = MSM_BUS_SLAVE_EBI_CH0,
1232 .ab = 0,
1233 .ib = 0,
1234 },
1235 {
1236 .src = MSM_BUS_MASTER_JPEG_ENC,
1237 .dst = MSM_BUS_SLAVE_EBI_CH0,
1238 .ab = 540000000,
1239 .ib = 1350000000,
1240 },
1241};
1242
1243static struct msm_bus_vectors cam_zsl_vectors[] = {
1244 {
1245 .src = MSM_BUS_MASTER_VFE,
1246 .dst = MSM_BUS_SLAVE_EBI_CH0,
1247 .ab = 302071680,
1248 .ib = 1208286720,
1249 },
1250 {
1251 .src = MSM_BUS_MASTER_VPE,
1252 .dst = MSM_BUS_SLAVE_EBI_CH0,
1253 .ab = 0,
1254 .ib = 0,
1255 },
1256 {
1257 .src = MSM_BUS_MASTER_JPEG_ENC,
1258 .dst = MSM_BUS_SLAVE_EBI_CH0,
1259 .ab = 540000000,
1260 .ib = 1350000000,
1261 },
1262};
1263
1264static struct msm_bus_paths cam_bus_client_config[] = {
1265 {
1266 ARRAY_SIZE(cam_init_vectors),
1267 cam_init_vectors,
1268 },
1269 {
1270 ARRAY_SIZE(cam_preview_vectors),
1271 cam_preview_vectors,
1272 },
1273 {
1274 ARRAY_SIZE(cam_video_vectors),
1275 cam_video_vectors,
1276 },
1277 {
1278 ARRAY_SIZE(cam_snapshot_vectors),
1279 cam_snapshot_vectors,
1280 },
1281 {
1282 ARRAY_SIZE(cam_zsl_vectors),
1283 cam_zsl_vectors,
1284 },
1285};
1286
1287static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1288 cam_bus_client_config,
1289 ARRAY_SIZE(cam_bus_client_config),
1290 .name = "msm_camera",
1291};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001292
Nishant Pandit24153d82011-08-27 16:05:13 +05301293struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1294 {
1295 .ioclk.mclk_clk_rate = 24000000,
1296 .ioclk.vfe_clk_rate = 228570000,
1297 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001298 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301299 },
1300 {
1301 .ioclk.mclk_clk_rate = 24000000,
1302 .ioclk.vfe_clk_rate = 228570000,
1303 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001304 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301305 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306};
1307
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001308#ifdef CONFIG_IMX074_ACT
1309static struct i2c_board_info imx074_actuator_i2c_info = {
1310 I2C_BOARD_INFO("imx074_act", 0x11),
1311};
1312
1313static struct msm_actuator_info imx074_actuator_info = {
1314 .board_info = &imx074_actuator_i2c_info,
1315 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1316 .vcm_pwd = 0,
1317 .vcm_enable = 1,
1318};
1319#endif
1320
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321#ifdef CONFIG_IMX074
1322static struct msm_camera_sensor_flash_data flash_imx074 = {
1323 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301324#ifdef CONFIG_MSM_CAMERA_FLASH
1325 .flash_src = &msm_flash_src
1326#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001327};
1328
Nishant Pandit24153d82011-08-27 16:05:13 +05301329static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1330 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001331 .sensor_reset = 107,
1332 .sensor_pwd = 85,
1333 .vcm_pwd = 0,
1334 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301335};
1336
1337static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1338 .sensor_name = "imx074",
1339 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001340 .flash_data = &flash_imx074,
1341 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301342 .sensor_platform_info = &sensor_board_info_imx074,
1343 .gpio_conf = &gpio_conf,
1344 .csi_if = 1,
1345 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001346#ifdef CONFIG_IMX074_ACT
1347 .actuator_info = &imx074_actuator_info
1348#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349};
1350
1351struct platform_device msm8960_camera_sensor_imx074 = {
1352 .name = "msm_camera_imx074",
1353 .dev = {
1354 .platform_data = &msm_camera_sensor_imx074_data,
1355 },
1356};
1357#endif
1358#ifdef CONFIG_OV2720
1359static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001360 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361};
1362
Nishant Pandit24153d82011-08-27 16:05:13 +05301363static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1364 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001365 .sensor_reset = 76,
1366 .sensor_pwd = 85,
1367 .vcm_pwd = 0,
1368 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301369};
1370
1371static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1372 .sensor_name = "ov2720",
1373 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001374 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301375 .sensor_platform_info = &sensor_board_info_ov2720,
1376 .gpio_conf = &gpio_conf,
1377 .csi_if = 1,
1378 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001379};
1380
1381struct platform_device msm8960_camera_sensor_ov2720 = {
1382 .name = "msm_camera_ov2720",
1383 .dev = {
1384 .platform_data = &msm_camera_sensor_ov2720_data,
1385 },
1386};
1387#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001388
1389static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1390 .flash_type = MSM_CAMERA_FLASH_LED,
1391};
1392
Nishant Pandit24153d82011-08-27 16:05:13 +05301393static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1394 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001395 .sensor_reset = 107,
1396 .sensor_pwd = 85,
1397 .vcm_pwd = 0,
1398 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301399};
1400
1401static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1402 .sensor_name = "qs_mt9p017",
1403 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001404 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301405 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1406 .gpio_conf = &gpio_conf,
1407 .csi_if = 1,
1408 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001409};
1410
1411struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1412 .name = "msm_camera_qs_mt9p017",
1413 .dev = {
1414 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1415 },
1416};
1417
Kevin Chan8b0d2322011-09-10 21:06:31 -07001418static struct msm8960_privacy_light_cfg privacy_light_info = {
1419 .mpp = PM8921_MPP_PM_TO_SYS(12),
1420};
1421
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422static void __init msm8960_init_cam(void)
1423{
1424 int i;
1425 struct platform_device *cam_dev[] = {
1426 &msm8960_camera_sensor_imx074,
1427 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001428 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429 };
1430
Kevin Chan8b0d2322011-09-10 21:06:31 -07001431 if (machine_is_msm8960_liquid()) {
1432 struct msm_camera_sensor_info *s_info;
1433 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1434 s_info->sensor_platform_info->mount_angle = 180;
1435 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1436 s_info->sensor_platform_info->privacy_light = 1;
1437 s_info->sensor_platform_info->privacy_light_info =
1438 &privacy_light_info;
1439 }
1440
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1442 struct msm_camera_sensor_info *s_info;
1443 s_info = cam_dev[i]->dev.platform_data;
1444 msm_get_cam_resources(s_info);
1445 platform_device_register(cam_dev[i]);
1446 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001447
1448 platform_device_register(&msm8960_device_csiphy0);
1449 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001450 platform_device_register(&msm8960_device_csid0);
1451 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001452 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001453 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001454 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455}
1456#endif
1457
1458#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001459#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001461#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462#endif
1463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001464
1465#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001466#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001468#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1469#else
1470#define MSM_FB_EXT_BUF_SIZE 0
1471#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001472
kuogee hsieh3830eb92011-09-12 15:25:57 -07001473#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1474/* width x height x 3 bpp x 2 frame buffer */
1475#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1476#define MSM_FB_WRITEBACK_OFFSET \
1477 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1478#else
1479#define MSM_FB_WRITEBACK_SIZE 0
1480#define MSM_FB_WRITEBACK_OFFSET 0
1481#endif
1482
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001483#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1484/* 4 bpp x 2 page HDMI case */
1485#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1486#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001487/* Note: must be multiple of 4096 */
1488#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1489 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001490#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001491
1492static int writeback_offset(void)
1493{
1494 return MSM_FB_WRITEBACK_OFFSET;
1495}
1496
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001497
1498#define MDP_VSYNC_GPIO 0
1499
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001500#define PANEL_NAME_MAX_LEN 30
1501#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1502#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1503#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1504#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1505#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1506#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1507#define HDMI_PANEL_NAME "hdmi_msm"
1508#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001509
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510static struct resource msm_fb_resources[] = {
1511 {
1512 .flags = IORESOURCE_DMA,
1513 }
1514};
1515
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001516static int msm_fb_detect_panel(const char *name)
1517{
1518 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001519 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1520 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1521 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001522 return 0;
1523 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001524 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1525 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1526 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001527 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001528
1529#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1530 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1531 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1532 PANEL_NAME_MAX_LEN)))
1533 return 0;
1534
1535 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1536 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1537 PANEL_NAME_MAX_LEN)))
1538 return 0;
1539
1540 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1541 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1542 PANEL_NAME_MAX_LEN)))
1543 return 0;
1544
1545 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1546 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1547 PANEL_NAME_MAX_LEN)))
1548 return 0;
1549#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001550 }
1551
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001552 if (!strncmp(name, HDMI_PANEL_NAME,
1553 strnlen(HDMI_PANEL_NAME,
1554 PANEL_NAME_MAX_LEN)))
1555 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001556
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001557 if (!strncmp(name, TVOUT_PANEL_NAME,
1558 strnlen(TVOUT_PANEL_NAME,
1559 PANEL_NAME_MAX_LEN)))
1560 return 0;
1561
1562 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001563 return -ENODEV;
1564}
1565
1566static struct msm_fb_platform_data msm_fb_pdata = {
1567 .detect_client = msm_fb_detect_panel,
1568};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570static struct platform_device msm_fb_device = {
1571 .name = "msm_fb",
1572 .id = 0,
1573 .num_resources = ARRAY_SIZE(msm_fb_resources),
1574 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001575 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001576};
1577
1578static bool dsi_power_on;
1579
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001580/**
1581 * LiQUID panel on/off
1582 *
1583 * @param on
1584 *
1585 * @return int
1586 */
1587static int mipi_dsi_liquid_panel_power(int on)
1588{
1589 static struct regulator *reg_l2, *reg_ext_3p3v;
1590 static int gpio21, gpio24, gpio43;
1591 int rc;
1592
1593 pr_info("%s: on=%d\n", __func__, on);
1594
1595 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1596 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1597 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1598
1599 if (!dsi_power_on) {
1600
1601 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1602 "dsi_vdda");
1603 if (IS_ERR(reg_l2)) {
1604 pr_err("could not get 8921_l2, rc = %ld\n",
1605 PTR_ERR(reg_l2));
1606 return -ENODEV;
1607 }
1608
1609 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1610 if (rc) {
1611 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1612 return -EINVAL;
1613 }
1614
1615 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1616 "vdd_lvds_3p3v");
1617 if (IS_ERR(reg_ext_3p3v)) {
1618 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1619 PTR_ERR(reg_ext_3p3v));
1620 return -ENODEV;
1621 }
1622
1623 rc = gpio_request(gpio21, "disp_pwr_en_n");
1624 if (rc) {
1625 pr_err("request gpio 21 failed, rc=%d\n", rc);
1626 return -ENODEV;
1627 }
1628
1629 rc = gpio_request(gpio43, "disp_rst_n");
1630 if (rc) {
1631 pr_err("request gpio 43 failed, rc=%d\n", rc);
1632 return -ENODEV;
1633 }
1634
1635 rc = gpio_request(gpio24, "disp_backlight_pwm");
1636 if (rc) {
1637 pr_err("request gpio 24 failed, rc=%d\n", rc);
1638 return -ENODEV;
1639 }
1640
1641 dsi_power_on = true;
1642 }
1643
1644 if (on) {
1645 rc = regulator_set_optimum_mode(reg_l2, 100000);
1646 if (rc < 0) {
1647 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1648 return -EINVAL;
1649 }
1650 rc = regulator_enable(reg_l2);
1651 if (rc) {
1652 pr_err("enable l2 failed, rc=%d\n", rc);
1653 return -ENODEV;
1654 }
1655
1656 rc = regulator_enable(reg_ext_3p3v);
1657 if (rc) {
1658 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1659 return -ENODEV;
1660 }
1661
1662 /* set reset pin before power enable */
1663 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1664
1665 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1666 msleep(20);
1667 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1668 msleep(20);
1669 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1670 msleep(20);
1671 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1672 msleep(20);
1673 } else {
1674 gpio_set_value_cansleep(gpio43, 0);
1675 gpio_set_value_cansleep(gpio21, 1);
1676
1677 rc = regulator_disable(reg_l2);
1678 if (rc) {
1679 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1680 return -ENODEV;
1681 }
1682 rc = regulator_disable(reg_ext_3p3v);
1683 if (rc) {
1684 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1685 return -ENODEV;
1686 }
1687 rc = regulator_set_optimum_mode(reg_l2, 100);
1688 if (rc < 0) {
1689 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1690 return -EINVAL;
1691 }
1692 }
1693
1694 return 0;
1695}
1696
1697static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698{
1699 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001700 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001701 int rc;
1702
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001703 pr_info("%s: state : %d\n", __func__, on);
1704
1705 if (!dsi_power_on) {
1706
1707 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1708 "dsi_vdc");
1709 if (IS_ERR(reg_l8)) {
1710 pr_err("could not get 8921_l8, rc = %ld\n",
1711 PTR_ERR(reg_l8));
1712 return -ENODEV;
1713 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1715 "dsi_vddio");
1716 if (IS_ERR(reg_l23)) {
1717 pr_err("could not get 8921_l23, rc = %ld\n",
1718 PTR_ERR(reg_l23));
1719 return -ENODEV;
1720 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1722 "dsi_vdda");
1723 if (IS_ERR(reg_l2)) {
1724 pr_err("could not get 8921_l2, rc = %ld\n",
1725 PTR_ERR(reg_l2));
1726 return -ENODEV;
1727 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001728 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1729 if (rc) {
1730 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1731 return -EINVAL;
1732 }
1733 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1734 if (rc) {
1735 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1736 return -EINVAL;
1737 }
1738 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1739 if (rc) {
1740 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1741 return -EINVAL;
1742 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001743 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1744 rc = gpio_request(gpio43, "disp_rst_n");
1745 if (rc) {
1746 pr_err("request gpio 43 failed, rc=%d\n", rc);
1747 return -ENODEV;
1748 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749 dsi_power_on = true;
1750 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001751 if (on) {
1752 rc = regulator_set_optimum_mode(reg_l8, 100000);
1753 if (rc < 0) {
1754 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1755 return -EINVAL;
1756 }
1757 rc = regulator_set_optimum_mode(reg_l23, 100000);
1758 if (rc < 0) {
1759 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1760 return -EINVAL;
1761 }
1762 rc = regulator_set_optimum_mode(reg_l2, 100000);
1763 if (rc < 0) {
1764 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1765 return -EINVAL;
1766 }
1767 rc = regulator_enable(reg_l8);
1768 if (rc) {
1769 pr_err("enable l8 failed, rc=%d\n", rc);
1770 return -ENODEV;
1771 }
1772 rc = regulator_enable(reg_l23);
1773 if (rc) {
1774 pr_err("enable l8 failed, rc=%d\n", rc);
1775 return -ENODEV;
1776 }
1777 rc = regulator_enable(reg_l2);
1778 if (rc) {
1779 pr_err("enable l2 failed, rc=%d\n", rc);
1780 return -ENODEV;
1781 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782 gpio_set_value_cansleep(gpio43, 1);
1783 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001784 rc = regulator_disable(reg_l2);
1785 if (rc) {
1786 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1787 return -ENODEV;
1788 }
1789 rc = regulator_disable(reg_l8);
1790 if (rc) {
1791 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1792 return -ENODEV;
1793 }
1794 rc = regulator_disable(reg_l23);
1795 if (rc) {
1796 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1797 return -ENODEV;
1798 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799 rc = regulator_set_optimum_mode(reg_l8, 100);
1800 if (rc < 0) {
1801 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1802 return -EINVAL;
1803 }
1804 rc = regulator_set_optimum_mode(reg_l23, 100);
1805 if (rc < 0) {
1806 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1807 return -EINVAL;
1808 }
1809 rc = regulator_set_optimum_mode(reg_l2, 100);
1810 if (rc < 0) {
1811 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1812 return -EINVAL;
1813 }
1814 gpio_set_value_cansleep(gpio43, 0);
1815 }
1816 return 0;
1817}
1818
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001819static int mipi_dsi_panel_power(int on)
1820{
1821 int ret;
1822
1823 pr_info("%s: on=%d\n", __func__, on);
1824
1825 if (machine_is_msm8960_liquid())
1826 ret = mipi_dsi_liquid_panel_power(on);
1827 else
1828 ret = mipi_dsi_cdp_panel_power(on);
1829
1830 return ret;
1831}
1832
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001833static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1834 .vsync_gpio = MDP_VSYNC_GPIO,
1835 .dsi_power_save = mipi_dsi_panel_power,
1836};
1837
1838#ifdef CONFIG_MSM_BUS_SCALING
1839
1840static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841 {
1842 .src = MSM_BUS_MASTER_MDP_PORT0,
1843 .dst = MSM_BUS_SLAVE_EBI_CH0,
1844 .ab = 0,
1845 .ib = 0,
1846 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001847};
1848
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001849#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1850static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1851 /* If HDMI is used as primary */
1852 {
1853 .src = MSM_BUS_MASTER_MDP_PORT0,
1854 .dst = MSM_BUS_SLAVE_EBI_CH0,
1855 .ab = 2000000000,
1856 .ib = 2000000000,
1857 },
1858};
1859static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1860 {
1861 ARRAY_SIZE(mdp_init_vectors),
1862 mdp_init_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 ARRAY_SIZE(hdmi_as_primary_vectors),
1874 hdmi_as_primary_vectors,
1875 },
1876 {
1877 ARRAY_SIZE(hdmi_as_primary_vectors),
1878 hdmi_as_primary_vectors,
1879 },
1880 {
1881 ARRAY_SIZE(hdmi_as_primary_vectors),
1882 hdmi_as_primary_vectors,
1883 },
1884};
1885#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001886static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001887 {
1888 .src = MSM_BUS_MASTER_MDP_PORT0,
1889 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001890 .ab = 216000000 * 2,
1891 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001892 },
1893};
1894
1895static struct msm_bus_vectors mdp_vga_vectors[] = {
1896 /* VGA and less video */
1897 {
1898 .src = MSM_BUS_MASTER_MDP_PORT0,
1899 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001900 .ab = 216000000 * 2,
1901 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902 },
1903};
1904
1905static struct msm_bus_vectors mdp_720p_vectors[] = {
1906 /* 720p and less video */
1907 {
1908 .src = MSM_BUS_MASTER_MDP_PORT0,
1909 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001910 .ab = 230400000 * 2,
1911 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912 },
1913};
1914
1915static struct msm_bus_vectors mdp_1080p_vectors[] = {
1916 /* 1080p and less video */
1917 {
1918 .src = MSM_BUS_MASTER_MDP_PORT0,
1919 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001920 .ab = 334080000 * 2,
1921 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922 },
1923};
1924
1925static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1926 {
1927 ARRAY_SIZE(mdp_init_vectors),
1928 mdp_init_vectors,
1929 },
1930 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001931 ARRAY_SIZE(mdp_ui_vectors),
1932 mdp_ui_vectors,
1933 },
1934 {
1935 ARRAY_SIZE(mdp_ui_vectors),
1936 mdp_ui_vectors,
1937 },
1938 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939 ARRAY_SIZE(mdp_vga_vectors),
1940 mdp_vga_vectors,
1941 },
1942 {
1943 ARRAY_SIZE(mdp_720p_vectors),
1944 mdp_720p_vectors,
1945 },
1946 {
1947 ARRAY_SIZE(mdp_1080p_vectors),
1948 mdp_1080p_vectors,
1949 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001951#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001952
1953static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1954 mdp_bus_scale_usecases,
1955 ARRAY_SIZE(mdp_bus_scale_usecases),
1956 .name = "mdp",
1957};
1958
1959#endif
1960
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001961#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1962int mdp_core_clk_rate_table[] = {
1963 200000000,
1964 200000000,
1965 200000000,
1966 200000000,
1967};
1968#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969int mdp_core_clk_rate_table[] = {
1970 85330000,
1971 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001972 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973 200000000,
1974};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001975#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001976
1977static struct msm_panel_common_pdata mdp_pdata = {
1978 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001979#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1980 .mdp_core_clk_rate = 200000000,
1981#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001983#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001984 .mdp_core_clk_table = mdp_core_clk_rate_table,
1985 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1986#ifdef CONFIG_MSM_BUS_SCALING
1987 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1988#endif
1989 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001990 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001991};
1992
1993static struct platform_device mipi_dsi_renesas_panel_device = {
1994 .name = "mipi_renesas",
1995 .id = 0,
1996};
1997
1998static struct platform_device mipi_dsi_simulator_panel_device = {
1999 .name = "mipi_simulator",
2000 .id = 0,
2001};
2002
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002003#define LPM_CHANNEL0 0
2004static int toshiba_gpio[] = {LPM_CHANNEL0};
2005
2006static struct mipi_dsi_panel_platform_data toshiba_pdata = {
2007 .gpio = toshiba_gpio,
2008};
2009
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002010static struct platform_device mipi_dsi_toshiba_panel_device = {
2011 .name = "mipi_toshiba",
2012 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002013 .dev = {
2014 .platform_data = &toshiba_pdata,
2015 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002016};
2017
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002018#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002019static int dsi2lvds_gpio[2] = {
2020 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2021 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2022 };
2023
2024static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2025 .gpio_num = dsi2lvds_gpio,
2026};
2027
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002028static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2029
2030/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2031 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2032 /* timing */
2033 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2034 0x0c, 0x03, 0x04, 0xa0},
2035 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2036 {0xff, 0x00, 0x06, 0x00}, /* strength */
2037 /* pll control */
2038 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2039 0x40, 0x07, 0x03,
2040 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2041};
2042
2043static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002044 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2045 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002046 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2047};
2048
2049static struct platform_device mipi_dsi_novatek_panel_device = {
2050 .name = "mipi_novatek",
2051 .id = 0,
2052 .dev = {
2053 .platform_data = &novatek_pdata,
2054 }
2055};
2056
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002057static struct platform_device mipi_dsi2lvds_bridge_device = {
2058 .name = "mipi_tc358764",
2059 .id = 0,
2060 .dev.platform_data = &mipi_dsi2lvds_pdata,
2061};
2062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002063#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2064static struct resource hdmi_msm_resources[] = {
2065 {
2066 .name = "hdmi_msm_qfprom_addr",
2067 .start = 0x00700000,
2068 .end = 0x007060FF,
2069 .flags = IORESOURCE_MEM,
2070 },
2071 {
2072 .name = "hdmi_msm_hdmi_addr",
2073 .start = 0x04A00000,
2074 .end = 0x04A00FFF,
2075 .flags = IORESOURCE_MEM,
2076 },
2077 {
2078 .name = "hdmi_msm_irq",
2079 .start = HDMI_IRQ,
2080 .end = HDMI_IRQ,
2081 .flags = IORESOURCE_IRQ,
2082 },
2083};
2084
2085static int hdmi_enable_5v(int on);
2086static int hdmi_core_power(int on, int show);
2087static int hdmi_cec_power(int on);
2088
2089static struct msm_hdmi_platform_data hdmi_msm_data = {
2090 .irq = HDMI_IRQ,
2091 .enable_5v = hdmi_enable_5v,
2092 .core_power = hdmi_core_power,
2093 .cec_power = hdmi_cec_power,
2094};
2095
2096static struct platform_device hdmi_msm_device = {
2097 .name = "hdmi_msm",
2098 .id = 0,
2099 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2100 .resource = hdmi_msm_resources,
2101 .dev.platform_data = &hdmi_msm_data,
2102};
2103#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2104
Vinay Kalia291263e2011-11-01 17:07:05 -07002105#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2106static struct platform_device wfd_panel_device = {
2107 .name = "wfd_panel",
2108 .id = 0,
2109 .dev.platform_data = NULL,
2110};
2111#endif
2112
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002113#ifdef CONFIG_MSM_BUS_SCALING
2114static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2115 {
2116 .src = MSM_BUS_MASTER_MDP_PORT0,
2117 .dst = MSM_BUS_SLAVE_EBI_CH0,
2118 .ab = 0,
2119 .ib = 0,
2120 },
2121};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002122
2123#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2124static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2125 {
2126 .src = MSM_BUS_MASTER_MDP_PORT0,
2127 .dst = MSM_BUS_SLAVE_EBI_CH0,
2128 .ab = 2000000000,
2129 .ib = 2000000000,
2130 },
2131};
2132#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002133static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2134 {
2135 .src = MSM_BUS_MASTER_MDP_PORT0,
2136 .dst = MSM_BUS_SLAVE_EBI_CH0,
2137 .ab = 566092800 * 2,
2138 .ib = 707616000 * 2,
2139 },
2140};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002141#endif
2142
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002143static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2144 {
2145 ARRAY_SIZE(dtv_bus_init_vectors),
2146 dtv_bus_init_vectors,
2147 },
2148 {
2149 ARRAY_SIZE(dtv_bus_def_vectors),
2150 dtv_bus_def_vectors,
2151 },
2152};
2153static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2154 dtv_bus_scale_usecases,
2155 ARRAY_SIZE(dtv_bus_scale_usecases),
2156 .name = "dtv",
2157};
2158
2159static struct lcdc_platform_data dtv_pdata = {
2160 .bus_scale_table = &dtv_bus_scale_pdata,
2161};
2162#endif
2163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002164static void __init msm_fb_add_devices(void)
2165{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002166 struct platform_device *ptr = NULL;
2167
2168 if (machine_is_msm8960_liquid())
2169 ptr = &mipi_dsi2lvds_bridge_device;
2170 else
2171 ptr = &mipi_dsi_toshiba_panel_device;
2172 platform_add_devices(&ptr, 1);
2173
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174 if (machine_is_msm8x60_rumi3()) {
2175 msm_fb_register_device("mdp", NULL);
2176 mipi_dsi_pdata.target_type = 1;
2177 } else
2178 msm_fb_register_device("mdp", &mdp_pdata);
2179 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002180#ifdef CONFIG_MSM_BUS_SCALING
2181 msm_fb_register_device("dtv", &dtv_pdata);
2182#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183}
2184
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002185static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2186 .func = GPIOMUX_FUNC_GPIO,
2187 .drv = GPIOMUX_DRV_2MA,
2188 .pull = GPIOMUX_PULL_DOWN,
2189};
2190
2191static struct gpiomux_setting mdp_vsync_active_cfg = {
2192 .func = GPIOMUX_FUNC_1,
2193 .drv = GPIOMUX_DRV_2MA,
2194 .pull = GPIOMUX_PULL_DOWN,
2195};
2196
2197static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2198 {
2199 .gpio = MDP_VSYNC_GPIO,
2200 .settings = {
2201 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2202 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2203 },
2204 }
2205};
2206
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002207#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2208static struct gpiomux_setting hdmi_suspend_cfg = {
2209 .func = GPIOMUX_FUNC_GPIO,
2210 .drv = GPIOMUX_DRV_2MA,
2211 .pull = GPIOMUX_PULL_DOWN,
2212};
2213
2214static struct gpiomux_setting hdmi_active_1_cfg = {
2215 .func = GPIOMUX_FUNC_1,
2216 .drv = GPIOMUX_DRV_2MA,
2217 .pull = GPIOMUX_PULL_UP,
2218};
2219
2220static struct gpiomux_setting hdmi_active_2_cfg = {
2221 .func = GPIOMUX_FUNC_1,
2222 .drv = GPIOMUX_DRV_2MA,
2223 .pull = GPIOMUX_PULL_DOWN,
2224};
2225
2226static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2227 {
2228 .gpio = 99,
2229 .settings = {
2230 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2231 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2232 },
2233 },
2234 {
2235 .gpio = 100,
2236 .settings = {
2237 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2238 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2239 },
2240 },
2241 {
2242 .gpio = 101,
2243 .settings = {
2244 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2245 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2246 },
2247 },
2248 {
2249 .gpio = 102,
2250 .settings = {
2251 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2252 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2253 },
2254 },
2255};
2256
2257static int hdmi_enable_5v(int on)
2258{
2259 /* TBD: PM8921 regulator instead of 8901 */
2260 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2261 static int prev_on;
2262 int rc;
2263
2264 if (on == prev_on)
2265 return 0;
2266
2267 if (!reg_8921_hdmi_mvs)
2268 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2269 "hdmi_mvs");
2270
2271 if (on) {
2272 rc = regulator_enable(reg_8921_hdmi_mvs);
2273 if (rc) {
2274 pr_err("'%s' regulator enable failed, rc=%d\n",
2275 "8921_hdmi_mvs", rc);
2276 return rc;
2277 }
2278 pr_debug("%s(on): success\n", __func__);
2279 } else {
2280 rc = regulator_disable(reg_8921_hdmi_mvs);
2281 if (rc)
2282 pr_warning("'%s' regulator disable failed, rc=%d\n",
2283 "8921_hdmi_mvs", rc);
2284 pr_debug("%s(off): success\n", __func__);
2285 }
2286
2287 prev_on = on;
2288
2289 return 0;
2290}
2291
2292static int hdmi_core_power(int on, int show)
2293{
2294 static struct regulator *reg_8921_l23, *reg_8921_s4;
2295 static int prev_on;
2296 int rc;
2297
2298 if (on == prev_on)
2299 return 0;
2300
2301 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002302 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002303 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002304 if (IS_ERR(reg_8921_l23)) {
2305 pr_err("could not get reg_8921_l23, rc = %ld\n",
2306 PTR_ERR(reg_8921_l23));
2307 return -ENODEV;
2308 }
2309 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2310 if (rc) {
2311 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2312 return -EINVAL;
2313 }
2314 }
2315 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002316 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002317 if (IS_ERR(reg_8921_s4)) {
2318 pr_err("could not get reg_8921_s4, rc = %ld\n",
2319 PTR_ERR(reg_8921_s4));
2320 return -ENODEV;
2321 }
2322 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2323 if (rc) {
2324 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2325 return -EINVAL;
2326 }
2327 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002328
2329 if (on) {
2330 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2331 if (rc < 0) {
2332 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2333 return -EINVAL;
2334 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002335 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002336 if (rc) {
2337 pr_err("'%s' regulator enable failed, rc=%d\n",
2338 "hdmi_avdd", rc);
2339 return rc;
2340 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002341 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002342 if (rc) {
2343 pr_err("'%s' regulator enable failed, rc=%d\n",
2344 "hdmi_vcc", rc);
2345 return rc;
2346 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 rc = gpio_request(100, "HDMI_DDC_CLK");
2348 if (rc) {
2349 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2350 "HDMI_DDC_CLK", 100, rc);
2351 goto error1;
2352 }
2353 rc = gpio_request(101, "HDMI_DDC_DATA");
2354 if (rc) {
2355 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2356 "HDMI_DDC_DATA", 101, rc);
2357 goto error2;
2358 }
2359 rc = gpio_request(102, "HDMI_HPD");
2360 if (rc) {
2361 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2362 "HDMI_HPD", 102, rc);
2363 goto error3;
2364 }
2365 pr_debug("%s(on): success\n", __func__);
2366 } else {
2367 gpio_free(100);
2368 gpio_free(101);
2369 gpio_free(102);
2370
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002371 rc = regulator_disable(reg_8921_l23);
2372 if (rc) {
2373 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2374 return -ENODEV;
2375 }
2376 rc = regulator_disable(reg_8921_s4);
2377 if (rc) {
2378 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2379 return -ENODEV;
2380 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2382 if (rc < 0) {
2383 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2384 return -EINVAL;
2385 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002386 pr_debug("%s(off): success\n", __func__);
2387 }
2388
2389 prev_on = on;
2390
2391 return 0;
2392
2393error3:
2394 gpio_free(101);
2395error2:
2396 gpio_free(100);
2397error1:
2398 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002399 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002400 return rc;
2401}
2402
2403static int hdmi_cec_power(int on)
2404{
2405 static int prev_on;
2406 int rc;
2407
2408 if (on == prev_on)
2409 return 0;
2410
2411 if (on) {
2412 rc = gpio_request(99, "HDMI_CEC_VAR");
2413 if (rc) {
2414 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2415 "HDMI_CEC_VAR", 99, rc);
2416 goto error;
2417 }
2418 pr_debug("%s(on): success\n", __func__);
2419 } else {
2420 gpio_free(99);
2421 pr_debug("%s(off): success\n", __func__);
2422 }
2423
2424 prev_on = on;
2425
2426 return 0;
2427error:
2428 return rc;
2429}
2430#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2431
2432static void __init msm8960_allocate_memory_regions(void)
2433{
2434 void *addr;
2435 unsigned long size;
2436
2437 size = MSM_FB_SIZE;
2438 addr = alloc_bootmem_align(size, 0x1000);
2439 msm_fb_resources[0].start = __pa(addr);
2440 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2441 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2442 size, addr, __pa(addr));
2443
2444}
2445#ifdef CONFIG_WCD9310_CODEC
2446
2447#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2448
Patrick Lai3043fba2011-08-01 14:15:57 -07002449/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2450 * 4 micbiases are used to power various analog and digital
2451 * microphones operating at 1800 mV. Technically, all micbiases
2452 * can source from single cfilter since all microphones operate
2453 * at the same voltage level. The arrangement below is to make
2454 * sure all cfilters are exercised. LDO_H regulator ouput level
2455 * does not need to be as high as 2.85V. It is choosen for
2456 * microphone sensitivity purpose.
2457 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002458static struct tabla_pdata tabla_platform_data = {
2459 .slimbus_slave_device = {
2460 .name = "tabla-slave",
2461 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2462 },
2463 .irq = MSM_GPIO_TO_INT(62),
2464 .irq_base = TABLA_INTERRUPT_BASE,
2465 .num_irqs = NR_TABLA_IRQS,
2466 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002467 .micbias = {
2468 .ldoh_v = TABLA_LDOH_2P85_V,
2469 .cfilt1_mv = 1800,
2470 .cfilt2_mv = 1800,
2471 .cfilt3_mv = 1800,
2472 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2473 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2474 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2475 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2476 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002477};
2478
2479static struct slim_device msm_slim_tabla = {
2480 .name = "tabla-slim",
2481 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2482 .dev = {
2483 .platform_data = &tabla_platform_data,
2484 },
2485};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302486
2487static struct tabla_pdata tabla20_platform_data = {
2488 .slimbus_slave_device = {
2489 .name = "tabla-slave",
2490 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2491 },
2492 .irq = MSM_GPIO_TO_INT(62),
2493 .irq_base = TABLA_INTERRUPT_BASE,
2494 .num_irqs = NR_TABLA_IRQS,
2495 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2496 .micbias = {
2497 .ldoh_v = TABLA_LDOH_2P85_V,
2498 .cfilt1_mv = 1800,
2499 .cfilt2_mv = 1800,
2500 .cfilt3_mv = 1800,
2501 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2502 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2503 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2504 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2505 }
2506};
2507
2508static struct slim_device msm_slim_tabla20 = {
2509 .name = "tabla2x-slim",
2510 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2511 .dev = {
2512 .platform_data = &tabla20_platform_data,
2513 },
2514};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002515#endif
2516
2517static struct slim_boardinfo msm_slim_devices[] = {
2518#ifdef CONFIG_WCD9310_CODEC
2519 {
2520 .bus_num = 1,
2521 .slim_slave = &msm_slim_tabla,
2522 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302523 {
2524 .bus_num = 1,
2525 .slim_slave = &msm_slim_tabla20,
2526 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527#endif
2528 /* add more slimbus slaves as needed */
2529};
2530
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002531#define MSM_WCNSS_PHYS 0x03000000
2532#define MSM_WCNSS_SIZE 0x280000
2533
2534static struct resource resources_wcnss_wlan[] = {
2535 {
2536 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2537 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2538 .name = "wcnss_wlanrx_irq",
2539 .flags = IORESOURCE_IRQ,
2540 },
2541 {
2542 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2543 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2544 .name = "wcnss_wlantx_irq",
2545 .flags = IORESOURCE_IRQ,
2546 },
2547 {
2548 .start = MSM_WCNSS_PHYS,
2549 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2550 .name = "wcnss_mmio",
2551 .flags = IORESOURCE_MEM,
2552 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002553 {
2554 .start = 84,
2555 .end = 88,
2556 .name = "wcnss_gpios_5wire",
2557 .flags = IORESOURCE_IO,
2558 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002559};
2560
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002561static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2562 .has_48mhz_xo = 1,
2563};
2564
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002565static struct platform_device msm_device_wcnss_wlan = {
2566 .name = "wcnss_wlan",
2567 .id = 0,
2568 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2569 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002570 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002571};
2572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002573#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2574 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2575 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2576 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2577
2578#define QCE_SIZE 0x10000
2579#define QCE_0_BASE 0x18500000
2580
2581#define QCE_HW_KEY_SUPPORT 0
2582#define QCE_SHA_HMAC_SUPPORT 1
2583#define QCE_SHARE_CE_RESOURCE 1
2584#define QCE_CE_SHARED 0
2585
2586static struct resource qcrypto_resources[] = {
2587 [0] = {
2588 .start = QCE_0_BASE,
2589 .end = QCE_0_BASE + QCE_SIZE - 1,
2590 .flags = IORESOURCE_MEM,
2591 },
2592 [1] = {
2593 .name = "crypto_channels",
2594 .start = DMOV_CE_IN_CHAN,
2595 .end = DMOV_CE_OUT_CHAN,
2596 .flags = IORESOURCE_DMA,
2597 },
2598 [2] = {
2599 .name = "crypto_crci_in",
2600 .start = DMOV_CE_IN_CRCI,
2601 .end = DMOV_CE_IN_CRCI,
2602 .flags = IORESOURCE_DMA,
2603 },
2604 [3] = {
2605 .name = "crypto_crci_out",
2606 .start = DMOV_CE_OUT_CRCI,
2607 .end = DMOV_CE_OUT_CRCI,
2608 .flags = IORESOURCE_DMA,
2609 },
2610};
2611
2612static struct resource qcedev_resources[] = {
2613 [0] = {
2614 .start = QCE_0_BASE,
2615 .end = QCE_0_BASE + QCE_SIZE - 1,
2616 .flags = IORESOURCE_MEM,
2617 },
2618 [1] = {
2619 .name = "crypto_channels",
2620 .start = DMOV_CE_IN_CHAN,
2621 .end = DMOV_CE_OUT_CHAN,
2622 .flags = IORESOURCE_DMA,
2623 },
2624 [2] = {
2625 .name = "crypto_crci_in",
2626 .start = DMOV_CE_IN_CRCI,
2627 .end = DMOV_CE_IN_CRCI,
2628 .flags = IORESOURCE_DMA,
2629 },
2630 [3] = {
2631 .name = "crypto_crci_out",
2632 .start = DMOV_CE_OUT_CRCI,
2633 .end = DMOV_CE_OUT_CRCI,
2634 .flags = IORESOURCE_DMA,
2635 },
2636};
2637
2638#endif
2639
2640#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2641 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2642
2643static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2644 .ce_shared = QCE_CE_SHARED,
2645 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2646 .hw_key_support = QCE_HW_KEY_SUPPORT,
2647 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2648};
2649
2650static struct platform_device qcrypto_device = {
2651 .name = "qcrypto",
2652 .id = 0,
2653 .num_resources = ARRAY_SIZE(qcrypto_resources),
2654 .resource = qcrypto_resources,
2655 .dev = {
2656 .coherent_dma_mask = DMA_BIT_MASK(32),
2657 .platform_data = &qcrypto_ce_hw_suppport,
2658 },
2659};
2660#endif
2661
2662#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2663 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2664
2665static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2666 .ce_shared = QCE_CE_SHARED,
2667 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2668 .hw_key_support = QCE_HW_KEY_SUPPORT,
2669 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2670};
2671
2672static struct platform_device qcedev_device = {
2673 .name = "qce",
2674 .id = 0,
2675 .num_resources = ARRAY_SIZE(qcedev_resources),
2676 .resource = qcedev_resources,
2677 .dev = {
2678 .coherent_dma_mask = DMA_BIT_MASK(32),
2679 .platform_data = &qcedev_ce_hw_suppport,
2680 },
2681};
2682#endif
2683
2684
2685static int __init gpiomux_init(void)
2686{
2687 int rc;
2688
2689 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2690 if (rc) {
2691 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2692 return rc;
2693 }
2694
Nishant Pandit24153d82011-08-27 16:05:13 +05302695 msm_gpiomux_install(msm8960_cam_common_configs,
2696 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697
2698 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002699 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002700
2701 msm_gpiomux_install(msm8960_gsbi_configs,
2702 ARRAY_SIZE(msm8960_gsbi_configs));
2703
2704 msm_gpiomux_install(msm8960_cyts_configs,
2705 ARRAY_SIZE(msm8960_cyts_configs));
2706
2707 msm_gpiomux_install(msm8960_slimbus_config,
2708 ARRAY_SIZE(msm8960_slimbus_config));
2709
2710 msm_gpiomux_install(msm8960_audio_codec_configs,
2711 ARRAY_SIZE(msm8960_audio_codec_configs));
2712
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002713 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2714 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2715
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002716#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2717 msm_gpiomux_install(msm8960_hdmi_configs,
2718 ARRAY_SIZE(msm8960_hdmi_configs));
2719#endif
2720
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002721 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2722 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002724 msm_gpiomux_install(wcnss_5wire_interface,
2725 ARRAY_SIZE(wcnss_5wire_interface));
2726
Mohan Pallaka5e490392011-09-09 15:18:41 +05302727 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2728 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2729 msm_gpiomux_install(hap_lvl_shft_config,
2730 ARRAY_SIZE(hap_lvl_shft_config));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731 return 0;
2732}
2733
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002734#define MSM_SHARED_RAM_PHYS 0x80000000
2735
2736static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2737 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2738 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2739 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2740 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2741 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2742 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2743 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2744 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2745 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2746 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2747 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2748 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2750 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2751 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2752 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2753 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2754 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2755 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2756 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2757 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2758 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2759 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2760 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2761 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2762 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002763 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002764 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2765 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2766 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002767 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2768 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002769};
2770
2771static struct pm8921_adc_properties pm8921_adc_data = {
2772 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2773 .bitresolution = 15,
2774 .bipolar = 0,
2775};
2776
2777static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2778 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002779 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002781 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002783
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002784static void __init msm8960_map_io(void)
2785{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002786 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002787 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002788
2789 if (socinfo_init() < 0)
2790 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002791}
2792
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002793#ifdef CONFIG_ARCH_MSM8930
2794static void __init msm8930_map_io(void)
2795{
2796 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2797 msm_map_msm8930_io();
2798
2799 if (socinfo_init() < 0)
2800 pr_err("socinfo_init() failed!\n");
2801}
2802#endif
2803
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002804static void __init msm8960_init_irq(void)
2805{
2806 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002807
2808 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002809 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002810 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002811
2812 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002813 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002814
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2816 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002817
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002818 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2819 * as they are configured as level, which does not play nice with
2820 * handle_percpu_irq.
2821 */
2822 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2823 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002824 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002825 }
2826}
2827
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002828/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829enum sdcc_controllers {
2830 SDCC1,
2831 SDCC2,
2832 SDCC3,
2833 SDCC4,
2834 SDCC5,
2835 MAX_SDCC_CONTROLLER
2836};
2837
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002838/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002839static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2840 /* SDCC1 : eMMC card connected */
2841 [SDCC1] = {
2842 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302843 .high_vol_level = 2950000,
2844 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302845 .always_on = 1,
2846 .lpm_sup = 1,
2847 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002848 .hpm_uA = 200000, /* 200mA */
2849 },
2850 /* SDCC3 : External card slot connected */
2851 [SDCC3] = {
2852 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302853 .high_vol_level = 2950000,
2854 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002855 .hpm_uA = 600000, /* 600mA */
2856 }
2857};
2858
2859/* Only slots having eMMC card will require VCCQ voltage */
2860static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2861 /* SDCC1 : eMMC card connected */
2862 [SDCC1] = {
2863 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002864 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302865 .high_vol_level = 1800000,
2866 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867 .hpm_uA = 200000, /* 200mA */
2868 }
2869};
2870
2871/* All SDCC controllers may require voting for VDD PAD voltage */
2872static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2873 /* SDCC3 : External card slot connected */
2874 [SDCC3] = {
2875 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302876 .high_vol_level = 2950000,
2877 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002878 .always_on = 1,
2879 .lpm_sup = 1,
2880 /* Max. Active current required is 16 mA */
2881 .hpm_uA = 16000,
2882 /*
2883 * Sleep current required is ~300 uA. But min. vote can be
2884 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2885 * during sleep.
2886 */
2887 .lpm_uA = 2000,
2888 }
2889};
2890
2891static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2892 /* SDCC1 : eMMC card connected */
2893 [SDCC1] = {
2894 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2895 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2896 },
2897 /* SDCC3 : External card slot connected */
2898 [SDCC3] = {
2899 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2900 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2901 }
2902};
2903
2904/* SDC1 pad data */
2905static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2906 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302907 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2908 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002909};
2910
2911static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2912 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2913 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2914 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2915};
2916
2917static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302918 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002919 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2920 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2921};
2922
2923static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302924 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2926 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2927};
2928
2929/* SDC3 pad data */
2930static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2931 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2932 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2933 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2934};
2935
2936static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2937 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2938 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2939 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2940};
2941
2942static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302943 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002944 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2945 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2946};
2947
2948static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302949 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302950 /*
2951 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2952 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2953 * which would result in false card detection interrupts.
2954 */
2955 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2956 /*
2957 * Keeping DATA lines status to PULL UP will make sure that
2958 * there is no current leak during sleep if external pull up
2959 * is connected to DATA lines.
2960 */
2961 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002962};
2963
2964struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2965 [SDCC1] = {
2966 .on = sdc1_pad_pull_on_cfg,
2967 .off = sdc1_pad_pull_off_cfg,
2968 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2969 },
2970 [SDCC3] = {
2971 .on = sdc3_pad_pull_on_cfg,
2972 .off = sdc3_pad_pull_off_cfg,
2973 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2974 },
2975};
2976
2977struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2978 [SDCC1] = {
2979 .on = sdc1_pad_drv_on_cfg,
2980 .off = sdc1_pad_drv_off_cfg,
2981 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2982 },
2983 [SDCC3] = {
2984 .on = sdc3_pad_drv_on_cfg,
2985 .off = sdc3_pad_drv_off_cfg,
2986 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2987 },
2988};
2989
2990struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2991 [SDCC1] = {
2992 .pull = &mmc_pad_pull_data[SDCC1],
2993 .drv = &mmc_pad_drv_data[SDCC1]
2994 },
2995 [SDCC3] = {
2996 .pull = &mmc_pad_pull_data[SDCC3],
2997 .drv = &mmc_pad_drv_data[SDCC3]
2998 },
2999};
3000
3001struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
3002 [SDCC1] = {
3003 .pad_data = &mmc_pad_data[SDCC1],
3004 },
3005 [SDCC3] = {
3006 .pad_data = &mmc_pad_data[SDCC3],
3007 },
3008};
3009
3010static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303011 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003012};
3013
3014static unsigned int sdc3_sup_clk_rates[] = {
3015 400000, 24000000, 48000000, 96000000
3016};
3017
3018#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3019static struct mmc_platform_data msm8960_sdc1_data = {
3020 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3021#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3022 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3023#else
3024 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3025#endif
3026 .sup_clk_table = sdc1_sup_clk_rates,
3027 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303028 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003029 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003030 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303031 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003032};
3033#endif
3034
3035#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3036static struct mmc_platform_data msm8960_sdc3_data = {
3037 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3038 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3039 .sup_clk_table = sdc3_sup_clk_rates,
3040 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303041 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303042#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003043 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303044#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003045 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3046 .pin_data = &mmc_slot_pin_data[SDCC3],
3047#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3048 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3049 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3050 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3051#endif
3052 .xpc_cap = 1,
3053 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3054 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303055 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003056};
3057#endif
3058
3059static void __init msm8960_init_mmc(void)
3060{
3061#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3062 /* SDC1 : eMMC card connected */
3063 msm_add_sdcc(1, &msm8960_sdc1_data);
3064#endif
3065#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3066 /* SDC3: External card slot */
3067 msm_add_sdcc(3, &msm8960_sdc3_data);
3068#endif
3069}
3070
3071static void __init msm8960_init_buses(void)
3072{
3073#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003074 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003075 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3076 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3077 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3078 msm_bus_apps_fabric.dev.platform_data =
3079 &msm_bus_8960_apps_fabric_pdata;
3080 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3081 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3082 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3083 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003084#endif
3085}
3086
3087static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3088 .max_clock_speed = 15060000,
3089};
3090
3091#ifdef CONFIG_USB_MSM_OTG_72K
3092static struct msm_otg_platform_data msm_otg_pdata;
3093#else
3094#define USB_5V_EN 42
3095static void msm_hsusb_vbus_power(bool on)
3096{
3097 int rc;
3098 static bool vbus_is_on;
3099 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003100
3101 if (vbus_is_on == on)
3102 return;
3103
3104 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003105 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3106 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003107 if (IS_ERR(mvs_otg_switch)) {
3108 pr_err("Unable to get mvs_otg_switch\n");
3109 return;
3110 }
3111
3112 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3113 "usb_5v_en");
3114 if (rc < 0) {
3115 pr_err("failed to request usb_5v_en gpio\n");
3116 goto put_mvs_otg;
3117 }
3118
Anji jonnala2936fd92011-11-09 15:39:22 +05303119 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3120 if (rc) {
3121 pr_err("%s: unable to set_direction for gpio [%d]\n",
3122 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003123 goto free_usb_5v_en;
3124 }
3125
Anji jonnala2936fd92011-11-09 15:39:22 +05303126 if (regulator_enable(mvs_otg_switch)) {
3127 pr_err("unable to enable mvs_otg_switch\n");
3128 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003129 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303130
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003131 vbus_is_on = true;
3132 return;
3133 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303134 regulator_disable(mvs_otg_switch);
3135err_ldo_gpio_set_dir:
3136 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303138 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003139put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303140 regulator_put(mvs_otg_switch);
3141 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003142}
3143
3144static struct msm_otg_platform_data msm_otg_pdata = {
3145 .mode = USB_OTG,
3146 .otg_control = OTG_PMIC_CONTROL,
3147 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3148 .pclk_src_name = "dfab_usb_hs_clk",
3149 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3150 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303151 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003152};
3153#endif
3154
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303155#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303156#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303157static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3158 .strobe = 150,
3159 .data = 151,
3160};
3161#else
3162static struct msm_hsic_host_platform_data msm_hsic_pdata;
3163#endif
3164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003165#define PID_MAGIC_ID 0x71432909
3166#define SERIAL_NUM_MAGIC_ID 0x61945374
3167#define SERIAL_NUMBER_LENGTH 127
3168#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3169
3170struct magic_num_struct {
3171 uint32_t pid;
3172 uint32_t serial_num;
3173};
3174
3175struct dload_struct {
3176 uint32_t reserved1;
3177 uint32_t reserved2;
3178 uint32_t reserved3;
3179 uint16_t reserved4;
3180 uint16_t pid;
3181 char serial_number[SERIAL_NUMBER_LENGTH];
3182 uint16_t reserved5;
3183 struct magic_num_struct magic_struct;
3184};
3185
3186static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3187{
3188 struct dload_struct __iomem *dload = 0;
3189
3190 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3191 if (!dload) {
3192 pr_err("%s: cannot remap I/O memory region: %08x\n",
3193 __func__, DLOAD_USB_BASE_ADD);
3194 return -ENXIO;
3195 }
3196
3197 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3198 __func__, dload, pid, snum);
3199 /* update pid */
3200 dload->magic_struct.pid = PID_MAGIC_ID;
3201 dload->pid = pid;
3202
3203 /* update serial number */
3204 dload->magic_struct.serial_num = 0;
3205 if (!snum) {
3206 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3207 goto out;
3208 }
3209
3210 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003211 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003212out:
3213 iounmap(dload);
3214 return 0;
3215}
3216
3217static struct android_usb_platform_data android_usb_pdata = {
3218 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3219};
3220
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003221static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003222 .name = "android_usb",
3223 .id = -1,
3224 .dev = {
3225 .platform_data = &android_usb_pdata,
3226 },
3227};
3228
3229static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3230 0x03, 0x0f,
3231};
3232
3233static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3234 0x00, 0x24, 0x54, 0x10,
3235 0x09, 0x03, 0x01,
3236 0x10, 0x54, 0x30, 0x0C,
3237 0x24, 0x30, 0x0f,
3238};
3239
3240static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3241 0x00, 0x24, 0x54, 0x10,
3242 0x09, 0x07, 0x01, 0x0B,
3243 0x10, 0x54, 0x30, 0x0C,
3244 0x24, 0x30, 0x0f,
3245};
3246
3247static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3248 [0] = {
3249 .mode = MSM_SPM_MODE_CLOCK_GATING,
3250 .notify_rpm = false,
3251 .cmd = spm_wfi_cmd_sequence,
3252 },
3253 [1] = {
3254 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3255 .notify_rpm = false,
3256 .cmd = spm_power_collapse_without_rpm,
3257 },
3258 [2] = {
3259 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3260 .notify_rpm = true,
3261 .cmd = spm_power_collapse_with_rpm,
3262 },
3263};
3264
3265static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3266 [0] = {
3267 .reg_base_addr = MSM_SAW0_BASE,
3268 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3269 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3270 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3271#if defined(CONFIG_MSM_AVS_HW)
3272 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3273 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3274#endif
3275 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3276 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3277 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3278 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3279 .vctl_timeout_us = 50,
3280 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3281 .modes = msm_spm_seq_list,
3282 },
3283 [1] = {
3284 .reg_base_addr = MSM_SAW1_BASE,
3285 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3286 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3287 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3288#if defined(CONFIG_MSM_AVS_HW)
3289 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3290 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3291#endif
3292 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3293 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3294 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3295 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3296 .vctl_timeout_us = 50,
3297 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3298 .modes = msm_spm_seq_list,
3299 },
3300};
3301
3302static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3303 0x00, 0x20, 0x03, 0x20,
3304 0x00, 0x0f,
3305};
3306
3307static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3308 0x00, 0x20, 0x34, 0x64,
3309 0x48, 0x07, 0x48, 0x20,
3310 0x50, 0x64, 0x04, 0x34,
3311 0x50, 0x0f,
3312};
3313static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3314 0x00, 0x10, 0x34, 0x64,
3315 0x48, 0x07, 0x48, 0x10,
3316 0x50, 0x64, 0x04, 0x34,
3317 0x50, 0x0F,
3318};
3319
3320static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3321 [0] = {
3322 .mode = MSM_SPM_L2_MODE_RETENTION,
3323 .notify_rpm = false,
3324 .cmd = l2_spm_wfi_cmd_sequence,
3325 },
3326 [1] = {
3327 .mode = MSM_SPM_L2_MODE_GDHS,
3328 .notify_rpm = true,
3329 .cmd = l2_spm_gdhs_cmd_sequence,
3330 },
3331 [2] = {
3332 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3333 .notify_rpm = true,
3334 .cmd = l2_spm_power_off_cmd_sequence,
3335 },
3336};
3337
3338
3339static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3340 [0] = {
3341 .reg_base_addr = MSM_SAW_L2_BASE,
3342 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3343 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3344 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3345 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3346 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3347 .modes = msm_spm_l2_seq_list,
3348 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3349 },
3350};
3351
Mohan Pallaka5e490392011-09-09 15:18:41 +05303352#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3353#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3354
3355static struct msm_xo_voter *xo_handle_d1;
3356
3357static int isa1200_power(int on)
3358{
3359 int rc = 0;
3360
3361 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3362
3363 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3364 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3365 if (rc < 0) {
3366 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3367 __func__, on ? "" : "de-", rc);
3368 goto err_xo_vote;
3369 }
3370
3371 return 0;
3372
3373err_xo_vote:
3374 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3375 return rc;
3376}
3377
3378static int isa1200_dev_setup(bool enable)
3379{
3380 int rc = 0;
3381
3382 struct pm_gpio hap_gpio_config = {
3383 .direction = PM_GPIO_DIR_OUT,
3384 .pull = PM_GPIO_PULL_NO,
3385 .out_strength = PM_GPIO_STRENGTH_HIGH,
3386 .function = PM_GPIO_FUNC_NORMAL,
3387 .inv_int_pol = 0,
3388 .vin_sel = 2,
3389 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3390 .output_value = 0,
3391 };
3392
3393 if (enable == true) {
3394 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3395 if (rc) {
3396 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3397 __func__, PM_HAP_EN_GPIO, rc);
3398 return rc;
3399 }
3400
3401 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3402 if (rc) {
3403 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3404 __func__, PM_HAP_LEN_GPIO, rc);
3405 return rc;
3406 }
3407
3408 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3409 if (rc) {
3410 pr_err("%s: unable to request gpio %d (%d)\n",
3411 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3412 return rc;
3413 }
3414
3415 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3416 if (rc) {
3417 pr_err("%s: Unable to set direction\n", __func__);
3418 goto free_gpio;
3419 }
3420
3421 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3422 if (IS_ERR(xo_handle_d1)) {
3423 rc = PTR_ERR(xo_handle_d1);
3424 pr_err("%s: failed to get the handle for D1(%d)\n",
3425 __func__, rc);
3426 goto gpio_set_dir;
3427 }
3428 } else {
3429 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3430
3431 msm_xo_put(xo_handle_d1);
3432 }
3433
3434 return 0;
3435
3436gpio_set_dir:
3437 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3438free_gpio:
3439 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3440 return rc;
3441}
3442
3443static struct isa1200_regulator isa1200_reg_data[] = {
3444 {
3445 .name = "vcc_i2c",
3446 .min_uV = ISA_I2C_VTG_MIN_UV,
3447 .max_uV = ISA_I2C_VTG_MAX_UV,
3448 .load_uA = ISA_I2C_CURR_UA,
3449 },
3450};
3451
3452static struct isa1200_platform_data isa1200_1_pdata = {
3453 .name = "vibrator",
3454 .dev_setup = isa1200_dev_setup,
3455 .power_on = isa1200_power,
3456 .hap_en_gpio = PM_HAP_EN_GPIO,
3457 .hap_len_gpio = PM_HAP_LEN_GPIO,
3458 .max_timeout = 15000,
3459 .mode_ctrl = PWM_GEN_MODE,
3460 .pwm_fd = {
3461 .pwm_div = 256,
3462 },
3463 .is_erm = false,
3464 .smart_en = true,
3465 .ext_clk_en = true,
3466 .chip_en = 1,
3467 .regulator_info = isa1200_reg_data,
3468 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3469};
3470
3471static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3472 {
3473 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3474 .platform_data = &isa1200_1_pdata,
3475 },
3476};
3477
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003478#define CYTTSP_TS_GPIO_IRQ 11
3479#define CYTTSP_TS_SLEEP_GPIO 50
3480#define CYTTSP_TS_RESOUT_N_GPIO 52
3481
3482/*virtual key support */
3483static ssize_t tma340_vkeys_show(struct kobject *kobj,
3484 struct kobj_attribute *attr, char *buf)
3485{
3486 return snprintf(buf, 200,
3487 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3488 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3489 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3490 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3491 "\n");
3492}
3493
3494static struct kobj_attribute tma340_vkeys_attr = {
3495 .attr = {
3496 .mode = S_IRUGO,
3497 },
3498 .show = &tma340_vkeys_show,
3499};
3500
3501static struct attribute *tma340_properties_attrs[] = {
3502 &tma340_vkeys_attr.attr,
3503 NULL
3504};
3505
3506static struct attribute_group tma340_properties_attr_group = {
3507 .attrs = tma340_properties_attrs,
3508};
3509
3510
3511static int cyttsp_platform_init(struct i2c_client *client)
3512{
3513 int rc = 0;
3514 static struct kobject *tma340_properties_kobj;
3515
3516 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3517 tma340_properties_kobj = kobject_create_and_add("board_properties",
3518 NULL);
3519 if (tma340_properties_kobj)
3520 rc = sysfs_create_group(tma340_properties_kobj,
3521 &tma340_properties_attr_group);
3522 if (!tma340_properties_kobj || rc)
3523 pr_err("%s: failed to create board_properties\n",
3524 __func__);
3525
3526 return 0;
3527}
3528
3529static struct cyttsp_regulator regulator_data[] = {
3530 {
3531 .name = "vdd",
3532 .min_uV = CY_TMA300_VTG_MIN_UV,
3533 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303534 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3535 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003536 },
3537 /* TODO: Remove after runtime PM is enabled in I2C driver */
3538 {
3539 .name = "vcc_i2c",
3540 .min_uV = CY_I2C_VTG_MIN_UV,
3541 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303542 .hpm_load_uA = CY_I2C_CURR_UA,
3543 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003544 },
3545};
3546
3547static struct cyttsp_platform_data cyttsp_pdata = {
3548 .panel_maxx = 634,
3549 .panel_maxy = 1166,
3550 .disp_maxx = 616,
3551 .disp_maxy = 1023,
3552 .disp_minx = 0,
3553 .disp_miny = 16,
3554 .flags = 0x01,
3555 .gen = CY_GEN3, /* or */
3556 .use_st = CY_USE_ST,
3557 .use_mt = CY_USE_MT,
3558 .use_hndshk = CY_SEND_HNDSHK,
3559 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303560 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003561 .use_gestures = CY_USE_GESTURES,
3562 .fw_fname = "cyttsp_8960_cdp.hex",
3563 /* activate up to 4 groups
3564 * and set active distance
3565 */
3566 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3567 CY_GEST_GRP3 | CY_GEST_GRP4 |
3568 CY_ACT_DIST,
3569 /* change act_intrvl to customize the Active power state
3570 * scanning/processing refresh interval for Operating mode
3571 */
3572 .act_intrvl = CY_ACT_INTRVL_DFLT,
3573 /* change tch_tmout to customize the touch timeout for the
3574 * Active power state for Operating mode
3575 */
3576 .tch_tmout = CY_TCH_TMOUT_DFLT,
3577 /* change lp_intrvl to customize the Low Power power state
3578 * scanning/processing refresh interval for Operating mode
3579 */
3580 .lp_intrvl = CY_LP_INTRVL_DFLT,
3581 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3582 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3583 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3584 .regulator_info = regulator_data,
3585 .num_regulators = ARRAY_SIZE(regulator_data),
3586 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303587 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003588};
3589
3590static struct i2c_board_info cyttsp_info[] __initdata = {
3591 {
3592 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3593 .platform_data = &cyttsp_pdata,
3594#ifndef CY_USE_TIMER
3595 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3596#endif /* CY_USE_TIMER */
3597 },
3598};
3599
Mohan Pallaka50837382011-09-07 11:00:57 +05303600/* configuration data */
3601static const u8 mxt_config_data[] = {
3602 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003603 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303604 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003605 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3606 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3607 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3608 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3609 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3610 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3611 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303612 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003613 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303614 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003615 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303616 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003617 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3618 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3619 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3620 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303621 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003622 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3623 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303624 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003625 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3626 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303627 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003628 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3629 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303630 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003631 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3632 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303633 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003634 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303635 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003636 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303637 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003638 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303639 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003640 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303641 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003642 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303643};
3644
3645#define MXT_TS_GPIO_IRQ 11
3646#define MXT_TS_LDO_EN_GPIO 50
3647#define MXT_TS_RESET_GPIO 52
3648
3649static void mxt_init_hw_liquid(void)
3650{
3651 int rc;
3652
3653 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3654 if (rc) {
3655 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3656 __func__, MXT_TS_GPIO_IRQ);
3657 return;
3658 }
3659
3660 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3661 if (rc) {
3662 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3663 __func__, MXT_TS_GPIO_IRQ);
3664 goto err_irq_gpio_req;
3665 }
3666
3667 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3668 if (rc) {
3669 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3670 __func__, MXT_TS_LDO_EN_GPIO);
3671 goto err_irq_gpio_req;
3672 }
3673
3674 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3675 if (rc) {
3676 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3677 __func__, MXT_TS_LDO_EN_GPIO);
3678 goto err_ldo_gpio_req;
3679 }
3680
3681 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3682 if (rc) {
3683 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3684 __func__, MXT_TS_RESET_GPIO);
3685 goto err_ldo_gpio_set_dir;
3686 }
3687
3688 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3689 if (rc) {
3690 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3691 __func__, MXT_TS_RESET_GPIO);
3692 goto err_reset_gpio_req;
3693 }
3694
3695 return;
3696
3697err_reset_gpio_req:
3698 gpio_free(MXT_TS_RESET_GPIO);
3699err_ldo_gpio_set_dir:
3700 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3701err_ldo_gpio_req:
3702 gpio_free(MXT_TS_LDO_EN_GPIO);
3703err_irq_gpio_req:
3704 gpio_free(MXT_TS_GPIO_IRQ);
3705}
3706
3707static struct mxt_platform_data mxt_platform_data = {
3708 .config = mxt_config_data,
3709 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003710 .x_size = 1365,
3711 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303712 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003713 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303714};
3715
3716static struct i2c_board_info mxt_device_info[] __initdata = {
3717 {
3718 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3719 .platform_data = &mxt_platform_data,
3720 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3721 },
3722};
3723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003724static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3725{
3726}
3727
3728static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3729 .clk_freq = 100000,
3730 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003731 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3732};
3733
3734static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3735 .clk_freq = 100000,
3736 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003737 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3738};
3739
3740static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3741 .clk_freq = 100000,
3742 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003743 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3744};
3745
3746static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3747 .clk_freq = 100000,
3748 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003749 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3750};
3751
3752static struct msm_rpm_platform_data msm_rpm_data = {
3753 .reg_base_addrs = {
3754 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3755 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3756 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3757 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3758 },
3759
3760 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3761 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3762 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3763 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3764 .msm_apps_ipc_rpm_val = 4,
3765};
3766
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003767static struct ks8851_pdata spi_eth_pdata = {
3768 .irq_gpio = KS8851_IRQ_GPIO,
3769 .rst_gpio = KS8851_RST_GPIO,
3770};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003771
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003772static struct spi_board_info spi_board_info[] __initdata = {
3773 {
3774 .modalias = "ks8851",
3775 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3776 .max_speed_hz = 19200000,
3777 .bus_num = 0,
3778 .chip_select = 0,
3779 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003780 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003781 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003782 {
3783 .modalias = "dsi_novatek_3d_panel_spi",
3784 .max_speed_hz = 10800000,
3785 .bus_num = 0,
3786 .chip_select = 1,
3787 .mode = SPI_MODE_0,
3788 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003789};
3790
3791static struct platform_device msm_device_saw_core0 = {
3792 .name = "saw-regulator",
3793 .id = 0,
3794 .dev = {
3795 .platform_data = &msm_saw_regulator_pdata_s5,
3796 },
3797};
3798
3799static struct platform_device msm_device_saw_core1 = {
3800 .name = "saw-regulator",
3801 .id = 1,
3802 .dev = {
3803 .platform_data = &msm_saw_regulator_pdata_s6,
3804 },
3805};
3806
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003807#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3808static struct platform_device wfd_device = {
3809 .name = "msm_wfd",
3810 .id = -1,
3811};
3812#endif
3813
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003814static struct tsens_platform_data msm_tsens_pdata = {
3815 .slope = 910,
3816 .tsens_factor = 1000,
3817 .hw_type = MSM_8960,
3818 .tsens_num_sensor = 5,
3819};
3820
3821static struct platform_device msm_tsens_device = {
3822 .name = "tsens8960-tm",
3823 .id = -1,
3824 .dev = {
3825 .platform_data = &msm_tsens_pdata,
3826 },
3827};
3828
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003829#ifdef CONFIG_MSM_FAKE_BATTERY
3830static struct platform_device fish_battery_device = {
3831 .name = "fish_battery",
3832};
3833#endif
3834
David Collins26f05562011-06-20 09:56:28 -07003835static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003836 .name = GPIO_REGULATOR_DEV_NAME,
3837 .id = PM8921_MPP_PM_TO_SYS(7),
3838 .dev = {
3839 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3840 },
3841};
3842
David Collins26f05562011-06-20 09:56:28 -07003843static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003844 .name = GPIO_REGULATOR_DEV_NAME,
3845 .id = 91,
3846 .dev = {
3847 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3848 },
3849};
3850
David Collinsb10be1d2011-09-02 10:29:31 -07003851static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3852 .name = GPIO_REGULATOR_DEV_NAME,
3853 .id = PM8921_GPIO_PM_TO_SYS(17),
3854 .dev = {
3855 .platform_data =
3856 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3857 },
3858};
3859
David Collins26f05562011-06-20 09:56:28 -07003860static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3861 .name = "rpm-regulator",
3862 .id = -1,
3863 .dev = {
3864 .platform_data = &msm_rpm_regulator_pdata,
3865 },
3866};
3867
David Collins4c31a872011-08-31 10:07:10 -07003868static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3869 .phys_addr_base = 0x0010C000,
3870 .reg_offsets = {
3871 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3872 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3873 },
3874 .phys_size = SZ_8K,
3875 .log_len = 4096, /* log's buffer length in bytes */
3876 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3877};
3878
3879static struct platform_device msm_rpm_log_device = {
3880 .name = "msm_rpm_log",
3881 .id = -1,
3882 .dev = {
3883 .platform_data = &msm_rpm_log_pdata,
3884 },
3885};
3886
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003887static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003888 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003889 &msm_device_smd,
3890 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303891 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003892 &msm_device_saw_core0,
3893 &msm_device_saw_core1,
3894 &msm8960_device_ext_5v_vreg,
3895 &msm8960_device_ext_l2_vreg,
3896 &msm8960_device_ssbi_pm8921,
3897 &msm8960_device_qup_spi_gsbi1,
3898 &msm8960_device_qup_i2c_gsbi3,
3899 &msm8960_device_qup_i2c_gsbi4,
3900 &msm8960_device_qup_i2c_gsbi10,
3901#ifndef CONFIG_MSM_DSPS
3902 &msm8960_device_qup_i2c_gsbi12,
3903#endif
3904 &msm_slim_ctrl,
3905 &msm_device_wcnss_wlan,
3906#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3907 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3908 &qcrypto_device,
3909#endif
3910
3911#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3912 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3913 &qcedev_device,
3914#endif
3915#ifdef CONFIG_MSM_ROTATOR
3916 &msm_rotator_device,
3917#endif
3918 &msm_device_sps,
3919#ifdef CONFIG_MSM_FAKE_BATTERY
3920 &fish_battery_device,
3921#endif
3922#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003923#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003924 &android_pmem_device,
3925 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003926#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003927 &android_pmem_audio_device,
3928#endif
3929 &msm_fb_device,
3930 &msm_device_vidc,
3931 &msm_device_bam_dmux,
3932 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003933
3934#ifdef CONFIG_HW_RANDOM_MSM
3935 &msm_device_rng,
3936#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003937 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003938#ifdef CONFIG_ION_MSM
3939 &ion_dev,
3940#endif
David Collins4c31a872011-08-31 10:07:10 -07003941 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003942 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003943#ifdef CONFIG_MSM_QDSS
3944 &msm_etb_device,
3945 &msm_tpiu_device,
3946 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003947 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003948 &msm_ptm_device,
3949#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003950 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003951 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003952#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3953 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003954 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003955#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003956};
3957
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003958static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003959 &msm8960_device_otg,
3960 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003961 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303962 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003963 &android_usb_device,
3964 &msm_device_vidc,
3965 &mipi_dsi_simulator_panel_device,
3966 &msm_bus_apps_fabric,
3967 &msm_bus_sys_fabric,
3968 &msm_bus_mm_fabric,
3969 &msm_bus_sys_fpb,
3970 &msm_bus_cpss_fpb,
3971 &msm_pcm,
3972 &msm_pcm_routing,
3973 &msm_cpudai0,
3974 &msm_cpudai1,
3975 &msm_cpudai_hdmi_rx,
3976 &msm_cpudai_bt_rx,
3977 &msm_cpudai_bt_tx,
3978 &msm_cpudai_fm_rx,
3979 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003980 &msm_cpudai_auxpcm_rx,
3981 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003982 &msm_cpu_fe,
3983 &msm_stub_codec,
3984 &msm_voice,
3985 &msm_voip,
3986 &msm_lpa_pcm,
3987
3988#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3989 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3990 &qcrypto_device,
3991#endif
3992
3993#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3994 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3995 &qcedev_device,
3996#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003997};
3998
3999static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004000 &msm_kgsl_3d0,
4001 &msm_kgsl_2d0,
4002 &msm_kgsl_2d1,
4003 &mipi_dsi_renesas_panel_device,
4004#ifdef CONFIG_MSM_GEMINI
4005 &msm8960_gemini_device,
4006#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004007};
4008
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004009static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004010 &msm8960_device_otg,
4011 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004012 &msm_device_hsusb_host,
4013 &android_usb_device,
4014 &msm_pcm,
4015 &msm_pcm_routing,
4016 &msm_cpudai0,
4017 &msm_cpudai1,
4018 &msm_cpudai_hdmi_rx,
4019 &msm_cpudai_bt_rx,
4020 &msm_cpudai_bt_tx,
4021 &msm_cpudai_fm_rx,
4022 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004023 &msm_cpudai_auxpcm_rx,
4024 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004025 &msm_cpu_fe,
4026 &msm_stub_codec,
4027 &msm_kgsl_3d0,
4028#ifdef CONFIG_MSM_KGSL_2D
4029 &msm_kgsl_2d0,
4030 &msm_kgsl_2d1,
4031#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004032 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004033#ifdef CONFIG_MSM_GEMINI
4034 &msm8960_gemini_device,
4035#endif
4036 &msm_voice,
4037 &msm_voip,
4038 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304039 &msm_cpudai_afe_01_rx,
4040 &msm_cpudai_afe_01_tx,
4041 &msm_cpudai_afe_02_rx,
4042 &msm_cpudai_afe_02_tx,
4043 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004044#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4045 &hdmi_msm_device,
4046#endif
4047 &msm_pcm_hostless,
4048 &msm_bus_apps_fabric,
4049 &msm_bus_sys_fabric,
4050 &msm_bus_mm_fabric,
4051 &msm_bus_sys_fpb,
4052 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004053 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004054};
4055
4056static void __init msm8960_i2c_init(void)
4057{
4058 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4059 &msm8960_i2c_qup_gsbi4_pdata;
4060
4061 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4062 &msm8960_i2c_qup_gsbi3_pdata;
4063
4064 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4065 &msm8960_i2c_qup_gsbi10_pdata;
4066
4067 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4068 &msm8960_i2c_qup_gsbi12_pdata;
4069}
4070
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004071static void __init msm8960_gfx_init(void)
4072{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004073 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004074 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4075 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4076 msm_kgsl_3d0.dev.platform_data;
4077 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
4078 320000000;
4079 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
4080 266667000;
4081 }
4082}
4083
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004084static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4085 .irq_base = PM8921_IRQ_BASE,
4086 .devirq = MSM_GPIO_TO_INT(104),
4087 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4088};
4089
4090static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4091 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4092};
4093
4094static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4095 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4096};
4097
4098static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4099 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304100 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004101};
4102
4103static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4104 .pull_up = 1,
4105 .kpd_trigger_delay_us = 970,
4106 .wakeup = 1,
4107};
4108
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304109/* Rotate lock key is not available so use F1 */
4110#define KEY_ROTATE_LOCK KEY_F1
4111
4112static const unsigned int keymap_liquid[] = {
4113 KEY(0, 0, KEY_VOLUMEUP),
4114 KEY(0, 1, KEY_VOLUMEDOWN),
4115 KEY(1, 3, KEY_ROTATE_LOCK),
4116 KEY(1, 4, KEY_HOME),
4117};
4118
4119static struct matrix_keymap_data keymap_data_liquid = {
4120 .keymap_size = ARRAY_SIZE(keymap_liquid),
4121 .keymap = keymap_liquid,
4122};
4123
4124static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4125 .input_name = "keypad_8960_liquid",
4126 .input_phys_device = "keypad_8960/input0",
4127 .num_rows = 2,
4128 .num_cols = 5,
4129 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4130 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4131 .debounce_ms = 15,
4132 .scan_delay_ms = 32,
4133 .row_hold_ns = 91500,
4134 .wakeup = 1,
4135 .keymap_data = &keymap_data_liquid,
4136};
4137
4138
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004139static const unsigned int keymap[] = {
4140 KEY(0, 0, KEY_VOLUMEUP),
4141 KEY(0, 1, KEY_VOLUMEDOWN),
4142 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4143 KEY(0, 3, KEY_CAMERA_FOCUS),
4144};
4145
4146static struct matrix_keymap_data keymap_data = {
4147 .keymap_size = ARRAY_SIZE(keymap),
4148 .keymap = keymap,
4149};
4150
4151static struct pm8xxx_keypad_platform_data keypad_data = {
4152 .input_name = "keypad_8960",
4153 .input_phys_device = "keypad_8960/input0",
4154 .num_rows = 1,
4155 .num_cols = 5,
4156 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4157 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4158 .debounce_ms = 15,
4159 .scan_delay_ms = 32,
4160 .row_hold_ns = 91500,
4161 .wakeup = 1,
4162 .keymap_data = &keymap_data,
4163};
4164
4165static const unsigned int keymap_sim[] = {
4166 KEY(0, 0, KEY_7),
4167 KEY(0, 1, KEY_DOWN),
4168 KEY(0, 2, KEY_UP),
4169 KEY(0, 3, KEY_RIGHT),
4170 KEY(0, 4, KEY_ENTER),
4171 KEY(0, 5, KEY_L),
4172 KEY(0, 6, KEY_BACK),
4173 KEY(0, 7, KEY_M),
4174
4175 KEY(1, 0, KEY_LEFT),
4176 KEY(1, 1, KEY_SEND),
4177 KEY(1, 2, KEY_1),
4178 KEY(1, 3, KEY_4),
4179 KEY(1, 4, KEY_CLEAR),
4180 KEY(1, 5, KEY_MSDOS),
4181 KEY(1, 6, KEY_SPACE),
4182 KEY(1, 7, KEY_COMMA),
4183
4184 KEY(2, 0, KEY_6),
4185 KEY(2, 1, KEY_5),
4186 KEY(2, 2, KEY_8),
4187 KEY(2, 3, KEY_3),
4188 KEY(2, 4, KEY_NUMERIC_STAR),
4189 KEY(2, 5, KEY_UP),
4190 KEY(2, 6, KEY_DOWN),
4191 KEY(2, 7, KEY_LEFTSHIFT),
4192
4193 KEY(3, 0, KEY_9),
4194 KEY(3, 1, KEY_NUMERIC_POUND),
4195 KEY(3, 2, KEY_0),
4196 KEY(3, 3, KEY_2),
4197 KEY(3, 4, KEY_SLEEP),
4198 KEY(3, 5, KEY_F1),
4199 KEY(3, 6, KEY_F2),
4200 KEY(3, 7, KEY_F3),
4201
4202 KEY(4, 0, KEY_BACK),
4203 KEY(4, 1, KEY_HOME),
4204 KEY(4, 2, KEY_MENU),
4205 KEY(4, 3, KEY_VOLUMEUP),
4206 KEY(4, 4, KEY_VOLUMEDOWN),
4207 KEY(4, 5, KEY_F4),
4208 KEY(4, 6, KEY_F5),
4209 KEY(4, 7, KEY_F6),
4210
4211 KEY(5, 0, KEY_R),
4212 KEY(5, 1, KEY_T),
4213 KEY(5, 2, KEY_Y),
4214 KEY(5, 3, KEY_LEFTALT),
4215 KEY(5, 4, KEY_KPENTER),
4216 KEY(5, 5, KEY_Q),
4217 KEY(5, 6, KEY_W),
4218 KEY(5, 7, KEY_E),
4219
4220 KEY(6, 0, KEY_F),
4221 KEY(6, 1, KEY_G),
4222 KEY(6, 2, KEY_H),
4223 KEY(6, 3, KEY_CAPSLOCK),
4224 KEY(6, 4, KEY_PAGEUP),
4225 KEY(6, 5, KEY_A),
4226 KEY(6, 6, KEY_S),
4227 KEY(6, 7, KEY_D),
4228
4229 KEY(7, 0, KEY_V),
4230 KEY(7, 1, KEY_B),
4231 KEY(7, 2, KEY_N),
4232 KEY(7, 3, KEY_MENU),
4233 KEY(7, 4, KEY_PAGEDOWN),
4234 KEY(7, 5, KEY_Z),
4235 KEY(7, 6, KEY_X),
4236 KEY(7, 7, KEY_C),
4237
4238 KEY(8, 0, KEY_P),
4239 KEY(8, 1, KEY_J),
4240 KEY(8, 2, KEY_K),
4241 KEY(8, 3, KEY_INSERT),
4242 KEY(8, 4, KEY_LINEFEED),
4243 KEY(8, 5, KEY_U),
4244 KEY(8, 6, KEY_I),
4245 KEY(8, 7, KEY_O),
4246
4247 KEY(9, 0, KEY_4),
4248 KEY(9, 1, KEY_5),
4249 KEY(9, 2, KEY_6),
4250 KEY(9, 3, KEY_7),
4251 KEY(9, 4, KEY_8),
4252 KEY(9, 5, KEY_1),
4253 KEY(9, 6, KEY_2),
4254 KEY(9, 7, KEY_3),
4255
4256 KEY(10, 0, KEY_F7),
4257 KEY(10, 1, KEY_F8),
4258 KEY(10, 2, KEY_F9),
4259 KEY(10, 3, KEY_F10),
4260 KEY(10, 4, KEY_FN),
4261 KEY(10, 5, KEY_9),
4262 KEY(10, 6, KEY_0),
4263 KEY(10, 7, KEY_DOT),
4264
4265 KEY(11, 0, KEY_LEFTCTRL),
4266 KEY(11, 1, KEY_F11),
4267 KEY(11, 2, KEY_ENTER),
4268 KEY(11, 3, KEY_SEARCH),
4269 KEY(11, 4, KEY_DELETE),
4270 KEY(11, 5, KEY_RIGHT),
4271 KEY(11, 6, KEY_LEFT),
4272 KEY(11, 7, KEY_RIGHTSHIFT),
4273 KEY(0, 0, KEY_VOLUMEUP),
4274 KEY(0, 1, KEY_VOLUMEDOWN),
4275 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4276 KEY(0, 3, KEY_CAMERA_FOCUS),
4277};
4278
4279static struct matrix_keymap_data keymap_data_sim = {
4280 .keymap_size = ARRAY_SIZE(keymap_sim),
4281 .keymap = keymap_sim,
4282};
4283
4284static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4285 .input_name = "keypad_8960",
4286 .input_phys_device = "keypad_8960/input0",
4287 .num_rows = 12,
4288 .num_cols = 8,
4289 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4290 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4291 .debounce_ms = 15,
4292 .scan_delay_ms = 32,
4293 .row_hold_ns = 91500,
4294 .wakeup = 1,
4295 .keymap_data = &keymap_data_sim,
4296};
4297
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004298static int pm8921_therm_mitigation[] = {
4299 1100,
4300 700,
4301 600,
4302 325,
4303};
4304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004305static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004306 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004307 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004308 .max_voltage = 4200,
4309 .min_voltage = 3200,
4310 .resume_voltage = 4100,
4311 .term_current = 100,
4312 .cool_temp = 10,
4313 .warm_temp = 40,
4314 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004315 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004316 .cool_bat_chg_current = 350,
4317 .warm_bat_chg_current = 350,
4318 .cool_bat_voltage = 4100,
4319 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004320 .thermal_mitigation = pm8921_therm_mitigation,
4321 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004322};
4323
4324static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4325 .priority = 0,
4326};
4327
4328static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4329 .r_sense = 10,
4330 .i_test = 2500,
4331 .v_failure = 3000,
4332 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004333};
4334
Jay Chokshide4cefb2011-08-04 18:10:44 -07004335#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004336#define PM8XXX_LED_PWM_PERIOD 1000
4337#define PM8XXX_LED_PWM_DUTY_MS 20
4338/**
4339 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4340 * driven using PWM feature.
4341 */
4342#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004343
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004344static struct led_info pm8921_led_info[] = {
4345 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004346 .name = "led:battery_charging",
4347 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004348 },
4349 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004350 .name = "led:battery_full",
4351 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004352 },
4353};
4354
Jay Chokshi8994e392011-09-14 18:20:39 -07004355static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356 .num_leds = ARRAY_SIZE(pm8921_led_info),
4357 .leds = pm8921_led_info,
4358};
4359
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004360static int pm8921_led0_pwm_duty_pcts[56] = {
4361 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4362 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4363 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4364 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4365 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4366 14, 10, 6, 4, 1
4367};
4368
4369static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4370 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4371 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4372 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4373 .start_idx = 0,
4374};
4375
Jay Chokshi8994e392011-09-14 18:20:39 -07004376static struct pm8xxx_led_config pm8921_led_configs[] = {
4377 [0] = {
4378 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004379 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004380 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004381 .pwm_channel = 5,
4382 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4383 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004384 },
4385 [1] = {
4386 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004387 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004388 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004389 .pwm_channel = 4,
4390 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004391 },
4392};
4393
4394static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4395 .led_core = &pm8921_led_core_pdata,
4396 .configs = pm8921_led_configs,
4397 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4398};
4399
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004400static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4401 .irq_pdata = &pm8xxx_irq_pdata,
4402 .gpio_pdata = &pm8xxx_gpio_pdata,
4403 .mpp_pdata = &pm8xxx_mpp_pdata,
4404 .rtc_pdata = &pm8xxx_rtc_pdata,
4405 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4406 .keypad_pdata = &keypad_data,
4407 .misc_pdata = &pm8xxx_misc_pdata,
4408 .regulator_pdatas = msm_pm8921_regulator_pdata,
4409 .charger_pdata = &pm8921_chg_pdata,
4410 .bms_pdata = &pm8921_bms_pdata,
4411 .adc_pdata = &pm8921_adc_pdata,
4412 .leds_pdata = &pm8xxx_leds_pdata,
4413};
4414
4415static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4416 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4417 .slave = {
4418 .name = "pm8921-core",
4419 .platform_data = &pm8921_platform_data,
4420 },
4421};
4422
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004423static struct msm_cpuidle_state msm_cstates[] __initdata = {
4424 {0, 0, "C0", "WFI",
4425 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4426
4427 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4428 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4429
4430 {0, 2, "C2", "POWER_COLLAPSE",
4431 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4432
4433 {1, 0, "C0", "WFI",
4434 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4435
4436 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4437 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4438};
4439
4440static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4441 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4442 .idle_supported = 1,
4443 .suspend_supported = 1,
4444 .idle_enabled = 0,
4445 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004446 },
4447
4448 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4449 .idle_supported = 1,
4450 .suspend_supported = 1,
4451 .idle_enabled = 0,
4452 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004453 },
4454
4455 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4456 .idle_supported = 1,
4457 .suspend_supported = 1,
4458 .idle_enabled = 1,
4459 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004460 },
4461
4462 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4463 .idle_supported = 0,
4464 .suspend_supported = 1,
4465 .idle_enabled = 0,
4466 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004467 },
4468
4469 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4470 .idle_supported = 1,
4471 .suspend_supported = 1,
4472 .idle_enabled = 0,
4473 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004474 },
4475
4476 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4477 .idle_supported = 1,
4478 .suspend_supported = 0,
4479 .idle_enabled = 1,
4480 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004481 },
4482};
4483
4484static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4485 {
4486 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4487 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4488 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004489 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004490 },
4491
4492 {
4493 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4494 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4495 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004496 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004497 },
4498
4499 {
4500 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4501 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4502 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004503 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004504 },
4505
4506 {
4507 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4508 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4509 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004510 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004511 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004512 {
4513 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4514 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4515 false,
4516 7000, 3500, 66600000, 5150,
4517 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004518
4519 {
4520 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4521 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4522 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004523 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004524 },
4525
4526 {
4527 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4528 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4529 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004530 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004531 },
4532
4533 {
4534 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4535 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4536 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004537 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004538 },
4539
4540 {
4541 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4542 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4543 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004544 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004545 },
4546};
4547
4548#ifdef CONFIG_I2C
4549#define I2C_SURF 1
4550#define I2C_FFA (1 << 1)
4551#define I2C_RUMI (1 << 2)
4552#define I2C_SIM (1 << 3)
4553#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004554#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004555
4556struct i2c_registry {
4557 u8 machs;
4558 int bus;
4559 struct i2c_board_info *info;
4560 int len;
4561};
4562
4563#ifdef CONFIG_MSM_CAMERA
4564static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4565#ifdef CONFIG_IMX074
4566 {
4567 I2C_BOARD_INFO("imx074", 0x1A),
4568 },
4569#endif
4570#ifdef CONFIG_OV2720
4571 {
4572 I2C_BOARD_INFO("ov2720", 0x6C),
4573 },
4574#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004575 {
4576 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4577 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304578#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4579 {
4580 I2C_BOARD_INFO("sc628a", 0x6E),
4581 },
4582#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004583};
4584#endif
4585
4586/* Sensors DSPS platform data */
4587#ifdef CONFIG_MSM_DSPS
4588#define DSPS_PIL_GENERIC_NAME "dsps"
4589#endif /* CONFIG_MSM_DSPS */
4590
4591static void __init msm8960_init_dsps(void)
4592{
4593#ifdef CONFIG_MSM_DSPS
4594 struct msm_dsps_platform_data *pdata =
4595 msm_dsps_device.dev.platform_data;
4596 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4597 pdata->gpios = NULL;
4598 pdata->gpios_num = 0;
4599
4600 platform_device_register(&msm_dsps_device);
4601#endif /* CONFIG_MSM_DSPS */
4602}
4603
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004604static void __init msm8960_init_hsic(void)
4605{
4606#ifdef CONFIG_USB_EHCI_MSM_HSIC
4607 uint32_t version = socinfo_get_version();
4608
4609 pr_info("%s: version:%d mtp:%d\n", __func__,
4610 SOCINFO_VERSION_MAJOR(version),
4611 machine_is_msm8960_mtp());
4612
4613 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4614 machine_is_msm8960_mtp() ||
4615 machine_is_msm8960_fluid())
4616 return;
4617
4618 msm_gpiomux_install(msm8960_hsic_configs,
4619 ARRAY_SIZE(msm8960_hsic_configs));
4620
4621 platform_device_register(&msm_device_hsic_host);
4622#endif
4623}
4624
4625
Amir Samuelov5137e392011-09-21 17:31:25 +03004626#ifdef CONFIG_ISL9519_CHARGER
4627static struct isl_platform_data isl_data __initdata = {
4628 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4629 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4630 .max_system_voltage = 4200,
4631 .min_system_voltage = 3200,
4632 .chgcurrent = 1000, /* 1900, */
4633 .term_current = 400, /* Need fine tuning */
4634 .input_current = 2048,
4635};
4636
4637static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4638 {
4639 I2C_BOARD_INFO("isl9519q", 0x9),
4640 .irq = 0, /* Not required when notify-by-pmic */
4641 .platform_data = &isl_data,
4642 },
4643};
4644#endif /* CONFIG_ISL9519_CHARGER */
4645
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004646static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4647#ifdef CONFIG_MSM_CAMERA
4648 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004649 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004650 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4651 msm_camera_boardinfo,
4652 ARRAY_SIZE(msm_camera_boardinfo),
4653 },
4654#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004655#ifdef CONFIG_ISL9519_CHARGER
4656 {
4657 I2C_LIQUID,
4658 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4659 isl_charger_i2c_info,
4660 ARRAY_SIZE(isl_charger_i2c_info),
4661 },
4662#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004663 {
4664 I2C_SURF | I2C_FFA | I2C_FLUID,
4665 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4666 cyttsp_info,
4667 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004668 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304669 {
4670 I2C_LIQUID,
4671 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4672 mxt_device_info,
4673 ARRAY_SIZE(mxt_device_info),
4674 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304675 {
4676 I2C_LIQUID,
4677 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4678 msm_isa1200_board_info,
4679 ARRAY_SIZE(msm_isa1200_board_info),
4680 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004681};
4682#endif /* CONFIG_I2C */
4683
4684static void __init register_i2c_devices(void)
4685{
4686#ifdef CONFIG_I2C
4687 u8 mach_mask = 0;
4688 int i;
4689
4690 /* Build the matching 'supported_machs' bitmask */
4691 if (machine_is_msm8960_cdp())
4692 mach_mask = I2C_SURF;
4693 else if (machine_is_msm8960_rumi3())
4694 mach_mask = I2C_RUMI;
4695 else if (machine_is_msm8960_sim())
4696 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004697 else if (machine_is_msm8960_fluid())
4698 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004699 else if (machine_is_msm8960_liquid())
4700 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004701 else if (machine_is_msm8960_mtp())
4702 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004703 else
4704 pr_err("unmatched machine ID in register_i2c_devices\n");
4705
4706 /* Run the array and install devices as appropriate */
4707 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4708 if (msm8960_i2c_devices[i].machs & mach_mask)
4709 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4710 msm8960_i2c_devices[i].info,
4711 msm8960_i2c_devices[i].len);
4712 }
4713#endif
4714}
4715
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004716static void __init msm8960_sim_init(void)
4717{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004718 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4719 &msm8960_device_watchdog.dev.platform_data;
4720
4721 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004722 BUG_ON(msm_rpm_init(&msm_rpm_data));
4723 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4724 ARRAY_SIZE(msm_rpmrs_levels)));
4725 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004726 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004727 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004728 msm8960_device_ssbi_pm8921.dev.platform_data =
4729 &msm8960_ssbi_pm8921_pdata;
4730 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004731
4732 /* Simulator supports a QWERTY keypad */
4733 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4734
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004735 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004736 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004737 msm8960_i2c_init();
4738 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4739 msm_spm_l2_init(msm_spm_l2_data);
4740 msm8960_init_buses();
4741 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4742 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004743 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004744 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004745
4746 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4747 &msm8960_qup_spi_gsbi1_pdata;
4748 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4749
4750 msm8960_init_mmc();
4751 msm_fb_add_devices();
4752 slim_register_board_info(msm_slim_devices,
4753 ARRAY_SIZE(msm_slim_devices));
4754 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4755 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4756 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4757 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004758 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004759}
4760
4761static void __init msm8960_rumi3_init(void)
4762{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004763 BUG_ON(msm_rpm_init(&msm_rpm_data));
4764 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4765 ARRAY_SIZE(msm_rpmrs_levels)));
4766 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004767 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004768 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004769 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004770 msm8960_device_ssbi_pm8921.dev.platform_data =
4771 &msm8960_ssbi_pm8921_pdata;
4772 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4773 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4774 &msm8960_qup_spi_gsbi1_pdata;
4775 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4776 msm8960_i2c_init();
4777 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4778 msm_spm_l2_init(msm_spm_l2_data);
4779 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4780 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004781 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004782 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004783 register_i2c_devices();
4784 msm_fb_add_devices();
4785 slim_register_board_info(msm_slim_devices,
4786 ARRAY_SIZE(msm_slim_devices));
4787 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4788 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4789 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4790 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004791 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004792}
4793
4794static void __init msm8960_cdp_init(void)
4795{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004796 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4797 pr_err("meminfo_init() failed!\n");
4798
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004799 BUG_ON(msm_rpm_init(&msm_rpm_data));
4800 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4801 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004802
4803 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004804 regulator_suppress_info_printing();
4805 if (msm_xo_init())
4806 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004807 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004808 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304809 if (machine_is_msm8960_liquid())
4810 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004811 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304812#ifdef CONFIG_USB_EHCI_MSM_HSIC
4813 if (machine_is_msm8960_liquid()) {
4814 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4815 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4816 }
4817#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304818 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004819 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304820 if (machine_is_msm8960_liquid())
4821 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004822 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4823 &msm8960_qup_spi_gsbi1_pdata;
4824 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4825 msm8960_device_ssbi_pm8921.dev.platform_data =
4826 &msm8960_ssbi_pm8921_pdata;
4827 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4828 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004829 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004830 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4831 msm_spm_l2_init(msm_spm_l2_data);
4832 msm8960_init_buses();
4833 platform_add_devices(msm_footswitch_devices,
4834 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004835 if (machine_is_msm8960_liquid())
4836 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004837 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4838 pm8921_gpio_mpp_init();
4839 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004840 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004841 msm8960_init_cam();
4842 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004843 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304844 if (machine_is_msm8960_liquid())
4845 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004846 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004847 msm_fb_add_devices();
4848 slim_register_board_info(msm_slim_devices,
4849 ARRAY_SIZE(msm_slim_devices));
4850 msm8960_init_dsps();
4851 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4852 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4853 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4854 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004855 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004856 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004857}
4858
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004859MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4860 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004861 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004862 .init_irq = msm8960_init_irq,
4863 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004864 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004865 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004866 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004867MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004868
4869MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4870 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004871 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004872 .init_irq = msm8960_init_irq,
4873 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004874 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004875 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004876 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004877MACHINE_END
4878
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004879MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4880 .map_io = msm8960_map_io,
4881 .reserve = msm8960_reserve,
4882 .init_irq = msm8960_init_irq,
4883 .timer = &msm_timer,
4884 .init_machine = msm8960_cdp_init,
4885 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004886 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004887MACHINE_END
4888
4889MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4890 .map_io = msm8960_map_io,
4891 .reserve = msm8960_reserve,
4892 .init_irq = msm8960_init_irq,
4893 .timer = &msm_timer,
4894 .init_machine = msm8960_cdp_init,
4895 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004896 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004897MACHINE_END
4898
4899MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4900 .map_io = msm8960_map_io,
4901 .reserve = msm8960_reserve,
4902 .init_irq = msm8960_init_irq,
4903 .timer = &msm_timer,
4904 .init_machine = msm8960_cdp_init,
4905 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004906 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004907MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004908
4909MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4910 .map_io = msm8960_map_io,
4911 .reserve = msm8960_reserve,
4912 .init_irq = msm8960_init_irq,
4913 .timer = &msm_timer,
4914 .init_machine = msm8960_cdp_init,
4915 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004916 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004917MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004918
4919#ifdef CONFIG_ARCH_MSM8930
4920MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4921 .map_io = msm8930_map_io,
4922 .reserve = msm8960_reserve,
4923 .init_irq = msm8960_init_irq,
4924 .timer = &msm_timer,
4925 .init_machine = msm8960_cdp_init,
4926 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004927 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004928MACHINE_END
4929
4930MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4931 .map_io = msm8930_map_io,
4932 .reserve = msm8960_reserve,
4933 .init_irq = msm8960_init_irq,
4934 .timer = &msm_timer,
4935 .init_machine = msm8960_cdp_init,
4936 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004937 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004938MACHINE_END
4939
4940MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4941 .map_io = msm8930_map_io,
4942 .reserve = msm8960_reserve,
4943 .init_irq = msm8960_init_irq,
4944 .timer = &msm_timer,
4945 .init_machine = msm8960_cdp_init,
4946 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004947 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004948MACHINE_END
4949#endif