blob: 75ea97d80bc5eeb8f65d902c60a082b2e5db705f [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>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070045#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <mach/msm_spi.h>
52#ifdef CONFIG_USB_MSM_OTG_72K
53#include <mach/msm_hsusb.h>
54#else
55#include <linux/usb/msm_hsusb.h>
56#endif
57#include <linux/usb/android.h>
58#include <mach/usbdiag.h>
59#include <mach/socinfo.h>
60#include <mach/rpm.h>
61#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070062#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#include <mach/msm_bus_board.h>
64#include <mach/msm_memtypes.h>
65#include <mach/dma.h>
66#include <mach/msm_dsps.h>
67#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070068#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
Laura Abbottd6183792011-08-19 13:42:24 -070076#include <linux/ion.h>
77#include <mach/ion.h>
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080080#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "spm.h"
83#include "board-msm8960.h"
84#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070088#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070089#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070090#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060091#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070092#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093
94static struct platform_device msm_fm_platform_init = {
95 .name = "iris_fm",
96 .id = -1,
97};
98
99struct pm8xxx_gpio_init {
100 unsigned gpio;
101 struct pm_gpio config;
102};
103
104struct pm8xxx_mpp_init {
105 unsigned mpp;
106 struct pm8xxx_mpp_config_data config;
107};
108
109#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
110 _func, _inv, _disable) \
111{ \
112 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
113 .config = { \
114 .direction = _dir, \
115 .output_buffer = _buf, \
116 .output_value = _val, \
117 .pull = _pull, \
118 .vin_sel = _vin, \
119 .out_strength = _out_strength, \
120 .function = _func, \
121 .inv_int_pol = _inv, \
122 .disable_pin = _disable, \
123 } \
124}
125
126#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
127{ \
128 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
129 .config = { \
130 .type = PM8XXX_MPP_TYPE_##_type, \
131 .level = _level, \
132 .control = PM8XXX_MPP_##_control, \
133 } \
134}
135
136#define PM8XXX_GPIO_DISABLE(_gpio) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
138 0, 0, 0, 1)
139
140#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
141 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
142 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
143 PM_GPIO_STRENGTH_HIGH, \
144 PM_GPIO_FUNC_NORMAL, 0, 0)
145
146#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
147 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
148 _pull, PM_GPIO_VIN_S4, \
149 PM_GPIO_STRENGTH_NO, \
150 PM_GPIO_FUNC_NORMAL, 0, 0)
151
152#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
153 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
154 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
155 PM_GPIO_STRENGTH_HIGH, \
156 _func, 0, 0)
157
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200158#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
159 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
160 PM_GPIO_PULL_NO, _vin, \
161 PM_GPIO_STRENGTH_HIGH, \
162 PM_GPIO_FUNC_NORMAL, 0, 0)
163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164/* Initial PM8921 GPIO configurations */
165static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
166 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
167 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
168 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300169 /* External regulator shared by display and touchscreen on LiQUID */
170 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200171 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700173 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700175 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700176};
177
178/* Initial PM8921 MPP configurations */
179static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
180 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
181 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700182 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
183 DOUT_CTRL_LOW),
184};
185
186static void __init pm8921_gpio_mpp_init(void)
187{
188 int i, rc;
189
190 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
191 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
192 &pm8921_gpios[i].config);
193 if (rc) {
194 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
195 break;
196 }
197 }
198
199 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
200 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
201 &pm8921_mpps[i].config);
202 if (rc) {
203 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
204 break;
205 }
206 }
207}
208
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700209#define KS8851_RST_GPIO 89
210#define KS8851_IRQ_GPIO 90
211
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700212#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
213enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700214 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700215 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
216 /* CAM Expander */
217 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
218 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
219 GPIO_CAM_GP_AFBUSY,
220 GPIO_CAM_GP_STROBE_CE,
221 GPIO_CAM_GP_CAM1MP_XCLR,
222 GPIO_CAM_GP_CAMIF_RESET_N,
223 GPIO_CAM_GP_XMT_FLASH_INT,
224 GPIO_CAM_GP_LED_EN1,
225 GPIO_CAM_GP_LED_EN2,
226
227};
228#endif
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230/* The SPI configurations apply to GSBI 1*/
231static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700232 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700233 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234 .pull = GPIOMUX_PULL_NONE,
235};
236
Harini Jayaraman608d0462011-08-09 19:10:03 -0600237static struct gpiomux_setting spi_suspended_config = {
238 .func = GPIOMUX_FUNC_GPIO,
239 .drv = GPIOMUX_DRV_2MA,
240 .pull = GPIOMUX_PULL_DOWN,
241};
242
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700243static struct gpiomux_setting spi_active_config2 = {
244 .func = GPIOMUX_FUNC_2,
245 .drv = GPIOMUX_DRV_8MA,
246 .pull = GPIOMUX_PULL_NONE,
247};
248
249static struct gpiomux_setting spi_suspended_config2 = {
250 .func = GPIOMUX_FUNC_GPIO,
251 .drv = GPIOMUX_DRV_2MA,
252 .pull = GPIOMUX_PULL_UP,
253};
254
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530255static struct gpiomux_setting gsbi3_suspended_cfg = {
256 .func = GPIOMUX_FUNC_1,
257 .drv = GPIOMUX_DRV_2MA,
258 .pull = GPIOMUX_PULL_KEEPER,
259};
260
261static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262 .func = GPIOMUX_FUNC_1,
263 .drv = GPIOMUX_DRV_8MA,
264 .pull = GPIOMUX_PULL_NONE,
265};
266
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267static struct gpiomux_setting gsbi5 = {
268 .func = GPIOMUX_FUNC_1,
269 .drv = GPIOMUX_DRV_8MA,
270 .pull = GPIOMUX_PULL_NONE,
271};
272
273static struct gpiomux_setting gsbi10 = {
274 .func = GPIOMUX_FUNC_2,
275 .drv = GPIOMUX_DRV_8MA,
276 .pull = GPIOMUX_PULL_NONE,
277};
278
279static struct gpiomux_setting gsbi12 = {
280 .func = GPIOMUX_FUNC_1,
281 .drv = GPIOMUX_DRV_8MA,
282 .pull = GPIOMUX_PULL_NONE,
283};
284
285static struct gpiomux_setting cdc_mclk = {
286 .func = GPIOMUX_FUNC_1,
287 .drv = GPIOMUX_DRV_8MA,
288 .pull = GPIOMUX_PULL_NONE,
289};
290
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700291static struct gpiomux_setting audio_auxpcm[] = {
292 /* Suspended state */
293 {
294 .func = GPIOMUX_FUNC_GPIO,
295 .drv = GPIOMUX_DRV_2MA,
296 .pull = GPIOMUX_PULL_NONE,
297 },
298 /* Active state */
299 {
300 .func = GPIOMUX_FUNC_1,
301 .drv = GPIOMUX_DRV_2MA,
302 .pull = GPIOMUX_PULL_NONE,
303 },
304};
305
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700306#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700307static struct gpiomux_setting gpio_eth_config = {
308 .pull = GPIOMUX_PULL_NONE,
309 .drv = GPIOMUX_DRV_8MA,
310 .func = GPIOMUX_FUNC_GPIO,
311};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700312#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313
314static struct gpiomux_setting slimbus = {
315 .func = GPIOMUX_FUNC_1,
316 .drv = GPIOMUX_DRV_8MA,
317 .pull = GPIOMUX_PULL_KEEPER,
318};
319
320struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700321#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 {
323 .gpio = KS8851_IRQ_GPIO,
324 .settings = {
325 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
326 }
327 },
328 {
329 .gpio = KS8851_RST_GPIO,
330 .settings = {
331 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
332 }
333 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700334#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335};
336
337static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
338 {
339 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
340 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600341 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
342 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343 },
344 },
345 {
346 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
347 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600348 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
349 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700350 },
351 },
352 {
353 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
354 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600355 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
356 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700357 },
358 },
359 {
360 .gpio = 9, /* GSBI1 QUP SPI_CLK */
361 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600362 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
363 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700364 },
365 },
366 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700367 .gpio = 14, /* GSBI1 SPI_CS_1 */
368 .settings = {
369 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
370 [GPIOMUX_ACTIVE] = &spi_active_config2,
371 },
372 },
373 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700374 .gpio = 16, /* GSBI3 I2C QUP SDA */
375 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530376 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
377 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700378 },
379 },
380 {
381 .gpio = 17, /* GSBI3 I2C QUP SCL */
382 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530383 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
384 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700385 },
386 },
387 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700388 .gpio = 22, /* GSBI5 UART2 */
389 .settings = {
390 [GPIOMUX_SUSPENDED] = &gsbi5,
391 },
392 },
393 {
394 .gpio = 23, /* GSBI5 UART2 */
395 .settings = {
396 [GPIOMUX_SUSPENDED] = &gsbi5,
397 },
398 },
399 {
400 .gpio = 24, /* GSBI5 UART2 */
401 .settings = {
402 [GPIOMUX_SUSPENDED] = &gsbi5,
403 },
404 },
405 {
406 .gpio = 25, /* GSBI5 UART2 */
407 .settings = {
408 [GPIOMUX_SUSPENDED] = &gsbi5,
409 },
410 },
411 {
412 .gpio = 44, /* GSBI12 I2C QUP SDA */
413 .settings = {
414 [GPIOMUX_SUSPENDED] = &gsbi12,
415 },
416 },
417 {
418 .gpio = 45, /* GSBI12 I2C QUP SCL */
419 .settings = {
420 [GPIOMUX_SUSPENDED] = &gsbi12,
421 },
422 },
423 {
424 .gpio = 73, /* GSBI10 I2C QUP SDA */
425 .settings = {
426 [GPIOMUX_SUSPENDED] = &gsbi10,
427 },
428 },
429 {
430 .gpio = 74, /* GSBI10 I2C QUP SCL */
431 .settings = {
432 [GPIOMUX_SUSPENDED] = &gsbi10,
433 },
434 },
435};
436
437static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
438 {
439 .gpio = 60, /* slimbus data */
440 .settings = {
441 [GPIOMUX_SUSPENDED] = &slimbus,
442 },
443 },
444 {
445 .gpio = 61, /* slimbus clk */
446 .settings = {
447 [GPIOMUX_SUSPENDED] = &slimbus,
448 },
449 },
450};
451
452static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
453 {
454 .gpio = 59,
455 .settings = {
456 [GPIOMUX_SUSPENDED] = &cdc_mclk,
457 },
458 },
459};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700460
461static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
462 {
463 .gpio = 63,
464 .settings = {
465 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
466 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
467 },
468 },
469 {
470 .gpio = 64,
471 .settings = {
472 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
473 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
474 },
475 },
476 {
477 .gpio = 65,
478 .settings = {
479 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
480 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
481 },
482 },
483 {
484 .gpio = 66,
485 .settings = {
486 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
487 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
488 },
489 },
490};
491
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700492static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
493 .func = GPIOMUX_FUNC_GPIO,
494 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700495 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700496};
497
498static struct gpiomux_setting wcnss_5wire_active_cfg = {
499 .func = GPIOMUX_FUNC_1,
500 .drv = GPIOMUX_DRV_6MA,
501 .pull = GPIOMUX_PULL_DOWN,
502};
503
504static struct msm_gpiomux_config wcnss_5wire_interface[] = {
505 {
506 .gpio = 84,
507 .settings = {
508 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
509 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
510 },
511 },
512 {
513 .gpio = 85,
514 .settings = {
515 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
516 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
517 },
518 },
519 {
520 .gpio = 86,
521 .settings = {
522 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
523 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
524 },
525 },
526 {
527 .gpio = 87,
528 .settings = {
529 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
530 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
531 },
532 },
533 {
534 .gpio = 88,
535 .settings = {
536 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
537 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
538 },
539 },
540};
Nishant Pandit24153d82011-08-27 16:05:13 +0530541static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530542 {
543 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
544 .drv = GPIOMUX_DRV_2MA,
545 .pull = GPIOMUX_PULL_DOWN,
546 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700547
Nishant Pandit474f2252011-07-23 23:17:56 +0530548 {
549 .func = GPIOMUX_FUNC_1, /*active 1*/
550 .drv = GPIOMUX_DRV_2MA,
551 .pull = GPIOMUX_PULL_NONE,
552 },
553
554 {
555 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
556 .drv = GPIOMUX_DRV_2MA,
557 .pull = GPIOMUX_PULL_NONE,
558 },
559
560 {
561 .func = GPIOMUX_FUNC_1, /*active 3*/
562 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700563 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530564 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530565
566 {
567 .func = GPIOMUX_FUNC_5, /*active 4*/
568 .drv = GPIOMUX_DRV_8MA,
569 .pull = GPIOMUX_PULL_UP,
570 },
571
572 {
573 .func = GPIOMUX_FUNC_6, /*active 5*/
574 .drv = GPIOMUX_DRV_8MA,
575 .pull = GPIOMUX_PULL_UP,
576 },
577
578 {
579 .func = GPIOMUX_FUNC_2, /*active 6*/
580 .drv = GPIOMUX_DRV_2MA,
581 .pull = GPIOMUX_PULL_UP,
582 },
583
584 {
585 .func = GPIOMUX_FUNC_3, /*active 7*/
586 .drv = GPIOMUX_DRV_8MA,
587 .pull = GPIOMUX_PULL_UP,
588 },
589
Kevin Chan4c58d292011-09-13 11:03:25 -0700590 {
591 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
592 .drv = GPIOMUX_DRV_2MA,
593 .pull = GPIOMUX_PULL_KEEPER,
594 },
595
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596};
597
Nishant Pandit24153d82011-08-27 16:05:13 +0530598static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700599 {
600 .gpio = 2,
601 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530602 [GPIOMUX_ACTIVE] = &cam_settings[2],
603 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700604 },
605 },
606 {
607 .gpio = 3,
608 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530609 [GPIOMUX_ACTIVE] = &cam_settings[1],
610 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700611 },
612 },
613 {
614 .gpio = 4,
615 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530616 [GPIOMUX_ACTIVE] = &cam_settings[1],
617 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700618 },
619 },
620 {
621 .gpio = 5,
622 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530623 [GPIOMUX_ACTIVE] = &cam_settings[1],
624 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700625 },
626 },
627 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530628 .gpio = 76,
629 .settings = {
630 [GPIOMUX_ACTIVE] = &cam_settings[2],
631 [GPIOMUX_SUSPENDED] = &cam_settings[0],
632 },
633 },
634 {
635 .gpio = 107,
636 .settings = {
637 [GPIOMUX_ACTIVE] = &cam_settings[2],
638 [GPIOMUX_SUSPENDED] = &cam_settings[0],
639 },
640 },
641};
642
643static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
644 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700645 .gpio = 18,
646 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530647 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700648 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700649 },
650 },
651 {
652 .gpio = 19,
653 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530654 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700655 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700656 },
657 },
658 {
659 .gpio = 20,
660 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530661 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700662 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700663 },
664 },
665 {
666 .gpio = 21,
667 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530668 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700669 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700670 },
671 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672};
673
674static struct gpiomux_setting cyts_resout_sus_cfg = {
675 .func = GPIOMUX_FUNC_GPIO,
676 .drv = GPIOMUX_DRV_6MA,
677 .pull = GPIOMUX_PULL_UP,
678};
679
680static struct gpiomux_setting cyts_resout_act_cfg = {
681 .func = GPIOMUX_FUNC_GPIO,
682 .drv = GPIOMUX_DRV_6MA,
683 .pull = GPIOMUX_PULL_UP,
684};
685
686static struct gpiomux_setting cyts_sleep_sus_cfg = {
687 .func = GPIOMUX_FUNC_GPIO,
688 .drv = GPIOMUX_DRV_6MA,
689 .pull = GPIOMUX_PULL_DOWN,
690};
691
692static struct gpiomux_setting cyts_sleep_act_cfg = {
693 .func = GPIOMUX_FUNC_GPIO,
694 .drv = GPIOMUX_DRV_6MA,
695 .pull = GPIOMUX_PULL_DOWN,
696};
697
698static struct gpiomux_setting cyts_int_act_cfg = {
699 .func = GPIOMUX_FUNC_GPIO,
700 .drv = GPIOMUX_DRV_8MA,
701 .pull = GPIOMUX_PULL_UP,
702};
703
704static struct gpiomux_setting cyts_int_sus_cfg = {
705 .func = GPIOMUX_FUNC_GPIO,
706 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530707 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700708};
709
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700710static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
711 { /* TS INTERRUPT */
712 .gpio = 11,
713 .settings = {
714 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
715 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
716 },
717 },
718 { /* TS SLEEP */
719 .gpio = 50,
720 .settings = {
721 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
722 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
723 },
724 },
725 { /* TS RESOUT */
726 .gpio = 52,
727 .settings = {
728 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
729 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
730 },
731 },
732};
733
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530734#ifdef CONFIG_USB_EHCI_MSM_HSIC
735static struct gpiomux_setting hsic_act_cfg = {
736 .func = GPIOMUX_FUNC_1,
737 .drv = GPIOMUX_DRV_12MA,
738 .pull = GPIOMUX_PULL_NONE,
739};
740
741static struct gpiomux_setting hsic_sus_cfg = {
742 .func = GPIOMUX_FUNC_GPIO,
743 .drv = GPIOMUX_DRV_2MA,
744 .pull = GPIOMUX_PULL_DOWN,
745};
746
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530747static struct gpiomux_setting hsic_hub_act_cfg = {
748 .func = GPIOMUX_FUNC_GPIO,
749 .drv = GPIOMUX_DRV_2MA,
750 .pull = GPIOMUX_PULL_NONE,
751};
752
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530753static struct msm_gpiomux_config msm8960_hsic_configs[] = {
754 {
755 .gpio = 150, /*HSIC_STROBE */
756 .settings = {
757 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
758 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
759 },
760 },
761 {
762 .gpio = 151, /* HSIC_DATA */
763 .settings = {
764 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
765 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
766 },
767 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530768 {
769 .gpio = 91, /* HSIC_HUB_RESET */
770 .settings = {
771 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
772 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
773 },
774 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530775};
776#endif
777
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700778#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
779enum {
780 SX150X_CAM,
781};
782
Nishant Pandit474f2252011-07-23 23:17:56 +0530783static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700784 [SX150X_CAM] = {
785 .gpio_base = GPIO_CAM_EXPANDER_BASE,
786 .oscio_is_gpo = false,
787 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530788 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700789 .io_open_drain_ena = 0x0,
790 .irq_summary = -1,
791 },
792};
Nishant Pandit474f2252011-07-23 23:17:56 +0530793
794#endif
795
796#ifdef CONFIG_I2C
797
798#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
799#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300800#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530801
802#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
803
804static struct i2c_board_info cam_expander_i2c_info[] = {
805 {
806 I2C_BOARD_INFO("sx1508q", 0x22),
807 .platform_data = &sx150x_data[SX150X_CAM]
808 },
809};
810
811static struct msm_cam_expander_info cam_expander_info[] = {
812 {
813 cam_expander_i2c_info,
814 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
815 },
816};
817#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700818#endif
819
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700820#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
821#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700822#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700823#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
824#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
825#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700826#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700827#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700828
829
830#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
831#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
832#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
833#define MSM_ION_HEAP_NUM 4
834#else
835#define MSM_ION_HEAP_NUM 2
836#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700837
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700838#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
839static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
840static int __init pmem_kernel_ebi1_size_setup(char *p)
841{
842 pmem_kernel_ebi1_size = memparse(p, NULL);
843 return 0;
844}
845early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
846#endif
847
848#ifdef CONFIG_ANDROID_PMEM
849static unsigned pmem_size = MSM_PMEM_SIZE;
850static int __init pmem_size_setup(char *p)
851{
852 pmem_size = memparse(p, NULL);
853 return 0;
854}
855early_param("pmem_size", pmem_size_setup);
856
857static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
858
859static int __init pmem_adsp_size_setup(char *p)
860{
861 pmem_adsp_size = memparse(p, NULL);
862 return 0;
863}
864early_param("pmem_adsp_size", pmem_adsp_size_setup);
865
866static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
867
868static int __init pmem_audio_size_setup(char *p)
869{
870 pmem_audio_size = memparse(p, NULL);
871 return 0;
872}
873early_param("pmem_audio_size", pmem_audio_size_setup);
874#endif
875
876#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700877#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878static struct android_pmem_platform_data android_pmem_pdata = {
879 .name = "pmem",
880 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
881 .cached = 1,
882 .memory_type = MEMTYPE_EBI1,
883};
884
885static struct platform_device android_pmem_device = {
886 .name = "android_pmem",
887 .id = 0,
888 .dev = {.platform_data = &android_pmem_pdata},
889};
890
891static struct android_pmem_platform_data android_pmem_adsp_pdata = {
892 .name = "pmem_adsp",
893 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
894 .cached = 0,
895 .memory_type = MEMTYPE_EBI1,
896};
897static struct platform_device android_pmem_adsp_device = {
898 .name = "android_pmem",
899 .id = 2,
900 .dev = { .platform_data = &android_pmem_adsp_pdata },
901};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700902#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903
904static struct android_pmem_platform_data android_pmem_audio_pdata = {
905 .name = "pmem_audio",
906 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
907 .cached = 0,
908 .memory_type = MEMTYPE_EBI1,
909};
910
911static struct platform_device android_pmem_audio_device = {
912 .name = "android_pmem",
913 .id = 4,
914 .dev = { .platform_data = &android_pmem_audio_pdata },
915};
916#endif
917
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700918#define DSP_RAM_BASE_8960 0x8da00000
919#define DSP_RAM_SIZE_8960 0x1800000
920static int dspcrashd_pdata_8960 = 0xDEADDEAD;
921
922static struct resource resources_dspcrashd_8960[] = {
923 {
924 .name = "msm_dspcrashd",
925 .start = DSP_RAM_BASE_8960,
926 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
927 .flags = IORESOURCE_DMA,
928 },
929};
930
931struct platform_device msm_device_dspcrashd_8960 = {
932 .name = "msm_dspcrashd",
933 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
934 .resource = resources_dspcrashd_8960,
935 .dev = { .platform_data = &dspcrashd_pdata_8960 },
936};
937
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700938static struct memtype_reserve msm8960_reserve_table[] __initdata = {
939 [MEMTYPE_SMI] = {
940 },
941 [MEMTYPE_EBI0] = {
942 .flags = MEMTYPE_FLAGS_1M_ALIGN,
943 },
944 [MEMTYPE_EBI1] = {
945 .flags = MEMTYPE_FLAGS_1M_ALIGN,
946 },
947};
948
949static void __init size_pmem_devices(void)
950{
951#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700952#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700953 android_pmem_adsp_pdata.size = pmem_adsp_size;
954 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700955#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700956 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
957#endif
958}
959
960static void __init reserve_memory_for(struct android_pmem_platform_data *p)
961{
962 msm8960_reserve_table[p->memory_type].size += p->size;
963}
964
965static void __init reserve_pmem_memory(void)
966{
967#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700968#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700969 reserve_memory_for(&android_pmem_adsp_pdata);
970 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700971#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700972 reserve_memory_for(&android_pmem_audio_pdata);
973 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
974#endif
975}
976
Larry Basselb4126da2011-07-18 14:31:33 -0700977static int msm8960_paddr_to_memtype(unsigned int paddr)
978{
979 return MEMTYPE_EBI1;
980}
981
Laura Abbottd6183792011-08-19 13:42:24 -0700982#ifdef CONFIG_ION_MSM
983struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700984 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700985 .heaps = {
986 {
987 .id = ION_HEAP_SYSTEM_ID,
988 .type = ION_HEAP_TYPE_SYSTEM,
989 .name = ION_KMALLOC_HEAP_NAME,
990 },
991 {
992 .id = ION_HEAP_SYSTEM_CONTIG_ID,
993 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
994 .name = ION_VMALLOC_HEAP_NAME,
995 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700996#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700997 {
998 .id = ION_HEAP_EBI_ID,
999 .type = ION_HEAP_TYPE_CARVEOUT,
1000 .name = ION_EBI1_HEAP_NAME,
1001 .size = MSM_ION_EBI_SIZE,
1002 .memory_type = ION_EBI_TYPE,
1003 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001004 {
1005 .id = ION_HEAP_ADSP_ID,
1006 .type = ION_HEAP_TYPE_CARVEOUT,
1007 .name = ION_ADSP_HEAP_NAME,
1008 .size = MSM_ION_ADSP_SIZE,
1009 .memory_type = ION_EBI_TYPE,
1010 },
1011#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001012 }
1013};
1014
1015struct platform_device ion_dev = {
1016 .name = "ion-msm",
1017 .id = 1,
1018 .dev = { .platform_data = &ion_pdata },
1019};
1020#endif
1021
1022static void reserve_ion_memory(void)
1023{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001024#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001025 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001026 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001027#endif
1028}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001029static void __init msm8960_calculate_reserve_sizes(void)
1030{
1031 size_pmem_devices();
1032 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001033 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001034}
1035
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001036static struct reserve_info msm8960_reserve_info __initdata = {
1037 .memtype_reserve_table = msm8960_reserve_table,
1038 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1039 .paddr_to_memtype = msm8960_paddr_to_memtype,
1040};
1041
Larry Basselb4126da2011-07-18 14:31:33 -07001042static int msm8960_memory_bank_size(void)
1043{
1044 return 1<<29;
1045}
1046
1047static void __init locate_unstable_memory(void)
1048{
1049 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1050 unsigned long bank_size;
1051 unsigned long low, high;
1052
1053 bank_size = msm8960_memory_bank_size();
1054 low = meminfo.bank[0].start;
1055 high = mb->start + mb->size;
1056 low &= ~(bank_size - 1);
1057
1058 if (high - low <= bank_size)
1059 return;
1060 msm8960_reserve_info.low_unstable_address = low + bank_size;
1061 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1062 msm8960_reserve_info.bank_size = bank_size;
1063 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1064 msm8960_reserve_info.low_unstable_address,
1065 msm8960_reserve_info.max_unstable_size,
1066 msm8960_reserve_info.bank_size);
1067}
1068
Larry Basselb830e182011-10-14 10:46:55 -07001069static void __init place_movable_zone(void)
1070{
1071 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1072 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1073 pr_info("movable zone start %lx size %lx\n",
1074 movable_reserved_start, movable_reserved_size);
1075}
1076
1077static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078{
1079 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001080 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001081 place_movable_zone();
1082}
1083
1084static void __init msm8960_reserve(void)
1085{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001086 msm_reserve();
1087}
1088
Larry Bassela4414b12011-08-04 11:11:02 -07001089static int msm8960_change_memory_power(u64 start, u64 size,
1090 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001091{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001092 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001093}
1094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001095#ifdef CONFIG_MSM_CAMERA
1096
Nishant Pandit24153d82011-08-27 16:05:13 +05301097static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001098 5, /*CAMIF_MCLK*/
1099 20, /*CAMIF_I2C_DATA*/
1100 21, /*CAMIF_I2C_CLK*/
1101};
1102
Nishant Pandit24153d82011-08-27 16:05:13 +05301103static struct msm_camera_gpio_conf gpio_conf = {
1104 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1105 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1106 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1107 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1108};
1109
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001110#define VFE_CAMIF_TIMER1_GPIO 2
1111#define VFE_CAMIF_TIMER2_GPIO 3
1112#define VFE_CAMIF_TIMER3_GPIO_INT 4
1113struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1114 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1115 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1116 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1117 .flash_recharge_duration = 50000,
1118 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1119};
1120
Nishant Pandit474f2252011-07-23 23:17:56 +05301121#ifdef CONFIG_MSM_CAMERA_FLASH
1122static struct msm_camera_sensor_flash_src msm_flash_src = {
1123 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1124 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1125 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1126#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1127 defined(CONFIG_GPIO_SX150X_MODULE))
1128 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1129#endif
1130};
1131#endif
1132
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001133static struct msm_bus_vectors cam_init_vectors[] = {
1134 {
1135 .src = MSM_BUS_MASTER_VFE,
1136 .dst = MSM_BUS_SLAVE_EBI_CH0,
1137 .ab = 0,
1138 .ib = 0,
1139 },
1140 {
1141 .src = MSM_BUS_MASTER_VPE,
1142 .dst = MSM_BUS_SLAVE_EBI_CH0,
1143 .ab = 0,
1144 .ib = 0,
1145 },
1146 {
1147 .src = MSM_BUS_MASTER_JPEG_ENC,
1148 .dst = MSM_BUS_SLAVE_EBI_CH0,
1149 .ab = 0,
1150 .ib = 0,
1151 },
1152};
1153
1154static struct msm_bus_vectors cam_preview_vectors[] = {
1155 {
1156 .src = MSM_BUS_MASTER_VFE,
1157 .dst = MSM_BUS_SLAVE_EBI_CH0,
1158 .ab = 27648000,
1159 .ib = 110592000,
1160 },
1161 {
1162 .src = MSM_BUS_MASTER_VPE,
1163 .dst = MSM_BUS_SLAVE_EBI_CH0,
1164 .ab = 0,
1165 .ib = 0,
1166 },
1167 {
1168 .src = MSM_BUS_MASTER_JPEG_ENC,
1169 .dst = MSM_BUS_SLAVE_EBI_CH0,
1170 .ab = 0,
1171 .ib = 0,
1172 },
1173};
1174
1175static struct msm_bus_vectors cam_video_vectors[] = {
1176 {
1177 .src = MSM_BUS_MASTER_VFE,
1178 .dst = MSM_BUS_SLAVE_EBI_CH0,
1179 .ab = 140451840,
1180 .ib = 561807360,
1181 },
1182 {
1183 .src = MSM_BUS_MASTER_VPE,
1184 .dst = MSM_BUS_SLAVE_EBI_CH0,
1185 .ab = 206807040,
1186 .ib = 488816640,
1187 },
1188 {
1189 .src = MSM_BUS_MASTER_JPEG_ENC,
1190 .dst = MSM_BUS_SLAVE_EBI_CH0,
1191 .ab = 0,
1192 .ib = 0,
1193 },
1194};
1195
1196static struct msm_bus_vectors cam_snapshot_vectors[] = {
1197 {
1198 .src = MSM_BUS_MASTER_VFE,
1199 .dst = MSM_BUS_SLAVE_EBI_CH0,
1200 .ab = 274423680,
1201 .ib = 1097694720,
1202 },
1203 {
1204 .src = MSM_BUS_MASTER_VPE,
1205 .dst = MSM_BUS_SLAVE_EBI_CH0,
1206 .ab = 0,
1207 .ib = 0,
1208 },
1209 {
1210 .src = MSM_BUS_MASTER_JPEG_ENC,
1211 .dst = MSM_BUS_SLAVE_EBI_CH0,
1212 .ab = 540000000,
1213 .ib = 1350000000,
1214 },
1215};
1216
1217static struct msm_bus_vectors cam_zsl_vectors[] = {
1218 {
1219 .src = MSM_BUS_MASTER_VFE,
1220 .dst = MSM_BUS_SLAVE_EBI_CH0,
1221 .ab = 302071680,
1222 .ib = 1208286720,
1223 },
1224 {
1225 .src = MSM_BUS_MASTER_VPE,
1226 .dst = MSM_BUS_SLAVE_EBI_CH0,
1227 .ab = 0,
1228 .ib = 0,
1229 },
1230 {
1231 .src = MSM_BUS_MASTER_JPEG_ENC,
1232 .dst = MSM_BUS_SLAVE_EBI_CH0,
1233 .ab = 540000000,
1234 .ib = 1350000000,
1235 },
1236};
1237
1238static struct msm_bus_paths cam_bus_client_config[] = {
1239 {
1240 ARRAY_SIZE(cam_init_vectors),
1241 cam_init_vectors,
1242 },
1243 {
1244 ARRAY_SIZE(cam_preview_vectors),
1245 cam_preview_vectors,
1246 },
1247 {
1248 ARRAY_SIZE(cam_video_vectors),
1249 cam_video_vectors,
1250 },
1251 {
1252 ARRAY_SIZE(cam_snapshot_vectors),
1253 cam_snapshot_vectors,
1254 },
1255 {
1256 ARRAY_SIZE(cam_zsl_vectors),
1257 cam_zsl_vectors,
1258 },
1259};
1260
1261static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1262 cam_bus_client_config,
1263 ARRAY_SIZE(cam_bus_client_config),
1264 .name = "msm_camera",
1265};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001266
Nishant Pandit24153d82011-08-27 16:05:13 +05301267struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1268 {
1269 .ioclk.mclk_clk_rate = 24000000,
1270 .ioclk.vfe_clk_rate = 228570000,
1271 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001272 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301273 },
1274 {
1275 .ioclk.mclk_clk_rate = 24000000,
1276 .ioclk.vfe_clk_rate = 228570000,
1277 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001278 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301279 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001280};
1281
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001282#ifdef CONFIG_IMX074_ACT
1283static struct i2c_board_info imx074_actuator_i2c_info = {
1284 I2C_BOARD_INFO("imx074_act", 0x11),
1285};
1286
1287static struct msm_actuator_info imx074_actuator_info = {
1288 .board_info = &imx074_actuator_i2c_info,
1289 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1290 .vcm_pwd = 0,
1291 .vcm_enable = 1,
1292};
1293#endif
1294
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001295#ifdef CONFIG_IMX074
1296static struct msm_camera_sensor_flash_data flash_imx074 = {
1297 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301298#ifdef CONFIG_MSM_CAMERA_FLASH
1299 .flash_src = &msm_flash_src
1300#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001301};
1302
Nishant Pandit24153d82011-08-27 16:05:13 +05301303static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1304 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305 .sensor_reset = 107,
1306 .sensor_pwd = 85,
1307 .vcm_pwd = 0,
1308 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301309};
1310
1311static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1312 .sensor_name = "imx074",
1313 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314 .flash_data = &flash_imx074,
1315 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301316 .sensor_platform_info = &sensor_board_info_imx074,
1317 .gpio_conf = &gpio_conf,
1318 .csi_if = 1,
1319 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001320#ifdef CONFIG_IMX074_ACT
1321 .actuator_info = &imx074_actuator_info
1322#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323};
1324
1325struct platform_device msm8960_camera_sensor_imx074 = {
1326 .name = "msm_camera_imx074",
1327 .dev = {
1328 .platform_data = &msm_camera_sensor_imx074_data,
1329 },
1330};
1331#endif
1332#ifdef CONFIG_OV2720
1333static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001334 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001335};
1336
Nishant Pandit24153d82011-08-27 16:05:13 +05301337static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1338 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001339 .sensor_reset = 76,
1340 .sensor_pwd = 85,
1341 .vcm_pwd = 0,
1342 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301343};
1344
1345static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1346 .sensor_name = "ov2720",
1347 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001348 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301349 .sensor_platform_info = &sensor_board_info_ov2720,
1350 .gpio_conf = &gpio_conf,
1351 .csi_if = 1,
1352 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001353};
1354
1355struct platform_device msm8960_camera_sensor_ov2720 = {
1356 .name = "msm_camera_ov2720",
1357 .dev = {
1358 .platform_data = &msm_camera_sensor_ov2720_data,
1359 },
1360};
1361#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001362
1363static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1364 .flash_type = MSM_CAMERA_FLASH_LED,
1365};
1366
Nishant Pandit24153d82011-08-27 16:05:13 +05301367static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1368 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001369 .sensor_reset = 107,
1370 .sensor_pwd = 85,
1371 .vcm_pwd = 0,
1372 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301373};
1374
1375static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1376 .sensor_name = "qs_mt9p017",
1377 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001378 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301379 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1380 .gpio_conf = &gpio_conf,
1381 .csi_if = 1,
1382 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001383};
1384
1385struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1386 .name = "msm_camera_qs_mt9p017",
1387 .dev = {
1388 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1389 },
1390};
1391
Kevin Chan8b0d2322011-09-10 21:06:31 -07001392static struct msm8960_privacy_light_cfg privacy_light_info = {
1393 .mpp = PM8921_MPP_PM_TO_SYS(12),
1394};
1395
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001396static void __init msm8960_init_cam(void)
1397{
1398 int i;
1399 struct platform_device *cam_dev[] = {
1400 &msm8960_camera_sensor_imx074,
1401 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001402 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001403 };
1404
Kevin Chan8b0d2322011-09-10 21:06:31 -07001405 if (machine_is_msm8960_liquid()) {
1406 struct msm_camera_sensor_info *s_info;
1407 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1408 s_info->sensor_platform_info->mount_angle = 180;
1409 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1410 s_info->sensor_platform_info->privacy_light = 1;
1411 s_info->sensor_platform_info->privacy_light_info =
1412 &privacy_light_info;
1413 }
1414
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001415 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1416 struct msm_camera_sensor_info *s_info;
1417 s_info = cam_dev[i]->dev.platform_data;
1418 msm_get_cam_resources(s_info);
1419 platform_device_register(cam_dev[i]);
1420 }
1421}
1422#endif
1423
1424#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001425#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001427#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001428#endif
1429
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001430
1431#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001432#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001434#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1435#else
1436#define MSM_FB_EXT_BUF_SIZE 0
1437#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001438
kuogee hsieh3830eb92011-09-12 15:25:57 -07001439#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1440/* width x height x 3 bpp x 2 frame buffer */
1441#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1442#define MSM_FB_WRITEBACK_OFFSET \
1443 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1444#else
1445#define MSM_FB_WRITEBACK_SIZE 0
1446#define MSM_FB_WRITEBACK_OFFSET 0
1447#endif
1448
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001449#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1450/* 4 bpp x 2 page HDMI case */
1451#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1452#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001453/* Note: must be multiple of 4096 */
1454#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1455 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001456#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001457
1458static int writeback_offset(void)
1459{
1460 return MSM_FB_WRITEBACK_OFFSET;
1461}
1462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001463
1464#define MDP_VSYNC_GPIO 0
1465
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001466#define PANEL_NAME_MAX_LEN 30
1467#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1468#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1469#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1470#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1471#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1472#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1473#define HDMI_PANEL_NAME "hdmi_msm"
1474#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001475
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001476static struct resource msm_fb_resources[] = {
1477 {
1478 .flags = IORESOURCE_DMA,
1479 }
1480};
1481
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001482static int msm_fb_detect_panel(const char *name)
1483{
1484 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001485 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1486 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1487 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001488 return 0;
1489 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001490 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1491 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1492 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001493 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001494
1495#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1496 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1497 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1498 PANEL_NAME_MAX_LEN)))
1499 return 0;
1500
1501 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1502 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1503 PANEL_NAME_MAX_LEN)))
1504 return 0;
1505
1506 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1507 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1508 PANEL_NAME_MAX_LEN)))
1509 return 0;
1510
1511 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1512 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1513 PANEL_NAME_MAX_LEN)))
1514 return 0;
1515#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001516 }
1517
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001518 if (!strncmp(name, HDMI_PANEL_NAME,
1519 strnlen(HDMI_PANEL_NAME,
1520 PANEL_NAME_MAX_LEN)))
1521 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001522
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001523 if (!strncmp(name, TVOUT_PANEL_NAME,
1524 strnlen(TVOUT_PANEL_NAME,
1525 PANEL_NAME_MAX_LEN)))
1526 return 0;
1527
1528 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001529 return -ENODEV;
1530}
1531
1532static struct msm_fb_platform_data msm_fb_pdata = {
1533 .detect_client = msm_fb_detect_panel,
1534};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001535
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001536static struct platform_device msm_fb_device = {
1537 .name = "msm_fb",
1538 .id = 0,
1539 .num_resources = ARRAY_SIZE(msm_fb_resources),
1540 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001541 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542};
1543
1544static bool dsi_power_on;
1545
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001546/**
1547 * LiQUID panel on/off
1548 *
1549 * @param on
1550 *
1551 * @return int
1552 */
1553static int mipi_dsi_liquid_panel_power(int on)
1554{
1555 static struct regulator *reg_l2, *reg_ext_3p3v;
1556 static int gpio21, gpio24, gpio43;
1557 int rc;
1558
1559 pr_info("%s: on=%d\n", __func__, on);
1560
1561 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1562 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1563 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1564
1565 if (!dsi_power_on) {
1566
1567 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1568 "dsi_vdda");
1569 if (IS_ERR(reg_l2)) {
1570 pr_err("could not get 8921_l2, rc = %ld\n",
1571 PTR_ERR(reg_l2));
1572 return -ENODEV;
1573 }
1574
1575 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1576 if (rc) {
1577 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1578 return -EINVAL;
1579 }
1580
1581 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1582 "vdd_lvds_3p3v");
1583 if (IS_ERR(reg_ext_3p3v)) {
1584 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1585 PTR_ERR(reg_ext_3p3v));
1586 return -ENODEV;
1587 }
1588
1589 rc = gpio_request(gpio21, "disp_pwr_en_n");
1590 if (rc) {
1591 pr_err("request gpio 21 failed, rc=%d\n", rc);
1592 return -ENODEV;
1593 }
1594
1595 rc = gpio_request(gpio43, "disp_rst_n");
1596 if (rc) {
1597 pr_err("request gpio 43 failed, rc=%d\n", rc);
1598 return -ENODEV;
1599 }
1600
1601 rc = gpio_request(gpio24, "disp_backlight_pwm");
1602 if (rc) {
1603 pr_err("request gpio 24 failed, rc=%d\n", rc);
1604 return -ENODEV;
1605 }
1606
1607 dsi_power_on = true;
1608 }
1609
1610 if (on) {
1611 rc = regulator_set_optimum_mode(reg_l2, 100000);
1612 if (rc < 0) {
1613 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1614 return -EINVAL;
1615 }
1616 rc = regulator_enable(reg_l2);
1617 if (rc) {
1618 pr_err("enable l2 failed, rc=%d\n", rc);
1619 return -ENODEV;
1620 }
1621
1622 rc = regulator_enable(reg_ext_3p3v);
1623 if (rc) {
1624 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1625 return -ENODEV;
1626 }
1627
1628 /* set reset pin before power enable */
1629 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1630
1631 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1632 msleep(20);
1633 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1634 msleep(20);
1635 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1636 msleep(20);
1637 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1638 msleep(20);
1639 } else {
1640 gpio_set_value_cansleep(gpio43, 0);
1641 gpio_set_value_cansleep(gpio21, 1);
1642
1643 rc = regulator_disable(reg_l2);
1644 if (rc) {
1645 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1646 return -ENODEV;
1647 }
1648 rc = regulator_disable(reg_ext_3p3v);
1649 if (rc) {
1650 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1651 return -ENODEV;
1652 }
1653 rc = regulator_set_optimum_mode(reg_l2, 100);
1654 if (rc < 0) {
1655 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1656 return -EINVAL;
1657 }
1658 }
1659
1660 return 0;
1661}
1662
1663static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001664{
1665 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001666 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001667 int rc;
1668
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001669 pr_info("%s: state : %d\n", __func__, on);
1670
1671 if (!dsi_power_on) {
1672
1673 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1674 "dsi_vdc");
1675 if (IS_ERR(reg_l8)) {
1676 pr_err("could not get 8921_l8, rc = %ld\n",
1677 PTR_ERR(reg_l8));
1678 return -ENODEV;
1679 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001680 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1681 "dsi_vddio");
1682 if (IS_ERR(reg_l23)) {
1683 pr_err("could not get 8921_l23, rc = %ld\n",
1684 PTR_ERR(reg_l23));
1685 return -ENODEV;
1686 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1688 "dsi_vdda");
1689 if (IS_ERR(reg_l2)) {
1690 pr_err("could not get 8921_l2, rc = %ld\n",
1691 PTR_ERR(reg_l2));
1692 return -ENODEV;
1693 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001694 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1695 if (rc) {
1696 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1697 return -EINVAL;
1698 }
1699 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1700 if (rc) {
1701 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1702 return -EINVAL;
1703 }
1704 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1705 if (rc) {
1706 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1707 return -EINVAL;
1708 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1710 rc = gpio_request(gpio43, "disp_rst_n");
1711 if (rc) {
1712 pr_err("request gpio 43 failed, rc=%d\n", rc);
1713 return -ENODEV;
1714 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 dsi_power_on = true;
1716 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001717 if (on) {
1718 rc = regulator_set_optimum_mode(reg_l8, 100000);
1719 if (rc < 0) {
1720 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1721 return -EINVAL;
1722 }
1723 rc = regulator_set_optimum_mode(reg_l23, 100000);
1724 if (rc < 0) {
1725 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1726 return -EINVAL;
1727 }
1728 rc = regulator_set_optimum_mode(reg_l2, 100000);
1729 if (rc < 0) {
1730 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1731 return -EINVAL;
1732 }
1733 rc = regulator_enable(reg_l8);
1734 if (rc) {
1735 pr_err("enable l8 failed, rc=%d\n", rc);
1736 return -ENODEV;
1737 }
1738 rc = regulator_enable(reg_l23);
1739 if (rc) {
1740 pr_err("enable l8 failed, rc=%d\n", rc);
1741 return -ENODEV;
1742 }
1743 rc = regulator_enable(reg_l2);
1744 if (rc) {
1745 pr_err("enable l2 failed, rc=%d\n", rc);
1746 return -ENODEV;
1747 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001748 gpio_set_value_cansleep(gpio43, 1);
1749 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001750 rc = regulator_disable(reg_l2);
1751 if (rc) {
1752 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1753 return -ENODEV;
1754 }
1755 rc = regulator_disable(reg_l8);
1756 if (rc) {
1757 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1758 return -ENODEV;
1759 }
1760 rc = regulator_disable(reg_l23);
1761 if (rc) {
1762 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1763 return -ENODEV;
1764 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765 rc = regulator_set_optimum_mode(reg_l8, 100);
1766 if (rc < 0) {
1767 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1768 return -EINVAL;
1769 }
1770 rc = regulator_set_optimum_mode(reg_l23, 100);
1771 if (rc < 0) {
1772 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1773 return -EINVAL;
1774 }
1775 rc = regulator_set_optimum_mode(reg_l2, 100);
1776 if (rc < 0) {
1777 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1778 return -EINVAL;
1779 }
1780 gpio_set_value_cansleep(gpio43, 0);
1781 }
1782 return 0;
1783}
1784
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001785static int mipi_dsi_panel_power(int on)
1786{
1787 int ret;
1788
1789 pr_info("%s: on=%d\n", __func__, on);
1790
1791 if (machine_is_msm8960_liquid())
1792 ret = mipi_dsi_liquid_panel_power(on);
1793 else
1794 ret = mipi_dsi_cdp_panel_power(on);
1795
1796 return ret;
1797}
1798
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1800 .vsync_gpio = MDP_VSYNC_GPIO,
1801 .dsi_power_save = mipi_dsi_panel_power,
1802};
1803
1804#ifdef CONFIG_MSM_BUS_SCALING
1805
1806static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001807 {
1808 .src = MSM_BUS_MASTER_MDP_PORT0,
1809 .dst = MSM_BUS_SLAVE_EBI_CH0,
1810 .ab = 0,
1811 .ib = 0,
1812 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001813};
1814
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001815#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1816static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1817 /* If HDMI is used as primary */
1818 {
1819 .src = MSM_BUS_MASTER_MDP_PORT0,
1820 .dst = MSM_BUS_SLAVE_EBI_CH0,
1821 .ab = 2000000000,
1822 .ib = 2000000000,
1823 },
1824};
1825static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1826 {
1827 ARRAY_SIZE(mdp_init_vectors),
1828 mdp_init_vectors,
1829 },
1830 {
1831 ARRAY_SIZE(hdmi_as_primary_vectors),
1832 hdmi_as_primary_vectors,
1833 },
1834 {
1835 ARRAY_SIZE(hdmi_as_primary_vectors),
1836 hdmi_as_primary_vectors,
1837 },
1838 {
1839 ARRAY_SIZE(hdmi_as_primary_vectors),
1840 hdmi_as_primary_vectors,
1841 },
1842 {
1843 ARRAY_SIZE(hdmi_as_primary_vectors),
1844 hdmi_as_primary_vectors,
1845 },
1846 {
1847 ARRAY_SIZE(hdmi_as_primary_vectors),
1848 hdmi_as_primary_vectors,
1849 },
1850};
1851#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001852static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001853 {
1854 .src = MSM_BUS_MASTER_MDP_PORT0,
1855 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001856 .ab = 216000000 * 2,
1857 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858 },
1859};
1860
1861static struct msm_bus_vectors mdp_vga_vectors[] = {
1862 /* VGA and less video */
1863 {
1864 .src = MSM_BUS_MASTER_MDP_PORT0,
1865 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001866 .ab = 216000000 * 2,
1867 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001868 },
1869};
1870
1871static struct msm_bus_vectors mdp_720p_vectors[] = {
1872 /* 720p and less video */
1873 {
1874 .src = MSM_BUS_MASTER_MDP_PORT0,
1875 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001876 .ab = 230400000 * 2,
1877 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001878 },
1879};
1880
1881static struct msm_bus_vectors mdp_1080p_vectors[] = {
1882 /* 1080p and less video */
1883 {
1884 .src = MSM_BUS_MASTER_MDP_PORT0,
1885 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001886 .ab = 334080000 * 2,
1887 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888 },
1889};
1890
1891static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1892 {
1893 ARRAY_SIZE(mdp_init_vectors),
1894 mdp_init_vectors,
1895 },
1896 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001897 ARRAY_SIZE(mdp_ui_vectors),
1898 mdp_ui_vectors,
1899 },
1900 {
1901 ARRAY_SIZE(mdp_ui_vectors),
1902 mdp_ui_vectors,
1903 },
1904 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001905 ARRAY_SIZE(mdp_vga_vectors),
1906 mdp_vga_vectors,
1907 },
1908 {
1909 ARRAY_SIZE(mdp_720p_vectors),
1910 mdp_720p_vectors,
1911 },
1912 {
1913 ARRAY_SIZE(mdp_1080p_vectors),
1914 mdp_1080p_vectors,
1915 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001917#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001918
1919static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1920 mdp_bus_scale_usecases,
1921 ARRAY_SIZE(mdp_bus_scale_usecases),
1922 .name = "mdp",
1923};
1924
1925#endif
1926
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001927#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1928int mdp_core_clk_rate_table[] = {
1929 200000000,
1930 200000000,
1931 200000000,
1932 200000000,
1933};
1934#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935int mdp_core_clk_rate_table[] = {
1936 85330000,
1937 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001938 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939 200000000,
1940};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001941#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001942
1943static struct msm_panel_common_pdata mdp_pdata = {
1944 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001945#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1946 .mdp_core_clk_rate = 200000000,
1947#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001948 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001949#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950 .mdp_core_clk_table = mdp_core_clk_rate_table,
1951 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1952#ifdef CONFIG_MSM_BUS_SCALING
1953 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1954#endif
1955 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001956 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001957};
1958
1959static struct platform_device mipi_dsi_renesas_panel_device = {
1960 .name = "mipi_renesas",
1961 .id = 0,
1962};
1963
1964static struct platform_device mipi_dsi_simulator_panel_device = {
1965 .name = "mipi_simulator",
1966 .id = 0,
1967};
1968
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001969#define LPM_CHANNEL0 0
1970static int toshiba_gpio[] = {LPM_CHANNEL0};
1971
1972static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1973 .gpio = toshiba_gpio,
1974};
1975
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001976static struct platform_device mipi_dsi_toshiba_panel_device = {
1977 .name = "mipi_toshiba",
1978 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001979 .dev = {
1980 .platform_data = &toshiba_pdata,
1981 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982};
1983
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001984#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001985static int dsi2lvds_gpio[2] = {
1986 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1987 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1988 };
1989
1990static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1991 .gpio_num = dsi2lvds_gpio,
1992};
1993
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001994static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1995
1996/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1997 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1998 /* timing */
1999 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2000 0x0c, 0x03, 0x04, 0xa0},
2001 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2002 {0xff, 0x00, 0x06, 0x00}, /* strength */
2003 /* pll control */
2004 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2005 0x40, 0x07, 0x03,
2006 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2007};
2008
2009static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002010 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2011 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002012 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2013};
2014
2015static struct platform_device mipi_dsi_novatek_panel_device = {
2016 .name = "mipi_novatek",
2017 .id = 0,
2018 .dev = {
2019 .platform_data = &novatek_pdata,
2020 }
2021};
2022
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002023static struct platform_device mipi_dsi2lvds_bridge_device = {
2024 .name = "mipi_tc358764",
2025 .id = 0,
2026 .dev.platform_data = &mipi_dsi2lvds_pdata,
2027};
2028
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002029#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2030static struct resource hdmi_msm_resources[] = {
2031 {
2032 .name = "hdmi_msm_qfprom_addr",
2033 .start = 0x00700000,
2034 .end = 0x007060FF,
2035 .flags = IORESOURCE_MEM,
2036 },
2037 {
2038 .name = "hdmi_msm_hdmi_addr",
2039 .start = 0x04A00000,
2040 .end = 0x04A00FFF,
2041 .flags = IORESOURCE_MEM,
2042 },
2043 {
2044 .name = "hdmi_msm_irq",
2045 .start = HDMI_IRQ,
2046 .end = HDMI_IRQ,
2047 .flags = IORESOURCE_IRQ,
2048 },
2049};
2050
2051static int hdmi_enable_5v(int on);
2052static int hdmi_core_power(int on, int show);
2053static int hdmi_cec_power(int on);
2054
2055static struct msm_hdmi_platform_data hdmi_msm_data = {
2056 .irq = HDMI_IRQ,
2057 .enable_5v = hdmi_enable_5v,
2058 .core_power = hdmi_core_power,
2059 .cec_power = hdmi_cec_power,
2060};
2061
2062static struct platform_device hdmi_msm_device = {
2063 .name = "hdmi_msm",
2064 .id = 0,
2065 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2066 .resource = hdmi_msm_resources,
2067 .dev.platform_data = &hdmi_msm_data,
2068};
2069#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2070
Vinay Kalia291263e2011-11-01 17:07:05 -07002071#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2072static struct platform_device wfd_panel_device = {
2073 .name = "wfd_panel",
2074 .id = 0,
2075 .dev.platform_data = NULL,
2076};
2077#endif
2078
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002079#ifdef CONFIG_MSM_BUS_SCALING
2080static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2081 {
2082 .src = MSM_BUS_MASTER_MDP_PORT0,
2083 .dst = MSM_BUS_SLAVE_EBI_CH0,
2084 .ab = 0,
2085 .ib = 0,
2086 },
2087};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002088
2089#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2090static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2091 {
2092 .src = MSM_BUS_MASTER_MDP_PORT0,
2093 .dst = MSM_BUS_SLAVE_EBI_CH0,
2094 .ab = 2000000000,
2095 .ib = 2000000000,
2096 },
2097};
2098#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002099static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2100 {
2101 .src = MSM_BUS_MASTER_MDP_PORT0,
2102 .dst = MSM_BUS_SLAVE_EBI_CH0,
2103 .ab = 566092800 * 2,
2104 .ib = 707616000 * 2,
2105 },
2106};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002107#endif
2108
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002109static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2110 {
2111 ARRAY_SIZE(dtv_bus_init_vectors),
2112 dtv_bus_init_vectors,
2113 },
2114 {
2115 ARRAY_SIZE(dtv_bus_def_vectors),
2116 dtv_bus_def_vectors,
2117 },
2118};
2119static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2120 dtv_bus_scale_usecases,
2121 ARRAY_SIZE(dtv_bus_scale_usecases),
2122 .name = "dtv",
2123};
2124
2125static struct lcdc_platform_data dtv_pdata = {
2126 .bus_scale_table = &dtv_bus_scale_pdata,
2127};
2128#endif
2129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002130static void __init msm_fb_add_devices(void)
2131{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002132 struct platform_device *ptr = NULL;
2133
2134 if (machine_is_msm8960_liquid())
2135 ptr = &mipi_dsi2lvds_bridge_device;
2136 else
2137 ptr = &mipi_dsi_toshiba_panel_device;
2138 platform_add_devices(&ptr, 1);
2139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002140 if (machine_is_msm8x60_rumi3()) {
2141 msm_fb_register_device("mdp", NULL);
2142 mipi_dsi_pdata.target_type = 1;
2143 } else
2144 msm_fb_register_device("mdp", &mdp_pdata);
2145 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002146#ifdef CONFIG_MSM_BUS_SCALING
2147 msm_fb_register_device("dtv", &dtv_pdata);
2148#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002149}
2150
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002151static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2152 .func = GPIOMUX_FUNC_GPIO,
2153 .drv = GPIOMUX_DRV_2MA,
2154 .pull = GPIOMUX_PULL_DOWN,
2155};
2156
2157static struct gpiomux_setting mdp_vsync_active_cfg = {
2158 .func = GPIOMUX_FUNC_1,
2159 .drv = GPIOMUX_DRV_2MA,
2160 .pull = GPIOMUX_PULL_DOWN,
2161};
2162
2163static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2164 {
2165 .gpio = MDP_VSYNC_GPIO,
2166 .settings = {
2167 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2168 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2169 },
2170 }
2171};
2172
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002173#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2174static struct gpiomux_setting hdmi_suspend_cfg = {
2175 .func = GPIOMUX_FUNC_GPIO,
2176 .drv = GPIOMUX_DRV_2MA,
2177 .pull = GPIOMUX_PULL_DOWN,
2178};
2179
2180static struct gpiomux_setting hdmi_active_1_cfg = {
2181 .func = GPIOMUX_FUNC_1,
2182 .drv = GPIOMUX_DRV_2MA,
2183 .pull = GPIOMUX_PULL_UP,
2184};
2185
2186static struct gpiomux_setting hdmi_active_2_cfg = {
2187 .func = GPIOMUX_FUNC_1,
2188 .drv = GPIOMUX_DRV_2MA,
2189 .pull = GPIOMUX_PULL_DOWN,
2190};
2191
2192static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2193 {
2194 .gpio = 99,
2195 .settings = {
2196 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2197 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2198 },
2199 },
2200 {
2201 .gpio = 100,
2202 .settings = {
2203 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2204 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2205 },
2206 },
2207 {
2208 .gpio = 101,
2209 .settings = {
2210 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2211 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2212 },
2213 },
2214 {
2215 .gpio = 102,
2216 .settings = {
2217 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2218 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2219 },
2220 },
2221};
2222
2223static int hdmi_enable_5v(int on)
2224{
2225 /* TBD: PM8921 regulator instead of 8901 */
2226 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2227 static int prev_on;
2228 int rc;
2229
2230 if (on == prev_on)
2231 return 0;
2232
2233 if (!reg_8921_hdmi_mvs)
2234 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2235 "hdmi_mvs");
2236
2237 if (on) {
2238 rc = regulator_enable(reg_8921_hdmi_mvs);
2239 if (rc) {
2240 pr_err("'%s' regulator enable failed, rc=%d\n",
2241 "8921_hdmi_mvs", rc);
2242 return rc;
2243 }
2244 pr_debug("%s(on): success\n", __func__);
2245 } else {
2246 rc = regulator_disable(reg_8921_hdmi_mvs);
2247 if (rc)
2248 pr_warning("'%s' regulator disable failed, rc=%d\n",
2249 "8921_hdmi_mvs", rc);
2250 pr_debug("%s(off): success\n", __func__);
2251 }
2252
2253 prev_on = on;
2254
2255 return 0;
2256}
2257
2258static int hdmi_core_power(int on, int show)
2259{
2260 static struct regulator *reg_8921_l23, *reg_8921_s4;
2261 static int prev_on;
2262 int rc;
2263
2264 if (on == prev_on)
2265 return 0;
2266
2267 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002268 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002269 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002270 if (IS_ERR(reg_8921_l23)) {
2271 pr_err("could not get reg_8921_l23, rc = %ld\n",
2272 PTR_ERR(reg_8921_l23));
2273 return -ENODEV;
2274 }
2275 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2276 if (rc) {
2277 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2278 return -EINVAL;
2279 }
2280 }
2281 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002283 if (IS_ERR(reg_8921_s4)) {
2284 pr_err("could not get reg_8921_s4, rc = %ld\n",
2285 PTR_ERR(reg_8921_s4));
2286 return -ENODEV;
2287 }
2288 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2289 if (rc) {
2290 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2291 return -EINVAL;
2292 }
2293 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294
2295 if (on) {
2296 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2297 if (rc < 0) {
2298 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2299 return -EINVAL;
2300 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002301 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302 if (rc) {
2303 pr_err("'%s' regulator enable failed, rc=%d\n",
2304 "hdmi_avdd", rc);
2305 return rc;
2306 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002307 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002308 if (rc) {
2309 pr_err("'%s' regulator enable failed, rc=%d\n",
2310 "hdmi_vcc", rc);
2311 return rc;
2312 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002313 rc = gpio_request(100, "HDMI_DDC_CLK");
2314 if (rc) {
2315 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2316 "HDMI_DDC_CLK", 100, rc);
2317 goto error1;
2318 }
2319 rc = gpio_request(101, "HDMI_DDC_DATA");
2320 if (rc) {
2321 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2322 "HDMI_DDC_DATA", 101, rc);
2323 goto error2;
2324 }
2325 rc = gpio_request(102, "HDMI_HPD");
2326 if (rc) {
2327 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2328 "HDMI_HPD", 102, rc);
2329 goto error3;
2330 }
2331 pr_debug("%s(on): success\n", __func__);
2332 } else {
2333 gpio_free(100);
2334 gpio_free(101);
2335 gpio_free(102);
2336
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002337 rc = regulator_disable(reg_8921_l23);
2338 if (rc) {
2339 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2340 return -ENODEV;
2341 }
2342 rc = regulator_disable(reg_8921_s4);
2343 if (rc) {
2344 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2345 return -ENODEV;
2346 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2348 if (rc < 0) {
2349 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2350 return -EINVAL;
2351 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002352 pr_debug("%s(off): success\n", __func__);
2353 }
2354
2355 prev_on = on;
2356
2357 return 0;
2358
2359error3:
2360 gpio_free(101);
2361error2:
2362 gpio_free(100);
2363error1:
2364 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002365 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002366 return rc;
2367}
2368
2369static int hdmi_cec_power(int on)
2370{
2371 static int prev_on;
2372 int rc;
2373
2374 if (on == prev_on)
2375 return 0;
2376
2377 if (on) {
2378 rc = gpio_request(99, "HDMI_CEC_VAR");
2379 if (rc) {
2380 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2381 "HDMI_CEC_VAR", 99, rc);
2382 goto error;
2383 }
2384 pr_debug("%s(on): success\n", __func__);
2385 } else {
2386 gpio_free(99);
2387 pr_debug("%s(off): success\n", __func__);
2388 }
2389
2390 prev_on = on;
2391
2392 return 0;
2393error:
2394 return rc;
2395}
2396#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2397
2398static void __init msm8960_allocate_memory_regions(void)
2399{
2400 void *addr;
2401 unsigned long size;
2402
2403 size = MSM_FB_SIZE;
2404 addr = alloc_bootmem_align(size, 0x1000);
2405 msm_fb_resources[0].start = __pa(addr);
2406 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2407 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2408 size, addr, __pa(addr));
2409
2410}
2411#ifdef CONFIG_WCD9310_CODEC
2412
2413#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2414
Patrick Lai3043fba2011-08-01 14:15:57 -07002415/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2416 * 4 micbiases are used to power various analog and digital
2417 * microphones operating at 1800 mV. Technically, all micbiases
2418 * can source from single cfilter since all microphones operate
2419 * at the same voltage level. The arrangement below is to make
2420 * sure all cfilters are exercised. LDO_H regulator ouput level
2421 * does not need to be as high as 2.85V. It is choosen for
2422 * microphone sensitivity purpose.
2423 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002424static struct tabla_pdata tabla_platform_data = {
2425 .slimbus_slave_device = {
2426 .name = "tabla-slave",
2427 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2428 },
2429 .irq = MSM_GPIO_TO_INT(62),
2430 .irq_base = TABLA_INTERRUPT_BASE,
2431 .num_irqs = NR_TABLA_IRQS,
2432 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002433 .micbias = {
2434 .ldoh_v = TABLA_LDOH_2P85_V,
2435 .cfilt1_mv = 1800,
2436 .cfilt2_mv = 1800,
2437 .cfilt3_mv = 1800,
2438 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2439 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2440 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2441 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2442 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002443};
2444
2445static struct slim_device msm_slim_tabla = {
2446 .name = "tabla-slim",
2447 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2448 .dev = {
2449 .platform_data = &tabla_platform_data,
2450 },
2451};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302452
2453static struct tabla_pdata tabla20_platform_data = {
2454 .slimbus_slave_device = {
2455 .name = "tabla-slave",
2456 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2457 },
2458 .irq = MSM_GPIO_TO_INT(62),
2459 .irq_base = TABLA_INTERRUPT_BASE,
2460 .num_irqs = NR_TABLA_IRQS,
2461 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2462 .micbias = {
2463 .ldoh_v = TABLA_LDOH_2P85_V,
2464 .cfilt1_mv = 1800,
2465 .cfilt2_mv = 1800,
2466 .cfilt3_mv = 1800,
2467 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2468 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2469 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2470 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2471 }
2472};
2473
2474static struct slim_device msm_slim_tabla20 = {
2475 .name = "tabla2x-slim",
2476 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2477 .dev = {
2478 .platform_data = &tabla20_platform_data,
2479 },
2480};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481#endif
2482
2483static struct slim_boardinfo msm_slim_devices[] = {
2484#ifdef CONFIG_WCD9310_CODEC
2485 {
2486 .bus_num = 1,
2487 .slim_slave = &msm_slim_tabla,
2488 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302489 {
2490 .bus_num = 1,
2491 .slim_slave = &msm_slim_tabla20,
2492 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002493#endif
2494 /* add more slimbus slaves as needed */
2495};
2496
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002497#define MSM_WCNSS_PHYS 0x03000000
2498#define MSM_WCNSS_SIZE 0x280000
2499
2500static struct resource resources_wcnss_wlan[] = {
2501 {
2502 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2503 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2504 .name = "wcnss_wlanrx_irq",
2505 .flags = IORESOURCE_IRQ,
2506 },
2507 {
2508 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2509 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2510 .name = "wcnss_wlantx_irq",
2511 .flags = IORESOURCE_IRQ,
2512 },
2513 {
2514 .start = MSM_WCNSS_PHYS,
2515 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2516 .name = "wcnss_mmio",
2517 .flags = IORESOURCE_MEM,
2518 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002519 {
2520 .start = 84,
2521 .end = 88,
2522 .name = "wcnss_gpios_5wire",
2523 .flags = IORESOURCE_IO,
2524 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002525};
2526
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002527static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2528 .has_48mhz_xo = 1,
2529};
2530
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002531static struct platform_device msm_device_wcnss_wlan = {
2532 .name = "wcnss_wlan",
2533 .id = 0,
2534 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2535 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002536 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002537};
2538
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002539#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2540 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2541 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2542 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2543
2544#define QCE_SIZE 0x10000
2545#define QCE_0_BASE 0x18500000
2546
2547#define QCE_HW_KEY_SUPPORT 0
2548#define QCE_SHA_HMAC_SUPPORT 1
2549#define QCE_SHARE_CE_RESOURCE 1
2550#define QCE_CE_SHARED 0
2551
2552static struct resource qcrypto_resources[] = {
2553 [0] = {
2554 .start = QCE_0_BASE,
2555 .end = QCE_0_BASE + QCE_SIZE - 1,
2556 .flags = IORESOURCE_MEM,
2557 },
2558 [1] = {
2559 .name = "crypto_channels",
2560 .start = DMOV_CE_IN_CHAN,
2561 .end = DMOV_CE_OUT_CHAN,
2562 .flags = IORESOURCE_DMA,
2563 },
2564 [2] = {
2565 .name = "crypto_crci_in",
2566 .start = DMOV_CE_IN_CRCI,
2567 .end = DMOV_CE_IN_CRCI,
2568 .flags = IORESOURCE_DMA,
2569 },
2570 [3] = {
2571 .name = "crypto_crci_out",
2572 .start = DMOV_CE_OUT_CRCI,
2573 .end = DMOV_CE_OUT_CRCI,
2574 .flags = IORESOURCE_DMA,
2575 },
2576};
2577
2578static struct resource qcedev_resources[] = {
2579 [0] = {
2580 .start = QCE_0_BASE,
2581 .end = QCE_0_BASE + QCE_SIZE - 1,
2582 .flags = IORESOURCE_MEM,
2583 },
2584 [1] = {
2585 .name = "crypto_channels",
2586 .start = DMOV_CE_IN_CHAN,
2587 .end = DMOV_CE_OUT_CHAN,
2588 .flags = IORESOURCE_DMA,
2589 },
2590 [2] = {
2591 .name = "crypto_crci_in",
2592 .start = DMOV_CE_IN_CRCI,
2593 .end = DMOV_CE_IN_CRCI,
2594 .flags = IORESOURCE_DMA,
2595 },
2596 [3] = {
2597 .name = "crypto_crci_out",
2598 .start = DMOV_CE_OUT_CRCI,
2599 .end = DMOV_CE_OUT_CRCI,
2600 .flags = IORESOURCE_DMA,
2601 },
2602};
2603
2604#endif
2605
2606#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2607 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2608
2609static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2610 .ce_shared = QCE_CE_SHARED,
2611 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2612 .hw_key_support = QCE_HW_KEY_SUPPORT,
2613 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2614};
2615
2616static struct platform_device qcrypto_device = {
2617 .name = "qcrypto",
2618 .id = 0,
2619 .num_resources = ARRAY_SIZE(qcrypto_resources),
2620 .resource = qcrypto_resources,
2621 .dev = {
2622 .coherent_dma_mask = DMA_BIT_MASK(32),
2623 .platform_data = &qcrypto_ce_hw_suppport,
2624 },
2625};
2626#endif
2627
2628#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2629 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2630
2631static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2632 .ce_shared = QCE_CE_SHARED,
2633 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2634 .hw_key_support = QCE_HW_KEY_SUPPORT,
2635 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2636};
2637
2638static struct platform_device qcedev_device = {
2639 .name = "qce",
2640 .id = 0,
2641 .num_resources = ARRAY_SIZE(qcedev_resources),
2642 .resource = qcedev_resources,
2643 .dev = {
2644 .coherent_dma_mask = DMA_BIT_MASK(32),
2645 .platform_data = &qcedev_ce_hw_suppport,
2646 },
2647};
2648#endif
2649
2650
2651static int __init gpiomux_init(void)
2652{
2653 int rc;
2654
2655 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2656 if (rc) {
2657 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2658 return rc;
2659 }
2660
Nishant Pandit24153d82011-08-27 16:05:13 +05302661 msm_gpiomux_install(msm8960_cam_common_configs,
2662 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002663
2664 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002665 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666
2667 msm_gpiomux_install(msm8960_gsbi_configs,
2668 ARRAY_SIZE(msm8960_gsbi_configs));
2669
2670 msm_gpiomux_install(msm8960_cyts_configs,
2671 ARRAY_SIZE(msm8960_cyts_configs));
2672
2673 msm_gpiomux_install(msm8960_slimbus_config,
2674 ARRAY_SIZE(msm8960_slimbus_config));
2675
2676 msm_gpiomux_install(msm8960_audio_codec_configs,
2677 ARRAY_SIZE(msm8960_audio_codec_configs));
2678
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002679 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2680 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002682#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2683 msm_gpiomux_install(msm8960_hdmi_configs,
2684 ARRAY_SIZE(msm8960_hdmi_configs));
2685#endif
2686
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002687 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2688 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002690 msm_gpiomux_install(wcnss_5wire_interface,
2691 ARRAY_SIZE(wcnss_5wire_interface));
2692
2693 return 0;
2694}
2695
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002696#define MSM_SHARED_RAM_PHYS 0x80000000
2697
2698static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2699 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2700 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2701 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2702 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2703 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2704 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2705 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2706 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2707 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2708 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2709 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2710 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2712 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2713 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2714 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2715 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2716 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2717 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2718 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2719 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2720 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2721 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2722 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2723 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2724 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002725 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002726 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2727 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2728 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002729 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2730 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731};
2732
2733static struct pm8921_adc_properties pm8921_adc_data = {
2734 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2735 .bitresolution = 15,
2736 .bipolar = 0,
2737};
2738
2739static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2740 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002741 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002743 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002744};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002745
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002746static void __init msm8960_map_io(void)
2747{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002749 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002750
2751 if (socinfo_init() < 0)
2752 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002753}
2754
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002755#ifdef CONFIG_ARCH_MSM8930
2756static void __init msm8930_map_io(void)
2757{
2758 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2759 msm_map_msm8930_io();
2760
2761 if (socinfo_init() < 0)
2762 pr_err("socinfo_init() failed!\n");
2763}
2764#endif
2765
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002766static void __init msm8960_init_irq(void)
2767{
2768 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002769
2770 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002771 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002773
2774 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002776
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002777 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2778 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002779
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002780 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2781 * as they are configured as level, which does not play nice with
2782 * handle_percpu_irq.
2783 */
2784 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2785 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002786 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002787 }
2788}
2789
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002790/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791enum sdcc_controllers {
2792 SDCC1,
2793 SDCC2,
2794 SDCC3,
2795 SDCC4,
2796 SDCC5,
2797 MAX_SDCC_CONTROLLER
2798};
2799
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002800/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002801static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2802 /* SDCC1 : eMMC card connected */
2803 [SDCC1] = {
2804 .name = "sdc_vdd",
2805 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302806 .high_vol_level = 2950000,
2807 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302808 .always_on = 1,
2809 .lpm_sup = 1,
2810 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811 .hpm_uA = 200000, /* 200mA */
2812 },
2813 /* SDCC3 : External card slot connected */
2814 [SDCC3] = {
2815 .name = "sdc_vdd",
2816 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302817 .high_vol_level = 2950000,
2818 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002819 .hpm_uA = 600000, /* 600mA */
2820 }
2821};
2822
2823/* Only slots having eMMC card will require VCCQ voltage */
2824static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2825 /* SDCC1 : eMMC card connected */
2826 [SDCC1] = {
2827 .name = "sdc_vccq",
2828 .set_voltage_sup = 1,
2829 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302830 .high_vol_level = 1800000,
2831 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002832 .hpm_uA = 200000, /* 200mA */
2833 }
2834};
2835
2836/* All SDCC controllers may require voting for VDD PAD voltage */
2837static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2838 /* SDCC3 : External card slot connected */
2839 [SDCC3] = {
2840 .name = "sdc_vddp",
2841 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302842 .high_vol_level = 2950000,
2843 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844 .always_on = 1,
2845 .lpm_sup = 1,
2846 /* Max. Active current required is 16 mA */
2847 .hpm_uA = 16000,
2848 /*
2849 * Sleep current required is ~300 uA. But min. vote can be
2850 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2851 * during sleep.
2852 */
2853 .lpm_uA = 2000,
2854 }
2855};
2856
2857static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2858 /* SDCC1 : eMMC card connected */
2859 [SDCC1] = {
2860 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2861 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2862 },
2863 /* SDCC3 : External card slot connected */
2864 [SDCC3] = {
2865 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2866 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2867 }
2868};
2869
2870/* SDC1 pad data */
2871static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2872 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302873 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2874 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875};
2876
2877static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2878 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2879 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2880 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2881};
2882
2883static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302884 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002885 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2886 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2887};
2888
2889static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302890 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002891 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2892 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2893};
2894
2895/* SDC3 pad data */
2896static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2897 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2898 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2899 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2900};
2901
2902static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2903 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2904 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2905 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2906};
2907
2908static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302909 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002910 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2911 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2912};
2913
2914static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302915 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302916 /*
2917 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2918 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2919 * which would result in false card detection interrupts.
2920 */
2921 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2922 /*
2923 * Keeping DATA lines status to PULL UP will make sure that
2924 * there is no current leak during sleep if external pull up
2925 * is connected to DATA lines.
2926 */
2927 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002928};
2929
2930struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2931 [SDCC1] = {
2932 .on = sdc1_pad_pull_on_cfg,
2933 .off = sdc1_pad_pull_off_cfg,
2934 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2935 },
2936 [SDCC3] = {
2937 .on = sdc3_pad_pull_on_cfg,
2938 .off = sdc3_pad_pull_off_cfg,
2939 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2940 },
2941};
2942
2943struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2944 [SDCC1] = {
2945 .on = sdc1_pad_drv_on_cfg,
2946 .off = sdc1_pad_drv_off_cfg,
2947 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2948 },
2949 [SDCC3] = {
2950 .on = sdc3_pad_drv_on_cfg,
2951 .off = sdc3_pad_drv_off_cfg,
2952 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2953 },
2954};
2955
2956struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2957 [SDCC1] = {
2958 .pull = &mmc_pad_pull_data[SDCC1],
2959 .drv = &mmc_pad_drv_data[SDCC1]
2960 },
2961 [SDCC3] = {
2962 .pull = &mmc_pad_pull_data[SDCC3],
2963 .drv = &mmc_pad_drv_data[SDCC3]
2964 },
2965};
2966
2967struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2968 [SDCC1] = {
2969 .pad_data = &mmc_pad_data[SDCC1],
2970 },
2971 [SDCC3] = {
2972 .pad_data = &mmc_pad_data[SDCC3],
2973 },
2974};
2975
2976static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302977 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002978};
2979
2980static unsigned int sdc3_sup_clk_rates[] = {
2981 400000, 24000000, 48000000, 96000000
2982};
2983
2984#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2985static struct mmc_platform_data msm8960_sdc1_data = {
2986 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2987#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2988 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2989#else
2990 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2991#endif
2992 .sup_clk_table = sdc1_sup_clk_rates,
2993 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302994 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002995 .nonremovable = 1,
2996 .sdcc_v4_sup = true,
2997 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302998 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002999};
3000#endif
3001
3002#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3003static struct mmc_platform_data msm8960_sdc3_data = {
3004 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3005 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3006 .sup_clk_table = sdc3_sup_clk_rates,
3007 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303008 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303009#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003010 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303011#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003012 .sdcc_v4_sup = true,
3013 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3014 .pin_data = &mmc_slot_pin_data[SDCC3],
3015#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3016 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3017 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3018 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3019#endif
3020 .xpc_cap = 1,
3021 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3022 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303023 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003024};
3025#endif
3026
3027static void __init msm8960_init_mmc(void)
3028{
3029#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3030 /* SDC1 : eMMC card connected */
3031 msm_add_sdcc(1, &msm8960_sdc1_data);
3032#endif
3033#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3034 /* SDC3: External card slot */
3035 msm_add_sdcc(3, &msm8960_sdc3_data);
3036#endif
3037}
3038
3039static void __init msm8960_init_buses(void)
3040{
3041#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003042 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003043 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3044 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3045 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3046 msm_bus_apps_fabric.dev.platform_data =
3047 &msm_bus_8960_apps_fabric_pdata;
3048 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3049 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3050 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3051 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003052#endif
3053}
3054
3055static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3056 .max_clock_speed = 15060000,
3057};
3058
3059#ifdef CONFIG_USB_MSM_OTG_72K
3060static struct msm_otg_platform_data msm_otg_pdata;
3061#else
3062#define USB_5V_EN 42
3063static void msm_hsusb_vbus_power(bool on)
3064{
3065 int rc;
3066 static bool vbus_is_on;
3067 static struct regulator *mvs_otg_switch;
3068 struct pm_gpio param = {
3069 .direction = PM_GPIO_DIR_OUT,
3070 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3071 .output_value = 1,
3072 .pull = PM_GPIO_PULL_NO,
3073 .vin_sel = PM_GPIO_VIN_S4,
3074 .out_strength = PM_GPIO_STRENGTH_MED,
3075 .function = PM_GPIO_FUNC_NORMAL,
3076 };
3077
3078 if (vbus_is_on == on)
3079 return;
3080
3081 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003082 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3083 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003084 if (IS_ERR(mvs_otg_switch)) {
3085 pr_err("Unable to get mvs_otg_switch\n");
3086 return;
3087 }
3088
3089 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3090 "usb_5v_en");
3091 if (rc < 0) {
3092 pr_err("failed to request usb_5v_en gpio\n");
3093 goto put_mvs_otg;
3094 }
3095
3096 if (regulator_enable(mvs_otg_switch)) {
3097 pr_err("unable to enable mvs_otg_switch\n");
3098 goto free_usb_5v_en;
3099 }
3100
3101 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3102 &param);
3103 if (rc < 0) {
3104 pr_err("failed to configure usb_5v_en gpio\n");
3105 goto disable_mvs_otg;
3106 }
3107 vbus_is_on = true;
3108 return;
3109 }
3110disable_mvs_otg:
3111 regulator_disable(mvs_otg_switch);
3112free_usb_5v_en:
3113 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
3114put_mvs_otg:
3115 regulator_put(mvs_otg_switch);
3116 vbus_is_on = false;
3117}
3118
3119static struct msm_otg_platform_data msm_otg_pdata = {
3120 .mode = USB_OTG,
3121 .otg_control = OTG_PMIC_CONTROL,
3122 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3123 .pclk_src_name = "dfab_usb_hs_clk",
3124 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3125 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303126 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003127};
3128#endif
3129
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303130#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303131#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303132static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3133 .strobe = 150,
3134 .data = 151,
3135};
3136#else
3137static struct msm_hsic_host_platform_data msm_hsic_pdata;
3138#endif
3139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003140#define PID_MAGIC_ID 0x71432909
3141#define SERIAL_NUM_MAGIC_ID 0x61945374
3142#define SERIAL_NUMBER_LENGTH 127
3143#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3144
3145struct magic_num_struct {
3146 uint32_t pid;
3147 uint32_t serial_num;
3148};
3149
3150struct dload_struct {
3151 uint32_t reserved1;
3152 uint32_t reserved2;
3153 uint32_t reserved3;
3154 uint16_t reserved4;
3155 uint16_t pid;
3156 char serial_number[SERIAL_NUMBER_LENGTH];
3157 uint16_t reserved5;
3158 struct magic_num_struct magic_struct;
3159};
3160
3161static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3162{
3163 struct dload_struct __iomem *dload = 0;
3164
3165 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3166 if (!dload) {
3167 pr_err("%s: cannot remap I/O memory region: %08x\n",
3168 __func__, DLOAD_USB_BASE_ADD);
3169 return -ENXIO;
3170 }
3171
3172 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3173 __func__, dload, pid, snum);
3174 /* update pid */
3175 dload->magic_struct.pid = PID_MAGIC_ID;
3176 dload->pid = pid;
3177
3178 /* update serial number */
3179 dload->magic_struct.serial_num = 0;
3180 if (!snum) {
3181 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3182 goto out;
3183 }
3184
3185 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003186 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003187out:
3188 iounmap(dload);
3189 return 0;
3190}
3191
3192static struct android_usb_platform_data android_usb_pdata = {
3193 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3194};
3195
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003196static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003197 .name = "android_usb",
3198 .id = -1,
3199 .dev = {
3200 .platform_data = &android_usb_pdata,
3201 },
3202};
3203
3204static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3205 0x03, 0x0f,
3206};
3207
3208static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3209 0x00, 0x24, 0x54, 0x10,
3210 0x09, 0x03, 0x01,
3211 0x10, 0x54, 0x30, 0x0C,
3212 0x24, 0x30, 0x0f,
3213};
3214
3215static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3216 0x00, 0x24, 0x54, 0x10,
3217 0x09, 0x07, 0x01, 0x0B,
3218 0x10, 0x54, 0x30, 0x0C,
3219 0x24, 0x30, 0x0f,
3220};
3221
3222static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3223 [0] = {
3224 .mode = MSM_SPM_MODE_CLOCK_GATING,
3225 .notify_rpm = false,
3226 .cmd = spm_wfi_cmd_sequence,
3227 },
3228 [1] = {
3229 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3230 .notify_rpm = false,
3231 .cmd = spm_power_collapse_without_rpm,
3232 },
3233 [2] = {
3234 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3235 .notify_rpm = true,
3236 .cmd = spm_power_collapse_with_rpm,
3237 },
3238};
3239
3240static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3241 [0] = {
3242 .reg_base_addr = MSM_SAW0_BASE,
3243 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3244 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3245 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3246#if defined(CONFIG_MSM_AVS_HW)
3247 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3248 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3249#endif
3250 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3251 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3252 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3253 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3254 .vctl_timeout_us = 50,
3255 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3256 .modes = msm_spm_seq_list,
3257 },
3258 [1] = {
3259 .reg_base_addr = MSM_SAW1_BASE,
3260 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3261 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3262 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3263#if defined(CONFIG_MSM_AVS_HW)
3264 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3265 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3266#endif
3267 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3268 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3269 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3270 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3271 .vctl_timeout_us = 50,
3272 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3273 .modes = msm_spm_seq_list,
3274 },
3275};
3276
3277static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3278 0x00, 0x20, 0x03, 0x20,
3279 0x00, 0x0f,
3280};
3281
3282static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3283 0x00, 0x20, 0x34, 0x64,
3284 0x48, 0x07, 0x48, 0x20,
3285 0x50, 0x64, 0x04, 0x34,
3286 0x50, 0x0f,
3287};
3288static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3289 0x00, 0x10, 0x34, 0x64,
3290 0x48, 0x07, 0x48, 0x10,
3291 0x50, 0x64, 0x04, 0x34,
3292 0x50, 0x0F,
3293};
3294
3295static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3296 [0] = {
3297 .mode = MSM_SPM_L2_MODE_RETENTION,
3298 .notify_rpm = false,
3299 .cmd = l2_spm_wfi_cmd_sequence,
3300 },
3301 [1] = {
3302 .mode = MSM_SPM_L2_MODE_GDHS,
3303 .notify_rpm = true,
3304 .cmd = l2_spm_gdhs_cmd_sequence,
3305 },
3306 [2] = {
3307 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3308 .notify_rpm = true,
3309 .cmd = l2_spm_power_off_cmd_sequence,
3310 },
3311};
3312
3313
3314static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3315 [0] = {
3316 .reg_base_addr = MSM_SAW_L2_BASE,
3317 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3318 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3319 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3320 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3321 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3322 .modes = msm_spm_l2_seq_list,
3323 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3324 },
3325};
3326
3327#define CYTTSP_TS_GPIO_IRQ 11
3328#define CYTTSP_TS_SLEEP_GPIO 50
3329#define CYTTSP_TS_RESOUT_N_GPIO 52
3330
3331/*virtual key support */
3332static ssize_t tma340_vkeys_show(struct kobject *kobj,
3333 struct kobj_attribute *attr, char *buf)
3334{
3335 return snprintf(buf, 200,
3336 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3337 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3338 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3339 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3340 "\n");
3341}
3342
3343static struct kobj_attribute tma340_vkeys_attr = {
3344 .attr = {
3345 .mode = S_IRUGO,
3346 },
3347 .show = &tma340_vkeys_show,
3348};
3349
3350static struct attribute *tma340_properties_attrs[] = {
3351 &tma340_vkeys_attr.attr,
3352 NULL
3353};
3354
3355static struct attribute_group tma340_properties_attr_group = {
3356 .attrs = tma340_properties_attrs,
3357};
3358
3359
3360static int cyttsp_platform_init(struct i2c_client *client)
3361{
3362 int rc = 0;
3363 static struct kobject *tma340_properties_kobj;
3364
3365 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3366 tma340_properties_kobj = kobject_create_and_add("board_properties",
3367 NULL);
3368 if (tma340_properties_kobj)
3369 rc = sysfs_create_group(tma340_properties_kobj,
3370 &tma340_properties_attr_group);
3371 if (!tma340_properties_kobj || rc)
3372 pr_err("%s: failed to create board_properties\n",
3373 __func__);
3374
3375 return 0;
3376}
3377
3378static struct cyttsp_regulator regulator_data[] = {
3379 {
3380 .name = "vdd",
3381 .min_uV = CY_TMA300_VTG_MIN_UV,
3382 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303383 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3384 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 },
3386 /* TODO: Remove after runtime PM is enabled in I2C driver */
3387 {
3388 .name = "vcc_i2c",
3389 .min_uV = CY_I2C_VTG_MIN_UV,
3390 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303391 .hpm_load_uA = CY_I2C_CURR_UA,
3392 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003393 },
3394};
3395
3396static struct cyttsp_platform_data cyttsp_pdata = {
3397 .panel_maxx = 634,
3398 .panel_maxy = 1166,
3399 .disp_maxx = 616,
3400 .disp_maxy = 1023,
3401 .disp_minx = 0,
3402 .disp_miny = 16,
3403 .flags = 0x01,
3404 .gen = CY_GEN3, /* or */
3405 .use_st = CY_USE_ST,
3406 .use_mt = CY_USE_MT,
3407 .use_hndshk = CY_SEND_HNDSHK,
3408 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303409 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003410 .use_gestures = CY_USE_GESTURES,
3411 .fw_fname = "cyttsp_8960_cdp.hex",
3412 /* activate up to 4 groups
3413 * and set active distance
3414 */
3415 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3416 CY_GEST_GRP3 | CY_GEST_GRP4 |
3417 CY_ACT_DIST,
3418 /* change act_intrvl to customize the Active power state
3419 * scanning/processing refresh interval for Operating mode
3420 */
3421 .act_intrvl = CY_ACT_INTRVL_DFLT,
3422 /* change tch_tmout to customize the touch timeout for the
3423 * Active power state for Operating mode
3424 */
3425 .tch_tmout = CY_TCH_TMOUT_DFLT,
3426 /* change lp_intrvl to customize the Low Power power state
3427 * scanning/processing refresh interval for Operating mode
3428 */
3429 .lp_intrvl = CY_LP_INTRVL_DFLT,
3430 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3431 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3432 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3433 .regulator_info = regulator_data,
3434 .num_regulators = ARRAY_SIZE(regulator_data),
3435 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303436 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003437};
3438
3439static struct i2c_board_info cyttsp_info[] __initdata = {
3440 {
3441 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3442 .platform_data = &cyttsp_pdata,
3443#ifndef CY_USE_TIMER
3444 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3445#endif /* CY_USE_TIMER */
3446 },
3447};
3448
Mohan Pallaka50837382011-09-07 11:00:57 +05303449/* configuration data */
3450static const u8 mxt_config_data[] = {
3451 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003452 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303453 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003454 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3456 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3457 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3459 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3460 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303461 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003462 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303463 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003464 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303465 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003466 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3467 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3468 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3469 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303470 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3472 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303473 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003474 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3475 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303476 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003477 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3478 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303479 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003480 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3481 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303482 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003483 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303484 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003485 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303486 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003487 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303488 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003489 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303490 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003491 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303492};
3493
3494#define MXT_TS_GPIO_IRQ 11
3495#define MXT_TS_LDO_EN_GPIO 50
3496#define MXT_TS_RESET_GPIO 52
3497
3498static void mxt_init_hw_liquid(void)
3499{
3500 int rc;
3501
3502 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3503 if (rc) {
3504 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3505 __func__, MXT_TS_GPIO_IRQ);
3506 return;
3507 }
3508
3509 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3510 if (rc) {
3511 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3512 __func__, MXT_TS_GPIO_IRQ);
3513 goto err_irq_gpio_req;
3514 }
3515
3516 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3517 if (rc) {
3518 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3519 __func__, MXT_TS_LDO_EN_GPIO);
3520 goto err_irq_gpio_req;
3521 }
3522
3523 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3524 if (rc) {
3525 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3526 __func__, MXT_TS_LDO_EN_GPIO);
3527 goto err_ldo_gpio_req;
3528 }
3529
3530 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3531 if (rc) {
3532 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3533 __func__, MXT_TS_RESET_GPIO);
3534 goto err_ldo_gpio_set_dir;
3535 }
3536
3537 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3538 if (rc) {
3539 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3540 __func__, MXT_TS_RESET_GPIO);
3541 goto err_reset_gpio_req;
3542 }
3543
3544 return;
3545
3546err_reset_gpio_req:
3547 gpio_free(MXT_TS_RESET_GPIO);
3548err_ldo_gpio_set_dir:
3549 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3550err_ldo_gpio_req:
3551 gpio_free(MXT_TS_LDO_EN_GPIO);
3552err_irq_gpio_req:
3553 gpio_free(MXT_TS_GPIO_IRQ);
3554}
3555
3556static struct mxt_platform_data mxt_platform_data = {
3557 .config = mxt_config_data,
3558 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003559 .x_size = 1365,
3560 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303561 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003562 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303563};
3564
3565static struct i2c_board_info mxt_device_info[] __initdata = {
3566 {
3567 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3568 .platform_data = &mxt_platform_data,
3569 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3570 },
3571};
3572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003573static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3574{
3575}
3576
3577static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3578 .clk_freq = 100000,
3579 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003580 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3581};
3582
3583static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3584 .clk_freq = 100000,
3585 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003586 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3587};
3588
3589static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3590 .clk_freq = 100000,
3591 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003592 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3593};
3594
3595static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3596 .clk_freq = 100000,
3597 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003598 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3599};
3600
3601static struct msm_rpm_platform_data msm_rpm_data = {
3602 .reg_base_addrs = {
3603 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3604 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3605 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3606 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3607 },
3608
3609 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3610 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3611 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3612 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3613 .msm_apps_ipc_rpm_val = 4,
3614};
3615
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003616static struct ks8851_pdata spi_eth_pdata = {
3617 .irq_gpio = KS8851_IRQ_GPIO,
3618 .rst_gpio = KS8851_RST_GPIO,
3619};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003620
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003621static struct spi_board_info spi_board_info[] __initdata = {
3622 {
3623 .modalias = "ks8851",
3624 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3625 .max_speed_hz = 19200000,
3626 .bus_num = 0,
3627 .chip_select = 0,
3628 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003629 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003630 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003631 {
3632 .modalias = "dsi_novatek_3d_panel_spi",
3633 .max_speed_hz = 10800000,
3634 .bus_num = 0,
3635 .chip_select = 1,
3636 .mode = SPI_MODE_0,
3637 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638};
3639
3640static struct platform_device msm_device_saw_core0 = {
3641 .name = "saw-regulator",
3642 .id = 0,
3643 .dev = {
3644 .platform_data = &msm_saw_regulator_pdata_s5,
3645 },
3646};
3647
3648static struct platform_device msm_device_saw_core1 = {
3649 .name = "saw-regulator",
3650 .id = 1,
3651 .dev = {
3652 .platform_data = &msm_saw_regulator_pdata_s6,
3653 },
3654};
3655
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003656#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3657static struct platform_device wfd_device = {
3658 .name = "msm_wfd",
3659 .id = -1,
3660};
3661#endif
3662
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003663static struct tsens_platform_data msm_tsens_pdata = {
3664 .slope = 910,
3665 .tsens_factor = 1000,
3666 .hw_type = MSM_8960,
3667 .tsens_num_sensor = 5,
3668};
3669
3670static struct platform_device msm_tsens_device = {
3671 .name = "tsens8960-tm",
3672 .id = -1,
3673 .dev = {
3674 .platform_data = &msm_tsens_pdata,
3675 },
3676};
3677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003678#ifdef CONFIG_MSM_FAKE_BATTERY
3679static struct platform_device fish_battery_device = {
3680 .name = "fish_battery",
3681};
3682#endif
3683
David Collins26f05562011-06-20 09:56:28 -07003684static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003685 .name = GPIO_REGULATOR_DEV_NAME,
3686 .id = PM8921_MPP_PM_TO_SYS(7),
3687 .dev = {
3688 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3689 },
3690};
3691
David Collins26f05562011-06-20 09:56:28 -07003692static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003693 .name = GPIO_REGULATOR_DEV_NAME,
3694 .id = 91,
3695 .dev = {
3696 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3697 },
3698};
3699
David Collinsb10be1d2011-09-02 10:29:31 -07003700static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3701 .name = GPIO_REGULATOR_DEV_NAME,
3702 .id = PM8921_GPIO_PM_TO_SYS(17),
3703 .dev = {
3704 .platform_data =
3705 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3706 },
3707};
3708
David Collins26f05562011-06-20 09:56:28 -07003709static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3710 .name = "rpm-regulator",
3711 .id = -1,
3712 .dev = {
3713 .platform_data = &msm_rpm_regulator_pdata,
3714 },
3715};
3716
David Collins4c31a872011-08-31 10:07:10 -07003717static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3718 .phys_addr_base = 0x0010C000,
3719 .reg_offsets = {
3720 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3721 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3722 },
3723 .phys_size = SZ_8K,
3724 .log_len = 4096, /* log's buffer length in bytes */
3725 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3726};
3727
3728static struct platform_device msm_rpm_log_device = {
3729 .name = "msm_rpm_log",
3730 .id = -1,
3731 .dev = {
3732 .platform_data = &msm_rpm_log_pdata,
3733 },
3734};
3735
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003736static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003737 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738 &msm_device_smd,
3739 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303740 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003741 &msm_device_saw_core0,
3742 &msm_device_saw_core1,
3743 &msm8960_device_ext_5v_vreg,
3744 &msm8960_device_ext_l2_vreg,
3745 &msm8960_device_ssbi_pm8921,
3746 &msm8960_device_qup_spi_gsbi1,
3747 &msm8960_device_qup_i2c_gsbi3,
3748 &msm8960_device_qup_i2c_gsbi4,
3749 &msm8960_device_qup_i2c_gsbi10,
3750#ifndef CONFIG_MSM_DSPS
3751 &msm8960_device_qup_i2c_gsbi12,
3752#endif
3753 &msm_slim_ctrl,
3754 &msm_device_wcnss_wlan,
3755#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3756 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3757 &qcrypto_device,
3758#endif
3759
3760#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3761 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3762 &qcedev_device,
3763#endif
3764#ifdef CONFIG_MSM_ROTATOR
3765 &msm_rotator_device,
3766#endif
3767 &msm_device_sps,
3768#ifdef CONFIG_MSM_FAKE_BATTERY
3769 &fish_battery_device,
3770#endif
3771#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003772#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003773 &android_pmem_device,
3774 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003775#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003776 &android_pmem_audio_device,
3777#endif
3778 &msm_fb_device,
3779 &msm_device_vidc,
3780 &msm_device_bam_dmux,
3781 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003782
3783#ifdef CONFIG_HW_RANDOM_MSM
3784 &msm_device_rng,
3785#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003786 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003787#ifdef CONFIG_ION_MSM
3788 &ion_dev,
3789#endif
David Collins4c31a872011-08-31 10:07:10 -07003790 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003791 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003792#ifdef CONFIG_MSM_QDSS
3793 &msm_etb_device,
3794 &msm_tpiu_device,
3795 &msm_funnel_device,
3796 &msm_ptm_device,
3797#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003798 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003799 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003800#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3801 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003802 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003803#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003804};
3805
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003806static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003807 &msm8960_device_otg,
3808 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003809 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303810 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003811 &android_usb_device,
3812 &msm_device_vidc,
3813 &mipi_dsi_simulator_panel_device,
3814 &msm_bus_apps_fabric,
3815 &msm_bus_sys_fabric,
3816 &msm_bus_mm_fabric,
3817 &msm_bus_sys_fpb,
3818 &msm_bus_cpss_fpb,
3819 &msm_pcm,
3820 &msm_pcm_routing,
3821 &msm_cpudai0,
3822 &msm_cpudai1,
3823 &msm_cpudai_hdmi_rx,
3824 &msm_cpudai_bt_rx,
3825 &msm_cpudai_bt_tx,
3826 &msm_cpudai_fm_rx,
3827 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003828 &msm_cpudai_auxpcm_rx,
3829 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003830 &msm_cpu_fe,
3831 &msm_stub_codec,
3832 &msm_voice,
3833 &msm_voip,
3834 &msm_lpa_pcm,
3835
3836#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3837 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3838 &qcrypto_device,
3839#endif
3840
3841#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3842 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3843 &qcedev_device,
3844#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003845};
3846
3847static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003848 &msm_kgsl_3d0,
3849 &msm_kgsl_2d0,
3850 &msm_kgsl_2d1,
3851 &mipi_dsi_renesas_panel_device,
3852#ifdef CONFIG_MSM_GEMINI
3853 &msm8960_gemini_device,
3854#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003855};
3856
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003857static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003858 &msm8960_device_otg,
3859 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003860 &msm_device_hsusb_host,
3861 &android_usb_device,
3862 &msm_pcm,
3863 &msm_pcm_routing,
3864 &msm_cpudai0,
3865 &msm_cpudai1,
3866 &msm_cpudai_hdmi_rx,
3867 &msm_cpudai_bt_rx,
3868 &msm_cpudai_bt_tx,
3869 &msm_cpudai_fm_rx,
3870 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003871 &msm_cpudai_auxpcm_rx,
3872 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003873 &msm_cpu_fe,
3874 &msm_stub_codec,
3875 &msm_kgsl_3d0,
3876#ifdef CONFIG_MSM_KGSL_2D
3877 &msm_kgsl_2d0,
3878 &msm_kgsl_2d1,
3879#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003880 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003881#ifdef CONFIG_MSM_GEMINI
3882 &msm8960_gemini_device,
3883#endif
3884 &msm_voice,
3885 &msm_voip,
3886 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303887 &msm_cpudai_afe_01_rx,
3888 &msm_cpudai_afe_01_tx,
3889 &msm_cpudai_afe_02_rx,
3890 &msm_cpudai_afe_02_tx,
3891 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003892#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3893 &hdmi_msm_device,
3894#endif
3895 &msm_pcm_hostless,
3896 &msm_bus_apps_fabric,
3897 &msm_bus_sys_fabric,
3898 &msm_bus_mm_fabric,
3899 &msm_bus_sys_fpb,
3900 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003901 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003902};
3903
3904static void __init msm8960_i2c_init(void)
3905{
3906 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3907 &msm8960_i2c_qup_gsbi4_pdata;
3908
3909 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3910 &msm8960_i2c_qup_gsbi3_pdata;
3911
3912 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3913 &msm8960_i2c_qup_gsbi10_pdata;
3914
3915 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3916 &msm8960_i2c_qup_gsbi12_pdata;
3917}
3918
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003919static void __init msm8960_gfx_init(void)
3920{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003921 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003922 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3923 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3924 msm_kgsl_3d0.dev.platform_data;
3925 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3926 320000000;
3927 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3928 266667000;
3929 }
3930}
3931
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003932static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3933 .irq_base = PM8921_IRQ_BASE,
3934 .devirq = MSM_GPIO_TO_INT(104),
3935 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3936};
3937
3938static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3939 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3940};
3941
3942static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3943 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3944};
3945
3946static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3947 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303948 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003949};
3950
3951static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3952 .pull_up = 1,
3953 .kpd_trigger_delay_us = 970,
3954 .wakeup = 1,
3955};
3956
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303957/* Rotate lock key is not available so use F1 */
3958#define KEY_ROTATE_LOCK KEY_F1
3959
3960static const unsigned int keymap_liquid[] = {
3961 KEY(0, 0, KEY_VOLUMEUP),
3962 KEY(0, 1, KEY_VOLUMEDOWN),
3963 KEY(1, 3, KEY_ROTATE_LOCK),
3964 KEY(1, 4, KEY_HOME),
3965};
3966
3967static struct matrix_keymap_data keymap_data_liquid = {
3968 .keymap_size = ARRAY_SIZE(keymap_liquid),
3969 .keymap = keymap_liquid,
3970};
3971
3972static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3973 .input_name = "keypad_8960_liquid",
3974 .input_phys_device = "keypad_8960/input0",
3975 .num_rows = 2,
3976 .num_cols = 5,
3977 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3978 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3979 .debounce_ms = 15,
3980 .scan_delay_ms = 32,
3981 .row_hold_ns = 91500,
3982 .wakeup = 1,
3983 .keymap_data = &keymap_data_liquid,
3984};
3985
3986
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003987static const unsigned int keymap[] = {
3988 KEY(0, 0, KEY_VOLUMEUP),
3989 KEY(0, 1, KEY_VOLUMEDOWN),
3990 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3991 KEY(0, 3, KEY_CAMERA_FOCUS),
3992};
3993
3994static struct matrix_keymap_data keymap_data = {
3995 .keymap_size = ARRAY_SIZE(keymap),
3996 .keymap = keymap,
3997};
3998
3999static struct pm8xxx_keypad_platform_data keypad_data = {
4000 .input_name = "keypad_8960",
4001 .input_phys_device = "keypad_8960/input0",
4002 .num_rows = 1,
4003 .num_cols = 5,
4004 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4005 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4006 .debounce_ms = 15,
4007 .scan_delay_ms = 32,
4008 .row_hold_ns = 91500,
4009 .wakeup = 1,
4010 .keymap_data = &keymap_data,
4011};
4012
4013static const unsigned int keymap_sim[] = {
4014 KEY(0, 0, KEY_7),
4015 KEY(0, 1, KEY_DOWN),
4016 KEY(0, 2, KEY_UP),
4017 KEY(0, 3, KEY_RIGHT),
4018 KEY(0, 4, KEY_ENTER),
4019 KEY(0, 5, KEY_L),
4020 KEY(0, 6, KEY_BACK),
4021 KEY(0, 7, KEY_M),
4022
4023 KEY(1, 0, KEY_LEFT),
4024 KEY(1, 1, KEY_SEND),
4025 KEY(1, 2, KEY_1),
4026 KEY(1, 3, KEY_4),
4027 KEY(1, 4, KEY_CLEAR),
4028 KEY(1, 5, KEY_MSDOS),
4029 KEY(1, 6, KEY_SPACE),
4030 KEY(1, 7, KEY_COMMA),
4031
4032 KEY(2, 0, KEY_6),
4033 KEY(2, 1, KEY_5),
4034 KEY(2, 2, KEY_8),
4035 KEY(2, 3, KEY_3),
4036 KEY(2, 4, KEY_NUMERIC_STAR),
4037 KEY(2, 5, KEY_UP),
4038 KEY(2, 6, KEY_DOWN),
4039 KEY(2, 7, KEY_LEFTSHIFT),
4040
4041 KEY(3, 0, KEY_9),
4042 KEY(3, 1, KEY_NUMERIC_POUND),
4043 KEY(3, 2, KEY_0),
4044 KEY(3, 3, KEY_2),
4045 KEY(3, 4, KEY_SLEEP),
4046 KEY(3, 5, KEY_F1),
4047 KEY(3, 6, KEY_F2),
4048 KEY(3, 7, KEY_F3),
4049
4050 KEY(4, 0, KEY_BACK),
4051 KEY(4, 1, KEY_HOME),
4052 KEY(4, 2, KEY_MENU),
4053 KEY(4, 3, KEY_VOLUMEUP),
4054 KEY(4, 4, KEY_VOLUMEDOWN),
4055 KEY(4, 5, KEY_F4),
4056 KEY(4, 6, KEY_F5),
4057 KEY(4, 7, KEY_F6),
4058
4059 KEY(5, 0, KEY_R),
4060 KEY(5, 1, KEY_T),
4061 KEY(5, 2, KEY_Y),
4062 KEY(5, 3, KEY_LEFTALT),
4063 KEY(5, 4, KEY_KPENTER),
4064 KEY(5, 5, KEY_Q),
4065 KEY(5, 6, KEY_W),
4066 KEY(5, 7, KEY_E),
4067
4068 KEY(6, 0, KEY_F),
4069 KEY(6, 1, KEY_G),
4070 KEY(6, 2, KEY_H),
4071 KEY(6, 3, KEY_CAPSLOCK),
4072 KEY(6, 4, KEY_PAGEUP),
4073 KEY(6, 5, KEY_A),
4074 KEY(6, 6, KEY_S),
4075 KEY(6, 7, KEY_D),
4076
4077 KEY(7, 0, KEY_V),
4078 KEY(7, 1, KEY_B),
4079 KEY(7, 2, KEY_N),
4080 KEY(7, 3, KEY_MENU),
4081 KEY(7, 4, KEY_PAGEDOWN),
4082 KEY(7, 5, KEY_Z),
4083 KEY(7, 6, KEY_X),
4084 KEY(7, 7, KEY_C),
4085
4086 KEY(8, 0, KEY_P),
4087 KEY(8, 1, KEY_J),
4088 KEY(8, 2, KEY_K),
4089 KEY(8, 3, KEY_INSERT),
4090 KEY(8, 4, KEY_LINEFEED),
4091 KEY(8, 5, KEY_U),
4092 KEY(8, 6, KEY_I),
4093 KEY(8, 7, KEY_O),
4094
4095 KEY(9, 0, KEY_4),
4096 KEY(9, 1, KEY_5),
4097 KEY(9, 2, KEY_6),
4098 KEY(9, 3, KEY_7),
4099 KEY(9, 4, KEY_8),
4100 KEY(9, 5, KEY_1),
4101 KEY(9, 6, KEY_2),
4102 KEY(9, 7, KEY_3),
4103
4104 KEY(10, 0, KEY_F7),
4105 KEY(10, 1, KEY_F8),
4106 KEY(10, 2, KEY_F9),
4107 KEY(10, 3, KEY_F10),
4108 KEY(10, 4, KEY_FN),
4109 KEY(10, 5, KEY_9),
4110 KEY(10, 6, KEY_0),
4111 KEY(10, 7, KEY_DOT),
4112
4113 KEY(11, 0, KEY_LEFTCTRL),
4114 KEY(11, 1, KEY_F11),
4115 KEY(11, 2, KEY_ENTER),
4116 KEY(11, 3, KEY_SEARCH),
4117 KEY(11, 4, KEY_DELETE),
4118 KEY(11, 5, KEY_RIGHT),
4119 KEY(11, 6, KEY_LEFT),
4120 KEY(11, 7, KEY_RIGHTSHIFT),
4121 KEY(0, 0, KEY_VOLUMEUP),
4122 KEY(0, 1, KEY_VOLUMEDOWN),
4123 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4124 KEY(0, 3, KEY_CAMERA_FOCUS),
4125};
4126
4127static struct matrix_keymap_data keymap_data_sim = {
4128 .keymap_size = ARRAY_SIZE(keymap_sim),
4129 .keymap = keymap_sim,
4130};
4131
4132static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4133 .input_name = "keypad_8960",
4134 .input_phys_device = "keypad_8960/input0",
4135 .num_rows = 12,
4136 .num_cols = 8,
4137 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4138 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4139 .debounce_ms = 15,
4140 .scan_delay_ms = 32,
4141 .row_hold_ns = 91500,
4142 .wakeup = 1,
4143 .keymap_data = &keymap_data_sim,
4144};
4145
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004146static int pm8921_therm_mitigation[] = {
4147 1100,
4148 700,
4149 600,
4150 325,
4151};
4152
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004153static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004154 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004155 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004156 .max_voltage = 4200,
4157 .min_voltage = 3200,
4158 .resume_voltage = 4100,
4159 .term_current = 100,
4160 .cool_temp = 10,
4161 .warm_temp = 40,
4162 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004163 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004164 .cool_bat_chg_current = 350,
4165 .warm_bat_chg_current = 350,
4166 .cool_bat_voltage = 4100,
4167 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004168 .thermal_mitigation = pm8921_therm_mitigation,
4169 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004170};
4171
4172static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4173 .priority = 0,
4174};
4175
4176static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4177 .r_sense = 10,
4178 .i_test = 2500,
4179 .v_failure = 3000,
4180 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004181};
4182
Jay Chokshide4cefb2011-08-04 18:10:44 -07004183#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004184#define PM8XXX_LED_PWM_PERIOD 1000
4185#define PM8XXX_LED_PWM_DUTY_MS 20
4186/**
4187 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4188 * driven using PWM feature.
4189 */
4190#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004191
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004192static struct led_info pm8921_led_info[] = {
4193 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004194 .name = "led:battery_charging",
4195 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004196 },
4197 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004198 .name = "led:battery_full",
4199 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004200 },
4201};
4202
Jay Chokshi8994e392011-09-14 18:20:39 -07004203static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004204 .num_leds = ARRAY_SIZE(pm8921_led_info),
4205 .leds = pm8921_led_info,
4206};
4207
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004208static int pm8921_led0_pwm_duty_pcts[56] = {
4209 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4210 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4211 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4212 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4213 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4214 14, 10, 6, 4, 1
4215};
4216
4217static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4218 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4219 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4220 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4221 .start_idx = 0,
4222};
4223
Jay Chokshi8994e392011-09-14 18:20:39 -07004224static struct pm8xxx_led_config pm8921_led_configs[] = {
4225 [0] = {
4226 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004227 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004228 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004229 .pwm_channel = 5,
4230 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4231 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004232 },
4233 [1] = {
4234 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004235 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004236 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004237 .pwm_channel = 4,
4238 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004239 },
4240};
4241
4242static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4243 .led_core = &pm8921_led_core_pdata,
4244 .configs = pm8921_led_configs,
4245 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4246};
4247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004248static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4249 .irq_pdata = &pm8xxx_irq_pdata,
4250 .gpio_pdata = &pm8xxx_gpio_pdata,
4251 .mpp_pdata = &pm8xxx_mpp_pdata,
4252 .rtc_pdata = &pm8xxx_rtc_pdata,
4253 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4254 .keypad_pdata = &keypad_data,
4255 .misc_pdata = &pm8xxx_misc_pdata,
4256 .regulator_pdatas = msm_pm8921_regulator_pdata,
4257 .charger_pdata = &pm8921_chg_pdata,
4258 .bms_pdata = &pm8921_bms_pdata,
4259 .adc_pdata = &pm8921_adc_pdata,
4260 .leds_pdata = &pm8xxx_leds_pdata,
4261};
4262
4263static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4264 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4265 .slave = {
4266 .name = "pm8921-core",
4267 .platform_data = &pm8921_platform_data,
4268 },
4269};
4270
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004271static struct msm_cpuidle_state msm_cstates[] __initdata = {
4272 {0, 0, "C0", "WFI",
4273 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4274
4275 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4276 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4277
4278 {0, 2, "C2", "POWER_COLLAPSE",
4279 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4280
4281 {1, 0, "C0", "WFI",
4282 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4283
4284 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4285 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4286};
4287
4288static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4289 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4290 .idle_supported = 1,
4291 .suspend_supported = 1,
4292 .idle_enabled = 0,
4293 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004294 },
4295
4296 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4297 .idle_supported = 1,
4298 .suspend_supported = 1,
4299 .idle_enabled = 0,
4300 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004301 },
4302
4303 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4304 .idle_supported = 1,
4305 .suspend_supported = 1,
4306 .idle_enabled = 1,
4307 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004308 },
4309
4310 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4311 .idle_supported = 0,
4312 .suspend_supported = 1,
4313 .idle_enabled = 0,
4314 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004315 },
4316
4317 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4318 .idle_supported = 1,
4319 .suspend_supported = 1,
4320 .idle_enabled = 0,
4321 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004322 },
4323
4324 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4325 .idle_supported = 1,
4326 .suspend_supported = 0,
4327 .idle_enabled = 1,
4328 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004329 },
4330};
4331
4332static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4333 {
4334 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4335 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4336 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004337 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004338 },
4339
4340 {
4341 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4342 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4343 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004344 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004345 },
4346
4347 {
4348 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4349 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4350 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004351 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004352 },
4353
4354 {
4355 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4356 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4357 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004358 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004359 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004360 {
4361 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4362 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4363 false,
4364 7000, 3500, 66600000, 5150,
4365 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004366
4367 {
4368 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4369 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4370 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004371 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004372 },
4373
4374 {
4375 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4376 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4377 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004378 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004379 },
4380
4381 {
4382 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4383 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4384 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004385 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004386 },
4387
4388 {
4389 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4390 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4391 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004392 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004393 },
4394};
4395
4396#ifdef CONFIG_I2C
4397#define I2C_SURF 1
4398#define I2C_FFA (1 << 1)
4399#define I2C_RUMI (1 << 2)
4400#define I2C_SIM (1 << 3)
4401#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004402#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004403
4404struct i2c_registry {
4405 u8 machs;
4406 int bus;
4407 struct i2c_board_info *info;
4408 int len;
4409};
4410
4411#ifdef CONFIG_MSM_CAMERA
4412static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4413#ifdef CONFIG_IMX074
4414 {
4415 I2C_BOARD_INFO("imx074", 0x1A),
4416 },
4417#endif
4418#ifdef CONFIG_OV2720
4419 {
4420 I2C_BOARD_INFO("ov2720", 0x6C),
4421 },
4422#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004423 {
4424 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4425 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304426#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4427 {
4428 I2C_BOARD_INFO("sc628a", 0x6E),
4429 },
4430#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004431};
4432#endif
4433
4434/* Sensors DSPS platform data */
4435#ifdef CONFIG_MSM_DSPS
4436#define DSPS_PIL_GENERIC_NAME "dsps"
4437#endif /* CONFIG_MSM_DSPS */
4438
4439static void __init msm8960_init_dsps(void)
4440{
4441#ifdef CONFIG_MSM_DSPS
4442 struct msm_dsps_platform_data *pdata =
4443 msm_dsps_device.dev.platform_data;
4444 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4445 pdata->gpios = NULL;
4446 pdata->gpios_num = 0;
4447
4448 platform_device_register(&msm_dsps_device);
4449#endif /* CONFIG_MSM_DSPS */
4450}
4451
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004452static void __init msm8960_init_hsic(void)
4453{
4454#ifdef CONFIG_USB_EHCI_MSM_HSIC
4455 uint32_t version = socinfo_get_version();
4456
4457 pr_info("%s: version:%d mtp:%d\n", __func__,
4458 SOCINFO_VERSION_MAJOR(version),
4459 machine_is_msm8960_mtp());
4460
4461 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4462 machine_is_msm8960_mtp() ||
4463 machine_is_msm8960_fluid())
4464 return;
4465
4466 msm_gpiomux_install(msm8960_hsic_configs,
4467 ARRAY_SIZE(msm8960_hsic_configs));
4468
4469 platform_device_register(&msm_device_hsic_host);
4470#endif
4471}
4472
4473
Amir Samuelov5137e392011-09-21 17:31:25 +03004474#ifdef CONFIG_ISL9519_CHARGER
4475static struct isl_platform_data isl_data __initdata = {
4476 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4477 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4478 .max_system_voltage = 4200,
4479 .min_system_voltage = 3200,
4480 .chgcurrent = 1000, /* 1900, */
4481 .term_current = 400, /* Need fine tuning */
4482 .input_current = 2048,
4483};
4484
4485static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4486 {
4487 I2C_BOARD_INFO("isl9519q", 0x9),
4488 .irq = 0, /* Not required when notify-by-pmic */
4489 .platform_data = &isl_data,
4490 },
4491};
4492#endif /* CONFIG_ISL9519_CHARGER */
4493
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004494static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4495#ifdef CONFIG_MSM_CAMERA
4496 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004497 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004498 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4499 msm_camera_boardinfo,
4500 ARRAY_SIZE(msm_camera_boardinfo),
4501 },
4502#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004503#ifdef CONFIG_ISL9519_CHARGER
4504 {
4505 I2C_LIQUID,
4506 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4507 isl_charger_i2c_info,
4508 ARRAY_SIZE(isl_charger_i2c_info),
4509 },
4510#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004511 {
4512 I2C_SURF | I2C_FFA | I2C_FLUID,
4513 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4514 cyttsp_info,
4515 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004516 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304517 {
4518 I2C_LIQUID,
4519 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4520 mxt_device_info,
4521 ARRAY_SIZE(mxt_device_info),
4522 },
4523
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004524};
4525#endif /* CONFIG_I2C */
4526
4527static void __init register_i2c_devices(void)
4528{
4529#ifdef CONFIG_I2C
4530 u8 mach_mask = 0;
4531 int i;
4532
4533 /* Build the matching 'supported_machs' bitmask */
4534 if (machine_is_msm8960_cdp())
4535 mach_mask = I2C_SURF;
4536 else if (machine_is_msm8960_rumi3())
4537 mach_mask = I2C_RUMI;
4538 else if (machine_is_msm8960_sim())
4539 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004540 else if (machine_is_msm8960_fluid())
4541 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004542 else if (machine_is_msm8960_liquid())
4543 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004544 else if (machine_is_msm8960_mtp())
4545 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004546 else
4547 pr_err("unmatched machine ID in register_i2c_devices\n");
4548
4549 /* Run the array and install devices as appropriate */
4550 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4551 if (msm8960_i2c_devices[i].machs & mach_mask)
4552 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4553 msm8960_i2c_devices[i].info,
4554 msm8960_i2c_devices[i].len);
4555 }
4556#endif
4557}
4558
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004559static void __init msm8960_sim_init(void)
4560{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004561 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4562 &msm8960_device_watchdog.dev.platform_data;
4563
4564 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004565 BUG_ON(msm_rpm_init(&msm_rpm_data));
4566 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4567 ARRAY_SIZE(msm_rpmrs_levels)));
4568 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004569 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004570 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004571 msm8960_device_ssbi_pm8921.dev.platform_data =
4572 &msm8960_ssbi_pm8921_pdata;
4573 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004574
4575 /* Simulator supports a QWERTY keypad */
4576 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4577
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004578 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4579 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4580 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004581 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004582 msm8960_i2c_init();
4583 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4584 msm_spm_l2_init(msm_spm_l2_data);
4585 msm8960_init_buses();
4586 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4587 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004588 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004589 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004590
4591 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4592 &msm8960_qup_spi_gsbi1_pdata;
4593 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4594
4595 msm8960_init_mmc();
4596 msm_fb_add_devices();
4597 slim_register_board_info(msm_slim_devices,
4598 ARRAY_SIZE(msm_slim_devices));
4599 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4600 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4601 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4602 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004603 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004604}
4605
4606static void __init msm8960_rumi3_init(void)
4607{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004608 BUG_ON(msm_rpm_init(&msm_rpm_data));
4609 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4610 ARRAY_SIZE(msm_rpmrs_levels)));
4611 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004612 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004613 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004614 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004615 msm8960_device_ssbi_pm8921.dev.platform_data =
4616 &msm8960_ssbi_pm8921_pdata;
4617 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4618 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4619 &msm8960_qup_spi_gsbi1_pdata;
4620 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4621 msm8960_i2c_init();
4622 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4623 msm_spm_l2_init(msm_spm_l2_data);
4624 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4625 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004626 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004627 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004628 register_i2c_devices();
4629 msm_fb_add_devices();
4630 slim_register_board_info(msm_slim_devices,
4631 ARRAY_SIZE(msm_slim_devices));
4632 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4633 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4634 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4635 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004636 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004637}
4638
4639static void __init msm8960_cdp_init(void)
4640{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004641 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4642 pr_err("meminfo_init() failed!\n");
4643
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004644 BUG_ON(msm_rpm_init(&msm_rpm_data));
4645 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4646 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004647
4648 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004649 regulator_suppress_info_printing();
4650 if (msm_xo_init())
4651 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004652 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004653 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304654 if (machine_is_msm8960_liquid())
4655 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004656 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4657 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4658 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304659#ifdef CONFIG_USB_EHCI_MSM_HSIC
4660 if (machine_is_msm8960_liquid()) {
4661 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4662 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4663 }
4664#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304665 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004666 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304667 if (machine_is_msm8960_liquid())
4668 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004669 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4670 &msm8960_qup_spi_gsbi1_pdata;
4671 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4672 msm8960_device_ssbi_pm8921.dev.platform_data =
4673 &msm8960_ssbi_pm8921_pdata;
4674 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4675 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004676 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004677 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4678 msm_spm_l2_init(msm_spm_l2_data);
4679 msm8960_init_buses();
4680 platform_add_devices(msm_footswitch_devices,
4681 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004682 if (machine_is_msm8960_liquid())
4683 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004684 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4685 pm8921_gpio_mpp_init();
4686 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004687 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004688 msm8960_init_cam();
4689 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004690 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304691 if (machine_is_msm8960_liquid())
4692 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004693 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004694 msm_fb_add_devices();
4695 slim_register_board_info(msm_slim_devices,
4696 ARRAY_SIZE(msm_slim_devices));
4697 msm8960_init_dsps();
4698 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4699 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4700 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4701 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004702 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004703 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004704}
4705
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004706MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4707 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004708 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004709 .init_irq = msm8960_init_irq,
4710 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004711 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004712 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004713 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004714MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004715
4716MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4717 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004718 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004719 .init_irq = msm8960_init_irq,
4720 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004721 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004722 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004723 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004724MACHINE_END
4725
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004726MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4727 .map_io = msm8960_map_io,
4728 .reserve = msm8960_reserve,
4729 .init_irq = msm8960_init_irq,
4730 .timer = &msm_timer,
4731 .init_machine = msm8960_cdp_init,
4732 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004733 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004734MACHINE_END
4735
4736MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4737 .map_io = msm8960_map_io,
4738 .reserve = msm8960_reserve,
4739 .init_irq = msm8960_init_irq,
4740 .timer = &msm_timer,
4741 .init_machine = msm8960_cdp_init,
4742 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004743 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004744MACHINE_END
4745
4746MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4747 .map_io = msm8960_map_io,
4748 .reserve = msm8960_reserve,
4749 .init_irq = msm8960_init_irq,
4750 .timer = &msm_timer,
4751 .init_machine = msm8960_cdp_init,
4752 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004753 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004754MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004755
4756MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4757 .map_io = msm8960_map_io,
4758 .reserve = msm8960_reserve,
4759 .init_irq = msm8960_init_irq,
4760 .timer = &msm_timer,
4761 .init_machine = msm8960_cdp_init,
4762 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004763 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004764MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004765
4766#ifdef CONFIG_ARCH_MSM8930
4767MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4768 .map_io = msm8930_map_io,
4769 .reserve = msm8960_reserve,
4770 .init_irq = msm8960_init_irq,
4771 .timer = &msm_timer,
4772 .init_machine = msm8960_cdp_init,
4773 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004774 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004775MACHINE_END
4776
4777MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4778 .map_io = msm8930_map_io,
4779 .reserve = msm8960_reserve,
4780 .init_irq = msm8960_init_irq,
4781 .timer = &msm_timer,
4782 .init_machine = msm8960_cdp_init,
4783 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004784 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004785MACHINE_END
4786
4787MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4788 .map_io = msm8930_map_io,
4789 .reserve = msm8960_reserve,
4790 .init_irq = msm8960_init_irq,
4791 .timer = &msm_timer,
4792 .init_machine = msm8960_cdp_init,
4793 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004794 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004795MACHINE_END
4796#endif