blob: 7448cc62fd7a580992ca0bfe43078952edd6f065 [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
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002071#ifdef CONFIG_MSM_BUS_SCALING
2072static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2073 {
2074 .src = MSM_BUS_MASTER_MDP_PORT0,
2075 .dst = MSM_BUS_SLAVE_EBI_CH0,
2076 .ab = 0,
2077 .ib = 0,
2078 },
2079};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002080
2081#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2082static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2083 {
2084 .src = MSM_BUS_MASTER_MDP_PORT0,
2085 .dst = MSM_BUS_SLAVE_EBI_CH0,
2086 .ab = 2000000000,
2087 .ib = 2000000000,
2088 },
2089};
2090#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002091static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2092 {
2093 .src = MSM_BUS_MASTER_MDP_PORT0,
2094 .dst = MSM_BUS_SLAVE_EBI_CH0,
2095 .ab = 566092800 * 2,
2096 .ib = 707616000 * 2,
2097 },
2098};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002099#endif
2100
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002101static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2102 {
2103 ARRAY_SIZE(dtv_bus_init_vectors),
2104 dtv_bus_init_vectors,
2105 },
2106 {
2107 ARRAY_SIZE(dtv_bus_def_vectors),
2108 dtv_bus_def_vectors,
2109 },
2110};
2111static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2112 dtv_bus_scale_usecases,
2113 ARRAY_SIZE(dtv_bus_scale_usecases),
2114 .name = "dtv",
2115};
2116
2117static struct lcdc_platform_data dtv_pdata = {
2118 .bus_scale_table = &dtv_bus_scale_pdata,
2119};
2120#endif
2121
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122static void __init msm_fb_add_devices(void)
2123{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002124 struct platform_device *ptr = NULL;
2125
2126 if (machine_is_msm8960_liquid())
2127 ptr = &mipi_dsi2lvds_bridge_device;
2128 else
2129 ptr = &mipi_dsi_toshiba_panel_device;
2130 platform_add_devices(&ptr, 1);
2131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002132 if (machine_is_msm8x60_rumi3()) {
2133 msm_fb_register_device("mdp", NULL);
2134 mipi_dsi_pdata.target_type = 1;
2135 } else
2136 msm_fb_register_device("mdp", &mdp_pdata);
2137 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002138#ifdef CONFIG_MSM_BUS_SCALING
2139 msm_fb_register_device("dtv", &dtv_pdata);
2140#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002141}
2142
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002143static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2144 .func = GPIOMUX_FUNC_GPIO,
2145 .drv = GPIOMUX_DRV_2MA,
2146 .pull = GPIOMUX_PULL_DOWN,
2147};
2148
2149static struct gpiomux_setting mdp_vsync_active_cfg = {
2150 .func = GPIOMUX_FUNC_1,
2151 .drv = GPIOMUX_DRV_2MA,
2152 .pull = GPIOMUX_PULL_DOWN,
2153};
2154
2155static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2156 {
2157 .gpio = MDP_VSYNC_GPIO,
2158 .settings = {
2159 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2160 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2161 },
2162 }
2163};
2164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002165#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2166static struct gpiomux_setting hdmi_suspend_cfg = {
2167 .func = GPIOMUX_FUNC_GPIO,
2168 .drv = GPIOMUX_DRV_2MA,
2169 .pull = GPIOMUX_PULL_DOWN,
2170};
2171
2172static struct gpiomux_setting hdmi_active_1_cfg = {
2173 .func = GPIOMUX_FUNC_1,
2174 .drv = GPIOMUX_DRV_2MA,
2175 .pull = GPIOMUX_PULL_UP,
2176};
2177
2178static struct gpiomux_setting hdmi_active_2_cfg = {
2179 .func = GPIOMUX_FUNC_1,
2180 .drv = GPIOMUX_DRV_2MA,
2181 .pull = GPIOMUX_PULL_DOWN,
2182};
2183
2184static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2185 {
2186 .gpio = 99,
2187 .settings = {
2188 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2189 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2190 },
2191 },
2192 {
2193 .gpio = 100,
2194 .settings = {
2195 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2196 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2197 },
2198 },
2199 {
2200 .gpio = 101,
2201 .settings = {
2202 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2203 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2204 },
2205 },
2206 {
2207 .gpio = 102,
2208 .settings = {
2209 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2210 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2211 },
2212 },
2213};
2214
2215static int hdmi_enable_5v(int on)
2216{
2217 /* TBD: PM8921 regulator instead of 8901 */
2218 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2219 static int prev_on;
2220 int rc;
2221
2222 if (on == prev_on)
2223 return 0;
2224
2225 if (!reg_8921_hdmi_mvs)
2226 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2227 "hdmi_mvs");
2228
2229 if (on) {
2230 rc = regulator_enable(reg_8921_hdmi_mvs);
2231 if (rc) {
2232 pr_err("'%s' regulator enable failed, rc=%d\n",
2233 "8921_hdmi_mvs", rc);
2234 return rc;
2235 }
2236 pr_debug("%s(on): success\n", __func__);
2237 } else {
2238 rc = regulator_disable(reg_8921_hdmi_mvs);
2239 if (rc)
2240 pr_warning("'%s' regulator disable failed, rc=%d\n",
2241 "8921_hdmi_mvs", rc);
2242 pr_debug("%s(off): success\n", __func__);
2243 }
2244
2245 prev_on = on;
2246
2247 return 0;
2248}
2249
2250static int hdmi_core_power(int on, int show)
2251{
2252 static struct regulator *reg_8921_l23, *reg_8921_s4;
2253 static int prev_on;
2254 int rc;
2255
2256 if (on == prev_on)
2257 return 0;
2258
2259 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002260 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002261 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002262 if (IS_ERR(reg_8921_l23)) {
2263 pr_err("could not get reg_8921_l23, rc = %ld\n",
2264 PTR_ERR(reg_8921_l23));
2265 return -ENODEV;
2266 }
2267 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2268 if (rc) {
2269 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2270 return -EINVAL;
2271 }
2272 }
2273 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002275 if (IS_ERR(reg_8921_s4)) {
2276 pr_err("could not get reg_8921_s4, rc = %ld\n",
2277 PTR_ERR(reg_8921_s4));
2278 return -ENODEV;
2279 }
2280 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2281 if (rc) {
2282 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2283 return -EINVAL;
2284 }
2285 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002286
2287 if (on) {
2288 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2289 if (rc < 0) {
2290 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2291 return -EINVAL;
2292 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002293 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294 if (rc) {
2295 pr_err("'%s' regulator enable failed, rc=%d\n",
2296 "hdmi_avdd", rc);
2297 return rc;
2298 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002299 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002300 if (rc) {
2301 pr_err("'%s' regulator enable failed, rc=%d\n",
2302 "hdmi_vcc", rc);
2303 return rc;
2304 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002305 rc = gpio_request(100, "HDMI_DDC_CLK");
2306 if (rc) {
2307 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2308 "HDMI_DDC_CLK", 100, rc);
2309 goto error1;
2310 }
2311 rc = gpio_request(101, "HDMI_DDC_DATA");
2312 if (rc) {
2313 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2314 "HDMI_DDC_DATA", 101, rc);
2315 goto error2;
2316 }
2317 rc = gpio_request(102, "HDMI_HPD");
2318 if (rc) {
2319 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2320 "HDMI_HPD", 102, rc);
2321 goto error3;
2322 }
2323 pr_debug("%s(on): success\n", __func__);
2324 } else {
2325 gpio_free(100);
2326 gpio_free(101);
2327 gpio_free(102);
2328
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002329 rc = regulator_disable(reg_8921_l23);
2330 if (rc) {
2331 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2332 return -ENODEV;
2333 }
2334 rc = regulator_disable(reg_8921_s4);
2335 if (rc) {
2336 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2337 return -ENODEV;
2338 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002339 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2340 if (rc < 0) {
2341 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2342 return -EINVAL;
2343 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002344 pr_debug("%s(off): success\n", __func__);
2345 }
2346
2347 prev_on = on;
2348
2349 return 0;
2350
2351error3:
2352 gpio_free(101);
2353error2:
2354 gpio_free(100);
2355error1:
2356 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002357 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358 return rc;
2359}
2360
2361static int hdmi_cec_power(int on)
2362{
2363 static int prev_on;
2364 int rc;
2365
2366 if (on == prev_on)
2367 return 0;
2368
2369 if (on) {
2370 rc = gpio_request(99, "HDMI_CEC_VAR");
2371 if (rc) {
2372 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2373 "HDMI_CEC_VAR", 99, rc);
2374 goto error;
2375 }
2376 pr_debug("%s(on): success\n", __func__);
2377 } else {
2378 gpio_free(99);
2379 pr_debug("%s(off): success\n", __func__);
2380 }
2381
2382 prev_on = on;
2383
2384 return 0;
2385error:
2386 return rc;
2387}
2388#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2389
2390static void __init msm8960_allocate_memory_regions(void)
2391{
2392 void *addr;
2393 unsigned long size;
2394
2395 size = MSM_FB_SIZE;
2396 addr = alloc_bootmem_align(size, 0x1000);
2397 msm_fb_resources[0].start = __pa(addr);
2398 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2399 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2400 size, addr, __pa(addr));
2401
2402}
2403#ifdef CONFIG_WCD9310_CODEC
2404
2405#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2406
Patrick Lai3043fba2011-08-01 14:15:57 -07002407/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2408 * 4 micbiases are used to power various analog and digital
2409 * microphones operating at 1800 mV. Technically, all micbiases
2410 * can source from single cfilter since all microphones operate
2411 * at the same voltage level. The arrangement below is to make
2412 * sure all cfilters are exercised. LDO_H regulator ouput level
2413 * does not need to be as high as 2.85V. It is choosen for
2414 * microphone sensitivity purpose.
2415 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002416static struct tabla_pdata tabla_platform_data = {
2417 .slimbus_slave_device = {
2418 .name = "tabla-slave",
2419 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2420 },
2421 .irq = MSM_GPIO_TO_INT(62),
2422 .irq_base = TABLA_INTERRUPT_BASE,
2423 .num_irqs = NR_TABLA_IRQS,
2424 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002425 .micbias = {
2426 .ldoh_v = TABLA_LDOH_2P85_V,
2427 .cfilt1_mv = 1800,
2428 .cfilt2_mv = 1800,
2429 .cfilt3_mv = 1800,
2430 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2431 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2432 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2433 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2434 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002435};
2436
2437static struct slim_device msm_slim_tabla = {
2438 .name = "tabla-slim",
2439 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2440 .dev = {
2441 .platform_data = &tabla_platform_data,
2442 },
2443};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302444
2445static struct tabla_pdata tabla20_platform_data = {
2446 .slimbus_slave_device = {
2447 .name = "tabla-slave",
2448 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2449 },
2450 .irq = MSM_GPIO_TO_INT(62),
2451 .irq_base = TABLA_INTERRUPT_BASE,
2452 .num_irqs = NR_TABLA_IRQS,
2453 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2454 .micbias = {
2455 .ldoh_v = TABLA_LDOH_2P85_V,
2456 .cfilt1_mv = 1800,
2457 .cfilt2_mv = 1800,
2458 .cfilt3_mv = 1800,
2459 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2460 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2461 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2462 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2463 }
2464};
2465
2466static struct slim_device msm_slim_tabla20 = {
2467 .name = "tabla2x-slim",
2468 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2469 .dev = {
2470 .platform_data = &tabla20_platform_data,
2471 },
2472};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473#endif
2474
2475static struct slim_boardinfo msm_slim_devices[] = {
2476#ifdef CONFIG_WCD9310_CODEC
2477 {
2478 .bus_num = 1,
2479 .slim_slave = &msm_slim_tabla,
2480 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302481 {
2482 .bus_num = 1,
2483 .slim_slave = &msm_slim_tabla20,
2484 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002485#endif
2486 /* add more slimbus slaves as needed */
2487};
2488
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002489#define MSM_WCNSS_PHYS 0x03000000
2490#define MSM_WCNSS_SIZE 0x280000
2491
2492static struct resource resources_wcnss_wlan[] = {
2493 {
2494 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2495 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2496 .name = "wcnss_wlanrx_irq",
2497 .flags = IORESOURCE_IRQ,
2498 },
2499 {
2500 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2501 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2502 .name = "wcnss_wlantx_irq",
2503 .flags = IORESOURCE_IRQ,
2504 },
2505 {
2506 .start = MSM_WCNSS_PHYS,
2507 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2508 .name = "wcnss_mmio",
2509 .flags = IORESOURCE_MEM,
2510 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002511 {
2512 .start = 84,
2513 .end = 88,
2514 .name = "wcnss_gpios_5wire",
2515 .flags = IORESOURCE_IO,
2516 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002517};
2518
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002519static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2520 .has_48mhz_xo = 1,
2521};
2522
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002523static struct platform_device msm_device_wcnss_wlan = {
2524 .name = "wcnss_wlan",
2525 .id = 0,
2526 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2527 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002528 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002529};
2530
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002531#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2532 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2533 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2534 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2535
2536#define QCE_SIZE 0x10000
2537#define QCE_0_BASE 0x18500000
2538
2539#define QCE_HW_KEY_SUPPORT 0
2540#define QCE_SHA_HMAC_SUPPORT 1
2541#define QCE_SHARE_CE_RESOURCE 1
2542#define QCE_CE_SHARED 0
2543
2544static struct resource qcrypto_resources[] = {
2545 [0] = {
2546 .start = QCE_0_BASE,
2547 .end = QCE_0_BASE + QCE_SIZE - 1,
2548 .flags = IORESOURCE_MEM,
2549 },
2550 [1] = {
2551 .name = "crypto_channels",
2552 .start = DMOV_CE_IN_CHAN,
2553 .end = DMOV_CE_OUT_CHAN,
2554 .flags = IORESOURCE_DMA,
2555 },
2556 [2] = {
2557 .name = "crypto_crci_in",
2558 .start = DMOV_CE_IN_CRCI,
2559 .end = DMOV_CE_IN_CRCI,
2560 .flags = IORESOURCE_DMA,
2561 },
2562 [3] = {
2563 .name = "crypto_crci_out",
2564 .start = DMOV_CE_OUT_CRCI,
2565 .end = DMOV_CE_OUT_CRCI,
2566 .flags = IORESOURCE_DMA,
2567 },
2568};
2569
2570static struct resource qcedev_resources[] = {
2571 [0] = {
2572 .start = QCE_0_BASE,
2573 .end = QCE_0_BASE + QCE_SIZE - 1,
2574 .flags = IORESOURCE_MEM,
2575 },
2576 [1] = {
2577 .name = "crypto_channels",
2578 .start = DMOV_CE_IN_CHAN,
2579 .end = DMOV_CE_OUT_CHAN,
2580 .flags = IORESOURCE_DMA,
2581 },
2582 [2] = {
2583 .name = "crypto_crci_in",
2584 .start = DMOV_CE_IN_CRCI,
2585 .end = DMOV_CE_IN_CRCI,
2586 .flags = IORESOURCE_DMA,
2587 },
2588 [3] = {
2589 .name = "crypto_crci_out",
2590 .start = DMOV_CE_OUT_CRCI,
2591 .end = DMOV_CE_OUT_CRCI,
2592 .flags = IORESOURCE_DMA,
2593 },
2594};
2595
2596#endif
2597
2598#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2599 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2600
2601static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2602 .ce_shared = QCE_CE_SHARED,
2603 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2604 .hw_key_support = QCE_HW_KEY_SUPPORT,
2605 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2606};
2607
2608static struct platform_device qcrypto_device = {
2609 .name = "qcrypto",
2610 .id = 0,
2611 .num_resources = ARRAY_SIZE(qcrypto_resources),
2612 .resource = qcrypto_resources,
2613 .dev = {
2614 .coherent_dma_mask = DMA_BIT_MASK(32),
2615 .platform_data = &qcrypto_ce_hw_suppport,
2616 },
2617};
2618#endif
2619
2620#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2621 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2622
2623static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2624 .ce_shared = QCE_CE_SHARED,
2625 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2626 .hw_key_support = QCE_HW_KEY_SUPPORT,
2627 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2628};
2629
2630static struct platform_device qcedev_device = {
2631 .name = "qce",
2632 .id = 0,
2633 .num_resources = ARRAY_SIZE(qcedev_resources),
2634 .resource = qcedev_resources,
2635 .dev = {
2636 .coherent_dma_mask = DMA_BIT_MASK(32),
2637 .platform_data = &qcedev_ce_hw_suppport,
2638 },
2639};
2640#endif
2641
2642
2643static int __init gpiomux_init(void)
2644{
2645 int rc;
2646
2647 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2648 if (rc) {
2649 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2650 return rc;
2651 }
2652
Nishant Pandit24153d82011-08-27 16:05:13 +05302653 msm_gpiomux_install(msm8960_cam_common_configs,
2654 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002655
2656 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002657 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658
2659 msm_gpiomux_install(msm8960_gsbi_configs,
2660 ARRAY_SIZE(msm8960_gsbi_configs));
2661
2662 msm_gpiomux_install(msm8960_cyts_configs,
2663 ARRAY_SIZE(msm8960_cyts_configs));
2664
2665 msm_gpiomux_install(msm8960_slimbus_config,
2666 ARRAY_SIZE(msm8960_slimbus_config));
2667
2668 msm_gpiomux_install(msm8960_audio_codec_configs,
2669 ARRAY_SIZE(msm8960_audio_codec_configs));
2670
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002671 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2672 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2673
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002674#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2675 msm_gpiomux_install(msm8960_hdmi_configs,
2676 ARRAY_SIZE(msm8960_hdmi_configs));
2677#endif
2678
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002679 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2680 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002682 msm_gpiomux_install(wcnss_5wire_interface,
2683 ARRAY_SIZE(wcnss_5wire_interface));
2684
2685 return 0;
2686}
2687
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002688#define MSM_SHARED_RAM_PHYS 0x80000000
2689
2690static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2691 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2692 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2693 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2694 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2695 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2696 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2697 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2698 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2699 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2700 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2701 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2702 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002703 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2704 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2705 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2706 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2707 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2708 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2709 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2710 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2711 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2712 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2713 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2714 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2715 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2716 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002717 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002718 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2719 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2720 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002721 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2722 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002723};
2724
2725static struct pm8921_adc_properties pm8921_adc_data = {
2726 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2727 .bitresolution = 15,
2728 .bipolar = 0,
2729};
2730
2731static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2732 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002733 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002734 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002735 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002736};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002737
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002738static void __init msm8960_map_io(void)
2739{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002741 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002742
2743 if (socinfo_init() < 0)
2744 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002745}
2746
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002747#ifdef CONFIG_ARCH_MSM8930
2748static void __init msm8930_map_io(void)
2749{
2750 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2751 msm_map_msm8930_io();
2752
2753 if (socinfo_init() < 0)
2754 pr_err("socinfo_init() failed!\n");
2755}
2756#endif
2757
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002758static void __init msm8960_init_irq(void)
2759{
2760 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002761
2762 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002763 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002764 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002765
2766 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002767 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002768
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002769 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2770 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002771
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002772 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2773 * as they are configured as level, which does not play nice with
2774 * handle_percpu_irq.
2775 */
2776 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2777 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002778 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002779 }
2780}
2781
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002782/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002783enum sdcc_controllers {
2784 SDCC1,
2785 SDCC2,
2786 SDCC3,
2787 SDCC4,
2788 SDCC5,
2789 MAX_SDCC_CONTROLLER
2790};
2791
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002792/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002793static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2794 /* SDCC1 : eMMC card connected */
2795 [SDCC1] = {
2796 .name = "sdc_vdd",
2797 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302798 .high_vol_level = 2950000,
2799 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302800 .always_on = 1,
2801 .lpm_sup = 1,
2802 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002803 .hpm_uA = 200000, /* 200mA */
2804 },
2805 /* SDCC3 : External card slot connected */
2806 [SDCC3] = {
2807 .name = "sdc_vdd",
2808 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302809 .high_vol_level = 2950000,
2810 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811 .hpm_uA = 600000, /* 600mA */
2812 }
2813};
2814
2815/* Only slots having eMMC card will require VCCQ voltage */
2816static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2817 /* SDCC1 : eMMC card connected */
2818 [SDCC1] = {
2819 .name = "sdc_vccq",
2820 .set_voltage_sup = 1,
2821 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302822 .high_vol_level = 1800000,
2823 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 .hpm_uA = 200000, /* 200mA */
2825 }
2826};
2827
2828/* All SDCC controllers may require voting for VDD PAD voltage */
2829static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2830 /* SDCC3 : External card slot connected */
2831 [SDCC3] = {
2832 .name = "sdc_vddp",
2833 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302834 .high_vol_level = 2950000,
2835 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836 .always_on = 1,
2837 .lpm_sup = 1,
2838 /* Max. Active current required is 16 mA */
2839 .hpm_uA = 16000,
2840 /*
2841 * Sleep current required is ~300 uA. But min. vote can be
2842 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2843 * during sleep.
2844 */
2845 .lpm_uA = 2000,
2846 }
2847};
2848
2849static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2850 /* SDCC1 : eMMC card connected */
2851 [SDCC1] = {
2852 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2853 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2854 },
2855 /* SDCC3 : External card slot connected */
2856 [SDCC3] = {
2857 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2858 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2859 }
2860};
2861
2862/* SDC1 pad data */
2863static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2864 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302865 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2866 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867};
2868
2869static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2870 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2871 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2872 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2873};
2874
2875static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302876 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002877 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2878 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2879};
2880
2881static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302882 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2884 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2885};
2886
2887/* SDC3 pad data */
2888static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2889 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2890 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2891 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2892};
2893
2894static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2895 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2896 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2897 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2898};
2899
2900static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302901 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002902 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2903 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2904};
2905
2906static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302907 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302908 /*
2909 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2910 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2911 * which would result in false card detection interrupts.
2912 */
2913 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2914 /*
2915 * Keeping DATA lines status to PULL UP will make sure that
2916 * there is no current leak during sleep if external pull up
2917 * is connected to DATA lines.
2918 */
2919 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002920};
2921
2922struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2923 [SDCC1] = {
2924 .on = sdc1_pad_pull_on_cfg,
2925 .off = sdc1_pad_pull_off_cfg,
2926 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2927 },
2928 [SDCC3] = {
2929 .on = sdc3_pad_pull_on_cfg,
2930 .off = sdc3_pad_pull_off_cfg,
2931 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2932 },
2933};
2934
2935struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2936 [SDCC1] = {
2937 .on = sdc1_pad_drv_on_cfg,
2938 .off = sdc1_pad_drv_off_cfg,
2939 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2940 },
2941 [SDCC3] = {
2942 .on = sdc3_pad_drv_on_cfg,
2943 .off = sdc3_pad_drv_off_cfg,
2944 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2945 },
2946};
2947
2948struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2949 [SDCC1] = {
2950 .pull = &mmc_pad_pull_data[SDCC1],
2951 .drv = &mmc_pad_drv_data[SDCC1]
2952 },
2953 [SDCC3] = {
2954 .pull = &mmc_pad_pull_data[SDCC3],
2955 .drv = &mmc_pad_drv_data[SDCC3]
2956 },
2957};
2958
2959struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2960 [SDCC1] = {
2961 .pad_data = &mmc_pad_data[SDCC1],
2962 },
2963 [SDCC3] = {
2964 .pad_data = &mmc_pad_data[SDCC3],
2965 },
2966};
2967
2968static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302969 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002970};
2971
2972static unsigned int sdc3_sup_clk_rates[] = {
2973 400000, 24000000, 48000000, 96000000
2974};
2975
2976#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2977static struct mmc_platform_data msm8960_sdc1_data = {
2978 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2979#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2980 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2981#else
2982 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2983#endif
2984 .sup_clk_table = sdc1_sup_clk_rates,
2985 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302986 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002987 .nonremovable = 1,
2988 .sdcc_v4_sup = true,
2989 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302990 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002991};
2992#endif
2993
2994#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2995static struct mmc_platform_data msm8960_sdc3_data = {
2996 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2997 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2998 .sup_clk_table = sdc3_sup_clk_rates,
2999 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303000 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303001#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003002 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303003#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003004 .sdcc_v4_sup = true,
3005 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3006 .pin_data = &mmc_slot_pin_data[SDCC3],
3007#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3008 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3009 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3010 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3011#endif
3012 .xpc_cap = 1,
3013 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3014 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303015 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016};
3017#endif
3018
3019static void __init msm8960_init_mmc(void)
3020{
3021#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3022 /* SDC1 : eMMC card connected */
3023 msm_add_sdcc(1, &msm8960_sdc1_data);
3024#endif
3025#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3026 /* SDC3: External card slot */
3027 msm_add_sdcc(3, &msm8960_sdc3_data);
3028#endif
3029}
3030
3031static void __init msm8960_init_buses(void)
3032{
3033#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003034 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003035 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3036 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3037 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3038 msm_bus_apps_fabric.dev.platform_data =
3039 &msm_bus_8960_apps_fabric_pdata;
3040 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3041 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3042 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3043 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003044#endif
3045}
3046
3047static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3048 .max_clock_speed = 15060000,
3049};
3050
3051#ifdef CONFIG_USB_MSM_OTG_72K
3052static struct msm_otg_platform_data msm_otg_pdata;
3053#else
3054#define USB_5V_EN 42
3055static void msm_hsusb_vbus_power(bool on)
3056{
3057 int rc;
3058 static bool vbus_is_on;
3059 static struct regulator *mvs_otg_switch;
3060 struct pm_gpio param = {
3061 .direction = PM_GPIO_DIR_OUT,
3062 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3063 .output_value = 1,
3064 .pull = PM_GPIO_PULL_NO,
3065 .vin_sel = PM_GPIO_VIN_S4,
3066 .out_strength = PM_GPIO_STRENGTH_MED,
3067 .function = PM_GPIO_FUNC_NORMAL,
3068 };
3069
3070 if (vbus_is_on == on)
3071 return;
3072
3073 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003074 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3075 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003076 if (IS_ERR(mvs_otg_switch)) {
3077 pr_err("Unable to get mvs_otg_switch\n");
3078 return;
3079 }
3080
3081 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3082 "usb_5v_en");
3083 if (rc < 0) {
3084 pr_err("failed to request usb_5v_en gpio\n");
3085 goto put_mvs_otg;
3086 }
3087
3088 if (regulator_enable(mvs_otg_switch)) {
3089 pr_err("unable to enable mvs_otg_switch\n");
3090 goto free_usb_5v_en;
3091 }
3092
3093 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3094 &param);
3095 if (rc < 0) {
3096 pr_err("failed to configure usb_5v_en gpio\n");
3097 goto disable_mvs_otg;
3098 }
3099 vbus_is_on = true;
3100 return;
3101 }
3102disable_mvs_otg:
3103 regulator_disable(mvs_otg_switch);
3104free_usb_5v_en:
3105 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
3106put_mvs_otg:
3107 regulator_put(mvs_otg_switch);
3108 vbus_is_on = false;
3109}
3110
3111static struct msm_otg_platform_data msm_otg_pdata = {
3112 .mode = USB_OTG,
3113 .otg_control = OTG_PMIC_CONTROL,
3114 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3115 .pclk_src_name = "dfab_usb_hs_clk",
3116 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3117 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303118 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003119};
3120#endif
3121
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303122#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303123#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303124static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3125 .strobe = 150,
3126 .data = 151,
3127};
3128#else
3129static struct msm_hsic_host_platform_data msm_hsic_pdata;
3130#endif
3131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132#define PID_MAGIC_ID 0x71432909
3133#define SERIAL_NUM_MAGIC_ID 0x61945374
3134#define SERIAL_NUMBER_LENGTH 127
3135#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3136
3137struct magic_num_struct {
3138 uint32_t pid;
3139 uint32_t serial_num;
3140};
3141
3142struct dload_struct {
3143 uint32_t reserved1;
3144 uint32_t reserved2;
3145 uint32_t reserved3;
3146 uint16_t reserved4;
3147 uint16_t pid;
3148 char serial_number[SERIAL_NUMBER_LENGTH];
3149 uint16_t reserved5;
3150 struct magic_num_struct magic_struct;
3151};
3152
3153static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3154{
3155 struct dload_struct __iomem *dload = 0;
3156
3157 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3158 if (!dload) {
3159 pr_err("%s: cannot remap I/O memory region: %08x\n",
3160 __func__, DLOAD_USB_BASE_ADD);
3161 return -ENXIO;
3162 }
3163
3164 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3165 __func__, dload, pid, snum);
3166 /* update pid */
3167 dload->magic_struct.pid = PID_MAGIC_ID;
3168 dload->pid = pid;
3169
3170 /* update serial number */
3171 dload->magic_struct.serial_num = 0;
3172 if (!snum) {
3173 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3174 goto out;
3175 }
3176
3177 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003178 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003179out:
3180 iounmap(dload);
3181 return 0;
3182}
3183
3184static struct android_usb_platform_data android_usb_pdata = {
3185 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3186};
3187
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003188static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003189 .name = "android_usb",
3190 .id = -1,
3191 .dev = {
3192 .platform_data = &android_usb_pdata,
3193 },
3194};
3195
3196static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3197 0x03, 0x0f,
3198};
3199
3200static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3201 0x00, 0x24, 0x54, 0x10,
3202 0x09, 0x03, 0x01,
3203 0x10, 0x54, 0x30, 0x0C,
3204 0x24, 0x30, 0x0f,
3205};
3206
3207static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3208 0x00, 0x24, 0x54, 0x10,
3209 0x09, 0x07, 0x01, 0x0B,
3210 0x10, 0x54, 0x30, 0x0C,
3211 0x24, 0x30, 0x0f,
3212};
3213
3214static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3215 [0] = {
3216 .mode = MSM_SPM_MODE_CLOCK_GATING,
3217 .notify_rpm = false,
3218 .cmd = spm_wfi_cmd_sequence,
3219 },
3220 [1] = {
3221 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3222 .notify_rpm = false,
3223 .cmd = spm_power_collapse_without_rpm,
3224 },
3225 [2] = {
3226 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3227 .notify_rpm = true,
3228 .cmd = spm_power_collapse_with_rpm,
3229 },
3230};
3231
3232static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3233 [0] = {
3234 .reg_base_addr = MSM_SAW0_BASE,
3235 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3236 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3237 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3238#if defined(CONFIG_MSM_AVS_HW)
3239 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3240 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3241#endif
3242 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3243 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3244 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3245 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3246 .vctl_timeout_us = 50,
3247 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3248 .modes = msm_spm_seq_list,
3249 },
3250 [1] = {
3251 .reg_base_addr = MSM_SAW1_BASE,
3252 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3253 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3254 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3255#if defined(CONFIG_MSM_AVS_HW)
3256 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3257 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3258#endif
3259 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3260 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3261 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3262 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3263 .vctl_timeout_us = 50,
3264 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3265 .modes = msm_spm_seq_list,
3266 },
3267};
3268
3269static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3270 0x00, 0x20, 0x03, 0x20,
3271 0x00, 0x0f,
3272};
3273
3274static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3275 0x00, 0x20, 0x34, 0x64,
3276 0x48, 0x07, 0x48, 0x20,
3277 0x50, 0x64, 0x04, 0x34,
3278 0x50, 0x0f,
3279};
3280static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3281 0x00, 0x10, 0x34, 0x64,
3282 0x48, 0x07, 0x48, 0x10,
3283 0x50, 0x64, 0x04, 0x34,
3284 0x50, 0x0F,
3285};
3286
3287static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3288 [0] = {
3289 .mode = MSM_SPM_L2_MODE_RETENTION,
3290 .notify_rpm = false,
3291 .cmd = l2_spm_wfi_cmd_sequence,
3292 },
3293 [1] = {
3294 .mode = MSM_SPM_L2_MODE_GDHS,
3295 .notify_rpm = true,
3296 .cmd = l2_spm_gdhs_cmd_sequence,
3297 },
3298 [2] = {
3299 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3300 .notify_rpm = true,
3301 .cmd = l2_spm_power_off_cmd_sequence,
3302 },
3303};
3304
3305
3306static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3307 [0] = {
3308 .reg_base_addr = MSM_SAW_L2_BASE,
3309 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3310 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3311 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3312 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3313 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3314 .modes = msm_spm_l2_seq_list,
3315 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3316 },
3317};
3318
3319#define CYTTSP_TS_GPIO_IRQ 11
3320#define CYTTSP_TS_SLEEP_GPIO 50
3321#define CYTTSP_TS_RESOUT_N_GPIO 52
3322
3323/*virtual key support */
3324static ssize_t tma340_vkeys_show(struct kobject *kobj,
3325 struct kobj_attribute *attr, char *buf)
3326{
3327 return snprintf(buf, 200,
3328 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3329 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3330 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3331 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3332 "\n");
3333}
3334
3335static struct kobj_attribute tma340_vkeys_attr = {
3336 .attr = {
3337 .mode = S_IRUGO,
3338 },
3339 .show = &tma340_vkeys_show,
3340};
3341
3342static struct attribute *tma340_properties_attrs[] = {
3343 &tma340_vkeys_attr.attr,
3344 NULL
3345};
3346
3347static struct attribute_group tma340_properties_attr_group = {
3348 .attrs = tma340_properties_attrs,
3349};
3350
3351
3352static int cyttsp_platform_init(struct i2c_client *client)
3353{
3354 int rc = 0;
3355 static struct kobject *tma340_properties_kobj;
3356
3357 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3358 tma340_properties_kobj = kobject_create_and_add("board_properties",
3359 NULL);
3360 if (tma340_properties_kobj)
3361 rc = sysfs_create_group(tma340_properties_kobj,
3362 &tma340_properties_attr_group);
3363 if (!tma340_properties_kobj || rc)
3364 pr_err("%s: failed to create board_properties\n",
3365 __func__);
3366
3367 return 0;
3368}
3369
3370static struct cyttsp_regulator regulator_data[] = {
3371 {
3372 .name = "vdd",
3373 .min_uV = CY_TMA300_VTG_MIN_UV,
3374 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303375 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3376 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003377 },
3378 /* TODO: Remove after runtime PM is enabled in I2C driver */
3379 {
3380 .name = "vcc_i2c",
3381 .min_uV = CY_I2C_VTG_MIN_UV,
3382 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303383 .hpm_load_uA = CY_I2C_CURR_UA,
3384 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 },
3386};
3387
3388static struct cyttsp_platform_data cyttsp_pdata = {
3389 .panel_maxx = 634,
3390 .panel_maxy = 1166,
3391 .disp_maxx = 616,
3392 .disp_maxy = 1023,
3393 .disp_minx = 0,
3394 .disp_miny = 16,
3395 .flags = 0x01,
3396 .gen = CY_GEN3, /* or */
3397 .use_st = CY_USE_ST,
3398 .use_mt = CY_USE_MT,
3399 .use_hndshk = CY_SEND_HNDSHK,
3400 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303401 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003402 .use_gestures = CY_USE_GESTURES,
3403 .fw_fname = "cyttsp_8960_cdp.hex",
3404 /* activate up to 4 groups
3405 * and set active distance
3406 */
3407 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3408 CY_GEST_GRP3 | CY_GEST_GRP4 |
3409 CY_ACT_DIST,
3410 /* change act_intrvl to customize the Active power state
3411 * scanning/processing refresh interval for Operating mode
3412 */
3413 .act_intrvl = CY_ACT_INTRVL_DFLT,
3414 /* change tch_tmout to customize the touch timeout for the
3415 * Active power state for Operating mode
3416 */
3417 .tch_tmout = CY_TCH_TMOUT_DFLT,
3418 /* change lp_intrvl to customize the Low Power power state
3419 * scanning/processing refresh interval for Operating mode
3420 */
3421 .lp_intrvl = CY_LP_INTRVL_DFLT,
3422 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3423 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3424 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3425 .regulator_info = regulator_data,
3426 .num_regulators = ARRAY_SIZE(regulator_data),
3427 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303428 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003429};
3430
3431static struct i2c_board_info cyttsp_info[] __initdata = {
3432 {
3433 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3434 .platform_data = &cyttsp_pdata,
3435#ifndef CY_USE_TIMER
3436 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3437#endif /* CY_USE_TIMER */
3438 },
3439};
3440
Mohan Pallaka50837382011-09-07 11:00:57 +05303441/* configuration data */
3442static const u8 mxt_config_data[] = {
3443 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003444 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303445 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003446 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3449 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3451 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3452 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303453 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003454 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303455 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003456 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303457 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003458 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3459 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3460 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3461 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303462 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003463 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3464 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303465 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003466 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3467 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303468 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3470 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303471 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003472 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3473 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303474 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003475 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303476 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003477 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303478 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003479 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303480 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003481 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303482 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003483 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303484};
3485
3486#define MXT_TS_GPIO_IRQ 11
3487#define MXT_TS_LDO_EN_GPIO 50
3488#define MXT_TS_RESET_GPIO 52
3489
3490static void mxt_init_hw_liquid(void)
3491{
3492 int rc;
3493
3494 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3495 if (rc) {
3496 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3497 __func__, MXT_TS_GPIO_IRQ);
3498 return;
3499 }
3500
3501 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3502 if (rc) {
3503 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3504 __func__, MXT_TS_GPIO_IRQ);
3505 goto err_irq_gpio_req;
3506 }
3507
3508 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3509 if (rc) {
3510 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3511 __func__, MXT_TS_LDO_EN_GPIO);
3512 goto err_irq_gpio_req;
3513 }
3514
3515 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3516 if (rc) {
3517 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3518 __func__, MXT_TS_LDO_EN_GPIO);
3519 goto err_ldo_gpio_req;
3520 }
3521
3522 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3523 if (rc) {
3524 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3525 __func__, MXT_TS_RESET_GPIO);
3526 goto err_ldo_gpio_set_dir;
3527 }
3528
3529 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3530 if (rc) {
3531 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3532 __func__, MXT_TS_RESET_GPIO);
3533 goto err_reset_gpio_req;
3534 }
3535
3536 return;
3537
3538err_reset_gpio_req:
3539 gpio_free(MXT_TS_RESET_GPIO);
3540err_ldo_gpio_set_dir:
3541 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3542err_ldo_gpio_req:
3543 gpio_free(MXT_TS_LDO_EN_GPIO);
3544err_irq_gpio_req:
3545 gpio_free(MXT_TS_GPIO_IRQ);
3546}
3547
3548static struct mxt_platform_data mxt_platform_data = {
3549 .config = mxt_config_data,
3550 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003551 .x_size = 1365,
3552 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303553 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003554 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303555};
3556
3557static struct i2c_board_info mxt_device_info[] __initdata = {
3558 {
3559 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3560 .platform_data = &mxt_platform_data,
3561 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3562 },
3563};
3564
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003565static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3566{
3567}
3568
3569static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3570 .clk_freq = 100000,
3571 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003572 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3573};
3574
3575static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3576 .clk_freq = 100000,
3577 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003578 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3579};
3580
3581static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3582 .clk_freq = 100000,
3583 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003584 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3585};
3586
3587static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3588 .clk_freq = 100000,
3589 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003590 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3591};
3592
3593static struct msm_rpm_platform_data msm_rpm_data = {
3594 .reg_base_addrs = {
3595 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3596 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3597 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3598 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3599 },
3600
3601 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3602 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3603 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3604 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3605 .msm_apps_ipc_rpm_val = 4,
3606};
3607
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003608static struct ks8851_pdata spi_eth_pdata = {
3609 .irq_gpio = KS8851_IRQ_GPIO,
3610 .rst_gpio = KS8851_RST_GPIO,
3611};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003612
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003613static struct spi_board_info spi_board_info[] __initdata = {
3614 {
3615 .modalias = "ks8851",
3616 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3617 .max_speed_hz = 19200000,
3618 .bus_num = 0,
3619 .chip_select = 0,
3620 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003621 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003622 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003623 {
3624 .modalias = "dsi_novatek_3d_panel_spi",
3625 .max_speed_hz = 10800000,
3626 .bus_num = 0,
3627 .chip_select = 1,
3628 .mode = SPI_MODE_0,
3629 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003630};
3631
3632static struct platform_device msm_device_saw_core0 = {
3633 .name = "saw-regulator",
3634 .id = 0,
3635 .dev = {
3636 .platform_data = &msm_saw_regulator_pdata_s5,
3637 },
3638};
3639
3640static struct platform_device msm_device_saw_core1 = {
3641 .name = "saw-regulator",
3642 .id = 1,
3643 .dev = {
3644 .platform_data = &msm_saw_regulator_pdata_s6,
3645 },
3646};
3647
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003648static struct tsens_platform_data msm_tsens_pdata = {
3649 .slope = 910,
3650 .tsens_factor = 1000,
3651 .hw_type = MSM_8960,
3652 .tsens_num_sensor = 5,
3653};
3654
3655static struct platform_device msm_tsens_device = {
3656 .name = "tsens8960-tm",
3657 .id = -1,
3658 .dev = {
3659 .platform_data = &msm_tsens_pdata,
3660 },
3661};
3662
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003663#ifdef CONFIG_MSM_FAKE_BATTERY
3664static struct platform_device fish_battery_device = {
3665 .name = "fish_battery",
3666};
3667#endif
3668
David Collins26f05562011-06-20 09:56:28 -07003669static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003670 .name = GPIO_REGULATOR_DEV_NAME,
3671 .id = PM8921_MPP_PM_TO_SYS(7),
3672 .dev = {
3673 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3674 },
3675};
3676
David Collins26f05562011-06-20 09:56:28 -07003677static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003678 .name = GPIO_REGULATOR_DEV_NAME,
3679 .id = 91,
3680 .dev = {
3681 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3682 },
3683};
3684
David Collinsb10be1d2011-09-02 10:29:31 -07003685static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3686 .name = GPIO_REGULATOR_DEV_NAME,
3687 .id = PM8921_GPIO_PM_TO_SYS(17),
3688 .dev = {
3689 .platform_data =
3690 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3691 },
3692};
3693
David Collins26f05562011-06-20 09:56:28 -07003694static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3695 .name = "rpm-regulator",
3696 .id = -1,
3697 .dev = {
3698 .platform_data = &msm_rpm_regulator_pdata,
3699 },
3700};
3701
David Collins4c31a872011-08-31 10:07:10 -07003702static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3703 .phys_addr_base = 0x0010C000,
3704 .reg_offsets = {
3705 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3706 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3707 },
3708 .phys_size = SZ_8K,
3709 .log_len = 4096, /* log's buffer length in bytes */
3710 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3711};
3712
3713static struct platform_device msm_rpm_log_device = {
3714 .name = "msm_rpm_log",
3715 .id = -1,
3716 .dev = {
3717 .platform_data = &msm_rpm_log_pdata,
3718 },
3719};
3720
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003721static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003722 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003723 &msm_device_smd,
3724 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303725 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003726 &msm_device_saw_core0,
3727 &msm_device_saw_core1,
3728 &msm8960_device_ext_5v_vreg,
3729 &msm8960_device_ext_l2_vreg,
3730 &msm8960_device_ssbi_pm8921,
3731 &msm8960_device_qup_spi_gsbi1,
3732 &msm8960_device_qup_i2c_gsbi3,
3733 &msm8960_device_qup_i2c_gsbi4,
3734 &msm8960_device_qup_i2c_gsbi10,
3735#ifndef CONFIG_MSM_DSPS
3736 &msm8960_device_qup_i2c_gsbi12,
3737#endif
3738 &msm_slim_ctrl,
3739 &msm_device_wcnss_wlan,
3740#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3741 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3742 &qcrypto_device,
3743#endif
3744
3745#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3746 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3747 &qcedev_device,
3748#endif
3749#ifdef CONFIG_MSM_ROTATOR
3750 &msm_rotator_device,
3751#endif
3752 &msm_device_sps,
3753#ifdef CONFIG_MSM_FAKE_BATTERY
3754 &fish_battery_device,
3755#endif
3756#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003757#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003758 &android_pmem_device,
3759 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003760#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003761 &android_pmem_audio_device,
3762#endif
3763 &msm_fb_device,
3764 &msm_device_vidc,
3765 &msm_device_bam_dmux,
3766 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003767
3768#ifdef CONFIG_HW_RANDOM_MSM
3769 &msm_device_rng,
3770#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003771 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003772#ifdef CONFIG_ION_MSM
3773 &ion_dev,
3774#endif
David Collins4c31a872011-08-31 10:07:10 -07003775 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003776#ifdef CONFIG_MSM_QDSS
3777 &msm_etb_device,
3778 &msm_tpiu_device,
3779 &msm_funnel_device,
3780 &msm_ptm_device,
3781#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003782 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003783 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003784};
3785
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003786static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003787 &msm8960_device_otg,
3788 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003789 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303790 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003791 &android_usb_device,
3792 &msm_device_vidc,
3793 &mipi_dsi_simulator_panel_device,
3794 &msm_bus_apps_fabric,
3795 &msm_bus_sys_fabric,
3796 &msm_bus_mm_fabric,
3797 &msm_bus_sys_fpb,
3798 &msm_bus_cpss_fpb,
3799 &msm_pcm,
3800 &msm_pcm_routing,
3801 &msm_cpudai0,
3802 &msm_cpudai1,
3803 &msm_cpudai_hdmi_rx,
3804 &msm_cpudai_bt_rx,
3805 &msm_cpudai_bt_tx,
3806 &msm_cpudai_fm_rx,
3807 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003808 &msm_cpudai_auxpcm_rx,
3809 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003810 &msm_cpu_fe,
3811 &msm_stub_codec,
3812 &msm_voice,
3813 &msm_voip,
3814 &msm_lpa_pcm,
3815
3816#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3817 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3818 &qcrypto_device,
3819#endif
3820
3821#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3822 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3823 &qcedev_device,
3824#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003825};
3826
3827static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003828 &msm_kgsl_3d0,
3829 &msm_kgsl_2d0,
3830 &msm_kgsl_2d1,
3831 &mipi_dsi_renesas_panel_device,
3832#ifdef CONFIG_MSM_GEMINI
3833 &msm8960_gemini_device,
3834#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003835};
3836
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003837static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003838 &msm8960_device_otg,
3839 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003840 &msm_device_hsusb_host,
3841 &android_usb_device,
3842 &msm_pcm,
3843 &msm_pcm_routing,
3844 &msm_cpudai0,
3845 &msm_cpudai1,
3846 &msm_cpudai_hdmi_rx,
3847 &msm_cpudai_bt_rx,
3848 &msm_cpudai_bt_tx,
3849 &msm_cpudai_fm_rx,
3850 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003851 &msm_cpudai_auxpcm_rx,
3852 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003853 &msm_cpu_fe,
3854 &msm_stub_codec,
3855 &msm_kgsl_3d0,
3856#ifdef CONFIG_MSM_KGSL_2D
3857 &msm_kgsl_2d0,
3858 &msm_kgsl_2d1,
3859#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003860 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003861#ifdef CONFIG_MSM_GEMINI
3862 &msm8960_gemini_device,
3863#endif
3864 &msm_voice,
3865 &msm_voip,
3866 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303867 &msm_cpudai_afe_01_rx,
3868 &msm_cpudai_afe_01_tx,
3869 &msm_cpudai_afe_02_rx,
3870 &msm_cpudai_afe_02_tx,
3871 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003872#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3873 &hdmi_msm_device,
3874#endif
3875 &msm_pcm_hostless,
3876 &msm_bus_apps_fabric,
3877 &msm_bus_sys_fabric,
3878 &msm_bus_mm_fabric,
3879 &msm_bus_sys_fpb,
3880 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003881 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003882};
3883
3884static void __init msm8960_i2c_init(void)
3885{
3886 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3887 &msm8960_i2c_qup_gsbi4_pdata;
3888
3889 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3890 &msm8960_i2c_qup_gsbi3_pdata;
3891
3892 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3893 &msm8960_i2c_qup_gsbi10_pdata;
3894
3895 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3896 &msm8960_i2c_qup_gsbi12_pdata;
3897}
3898
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003899static void __init msm8960_gfx_init(void)
3900{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003901 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003902 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3903 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3904 msm_kgsl_3d0.dev.platform_data;
3905 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3906 320000000;
3907 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3908 266667000;
3909 }
3910}
3911
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003912static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3913 .irq_base = PM8921_IRQ_BASE,
3914 .devirq = MSM_GPIO_TO_INT(104),
3915 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3916};
3917
3918static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3919 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3920};
3921
3922static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3923 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3924};
3925
3926static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3927 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303928 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003929};
3930
3931static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3932 .pull_up = 1,
3933 .kpd_trigger_delay_us = 970,
3934 .wakeup = 1,
3935};
3936
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303937/* Rotate lock key is not available so use F1 */
3938#define KEY_ROTATE_LOCK KEY_F1
3939
3940static const unsigned int keymap_liquid[] = {
3941 KEY(0, 0, KEY_VOLUMEUP),
3942 KEY(0, 1, KEY_VOLUMEDOWN),
3943 KEY(1, 3, KEY_ROTATE_LOCK),
3944 KEY(1, 4, KEY_HOME),
3945};
3946
3947static struct matrix_keymap_data keymap_data_liquid = {
3948 .keymap_size = ARRAY_SIZE(keymap_liquid),
3949 .keymap = keymap_liquid,
3950};
3951
3952static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3953 .input_name = "keypad_8960_liquid",
3954 .input_phys_device = "keypad_8960/input0",
3955 .num_rows = 2,
3956 .num_cols = 5,
3957 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3958 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3959 .debounce_ms = 15,
3960 .scan_delay_ms = 32,
3961 .row_hold_ns = 91500,
3962 .wakeup = 1,
3963 .keymap_data = &keymap_data_liquid,
3964};
3965
3966
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003967static const unsigned int keymap[] = {
3968 KEY(0, 0, KEY_VOLUMEUP),
3969 KEY(0, 1, KEY_VOLUMEDOWN),
3970 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3971 KEY(0, 3, KEY_CAMERA_FOCUS),
3972};
3973
3974static struct matrix_keymap_data keymap_data = {
3975 .keymap_size = ARRAY_SIZE(keymap),
3976 .keymap = keymap,
3977};
3978
3979static struct pm8xxx_keypad_platform_data keypad_data = {
3980 .input_name = "keypad_8960",
3981 .input_phys_device = "keypad_8960/input0",
3982 .num_rows = 1,
3983 .num_cols = 5,
3984 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3985 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3986 .debounce_ms = 15,
3987 .scan_delay_ms = 32,
3988 .row_hold_ns = 91500,
3989 .wakeup = 1,
3990 .keymap_data = &keymap_data,
3991};
3992
3993static const unsigned int keymap_sim[] = {
3994 KEY(0, 0, KEY_7),
3995 KEY(0, 1, KEY_DOWN),
3996 KEY(0, 2, KEY_UP),
3997 KEY(0, 3, KEY_RIGHT),
3998 KEY(0, 4, KEY_ENTER),
3999 KEY(0, 5, KEY_L),
4000 KEY(0, 6, KEY_BACK),
4001 KEY(0, 7, KEY_M),
4002
4003 KEY(1, 0, KEY_LEFT),
4004 KEY(1, 1, KEY_SEND),
4005 KEY(1, 2, KEY_1),
4006 KEY(1, 3, KEY_4),
4007 KEY(1, 4, KEY_CLEAR),
4008 KEY(1, 5, KEY_MSDOS),
4009 KEY(1, 6, KEY_SPACE),
4010 KEY(1, 7, KEY_COMMA),
4011
4012 KEY(2, 0, KEY_6),
4013 KEY(2, 1, KEY_5),
4014 KEY(2, 2, KEY_8),
4015 KEY(2, 3, KEY_3),
4016 KEY(2, 4, KEY_NUMERIC_STAR),
4017 KEY(2, 5, KEY_UP),
4018 KEY(2, 6, KEY_DOWN),
4019 KEY(2, 7, KEY_LEFTSHIFT),
4020
4021 KEY(3, 0, KEY_9),
4022 KEY(3, 1, KEY_NUMERIC_POUND),
4023 KEY(3, 2, KEY_0),
4024 KEY(3, 3, KEY_2),
4025 KEY(3, 4, KEY_SLEEP),
4026 KEY(3, 5, KEY_F1),
4027 KEY(3, 6, KEY_F2),
4028 KEY(3, 7, KEY_F3),
4029
4030 KEY(4, 0, KEY_BACK),
4031 KEY(4, 1, KEY_HOME),
4032 KEY(4, 2, KEY_MENU),
4033 KEY(4, 3, KEY_VOLUMEUP),
4034 KEY(4, 4, KEY_VOLUMEDOWN),
4035 KEY(4, 5, KEY_F4),
4036 KEY(4, 6, KEY_F5),
4037 KEY(4, 7, KEY_F6),
4038
4039 KEY(5, 0, KEY_R),
4040 KEY(5, 1, KEY_T),
4041 KEY(5, 2, KEY_Y),
4042 KEY(5, 3, KEY_LEFTALT),
4043 KEY(5, 4, KEY_KPENTER),
4044 KEY(5, 5, KEY_Q),
4045 KEY(5, 6, KEY_W),
4046 KEY(5, 7, KEY_E),
4047
4048 KEY(6, 0, KEY_F),
4049 KEY(6, 1, KEY_G),
4050 KEY(6, 2, KEY_H),
4051 KEY(6, 3, KEY_CAPSLOCK),
4052 KEY(6, 4, KEY_PAGEUP),
4053 KEY(6, 5, KEY_A),
4054 KEY(6, 6, KEY_S),
4055 KEY(6, 7, KEY_D),
4056
4057 KEY(7, 0, KEY_V),
4058 KEY(7, 1, KEY_B),
4059 KEY(7, 2, KEY_N),
4060 KEY(7, 3, KEY_MENU),
4061 KEY(7, 4, KEY_PAGEDOWN),
4062 KEY(7, 5, KEY_Z),
4063 KEY(7, 6, KEY_X),
4064 KEY(7, 7, KEY_C),
4065
4066 KEY(8, 0, KEY_P),
4067 KEY(8, 1, KEY_J),
4068 KEY(8, 2, KEY_K),
4069 KEY(8, 3, KEY_INSERT),
4070 KEY(8, 4, KEY_LINEFEED),
4071 KEY(8, 5, KEY_U),
4072 KEY(8, 6, KEY_I),
4073 KEY(8, 7, KEY_O),
4074
4075 KEY(9, 0, KEY_4),
4076 KEY(9, 1, KEY_5),
4077 KEY(9, 2, KEY_6),
4078 KEY(9, 3, KEY_7),
4079 KEY(9, 4, KEY_8),
4080 KEY(9, 5, KEY_1),
4081 KEY(9, 6, KEY_2),
4082 KEY(9, 7, KEY_3),
4083
4084 KEY(10, 0, KEY_F7),
4085 KEY(10, 1, KEY_F8),
4086 KEY(10, 2, KEY_F9),
4087 KEY(10, 3, KEY_F10),
4088 KEY(10, 4, KEY_FN),
4089 KEY(10, 5, KEY_9),
4090 KEY(10, 6, KEY_0),
4091 KEY(10, 7, KEY_DOT),
4092
4093 KEY(11, 0, KEY_LEFTCTRL),
4094 KEY(11, 1, KEY_F11),
4095 KEY(11, 2, KEY_ENTER),
4096 KEY(11, 3, KEY_SEARCH),
4097 KEY(11, 4, KEY_DELETE),
4098 KEY(11, 5, KEY_RIGHT),
4099 KEY(11, 6, KEY_LEFT),
4100 KEY(11, 7, KEY_RIGHTSHIFT),
4101 KEY(0, 0, KEY_VOLUMEUP),
4102 KEY(0, 1, KEY_VOLUMEDOWN),
4103 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4104 KEY(0, 3, KEY_CAMERA_FOCUS),
4105};
4106
4107static struct matrix_keymap_data keymap_data_sim = {
4108 .keymap_size = ARRAY_SIZE(keymap_sim),
4109 .keymap = keymap_sim,
4110};
4111
4112static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4113 .input_name = "keypad_8960",
4114 .input_phys_device = "keypad_8960/input0",
4115 .num_rows = 12,
4116 .num_cols = 8,
4117 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4118 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4119 .debounce_ms = 15,
4120 .scan_delay_ms = 32,
4121 .row_hold_ns = 91500,
4122 .wakeup = 1,
4123 .keymap_data = &keymap_data_sim,
4124};
4125
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004126static int pm8921_therm_mitigation[] = {
4127 1100,
4128 700,
4129 600,
4130 325,
4131};
4132
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004133static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004134 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004135 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004136 .max_voltage = 4200,
4137 .min_voltage = 3200,
4138 .resume_voltage = 4100,
4139 .term_current = 100,
4140 .cool_temp = 10,
4141 .warm_temp = 40,
4142 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004143 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004144 .cool_bat_chg_current = 350,
4145 .warm_bat_chg_current = 350,
4146 .cool_bat_voltage = 4100,
4147 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004148 .thermal_mitigation = pm8921_therm_mitigation,
4149 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004150};
4151
4152static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4153 .priority = 0,
4154};
4155
4156static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4157 .r_sense = 10,
4158 .i_test = 2500,
4159 .v_failure = 3000,
4160 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004161};
4162
Jay Chokshide4cefb2011-08-04 18:10:44 -07004163#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004164#define PM8XXX_LED_PWM_PERIOD 1000
4165#define PM8XXX_LED_PWM_DUTY_MS 20
4166/**
4167 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4168 * driven using PWM feature.
4169 */
4170#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004171
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004172static struct led_info pm8921_led_info[] = {
4173 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004174 .name = "led:battery_charging",
4175 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004176 },
4177 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004178 .name = "led:battery_full",
4179 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 },
4181};
4182
Jay Chokshi8994e392011-09-14 18:20:39 -07004183static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004184 .num_leds = ARRAY_SIZE(pm8921_led_info),
4185 .leds = pm8921_led_info,
4186};
4187
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004188static int pm8921_led0_pwm_duty_pcts[56] = {
4189 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4190 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4191 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4192 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4193 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4194 14, 10, 6, 4, 1
4195};
4196
4197static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4198 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4199 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4200 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4201 .start_idx = 0,
4202};
4203
Jay Chokshi8994e392011-09-14 18:20:39 -07004204static struct pm8xxx_led_config pm8921_led_configs[] = {
4205 [0] = {
4206 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004207 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004208 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004209 .pwm_channel = 5,
4210 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4211 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004212 },
4213 [1] = {
4214 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004215 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004216 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004217 .pwm_channel = 4,
4218 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004219 },
4220};
4221
4222static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4223 .led_core = &pm8921_led_core_pdata,
4224 .configs = pm8921_led_configs,
4225 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4226};
4227
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004228static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4229 .irq_pdata = &pm8xxx_irq_pdata,
4230 .gpio_pdata = &pm8xxx_gpio_pdata,
4231 .mpp_pdata = &pm8xxx_mpp_pdata,
4232 .rtc_pdata = &pm8xxx_rtc_pdata,
4233 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4234 .keypad_pdata = &keypad_data,
4235 .misc_pdata = &pm8xxx_misc_pdata,
4236 .regulator_pdatas = msm_pm8921_regulator_pdata,
4237 .charger_pdata = &pm8921_chg_pdata,
4238 .bms_pdata = &pm8921_bms_pdata,
4239 .adc_pdata = &pm8921_adc_pdata,
4240 .leds_pdata = &pm8xxx_leds_pdata,
4241};
4242
4243static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4244 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4245 .slave = {
4246 .name = "pm8921-core",
4247 .platform_data = &pm8921_platform_data,
4248 },
4249};
4250
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004251static struct msm_cpuidle_state msm_cstates[] __initdata = {
4252 {0, 0, "C0", "WFI",
4253 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4254
4255 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4256 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4257
4258 {0, 2, "C2", "POWER_COLLAPSE",
4259 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4260
4261 {1, 0, "C0", "WFI",
4262 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4263
4264 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4265 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4266};
4267
4268static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4269 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4270 .idle_supported = 1,
4271 .suspend_supported = 1,
4272 .idle_enabled = 0,
4273 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004274 },
4275
4276 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4277 .idle_supported = 1,
4278 .suspend_supported = 1,
4279 .idle_enabled = 0,
4280 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004281 },
4282
4283 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4284 .idle_supported = 1,
4285 .suspend_supported = 1,
4286 .idle_enabled = 1,
4287 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004288 },
4289
4290 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4291 .idle_supported = 0,
4292 .suspend_supported = 1,
4293 .idle_enabled = 0,
4294 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004295 },
4296
4297 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4298 .idle_supported = 1,
4299 .suspend_supported = 1,
4300 .idle_enabled = 0,
4301 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004302 },
4303
4304 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4305 .idle_supported = 1,
4306 .suspend_supported = 0,
4307 .idle_enabled = 1,
4308 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004309 },
4310};
4311
4312static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4313 {
4314 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4315 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4316 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004317 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004318 },
4319
4320 {
4321 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4322 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4323 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004324 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004325 },
4326
4327 {
4328 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4329 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4330 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004331 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004332 },
4333
4334 {
4335 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4336 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4337 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004338 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004339 },
4340
4341 {
4342 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4343 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4344 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004345 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 },
4347
4348 {
4349 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4350 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4351 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004352 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 },
4354
4355 {
4356 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4357 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4358 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004359 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004360 },
4361
4362 {
4363 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4364 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4365 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004366 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004367 },
4368};
4369
4370#ifdef CONFIG_I2C
4371#define I2C_SURF 1
4372#define I2C_FFA (1 << 1)
4373#define I2C_RUMI (1 << 2)
4374#define I2C_SIM (1 << 3)
4375#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004376#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004377
4378struct i2c_registry {
4379 u8 machs;
4380 int bus;
4381 struct i2c_board_info *info;
4382 int len;
4383};
4384
4385#ifdef CONFIG_MSM_CAMERA
4386static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4387#ifdef CONFIG_IMX074
4388 {
4389 I2C_BOARD_INFO("imx074", 0x1A),
4390 },
4391#endif
4392#ifdef CONFIG_OV2720
4393 {
4394 I2C_BOARD_INFO("ov2720", 0x6C),
4395 },
4396#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004397 {
4398 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4399 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304400#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4401 {
4402 I2C_BOARD_INFO("sc628a", 0x6E),
4403 },
4404#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004405};
4406#endif
4407
4408/* Sensors DSPS platform data */
4409#ifdef CONFIG_MSM_DSPS
4410#define DSPS_PIL_GENERIC_NAME "dsps"
4411#endif /* CONFIG_MSM_DSPS */
4412
4413static void __init msm8960_init_dsps(void)
4414{
4415#ifdef CONFIG_MSM_DSPS
4416 struct msm_dsps_platform_data *pdata =
4417 msm_dsps_device.dev.platform_data;
4418 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4419 pdata->gpios = NULL;
4420 pdata->gpios_num = 0;
4421
4422 platform_device_register(&msm_dsps_device);
4423#endif /* CONFIG_MSM_DSPS */
4424}
4425
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004426static void __init msm8960_init_hsic(void)
4427{
4428#ifdef CONFIG_USB_EHCI_MSM_HSIC
4429 uint32_t version = socinfo_get_version();
4430
4431 pr_info("%s: version:%d mtp:%d\n", __func__,
4432 SOCINFO_VERSION_MAJOR(version),
4433 machine_is_msm8960_mtp());
4434
4435 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4436 machine_is_msm8960_mtp() ||
4437 machine_is_msm8960_fluid())
4438 return;
4439
4440 msm_gpiomux_install(msm8960_hsic_configs,
4441 ARRAY_SIZE(msm8960_hsic_configs));
4442
4443 platform_device_register(&msm_device_hsic_host);
4444#endif
4445}
4446
4447
Amir Samuelov5137e392011-09-21 17:31:25 +03004448#ifdef CONFIG_ISL9519_CHARGER
4449static struct isl_platform_data isl_data __initdata = {
4450 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4451 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4452 .max_system_voltage = 4200,
4453 .min_system_voltage = 3200,
4454 .chgcurrent = 1000, /* 1900, */
4455 .term_current = 400, /* Need fine tuning */
4456 .input_current = 2048,
4457};
4458
4459static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4460 {
4461 I2C_BOARD_INFO("isl9519q", 0x9),
4462 .irq = 0, /* Not required when notify-by-pmic */
4463 .platform_data = &isl_data,
4464 },
4465};
4466#endif /* CONFIG_ISL9519_CHARGER */
4467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004468static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4469#ifdef CONFIG_MSM_CAMERA
4470 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004471 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004472 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4473 msm_camera_boardinfo,
4474 ARRAY_SIZE(msm_camera_boardinfo),
4475 },
4476#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004477#ifdef CONFIG_ISL9519_CHARGER
4478 {
4479 I2C_LIQUID,
4480 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4481 isl_charger_i2c_info,
4482 ARRAY_SIZE(isl_charger_i2c_info),
4483 },
4484#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004485 {
4486 I2C_SURF | I2C_FFA | I2C_FLUID,
4487 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4488 cyttsp_info,
4489 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004490 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304491 {
4492 I2C_LIQUID,
4493 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4494 mxt_device_info,
4495 ARRAY_SIZE(mxt_device_info),
4496 },
4497
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004498};
4499#endif /* CONFIG_I2C */
4500
4501static void __init register_i2c_devices(void)
4502{
4503#ifdef CONFIG_I2C
4504 u8 mach_mask = 0;
4505 int i;
4506
4507 /* Build the matching 'supported_machs' bitmask */
4508 if (machine_is_msm8960_cdp())
4509 mach_mask = I2C_SURF;
4510 else if (machine_is_msm8960_rumi3())
4511 mach_mask = I2C_RUMI;
4512 else if (machine_is_msm8960_sim())
4513 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004514 else if (machine_is_msm8960_fluid())
4515 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004516 else if (machine_is_msm8960_liquid())
4517 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004518 else if (machine_is_msm8960_mtp())
4519 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004520 else
4521 pr_err("unmatched machine ID in register_i2c_devices\n");
4522
4523 /* Run the array and install devices as appropriate */
4524 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4525 if (msm8960_i2c_devices[i].machs & mach_mask)
4526 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4527 msm8960_i2c_devices[i].info,
4528 msm8960_i2c_devices[i].len);
4529 }
4530#endif
4531}
4532
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004533static void __init msm8960_sim_init(void)
4534{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004535 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4536 &msm8960_device_watchdog.dev.platform_data;
4537
4538 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004539 BUG_ON(msm_rpm_init(&msm_rpm_data));
4540 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4541 ARRAY_SIZE(msm_rpmrs_levels)));
4542 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004543 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004544 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004545 msm8960_device_ssbi_pm8921.dev.platform_data =
4546 &msm8960_ssbi_pm8921_pdata;
4547 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004548
4549 /* Simulator supports a QWERTY keypad */
4550 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4551
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004552 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4553 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4554 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004555 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004556 msm8960_i2c_init();
4557 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4558 msm_spm_l2_init(msm_spm_l2_data);
4559 msm8960_init_buses();
4560 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4561 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004562 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004563 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004564
4565 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4566 &msm8960_qup_spi_gsbi1_pdata;
4567 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4568
4569 msm8960_init_mmc();
4570 msm_fb_add_devices();
4571 slim_register_board_info(msm_slim_devices,
4572 ARRAY_SIZE(msm_slim_devices));
4573 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4574 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4575 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4576 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004577 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004578}
4579
4580static void __init msm8960_rumi3_init(void)
4581{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004582 BUG_ON(msm_rpm_init(&msm_rpm_data));
4583 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4584 ARRAY_SIZE(msm_rpmrs_levels)));
4585 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004586 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004587 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004588 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004589 msm8960_device_ssbi_pm8921.dev.platform_data =
4590 &msm8960_ssbi_pm8921_pdata;
4591 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4592 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4593 &msm8960_qup_spi_gsbi1_pdata;
4594 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4595 msm8960_i2c_init();
4596 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4597 msm_spm_l2_init(msm_spm_l2_data);
4598 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4599 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004600 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004601 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004602 register_i2c_devices();
4603 msm_fb_add_devices();
4604 slim_register_board_info(msm_slim_devices,
4605 ARRAY_SIZE(msm_slim_devices));
4606 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4607 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4608 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4609 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004610 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004611}
4612
4613static void __init msm8960_cdp_init(void)
4614{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004615 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4616 pr_err("meminfo_init() failed!\n");
4617
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004618 BUG_ON(msm_rpm_init(&msm_rpm_data));
4619 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4620 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004621
4622 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004623 regulator_suppress_info_printing();
4624 if (msm_xo_init())
4625 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004626 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004627 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004628 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4629 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4630 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304631#ifdef CONFIG_USB_EHCI_MSM_HSIC
4632 if (machine_is_msm8960_liquid()) {
4633 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4634 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4635 }
4636#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304637 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004638 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304639 if (machine_is_msm8960_liquid())
4640 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004641 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4642 &msm8960_qup_spi_gsbi1_pdata;
4643 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4644 msm8960_device_ssbi_pm8921.dev.platform_data =
4645 &msm8960_ssbi_pm8921_pdata;
4646 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4647 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004648 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004649 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4650 msm_spm_l2_init(msm_spm_l2_data);
4651 msm8960_init_buses();
4652 platform_add_devices(msm_footswitch_devices,
4653 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004654 if (machine_is_msm8960_liquid())
4655 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004656 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4657 pm8921_gpio_mpp_init();
4658 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004659 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004660 msm8960_init_cam();
4661 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004662 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304663 if (machine_is_msm8960_liquid())
4664 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004665 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004666 msm_fb_add_devices();
4667 slim_register_board_info(msm_slim_devices,
4668 ARRAY_SIZE(msm_slim_devices));
4669 msm8960_init_dsps();
4670 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4671 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4672 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4673 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004674 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004675 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004676}
4677
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004678MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4679 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004680 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004681 .init_irq = msm8960_init_irq,
4682 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004683 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004684 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004685 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004686MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004687
4688MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4689 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004690 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004691 .init_irq = msm8960_init_irq,
4692 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004693 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004694 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004695 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004696MACHINE_END
4697
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004698MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4699 .map_io = msm8960_map_io,
4700 .reserve = msm8960_reserve,
4701 .init_irq = msm8960_init_irq,
4702 .timer = &msm_timer,
4703 .init_machine = msm8960_cdp_init,
4704 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004705 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004706MACHINE_END
4707
4708MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4709 .map_io = msm8960_map_io,
4710 .reserve = msm8960_reserve,
4711 .init_irq = msm8960_init_irq,
4712 .timer = &msm_timer,
4713 .init_machine = msm8960_cdp_init,
4714 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004715 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004716MACHINE_END
4717
4718MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4719 .map_io = msm8960_map_io,
4720 .reserve = msm8960_reserve,
4721 .init_irq = msm8960_init_irq,
4722 .timer = &msm_timer,
4723 .init_machine = msm8960_cdp_init,
4724 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004725 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004726MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004727
4728MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4729 .map_io = msm8960_map_io,
4730 .reserve = msm8960_reserve,
4731 .init_irq = msm8960_init_irq,
4732 .timer = &msm_timer,
4733 .init_machine = msm8960_cdp_init,
4734 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004735 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004736MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004737
4738#ifdef CONFIG_ARCH_MSM8930
4739MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4740 .map_io = msm8930_map_io,
4741 .reserve = msm8960_reserve,
4742 .init_irq = msm8960_init_irq,
4743 .timer = &msm_timer,
4744 .init_machine = msm8960_cdp_init,
4745 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004746 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004747MACHINE_END
4748
4749MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4750 .map_io = msm8930_map_io,
4751 .reserve = msm8960_reserve,
4752 .init_irq = msm8960_init_irq,
4753 .timer = &msm_timer,
4754 .init_machine = msm8960_cdp_init,
4755 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004756 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004757MACHINE_END
4758
4759MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4760 .map_io = msm8930_map_io,
4761 .reserve = msm8960_reserve,
4762 .init_irq = msm8960_init_irq,
4763 .timer = &msm_timer,
4764 .init_machine = msm8960_cdp_init,
4765 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004766 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004767MACHINE_END
4768#endif