blob: 2262ba3ade3927bf4a5415351423db603dbbebcb [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"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092
93static struct platform_device msm_fm_platform_init = {
94 .name = "iris_fm",
95 .id = -1,
96};
97
98struct pm8xxx_gpio_init {
99 unsigned gpio;
100 struct pm_gpio config;
101};
102
103struct pm8xxx_mpp_init {
104 unsigned mpp;
105 struct pm8xxx_mpp_config_data config;
106};
107
108#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
109 _func, _inv, _disable) \
110{ \
111 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
112 .config = { \
113 .direction = _dir, \
114 .output_buffer = _buf, \
115 .output_value = _val, \
116 .pull = _pull, \
117 .vin_sel = _vin, \
118 .out_strength = _out_strength, \
119 .function = _func, \
120 .inv_int_pol = _inv, \
121 .disable_pin = _disable, \
122 } \
123}
124
125#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
126{ \
127 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
128 .config = { \
129 .type = PM8XXX_MPP_TYPE_##_type, \
130 .level = _level, \
131 .control = PM8XXX_MPP_##_control, \
132 } \
133}
134
135#define PM8XXX_GPIO_DISABLE(_gpio) \
136 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
137 0, 0, 0, 1)
138
139#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
140 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
141 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
142 PM_GPIO_STRENGTH_HIGH, \
143 PM_GPIO_FUNC_NORMAL, 0, 0)
144
145#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
146 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
147 _pull, PM_GPIO_VIN_S4, \
148 PM_GPIO_STRENGTH_NO, \
149 PM_GPIO_FUNC_NORMAL, 0, 0)
150
151#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
152 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
153 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
154 PM_GPIO_STRENGTH_HIGH, \
155 _func, 0, 0)
156
157/* Initial PM8921 GPIO configurations */
158static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
159 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
160 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
161 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300162 /* External regulator shared by display and touchscreen on LiQUID */
163 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
164 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700166 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700167 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700168 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169};
170
171/* Initial PM8921 MPP configurations */
172static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
173 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
174 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
176 DOUT_CTRL_LOW),
177};
178
179static void __init pm8921_gpio_mpp_init(void)
180{
181 int i, rc;
182
183 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
184 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
185 &pm8921_gpios[i].config);
186 if (rc) {
187 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
188 break;
189 }
190 }
191
192 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
193 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
194 &pm8921_mpps[i].config);
195 if (rc) {
196 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
197 break;
198 }
199 }
200}
201
202#define FPGA_CS_GPIO 14
203#define KS8851_RST_GPIO 89
204#define KS8851_IRQ_GPIO 90
205
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700206#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
207enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700208 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700209 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
210 /* CAM Expander */
211 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
212 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
213 GPIO_CAM_GP_AFBUSY,
214 GPIO_CAM_GP_STROBE_CE,
215 GPIO_CAM_GP_CAM1MP_XCLR,
216 GPIO_CAM_GP_CAMIF_RESET_N,
217 GPIO_CAM_GP_XMT_FLASH_INT,
218 GPIO_CAM_GP_LED_EN1,
219 GPIO_CAM_GP_LED_EN2,
220
221};
222#endif
223
Harini Jayaraman608d0462011-08-09 19:10:03 -0600224/* The SPI configurations apply to GSBI 1*/
225static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700226 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700227 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 .pull = GPIOMUX_PULL_NONE,
229};
230
Harini Jayaraman608d0462011-08-09 19:10:03 -0600231static struct gpiomux_setting spi_suspended_config = {
232 .func = GPIOMUX_FUNC_GPIO,
233 .drv = GPIOMUX_DRV_2MA,
234 .pull = GPIOMUX_PULL_DOWN,
235};
236
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530237static struct gpiomux_setting gsbi3_suspended_cfg = {
238 .func = GPIOMUX_FUNC_1,
239 .drv = GPIOMUX_DRV_2MA,
240 .pull = GPIOMUX_PULL_KEEPER,
241};
242
243static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244 .func = GPIOMUX_FUNC_1,
245 .drv = GPIOMUX_DRV_8MA,
246 .pull = GPIOMUX_PULL_NONE,
247};
248
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700249static struct gpiomux_setting gsbi5 = {
250 .func = GPIOMUX_FUNC_1,
251 .drv = GPIOMUX_DRV_8MA,
252 .pull = GPIOMUX_PULL_NONE,
253};
254
255static struct gpiomux_setting gsbi10 = {
256 .func = GPIOMUX_FUNC_2,
257 .drv = GPIOMUX_DRV_8MA,
258 .pull = GPIOMUX_PULL_NONE,
259};
260
261static struct gpiomux_setting gsbi12 = {
262 .func = GPIOMUX_FUNC_1,
263 .drv = GPIOMUX_DRV_8MA,
264 .pull = GPIOMUX_PULL_NONE,
265};
266
267static struct gpiomux_setting cdc_mclk = {
268 .func = GPIOMUX_FUNC_1,
269 .drv = GPIOMUX_DRV_8MA,
270 .pull = GPIOMUX_PULL_NONE,
271};
272
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700273static struct gpiomux_setting audio_auxpcm[] = {
274 /* Suspended state */
275 {
276 .func = GPIOMUX_FUNC_GPIO,
277 .drv = GPIOMUX_DRV_2MA,
278 .pull = GPIOMUX_PULL_NONE,
279 },
280 /* Active state */
281 {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_2MA,
284 .pull = GPIOMUX_PULL_NONE,
285 },
286};
287
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700288#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700289static struct gpiomux_setting gpio_eth_config = {
290 .pull = GPIOMUX_PULL_NONE,
291 .drv = GPIOMUX_DRV_8MA,
292 .func = GPIOMUX_FUNC_GPIO,
293};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700294#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295
296static struct gpiomux_setting slimbus = {
297 .func = GPIOMUX_FUNC_1,
298 .drv = GPIOMUX_DRV_8MA,
299 .pull = GPIOMUX_PULL_KEEPER,
300};
301
302struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700303#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700304 {
305 .gpio = KS8851_IRQ_GPIO,
306 .settings = {
307 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
308 }
309 },
310 {
311 .gpio = KS8851_RST_GPIO,
312 .settings = {
313 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
314 }
315 },
316 {
317 .gpio = FPGA_CS_GPIO,
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
320 }
321 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700322#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323};
324
325static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
326 {
327 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
328 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600329 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
330 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331 },
332 },
333 {
334 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
335 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600336 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
337 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700338 },
339 },
340 {
341 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 9, /* GSBI1 QUP SPI_CLK */
349 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600350 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
351 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352 },
353 },
354 {
355 .gpio = 16, /* GSBI3 I2C QUP SDA */
356 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530357 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
358 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 },
360 },
361 {
362 .gpio = 17, /* GSBI3 I2C QUP SCL */
363 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530364 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
365 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 },
367 },
368 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700369 .gpio = 22, /* GSBI5 UART2 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi5,
372 },
373 },
374 {
375 .gpio = 23, /* GSBI5 UART2 */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi5,
378 },
379 },
380 {
381 .gpio = 24, /* GSBI5 UART2 */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi5,
384 },
385 },
386 {
387 .gpio = 25, /* GSBI5 UART2 */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi5,
390 },
391 },
392 {
393 .gpio = 44, /* GSBI12 I2C QUP SDA */
394 .settings = {
395 [GPIOMUX_SUSPENDED] = &gsbi12,
396 },
397 },
398 {
399 .gpio = 45, /* GSBI12 I2C QUP SCL */
400 .settings = {
401 [GPIOMUX_SUSPENDED] = &gsbi12,
402 },
403 },
404 {
405 .gpio = 73, /* GSBI10 I2C QUP SDA */
406 .settings = {
407 [GPIOMUX_SUSPENDED] = &gsbi10,
408 },
409 },
410 {
411 .gpio = 74, /* GSBI10 I2C QUP SCL */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &gsbi10,
414 },
415 },
416};
417
418static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
419 {
420 .gpio = 60, /* slimbus data */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &slimbus,
423 },
424 },
425 {
426 .gpio = 61, /* slimbus clk */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &slimbus,
429 },
430 },
431};
432
433static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
434 {
435 .gpio = 59,
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &cdc_mclk,
438 },
439 },
440};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700441
442static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
443 {
444 .gpio = 63,
445 .settings = {
446 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
447 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
448 },
449 },
450 {
451 .gpio = 64,
452 .settings = {
453 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
454 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
455 },
456 },
457 {
458 .gpio = 65,
459 .settings = {
460 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
461 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
462 },
463 },
464 {
465 .gpio = 66,
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
468 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
469 },
470 },
471};
472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
474 .func = GPIOMUX_FUNC_GPIO,
475 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700476 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700477};
478
479static struct gpiomux_setting wcnss_5wire_active_cfg = {
480 .func = GPIOMUX_FUNC_1,
481 .drv = GPIOMUX_DRV_6MA,
482 .pull = GPIOMUX_PULL_DOWN,
483};
484
485static struct msm_gpiomux_config wcnss_5wire_interface[] = {
486 {
487 .gpio = 84,
488 .settings = {
489 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
490 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
491 },
492 },
493 {
494 .gpio = 85,
495 .settings = {
496 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
497 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
498 },
499 },
500 {
501 .gpio = 86,
502 .settings = {
503 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
504 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
505 },
506 },
507 {
508 .gpio = 87,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
511 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
512 },
513 },
514 {
515 .gpio = 88,
516 .settings = {
517 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
518 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
519 },
520 },
521};
Nishant Pandit24153d82011-08-27 16:05:13 +0530522static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530523 {
524 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
525 .drv = GPIOMUX_DRV_2MA,
526 .pull = GPIOMUX_PULL_DOWN,
527 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700528
Nishant Pandit474f2252011-07-23 23:17:56 +0530529 {
530 .func = GPIOMUX_FUNC_1, /*active 1*/
531 .drv = GPIOMUX_DRV_2MA,
532 .pull = GPIOMUX_PULL_NONE,
533 },
534
535 {
536 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
537 .drv = GPIOMUX_DRV_2MA,
538 .pull = GPIOMUX_PULL_NONE,
539 },
540
541 {
542 .func = GPIOMUX_FUNC_1, /*active 3*/
543 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700544 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530545 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530546
547 {
548 .func = GPIOMUX_FUNC_5, /*active 4*/
549 .drv = GPIOMUX_DRV_8MA,
550 .pull = GPIOMUX_PULL_UP,
551 },
552
553 {
554 .func = GPIOMUX_FUNC_6, /*active 5*/
555 .drv = GPIOMUX_DRV_8MA,
556 .pull = GPIOMUX_PULL_UP,
557 },
558
559 {
560 .func = GPIOMUX_FUNC_2, /*active 6*/
561 .drv = GPIOMUX_DRV_2MA,
562 .pull = GPIOMUX_PULL_UP,
563 },
564
565 {
566 .func = GPIOMUX_FUNC_3, /*active 7*/
567 .drv = GPIOMUX_DRV_8MA,
568 .pull = GPIOMUX_PULL_UP,
569 },
570
Kevin Chan4c58d292011-09-13 11:03:25 -0700571 {
572 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
573 .drv = GPIOMUX_DRV_2MA,
574 .pull = GPIOMUX_PULL_KEEPER,
575 },
576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700577};
578
Nishant Pandit24153d82011-08-27 16:05:13 +0530579static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580 {
581 .gpio = 2,
582 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530583 [GPIOMUX_ACTIVE] = &cam_settings[2],
584 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585 },
586 },
587 {
588 .gpio = 3,
589 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530590 [GPIOMUX_ACTIVE] = &cam_settings[1],
591 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592 },
593 },
594 {
595 .gpio = 4,
596 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530597 [GPIOMUX_ACTIVE] = &cam_settings[1],
598 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700599 },
600 },
601 {
602 .gpio = 5,
603 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530604 [GPIOMUX_ACTIVE] = &cam_settings[1],
605 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 },
608 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530609 .gpio = 76,
610 .settings = {
611 [GPIOMUX_ACTIVE] = &cam_settings[2],
612 [GPIOMUX_SUSPENDED] = &cam_settings[0],
613 },
614 },
615 {
616 .gpio = 107,
617 .settings = {
618 [GPIOMUX_ACTIVE] = &cam_settings[2],
619 [GPIOMUX_SUSPENDED] = &cam_settings[0],
620 },
621 },
622};
623
624static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
625 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700626 .gpio = 18,
627 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530628 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700629 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700630 },
631 },
632 {
633 .gpio = 19,
634 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530635 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700636 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700637 },
638 },
639 {
640 .gpio = 20,
641 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530642 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700643 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644 },
645 },
646 {
647 .gpio = 21,
648 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530649 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700650 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651 },
652 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653};
654
655static struct gpiomux_setting cyts_resout_sus_cfg = {
656 .func = GPIOMUX_FUNC_GPIO,
657 .drv = GPIOMUX_DRV_6MA,
658 .pull = GPIOMUX_PULL_UP,
659};
660
661static struct gpiomux_setting cyts_resout_act_cfg = {
662 .func = GPIOMUX_FUNC_GPIO,
663 .drv = GPIOMUX_DRV_6MA,
664 .pull = GPIOMUX_PULL_UP,
665};
666
667static struct gpiomux_setting cyts_sleep_sus_cfg = {
668 .func = GPIOMUX_FUNC_GPIO,
669 .drv = GPIOMUX_DRV_6MA,
670 .pull = GPIOMUX_PULL_DOWN,
671};
672
673static struct gpiomux_setting cyts_sleep_act_cfg = {
674 .func = GPIOMUX_FUNC_GPIO,
675 .drv = GPIOMUX_DRV_6MA,
676 .pull = GPIOMUX_PULL_DOWN,
677};
678
679static struct gpiomux_setting cyts_int_act_cfg = {
680 .func = GPIOMUX_FUNC_GPIO,
681 .drv = GPIOMUX_DRV_8MA,
682 .pull = GPIOMUX_PULL_UP,
683};
684
685static struct gpiomux_setting cyts_int_sus_cfg = {
686 .func = GPIOMUX_FUNC_GPIO,
687 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530688 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700689};
690
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
692 { /* TS INTERRUPT */
693 .gpio = 11,
694 .settings = {
695 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
696 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
697 },
698 },
699 { /* TS SLEEP */
700 .gpio = 50,
701 .settings = {
702 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
703 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
704 },
705 },
706 { /* TS RESOUT */
707 .gpio = 52,
708 .settings = {
709 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
710 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
711 },
712 },
713};
714
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530715#ifdef CONFIG_USB_EHCI_MSM_HSIC
716static struct gpiomux_setting hsic_act_cfg = {
717 .func = GPIOMUX_FUNC_1,
718 .drv = GPIOMUX_DRV_12MA,
719 .pull = GPIOMUX_PULL_NONE,
720};
721
722static struct gpiomux_setting hsic_sus_cfg = {
723 .func = GPIOMUX_FUNC_GPIO,
724 .drv = GPIOMUX_DRV_2MA,
725 .pull = GPIOMUX_PULL_DOWN,
726};
727
728static struct msm_gpiomux_config msm8960_hsic_configs[] = {
729 {
730 .gpio = 150, /*HSIC_STROBE */
731 .settings = {
732 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
733 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
734 },
735 },
736 {
737 .gpio = 151, /* HSIC_DATA */
738 .settings = {
739 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
740 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
741 },
742 },
743};
744#endif
745
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700746#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
747enum {
748 SX150X_CAM,
749};
750
Nishant Pandit474f2252011-07-23 23:17:56 +0530751static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700752 [SX150X_CAM] = {
753 .gpio_base = GPIO_CAM_EXPANDER_BASE,
754 .oscio_is_gpo = false,
755 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530756 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700757 .io_open_drain_ena = 0x0,
758 .irq_summary = -1,
759 },
760};
Nishant Pandit474f2252011-07-23 23:17:56 +0530761
762#endif
763
764#ifdef CONFIG_I2C
765
766#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
767#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300768#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530769
770#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
771
772static struct i2c_board_info cam_expander_i2c_info[] = {
773 {
774 I2C_BOARD_INFO("sx1508q", 0x22),
775 .platform_data = &sx150x_data[SX150X_CAM]
776 },
777};
778
779static struct msm_cam_expander_info cam_expander_info[] = {
780 {
781 cam_expander_i2c_info,
782 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
783 },
784};
785#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700786#endif
787
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700788#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
789#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700790#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700791#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
792#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
793#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700794#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700795#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700796
797
798#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
799#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
800#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
801#define MSM_ION_HEAP_NUM 4
802#else
803#define MSM_ION_HEAP_NUM 2
804#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
807static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
808static int __init pmem_kernel_ebi1_size_setup(char *p)
809{
810 pmem_kernel_ebi1_size = memparse(p, NULL);
811 return 0;
812}
813early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
814#endif
815
816#ifdef CONFIG_ANDROID_PMEM
817static unsigned pmem_size = MSM_PMEM_SIZE;
818static int __init pmem_size_setup(char *p)
819{
820 pmem_size = memparse(p, NULL);
821 return 0;
822}
823early_param("pmem_size", pmem_size_setup);
824
825static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
826
827static int __init pmem_adsp_size_setup(char *p)
828{
829 pmem_adsp_size = memparse(p, NULL);
830 return 0;
831}
832early_param("pmem_adsp_size", pmem_adsp_size_setup);
833
834static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
835
836static int __init pmem_audio_size_setup(char *p)
837{
838 pmem_audio_size = memparse(p, NULL);
839 return 0;
840}
841early_param("pmem_audio_size", pmem_audio_size_setup);
842#endif
843
844#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700845#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846static struct android_pmem_platform_data android_pmem_pdata = {
847 .name = "pmem",
848 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
849 .cached = 1,
850 .memory_type = MEMTYPE_EBI1,
851};
852
853static struct platform_device android_pmem_device = {
854 .name = "android_pmem",
855 .id = 0,
856 .dev = {.platform_data = &android_pmem_pdata},
857};
858
859static struct android_pmem_platform_data android_pmem_adsp_pdata = {
860 .name = "pmem_adsp",
861 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
862 .cached = 0,
863 .memory_type = MEMTYPE_EBI1,
864};
865static struct platform_device android_pmem_adsp_device = {
866 .name = "android_pmem",
867 .id = 2,
868 .dev = { .platform_data = &android_pmem_adsp_pdata },
869};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700870#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700871
872static struct android_pmem_platform_data android_pmem_audio_pdata = {
873 .name = "pmem_audio",
874 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
875 .cached = 0,
876 .memory_type = MEMTYPE_EBI1,
877};
878
879static struct platform_device android_pmem_audio_device = {
880 .name = "android_pmem",
881 .id = 4,
882 .dev = { .platform_data = &android_pmem_audio_pdata },
883};
884#endif
885
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700886#define DSP_RAM_BASE_8960 0x8da00000
887#define DSP_RAM_SIZE_8960 0x1800000
888static int dspcrashd_pdata_8960 = 0xDEADDEAD;
889
890static struct resource resources_dspcrashd_8960[] = {
891 {
892 .name = "msm_dspcrashd",
893 .start = DSP_RAM_BASE_8960,
894 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
895 .flags = IORESOURCE_DMA,
896 },
897};
898
899struct platform_device msm_device_dspcrashd_8960 = {
900 .name = "msm_dspcrashd",
901 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
902 .resource = resources_dspcrashd_8960,
903 .dev = { .platform_data = &dspcrashd_pdata_8960 },
904};
905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906static struct memtype_reserve msm8960_reserve_table[] __initdata = {
907 [MEMTYPE_SMI] = {
908 },
909 [MEMTYPE_EBI0] = {
910 .flags = MEMTYPE_FLAGS_1M_ALIGN,
911 },
912 [MEMTYPE_EBI1] = {
913 .flags = MEMTYPE_FLAGS_1M_ALIGN,
914 },
915};
916
917static void __init size_pmem_devices(void)
918{
919#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700920#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700921 android_pmem_adsp_pdata.size = pmem_adsp_size;
922 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700923#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
925#endif
926}
927
928static void __init reserve_memory_for(struct android_pmem_platform_data *p)
929{
930 msm8960_reserve_table[p->memory_type].size += p->size;
931}
932
933static void __init reserve_pmem_memory(void)
934{
935#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700936#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937 reserve_memory_for(&android_pmem_adsp_pdata);
938 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700939#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700940 reserve_memory_for(&android_pmem_audio_pdata);
941 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
942#endif
943}
944
Larry Basselb4126da2011-07-18 14:31:33 -0700945static int msm8960_paddr_to_memtype(unsigned int paddr)
946{
947 return MEMTYPE_EBI1;
948}
949
Laura Abbottd6183792011-08-19 13:42:24 -0700950#ifdef CONFIG_ION_MSM
951struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700952 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700953 .heaps = {
954 {
955 .id = ION_HEAP_SYSTEM_ID,
956 .type = ION_HEAP_TYPE_SYSTEM,
957 .name = ION_KMALLOC_HEAP_NAME,
958 },
959 {
960 .id = ION_HEAP_SYSTEM_CONTIG_ID,
961 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
962 .name = ION_VMALLOC_HEAP_NAME,
963 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700964#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700965 {
966 .id = ION_HEAP_EBI_ID,
967 .type = ION_HEAP_TYPE_CARVEOUT,
968 .name = ION_EBI1_HEAP_NAME,
969 .size = MSM_ION_EBI_SIZE,
970 .memory_type = ION_EBI_TYPE,
971 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700972 {
973 .id = ION_HEAP_ADSP_ID,
974 .type = ION_HEAP_TYPE_CARVEOUT,
975 .name = ION_ADSP_HEAP_NAME,
976 .size = MSM_ION_ADSP_SIZE,
977 .memory_type = ION_EBI_TYPE,
978 },
979#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700980 }
981};
982
983struct platform_device ion_dev = {
984 .name = "ion-msm",
985 .id = 1,
986 .dev = { .platform_data = &ion_pdata },
987};
988#endif
989
990static void reserve_ion_memory(void)
991{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700992#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -0700993 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700994 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700995#endif
996}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700997static void __init msm8960_calculate_reserve_sizes(void)
998{
999 size_pmem_devices();
1000 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001001 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001002}
1003
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004static struct reserve_info msm8960_reserve_info __initdata = {
1005 .memtype_reserve_table = msm8960_reserve_table,
1006 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1007 .paddr_to_memtype = msm8960_paddr_to_memtype,
1008};
1009
Larry Basselb4126da2011-07-18 14:31:33 -07001010static int msm8960_memory_bank_size(void)
1011{
1012 return 1<<29;
1013}
1014
1015static void __init locate_unstable_memory(void)
1016{
1017 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1018 unsigned long bank_size;
1019 unsigned long low, high;
1020
1021 bank_size = msm8960_memory_bank_size();
1022 low = meminfo.bank[0].start;
1023 high = mb->start + mb->size;
1024 low &= ~(bank_size - 1);
1025
1026 if (high - low <= bank_size)
1027 return;
1028 msm8960_reserve_info.low_unstable_address = low + bank_size;
1029 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1030 msm8960_reserve_info.bank_size = bank_size;
1031 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1032 msm8960_reserve_info.low_unstable_address,
1033 msm8960_reserve_info.max_unstable_size,
1034 msm8960_reserve_info.bank_size);
1035}
1036
Larry Basselb830e182011-10-14 10:46:55 -07001037static void __init place_movable_zone(void)
1038{
1039 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1040 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1041 pr_info("movable zone start %lx size %lx\n",
1042 movable_reserved_start, movable_reserved_size);
1043}
1044
1045static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001046{
1047 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001048 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001049 place_movable_zone();
1050}
1051
1052static void __init msm8960_reserve(void)
1053{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001054 msm_reserve();
1055}
1056
Larry Bassela4414b12011-08-04 11:11:02 -07001057static int msm8960_change_memory_power(u64 start, u64 size,
1058 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001059{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001060 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001061}
1062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063#ifdef CONFIG_MSM_CAMERA
1064
Nishant Pandit24153d82011-08-27 16:05:13 +05301065static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066 5, /*CAMIF_MCLK*/
1067 20, /*CAMIF_I2C_DATA*/
1068 21, /*CAMIF_I2C_CLK*/
1069};
1070
Nishant Pandit24153d82011-08-27 16:05:13 +05301071static struct msm_camera_gpio_conf gpio_conf = {
1072 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1073 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1074 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1075 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1076};
1077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078#define VFE_CAMIF_TIMER1_GPIO 2
1079#define VFE_CAMIF_TIMER2_GPIO 3
1080#define VFE_CAMIF_TIMER3_GPIO_INT 4
1081struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1082 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1083 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1084 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1085 .flash_recharge_duration = 50000,
1086 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1087};
1088
Nishant Pandit474f2252011-07-23 23:17:56 +05301089#ifdef CONFIG_MSM_CAMERA_FLASH
1090static struct msm_camera_sensor_flash_src msm_flash_src = {
1091 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1092 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1093 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1094#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1095 defined(CONFIG_GPIO_SX150X_MODULE))
1096 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1097#endif
1098};
1099#endif
1100
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001101static struct msm_bus_vectors cam_init_vectors[] = {
1102 {
1103 .src = MSM_BUS_MASTER_VFE,
1104 .dst = MSM_BUS_SLAVE_EBI_CH0,
1105 .ab = 0,
1106 .ib = 0,
1107 },
1108 {
1109 .src = MSM_BUS_MASTER_VPE,
1110 .dst = MSM_BUS_SLAVE_EBI_CH0,
1111 .ab = 0,
1112 .ib = 0,
1113 },
1114 {
1115 .src = MSM_BUS_MASTER_JPEG_ENC,
1116 .dst = MSM_BUS_SLAVE_EBI_CH0,
1117 .ab = 0,
1118 .ib = 0,
1119 },
1120};
1121
1122static struct msm_bus_vectors cam_preview_vectors[] = {
1123 {
1124 .src = MSM_BUS_MASTER_VFE,
1125 .dst = MSM_BUS_SLAVE_EBI_CH0,
1126 .ab = 27648000,
1127 .ib = 110592000,
1128 },
1129 {
1130 .src = MSM_BUS_MASTER_VPE,
1131 .dst = MSM_BUS_SLAVE_EBI_CH0,
1132 .ab = 0,
1133 .ib = 0,
1134 },
1135 {
1136 .src = MSM_BUS_MASTER_JPEG_ENC,
1137 .dst = MSM_BUS_SLAVE_EBI_CH0,
1138 .ab = 0,
1139 .ib = 0,
1140 },
1141};
1142
1143static struct msm_bus_vectors cam_video_vectors[] = {
1144 {
1145 .src = MSM_BUS_MASTER_VFE,
1146 .dst = MSM_BUS_SLAVE_EBI_CH0,
1147 .ab = 140451840,
1148 .ib = 561807360,
1149 },
1150 {
1151 .src = MSM_BUS_MASTER_VPE,
1152 .dst = MSM_BUS_SLAVE_EBI_CH0,
1153 .ab = 206807040,
1154 .ib = 488816640,
1155 },
1156 {
1157 .src = MSM_BUS_MASTER_JPEG_ENC,
1158 .dst = MSM_BUS_SLAVE_EBI_CH0,
1159 .ab = 0,
1160 .ib = 0,
1161 },
1162};
1163
1164static struct msm_bus_vectors cam_snapshot_vectors[] = {
1165 {
1166 .src = MSM_BUS_MASTER_VFE,
1167 .dst = MSM_BUS_SLAVE_EBI_CH0,
1168 .ab = 274423680,
1169 .ib = 1097694720,
1170 },
1171 {
1172 .src = MSM_BUS_MASTER_VPE,
1173 .dst = MSM_BUS_SLAVE_EBI_CH0,
1174 .ab = 0,
1175 .ib = 0,
1176 },
1177 {
1178 .src = MSM_BUS_MASTER_JPEG_ENC,
1179 .dst = MSM_BUS_SLAVE_EBI_CH0,
1180 .ab = 540000000,
1181 .ib = 1350000000,
1182 },
1183};
1184
1185static struct msm_bus_vectors cam_zsl_vectors[] = {
1186 {
1187 .src = MSM_BUS_MASTER_VFE,
1188 .dst = MSM_BUS_SLAVE_EBI_CH0,
1189 .ab = 302071680,
1190 .ib = 1208286720,
1191 },
1192 {
1193 .src = MSM_BUS_MASTER_VPE,
1194 .dst = MSM_BUS_SLAVE_EBI_CH0,
1195 .ab = 0,
1196 .ib = 0,
1197 },
1198 {
1199 .src = MSM_BUS_MASTER_JPEG_ENC,
1200 .dst = MSM_BUS_SLAVE_EBI_CH0,
1201 .ab = 540000000,
1202 .ib = 1350000000,
1203 },
1204};
1205
1206static struct msm_bus_paths cam_bus_client_config[] = {
1207 {
1208 ARRAY_SIZE(cam_init_vectors),
1209 cam_init_vectors,
1210 },
1211 {
1212 ARRAY_SIZE(cam_preview_vectors),
1213 cam_preview_vectors,
1214 },
1215 {
1216 ARRAY_SIZE(cam_video_vectors),
1217 cam_video_vectors,
1218 },
1219 {
1220 ARRAY_SIZE(cam_snapshot_vectors),
1221 cam_snapshot_vectors,
1222 },
1223 {
1224 ARRAY_SIZE(cam_zsl_vectors),
1225 cam_zsl_vectors,
1226 },
1227};
1228
1229static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1230 cam_bus_client_config,
1231 ARRAY_SIZE(cam_bus_client_config),
1232 .name = "msm_camera",
1233};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001234
Nishant Pandit24153d82011-08-27 16:05:13 +05301235struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1236 {
1237 .ioclk.mclk_clk_rate = 24000000,
1238 .ioclk.vfe_clk_rate = 228570000,
1239 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001240 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301241 },
1242 {
1243 .ioclk.mclk_clk_rate = 24000000,
1244 .ioclk.vfe_clk_rate = 228570000,
1245 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001246 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301247 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001248};
1249
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001250#ifdef CONFIG_IMX074_ACT
1251static struct i2c_board_info imx074_actuator_i2c_info = {
1252 I2C_BOARD_INFO("imx074_act", 0x11),
1253};
1254
1255static struct msm_actuator_info imx074_actuator_info = {
1256 .board_info = &imx074_actuator_i2c_info,
1257 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1258 .vcm_pwd = 0,
1259 .vcm_enable = 1,
1260};
1261#endif
1262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263#ifdef CONFIG_IMX074
1264static struct msm_camera_sensor_flash_data flash_imx074 = {
1265 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301266#ifdef CONFIG_MSM_CAMERA_FLASH
1267 .flash_src = &msm_flash_src
1268#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269};
1270
Nishant Pandit24153d82011-08-27 16:05:13 +05301271static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1272 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001273 .sensor_reset = 107,
1274 .sensor_pwd = 85,
1275 .vcm_pwd = 0,
1276 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301277};
1278
1279static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1280 .sensor_name = "imx074",
1281 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 .flash_data = &flash_imx074,
1283 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301284 .sensor_platform_info = &sensor_board_info_imx074,
1285 .gpio_conf = &gpio_conf,
1286 .csi_if = 1,
1287 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001288#ifdef CONFIG_IMX074_ACT
1289 .actuator_info = &imx074_actuator_info
1290#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291};
1292
1293struct platform_device msm8960_camera_sensor_imx074 = {
1294 .name = "msm_camera_imx074",
1295 .dev = {
1296 .platform_data = &msm_camera_sensor_imx074_data,
1297 },
1298};
1299#endif
1300#ifdef CONFIG_OV2720
1301static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001302 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303};
1304
Nishant Pandit24153d82011-08-27 16:05:13 +05301305static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1306 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307 .sensor_reset = 76,
1308 .sensor_pwd = 85,
1309 .vcm_pwd = 0,
1310 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301311};
1312
1313static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1314 .sensor_name = "ov2720",
1315 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001316 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301317 .sensor_platform_info = &sensor_board_info_ov2720,
1318 .gpio_conf = &gpio_conf,
1319 .csi_if = 1,
1320 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321};
1322
1323struct platform_device msm8960_camera_sensor_ov2720 = {
1324 .name = "msm_camera_ov2720",
1325 .dev = {
1326 .platform_data = &msm_camera_sensor_ov2720_data,
1327 },
1328};
1329#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001330
1331static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1332 .flash_type = MSM_CAMERA_FLASH_LED,
1333};
1334
Nishant Pandit24153d82011-08-27 16:05:13 +05301335static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1336 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001337 .sensor_reset = 107,
1338 .sensor_pwd = 85,
1339 .vcm_pwd = 0,
1340 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301341};
1342
1343static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1344 .sensor_name = "qs_mt9p017",
1345 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001346 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301347 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1348 .gpio_conf = &gpio_conf,
1349 .csi_if = 1,
1350 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001351};
1352
1353struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1354 .name = "msm_camera_qs_mt9p017",
1355 .dev = {
1356 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1357 },
1358};
1359
Kevin Chan8b0d2322011-09-10 21:06:31 -07001360static struct msm8960_privacy_light_cfg privacy_light_info = {
1361 .mpp = PM8921_MPP_PM_TO_SYS(12),
1362};
1363
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364static void __init msm8960_init_cam(void)
1365{
1366 int i;
1367 struct platform_device *cam_dev[] = {
1368 &msm8960_camera_sensor_imx074,
1369 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001370 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 };
1372
Kevin Chan8b0d2322011-09-10 21:06:31 -07001373 if (machine_is_msm8960_liquid()) {
1374 struct msm_camera_sensor_info *s_info;
1375 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1376 s_info->sensor_platform_info->mount_angle = 180;
1377 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1378 s_info->sensor_platform_info->privacy_light = 1;
1379 s_info->sensor_platform_info->privacy_light_info =
1380 &privacy_light_info;
1381 }
1382
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001383 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1384 struct msm_camera_sensor_info *s_info;
1385 s_info = cam_dev[i]->dev.platform_data;
1386 msm_get_cam_resources(s_info);
1387 platform_device_register(cam_dev[i]);
1388 }
1389}
1390#endif
1391
1392#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001393#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001394#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001395#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001396#endif
1397
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001398
1399#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001400#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001402#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1403#else
1404#define MSM_FB_EXT_BUF_SIZE 0
1405#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406
kuogee hsieh3830eb92011-09-12 15:25:57 -07001407#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1408/* width x height x 3 bpp x 2 frame buffer */
1409#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1410#define MSM_FB_WRITEBACK_OFFSET \
1411 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1412#else
1413#define MSM_FB_WRITEBACK_SIZE 0
1414#define MSM_FB_WRITEBACK_OFFSET 0
1415#endif
1416
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001417#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1418/* 4 bpp x 2 page HDMI case */
1419#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1420#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001421/* Note: must be multiple of 4096 */
1422#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1423 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001424#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001425
1426static int writeback_offset(void)
1427{
1428 return MSM_FB_WRITEBACK_OFFSET;
1429}
1430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001431
1432#define MDP_VSYNC_GPIO 0
1433
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001434#define PANEL_NAME_MAX_LEN 30
1435#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1436#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1437#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1438#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1439#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1440#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1441#define HDMI_PANEL_NAME "hdmi_msm"
1442#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001444static struct resource msm_fb_resources[] = {
1445 {
1446 .flags = IORESOURCE_DMA,
1447 }
1448};
1449
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001450static int msm_fb_detect_panel(const char *name)
1451{
1452 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001453 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1454 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1455 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001456 return 0;
1457 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001458 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1459 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1460 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001461 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001462
1463#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1464 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1465 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1466 PANEL_NAME_MAX_LEN)))
1467 return 0;
1468
1469 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1470 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1471 PANEL_NAME_MAX_LEN)))
1472 return 0;
1473
1474 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1475 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1476 PANEL_NAME_MAX_LEN)))
1477 return 0;
1478
1479 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1480 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1481 PANEL_NAME_MAX_LEN)))
1482 return 0;
1483#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001484 }
1485
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001486 if (!strncmp(name, HDMI_PANEL_NAME,
1487 strnlen(HDMI_PANEL_NAME,
1488 PANEL_NAME_MAX_LEN)))
1489 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001490
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001491 if (!strncmp(name, TVOUT_PANEL_NAME,
1492 strnlen(TVOUT_PANEL_NAME,
1493 PANEL_NAME_MAX_LEN)))
1494 return 0;
1495
1496 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001497 return -ENODEV;
1498}
1499
1500static struct msm_fb_platform_data msm_fb_pdata = {
1501 .detect_client = msm_fb_detect_panel,
1502};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001503
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001504static struct platform_device msm_fb_device = {
1505 .name = "msm_fb",
1506 .id = 0,
1507 .num_resources = ARRAY_SIZE(msm_fb_resources),
1508 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001509 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510};
1511
1512static bool dsi_power_on;
1513
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001514/**
1515 * LiQUID panel on/off
1516 *
1517 * @param on
1518 *
1519 * @return int
1520 */
1521static int mipi_dsi_liquid_panel_power(int on)
1522{
1523 static struct regulator *reg_l2, *reg_ext_3p3v;
1524 static int gpio21, gpio24, gpio43;
1525 int rc;
1526
1527 pr_info("%s: on=%d\n", __func__, on);
1528
1529 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1530 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1531 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1532
1533 if (!dsi_power_on) {
1534
1535 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1536 "dsi_vdda");
1537 if (IS_ERR(reg_l2)) {
1538 pr_err("could not get 8921_l2, rc = %ld\n",
1539 PTR_ERR(reg_l2));
1540 return -ENODEV;
1541 }
1542
1543 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1544 if (rc) {
1545 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1546 return -EINVAL;
1547 }
1548
1549 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1550 "vdd_lvds_3p3v");
1551 if (IS_ERR(reg_ext_3p3v)) {
1552 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1553 PTR_ERR(reg_ext_3p3v));
1554 return -ENODEV;
1555 }
1556
1557 rc = gpio_request(gpio21, "disp_pwr_en_n");
1558 if (rc) {
1559 pr_err("request gpio 21 failed, rc=%d\n", rc);
1560 return -ENODEV;
1561 }
1562
1563 rc = gpio_request(gpio43, "disp_rst_n");
1564 if (rc) {
1565 pr_err("request gpio 43 failed, rc=%d\n", rc);
1566 return -ENODEV;
1567 }
1568
1569 rc = gpio_request(gpio24, "disp_backlight_pwm");
1570 if (rc) {
1571 pr_err("request gpio 24 failed, rc=%d\n", rc);
1572 return -ENODEV;
1573 }
1574
1575 dsi_power_on = true;
1576 }
1577
1578 if (on) {
1579 rc = regulator_set_optimum_mode(reg_l2, 100000);
1580 if (rc < 0) {
1581 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1582 return -EINVAL;
1583 }
1584 rc = regulator_enable(reg_l2);
1585 if (rc) {
1586 pr_err("enable l2 failed, rc=%d\n", rc);
1587 return -ENODEV;
1588 }
1589
1590 rc = regulator_enable(reg_ext_3p3v);
1591 if (rc) {
1592 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1593 return -ENODEV;
1594 }
1595
1596 /* set reset pin before power enable */
1597 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1598
1599 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1600 msleep(20);
1601 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1602 msleep(20);
1603 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1604 msleep(20);
1605 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1606 msleep(20);
1607 } else {
1608 gpio_set_value_cansleep(gpio43, 0);
1609 gpio_set_value_cansleep(gpio21, 1);
1610
1611 rc = regulator_disable(reg_l2);
1612 if (rc) {
1613 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1614 return -ENODEV;
1615 }
1616 rc = regulator_disable(reg_ext_3p3v);
1617 if (rc) {
1618 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1619 return -ENODEV;
1620 }
1621 rc = regulator_set_optimum_mode(reg_l2, 100);
1622 if (rc < 0) {
1623 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1624 return -EINVAL;
1625 }
1626 }
1627
1628 return 0;
1629}
1630
1631static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001632{
1633 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001634 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001635 int rc;
1636
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637 pr_info("%s: state : %d\n", __func__, on);
1638
1639 if (!dsi_power_on) {
1640
1641 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1642 "dsi_vdc");
1643 if (IS_ERR(reg_l8)) {
1644 pr_err("could not get 8921_l8, rc = %ld\n",
1645 PTR_ERR(reg_l8));
1646 return -ENODEV;
1647 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001648 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1649 "dsi_vddio");
1650 if (IS_ERR(reg_l23)) {
1651 pr_err("could not get 8921_l23, rc = %ld\n",
1652 PTR_ERR(reg_l23));
1653 return -ENODEV;
1654 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001655 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1656 "dsi_vdda");
1657 if (IS_ERR(reg_l2)) {
1658 pr_err("could not get 8921_l2, rc = %ld\n",
1659 PTR_ERR(reg_l2));
1660 return -ENODEV;
1661 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001662 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1663 if (rc) {
1664 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1665 return -EINVAL;
1666 }
1667 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1668 if (rc) {
1669 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1670 return -EINVAL;
1671 }
1672 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1673 if (rc) {
1674 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1675 return -EINVAL;
1676 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001677 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1678 rc = gpio_request(gpio43, "disp_rst_n");
1679 if (rc) {
1680 pr_err("request gpio 43 failed, rc=%d\n", rc);
1681 return -ENODEV;
1682 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683 dsi_power_on = true;
1684 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685 if (on) {
1686 rc = regulator_set_optimum_mode(reg_l8, 100000);
1687 if (rc < 0) {
1688 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1689 return -EINVAL;
1690 }
1691 rc = regulator_set_optimum_mode(reg_l23, 100000);
1692 if (rc < 0) {
1693 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1694 return -EINVAL;
1695 }
1696 rc = regulator_set_optimum_mode(reg_l2, 100000);
1697 if (rc < 0) {
1698 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1699 return -EINVAL;
1700 }
1701 rc = regulator_enable(reg_l8);
1702 if (rc) {
1703 pr_err("enable l8 failed, rc=%d\n", rc);
1704 return -ENODEV;
1705 }
1706 rc = regulator_enable(reg_l23);
1707 if (rc) {
1708 pr_err("enable l8 failed, rc=%d\n", rc);
1709 return -ENODEV;
1710 }
1711 rc = regulator_enable(reg_l2);
1712 if (rc) {
1713 pr_err("enable l2 failed, rc=%d\n", rc);
1714 return -ENODEV;
1715 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 gpio_set_value_cansleep(gpio43, 1);
1717 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001718 rc = regulator_disable(reg_l2);
1719 if (rc) {
1720 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1721 return -ENODEV;
1722 }
1723 rc = regulator_disable(reg_l8);
1724 if (rc) {
1725 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1726 return -ENODEV;
1727 }
1728 rc = regulator_disable(reg_l23);
1729 if (rc) {
1730 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1731 return -ENODEV;
1732 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733 rc = regulator_set_optimum_mode(reg_l8, 100);
1734 if (rc < 0) {
1735 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1736 return -EINVAL;
1737 }
1738 rc = regulator_set_optimum_mode(reg_l23, 100);
1739 if (rc < 0) {
1740 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1741 return -EINVAL;
1742 }
1743 rc = regulator_set_optimum_mode(reg_l2, 100);
1744 if (rc < 0) {
1745 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1746 return -EINVAL;
1747 }
1748 gpio_set_value_cansleep(gpio43, 0);
1749 }
1750 return 0;
1751}
1752
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001753static int mipi_dsi_panel_power(int on)
1754{
1755 int ret;
1756
1757 pr_info("%s: on=%d\n", __func__, on);
1758
1759 if (machine_is_msm8960_liquid())
1760 ret = mipi_dsi_liquid_panel_power(on);
1761 else
1762 ret = mipi_dsi_cdp_panel_power(on);
1763
1764 return ret;
1765}
1766
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001767static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1768 .vsync_gpio = MDP_VSYNC_GPIO,
1769 .dsi_power_save = mipi_dsi_panel_power,
1770};
1771
1772#ifdef CONFIG_MSM_BUS_SCALING
1773
1774static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001775 {
1776 .src = MSM_BUS_MASTER_MDP_PORT0,
1777 .dst = MSM_BUS_SLAVE_EBI_CH0,
1778 .ab = 0,
1779 .ib = 0,
1780 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001781};
1782
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001783#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1784static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1785 /* If HDMI is used as primary */
1786 {
1787 .src = MSM_BUS_MASTER_MDP_PORT0,
1788 .dst = MSM_BUS_SLAVE_EBI_CH0,
1789 .ab = 2000000000,
1790 .ib = 2000000000,
1791 },
1792};
1793static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1794 {
1795 ARRAY_SIZE(mdp_init_vectors),
1796 mdp_init_vectors,
1797 },
1798 {
1799 ARRAY_SIZE(hdmi_as_primary_vectors),
1800 hdmi_as_primary_vectors,
1801 },
1802 {
1803 ARRAY_SIZE(hdmi_as_primary_vectors),
1804 hdmi_as_primary_vectors,
1805 },
1806 {
1807 ARRAY_SIZE(hdmi_as_primary_vectors),
1808 hdmi_as_primary_vectors,
1809 },
1810 {
1811 ARRAY_SIZE(hdmi_as_primary_vectors),
1812 hdmi_as_primary_vectors,
1813 },
1814 {
1815 ARRAY_SIZE(hdmi_as_primary_vectors),
1816 hdmi_as_primary_vectors,
1817 },
1818};
1819#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001820static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001821 {
1822 .src = MSM_BUS_MASTER_MDP_PORT0,
1823 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001824 .ab = 216000000 * 2,
1825 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001826 },
1827};
1828
1829static struct msm_bus_vectors mdp_vga_vectors[] = {
1830 /* VGA and less video */
1831 {
1832 .src = MSM_BUS_MASTER_MDP_PORT0,
1833 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001834 .ab = 216000000 * 2,
1835 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001836 },
1837};
1838
1839static struct msm_bus_vectors mdp_720p_vectors[] = {
1840 /* 720p and less video */
1841 {
1842 .src = MSM_BUS_MASTER_MDP_PORT0,
1843 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001844 .ab = 230400000 * 2,
1845 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001846 },
1847};
1848
1849static struct msm_bus_vectors mdp_1080p_vectors[] = {
1850 /* 1080p and less video */
1851 {
1852 .src = MSM_BUS_MASTER_MDP_PORT0,
1853 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001854 .ab = 334080000 * 2,
1855 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001856 },
1857};
1858
1859static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1860 {
1861 ARRAY_SIZE(mdp_init_vectors),
1862 mdp_init_vectors,
1863 },
1864 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001865 ARRAY_SIZE(mdp_ui_vectors),
1866 mdp_ui_vectors,
1867 },
1868 {
1869 ARRAY_SIZE(mdp_ui_vectors),
1870 mdp_ui_vectors,
1871 },
1872 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873 ARRAY_SIZE(mdp_vga_vectors),
1874 mdp_vga_vectors,
1875 },
1876 {
1877 ARRAY_SIZE(mdp_720p_vectors),
1878 mdp_720p_vectors,
1879 },
1880 {
1881 ARRAY_SIZE(mdp_1080p_vectors),
1882 mdp_1080p_vectors,
1883 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001884};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001885#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001886
1887static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1888 mdp_bus_scale_usecases,
1889 ARRAY_SIZE(mdp_bus_scale_usecases),
1890 .name = "mdp",
1891};
1892
1893#endif
1894
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001895#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1896int mdp_core_clk_rate_table[] = {
1897 200000000,
1898 200000000,
1899 200000000,
1900 200000000,
1901};
1902#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903int mdp_core_clk_rate_table[] = {
1904 85330000,
1905 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001906 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 200000000,
1908};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001909#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910
1911static struct msm_panel_common_pdata mdp_pdata = {
1912 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001913#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1914 .mdp_core_clk_rate = 200000000,
1915#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001917#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001918 .mdp_core_clk_table = mdp_core_clk_rate_table,
1919 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1920#ifdef CONFIG_MSM_BUS_SCALING
1921 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1922#endif
1923 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001924 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001925};
1926
1927static struct platform_device mipi_dsi_renesas_panel_device = {
1928 .name = "mipi_renesas",
1929 .id = 0,
1930};
1931
1932static struct platform_device mipi_dsi_simulator_panel_device = {
1933 .name = "mipi_simulator",
1934 .id = 0,
1935};
1936
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001937#define LPM_CHANNEL0 0
1938static int toshiba_gpio[] = {LPM_CHANNEL0};
1939
1940static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1941 .gpio = toshiba_gpio,
1942};
1943
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944static struct platform_device mipi_dsi_toshiba_panel_device = {
1945 .name = "mipi_toshiba",
1946 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001947 .dev = {
1948 .platform_data = &toshiba_pdata,
1949 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950};
1951
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001952static int dsi2lvds_gpio[2] = {
1953 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1954 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1955 };
1956
1957static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1958 .gpio_num = dsi2lvds_gpio,
1959};
1960
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001961static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1962
1963/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1964 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1965 /* timing */
1966 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1967 0x0c, 0x03, 0x04, 0xa0},
1968 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1969 {0xff, 0x00, 0x06, 0x00}, /* strength */
1970 /* pll control */
1971 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1972 0x40, 0x07, 0x03,
1973 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1974};
1975
1976static struct mipi_dsi_panel_platform_data novatek_pdata = {
1977 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1978};
1979
1980static struct platform_device mipi_dsi_novatek_panel_device = {
1981 .name = "mipi_novatek",
1982 .id = 0,
1983 .dev = {
1984 .platform_data = &novatek_pdata,
1985 }
1986};
1987
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001988static struct platform_device mipi_dsi2lvds_bridge_device = {
1989 .name = "mipi_tc358764",
1990 .id = 0,
1991 .dev.platform_data = &mipi_dsi2lvds_pdata,
1992};
1993
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001994#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1995static struct resource hdmi_msm_resources[] = {
1996 {
1997 .name = "hdmi_msm_qfprom_addr",
1998 .start = 0x00700000,
1999 .end = 0x007060FF,
2000 .flags = IORESOURCE_MEM,
2001 },
2002 {
2003 .name = "hdmi_msm_hdmi_addr",
2004 .start = 0x04A00000,
2005 .end = 0x04A00FFF,
2006 .flags = IORESOURCE_MEM,
2007 },
2008 {
2009 .name = "hdmi_msm_irq",
2010 .start = HDMI_IRQ,
2011 .end = HDMI_IRQ,
2012 .flags = IORESOURCE_IRQ,
2013 },
2014};
2015
2016static int hdmi_enable_5v(int on);
2017static int hdmi_core_power(int on, int show);
2018static int hdmi_cec_power(int on);
2019
2020static struct msm_hdmi_platform_data hdmi_msm_data = {
2021 .irq = HDMI_IRQ,
2022 .enable_5v = hdmi_enable_5v,
2023 .core_power = hdmi_core_power,
2024 .cec_power = hdmi_cec_power,
2025};
2026
2027static struct platform_device hdmi_msm_device = {
2028 .name = "hdmi_msm",
2029 .id = 0,
2030 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2031 .resource = hdmi_msm_resources,
2032 .dev.platform_data = &hdmi_msm_data,
2033};
2034#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2035
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002036#ifdef CONFIG_MSM_BUS_SCALING
2037static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2038 {
2039 .src = MSM_BUS_MASTER_MDP_PORT0,
2040 .dst = MSM_BUS_SLAVE_EBI_CH0,
2041 .ab = 0,
2042 .ib = 0,
2043 },
2044};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002045
2046#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2047static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2048 {
2049 .src = MSM_BUS_MASTER_MDP_PORT0,
2050 .dst = MSM_BUS_SLAVE_EBI_CH0,
2051 .ab = 2000000000,
2052 .ib = 2000000000,
2053 },
2054};
2055#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002056static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2057 {
2058 .src = MSM_BUS_MASTER_MDP_PORT0,
2059 .dst = MSM_BUS_SLAVE_EBI_CH0,
2060 .ab = 566092800 * 2,
2061 .ib = 707616000 * 2,
2062 },
2063};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002064#endif
2065
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002066static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2067 {
2068 ARRAY_SIZE(dtv_bus_init_vectors),
2069 dtv_bus_init_vectors,
2070 },
2071 {
2072 ARRAY_SIZE(dtv_bus_def_vectors),
2073 dtv_bus_def_vectors,
2074 },
2075};
2076static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2077 dtv_bus_scale_usecases,
2078 ARRAY_SIZE(dtv_bus_scale_usecases),
2079 .name = "dtv",
2080};
2081
2082static struct lcdc_platform_data dtv_pdata = {
2083 .bus_scale_table = &dtv_bus_scale_pdata,
2084};
2085#endif
2086
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002087static void __init msm_fb_add_devices(void)
2088{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002089 struct platform_device *ptr = NULL;
2090
2091 if (machine_is_msm8960_liquid())
2092 ptr = &mipi_dsi2lvds_bridge_device;
2093 else
2094 ptr = &mipi_dsi_toshiba_panel_device;
2095 platform_add_devices(&ptr, 1);
2096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002097 if (machine_is_msm8x60_rumi3()) {
2098 msm_fb_register_device("mdp", NULL);
2099 mipi_dsi_pdata.target_type = 1;
2100 } else
2101 msm_fb_register_device("mdp", &mdp_pdata);
2102 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002103#ifdef CONFIG_MSM_BUS_SCALING
2104 msm_fb_register_device("dtv", &dtv_pdata);
2105#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002106}
2107
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002108static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2109 .func = GPIOMUX_FUNC_GPIO,
2110 .drv = GPIOMUX_DRV_2MA,
2111 .pull = GPIOMUX_PULL_DOWN,
2112};
2113
2114static struct gpiomux_setting mdp_vsync_active_cfg = {
2115 .func = GPIOMUX_FUNC_1,
2116 .drv = GPIOMUX_DRV_2MA,
2117 .pull = GPIOMUX_PULL_DOWN,
2118};
2119
2120static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2121 {
2122 .gpio = MDP_VSYNC_GPIO,
2123 .settings = {
2124 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2125 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2126 },
2127 }
2128};
2129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002130#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2131static struct gpiomux_setting hdmi_suspend_cfg = {
2132 .func = GPIOMUX_FUNC_GPIO,
2133 .drv = GPIOMUX_DRV_2MA,
2134 .pull = GPIOMUX_PULL_DOWN,
2135};
2136
2137static struct gpiomux_setting hdmi_active_1_cfg = {
2138 .func = GPIOMUX_FUNC_1,
2139 .drv = GPIOMUX_DRV_2MA,
2140 .pull = GPIOMUX_PULL_UP,
2141};
2142
2143static struct gpiomux_setting hdmi_active_2_cfg = {
2144 .func = GPIOMUX_FUNC_1,
2145 .drv = GPIOMUX_DRV_2MA,
2146 .pull = GPIOMUX_PULL_DOWN,
2147};
2148
2149static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2150 {
2151 .gpio = 99,
2152 .settings = {
2153 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2154 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2155 },
2156 },
2157 {
2158 .gpio = 100,
2159 .settings = {
2160 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2161 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2162 },
2163 },
2164 {
2165 .gpio = 101,
2166 .settings = {
2167 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2168 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2169 },
2170 },
2171 {
2172 .gpio = 102,
2173 .settings = {
2174 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2175 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2176 },
2177 },
2178};
2179
2180static int hdmi_enable_5v(int on)
2181{
2182 /* TBD: PM8921 regulator instead of 8901 */
2183 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2184 static int prev_on;
2185 int rc;
2186
2187 if (on == prev_on)
2188 return 0;
2189
2190 if (!reg_8921_hdmi_mvs)
2191 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2192 "hdmi_mvs");
2193
2194 if (on) {
2195 rc = regulator_enable(reg_8921_hdmi_mvs);
2196 if (rc) {
2197 pr_err("'%s' regulator enable failed, rc=%d\n",
2198 "8921_hdmi_mvs", rc);
2199 return rc;
2200 }
2201 pr_debug("%s(on): success\n", __func__);
2202 } else {
2203 rc = regulator_disable(reg_8921_hdmi_mvs);
2204 if (rc)
2205 pr_warning("'%s' regulator disable failed, rc=%d\n",
2206 "8921_hdmi_mvs", rc);
2207 pr_debug("%s(off): success\n", __func__);
2208 }
2209
2210 prev_on = on;
2211
2212 return 0;
2213}
2214
2215static int hdmi_core_power(int on, int show)
2216{
2217 static struct regulator *reg_8921_l23, *reg_8921_s4;
2218 static int prev_on;
2219 int rc;
2220
2221 if (on == prev_on)
2222 return 0;
2223
2224 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002225 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002227 if (IS_ERR(reg_8921_l23)) {
2228 pr_err("could not get reg_8921_l23, rc = %ld\n",
2229 PTR_ERR(reg_8921_l23));
2230 return -ENODEV;
2231 }
2232 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2233 if (rc) {
2234 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2235 return -EINVAL;
2236 }
2237 }
2238 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002240 if (IS_ERR(reg_8921_s4)) {
2241 pr_err("could not get reg_8921_s4, rc = %ld\n",
2242 PTR_ERR(reg_8921_s4));
2243 return -ENODEV;
2244 }
2245 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2246 if (rc) {
2247 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2248 return -EINVAL;
2249 }
2250 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002251
2252 if (on) {
2253 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2254 if (rc < 0) {
2255 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2256 return -EINVAL;
2257 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002258 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259 if (rc) {
2260 pr_err("'%s' regulator enable failed, rc=%d\n",
2261 "hdmi_avdd", rc);
2262 return rc;
2263 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002264 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002265 if (rc) {
2266 pr_err("'%s' regulator enable failed, rc=%d\n",
2267 "hdmi_vcc", rc);
2268 return rc;
2269 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002270 rc = gpio_request(100, "HDMI_DDC_CLK");
2271 if (rc) {
2272 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2273 "HDMI_DDC_CLK", 100, rc);
2274 goto error1;
2275 }
2276 rc = gpio_request(101, "HDMI_DDC_DATA");
2277 if (rc) {
2278 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2279 "HDMI_DDC_DATA", 101, rc);
2280 goto error2;
2281 }
2282 rc = gpio_request(102, "HDMI_HPD");
2283 if (rc) {
2284 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2285 "HDMI_HPD", 102, rc);
2286 goto error3;
2287 }
2288 pr_debug("%s(on): success\n", __func__);
2289 } else {
2290 gpio_free(100);
2291 gpio_free(101);
2292 gpio_free(102);
2293
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002294 rc = regulator_disable(reg_8921_l23);
2295 if (rc) {
2296 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2297 return -ENODEV;
2298 }
2299 rc = regulator_disable(reg_8921_s4);
2300 if (rc) {
2301 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2302 return -ENODEV;
2303 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2305 if (rc < 0) {
2306 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2307 return -EINVAL;
2308 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 pr_debug("%s(off): success\n", __func__);
2310 }
2311
2312 prev_on = on;
2313
2314 return 0;
2315
2316error3:
2317 gpio_free(101);
2318error2:
2319 gpio_free(100);
2320error1:
2321 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002322 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323 return rc;
2324}
2325
2326static int hdmi_cec_power(int on)
2327{
2328 static int prev_on;
2329 int rc;
2330
2331 if (on == prev_on)
2332 return 0;
2333
2334 if (on) {
2335 rc = gpio_request(99, "HDMI_CEC_VAR");
2336 if (rc) {
2337 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2338 "HDMI_CEC_VAR", 99, rc);
2339 goto error;
2340 }
2341 pr_debug("%s(on): success\n", __func__);
2342 } else {
2343 gpio_free(99);
2344 pr_debug("%s(off): success\n", __func__);
2345 }
2346
2347 prev_on = on;
2348
2349 return 0;
2350error:
2351 return rc;
2352}
2353#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2354
2355static void __init msm8960_allocate_memory_regions(void)
2356{
2357 void *addr;
2358 unsigned long size;
2359
2360 size = MSM_FB_SIZE;
2361 addr = alloc_bootmem_align(size, 0x1000);
2362 msm_fb_resources[0].start = __pa(addr);
2363 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2364 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2365 size, addr, __pa(addr));
2366
2367}
2368#ifdef CONFIG_WCD9310_CODEC
2369
2370#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2371
Patrick Lai3043fba2011-08-01 14:15:57 -07002372/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2373 * 4 micbiases are used to power various analog and digital
2374 * microphones operating at 1800 mV. Technically, all micbiases
2375 * can source from single cfilter since all microphones operate
2376 * at the same voltage level. The arrangement below is to make
2377 * sure all cfilters are exercised. LDO_H regulator ouput level
2378 * does not need to be as high as 2.85V. It is choosen for
2379 * microphone sensitivity purpose.
2380 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381static struct tabla_pdata tabla_platform_data = {
2382 .slimbus_slave_device = {
2383 .name = "tabla-slave",
2384 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2385 },
2386 .irq = MSM_GPIO_TO_INT(62),
2387 .irq_base = TABLA_INTERRUPT_BASE,
2388 .num_irqs = NR_TABLA_IRQS,
2389 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002390 .micbias = {
2391 .ldoh_v = TABLA_LDOH_2P85_V,
2392 .cfilt1_mv = 1800,
2393 .cfilt2_mv = 1800,
2394 .cfilt3_mv = 1800,
2395 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2396 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2397 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2398 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2399 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002400};
2401
2402static struct slim_device msm_slim_tabla = {
2403 .name = "tabla-slim",
2404 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2405 .dev = {
2406 .platform_data = &tabla_platform_data,
2407 },
2408};
2409#endif
2410
2411static struct slim_boardinfo msm_slim_devices[] = {
2412#ifdef CONFIG_WCD9310_CODEC
2413 {
2414 .bus_num = 1,
2415 .slim_slave = &msm_slim_tabla,
2416 },
2417#endif
2418 /* add more slimbus slaves as needed */
2419};
2420
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002421#define MSM_WCNSS_PHYS 0x03000000
2422#define MSM_WCNSS_SIZE 0x280000
2423
2424static struct resource resources_wcnss_wlan[] = {
2425 {
2426 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2427 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2428 .name = "wcnss_wlanrx_irq",
2429 .flags = IORESOURCE_IRQ,
2430 },
2431 {
2432 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2433 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2434 .name = "wcnss_wlantx_irq",
2435 .flags = IORESOURCE_IRQ,
2436 },
2437 {
2438 .start = MSM_WCNSS_PHYS,
2439 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2440 .name = "wcnss_mmio",
2441 .flags = IORESOURCE_MEM,
2442 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002443 {
2444 .start = 84,
2445 .end = 88,
2446 .name = "wcnss_gpios_5wire",
2447 .flags = IORESOURCE_IO,
2448 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002449};
2450
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002451static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2452 .has_48mhz_xo = 1,
2453};
2454
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002455static struct platform_device msm_device_wcnss_wlan = {
2456 .name = "wcnss_wlan",
2457 .id = 0,
2458 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2459 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002460 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002461};
2462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002463#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2464 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2465 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2466 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2467
2468#define QCE_SIZE 0x10000
2469#define QCE_0_BASE 0x18500000
2470
2471#define QCE_HW_KEY_SUPPORT 0
2472#define QCE_SHA_HMAC_SUPPORT 1
2473#define QCE_SHARE_CE_RESOURCE 1
2474#define QCE_CE_SHARED 0
2475
2476static struct resource qcrypto_resources[] = {
2477 [0] = {
2478 .start = QCE_0_BASE,
2479 .end = QCE_0_BASE + QCE_SIZE - 1,
2480 .flags = IORESOURCE_MEM,
2481 },
2482 [1] = {
2483 .name = "crypto_channels",
2484 .start = DMOV_CE_IN_CHAN,
2485 .end = DMOV_CE_OUT_CHAN,
2486 .flags = IORESOURCE_DMA,
2487 },
2488 [2] = {
2489 .name = "crypto_crci_in",
2490 .start = DMOV_CE_IN_CRCI,
2491 .end = DMOV_CE_IN_CRCI,
2492 .flags = IORESOURCE_DMA,
2493 },
2494 [3] = {
2495 .name = "crypto_crci_out",
2496 .start = DMOV_CE_OUT_CRCI,
2497 .end = DMOV_CE_OUT_CRCI,
2498 .flags = IORESOURCE_DMA,
2499 },
2500};
2501
2502static struct resource qcedev_resources[] = {
2503 [0] = {
2504 .start = QCE_0_BASE,
2505 .end = QCE_0_BASE + QCE_SIZE - 1,
2506 .flags = IORESOURCE_MEM,
2507 },
2508 [1] = {
2509 .name = "crypto_channels",
2510 .start = DMOV_CE_IN_CHAN,
2511 .end = DMOV_CE_OUT_CHAN,
2512 .flags = IORESOURCE_DMA,
2513 },
2514 [2] = {
2515 .name = "crypto_crci_in",
2516 .start = DMOV_CE_IN_CRCI,
2517 .end = DMOV_CE_IN_CRCI,
2518 .flags = IORESOURCE_DMA,
2519 },
2520 [3] = {
2521 .name = "crypto_crci_out",
2522 .start = DMOV_CE_OUT_CRCI,
2523 .end = DMOV_CE_OUT_CRCI,
2524 .flags = IORESOURCE_DMA,
2525 },
2526};
2527
2528#endif
2529
2530#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2531 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2532
2533static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2534 .ce_shared = QCE_CE_SHARED,
2535 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2536 .hw_key_support = QCE_HW_KEY_SUPPORT,
2537 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2538};
2539
2540static struct platform_device qcrypto_device = {
2541 .name = "qcrypto",
2542 .id = 0,
2543 .num_resources = ARRAY_SIZE(qcrypto_resources),
2544 .resource = qcrypto_resources,
2545 .dev = {
2546 .coherent_dma_mask = DMA_BIT_MASK(32),
2547 .platform_data = &qcrypto_ce_hw_suppport,
2548 },
2549};
2550#endif
2551
2552#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2553 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2554
2555static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2556 .ce_shared = QCE_CE_SHARED,
2557 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2558 .hw_key_support = QCE_HW_KEY_SUPPORT,
2559 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2560};
2561
2562static struct platform_device qcedev_device = {
2563 .name = "qce",
2564 .id = 0,
2565 .num_resources = ARRAY_SIZE(qcedev_resources),
2566 .resource = qcedev_resources,
2567 .dev = {
2568 .coherent_dma_mask = DMA_BIT_MASK(32),
2569 .platform_data = &qcedev_ce_hw_suppport,
2570 },
2571};
2572#endif
2573
2574
2575static int __init gpiomux_init(void)
2576{
2577 int rc;
2578
2579 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2580 if (rc) {
2581 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2582 return rc;
2583 }
2584
Nishant Pandit24153d82011-08-27 16:05:13 +05302585 msm_gpiomux_install(msm8960_cam_common_configs,
2586 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002587
2588 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002589 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002590
2591 msm_gpiomux_install(msm8960_gsbi_configs,
2592 ARRAY_SIZE(msm8960_gsbi_configs));
2593
2594 msm_gpiomux_install(msm8960_cyts_configs,
2595 ARRAY_SIZE(msm8960_cyts_configs));
2596
2597 msm_gpiomux_install(msm8960_slimbus_config,
2598 ARRAY_SIZE(msm8960_slimbus_config));
2599
2600 msm_gpiomux_install(msm8960_audio_codec_configs,
2601 ARRAY_SIZE(msm8960_audio_codec_configs));
2602
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002603 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2604 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2605
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002606#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2607 msm_gpiomux_install(msm8960_hdmi_configs,
2608 ARRAY_SIZE(msm8960_hdmi_configs));
2609#endif
2610
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002611 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2612 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2613
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002614 msm_gpiomux_install(wcnss_5wire_interface,
2615 ARRAY_SIZE(wcnss_5wire_interface));
2616
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302617#ifdef CONFIG_USB_EHCI_MSM_HSIC
2618 msm_gpiomux_install(msm8960_hsic_configs,
2619 ARRAY_SIZE(msm8960_hsic_configs));
2620#endif
2621
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002622 return 0;
2623}
2624
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002625#define MSM_SHARED_RAM_PHYS 0x80000000
2626
2627static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2628 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2629 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2630 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2631 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2632 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2633 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2634 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2635 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2636 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2637 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2638 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2639 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002640 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2641 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2642 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2643 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2644 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2645 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2646 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2647 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2648 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2649 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2650 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2651 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2652 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2653 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002654 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002655 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2656 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2657 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002658 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2659 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002660};
2661
2662static struct pm8921_adc_properties pm8921_adc_data = {
2663 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2664 .bitresolution = 15,
2665 .bipolar = 0,
2666};
2667
2668static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2669 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002670 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002671 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002672 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002673};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002674
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002675static void __init msm8960_map_io(void)
2676{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002677 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002678 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002679
2680 if (socinfo_init() < 0)
2681 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002682}
2683
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002684#ifdef CONFIG_ARCH_MSM8930
2685static void __init msm8930_map_io(void)
2686{
2687 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2688 msm_map_msm8930_io();
2689
2690 if (socinfo_init() < 0)
2691 pr_err("socinfo_init() failed!\n");
2692}
2693#endif
2694
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002695static void __init msm8960_init_irq(void)
2696{
2697 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002698
2699 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002700 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002701 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002702
2703 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002704 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2707 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002708
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002709 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2710 * as they are configured as level, which does not play nice with
2711 * handle_percpu_irq.
2712 */
2713 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2714 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002715 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002716 }
2717}
2718
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002719/* MSM8960 have 5 SDCC controllers */
2720enum sdcc_controllers {
2721 SDCC1,
2722 SDCC2,
2723 SDCC3,
2724 SDCC4,
2725 SDCC5,
2726 MAX_SDCC_CONTROLLER
2727};
2728
2729/* All SDCC controllers requires VDD/VCC voltage */
2730static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2731 /* SDCC1 : eMMC card connected */
2732 [SDCC1] = {
2733 .name = "sdc_vdd",
2734 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302735 .high_vol_level = 2950000,
2736 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302737 .always_on = 1,
2738 .lpm_sup = 1,
2739 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740 .hpm_uA = 200000, /* 200mA */
2741 },
2742 /* SDCC3 : External card slot connected */
2743 [SDCC3] = {
2744 .name = "sdc_vdd",
2745 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302746 .high_vol_level = 2950000,
2747 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748 .hpm_uA = 600000, /* 600mA */
2749 }
2750};
2751
2752/* Only slots having eMMC card will require VCCQ voltage */
2753static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2754 /* SDCC1 : eMMC card connected */
2755 [SDCC1] = {
2756 .name = "sdc_vccq",
2757 .set_voltage_sup = 1,
2758 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302759 .high_vol_level = 1800000,
2760 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002761 .hpm_uA = 200000, /* 200mA */
2762 }
2763};
2764
2765/* All SDCC controllers may require voting for VDD PAD voltage */
2766static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2767 /* SDCC3 : External card slot connected */
2768 [SDCC3] = {
2769 .name = "sdc_vddp",
2770 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302771 .high_vol_level = 2950000,
2772 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002773 .always_on = 1,
2774 .lpm_sup = 1,
2775 /* Max. Active current required is 16 mA */
2776 .hpm_uA = 16000,
2777 /*
2778 * Sleep current required is ~300 uA. But min. vote can be
2779 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2780 * during sleep.
2781 */
2782 .lpm_uA = 2000,
2783 }
2784};
2785
2786static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2787 /* SDCC1 : eMMC card connected */
2788 [SDCC1] = {
2789 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2790 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2791 },
2792 /* SDCC3 : External card slot connected */
2793 [SDCC3] = {
2794 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2795 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2796 }
2797};
2798
2799/* SDC1 pad data */
2800static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2801 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302802 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2803 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804};
2805
2806static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2807 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2808 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2809 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2810};
2811
2812static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302813 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2815 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2816};
2817
2818static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302819 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002820 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2821 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2822};
2823
2824/* SDC3 pad data */
2825static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2826 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2827 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2828 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2829};
2830
2831static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2832 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2833 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2834 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2835};
2836
2837static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302838 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002839 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2840 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2841};
2842
2843static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302844 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302845 /*
2846 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2847 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2848 * which would result in false card detection interrupts.
2849 */
2850 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2851 /*
2852 * Keeping DATA lines status to PULL UP will make sure that
2853 * there is no current leak during sleep if external pull up
2854 * is connected to DATA lines.
2855 */
2856 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002857};
2858
2859struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2860 [SDCC1] = {
2861 .on = sdc1_pad_pull_on_cfg,
2862 .off = sdc1_pad_pull_off_cfg,
2863 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2864 },
2865 [SDCC3] = {
2866 .on = sdc3_pad_pull_on_cfg,
2867 .off = sdc3_pad_pull_off_cfg,
2868 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2869 },
2870};
2871
2872struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2873 [SDCC1] = {
2874 .on = sdc1_pad_drv_on_cfg,
2875 .off = sdc1_pad_drv_off_cfg,
2876 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2877 },
2878 [SDCC3] = {
2879 .on = sdc3_pad_drv_on_cfg,
2880 .off = sdc3_pad_drv_off_cfg,
2881 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2882 },
2883};
2884
2885struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2886 [SDCC1] = {
2887 .pull = &mmc_pad_pull_data[SDCC1],
2888 .drv = &mmc_pad_drv_data[SDCC1]
2889 },
2890 [SDCC3] = {
2891 .pull = &mmc_pad_pull_data[SDCC3],
2892 .drv = &mmc_pad_drv_data[SDCC3]
2893 },
2894};
2895
2896struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2897 [SDCC1] = {
2898 .pad_data = &mmc_pad_data[SDCC1],
2899 },
2900 [SDCC3] = {
2901 .pad_data = &mmc_pad_data[SDCC3],
2902 },
2903};
2904
2905static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302906 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907};
2908
2909static unsigned int sdc3_sup_clk_rates[] = {
2910 400000, 24000000, 48000000, 96000000
2911};
2912
2913#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2914static struct mmc_platform_data msm8960_sdc1_data = {
2915 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2916#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2917 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2918#else
2919 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2920#endif
2921 .sup_clk_table = sdc1_sup_clk_rates,
2922 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302923 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002924 .nonremovable = 1,
2925 .sdcc_v4_sup = true,
2926 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302927 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002928};
2929#endif
2930
2931#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2932static struct mmc_platform_data msm8960_sdc3_data = {
2933 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2934 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2935 .sup_clk_table = sdc3_sup_clk_rates,
2936 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302937 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302938#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302940#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941 .sdcc_v4_sup = true,
2942 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2943 .pin_data = &mmc_slot_pin_data[SDCC3],
2944#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2945 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2946 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2947 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2948#endif
2949 .xpc_cap = 1,
2950 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2951 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302952 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002953};
2954#endif
2955
2956static void __init msm8960_init_mmc(void)
2957{
2958#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2959 /* SDC1 : eMMC card connected */
2960 msm_add_sdcc(1, &msm8960_sdc1_data);
2961#endif
2962#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2963 /* SDC3: External card slot */
2964 msm_add_sdcc(3, &msm8960_sdc3_data);
2965#endif
2966}
2967
2968static void __init msm8960_init_buses(void)
2969{
2970#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06002971 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06002972 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
2973 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
2974 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
2975 msm_bus_apps_fabric.dev.platform_data =
2976 &msm_bus_8960_apps_fabric_pdata;
2977 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
2978 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
2979 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
2980 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002981#endif
2982}
2983
2984static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2985 .max_clock_speed = 15060000,
2986};
2987
2988#ifdef CONFIG_USB_MSM_OTG_72K
2989static struct msm_otg_platform_data msm_otg_pdata;
2990#else
2991#define USB_5V_EN 42
2992static void msm_hsusb_vbus_power(bool on)
2993{
2994 int rc;
2995 static bool vbus_is_on;
2996 static struct regulator *mvs_otg_switch;
2997 struct pm_gpio param = {
2998 .direction = PM_GPIO_DIR_OUT,
2999 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3000 .output_value = 1,
3001 .pull = PM_GPIO_PULL_NO,
3002 .vin_sel = PM_GPIO_VIN_S4,
3003 .out_strength = PM_GPIO_STRENGTH_MED,
3004 .function = PM_GPIO_FUNC_NORMAL,
3005 };
3006
3007 if (vbus_is_on == on)
3008 return;
3009
3010 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003011 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3012 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013 if (IS_ERR(mvs_otg_switch)) {
3014 pr_err("Unable to get mvs_otg_switch\n");
3015 return;
3016 }
3017
3018 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3019 "usb_5v_en");
3020 if (rc < 0) {
3021 pr_err("failed to request usb_5v_en gpio\n");
3022 goto put_mvs_otg;
3023 }
3024
3025 if (regulator_enable(mvs_otg_switch)) {
3026 pr_err("unable to enable mvs_otg_switch\n");
3027 goto free_usb_5v_en;
3028 }
3029
3030 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3031 &param);
3032 if (rc < 0) {
3033 pr_err("failed to configure usb_5v_en gpio\n");
3034 goto disable_mvs_otg;
3035 }
3036 vbus_is_on = true;
3037 return;
3038 }
3039disable_mvs_otg:
3040 regulator_disable(mvs_otg_switch);
3041free_usb_5v_en:
3042 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
3043put_mvs_otg:
3044 regulator_put(mvs_otg_switch);
3045 vbus_is_on = false;
3046}
3047
3048static struct msm_otg_platform_data msm_otg_pdata = {
3049 .mode = USB_OTG,
3050 .otg_control = OTG_PMIC_CONTROL,
3051 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3052 .pclk_src_name = "dfab_usb_hs_clk",
3053 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3054 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303055 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003056};
3057#endif
3058
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303059#ifdef CONFIG_USB_EHCI_MSM_HSIC
3060static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3061 .strobe = 150,
3062 .data = 151,
3063};
3064#else
3065static struct msm_hsic_host_platform_data msm_hsic_pdata;
3066#endif
3067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003068#define PID_MAGIC_ID 0x71432909
3069#define SERIAL_NUM_MAGIC_ID 0x61945374
3070#define SERIAL_NUMBER_LENGTH 127
3071#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3072
3073struct magic_num_struct {
3074 uint32_t pid;
3075 uint32_t serial_num;
3076};
3077
3078struct dload_struct {
3079 uint32_t reserved1;
3080 uint32_t reserved2;
3081 uint32_t reserved3;
3082 uint16_t reserved4;
3083 uint16_t pid;
3084 char serial_number[SERIAL_NUMBER_LENGTH];
3085 uint16_t reserved5;
3086 struct magic_num_struct magic_struct;
3087};
3088
3089static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3090{
3091 struct dload_struct __iomem *dload = 0;
3092
3093 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3094 if (!dload) {
3095 pr_err("%s: cannot remap I/O memory region: %08x\n",
3096 __func__, DLOAD_USB_BASE_ADD);
3097 return -ENXIO;
3098 }
3099
3100 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3101 __func__, dload, pid, snum);
3102 /* update pid */
3103 dload->magic_struct.pid = PID_MAGIC_ID;
3104 dload->pid = pid;
3105
3106 /* update serial number */
3107 dload->magic_struct.serial_num = 0;
3108 if (!snum) {
3109 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3110 goto out;
3111 }
3112
3113 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003114 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003115out:
3116 iounmap(dload);
3117 return 0;
3118}
3119
3120static struct android_usb_platform_data android_usb_pdata = {
3121 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3122};
3123
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003124static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003125 .name = "android_usb",
3126 .id = -1,
3127 .dev = {
3128 .platform_data = &android_usb_pdata,
3129 },
3130};
3131
3132static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3133 0x03, 0x0f,
3134};
3135
3136static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3137 0x00, 0x24, 0x54, 0x10,
3138 0x09, 0x03, 0x01,
3139 0x10, 0x54, 0x30, 0x0C,
3140 0x24, 0x30, 0x0f,
3141};
3142
3143static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3144 0x00, 0x24, 0x54, 0x10,
3145 0x09, 0x07, 0x01, 0x0B,
3146 0x10, 0x54, 0x30, 0x0C,
3147 0x24, 0x30, 0x0f,
3148};
3149
3150static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3151 [0] = {
3152 .mode = MSM_SPM_MODE_CLOCK_GATING,
3153 .notify_rpm = false,
3154 .cmd = spm_wfi_cmd_sequence,
3155 },
3156 [1] = {
3157 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3158 .notify_rpm = false,
3159 .cmd = spm_power_collapse_without_rpm,
3160 },
3161 [2] = {
3162 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3163 .notify_rpm = true,
3164 .cmd = spm_power_collapse_with_rpm,
3165 },
3166};
3167
3168static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3169 [0] = {
3170 .reg_base_addr = MSM_SAW0_BASE,
3171 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3172 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3173 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3174#if defined(CONFIG_MSM_AVS_HW)
3175 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3176 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3177#endif
3178 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3179 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3180 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3181 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3182 .vctl_timeout_us = 50,
3183 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3184 .modes = msm_spm_seq_list,
3185 },
3186 [1] = {
3187 .reg_base_addr = MSM_SAW1_BASE,
3188 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3189 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3190 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3191#if defined(CONFIG_MSM_AVS_HW)
3192 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3193 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3194#endif
3195 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3196 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3197 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3198 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3199 .vctl_timeout_us = 50,
3200 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3201 .modes = msm_spm_seq_list,
3202 },
3203};
3204
3205static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3206 0x00, 0x20, 0x03, 0x20,
3207 0x00, 0x0f,
3208};
3209
3210static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3211 0x00, 0x20, 0x34, 0x64,
3212 0x48, 0x07, 0x48, 0x20,
3213 0x50, 0x64, 0x04, 0x34,
3214 0x50, 0x0f,
3215};
3216static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3217 0x00, 0x10, 0x34, 0x64,
3218 0x48, 0x07, 0x48, 0x10,
3219 0x50, 0x64, 0x04, 0x34,
3220 0x50, 0x0F,
3221};
3222
3223static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3224 [0] = {
3225 .mode = MSM_SPM_L2_MODE_RETENTION,
3226 .notify_rpm = false,
3227 .cmd = l2_spm_wfi_cmd_sequence,
3228 },
3229 [1] = {
3230 .mode = MSM_SPM_L2_MODE_GDHS,
3231 .notify_rpm = true,
3232 .cmd = l2_spm_gdhs_cmd_sequence,
3233 },
3234 [2] = {
3235 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3236 .notify_rpm = true,
3237 .cmd = l2_spm_power_off_cmd_sequence,
3238 },
3239};
3240
3241
3242static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3243 [0] = {
3244 .reg_base_addr = MSM_SAW_L2_BASE,
3245 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3246 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3247 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3248 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3250 .modes = msm_spm_l2_seq_list,
3251 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3252 },
3253};
3254
3255#define CYTTSP_TS_GPIO_IRQ 11
3256#define CYTTSP_TS_SLEEP_GPIO 50
3257#define CYTTSP_TS_RESOUT_N_GPIO 52
3258
3259/*virtual key support */
3260static ssize_t tma340_vkeys_show(struct kobject *kobj,
3261 struct kobj_attribute *attr, char *buf)
3262{
3263 return snprintf(buf, 200,
3264 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3265 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3266 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3267 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3268 "\n");
3269}
3270
3271static struct kobj_attribute tma340_vkeys_attr = {
3272 .attr = {
3273 .mode = S_IRUGO,
3274 },
3275 .show = &tma340_vkeys_show,
3276};
3277
3278static struct attribute *tma340_properties_attrs[] = {
3279 &tma340_vkeys_attr.attr,
3280 NULL
3281};
3282
3283static struct attribute_group tma340_properties_attr_group = {
3284 .attrs = tma340_properties_attrs,
3285};
3286
3287
3288static int cyttsp_platform_init(struct i2c_client *client)
3289{
3290 int rc = 0;
3291 static struct kobject *tma340_properties_kobj;
3292
3293 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3294 tma340_properties_kobj = kobject_create_and_add("board_properties",
3295 NULL);
3296 if (tma340_properties_kobj)
3297 rc = sysfs_create_group(tma340_properties_kobj,
3298 &tma340_properties_attr_group);
3299 if (!tma340_properties_kobj || rc)
3300 pr_err("%s: failed to create board_properties\n",
3301 __func__);
3302
3303 return 0;
3304}
3305
3306static struct cyttsp_regulator regulator_data[] = {
3307 {
3308 .name = "vdd",
3309 .min_uV = CY_TMA300_VTG_MIN_UV,
3310 .max_uV = CY_TMA300_VTG_MAX_UV,
3311 .load_uA = CY_TMA300_CURR_24HZ_UA,
3312 },
3313 /* TODO: Remove after runtime PM is enabled in I2C driver */
3314 {
3315 .name = "vcc_i2c",
3316 .min_uV = CY_I2C_VTG_MIN_UV,
3317 .max_uV = CY_I2C_VTG_MAX_UV,
3318 .load_uA = CY_I2C_CURR_UA,
3319 },
3320};
3321
3322static struct cyttsp_platform_data cyttsp_pdata = {
3323 .panel_maxx = 634,
3324 .panel_maxy = 1166,
3325 .disp_maxx = 616,
3326 .disp_maxy = 1023,
3327 .disp_minx = 0,
3328 .disp_miny = 16,
3329 .flags = 0x01,
3330 .gen = CY_GEN3, /* or */
3331 .use_st = CY_USE_ST,
3332 .use_mt = CY_USE_MT,
3333 .use_hndshk = CY_SEND_HNDSHK,
3334 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303335 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003336 .use_gestures = CY_USE_GESTURES,
3337 .fw_fname = "cyttsp_8960_cdp.hex",
3338 /* activate up to 4 groups
3339 * and set active distance
3340 */
3341 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3342 CY_GEST_GRP3 | CY_GEST_GRP4 |
3343 CY_ACT_DIST,
3344 /* change act_intrvl to customize the Active power state
3345 * scanning/processing refresh interval for Operating mode
3346 */
3347 .act_intrvl = CY_ACT_INTRVL_DFLT,
3348 /* change tch_tmout to customize the touch timeout for the
3349 * Active power state for Operating mode
3350 */
3351 .tch_tmout = CY_TCH_TMOUT_DFLT,
3352 /* change lp_intrvl to customize the Low Power power state
3353 * scanning/processing refresh interval for Operating mode
3354 */
3355 .lp_intrvl = CY_LP_INTRVL_DFLT,
3356 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3357 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3358 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3359 .regulator_info = regulator_data,
3360 .num_regulators = ARRAY_SIZE(regulator_data),
3361 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303362 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003363};
3364
3365static struct i2c_board_info cyttsp_info[] __initdata = {
3366 {
3367 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3368 .platform_data = &cyttsp_pdata,
3369#ifndef CY_USE_TIMER
3370 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3371#endif /* CY_USE_TIMER */
3372 },
3373};
3374
Mohan Pallaka50837382011-09-07 11:00:57 +05303375/* configuration data */
3376static const u8 mxt_config_data[] = {
3377 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003378 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303379 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003380 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3385 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3386 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303387 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003388 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303389 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003390 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303391 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003392 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3393 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3394 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3395 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303396 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3398 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303399 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003400 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3401 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303402 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3404 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303405 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003406 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3407 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303408 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003409 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303410 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003411 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303412 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003413 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303414 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003415 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303416 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003417 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303418};
3419
3420#define MXT_TS_GPIO_IRQ 11
3421#define MXT_TS_LDO_EN_GPIO 50
3422#define MXT_TS_RESET_GPIO 52
3423
3424static void mxt_init_hw_liquid(void)
3425{
3426 int rc;
3427
3428 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3429 if (rc) {
3430 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3431 __func__, MXT_TS_GPIO_IRQ);
3432 return;
3433 }
3434
3435 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3436 if (rc) {
3437 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3438 __func__, MXT_TS_GPIO_IRQ);
3439 goto err_irq_gpio_req;
3440 }
3441
3442 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3443 if (rc) {
3444 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3445 __func__, MXT_TS_LDO_EN_GPIO);
3446 goto err_irq_gpio_req;
3447 }
3448
3449 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3450 if (rc) {
3451 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3452 __func__, MXT_TS_LDO_EN_GPIO);
3453 goto err_ldo_gpio_req;
3454 }
3455
3456 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3457 if (rc) {
3458 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3459 __func__, MXT_TS_RESET_GPIO);
3460 goto err_ldo_gpio_set_dir;
3461 }
3462
3463 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3464 if (rc) {
3465 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3466 __func__, MXT_TS_RESET_GPIO);
3467 goto err_reset_gpio_req;
3468 }
3469
3470 return;
3471
3472err_reset_gpio_req:
3473 gpio_free(MXT_TS_RESET_GPIO);
3474err_ldo_gpio_set_dir:
3475 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3476err_ldo_gpio_req:
3477 gpio_free(MXT_TS_LDO_EN_GPIO);
3478err_irq_gpio_req:
3479 gpio_free(MXT_TS_GPIO_IRQ);
3480}
3481
3482static struct mxt_platform_data mxt_platform_data = {
3483 .config = mxt_config_data,
3484 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003485 .x_size = 1365,
3486 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303487 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003488 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303489};
3490
3491static struct i2c_board_info mxt_device_info[] __initdata = {
3492 {
3493 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3494 .platform_data = &mxt_platform_data,
3495 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3496 },
3497};
3498
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003499static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3500{
3501}
3502
3503static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3504 .clk_freq = 100000,
3505 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003506 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3507};
3508
3509static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3510 .clk_freq = 100000,
3511 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003512 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3513};
3514
3515static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3516 .clk_freq = 100000,
3517 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3519};
3520
3521static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3522 .clk_freq = 100000,
3523 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003524 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3525};
3526
3527static struct msm_rpm_platform_data msm_rpm_data = {
3528 .reg_base_addrs = {
3529 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3530 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3531 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3532 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3533 },
3534
3535 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3536 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3537 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3538 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3539 .msm_apps_ipc_rpm_val = 4,
3540};
3541
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003542static struct ks8851_pdata spi_eth_pdata = {
3543 .irq_gpio = KS8851_IRQ_GPIO,
3544 .rst_gpio = KS8851_RST_GPIO,
3545};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003546
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003547static struct spi_board_info spi_board_info[] __initdata = {
3548 {
3549 .modalias = "ks8851",
3550 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3551 .max_speed_hz = 19200000,
3552 .bus_num = 0,
3553 .chip_select = 0,
3554 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003555 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003556 },
3557};
3558
3559static struct platform_device msm_device_saw_core0 = {
3560 .name = "saw-regulator",
3561 .id = 0,
3562 .dev = {
3563 .platform_data = &msm_saw_regulator_pdata_s5,
3564 },
3565};
3566
3567static struct platform_device msm_device_saw_core1 = {
3568 .name = "saw-regulator",
3569 .id = 1,
3570 .dev = {
3571 .platform_data = &msm_saw_regulator_pdata_s6,
3572 },
3573};
3574
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003575static struct tsens_platform_data msm_tsens_pdata = {
3576 .slope = 910,
3577 .tsens_factor = 1000,
3578 .hw_type = MSM_8960,
3579 .tsens_num_sensor = 5,
3580};
3581
3582static struct platform_device msm_tsens_device = {
3583 .name = "tsens8960-tm",
3584 .id = -1,
3585 .dev = {
3586 .platform_data = &msm_tsens_pdata,
3587 },
3588};
3589
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003590#ifdef CONFIG_MSM_FAKE_BATTERY
3591static struct platform_device fish_battery_device = {
3592 .name = "fish_battery",
3593};
3594#endif
3595
David Collins26f05562011-06-20 09:56:28 -07003596static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003597 .name = GPIO_REGULATOR_DEV_NAME,
3598 .id = PM8921_MPP_PM_TO_SYS(7),
3599 .dev = {
3600 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3601 },
3602};
3603
David Collins26f05562011-06-20 09:56:28 -07003604static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003605 .name = GPIO_REGULATOR_DEV_NAME,
3606 .id = 91,
3607 .dev = {
3608 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3609 },
3610};
3611
David Collinsb10be1d2011-09-02 10:29:31 -07003612static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3613 .name = GPIO_REGULATOR_DEV_NAME,
3614 .id = PM8921_GPIO_PM_TO_SYS(17),
3615 .dev = {
3616 .platform_data =
3617 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3618 },
3619};
3620
David Collins26f05562011-06-20 09:56:28 -07003621static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3622 .name = "rpm-regulator",
3623 .id = -1,
3624 .dev = {
3625 .platform_data = &msm_rpm_regulator_pdata,
3626 },
3627};
3628
David Collins4c31a872011-08-31 10:07:10 -07003629static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3630 .phys_addr_base = 0x0010C000,
3631 .reg_offsets = {
3632 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3633 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3634 },
3635 .phys_size = SZ_8K,
3636 .log_len = 4096, /* log's buffer length in bytes */
3637 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3638};
3639
3640static struct platform_device msm_rpm_log_device = {
3641 .name = "msm_rpm_log",
3642 .id = -1,
3643 .dev = {
3644 .platform_data = &msm_rpm_log_pdata,
3645 },
3646};
3647
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003648static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003649 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003650 &msm_device_smd,
3651 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303652 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003653 &msm_device_saw_core0,
3654 &msm_device_saw_core1,
3655 &msm8960_device_ext_5v_vreg,
3656 &msm8960_device_ext_l2_vreg,
3657 &msm8960_device_ssbi_pm8921,
3658 &msm8960_device_qup_spi_gsbi1,
3659 &msm8960_device_qup_i2c_gsbi3,
3660 &msm8960_device_qup_i2c_gsbi4,
3661 &msm8960_device_qup_i2c_gsbi10,
3662#ifndef CONFIG_MSM_DSPS
3663 &msm8960_device_qup_i2c_gsbi12,
3664#endif
3665 &msm_slim_ctrl,
3666 &msm_device_wcnss_wlan,
3667#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3668 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3669 &qcrypto_device,
3670#endif
3671
3672#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3673 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3674 &qcedev_device,
3675#endif
3676#ifdef CONFIG_MSM_ROTATOR
3677 &msm_rotator_device,
3678#endif
3679 &msm_device_sps,
3680#ifdef CONFIG_MSM_FAKE_BATTERY
3681 &fish_battery_device,
3682#endif
3683#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003684#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003685 &android_pmem_device,
3686 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003687#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003688 &android_pmem_audio_device,
3689#endif
3690 &msm_fb_device,
3691 &msm_device_vidc,
3692 &msm_device_bam_dmux,
3693 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003694
3695#ifdef CONFIG_HW_RANDOM_MSM
3696 &msm_device_rng,
3697#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003698 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003699#ifdef CONFIG_ION_MSM
3700 &ion_dev,
3701#endif
David Collins4c31a872011-08-31 10:07:10 -07003702 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003703#ifdef CONFIG_MSM_QDSS
3704 &msm_etb_device,
3705 &msm_tpiu_device,
3706 &msm_funnel_device,
3707 &msm_ptm_device,
3708#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003709 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003710};
3711
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003712static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003713 &msm8960_device_otg,
3714 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003715 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303716 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003717 &android_usb_device,
3718 &msm_device_vidc,
3719 &mipi_dsi_simulator_panel_device,
3720 &msm_bus_apps_fabric,
3721 &msm_bus_sys_fabric,
3722 &msm_bus_mm_fabric,
3723 &msm_bus_sys_fpb,
3724 &msm_bus_cpss_fpb,
3725 &msm_pcm,
3726 &msm_pcm_routing,
3727 &msm_cpudai0,
3728 &msm_cpudai1,
3729 &msm_cpudai_hdmi_rx,
3730 &msm_cpudai_bt_rx,
3731 &msm_cpudai_bt_tx,
3732 &msm_cpudai_fm_rx,
3733 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003734 &msm_cpudai_auxpcm_rx,
3735 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003736 &msm_cpu_fe,
3737 &msm_stub_codec,
3738 &msm_voice,
3739 &msm_voip,
3740 &msm_lpa_pcm,
3741
3742#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3743 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3744 &qcrypto_device,
3745#endif
3746
3747#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3748 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3749 &qcedev_device,
3750#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003751};
3752
3753static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003754 &msm_kgsl_3d0,
3755 &msm_kgsl_2d0,
3756 &msm_kgsl_2d1,
3757 &mipi_dsi_renesas_panel_device,
3758#ifdef CONFIG_MSM_GEMINI
3759 &msm8960_gemini_device,
3760#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003761};
3762
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003763static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003764 &msm8960_device_otg,
3765 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003766 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303767 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003768 &android_usb_device,
3769 &msm_pcm,
3770 &msm_pcm_routing,
3771 &msm_cpudai0,
3772 &msm_cpudai1,
3773 &msm_cpudai_hdmi_rx,
3774 &msm_cpudai_bt_rx,
3775 &msm_cpudai_bt_tx,
3776 &msm_cpudai_fm_rx,
3777 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003778 &msm_cpudai_auxpcm_rx,
3779 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003780 &msm_cpu_fe,
3781 &msm_stub_codec,
3782 &msm_kgsl_3d0,
3783#ifdef CONFIG_MSM_KGSL_2D
3784 &msm_kgsl_2d0,
3785 &msm_kgsl_2d1,
3786#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003787 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003788#ifdef CONFIG_MSM_GEMINI
3789 &msm8960_gemini_device,
3790#endif
3791 &msm_voice,
3792 &msm_voip,
3793 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303794 &msm_cpudai_afe_01_rx,
3795 &msm_cpudai_afe_01_tx,
3796 &msm_cpudai_afe_02_rx,
3797 &msm_cpudai_afe_02_tx,
3798 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003799#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3800 &hdmi_msm_device,
3801#endif
3802 &msm_pcm_hostless,
3803 &msm_bus_apps_fabric,
3804 &msm_bus_sys_fabric,
3805 &msm_bus_mm_fabric,
3806 &msm_bus_sys_fpb,
3807 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003808 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003809};
3810
3811static void __init msm8960_i2c_init(void)
3812{
3813 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3814 &msm8960_i2c_qup_gsbi4_pdata;
3815
3816 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3817 &msm8960_i2c_qup_gsbi3_pdata;
3818
3819 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3820 &msm8960_i2c_qup_gsbi10_pdata;
3821
3822 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3823 &msm8960_i2c_qup_gsbi12_pdata;
3824}
3825
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003826static void __init msm8960_gfx_init(void)
3827{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003828 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003829 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3830 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3831 msm_kgsl_3d0.dev.platform_data;
3832 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3833 320000000;
3834 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3835 266667000;
3836 }
3837}
3838
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003839static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3840 .irq_base = PM8921_IRQ_BASE,
3841 .devirq = MSM_GPIO_TO_INT(104),
3842 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3843};
3844
3845static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3846 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3847};
3848
3849static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3850 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3851};
3852
3853static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3854 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303855 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003856};
3857
3858static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3859 .pull_up = 1,
3860 .kpd_trigger_delay_us = 970,
3861 .wakeup = 1,
3862};
3863
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303864/* Rotate lock key is not available so use F1 */
3865#define KEY_ROTATE_LOCK KEY_F1
3866
3867static const unsigned int keymap_liquid[] = {
3868 KEY(0, 0, KEY_VOLUMEUP),
3869 KEY(0, 1, KEY_VOLUMEDOWN),
3870 KEY(1, 3, KEY_ROTATE_LOCK),
3871 KEY(1, 4, KEY_HOME),
3872};
3873
3874static struct matrix_keymap_data keymap_data_liquid = {
3875 .keymap_size = ARRAY_SIZE(keymap_liquid),
3876 .keymap = keymap_liquid,
3877};
3878
3879static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3880 .input_name = "keypad_8960_liquid",
3881 .input_phys_device = "keypad_8960/input0",
3882 .num_rows = 2,
3883 .num_cols = 5,
3884 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3885 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3886 .debounce_ms = 15,
3887 .scan_delay_ms = 32,
3888 .row_hold_ns = 91500,
3889 .wakeup = 1,
3890 .keymap_data = &keymap_data_liquid,
3891};
3892
3893
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003894static const unsigned int keymap[] = {
3895 KEY(0, 0, KEY_VOLUMEUP),
3896 KEY(0, 1, KEY_VOLUMEDOWN),
3897 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3898 KEY(0, 3, KEY_CAMERA_FOCUS),
3899};
3900
3901static struct matrix_keymap_data keymap_data = {
3902 .keymap_size = ARRAY_SIZE(keymap),
3903 .keymap = keymap,
3904};
3905
3906static struct pm8xxx_keypad_platform_data keypad_data = {
3907 .input_name = "keypad_8960",
3908 .input_phys_device = "keypad_8960/input0",
3909 .num_rows = 1,
3910 .num_cols = 5,
3911 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3912 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3913 .debounce_ms = 15,
3914 .scan_delay_ms = 32,
3915 .row_hold_ns = 91500,
3916 .wakeup = 1,
3917 .keymap_data = &keymap_data,
3918};
3919
3920static const unsigned int keymap_sim[] = {
3921 KEY(0, 0, KEY_7),
3922 KEY(0, 1, KEY_DOWN),
3923 KEY(0, 2, KEY_UP),
3924 KEY(0, 3, KEY_RIGHT),
3925 KEY(0, 4, KEY_ENTER),
3926 KEY(0, 5, KEY_L),
3927 KEY(0, 6, KEY_BACK),
3928 KEY(0, 7, KEY_M),
3929
3930 KEY(1, 0, KEY_LEFT),
3931 KEY(1, 1, KEY_SEND),
3932 KEY(1, 2, KEY_1),
3933 KEY(1, 3, KEY_4),
3934 KEY(1, 4, KEY_CLEAR),
3935 KEY(1, 5, KEY_MSDOS),
3936 KEY(1, 6, KEY_SPACE),
3937 KEY(1, 7, KEY_COMMA),
3938
3939 KEY(2, 0, KEY_6),
3940 KEY(2, 1, KEY_5),
3941 KEY(2, 2, KEY_8),
3942 KEY(2, 3, KEY_3),
3943 KEY(2, 4, KEY_NUMERIC_STAR),
3944 KEY(2, 5, KEY_UP),
3945 KEY(2, 6, KEY_DOWN),
3946 KEY(2, 7, KEY_LEFTSHIFT),
3947
3948 KEY(3, 0, KEY_9),
3949 KEY(3, 1, KEY_NUMERIC_POUND),
3950 KEY(3, 2, KEY_0),
3951 KEY(3, 3, KEY_2),
3952 KEY(3, 4, KEY_SLEEP),
3953 KEY(3, 5, KEY_F1),
3954 KEY(3, 6, KEY_F2),
3955 KEY(3, 7, KEY_F3),
3956
3957 KEY(4, 0, KEY_BACK),
3958 KEY(4, 1, KEY_HOME),
3959 KEY(4, 2, KEY_MENU),
3960 KEY(4, 3, KEY_VOLUMEUP),
3961 KEY(4, 4, KEY_VOLUMEDOWN),
3962 KEY(4, 5, KEY_F4),
3963 KEY(4, 6, KEY_F5),
3964 KEY(4, 7, KEY_F6),
3965
3966 KEY(5, 0, KEY_R),
3967 KEY(5, 1, KEY_T),
3968 KEY(5, 2, KEY_Y),
3969 KEY(5, 3, KEY_LEFTALT),
3970 KEY(5, 4, KEY_KPENTER),
3971 KEY(5, 5, KEY_Q),
3972 KEY(5, 6, KEY_W),
3973 KEY(5, 7, KEY_E),
3974
3975 KEY(6, 0, KEY_F),
3976 KEY(6, 1, KEY_G),
3977 KEY(6, 2, KEY_H),
3978 KEY(6, 3, KEY_CAPSLOCK),
3979 KEY(6, 4, KEY_PAGEUP),
3980 KEY(6, 5, KEY_A),
3981 KEY(6, 6, KEY_S),
3982 KEY(6, 7, KEY_D),
3983
3984 KEY(7, 0, KEY_V),
3985 KEY(7, 1, KEY_B),
3986 KEY(7, 2, KEY_N),
3987 KEY(7, 3, KEY_MENU),
3988 KEY(7, 4, KEY_PAGEDOWN),
3989 KEY(7, 5, KEY_Z),
3990 KEY(7, 6, KEY_X),
3991 KEY(7, 7, KEY_C),
3992
3993 KEY(8, 0, KEY_P),
3994 KEY(8, 1, KEY_J),
3995 KEY(8, 2, KEY_K),
3996 KEY(8, 3, KEY_INSERT),
3997 KEY(8, 4, KEY_LINEFEED),
3998 KEY(8, 5, KEY_U),
3999 KEY(8, 6, KEY_I),
4000 KEY(8, 7, KEY_O),
4001
4002 KEY(9, 0, KEY_4),
4003 KEY(9, 1, KEY_5),
4004 KEY(9, 2, KEY_6),
4005 KEY(9, 3, KEY_7),
4006 KEY(9, 4, KEY_8),
4007 KEY(9, 5, KEY_1),
4008 KEY(9, 6, KEY_2),
4009 KEY(9, 7, KEY_3),
4010
4011 KEY(10, 0, KEY_F7),
4012 KEY(10, 1, KEY_F8),
4013 KEY(10, 2, KEY_F9),
4014 KEY(10, 3, KEY_F10),
4015 KEY(10, 4, KEY_FN),
4016 KEY(10, 5, KEY_9),
4017 KEY(10, 6, KEY_0),
4018 KEY(10, 7, KEY_DOT),
4019
4020 KEY(11, 0, KEY_LEFTCTRL),
4021 KEY(11, 1, KEY_F11),
4022 KEY(11, 2, KEY_ENTER),
4023 KEY(11, 3, KEY_SEARCH),
4024 KEY(11, 4, KEY_DELETE),
4025 KEY(11, 5, KEY_RIGHT),
4026 KEY(11, 6, KEY_LEFT),
4027 KEY(11, 7, KEY_RIGHTSHIFT),
4028 KEY(0, 0, KEY_VOLUMEUP),
4029 KEY(0, 1, KEY_VOLUMEDOWN),
4030 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4031 KEY(0, 3, KEY_CAMERA_FOCUS),
4032};
4033
4034static struct matrix_keymap_data keymap_data_sim = {
4035 .keymap_size = ARRAY_SIZE(keymap_sim),
4036 .keymap = keymap_sim,
4037};
4038
4039static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4040 .input_name = "keypad_8960",
4041 .input_phys_device = "keypad_8960/input0",
4042 .num_rows = 12,
4043 .num_cols = 8,
4044 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4045 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4046 .debounce_ms = 15,
4047 .scan_delay_ms = 32,
4048 .row_hold_ns = 91500,
4049 .wakeup = 1,
4050 .keymap_data = &keymap_data_sim,
4051};
4052
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004053static int pm8921_therm_mitigation[] = {
4054 1100,
4055 700,
4056 600,
4057 325,
4058};
4059
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004060static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004061 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004062 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004063 .max_voltage = 4200,
4064 .min_voltage = 3200,
4065 .resume_voltage = 4100,
4066 .term_current = 100,
4067 .cool_temp = 10,
4068 .warm_temp = 40,
4069 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004070 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004071 .cool_bat_chg_current = 350,
4072 .warm_bat_chg_current = 350,
4073 .cool_bat_voltage = 4100,
4074 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004075 .thermal_mitigation = pm8921_therm_mitigation,
4076 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004077};
4078
4079static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4080 .priority = 0,
4081};
4082
4083static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4084 .r_sense = 10,
4085 .i_test = 2500,
4086 .v_failure = 3000,
4087 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004088};
4089
Jay Chokshide4cefb2011-08-04 18:10:44 -07004090#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004091#define PM8XXX_LED_PWM_PERIOD 1000
4092#define PM8XXX_LED_PWM_DUTY_MS 20
4093/**
4094 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4095 * driven using PWM feature.
4096 */
4097#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004098
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004099static struct led_info pm8921_led_info[] = {
4100 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004101 .name = "led:battery_charging",
4102 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004103 },
4104 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004105 .name = "led:battery_full",
4106 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004107 },
4108};
4109
Jay Chokshi8994e392011-09-14 18:20:39 -07004110static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004111 .num_leds = ARRAY_SIZE(pm8921_led_info),
4112 .leds = pm8921_led_info,
4113};
4114
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004115static int pm8921_led0_pwm_duty_pcts[56] = {
4116 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4117 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4118 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4119 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4120 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4121 14, 10, 6, 4, 1
4122};
4123
4124static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4125 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4126 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4127 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4128 .start_idx = 0,
4129};
4130
Jay Chokshi8994e392011-09-14 18:20:39 -07004131static struct pm8xxx_led_config pm8921_led_configs[] = {
4132 [0] = {
4133 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004134 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004135 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004136 .pwm_channel = 5,
4137 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4138 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004139 },
4140 [1] = {
4141 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004142 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004143 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004144 .pwm_channel = 4,
4145 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004146 },
4147};
4148
4149static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4150 .led_core = &pm8921_led_core_pdata,
4151 .configs = pm8921_led_configs,
4152 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4153};
4154
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004155static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4156 .irq_pdata = &pm8xxx_irq_pdata,
4157 .gpio_pdata = &pm8xxx_gpio_pdata,
4158 .mpp_pdata = &pm8xxx_mpp_pdata,
4159 .rtc_pdata = &pm8xxx_rtc_pdata,
4160 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4161 .keypad_pdata = &keypad_data,
4162 .misc_pdata = &pm8xxx_misc_pdata,
4163 .regulator_pdatas = msm_pm8921_regulator_pdata,
4164 .charger_pdata = &pm8921_chg_pdata,
4165 .bms_pdata = &pm8921_bms_pdata,
4166 .adc_pdata = &pm8921_adc_pdata,
4167 .leds_pdata = &pm8xxx_leds_pdata,
4168};
4169
4170static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4171 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4172 .slave = {
4173 .name = "pm8921-core",
4174 .platform_data = &pm8921_platform_data,
4175 },
4176};
4177
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004178#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
4179static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180{
4181 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004182
4183 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
4184 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004185 pr_err("FPGA CS gpio_request failed: %d\n", ret);
4186 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004187 }
4188
4189 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004190
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004191 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004192fail:
4193 return ret;
4194}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004195#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004196static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004197{
4198 return 0;
4199}
4200#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004201
4202static struct msm_cpuidle_state msm_cstates[] __initdata = {
4203 {0, 0, "C0", "WFI",
4204 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4205
4206 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4207 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4208
4209 {0, 2, "C2", "POWER_COLLAPSE",
4210 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4211
4212 {1, 0, "C0", "WFI",
4213 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4214
4215 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4216 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4217};
4218
4219static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4220 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4221 .idle_supported = 1,
4222 .suspend_supported = 1,
4223 .idle_enabled = 0,
4224 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004225 },
4226
4227 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4228 .idle_supported = 1,
4229 .suspend_supported = 1,
4230 .idle_enabled = 0,
4231 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004232 },
4233
4234 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4235 .idle_supported = 1,
4236 .suspend_supported = 1,
4237 .idle_enabled = 1,
4238 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004239 },
4240
4241 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4242 .idle_supported = 0,
4243 .suspend_supported = 1,
4244 .idle_enabled = 0,
4245 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004246 },
4247
4248 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4249 .idle_supported = 1,
4250 .suspend_supported = 1,
4251 .idle_enabled = 0,
4252 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004253 },
4254
4255 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4256 .idle_supported = 1,
4257 .suspend_supported = 0,
4258 .idle_enabled = 1,
4259 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004260 },
4261};
4262
4263static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4264 {
4265 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4266 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4267 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004268 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004269 },
4270
4271 {
4272 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4273 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4274 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004275 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004276 },
4277
4278 {
4279 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4280 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4281 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004282 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004283 },
4284
4285 {
4286 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4287 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4288 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004289 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004290 },
4291
4292 {
4293 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4294 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4295 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004296 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004297 },
4298
4299 {
4300 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4301 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4302 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004303 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004304 },
4305
4306 {
4307 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4308 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4309 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004310 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004311 },
4312
4313 {
4314 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4315 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4316 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004317 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004318 },
4319};
4320
4321#ifdef CONFIG_I2C
4322#define I2C_SURF 1
4323#define I2C_FFA (1 << 1)
4324#define I2C_RUMI (1 << 2)
4325#define I2C_SIM (1 << 3)
4326#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004327#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004328
4329struct i2c_registry {
4330 u8 machs;
4331 int bus;
4332 struct i2c_board_info *info;
4333 int len;
4334};
4335
4336#ifdef CONFIG_MSM_CAMERA
4337static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4338#ifdef CONFIG_IMX074
4339 {
4340 I2C_BOARD_INFO("imx074", 0x1A),
4341 },
4342#endif
4343#ifdef CONFIG_OV2720
4344 {
4345 I2C_BOARD_INFO("ov2720", 0x6C),
4346 },
4347#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004348 {
4349 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4350 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304351#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4352 {
4353 I2C_BOARD_INFO("sc628a", 0x6E),
4354 },
4355#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356};
4357#endif
4358
4359/* Sensors DSPS platform data */
4360#ifdef CONFIG_MSM_DSPS
4361#define DSPS_PIL_GENERIC_NAME "dsps"
4362#endif /* CONFIG_MSM_DSPS */
4363
4364static void __init msm8960_init_dsps(void)
4365{
4366#ifdef CONFIG_MSM_DSPS
4367 struct msm_dsps_platform_data *pdata =
4368 msm_dsps_device.dev.platform_data;
4369 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4370 pdata->gpios = NULL;
4371 pdata->gpios_num = 0;
4372
4373 platform_device_register(&msm_dsps_device);
4374#endif /* CONFIG_MSM_DSPS */
4375}
4376
Amir Samuelov5137e392011-09-21 17:31:25 +03004377#ifdef CONFIG_ISL9519_CHARGER
4378static struct isl_platform_data isl_data __initdata = {
4379 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4380 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4381 .max_system_voltage = 4200,
4382 .min_system_voltage = 3200,
4383 .chgcurrent = 1000, /* 1900, */
4384 .term_current = 400, /* Need fine tuning */
4385 .input_current = 2048,
4386};
4387
4388static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4389 {
4390 I2C_BOARD_INFO("isl9519q", 0x9),
4391 .irq = 0, /* Not required when notify-by-pmic */
4392 .platform_data = &isl_data,
4393 },
4394};
4395#endif /* CONFIG_ISL9519_CHARGER */
4396
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004397static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4398#ifdef CONFIG_MSM_CAMERA
4399 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004400 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004401 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4402 msm_camera_boardinfo,
4403 ARRAY_SIZE(msm_camera_boardinfo),
4404 },
4405#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004406#ifdef CONFIG_ISL9519_CHARGER
4407 {
4408 I2C_LIQUID,
4409 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4410 isl_charger_i2c_info,
4411 ARRAY_SIZE(isl_charger_i2c_info),
4412 },
4413#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004414 {
4415 I2C_SURF | I2C_FFA | I2C_FLUID,
4416 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4417 cyttsp_info,
4418 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004419 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304420 {
4421 I2C_LIQUID,
4422 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4423 mxt_device_info,
4424 ARRAY_SIZE(mxt_device_info),
4425 },
4426
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004427};
4428#endif /* CONFIG_I2C */
4429
4430static void __init register_i2c_devices(void)
4431{
4432#ifdef CONFIG_I2C
4433 u8 mach_mask = 0;
4434 int i;
4435
4436 /* Build the matching 'supported_machs' bitmask */
4437 if (machine_is_msm8960_cdp())
4438 mach_mask = I2C_SURF;
4439 else if (machine_is_msm8960_rumi3())
4440 mach_mask = I2C_RUMI;
4441 else if (machine_is_msm8960_sim())
4442 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004443 else if (machine_is_msm8960_fluid())
4444 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004445 else if (machine_is_msm8960_liquid())
4446 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004447 else if (machine_is_msm8960_mtp())
4448 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004449 else
4450 pr_err("unmatched machine ID in register_i2c_devices\n");
4451
4452 /* Run the array and install devices as appropriate */
4453 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4454 if (msm8960_i2c_devices[i].machs & mach_mask)
4455 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4456 msm8960_i2c_devices[i].info,
4457 msm8960_i2c_devices[i].len);
4458 }
4459#endif
4460}
4461
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004462static void __init msm8960_sim_init(void)
4463{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004464 BUG_ON(msm_rpm_init(&msm_rpm_data));
4465 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4466 ARRAY_SIZE(msm_rpmrs_levels)));
4467 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004468 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004469 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004470 msm8960_device_ssbi_pm8921.dev.platform_data =
4471 &msm8960_ssbi_pm8921_pdata;
4472 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004473
4474 /* Simulator supports a QWERTY keypad */
4475 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4476
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004477 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4478 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4479 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004480 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004481 msm8960_i2c_init();
4482 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4483 msm_spm_l2_init(msm_spm_l2_data);
4484 msm8960_init_buses();
4485 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4486 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004487 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004488 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004489
4490 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4491 &msm8960_qup_spi_gsbi1_pdata;
4492 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4493
4494 msm8960_init_mmc();
4495 msm_fb_add_devices();
4496 slim_register_board_info(msm_slim_devices,
4497 ARRAY_SIZE(msm_slim_devices));
4498 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4499 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4500 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4501 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004502 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004503}
4504
4505static void __init msm8960_rumi3_init(void)
4506{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004507 BUG_ON(msm_rpm_init(&msm_rpm_data));
4508 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4509 ARRAY_SIZE(msm_rpmrs_levels)));
4510 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004511 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004512 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004513 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004514 msm8960_device_ssbi_pm8921.dev.platform_data =
4515 &msm8960_ssbi_pm8921_pdata;
4516 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4517 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4518 &msm8960_qup_spi_gsbi1_pdata;
4519 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4520 msm8960_i2c_init();
4521 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4522 msm_spm_l2_init(msm_spm_l2_data);
4523 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4524 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004525 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004526 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004527 register_i2c_devices();
4528 msm_fb_add_devices();
4529 slim_register_board_info(msm_slim_devices,
4530 ARRAY_SIZE(msm_slim_devices));
4531 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4532 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4533 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4534 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004535 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004536}
4537
4538static void __init msm8960_cdp_init(void)
4539{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004540 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4541 pr_err("meminfo_init() failed!\n");
4542
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004543 BUG_ON(msm_rpm_init(&msm_rpm_data));
4544 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4545 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004546
4547 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004548 regulator_suppress_info_printing();
4549 if (msm_xo_init())
4550 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004551 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004552 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004553 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4554 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4555 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304556 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004557 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004558 if (machine_is_msm8960_cdp())
4559 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304560 if (machine_is_msm8960_liquid())
4561 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004562 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4563 &msm8960_qup_spi_gsbi1_pdata;
4564 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4565 msm8960_device_ssbi_pm8921.dev.platform_data =
4566 &msm8960_ssbi_pm8921_pdata;
4567 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4568 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004569 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004570 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4571 msm_spm_l2_init(msm_spm_l2_data);
4572 msm8960_init_buses();
4573 platform_add_devices(msm_footswitch_devices,
4574 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004575 if (machine_is_msm8960_liquid())
4576 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004577 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4578 pm8921_gpio_mpp_init();
4579 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4580 msm8960_init_cam();
4581 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004582 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304583 if (machine_is_msm8960_liquid())
4584 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004585 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004586 msm_fb_add_devices();
4587 slim_register_board_info(msm_slim_devices,
4588 ARRAY_SIZE(msm_slim_devices));
4589 msm8960_init_dsps();
4590 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4591 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4592 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4593 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004594 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004595 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004596}
4597
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004598MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4599 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004600 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004601 .init_irq = msm8960_init_irq,
4602 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004603 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004604 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004605 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004606MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004607
4608MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4609 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004610 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004611 .init_irq = msm8960_init_irq,
4612 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004613 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004614 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004615 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004616MACHINE_END
4617
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004618MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4619 .map_io = msm8960_map_io,
4620 .reserve = msm8960_reserve,
4621 .init_irq = msm8960_init_irq,
4622 .timer = &msm_timer,
4623 .init_machine = msm8960_cdp_init,
4624 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004625 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004626MACHINE_END
4627
4628MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4629 .map_io = msm8960_map_io,
4630 .reserve = msm8960_reserve,
4631 .init_irq = msm8960_init_irq,
4632 .timer = &msm_timer,
4633 .init_machine = msm8960_cdp_init,
4634 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004635 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004636MACHINE_END
4637
4638MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4639 .map_io = msm8960_map_io,
4640 .reserve = msm8960_reserve,
4641 .init_irq = msm8960_init_irq,
4642 .timer = &msm_timer,
4643 .init_machine = msm8960_cdp_init,
4644 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004645 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004646MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004647
4648MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4649 .map_io = msm8960_map_io,
4650 .reserve = msm8960_reserve,
4651 .init_irq = msm8960_init_irq,
4652 .timer = &msm_timer,
4653 .init_machine = msm8960_cdp_init,
4654 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004655 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004656MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004657
4658#ifdef CONFIG_ARCH_MSM8930
4659MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4660 .map_io = msm8930_map_io,
4661 .reserve = msm8960_reserve,
4662 .init_irq = msm8960_init_irq,
4663 .timer = &msm_timer,
4664 .init_machine = msm8960_cdp_init,
4665 .init_early = msm8960_allocate_memory_regions,
4666MACHINE_END
4667
4668MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4669 .map_io = msm8930_map_io,
4670 .reserve = msm8960_reserve,
4671 .init_irq = msm8960_init_irq,
4672 .timer = &msm_timer,
4673 .init_machine = msm8960_cdp_init,
4674 .init_early = msm8960_allocate_memory_regions,
4675MACHINE_END
4676
4677MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4678 .map_io = msm8930_map_io,
4679 .reserve = msm8960_reserve,
4680 .init_irq = msm8960_init_irq,
4681 .timer = &msm_timer,
4682 .init_machine = msm8960_cdp_init,
4683 .init_early = msm8960_allocate_memory_regions,
4684MACHINE_END
4685#endif