blob: 2c01e820308c5cc828b737a3a9cf80a937fa4d30 [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>
24#include <linux/regulator/consumer.h>
25#include <linux/spi/spi.h>
26#include <linux/slimbus/slimbus.h>
27#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060028#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
32#include <linux/cyttsp.h>
33#include <linux/dma-mapping.h>
34#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070035#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <linux/leds.h>
37#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053038#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070039#include <linux/msm_tsens.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080040
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070043#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <mach/board.h>
48#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <mach/msm_spi.h>
50#ifdef CONFIG_USB_MSM_OTG_72K
51#include <mach/msm_hsusb.h>
52#else
53#include <linux/usb/msm_hsusb.h>
54#endif
55#include <linux/usb/android.h>
56#include <mach/usbdiag.h>
57#include <mach/socinfo.h>
58#include <mach/rpm.h>
59#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070060#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061#include <mach/msm_bus_board.h>
62#include <mach/msm_memtypes.h>
63#include <mach/dma.h>
64#include <mach/msm_dsps.h>
65#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070066#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#ifdef CONFIG_WCD9310_CODEC
69#include <linux/slimbus/slimbus.h>
70#include <linux/mfd/wcd9310/core.h>
71#include <linux/mfd/wcd9310/pdata.h>
72#endif
73
Laura Abbottd6183792011-08-19 13:42:24 -070074#include <linux/ion.h>
75#include <mach/ion.h>
76
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080078#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "spm.h"
81#include "board-msm8960.h"
82#include "pm.h"
83#include "cpuidle.h"
84#include "rpm_resources.h"
85#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070086#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070087#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070088#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089
90static struct platform_device msm_fm_platform_init = {
91 .name = "iris_fm",
92 .id = -1,
93};
94
95struct pm8xxx_gpio_init {
96 unsigned gpio;
97 struct pm_gpio config;
98};
99
100struct pm8xxx_mpp_init {
101 unsigned mpp;
102 struct pm8xxx_mpp_config_data config;
103};
104
105#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
106 _func, _inv, _disable) \
107{ \
108 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
109 .config = { \
110 .direction = _dir, \
111 .output_buffer = _buf, \
112 .output_value = _val, \
113 .pull = _pull, \
114 .vin_sel = _vin, \
115 .out_strength = _out_strength, \
116 .function = _func, \
117 .inv_int_pol = _inv, \
118 .disable_pin = _disable, \
119 } \
120}
121
122#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
123{ \
124 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
125 .config = { \
126 .type = PM8XXX_MPP_TYPE_##_type, \
127 .level = _level, \
128 .control = PM8XXX_MPP_##_control, \
129 } \
130}
131
132#define PM8XXX_GPIO_DISABLE(_gpio) \
133 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
134 0, 0, 0, 1)
135
136#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
138 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_HIGH, \
140 PM_GPIO_FUNC_NORMAL, 0, 0)
141
142#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
143 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
144 _pull, PM_GPIO_VIN_S4, \
145 PM_GPIO_STRENGTH_NO, \
146 PM_GPIO_FUNC_NORMAL, 0, 0)
147
148#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
149 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
150 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
151 PM_GPIO_STRENGTH_HIGH, \
152 _func, 0, 0)
153
154/* Initial PM8921 GPIO configurations */
155static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
156 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
157 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
158 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300159 /* External regulator shared by display and touchscreen on LiQUID */
160 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
161 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700162 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700163 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700165 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166};
167
168/* Initial PM8921 MPP configurations */
169static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
170 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
171 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
172 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
173 DOUT_CTRL_LOW),
174 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
175 DOUT_CTRL_LOW),
176};
177
178static void __init pm8921_gpio_mpp_init(void)
179{
180 int i, rc;
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
183 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
184 &pm8921_gpios[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
192 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
193 &pm8921_mpps[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199}
200
201#define FPGA_CS_GPIO 14
202#define KS8851_RST_GPIO 89
203#define KS8851_IRQ_GPIO 90
204
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
206enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700207 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700208 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
209 /* CAM Expander */
210 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
211 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
212 GPIO_CAM_GP_AFBUSY,
213 GPIO_CAM_GP_STROBE_CE,
214 GPIO_CAM_GP_CAM1MP_XCLR,
215 GPIO_CAM_GP_CAMIF_RESET_N,
216 GPIO_CAM_GP_XMT_FLASH_INT,
217 GPIO_CAM_GP_LED_EN1,
218 GPIO_CAM_GP_LED_EN2,
219
220};
221#endif
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223/* The SPI configurations apply to GSBI 1*/
224static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225 .func = GPIOMUX_FUNC_1,
226 .drv = GPIOMUX_DRV_8MA,
227 .pull = GPIOMUX_PULL_NONE,
228};
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230static struct gpiomux_setting spi_suspended_config = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_DOWN,
234};
235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236static struct gpiomux_setting gsbi3 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242static struct gpiomux_setting gsbi5 = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
248static struct gpiomux_setting gsbi10 = {
249 .func = GPIOMUX_FUNC_2,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi12 = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting cdc_mclk = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700266#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267static struct gpiomux_setting gpio_eth_config = {
268 .pull = GPIOMUX_PULL_NONE,
269 .drv = GPIOMUX_DRV_8MA,
270 .func = GPIOMUX_FUNC_GPIO,
271};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700272#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273
274static struct gpiomux_setting slimbus = {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_8MA,
277 .pull = GPIOMUX_PULL_KEEPER,
278};
279
280struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700281#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282 {
283 .gpio = KS8851_IRQ_GPIO,
284 .settings = {
285 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
286 }
287 },
288 {
289 .gpio = KS8851_RST_GPIO,
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
292 }
293 },
294 {
295 .gpio = FPGA_CS_GPIO,
296 .settings = {
297 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
298 }
299 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700300#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301};
302
303static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
304 {
305 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
306 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600307 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
308 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309 },
310 },
311 {
312 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
313 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600314 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
315 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 },
317 },
318 {
319 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
320 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600321 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
322 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 },
324 },
325 {
326 .gpio = 9, /* GSBI1 QUP SPI_CLK */
327 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600328 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
329 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 },
331 },
332 {
333 .gpio = 16, /* GSBI3 I2C QUP SDA */
334 .settings = {
335 [GPIOMUX_SUSPENDED] = &gsbi3,
336 },
337 },
338 {
339 .gpio = 17, /* GSBI3 I2C QUP SCL */
340 .settings = {
341 [GPIOMUX_SUSPENDED] = &gsbi3,
342 },
343 },
344 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 .gpio = 22, /* GSBI5 UART2 */
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gsbi5,
348 },
349 },
350 {
351 .gpio = 23, /* GSBI5 UART2 */
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gsbi5,
354 },
355 },
356 {
357 .gpio = 24, /* GSBI5 UART2 */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gsbi5,
360 },
361 },
362 {
363 .gpio = 25, /* GSBI5 UART2 */
364 .settings = {
365 [GPIOMUX_SUSPENDED] = &gsbi5,
366 },
367 },
368 {
369 .gpio = 44, /* GSBI12 I2C QUP SDA */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi12,
372 },
373 },
374 {
375 .gpio = 45, /* GSBI12 I2C QUP SCL */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi12,
378 },
379 },
380 {
381 .gpio = 73, /* GSBI10 I2C QUP SDA */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi10,
384 },
385 },
386 {
387 .gpio = 74, /* GSBI10 I2C QUP SCL */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi10,
390 },
391 },
392};
393
394static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
395 {
396 .gpio = 60, /* slimbus data */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &slimbus,
399 },
400 },
401 {
402 .gpio = 61, /* slimbus clk */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &slimbus,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
410 {
411 .gpio = 59,
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &cdc_mclk,
414 },
415 },
416};
417static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
418 .func = GPIOMUX_FUNC_GPIO,
419 .drv = GPIOMUX_DRV_2MA,
420 .pull = GPIOMUX_PULL_NONE,
421};
422
423static struct gpiomux_setting wcnss_5wire_active_cfg = {
424 .func = GPIOMUX_FUNC_1,
425 .drv = GPIOMUX_DRV_6MA,
426 .pull = GPIOMUX_PULL_DOWN,
427};
428
429static struct msm_gpiomux_config wcnss_5wire_interface[] = {
430 {
431 .gpio = 84,
432 .settings = {
433 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
434 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
435 },
436 },
437 {
438 .gpio = 85,
439 .settings = {
440 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
441 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
442 },
443 },
444 {
445 .gpio = 86,
446 .settings = {
447 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
448 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
449 },
450 },
451 {
452 .gpio = 87,
453 .settings = {
454 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
455 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
456 },
457 },
458 {
459 .gpio = 88,
460 .settings = {
461 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
462 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
463 },
464 },
465};
Nishant Pandit24153d82011-08-27 16:05:13 +0530466static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530467 {
468 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
469 .drv = GPIOMUX_DRV_2MA,
470 .pull = GPIOMUX_PULL_DOWN,
471 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472
Nishant Pandit474f2252011-07-23 23:17:56 +0530473 {
474 .func = GPIOMUX_FUNC_1, /*active 1*/
475 .drv = GPIOMUX_DRV_2MA,
476 .pull = GPIOMUX_PULL_NONE,
477 },
478
479 {
480 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
481 .drv = GPIOMUX_DRV_2MA,
482 .pull = GPIOMUX_PULL_NONE,
483 },
484
485 {
486 .func = GPIOMUX_FUNC_1, /*active 3*/
487 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700488 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530489 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530490
491 {
492 .func = GPIOMUX_FUNC_5, /*active 4*/
493 .drv = GPIOMUX_DRV_8MA,
494 .pull = GPIOMUX_PULL_UP,
495 },
496
497 {
498 .func = GPIOMUX_FUNC_6, /*active 5*/
499 .drv = GPIOMUX_DRV_8MA,
500 .pull = GPIOMUX_PULL_UP,
501 },
502
503 {
504 .func = GPIOMUX_FUNC_2, /*active 6*/
505 .drv = GPIOMUX_DRV_2MA,
506 .pull = GPIOMUX_PULL_UP,
507 },
508
509 {
510 .func = GPIOMUX_FUNC_3, /*active 7*/
511 .drv = GPIOMUX_DRV_8MA,
512 .pull = GPIOMUX_PULL_UP,
513 },
514
Kevin Chan4c58d292011-09-13 11:03:25 -0700515 {
516 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
517 .drv = GPIOMUX_DRV_2MA,
518 .pull = GPIOMUX_PULL_KEEPER,
519 },
520
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521};
522
Nishant Pandit24153d82011-08-27 16:05:13 +0530523static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700524 {
525 .gpio = 2,
526 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530527 [GPIOMUX_ACTIVE] = &cam_settings[2],
528 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700529 },
530 },
531 {
532 .gpio = 3,
533 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530534 [GPIOMUX_ACTIVE] = &cam_settings[1],
535 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700536 },
537 },
538 {
539 .gpio = 4,
540 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530541 [GPIOMUX_ACTIVE] = &cam_settings[1],
542 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700543 },
544 },
545 {
546 .gpio = 5,
547 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530548 [GPIOMUX_ACTIVE] = &cam_settings[1],
549 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700550 },
551 },
552 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530553 .gpio = 76,
554 .settings = {
555 [GPIOMUX_ACTIVE] = &cam_settings[2],
556 [GPIOMUX_SUSPENDED] = &cam_settings[0],
557 },
558 },
559 {
560 .gpio = 107,
561 .settings = {
562 [GPIOMUX_ACTIVE] = &cam_settings[2],
563 [GPIOMUX_SUSPENDED] = &cam_settings[0],
564 },
565 },
566};
567
568static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
569 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570 .gpio = 18,
571 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530572 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700573 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574 },
575 },
576 {
577 .gpio = 19,
578 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530579 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700580 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700581 },
582 },
583 {
584 .gpio = 20,
585 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530586 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700587 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700588 },
589 },
590 {
591 .gpio = 21,
592 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530593 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700594 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595 },
596 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597};
598
599static struct gpiomux_setting cyts_resout_sus_cfg = {
600 .func = GPIOMUX_FUNC_GPIO,
601 .drv = GPIOMUX_DRV_6MA,
602 .pull = GPIOMUX_PULL_UP,
603};
604
605static struct gpiomux_setting cyts_resout_act_cfg = {
606 .func = GPIOMUX_FUNC_GPIO,
607 .drv = GPIOMUX_DRV_6MA,
608 .pull = GPIOMUX_PULL_UP,
609};
610
611static struct gpiomux_setting cyts_sleep_sus_cfg = {
612 .func = GPIOMUX_FUNC_GPIO,
613 .drv = GPIOMUX_DRV_6MA,
614 .pull = GPIOMUX_PULL_DOWN,
615};
616
617static struct gpiomux_setting cyts_sleep_act_cfg = {
618 .func = GPIOMUX_FUNC_GPIO,
619 .drv = GPIOMUX_DRV_6MA,
620 .pull = GPIOMUX_PULL_DOWN,
621};
622
623static struct gpiomux_setting cyts_int_act_cfg = {
624 .func = GPIOMUX_FUNC_GPIO,
625 .drv = GPIOMUX_DRV_8MA,
626 .pull = GPIOMUX_PULL_UP,
627};
628
629static struct gpiomux_setting cyts_int_sus_cfg = {
630 .func = GPIOMUX_FUNC_GPIO,
631 .drv = GPIOMUX_DRV_2MA,
632 .pull = GPIOMUX_PULL_UP,
633};
634
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
636 { /* TS INTERRUPT */
637 .gpio = 11,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
640 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
641 },
642 },
643 { /* TS SLEEP */
644 .gpio = 50,
645 .settings = {
646 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
647 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
648 },
649 },
650 { /* TS RESOUT */
651 .gpio = 52,
652 .settings = {
653 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
654 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
655 },
656 },
657};
658
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700659#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
660enum {
661 SX150X_CAM,
662};
663
Nishant Pandit474f2252011-07-23 23:17:56 +0530664static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700665 [SX150X_CAM] = {
666 .gpio_base = GPIO_CAM_EXPANDER_BASE,
667 .oscio_is_gpo = false,
668 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530669 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700670 .io_open_drain_ena = 0x0,
671 .irq_summary = -1,
672 },
673};
Nishant Pandit474f2252011-07-23 23:17:56 +0530674
675#endif
676
677#ifdef CONFIG_I2C
678
679#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
680#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300681#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530682
683#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
684
685static struct i2c_board_info cam_expander_i2c_info[] = {
686 {
687 I2C_BOARD_INFO("sx1508q", 0x22),
688 .platform_data = &sx150x_data[SX150X_CAM]
689 },
690};
691
692static struct msm_cam_expander_info cam_expander_info[] = {
693 {
694 cam_expander_i2c_info,
695 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
696 },
697};
698#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700699#endif
700
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700701#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
702#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700703#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700704#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
705
Laura Abbottd6183792011-08-19 13:42:24 -0700706#define MSM_ION_EBI_SIZE SZ_8M
707
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700708#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
709static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
710static int __init pmem_kernel_ebi1_size_setup(char *p)
711{
712 pmem_kernel_ebi1_size = memparse(p, NULL);
713 return 0;
714}
715early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
716#endif
717
718#ifdef CONFIG_ANDROID_PMEM
719static unsigned pmem_size = MSM_PMEM_SIZE;
720static int __init pmem_size_setup(char *p)
721{
722 pmem_size = memparse(p, NULL);
723 return 0;
724}
725early_param("pmem_size", pmem_size_setup);
726
727static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
728
729static int __init pmem_adsp_size_setup(char *p)
730{
731 pmem_adsp_size = memparse(p, NULL);
732 return 0;
733}
734early_param("pmem_adsp_size", pmem_adsp_size_setup);
735
736static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
737
738static int __init pmem_audio_size_setup(char *p)
739{
740 pmem_audio_size = memparse(p, NULL);
741 return 0;
742}
743early_param("pmem_audio_size", pmem_audio_size_setup);
744#endif
745
746#ifdef CONFIG_ANDROID_PMEM
747static struct android_pmem_platform_data android_pmem_pdata = {
748 .name = "pmem",
749 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
750 .cached = 1,
751 .memory_type = MEMTYPE_EBI1,
752};
753
754static struct platform_device android_pmem_device = {
755 .name = "android_pmem",
756 .id = 0,
757 .dev = {.platform_data = &android_pmem_pdata},
758};
759
760static struct android_pmem_platform_data android_pmem_adsp_pdata = {
761 .name = "pmem_adsp",
762 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
763 .cached = 0,
764 .memory_type = MEMTYPE_EBI1,
765};
766static struct platform_device android_pmem_adsp_device = {
767 .name = "android_pmem",
768 .id = 2,
769 .dev = { .platform_data = &android_pmem_adsp_pdata },
770};
771
772static struct android_pmem_platform_data android_pmem_audio_pdata = {
773 .name = "pmem_audio",
774 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
775 .cached = 0,
776 .memory_type = MEMTYPE_EBI1,
777};
778
779static struct platform_device android_pmem_audio_device = {
780 .name = "android_pmem",
781 .id = 4,
782 .dev = { .platform_data = &android_pmem_audio_pdata },
783};
784#endif
785
786static struct memtype_reserve msm8960_reserve_table[] __initdata = {
787 [MEMTYPE_SMI] = {
788 },
789 [MEMTYPE_EBI0] = {
790 .flags = MEMTYPE_FLAGS_1M_ALIGN,
791 },
792 [MEMTYPE_EBI1] = {
793 .flags = MEMTYPE_FLAGS_1M_ALIGN,
794 },
795};
796
797static void __init size_pmem_devices(void)
798{
799#ifdef CONFIG_ANDROID_PMEM
800 android_pmem_adsp_pdata.size = pmem_adsp_size;
801 android_pmem_pdata.size = pmem_size;
802 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
803#endif
804}
805
806static void __init reserve_memory_for(struct android_pmem_platform_data *p)
807{
808 msm8960_reserve_table[p->memory_type].size += p->size;
809}
810
811static void __init reserve_pmem_memory(void)
812{
813#ifdef CONFIG_ANDROID_PMEM
814 reserve_memory_for(&android_pmem_adsp_pdata);
815 reserve_memory_for(&android_pmem_pdata);
816 reserve_memory_for(&android_pmem_audio_pdata);
817 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
818#endif
819}
820
Larry Basselb4126da2011-07-18 14:31:33 -0700821static int msm8960_paddr_to_memtype(unsigned int paddr)
822{
823 return MEMTYPE_EBI1;
824}
825
Laura Abbottd6183792011-08-19 13:42:24 -0700826#ifdef CONFIG_ION_MSM
827struct ion_platform_data ion_pdata = {
828 .nr = 3,
829 .heaps = {
830 {
831 .id = ION_HEAP_SYSTEM_ID,
832 .type = ION_HEAP_TYPE_SYSTEM,
833 .name = ION_KMALLOC_HEAP_NAME,
834 },
835 {
836 .id = ION_HEAP_SYSTEM_CONTIG_ID,
837 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
838 .name = ION_VMALLOC_HEAP_NAME,
839 },
840 {
841 .id = ION_HEAP_EBI_ID,
842 .type = ION_HEAP_TYPE_CARVEOUT,
843 .name = ION_EBI1_HEAP_NAME,
844 .size = MSM_ION_EBI_SIZE,
845 .memory_type = ION_EBI_TYPE,
846 },
847 }
848};
849
850struct platform_device ion_dev = {
851 .name = "ion-msm",
852 .id = 1,
853 .dev = { .platform_data = &ion_pdata },
854};
855#endif
856
857static void reserve_ion_memory(void)
858{
859#ifdef CONFIG_ION_MSM
860 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
861#endif
862}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863static void __init msm8960_calculate_reserve_sizes(void)
864{
865 size_pmem_devices();
866 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700867 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868}
869
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870static struct reserve_info msm8960_reserve_info __initdata = {
871 .memtype_reserve_table = msm8960_reserve_table,
872 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
873 .paddr_to_memtype = msm8960_paddr_to_memtype,
874};
875
Larry Basselb4126da2011-07-18 14:31:33 -0700876static int msm8960_memory_bank_size(void)
877{
878 return 1<<29;
879}
880
881static void __init locate_unstable_memory(void)
882{
883 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
884 unsigned long bank_size;
885 unsigned long low, high;
886
887 bank_size = msm8960_memory_bank_size();
888 low = meminfo.bank[0].start;
889 high = mb->start + mb->size;
890 low &= ~(bank_size - 1);
891
892 if (high - low <= bank_size)
893 return;
894 msm8960_reserve_info.low_unstable_address = low + bank_size;
895 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
896 msm8960_reserve_info.bank_size = bank_size;
897 pr_info("low unstable address %lx max size %lx bank size %lx\n",
898 msm8960_reserve_info.low_unstable_address,
899 msm8960_reserve_info.max_unstable_size,
900 msm8960_reserve_info.bank_size);
901}
902
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903static void __init msm8960_reserve(void)
904{
905 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700906 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700907 msm_reserve();
908}
909
Larry Bassela4414b12011-08-04 11:11:02 -0700910static int msm8960_change_memory_power(u64 start, u64 size,
911 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700912{
Larry Bassela4414b12011-08-04 11:11:02 -0700913 return size;
Larry Bassela7eadea2011-07-14 10:46:00 -0700914}
915
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700916#ifdef CONFIG_MSM_CAMERA
917
Nishant Pandit24153d82011-08-27 16:05:13 +0530918static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700919 5, /*CAMIF_MCLK*/
920 20, /*CAMIF_I2C_DATA*/
921 21, /*CAMIF_I2C_CLK*/
922};
923
Nishant Pandit24153d82011-08-27 16:05:13 +0530924static struct msm_camera_gpio_conf gpio_conf = {
925 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
926 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
927 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
928 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
929};
930
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700931#define VFE_CAMIF_TIMER1_GPIO 2
932#define VFE_CAMIF_TIMER2_GPIO 3
933#define VFE_CAMIF_TIMER3_GPIO_INT 4
934struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
935 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
936 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
937 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
938 .flash_recharge_duration = 50000,
939 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
940};
941
Nishant Pandit474f2252011-07-23 23:17:56 +0530942#ifdef CONFIG_MSM_CAMERA_FLASH
943static struct msm_camera_sensor_flash_src msm_flash_src = {
944 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
945 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
946 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
947#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
948 defined(CONFIG_GPIO_SX150X_MODULE))
949 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
950#endif
951};
952#endif
953
Nishant Pandit24153d82011-08-27 16:05:13 +0530954struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
955 {
956 .ioclk.mclk_clk_rate = 24000000,
957 .ioclk.vfe_clk_rate = 228570000,
958 .csid_core = 0,
959 },
960 {
961 .ioclk.mclk_clk_rate = 24000000,
962 .ioclk.vfe_clk_rate = 228570000,
963 .csid_core = 1,
964 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965};
966
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -0700967#ifdef CONFIG_IMX074_ACT
968static struct i2c_board_info imx074_actuator_i2c_info = {
969 I2C_BOARD_INFO("imx074_act", 0x11),
970};
971
972static struct msm_actuator_info imx074_actuator_info = {
973 .board_info = &imx074_actuator_i2c_info,
974 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
975 .vcm_pwd = 0,
976 .vcm_enable = 1,
977};
978#endif
979
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980#ifdef CONFIG_IMX074
981static struct msm_camera_sensor_flash_data flash_imx074 = {
982 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530983#ifdef CONFIG_MSM_CAMERA_FLASH
984 .flash_src = &msm_flash_src
985#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986};
987
Nishant Pandit24153d82011-08-27 16:05:13 +0530988static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
989 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700990 .sensor_reset = 107,
991 .sensor_pwd = 85,
992 .vcm_pwd = 0,
993 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +0530994};
995
996static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
997 .sensor_name = "imx074",
998 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 .flash_data = &flash_imx074,
1000 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301001 .sensor_platform_info = &sensor_board_info_imx074,
1002 .gpio_conf = &gpio_conf,
1003 .csi_if = 1,
1004 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001005#ifdef CONFIG_IMX074_ACT
1006 .actuator_info = &imx074_actuator_info
1007#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001008};
1009
1010struct platform_device msm8960_camera_sensor_imx074 = {
1011 .name = "msm_camera_imx074",
1012 .dev = {
1013 .platform_data = &msm_camera_sensor_imx074_data,
1014 },
1015};
1016#endif
1017#ifdef CONFIG_OV2720
1018static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001019 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001020};
1021
Nishant Pandit24153d82011-08-27 16:05:13 +05301022static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1023 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001024 .sensor_reset = 76,
1025 .sensor_pwd = 85,
1026 .vcm_pwd = 0,
1027 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301028};
1029
1030static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1031 .sensor_name = "ov2720",
1032 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001033 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301034 .sensor_platform_info = &sensor_board_info_ov2720,
1035 .gpio_conf = &gpio_conf,
1036 .csi_if = 1,
1037 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001038};
1039
1040struct platform_device msm8960_camera_sensor_ov2720 = {
1041 .name = "msm_camera_ov2720",
1042 .dev = {
1043 .platform_data = &msm_camera_sensor_ov2720_data,
1044 },
1045};
1046#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001047
1048static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1049 .flash_type = MSM_CAMERA_FLASH_LED,
1050};
1051
Nishant Pandit24153d82011-08-27 16:05:13 +05301052static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1053 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001054 .sensor_reset = 107,
1055 .sensor_pwd = 85,
1056 .vcm_pwd = 0,
1057 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301058};
1059
1060static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1061 .sensor_name = "qs_mt9p017",
1062 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001063 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301064 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1065 .gpio_conf = &gpio_conf,
1066 .csi_if = 1,
1067 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001068};
1069
1070struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1071 .name = "msm_camera_qs_mt9p017",
1072 .dev = {
1073 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1074 },
1075};
1076
Kevin Chan8b0d2322011-09-10 21:06:31 -07001077static struct msm8960_privacy_light_cfg privacy_light_info = {
1078 .mpp = PM8921_MPP_PM_TO_SYS(12),
1079};
1080
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001081static void __init msm8960_init_cam(void)
1082{
1083 int i;
1084 struct platform_device *cam_dev[] = {
1085 &msm8960_camera_sensor_imx074,
1086 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001087 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001088 };
1089
Kevin Chan8b0d2322011-09-10 21:06:31 -07001090 if (machine_is_msm8960_liquid()) {
1091 struct msm_camera_sensor_info *s_info;
1092 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1093 s_info->sensor_platform_info->mount_angle = 180;
1094 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1095 s_info->sensor_platform_info->privacy_light = 1;
1096 s_info->sensor_platform_info->privacy_light_info =
1097 &privacy_light_info;
1098 }
1099
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001100 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1101 struct msm_camera_sensor_info *s_info;
1102 s_info = cam_dev[i]->dev.platform_data;
1103 msm_get_cam_resources(s_info);
1104 platform_device_register(cam_dev[i]);
1105 }
1106}
1107#endif
1108
1109#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001110/* prim = 1366 x 768 x 3(bpp) x 3(pages) */
1111#define MSM_FB_PRIM_BUF_SIZE roundup(1366 * 768 * 3 * 3, 0x10000)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001112#else
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001113/* prim = 1366 x 768 x 3(bpp) x 2(pages) */
1114#define MSM_FB_PRIM_BUF_SIZE roundup(1366 * 768 * 3 * 2, 0x10000)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001115#endif
1116
1117#ifdef CONFIG_FB_MSM_MIPI_DSI
Nagamalleswararao Ganji0b8dbd02011-08-18 20:46:59 -07001118#define MIPI_DSI_WRITEBACK_SIZE (1024 * 600 * 3 * 2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001119#else
1120#define MIPI_DSI_WRITEBACK_SIZE 0
1121#endif
1122
1123#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1124/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1125#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1126#elif defined(CONFIG_FB_MSM_TVOUT)
1127/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1128#define MSM_FB_EXT_BUF_SIZE 0x195000
1129#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1130#define MSM_FB_EXT_BUF_SIZE 0
1131#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1132
1133#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1134 MIPI_DSI_WRITEBACK_SIZE, 4096)
1135
1136#define MDP_VSYNC_GPIO 0
1137
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001138#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1139#define TOSHIBA_PANEL_NAME_LEN 24
1140#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1141#define CHIMEI_PANEL_NAME_LEN 16
1142
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001143static struct resource msm_fb_resources[] = {
1144 {
1145 .flags = IORESOURCE_DMA,
1146 }
1147};
1148
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001149#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1150static int msm_fb_detect_panel(const char *name)
1151{
1152 if (machine_is_msm8960_liquid()) {
1153 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1154 return 0;
1155 } else {
1156 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1157 return 0;
1158 }
1159
1160 pr_warning("%s: not supported '%s'", __func__, name);
1161
1162 return -ENODEV;
1163}
1164
1165static struct msm_fb_platform_data msm_fb_pdata = {
1166 .detect_client = msm_fb_detect_panel,
1167};
1168#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1169
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001170static struct platform_device msm_fb_device = {
1171 .name = "msm_fb",
1172 .id = 0,
1173 .num_resources = ARRAY_SIZE(msm_fb_resources),
1174 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001175#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1176 .dev.platform_data = &msm_fb_pdata,
1177#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001178};
1179
1180static bool dsi_power_on;
1181
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001182/**
1183 * LiQUID panel on/off
1184 *
1185 * @param on
1186 *
1187 * @return int
1188 */
1189static int mipi_dsi_liquid_panel_power(int on)
1190{
1191 static struct regulator *reg_l2, *reg_ext_3p3v;
1192 static int gpio21, gpio24, gpio43;
1193 int rc;
1194
1195 pr_info("%s: on=%d\n", __func__, on);
1196
1197 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1198 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1199 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1200
1201 if (!dsi_power_on) {
1202
1203 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1204 "dsi_vdda");
1205 if (IS_ERR(reg_l2)) {
1206 pr_err("could not get 8921_l2, rc = %ld\n",
1207 PTR_ERR(reg_l2));
1208 return -ENODEV;
1209 }
1210
1211 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1212 if (rc) {
1213 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1214 return -EINVAL;
1215 }
1216
1217 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1218 "vdd_lvds_3p3v");
1219 if (IS_ERR(reg_ext_3p3v)) {
1220 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1221 PTR_ERR(reg_ext_3p3v));
1222 return -ENODEV;
1223 }
1224
1225 rc = gpio_request(gpio21, "disp_pwr_en_n");
1226 if (rc) {
1227 pr_err("request gpio 21 failed, rc=%d\n", rc);
1228 return -ENODEV;
1229 }
1230
1231 rc = gpio_request(gpio43, "disp_rst_n");
1232 if (rc) {
1233 pr_err("request gpio 43 failed, rc=%d\n", rc);
1234 return -ENODEV;
1235 }
1236
1237 rc = gpio_request(gpio24, "disp_backlight_pwm");
1238 if (rc) {
1239 pr_err("request gpio 24 failed, rc=%d\n", rc);
1240 return -ENODEV;
1241 }
1242
1243 dsi_power_on = true;
1244 }
1245
1246 if (on) {
1247 rc = regulator_set_optimum_mode(reg_l2, 100000);
1248 if (rc < 0) {
1249 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1250 return -EINVAL;
1251 }
1252 rc = regulator_enable(reg_l2);
1253 if (rc) {
1254 pr_err("enable l2 failed, rc=%d\n", rc);
1255 return -ENODEV;
1256 }
1257
1258 rc = regulator_enable(reg_ext_3p3v);
1259 if (rc) {
1260 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1261 return -ENODEV;
1262 }
1263
1264 /* set reset pin before power enable */
1265 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1266
1267 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1268 msleep(20);
1269 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1270 msleep(20);
1271 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1272 msleep(20);
1273 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1274 msleep(20);
1275 } else {
1276 gpio_set_value_cansleep(gpio43, 0);
1277 gpio_set_value_cansleep(gpio21, 1);
1278
1279 rc = regulator_disable(reg_l2);
1280 if (rc) {
1281 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1282 return -ENODEV;
1283 }
1284 rc = regulator_disable(reg_ext_3p3v);
1285 if (rc) {
1286 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1287 return -ENODEV;
1288 }
1289 rc = regulator_set_optimum_mode(reg_l2, 100);
1290 if (rc < 0) {
1291 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1292 return -EINVAL;
1293 }
1294 }
1295
1296 return 0;
1297}
1298
1299static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300{
1301 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001302 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303 int rc;
1304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305 pr_info("%s: state : %d\n", __func__, on);
1306
1307 if (!dsi_power_on) {
1308
1309 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1310 "dsi_vdc");
1311 if (IS_ERR(reg_l8)) {
1312 pr_err("could not get 8921_l8, rc = %ld\n",
1313 PTR_ERR(reg_l8));
1314 return -ENODEV;
1315 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001316 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1317 "dsi_vddio");
1318 if (IS_ERR(reg_l23)) {
1319 pr_err("could not get 8921_l23, rc = %ld\n",
1320 PTR_ERR(reg_l23));
1321 return -ENODEV;
1322 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1324 "dsi_vdda");
1325 if (IS_ERR(reg_l2)) {
1326 pr_err("could not get 8921_l2, rc = %ld\n",
1327 PTR_ERR(reg_l2));
1328 return -ENODEV;
1329 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1331 if (rc) {
1332 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1333 return -EINVAL;
1334 }
1335 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1336 if (rc) {
1337 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1338 return -EINVAL;
1339 }
1340 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1341 if (rc) {
1342 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1343 return -EINVAL;
1344 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001345 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1346 rc = gpio_request(gpio43, "disp_rst_n");
1347 if (rc) {
1348 pr_err("request gpio 43 failed, rc=%d\n", rc);
1349 return -ENODEV;
1350 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351 dsi_power_on = true;
1352 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001353 if (on) {
1354 rc = regulator_set_optimum_mode(reg_l8, 100000);
1355 if (rc < 0) {
1356 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1357 return -EINVAL;
1358 }
1359 rc = regulator_set_optimum_mode(reg_l23, 100000);
1360 if (rc < 0) {
1361 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1362 return -EINVAL;
1363 }
1364 rc = regulator_set_optimum_mode(reg_l2, 100000);
1365 if (rc < 0) {
1366 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1367 return -EINVAL;
1368 }
1369 rc = regulator_enable(reg_l8);
1370 if (rc) {
1371 pr_err("enable l8 failed, rc=%d\n", rc);
1372 return -ENODEV;
1373 }
1374 rc = regulator_enable(reg_l23);
1375 if (rc) {
1376 pr_err("enable l8 failed, rc=%d\n", rc);
1377 return -ENODEV;
1378 }
1379 rc = regulator_enable(reg_l2);
1380 if (rc) {
1381 pr_err("enable l2 failed, rc=%d\n", rc);
1382 return -ENODEV;
1383 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001384 gpio_set_value_cansleep(gpio43, 1);
1385 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001386 rc = regulator_disable(reg_l2);
1387 if (rc) {
1388 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1389 return -ENODEV;
1390 }
1391 rc = regulator_disable(reg_l8);
1392 if (rc) {
1393 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1394 return -ENODEV;
1395 }
1396 rc = regulator_disable(reg_l23);
1397 if (rc) {
1398 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1399 return -ENODEV;
1400 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401 rc = regulator_set_optimum_mode(reg_l8, 100);
1402 if (rc < 0) {
1403 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1404 return -EINVAL;
1405 }
1406 rc = regulator_set_optimum_mode(reg_l23, 100);
1407 if (rc < 0) {
1408 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1409 return -EINVAL;
1410 }
1411 rc = regulator_set_optimum_mode(reg_l2, 100);
1412 if (rc < 0) {
1413 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1414 return -EINVAL;
1415 }
1416 gpio_set_value_cansleep(gpio43, 0);
1417 }
1418 return 0;
1419}
1420
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001421static int mipi_dsi_panel_power(int on)
1422{
1423 int ret;
1424
1425 pr_info("%s: on=%d\n", __func__, on);
1426
1427 if (machine_is_msm8960_liquid())
1428 ret = mipi_dsi_liquid_panel_power(on);
1429 else
1430 ret = mipi_dsi_cdp_panel_power(on);
1431
1432 return ret;
1433}
1434
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001435static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1436 .vsync_gpio = MDP_VSYNC_GPIO,
1437 .dsi_power_save = mipi_dsi_panel_power,
1438};
1439
1440#ifdef CONFIG_MSM_BUS_SCALING
1441
1442static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443 {
1444 .src = MSM_BUS_MASTER_MDP_PORT0,
1445 .dst = MSM_BUS_SLAVE_EBI_CH0,
1446 .ab = 0,
1447 .ib = 0,
1448 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001449};
1450
1451static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452 {
1453 .src = MSM_BUS_MASTER_MDP_PORT0,
1454 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001455 .ab = 216000000 * 2,
1456 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457 },
1458};
1459
1460static struct msm_bus_vectors mdp_vga_vectors[] = {
1461 /* VGA and less video */
1462 {
1463 .src = MSM_BUS_MASTER_MDP_PORT0,
1464 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001465 .ab = 216000000 * 2,
1466 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467 },
1468};
1469
1470static struct msm_bus_vectors mdp_720p_vectors[] = {
1471 /* 720p and less video */
1472 {
1473 .src = MSM_BUS_MASTER_MDP_PORT0,
1474 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001475 .ab = 230400000 * 2,
1476 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477 },
1478};
1479
1480static struct msm_bus_vectors mdp_1080p_vectors[] = {
1481 /* 1080p and less video */
1482 {
1483 .src = MSM_BUS_MASTER_MDP_PORT0,
1484 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001485 .ab = 334080000 * 2,
1486 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001487 },
1488};
1489
1490static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1491 {
1492 ARRAY_SIZE(mdp_init_vectors),
1493 mdp_init_vectors,
1494 },
1495 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001496 ARRAY_SIZE(mdp_ui_vectors),
1497 mdp_ui_vectors,
1498 },
1499 {
1500 ARRAY_SIZE(mdp_ui_vectors),
1501 mdp_ui_vectors,
1502 },
1503 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001504 ARRAY_SIZE(mdp_vga_vectors),
1505 mdp_vga_vectors,
1506 },
1507 {
1508 ARRAY_SIZE(mdp_720p_vectors),
1509 mdp_720p_vectors,
1510 },
1511 {
1512 ARRAY_SIZE(mdp_1080p_vectors),
1513 mdp_1080p_vectors,
1514 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001515};
1516
1517static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1518 mdp_bus_scale_usecases,
1519 ARRAY_SIZE(mdp_bus_scale_usecases),
1520 .name = "mdp",
1521};
1522
1523#endif
1524
1525int mdp_core_clk_rate_table[] = {
1526 85330000,
1527 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001528 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001529 200000000,
1530};
1531
1532static struct msm_panel_common_pdata mdp_pdata = {
1533 .gpio = MDP_VSYNC_GPIO,
1534 .mdp_core_clk_rate = 85330000,
1535 .mdp_core_clk_table = mdp_core_clk_rate_table,
1536 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1537#ifdef CONFIG_MSM_BUS_SCALING
1538 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1539#endif
1540 .mdp_rev = MDP_REV_42,
1541};
1542
1543static struct platform_device mipi_dsi_renesas_panel_device = {
1544 .name = "mipi_renesas",
1545 .id = 0,
1546};
1547
1548static struct platform_device mipi_dsi_simulator_panel_device = {
1549 .name = "mipi_simulator",
1550 .id = 0,
1551};
1552
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001553#define LPM_CHANNEL0 0
1554static int toshiba_gpio[] = {LPM_CHANNEL0};
1555
1556static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1557 .gpio = toshiba_gpio,
1558};
1559
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001560static struct platform_device mipi_dsi_toshiba_panel_device = {
1561 .name = "mipi_toshiba",
1562 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001563 .dev = {
1564 .platform_data = &toshiba_pdata,
1565 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001566};
1567
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001568static int dsi2lvds_gpio[2] = {
1569 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1570 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1571 };
1572
1573static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1574 .gpio_num = dsi2lvds_gpio,
1575};
1576
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001577static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1578
1579/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1580 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1581 /* timing */
1582 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1583 0x0c, 0x03, 0x04, 0xa0},
1584 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1585 {0xff, 0x00, 0x06, 0x00}, /* strength */
1586 /* pll control */
1587 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1588 0x40, 0x07, 0x03,
1589 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1590};
1591
1592static struct mipi_dsi_panel_platform_data novatek_pdata = {
1593 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1594};
1595
1596static struct platform_device mipi_dsi_novatek_panel_device = {
1597 .name = "mipi_novatek",
1598 .id = 0,
1599 .dev = {
1600 .platform_data = &novatek_pdata,
1601 }
1602};
1603
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001604static struct platform_device mipi_dsi2lvds_bridge_device = {
1605 .name = "mipi_tc358764",
1606 .id = 0,
1607 .dev.platform_data = &mipi_dsi2lvds_pdata,
1608};
1609
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001610#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1611static struct resource hdmi_msm_resources[] = {
1612 {
1613 .name = "hdmi_msm_qfprom_addr",
1614 .start = 0x00700000,
1615 .end = 0x007060FF,
1616 .flags = IORESOURCE_MEM,
1617 },
1618 {
1619 .name = "hdmi_msm_hdmi_addr",
1620 .start = 0x04A00000,
1621 .end = 0x04A00FFF,
1622 .flags = IORESOURCE_MEM,
1623 },
1624 {
1625 .name = "hdmi_msm_irq",
1626 .start = HDMI_IRQ,
1627 .end = HDMI_IRQ,
1628 .flags = IORESOURCE_IRQ,
1629 },
1630};
1631
1632static int hdmi_enable_5v(int on);
1633static int hdmi_core_power(int on, int show);
1634static int hdmi_cec_power(int on);
1635
1636static struct msm_hdmi_platform_data hdmi_msm_data = {
1637 .irq = HDMI_IRQ,
1638 .enable_5v = hdmi_enable_5v,
1639 .core_power = hdmi_core_power,
1640 .cec_power = hdmi_cec_power,
1641};
1642
1643static struct platform_device hdmi_msm_device = {
1644 .name = "hdmi_msm",
1645 .id = 0,
1646 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1647 .resource = hdmi_msm_resources,
1648 .dev.platform_data = &hdmi_msm_data,
1649};
1650#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1651
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001652#ifdef CONFIG_MSM_BUS_SCALING
1653static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1654 {
1655 .src = MSM_BUS_MASTER_MDP_PORT0,
1656 .dst = MSM_BUS_SLAVE_EBI_CH0,
1657 .ab = 0,
1658 .ib = 0,
1659 },
1660};
1661static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1662 {
1663 .src = MSM_BUS_MASTER_MDP_PORT0,
1664 .dst = MSM_BUS_SLAVE_EBI_CH0,
1665 .ab = 566092800 * 2,
1666 .ib = 707616000 * 2,
1667 },
1668};
1669static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1670 {
1671 ARRAY_SIZE(dtv_bus_init_vectors),
1672 dtv_bus_init_vectors,
1673 },
1674 {
1675 ARRAY_SIZE(dtv_bus_def_vectors),
1676 dtv_bus_def_vectors,
1677 },
1678};
1679static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1680 dtv_bus_scale_usecases,
1681 ARRAY_SIZE(dtv_bus_scale_usecases),
1682 .name = "dtv",
1683};
1684
1685static struct lcdc_platform_data dtv_pdata = {
1686 .bus_scale_table = &dtv_bus_scale_pdata,
1687};
1688#endif
1689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690static void __init msm_fb_add_devices(void)
1691{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001692 struct platform_device *ptr = NULL;
1693
1694 if (machine_is_msm8960_liquid())
1695 ptr = &mipi_dsi2lvds_bridge_device;
1696 else
1697 ptr = &mipi_dsi_toshiba_panel_device;
1698 platform_add_devices(&ptr, 1);
1699
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 if (machine_is_msm8x60_rumi3()) {
1701 msm_fb_register_device("mdp", NULL);
1702 mipi_dsi_pdata.target_type = 1;
1703 } else
1704 msm_fb_register_device("mdp", &mdp_pdata);
1705 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001706#ifdef CONFIG_MSM_BUS_SCALING
1707 msm_fb_register_device("dtv", &dtv_pdata);
1708#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709}
1710
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001711static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1712 .func = GPIOMUX_FUNC_GPIO,
1713 .drv = GPIOMUX_DRV_2MA,
1714 .pull = GPIOMUX_PULL_DOWN,
1715};
1716
1717static struct gpiomux_setting mdp_vsync_active_cfg = {
1718 .func = GPIOMUX_FUNC_1,
1719 .drv = GPIOMUX_DRV_2MA,
1720 .pull = GPIOMUX_PULL_DOWN,
1721};
1722
1723static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1724 {
1725 .gpio = MDP_VSYNC_GPIO,
1726 .settings = {
1727 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1728 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1729 },
1730 }
1731};
1732
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1734static struct gpiomux_setting hdmi_suspend_cfg = {
1735 .func = GPIOMUX_FUNC_GPIO,
1736 .drv = GPIOMUX_DRV_2MA,
1737 .pull = GPIOMUX_PULL_DOWN,
1738};
1739
1740static struct gpiomux_setting hdmi_active_1_cfg = {
1741 .func = GPIOMUX_FUNC_1,
1742 .drv = GPIOMUX_DRV_2MA,
1743 .pull = GPIOMUX_PULL_UP,
1744};
1745
1746static struct gpiomux_setting hdmi_active_2_cfg = {
1747 .func = GPIOMUX_FUNC_1,
1748 .drv = GPIOMUX_DRV_2MA,
1749 .pull = GPIOMUX_PULL_DOWN,
1750};
1751
1752static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1753 {
1754 .gpio = 99,
1755 .settings = {
1756 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1757 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1758 },
1759 },
1760 {
1761 .gpio = 100,
1762 .settings = {
1763 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1764 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1765 },
1766 },
1767 {
1768 .gpio = 101,
1769 .settings = {
1770 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1771 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1772 },
1773 },
1774 {
1775 .gpio = 102,
1776 .settings = {
1777 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1778 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1779 },
1780 },
1781};
1782
1783static int hdmi_enable_5v(int on)
1784{
1785 /* TBD: PM8921 regulator instead of 8901 */
1786 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1787 static int prev_on;
1788 int rc;
1789
1790 if (on == prev_on)
1791 return 0;
1792
1793 if (!reg_8921_hdmi_mvs)
1794 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1795 "hdmi_mvs");
1796
1797 if (on) {
1798 rc = regulator_enable(reg_8921_hdmi_mvs);
1799 if (rc) {
1800 pr_err("'%s' regulator enable failed, rc=%d\n",
1801 "8921_hdmi_mvs", rc);
1802 return rc;
1803 }
1804 pr_debug("%s(on): success\n", __func__);
1805 } else {
1806 rc = regulator_disable(reg_8921_hdmi_mvs);
1807 if (rc)
1808 pr_warning("'%s' regulator disable failed, rc=%d\n",
1809 "8921_hdmi_mvs", rc);
1810 pr_debug("%s(off): success\n", __func__);
1811 }
1812
1813 prev_on = on;
1814
1815 return 0;
1816}
1817
1818static int hdmi_core_power(int on, int show)
1819{
1820 static struct regulator *reg_8921_l23, *reg_8921_s4;
1821 static int prev_on;
1822 int rc;
1823
1824 if (on == prev_on)
1825 return 0;
1826
1827 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001828 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001829 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001830 if (IS_ERR(reg_8921_l23)) {
1831 pr_err("could not get reg_8921_l23, rc = %ld\n",
1832 PTR_ERR(reg_8921_l23));
1833 return -ENODEV;
1834 }
1835 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1836 if (rc) {
1837 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1838 return -EINVAL;
1839 }
1840 }
1841 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001842 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001843 if (IS_ERR(reg_8921_s4)) {
1844 pr_err("could not get reg_8921_s4, rc = %ld\n",
1845 PTR_ERR(reg_8921_s4));
1846 return -ENODEV;
1847 }
1848 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1849 if (rc) {
1850 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1851 return -EINVAL;
1852 }
1853 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001854
1855 if (on) {
1856 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1857 if (rc < 0) {
1858 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1859 return -EINVAL;
1860 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001861 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001862 if (rc) {
1863 pr_err("'%s' regulator enable failed, rc=%d\n",
1864 "hdmi_avdd", rc);
1865 return rc;
1866 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001867 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001868 if (rc) {
1869 pr_err("'%s' regulator enable failed, rc=%d\n",
1870 "hdmi_vcc", rc);
1871 return rc;
1872 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873 rc = gpio_request(100, "HDMI_DDC_CLK");
1874 if (rc) {
1875 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1876 "HDMI_DDC_CLK", 100, rc);
1877 goto error1;
1878 }
1879 rc = gpio_request(101, "HDMI_DDC_DATA");
1880 if (rc) {
1881 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1882 "HDMI_DDC_DATA", 101, rc);
1883 goto error2;
1884 }
1885 rc = gpio_request(102, "HDMI_HPD");
1886 if (rc) {
1887 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1888 "HDMI_HPD", 102, rc);
1889 goto error3;
1890 }
1891 pr_debug("%s(on): success\n", __func__);
1892 } else {
1893 gpio_free(100);
1894 gpio_free(101);
1895 gpio_free(102);
1896
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001897 rc = regulator_disable(reg_8921_l23);
1898 if (rc) {
1899 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1900 return -ENODEV;
1901 }
1902 rc = regulator_disable(reg_8921_s4);
1903 if (rc) {
1904 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1905 return -ENODEV;
1906 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1908 if (rc < 0) {
1909 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1910 return -EINVAL;
1911 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912 pr_debug("%s(off): success\n", __func__);
1913 }
1914
1915 prev_on = on;
1916
1917 return 0;
1918
1919error3:
1920 gpio_free(101);
1921error2:
1922 gpio_free(100);
1923error1:
1924 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001925 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001926 return rc;
1927}
1928
1929static int hdmi_cec_power(int on)
1930{
1931 static int prev_on;
1932 int rc;
1933
1934 if (on == prev_on)
1935 return 0;
1936
1937 if (on) {
1938 rc = gpio_request(99, "HDMI_CEC_VAR");
1939 if (rc) {
1940 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1941 "HDMI_CEC_VAR", 99, rc);
1942 goto error;
1943 }
1944 pr_debug("%s(on): success\n", __func__);
1945 } else {
1946 gpio_free(99);
1947 pr_debug("%s(off): success\n", __func__);
1948 }
1949
1950 prev_on = on;
1951
1952 return 0;
1953error:
1954 return rc;
1955}
1956#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1957
1958static void __init msm8960_allocate_memory_regions(void)
1959{
1960 void *addr;
1961 unsigned long size;
1962
1963 size = MSM_FB_SIZE;
1964 addr = alloc_bootmem_align(size, 0x1000);
1965 msm_fb_resources[0].start = __pa(addr);
1966 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1967 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1968 size, addr, __pa(addr));
1969
1970}
1971#ifdef CONFIG_WCD9310_CODEC
1972
1973#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1974
Patrick Lai3043fba2011-08-01 14:15:57 -07001975/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1976 * 4 micbiases are used to power various analog and digital
1977 * microphones operating at 1800 mV. Technically, all micbiases
1978 * can source from single cfilter since all microphones operate
1979 * at the same voltage level. The arrangement below is to make
1980 * sure all cfilters are exercised. LDO_H regulator ouput level
1981 * does not need to be as high as 2.85V. It is choosen for
1982 * microphone sensitivity purpose.
1983 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001984static struct tabla_pdata tabla_platform_data = {
1985 .slimbus_slave_device = {
1986 .name = "tabla-slave",
1987 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1988 },
1989 .irq = MSM_GPIO_TO_INT(62),
1990 .irq_base = TABLA_INTERRUPT_BASE,
1991 .num_irqs = NR_TABLA_IRQS,
1992 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07001993 .micbias = {
1994 .ldoh_v = TABLA_LDOH_2P85_V,
1995 .cfilt1_mv = 1800,
1996 .cfilt2_mv = 1800,
1997 .cfilt3_mv = 1800,
1998 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1999 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2000 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2001 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2002 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002003};
2004
2005static struct slim_device msm_slim_tabla = {
2006 .name = "tabla-slim",
2007 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2008 .dev = {
2009 .platform_data = &tabla_platform_data,
2010 },
2011};
2012#endif
2013
2014static struct slim_boardinfo msm_slim_devices[] = {
2015#ifdef CONFIG_WCD9310_CODEC
2016 {
2017 .bus_num = 1,
2018 .slim_slave = &msm_slim_tabla,
2019 },
2020#endif
2021 /* add more slimbus slaves as needed */
2022};
2023
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002024#define MSM_WCNSS_PHYS 0x03000000
2025#define MSM_WCNSS_SIZE 0x280000
2026
2027static struct resource resources_wcnss_wlan[] = {
2028 {
2029 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2030 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2031 .name = "wcnss_wlanrx_irq",
2032 .flags = IORESOURCE_IRQ,
2033 },
2034 {
2035 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2036 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2037 .name = "wcnss_wlantx_irq",
2038 .flags = IORESOURCE_IRQ,
2039 },
2040 {
2041 .start = MSM_WCNSS_PHYS,
2042 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2043 .name = "wcnss_mmio",
2044 .flags = IORESOURCE_MEM,
2045 },
2046};
2047
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002048static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2049 .has_48mhz_xo = 1,
2050};
2051
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002052static struct platform_device msm_device_wcnss_wlan = {
2053 .name = "wcnss_wlan",
2054 .id = 0,
2055 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2056 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002057 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002058};
2059
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002060#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2061 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2062 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2063 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2064
2065#define QCE_SIZE 0x10000
2066#define QCE_0_BASE 0x18500000
2067
2068#define QCE_HW_KEY_SUPPORT 0
2069#define QCE_SHA_HMAC_SUPPORT 1
2070#define QCE_SHARE_CE_RESOURCE 1
2071#define QCE_CE_SHARED 0
2072
2073static struct resource qcrypto_resources[] = {
2074 [0] = {
2075 .start = QCE_0_BASE,
2076 .end = QCE_0_BASE + QCE_SIZE - 1,
2077 .flags = IORESOURCE_MEM,
2078 },
2079 [1] = {
2080 .name = "crypto_channels",
2081 .start = DMOV_CE_IN_CHAN,
2082 .end = DMOV_CE_OUT_CHAN,
2083 .flags = IORESOURCE_DMA,
2084 },
2085 [2] = {
2086 .name = "crypto_crci_in",
2087 .start = DMOV_CE_IN_CRCI,
2088 .end = DMOV_CE_IN_CRCI,
2089 .flags = IORESOURCE_DMA,
2090 },
2091 [3] = {
2092 .name = "crypto_crci_out",
2093 .start = DMOV_CE_OUT_CRCI,
2094 .end = DMOV_CE_OUT_CRCI,
2095 .flags = IORESOURCE_DMA,
2096 },
2097};
2098
2099static struct resource qcedev_resources[] = {
2100 [0] = {
2101 .start = QCE_0_BASE,
2102 .end = QCE_0_BASE + QCE_SIZE - 1,
2103 .flags = IORESOURCE_MEM,
2104 },
2105 [1] = {
2106 .name = "crypto_channels",
2107 .start = DMOV_CE_IN_CHAN,
2108 .end = DMOV_CE_OUT_CHAN,
2109 .flags = IORESOURCE_DMA,
2110 },
2111 [2] = {
2112 .name = "crypto_crci_in",
2113 .start = DMOV_CE_IN_CRCI,
2114 .end = DMOV_CE_IN_CRCI,
2115 .flags = IORESOURCE_DMA,
2116 },
2117 [3] = {
2118 .name = "crypto_crci_out",
2119 .start = DMOV_CE_OUT_CRCI,
2120 .end = DMOV_CE_OUT_CRCI,
2121 .flags = IORESOURCE_DMA,
2122 },
2123};
2124
2125#endif
2126
2127#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2128 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2129
2130static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2131 .ce_shared = QCE_CE_SHARED,
2132 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2133 .hw_key_support = QCE_HW_KEY_SUPPORT,
2134 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2135};
2136
2137static struct platform_device qcrypto_device = {
2138 .name = "qcrypto",
2139 .id = 0,
2140 .num_resources = ARRAY_SIZE(qcrypto_resources),
2141 .resource = qcrypto_resources,
2142 .dev = {
2143 .coherent_dma_mask = DMA_BIT_MASK(32),
2144 .platform_data = &qcrypto_ce_hw_suppport,
2145 },
2146};
2147#endif
2148
2149#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2150 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2151
2152static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2153 .ce_shared = QCE_CE_SHARED,
2154 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2155 .hw_key_support = QCE_HW_KEY_SUPPORT,
2156 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2157};
2158
2159static struct platform_device qcedev_device = {
2160 .name = "qce",
2161 .id = 0,
2162 .num_resources = ARRAY_SIZE(qcedev_resources),
2163 .resource = qcedev_resources,
2164 .dev = {
2165 .coherent_dma_mask = DMA_BIT_MASK(32),
2166 .platform_data = &qcedev_ce_hw_suppport,
2167 },
2168};
2169#endif
2170
2171
2172static int __init gpiomux_init(void)
2173{
2174 int rc;
2175
2176 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2177 if (rc) {
2178 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2179 return rc;
2180 }
2181
Nishant Pandit24153d82011-08-27 16:05:13 +05302182 msm_gpiomux_install(msm8960_cam_common_configs,
2183 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002184
2185 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002186 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187
2188 msm_gpiomux_install(msm8960_gsbi_configs,
2189 ARRAY_SIZE(msm8960_gsbi_configs));
2190
2191 msm_gpiomux_install(msm8960_cyts_configs,
2192 ARRAY_SIZE(msm8960_cyts_configs));
2193
2194 msm_gpiomux_install(msm8960_slimbus_config,
2195 ARRAY_SIZE(msm8960_slimbus_config));
2196
2197 msm_gpiomux_install(msm8960_audio_codec_configs,
2198 ARRAY_SIZE(msm8960_audio_codec_configs));
2199
2200#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2201 msm_gpiomux_install(msm8960_hdmi_configs,
2202 ARRAY_SIZE(msm8960_hdmi_configs));
2203#endif
2204
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002205 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2206 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2207
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002208 msm_gpiomux_install(wcnss_5wire_interface,
2209 ARRAY_SIZE(wcnss_5wire_interface));
2210
2211 return 0;
2212}
2213
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002214#define MSM_SHARED_RAM_PHYS 0x80000000
2215
2216static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2217 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2218 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2219 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2220 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2221 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2222 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2223 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2224 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2225 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2226 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2227 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2228 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2229 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
2230 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2231 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
2232 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2233 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2234 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2235 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2236 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2237 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2238 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2239 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2240 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2241 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2242 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2243 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2244 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2245 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2246 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002247 {"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
2248 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2249 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2250 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002251};
2252
2253static struct pm8921_adc_properties pm8921_adc_data = {
2254 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2255 .bitresolution = 15,
2256 .bipolar = 0,
2257};
2258
2259static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2260 .adc_channel = pm8921_adc_channels_data,
2261 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
2262 .adc_prop = &pm8921_adc_data,
2263};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002264
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002265static void __init msm8960_map_io(void)
2266{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002268 msm_map_msm8960_io();
2269}
2270
2271static void __init msm8960_init_irq(void)
2272{
2273 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274
2275 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002276 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002278
2279 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002280 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002281
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2283 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002284
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002285 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2286 * as they are configured as level, which does not play nice with
2287 * handle_percpu_irq.
2288 */
2289 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2290 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002291 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002292 }
2293}
2294
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295/* MSM8960 have 5 SDCC controllers */
2296enum sdcc_controllers {
2297 SDCC1,
2298 SDCC2,
2299 SDCC3,
2300 SDCC4,
2301 SDCC5,
2302 MAX_SDCC_CONTROLLER
2303};
2304
2305/* All SDCC controllers requires VDD/VCC voltage */
2306static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2307 /* SDCC1 : eMMC card connected */
2308 [SDCC1] = {
2309 .name = "sdc_vdd",
2310 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302311 .high_vol_level = 2950000,
2312 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302313 .always_on = 1,
2314 .lpm_sup = 1,
2315 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002316 .hpm_uA = 200000, /* 200mA */
2317 },
2318 /* SDCC3 : External card slot connected */
2319 [SDCC3] = {
2320 .name = "sdc_vdd",
2321 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302322 .high_vol_level = 2950000,
2323 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002324 .hpm_uA = 600000, /* 600mA */
2325 }
2326};
2327
2328/* Only slots having eMMC card will require VCCQ voltage */
2329static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2330 /* SDCC1 : eMMC card connected */
2331 [SDCC1] = {
2332 .name = "sdc_vccq",
2333 .set_voltage_sup = 1,
2334 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302335 .high_vol_level = 1800000,
2336 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002337 .hpm_uA = 200000, /* 200mA */
2338 }
2339};
2340
2341/* All SDCC controllers may require voting for VDD PAD voltage */
2342static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2343 /* SDCC3 : External card slot connected */
2344 [SDCC3] = {
2345 .name = "sdc_vddp",
2346 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302347 .high_vol_level = 2950000,
2348 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002349 .always_on = 1,
2350 .lpm_sup = 1,
2351 /* Max. Active current required is 16 mA */
2352 .hpm_uA = 16000,
2353 /*
2354 * Sleep current required is ~300 uA. But min. vote can be
2355 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2356 * during sleep.
2357 */
2358 .lpm_uA = 2000,
2359 }
2360};
2361
2362static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2363 /* SDCC1 : eMMC card connected */
2364 [SDCC1] = {
2365 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2366 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2367 },
2368 /* SDCC3 : External card slot connected */
2369 [SDCC3] = {
2370 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2371 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2372 }
2373};
2374
2375/* SDC1 pad data */
2376static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2377 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302378 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2379 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002380};
2381
2382static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2383 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2384 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2385 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2386};
2387
2388static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302389 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002390 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2391 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2392};
2393
2394static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302395 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002396 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2397 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2398};
2399
2400/* SDC3 pad data */
2401static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2402 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2403 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2404 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2405};
2406
2407static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2408 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2409 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2410 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2411};
2412
2413static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302414 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002415 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2416 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2417};
2418
2419static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302420 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002421 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2422 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2423};
2424
2425struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2426 [SDCC1] = {
2427 .on = sdc1_pad_pull_on_cfg,
2428 .off = sdc1_pad_pull_off_cfg,
2429 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2430 },
2431 [SDCC3] = {
2432 .on = sdc3_pad_pull_on_cfg,
2433 .off = sdc3_pad_pull_off_cfg,
2434 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2435 },
2436};
2437
2438struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2439 [SDCC1] = {
2440 .on = sdc1_pad_drv_on_cfg,
2441 .off = sdc1_pad_drv_off_cfg,
2442 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2443 },
2444 [SDCC3] = {
2445 .on = sdc3_pad_drv_on_cfg,
2446 .off = sdc3_pad_drv_off_cfg,
2447 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2448 },
2449};
2450
2451struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2452 [SDCC1] = {
2453 .pull = &mmc_pad_pull_data[SDCC1],
2454 .drv = &mmc_pad_drv_data[SDCC1]
2455 },
2456 [SDCC3] = {
2457 .pull = &mmc_pad_pull_data[SDCC3],
2458 .drv = &mmc_pad_drv_data[SDCC3]
2459 },
2460};
2461
2462struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2463 [SDCC1] = {
2464 .pad_data = &mmc_pad_data[SDCC1],
2465 },
2466 [SDCC3] = {
2467 .pad_data = &mmc_pad_data[SDCC3],
2468 },
2469};
2470
2471static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302472 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473};
2474
2475static unsigned int sdc3_sup_clk_rates[] = {
2476 400000, 24000000, 48000000, 96000000
2477};
2478
2479#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2480static struct mmc_platform_data msm8960_sdc1_data = {
2481 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2482#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2483 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2484#else
2485 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2486#endif
2487 .sup_clk_table = sdc1_sup_clk_rates,
2488 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2489 .nonremovable = 1,
2490 .sdcc_v4_sup = true,
2491 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302492 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002493};
2494#endif
2495
2496#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2497static struct mmc_platform_data msm8960_sdc3_data = {
2498 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2499 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2500 .sup_clk_table = sdc3_sup_clk_rates,
2501 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302502#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002503 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302504#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002505 .sdcc_v4_sup = true,
2506 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2507 .pin_data = &mmc_slot_pin_data[SDCC3],
2508#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2509 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2510 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2511 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2512#endif
2513 .xpc_cap = 1,
2514 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2515 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302516 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002517};
2518#endif
2519
2520static void __init msm8960_init_mmc(void)
2521{
2522#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2523 /* SDC1 : eMMC card connected */
2524 msm_add_sdcc(1, &msm8960_sdc1_data);
2525#endif
2526#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2527 /* SDC3: External card slot */
2528 msm_add_sdcc(3, &msm8960_sdc3_data);
2529#endif
2530}
2531
2532static void __init msm8960_init_buses(void)
2533{
2534#ifdef CONFIG_MSM_BUS_SCALING
2535 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2536 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2537 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2538 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2539 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2540 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2541 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2542 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2543 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2544 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2545#endif
2546}
2547
2548static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2549 .max_clock_speed = 15060000,
2550};
2551
2552#ifdef CONFIG_USB_MSM_OTG_72K
2553static struct msm_otg_platform_data msm_otg_pdata;
2554#else
2555#define USB_5V_EN 42
2556static void msm_hsusb_vbus_power(bool on)
2557{
2558 int rc;
2559 static bool vbus_is_on;
2560 static struct regulator *mvs_otg_switch;
2561 struct pm_gpio param = {
2562 .direction = PM_GPIO_DIR_OUT,
2563 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2564 .output_value = 1,
2565 .pull = PM_GPIO_PULL_NO,
2566 .vin_sel = PM_GPIO_VIN_S4,
2567 .out_strength = PM_GPIO_STRENGTH_MED,
2568 .function = PM_GPIO_FUNC_NORMAL,
2569 };
2570
2571 if (vbus_is_on == on)
2572 return;
2573
2574 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002575 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2576 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577 if (IS_ERR(mvs_otg_switch)) {
2578 pr_err("Unable to get mvs_otg_switch\n");
2579 return;
2580 }
2581
2582 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2583 "usb_5v_en");
2584 if (rc < 0) {
2585 pr_err("failed to request usb_5v_en gpio\n");
2586 goto put_mvs_otg;
2587 }
2588
2589 if (regulator_enable(mvs_otg_switch)) {
2590 pr_err("unable to enable mvs_otg_switch\n");
2591 goto free_usb_5v_en;
2592 }
2593
2594 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2595 &param);
2596 if (rc < 0) {
2597 pr_err("failed to configure usb_5v_en gpio\n");
2598 goto disable_mvs_otg;
2599 }
2600 vbus_is_on = true;
2601 return;
2602 }
2603disable_mvs_otg:
2604 regulator_disable(mvs_otg_switch);
2605free_usb_5v_en:
2606 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2607put_mvs_otg:
2608 regulator_put(mvs_otg_switch);
2609 vbus_is_on = false;
2610}
2611
2612static struct msm_otg_platform_data msm_otg_pdata = {
2613 .mode = USB_OTG,
2614 .otg_control = OTG_PMIC_CONTROL,
2615 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2616 .pclk_src_name = "dfab_usb_hs_clk",
2617 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2618 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302619 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002620};
2621#endif
2622
2623#define PID_MAGIC_ID 0x71432909
2624#define SERIAL_NUM_MAGIC_ID 0x61945374
2625#define SERIAL_NUMBER_LENGTH 127
2626#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2627
2628struct magic_num_struct {
2629 uint32_t pid;
2630 uint32_t serial_num;
2631};
2632
2633struct dload_struct {
2634 uint32_t reserved1;
2635 uint32_t reserved2;
2636 uint32_t reserved3;
2637 uint16_t reserved4;
2638 uint16_t pid;
2639 char serial_number[SERIAL_NUMBER_LENGTH];
2640 uint16_t reserved5;
2641 struct magic_num_struct magic_struct;
2642};
2643
2644static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2645{
2646 struct dload_struct __iomem *dload = 0;
2647
2648 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2649 if (!dload) {
2650 pr_err("%s: cannot remap I/O memory region: %08x\n",
2651 __func__, DLOAD_USB_BASE_ADD);
2652 return -ENXIO;
2653 }
2654
2655 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2656 __func__, dload, pid, snum);
2657 /* update pid */
2658 dload->magic_struct.pid = PID_MAGIC_ID;
2659 dload->pid = pid;
2660
2661 /* update serial number */
2662 dload->magic_struct.serial_num = 0;
2663 if (!snum) {
2664 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2665 goto out;
2666 }
2667
2668 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2669 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2670 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2671out:
2672 iounmap(dload);
2673 return 0;
2674}
2675
2676static struct android_usb_platform_data android_usb_pdata = {
2677 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2678};
2679
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002680static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002681 .name = "android_usb",
2682 .id = -1,
2683 .dev = {
2684 .platform_data = &android_usb_pdata,
2685 },
2686};
2687
2688static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2689 0x03, 0x0f,
2690};
2691
2692static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2693 0x00, 0x24, 0x54, 0x10,
2694 0x09, 0x03, 0x01,
2695 0x10, 0x54, 0x30, 0x0C,
2696 0x24, 0x30, 0x0f,
2697};
2698
2699static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2700 0x00, 0x24, 0x54, 0x10,
2701 0x09, 0x07, 0x01, 0x0B,
2702 0x10, 0x54, 0x30, 0x0C,
2703 0x24, 0x30, 0x0f,
2704};
2705
2706static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2707 [0] = {
2708 .mode = MSM_SPM_MODE_CLOCK_GATING,
2709 .notify_rpm = false,
2710 .cmd = spm_wfi_cmd_sequence,
2711 },
2712 [1] = {
2713 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2714 .notify_rpm = false,
2715 .cmd = spm_power_collapse_without_rpm,
2716 },
2717 [2] = {
2718 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2719 .notify_rpm = true,
2720 .cmd = spm_power_collapse_with_rpm,
2721 },
2722};
2723
2724static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2725 [0] = {
2726 .reg_base_addr = MSM_SAW0_BASE,
2727 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2728 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2729 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2730#if defined(CONFIG_MSM_AVS_HW)
2731 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2732 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2733#endif
2734 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2735 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2736 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2737 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2738 .vctl_timeout_us = 50,
2739 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2740 .modes = msm_spm_seq_list,
2741 },
2742 [1] = {
2743 .reg_base_addr = MSM_SAW1_BASE,
2744 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2745 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2746 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2747#if defined(CONFIG_MSM_AVS_HW)
2748 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2749 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2750#endif
2751 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2752 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2753 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2754 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2755 .vctl_timeout_us = 50,
2756 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2757 .modes = msm_spm_seq_list,
2758 },
2759};
2760
2761static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2762 0x00, 0x20, 0x03, 0x20,
2763 0x00, 0x0f,
2764};
2765
2766static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2767 0x00, 0x20, 0x34, 0x64,
2768 0x48, 0x07, 0x48, 0x20,
2769 0x50, 0x64, 0x04, 0x34,
2770 0x50, 0x0f,
2771};
2772static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2773 0x00, 0x10, 0x34, 0x64,
2774 0x48, 0x07, 0x48, 0x10,
2775 0x50, 0x64, 0x04, 0x34,
2776 0x50, 0x0F,
2777};
2778
2779static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2780 [0] = {
2781 .mode = MSM_SPM_L2_MODE_RETENTION,
2782 .notify_rpm = false,
2783 .cmd = l2_spm_wfi_cmd_sequence,
2784 },
2785 [1] = {
2786 .mode = MSM_SPM_L2_MODE_GDHS,
2787 .notify_rpm = true,
2788 .cmd = l2_spm_gdhs_cmd_sequence,
2789 },
2790 [2] = {
2791 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2792 .notify_rpm = true,
2793 .cmd = l2_spm_power_off_cmd_sequence,
2794 },
2795};
2796
2797
2798static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2799 [0] = {
2800 .reg_base_addr = MSM_SAW_L2_BASE,
2801 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2802 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2803 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2804 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2805 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2806 .modes = msm_spm_l2_seq_list,
2807 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2808 },
2809};
2810
2811#define CYTTSP_TS_GPIO_IRQ 11
2812#define CYTTSP_TS_SLEEP_GPIO 50
2813#define CYTTSP_TS_RESOUT_N_GPIO 52
2814
2815/*virtual key support */
2816static ssize_t tma340_vkeys_show(struct kobject *kobj,
2817 struct kobj_attribute *attr, char *buf)
2818{
2819 return snprintf(buf, 200,
2820 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2821 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2822 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2823 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2824 "\n");
2825}
2826
2827static struct kobj_attribute tma340_vkeys_attr = {
2828 .attr = {
2829 .mode = S_IRUGO,
2830 },
2831 .show = &tma340_vkeys_show,
2832};
2833
2834static struct attribute *tma340_properties_attrs[] = {
2835 &tma340_vkeys_attr.attr,
2836 NULL
2837};
2838
2839static struct attribute_group tma340_properties_attr_group = {
2840 .attrs = tma340_properties_attrs,
2841};
2842
2843
2844static int cyttsp_platform_init(struct i2c_client *client)
2845{
2846 int rc = 0;
2847 static struct kobject *tma340_properties_kobj;
2848
2849 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2850 tma340_properties_kobj = kobject_create_and_add("board_properties",
2851 NULL);
2852 if (tma340_properties_kobj)
2853 rc = sysfs_create_group(tma340_properties_kobj,
2854 &tma340_properties_attr_group);
2855 if (!tma340_properties_kobj || rc)
2856 pr_err("%s: failed to create board_properties\n",
2857 __func__);
2858
2859 return 0;
2860}
2861
2862static struct cyttsp_regulator regulator_data[] = {
2863 {
2864 .name = "vdd",
2865 .min_uV = CY_TMA300_VTG_MIN_UV,
2866 .max_uV = CY_TMA300_VTG_MAX_UV,
2867 .load_uA = CY_TMA300_CURR_24HZ_UA,
2868 },
2869 /* TODO: Remove after runtime PM is enabled in I2C driver */
2870 {
2871 .name = "vcc_i2c",
2872 .min_uV = CY_I2C_VTG_MIN_UV,
2873 .max_uV = CY_I2C_VTG_MAX_UV,
2874 .load_uA = CY_I2C_CURR_UA,
2875 },
2876};
2877
2878static struct cyttsp_platform_data cyttsp_pdata = {
2879 .panel_maxx = 634,
2880 .panel_maxy = 1166,
2881 .disp_maxx = 616,
2882 .disp_maxy = 1023,
2883 .disp_minx = 0,
2884 .disp_miny = 16,
2885 .flags = 0x01,
2886 .gen = CY_GEN3, /* or */
2887 .use_st = CY_USE_ST,
2888 .use_mt = CY_USE_MT,
2889 .use_hndshk = CY_SEND_HNDSHK,
2890 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302891 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002892 .use_gestures = CY_USE_GESTURES,
2893 .fw_fname = "cyttsp_8960_cdp.hex",
2894 /* activate up to 4 groups
2895 * and set active distance
2896 */
2897 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2898 CY_GEST_GRP3 | CY_GEST_GRP4 |
2899 CY_ACT_DIST,
2900 /* change act_intrvl to customize the Active power state
2901 * scanning/processing refresh interval for Operating mode
2902 */
2903 .act_intrvl = CY_ACT_INTRVL_DFLT,
2904 /* change tch_tmout to customize the touch timeout for the
2905 * Active power state for Operating mode
2906 */
2907 .tch_tmout = CY_TCH_TMOUT_DFLT,
2908 /* change lp_intrvl to customize the Low Power power state
2909 * scanning/processing refresh interval for Operating mode
2910 */
2911 .lp_intrvl = CY_LP_INTRVL_DFLT,
2912 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2913 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2914 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2915 .regulator_info = regulator_data,
2916 .num_regulators = ARRAY_SIZE(regulator_data),
2917 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302918 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002919};
2920
2921static struct i2c_board_info cyttsp_info[] __initdata = {
2922 {
2923 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2924 .platform_data = &cyttsp_pdata,
2925#ifndef CY_USE_TIMER
2926 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2927#endif /* CY_USE_TIMER */
2928 },
2929};
2930
Mohan Pallaka50837382011-09-07 11:00:57 +05302931/* configuration data */
2932static const u8 mxt_config_data[] = {
2933 /* T6 Object */
2934 0, 0, 0, 0, 0, 0,
2935 /* T38 Object */
2936 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
2937 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2938 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2939 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2940 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2941 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2942 0, 0, 0, 0,
2943 /* T7 Object */
2944 10, 10, 50,
2945 /* T8 Object */
2946 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2947 /* T9 Object */
2948 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
2949 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
2950 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
2951 0, 5, 45, 46,
2952 /* T15 Object */
2953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2954 0,
2955 /* T22 Object */
2956 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2957 0, 0, 255, 255, 255, 255, 0,
2958 /* T24 Object */
2959 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2960 0, 0, 0, 0, 0, 0, 0, 0, 0,
2961 /* T25 Object */
2962 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2963 0, 0, 0, 0,
2964 /* T27 Object */
2965 0, 0, 0, 0, 0, 0, 0,
2966 /* T28 Object */
2967 0, 0, 0, 8, 8, 8,
2968 /* T40 Object */
2969 0, 0, 0, 0, 0,
2970 /* T41 Object */
2971 0, 0, 0, 0, 0, 0,
2972 /* T43 Object */
2973 0, 0, 0, 0, 0, 0,
2974};
2975
2976#define MXT_TS_GPIO_IRQ 11
2977#define MXT_TS_LDO_EN_GPIO 50
2978#define MXT_TS_RESET_GPIO 52
2979
2980static void mxt_init_hw_liquid(void)
2981{
2982 int rc;
2983
2984 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
2985 if (rc) {
2986 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
2987 __func__, MXT_TS_GPIO_IRQ);
2988 return;
2989 }
2990
2991 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
2992 if (rc) {
2993 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
2994 __func__, MXT_TS_GPIO_IRQ);
2995 goto err_irq_gpio_req;
2996 }
2997
2998 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2999 if (rc) {
3000 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3001 __func__, MXT_TS_LDO_EN_GPIO);
3002 goto err_irq_gpio_req;
3003 }
3004
3005 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3006 if (rc) {
3007 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3008 __func__, MXT_TS_LDO_EN_GPIO);
3009 goto err_ldo_gpio_req;
3010 }
3011
3012 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3013 if (rc) {
3014 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3015 __func__, MXT_TS_RESET_GPIO);
3016 goto err_ldo_gpio_set_dir;
3017 }
3018
3019 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3020 if (rc) {
3021 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3022 __func__, MXT_TS_RESET_GPIO);
3023 goto err_reset_gpio_req;
3024 }
3025
3026 return;
3027
3028err_reset_gpio_req:
3029 gpio_free(MXT_TS_RESET_GPIO);
3030err_ldo_gpio_set_dir:
3031 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3032err_ldo_gpio_req:
3033 gpio_free(MXT_TS_LDO_EN_GPIO);
3034err_irq_gpio_req:
3035 gpio_free(MXT_TS_GPIO_IRQ);
3036}
3037
3038static struct mxt_platform_data mxt_platform_data = {
3039 .config = mxt_config_data,
3040 .config_length = ARRAY_SIZE(mxt_config_data),
3041 .x_line = 26,
3042 .y_line = 42,
3043 .x_size = 767,
3044 .y_size = 1365,
3045 .blen = 32,
3046 .threshold = 40,
3047 .voltage = 3300000, /* 3.3V */
3048 .orient = MXT_ROTATED_90,
3049 .irqflags = IRQF_TRIGGER_FALLING,
3050};
3051
3052static struct i2c_board_info mxt_device_info[] __initdata = {
3053 {
3054 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3055 .platform_data = &mxt_platform_data,
3056 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3057 },
3058};
3059
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003060static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3061{
3062}
3063
3064static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3065 .clk_freq = 100000,
3066 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003067 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3068};
3069
3070static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3071 .clk_freq = 100000,
3072 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003073 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3074};
3075
3076static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3077 .clk_freq = 100000,
3078 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003079 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3080};
3081
3082static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3083 .clk_freq = 100000,
3084 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003085 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3086};
3087
3088static struct msm_rpm_platform_data msm_rpm_data = {
3089 .reg_base_addrs = {
3090 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3091 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3092 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3093 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3094 },
3095
3096 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3097 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3098 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3099 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3100 .msm_apps_ipc_rpm_val = 4,
3101};
3102
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003103static struct platform_device msm_rpm_device = {
3104 .name = "msm_rpm",
3105 .id = -1,
3106};
3107
3108
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003109static struct spi_board_info spi_board_info[] __initdata = {
3110 {
3111 .modalias = "ks8851",
3112 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3113 .max_speed_hz = 19200000,
3114 .bus_num = 0,
3115 .chip_select = 0,
3116 .mode = SPI_MODE_0,
3117 },
3118};
3119
3120static struct platform_device msm_device_saw_core0 = {
3121 .name = "saw-regulator",
3122 .id = 0,
3123 .dev = {
3124 .platform_data = &msm_saw_regulator_pdata_s5,
3125 },
3126};
3127
3128static struct platform_device msm_device_saw_core1 = {
3129 .name = "saw-regulator",
3130 .id = 1,
3131 .dev = {
3132 .platform_data = &msm_saw_regulator_pdata_s6,
3133 },
3134};
3135
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003136static struct tsens_platform_data msm_tsens_pdata = {
3137 .slope = 910,
3138 .tsens_factor = 1000,
3139 .hw_type = MSM_8960,
3140 .tsens_num_sensor = 5,
3141};
3142
3143static struct platform_device msm_tsens_device = {
3144 .name = "tsens8960-tm",
3145 .id = -1,
3146 .dev = {
3147 .platform_data = &msm_tsens_pdata,
3148 },
3149};
3150
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003151#ifdef CONFIG_MSM_FAKE_BATTERY
3152static struct platform_device fish_battery_device = {
3153 .name = "fish_battery",
3154};
3155#endif
3156
David Collins26f05562011-06-20 09:56:28 -07003157static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003158 .name = GPIO_REGULATOR_DEV_NAME,
3159 .id = PM8921_MPP_PM_TO_SYS(7),
3160 .dev = {
3161 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3162 },
3163};
3164
David Collins26f05562011-06-20 09:56:28 -07003165static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003166 .name = GPIO_REGULATOR_DEV_NAME,
3167 .id = 91,
3168 .dev = {
3169 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3170 },
3171};
3172
David Collinsb10be1d2011-09-02 10:29:31 -07003173static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3174 .name = GPIO_REGULATOR_DEV_NAME,
3175 .id = PM8921_GPIO_PM_TO_SYS(17),
3176 .dev = {
3177 .platform_data =
3178 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3179 },
3180};
3181
David Collins26f05562011-06-20 09:56:28 -07003182static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3183 .name = "rpm-regulator",
3184 .id = -1,
3185 .dev = {
3186 .platform_data = &msm_rpm_regulator_pdata,
3187 },
3188};
3189
David Collins4c31a872011-08-31 10:07:10 -07003190static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3191 .phys_addr_base = 0x0010C000,
3192 .reg_offsets = {
3193 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3194 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3195 },
3196 .phys_size = SZ_8K,
3197 .log_len = 4096, /* log's buffer length in bytes */
3198 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3199};
3200
3201static struct platform_device msm_rpm_log_device = {
3202 .name = "msm_rpm_log",
3203 .id = -1,
3204 .dev = {
3205 .platform_data = &msm_rpm_log_pdata,
3206 },
3207};
3208
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003209static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003210 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003211 &msm_device_smd,
3212 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303213 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003214 &msm_device_saw_core0,
3215 &msm_device_saw_core1,
3216 &msm8960_device_ext_5v_vreg,
3217 &msm8960_device_ext_l2_vreg,
3218 &msm8960_device_ssbi_pm8921,
3219 &msm8960_device_qup_spi_gsbi1,
3220 &msm8960_device_qup_i2c_gsbi3,
3221 &msm8960_device_qup_i2c_gsbi4,
3222 &msm8960_device_qup_i2c_gsbi10,
3223#ifndef CONFIG_MSM_DSPS
3224 &msm8960_device_qup_i2c_gsbi12,
3225#endif
3226 &msm_slim_ctrl,
3227 &msm_device_wcnss_wlan,
3228#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3229 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3230 &qcrypto_device,
3231#endif
3232
3233#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3234 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3235 &qcedev_device,
3236#endif
3237#ifdef CONFIG_MSM_ROTATOR
3238 &msm_rotator_device,
3239#endif
3240 &msm_device_sps,
3241#ifdef CONFIG_MSM_FAKE_BATTERY
3242 &fish_battery_device,
3243#endif
3244#ifdef CONFIG_ANDROID_PMEM
3245 &android_pmem_device,
3246 &android_pmem_adsp_device,
3247 &android_pmem_audio_device,
3248#endif
3249 &msm_fb_device,
3250 &msm_device_vidc,
3251 &msm_device_bam_dmux,
3252 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003253
3254#ifdef CONFIG_HW_RANDOM_MSM
3255 &msm_device_rng,
3256#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003257 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003258#ifdef CONFIG_ION_MSM
3259 &ion_dev,
3260#endif
David Collins4c31a872011-08-31 10:07:10 -07003261 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003262#ifdef CONFIG_MSM_QDSS
3263 &msm_etb_device,
3264 &msm_tpiu_device,
3265 &msm_funnel_device,
3266 &msm_ptm_device,
3267#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003268};
3269
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003270static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003271 &msm8960_device_otg,
3272 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003273 &msm_device_hsusb_host,
3274 &android_usb_device,
3275 &msm_device_vidc,
3276 &mipi_dsi_simulator_panel_device,
3277 &msm_bus_apps_fabric,
3278 &msm_bus_sys_fabric,
3279 &msm_bus_mm_fabric,
3280 &msm_bus_sys_fpb,
3281 &msm_bus_cpss_fpb,
3282 &msm_pcm,
3283 &msm_pcm_routing,
3284 &msm_cpudai0,
3285 &msm_cpudai1,
3286 &msm_cpudai_hdmi_rx,
3287 &msm_cpudai_bt_rx,
3288 &msm_cpudai_bt_tx,
3289 &msm_cpudai_fm_rx,
3290 &msm_cpudai_fm_tx,
3291 &msm_cpu_fe,
3292 &msm_stub_codec,
3293 &msm_voice,
3294 &msm_voip,
3295 &msm_lpa_pcm,
3296
3297#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3298 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3299 &qcrypto_device,
3300#endif
3301
3302#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3303 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3304 &qcedev_device,
3305#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003306};
3307
3308static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003309 &msm_kgsl_3d0,
3310 &msm_kgsl_2d0,
3311 &msm_kgsl_2d1,
3312 &mipi_dsi_renesas_panel_device,
3313#ifdef CONFIG_MSM_GEMINI
3314 &msm8960_gemini_device,
3315#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003316};
3317
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003319 &msm8960_device_otg,
3320 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003321 &msm_device_hsusb_host,
3322 &android_usb_device,
3323 &msm_pcm,
3324 &msm_pcm_routing,
3325 &msm_cpudai0,
3326 &msm_cpudai1,
3327 &msm_cpudai_hdmi_rx,
3328 &msm_cpudai_bt_rx,
3329 &msm_cpudai_bt_tx,
3330 &msm_cpudai_fm_rx,
3331 &msm_cpudai_fm_tx,
3332 &msm_cpu_fe,
3333 &msm_stub_codec,
3334 &msm_kgsl_3d0,
3335#ifdef CONFIG_MSM_KGSL_2D
3336 &msm_kgsl_2d0,
3337 &msm_kgsl_2d1,
3338#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003339 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003340#ifdef CONFIG_MSM_GEMINI
3341 &msm8960_gemini_device,
3342#endif
3343 &msm_voice,
3344 &msm_voip,
3345 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303346 &msm_cpudai_afe_01_rx,
3347 &msm_cpudai_afe_01_tx,
3348 &msm_cpudai_afe_02_rx,
3349 &msm_cpudai_afe_02_tx,
3350 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003351#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3352 &hdmi_msm_device,
3353#endif
3354 &msm_pcm_hostless,
3355 &msm_bus_apps_fabric,
3356 &msm_bus_sys_fabric,
3357 &msm_bus_mm_fabric,
3358 &msm_bus_sys_fpb,
3359 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003360 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003361};
3362
3363static void __init msm8960_i2c_init(void)
3364{
3365 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3366 &msm8960_i2c_qup_gsbi4_pdata;
3367
3368 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3369 &msm8960_i2c_qup_gsbi3_pdata;
3370
3371 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3372 &msm8960_i2c_qup_gsbi10_pdata;
3373
3374 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3375 &msm8960_i2c_qup_gsbi12_pdata;
3376}
3377
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003378static void __init msm8960_gfx_init(void)
3379{
3380 uint32_t soc_platform_version = socinfo_get_platform_version();
3381 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3382 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3383 msm_kgsl_3d0.dev.platform_data;
3384 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3385 320000000;
3386 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3387 266667000;
3388 }
3389}
3390
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003391static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3392 .irq_base = PM8921_IRQ_BASE,
3393 .devirq = MSM_GPIO_TO_INT(104),
3394 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3395};
3396
3397static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3398 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3399};
3400
3401static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3402 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3403};
3404
3405static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3406 .rtc_write_enable = false,
3407};
3408
3409static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3410 .pull_up = 1,
3411 .kpd_trigger_delay_us = 970,
3412 .wakeup = 1,
3413};
3414
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303415/* Rotate lock key is not available so use F1 */
3416#define KEY_ROTATE_LOCK KEY_F1
3417
3418static const unsigned int keymap_liquid[] = {
3419 KEY(0, 0, KEY_VOLUMEUP),
3420 KEY(0, 1, KEY_VOLUMEDOWN),
3421 KEY(1, 3, KEY_ROTATE_LOCK),
3422 KEY(1, 4, KEY_HOME),
3423};
3424
3425static struct matrix_keymap_data keymap_data_liquid = {
3426 .keymap_size = ARRAY_SIZE(keymap_liquid),
3427 .keymap = keymap_liquid,
3428};
3429
3430static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3431 .input_name = "keypad_8960_liquid",
3432 .input_phys_device = "keypad_8960/input0",
3433 .num_rows = 2,
3434 .num_cols = 5,
3435 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3436 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3437 .debounce_ms = 15,
3438 .scan_delay_ms = 32,
3439 .row_hold_ns = 91500,
3440 .wakeup = 1,
3441 .keymap_data = &keymap_data_liquid,
3442};
3443
3444
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003445static const unsigned int keymap[] = {
3446 KEY(0, 0, KEY_VOLUMEUP),
3447 KEY(0, 1, KEY_VOLUMEDOWN),
3448 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3449 KEY(0, 3, KEY_CAMERA_FOCUS),
3450};
3451
3452static struct matrix_keymap_data keymap_data = {
3453 .keymap_size = ARRAY_SIZE(keymap),
3454 .keymap = keymap,
3455};
3456
3457static struct pm8xxx_keypad_platform_data keypad_data = {
3458 .input_name = "keypad_8960",
3459 .input_phys_device = "keypad_8960/input0",
3460 .num_rows = 1,
3461 .num_cols = 5,
3462 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3463 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3464 .debounce_ms = 15,
3465 .scan_delay_ms = 32,
3466 .row_hold_ns = 91500,
3467 .wakeup = 1,
3468 .keymap_data = &keymap_data,
3469};
3470
3471static const unsigned int keymap_sim[] = {
3472 KEY(0, 0, KEY_7),
3473 KEY(0, 1, KEY_DOWN),
3474 KEY(0, 2, KEY_UP),
3475 KEY(0, 3, KEY_RIGHT),
3476 KEY(0, 4, KEY_ENTER),
3477 KEY(0, 5, KEY_L),
3478 KEY(0, 6, KEY_BACK),
3479 KEY(0, 7, KEY_M),
3480
3481 KEY(1, 0, KEY_LEFT),
3482 KEY(1, 1, KEY_SEND),
3483 KEY(1, 2, KEY_1),
3484 KEY(1, 3, KEY_4),
3485 KEY(1, 4, KEY_CLEAR),
3486 KEY(1, 5, KEY_MSDOS),
3487 KEY(1, 6, KEY_SPACE),
3488 KEY(1, 7, KEY_COMMA),
3489
3490 KEY(2, 0, KEY_6),
3491 KEY(2, 1, KEY_5),
3492 KEY(2, 2, KEY_8),
3493 KEY(2, 3, KEY_3),
3494 KEY(2, 4, KEY_NUMERIC_STAR),
3495 KEY(2, 5, KEY_UP),
3496 KEY(2, 6, KEY_DOWN),
3497 KEY(2, 7, KEY_LEFTSHIFT),
3498
3499 KEY(3, 0, KEY_9),
3500 KEY(3, 1, KEY_NUMERIC_POUND),
3501 KEY(3, 2, KEY_0),
3502 KEY(3, 3, KEY_2),
3503 KEY(3, 4, KEY_SLEEP),
3504 KEY(3, 5, KEY_F1),
3505 KEY(3, 6, KEY_F2),
3506 KEY(3, 7, KEY_F3),
3507
3508 KEY(4, 0, KEY_BACK),
3509 KEY(4, 1, KEY_HOME),
3510 KEY(4, 2, KEY_MENU),
3511 KEY(4, 3, KEY_VOLUMEUP),
3512 KEY(4, 4, KEY_VOLUMEDOWN),
3513 KEY(4, 5, KEY_F4),
3514 KEY(4, 6, KEY_F5),
3515 KEY(4, 7, KEY_F6),
3516
3517 KEY(5, 0, KEY_R),
3518 KEY(5, 1, KEY_T),
3519 KEY(5, 2, KEY_Y),
3520 KEY(5, 3, KEY_LEFTALT),
3521 KEY(5, 4, KEY_KPENTER),
3522 KEY(5, 5, KEY_Q),
3523 KEY(5, 6, KEY_W),
3524 KEY(5, 7, KEY_E),
3525
3526 KEY(6, 0, KEY_F),
3527 KEY(6, 1, KEY_G),
3528 KEY(6, 2, KEY_H),
3529 KEY(6, 3, KEY_CAPSLOCK),
3530 KEY(6, 4, KEY_PAGEUP),
3531 KEY(6, 5, KEY_A),
3532 KEY(6, 6, KEY_S),
3533 KEY(6, 7, KEY_D),
3534
3535 KEY(7, 0, KEY_V),
3536 KEY(7, 1, KEY_B),
3537 KEY(7, 2, KEY_N),
3538 KEY(7, 3, KEY_MENU),
3539 KEY(7, 4, KEY_PAGEDOWN),
3540 KEY(7, 5, KEY_Z),
3541 KEY(7, 6, KEY_X),
3542 KEY(7, 7, KEY_C),
3543
3544 KEY(8, 0, KEY_P),
3545 KEY(8, 1, KEY_J),
3546 KEY(8, 2, KEY_K),
3547 KEY(8, 3, KEY_INSERT),
3548 KEY(8, 4, KEY_LINEFEED),
3549 KEY(8, 5, KEY_U),
3550 KEY(8, 6, KEY_I),
3551 KEY(8, 7, KEY_O),
3552
3553 KEY(9, 0, KEY_4),
3554 KEY(9, 1, KEY_5),
3555 KEY(9, 2, KEY_6),
3556 KEY(9, 3, KEY_7),
3557 KEY(9, 4, KEY_8),
3558 KEY(9, 5, KEY_1),
3559 KEY(9, 6, KEY_2),
3560 KEY(9, 7, KEY_3),
3561
3562 KEY(10, 0, KEY_F7),
3563 KEY(10, 1, KEY_F8),
3564 KEY(10, 2, KEY_F9),
3565 KEY(10, 3, KEY_F10),
3566 KEY(10, 4, KEY_FN),
3567 KEY(10, 5, KEY_9),
3568 KEY(10, 6, KEY_0),
3569 KEY(10, 7, KEY_DOT),
3570
3571 KEY(11, 0, KEY_LEFTCTRL),
3572 KEY(11, 1, KEY_F11),
3573 KEY(11, 2, KEY_ENTER),
3574 KEY(11, 3, KEY_SEARCH),
3575 KEY(11, 4, KEY_DELETE),
3576 KEY(11, 5, KEY_RIGHT),
3577 KEY(11, 6, KEY_LEFT),
3578 KEY(11, 7, KEY_RIGHTSHIFT),
3579 KEY(0, 0, KEY_VOLUMEUP),
3580 KEY(0, 1, KEY_VOLUMEDOWN),
3581 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3582 KEY(0, 3, KEY_CAMERA_FOCUS),
3583};
3584
3585static struct matrix_keymap_data keymap_data_sim = {
3586 .keymap_size = ARRAY_SIZE(keymap_sim),
3587 .keymap = keymap_sim,
3588};
3589
3590static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3591 .input_name = "keypad_8960",
3592 .input_phys_device = "keypad_8960/input0",
3593 .num_rows = 12,
3594 .num_cols = 8,
3595 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3596 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3597 .debounce_ms = 15,
3598 .scan_delay_ms = 32,
3599 .row_hold_ns = 91500,
3600 .wakeup = 1,
3601 .keymap_data = &keymap_data_sim,
3602};
3603
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003604static int pm8921_therm_mitigation[] = {
3605 1100,
3606 700,
3607 600,
3608 325,
3609};
3610
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003611static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003612 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003613 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003614 .max_voltage = 4200,
3615 .min_voltage = 3200,
3616 .resume_voltage = 4100,
3617 .term_current = 100,
3618 .cool_temp = 10,
3619 .warm_temp = 40,
3620 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003621 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003622 .cool_bat_chg_current = 350,
3623 .warm_bat_chg_current = 350,
3624 .cool_bat_voltage = 4100,
3625 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003626 .thermal_mitigation = pm8921_therm_mitigation,
3627 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003628};
3629
3630static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3631 .priority = 0,
3632};
3633
3634static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3635 .r_sense = 10,
3636 .i_test = 2500,
3637 .v_failure = 3000,
3638 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003639};
3640
Jay Chokshide4cefb2011-08-04 18:10:44 -07003641#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3642
3643/**
3644 * 'flag' stores three values; led id, led mode, and max current of led.
3645 * The bit packing format is as follow,
3646 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3647 * led_id (1 nibble)
3648 */
3649#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3650 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3651 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3652 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3653 PM8XXX_LED_MAX_CURRENT_MASK))
3654
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003655static struct led_info pm8921_led_info[] = {
3656 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003657 .name = "led:usb",
3658 .default_trigger = "usb-online",
3659 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3660 PM8XXX_LED_MODE_MANUAL,
3661 PM8921_LC_LED_MAX_CURRENT),
3662 },
3663 [1] = {
3664 .name = "led:ac",
3665 .default_trigger = "ac-online",
3666 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3667 PM8XXX_LED_MODE_MANUAL,
3668 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003669 },
3670};
3671
3672static struct led_platform_data pm8xxx_leds_pdata = {
3673 .num_leds = ARRAY_SIZE(pm8921_led_info),
3674 .leds = pm8921_led_info,
3675};
3676
3677static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3678 .irq_pdata = &pm8xxx_irq_pdata,
3679 .gpio_pdata = &pm8xxx_gpio_pdata,
3680 .mpp_pdata = &pm8xxx_mpp_pdata,
3681 .rtc_pdata = &pm8xxx_rtc_pdata,
3682 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3683 .keypad_pdata = &keypad_data,
3684 .misc_pdata = &pm8xxx_misc_pdata,
3685 .regulator_pdatas = msm_pm8921_regulator_pdata,
3686 .charger_pdata = &pm8921_chg_pdata,
3687 .bms_pdata = &pm8921_bms_pdata,
3688 .adc_pdata = &pm8921_adc_pdata,
3689 .leds_pdata = &pm8xxx_leds_pdata,
3690};
3691
3692static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3693 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3694 .slave = {
3695 .name = "pm8921-core",
3696 .platform_data = &pm8921_platform_data,
3697 },
3698};
3699
3700static void msm8960_wcnss_init(void)
3701{
3702 int i, ret, j;
3703
3704 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3705 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3706 "wcnss_5_wire");
3707 if (ret) {
3708 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3709 wcnss_5wire_interface[i].gpio, ret);
3710 goto fail;
3711 }
3712 }
3713
3714 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3715
3716 return;
3717
3718fail:
3719 for (j = 0; j < i; j++)
3720 gpio_free(wcnss_5wire_interface[j].gpio);
3721}
3722
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003723#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003724static int ethernet_init(void)
3725{
3726 int ret;
3727 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3728 if (ret) {
3729 pr_err("ks8851 gpio_request failed: %d\n", ret);
3730 goto fail;
3731 }
3732
3733 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3734 if (ret) {
3735 pr_err("ks8851 gpio_request failed: %d\n", ret);
3736 goto fail_rst;
3737 }
3738
3739 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3740 if (ret) {
3741 pr_err("ks8851 gpio_request failed: %d\n", ret);
3742 goto fail_cs;
3743 }
3744
3745 gpio_direction_output(FPGA_CS_GPIO, 1);
3746 gpio_direction_output(KS8851_RST_GPIO, 1);
3747 return 0;
3748fail_cs:
3749 gpio_free(KS8851_RST_GPIO);
3750fail_rst:
3751 gpio_free(KS8851_IRQ_GPIO);
3752fail:
3753 return ret;
3754}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003755#else
3756static int ethernet_init(void)
3757{
3758 return 0;
3759}
3760#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003761
3762static struct msm_cpuidle_state msm_cstates[] __initdata = {
3763 {0, 0, "C0", "WFI",
3764 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3765
3766 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3767 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3768
3769 {0, 2, "C2", "POWER_COLLAPSE",
3770 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3771
3772 {1, 0, "C0", "WFI",
3773 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3774
3775 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3776 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3777};
3778
3779static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3780 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3781 .idle_supported = 1,
3782 .suspend_supported = 1,
3783 .idle_enabled = 0,
3784 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003785 },
3786
3787 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3788 .idle_supported = 1,
3789 .suspend_supported = 1,
3790 .idle_enabled = 0,
3791 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003792 },
3793
3794 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3795 .idle_supported = 1,
3796 .suspend_supported = 1,
3797 .idle_enabled = 1,
3798 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003799 },
3800
3801 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3802 .idle_supported = 0,
3803 .suspend_supported = 1,
3804 .idle_enabled = 0,
3805 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003806 },
3807
3808 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3809 .idle_supported = 1,
3810 .suspend_supported = 1,
3811 .idle_enabled = 0,
3812 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003813 },
3814
3815 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3816 .idle_supported = 1,
3817 .suspend_supported = 0,
3818 .idle_enabled = 1,
3819 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003820 },
3821};
3822
3823static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3824 {
3825 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3826 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3827 true,
3828 1, 8000, 100000, 1,
3829 },
3830
3831 {
3832 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3833 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3834 true,
3835 1500, 5000, 60100000, 3000,
3836 },
3837
3838 {
3839 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3840 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3841 false,
3842 1800, 5000, 60350000, 3500,
3843 },
3844
3845 {
3846 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3847 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3848 false,
3849 2800, 2500, 65350000, 4800,
3850 },
3851
3852 {
3853 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3854 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3855 false,
3856 3800, 4500, 67850000, 5500,
3857 },
3858
3859 {
3860 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3861 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3862 false,
3863 4800, 2000, 71850000, 6800,
3864 },
3865
3866 {
3867 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3868 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3869 false,
3870 6800, 500, 75850000, 8800,
3871 },
3872
3873 {
3874 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3875 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3876 false,
3877 7800, 0, 76350000, 9800,
3878 },
3879};
3880
3881#ifdef CONFIG_I2C
3882#define I2C_SURF 1
3883#define I2C_FFA (1 << 1)
3884#define I2C_RUMI (1 << 2)
3885#define I2C_SIM (1 << 3)
3886#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003887#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003888
3889struct i2c_registry {
3890 u8 machs;
3891 int bus;
3892 struct i2c_board_info *info;
3893 int len;
3894};
3895
3896#ifdef CONFIG_MSM_CAMERA
3897static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3898#ifdef CONFIG_IMX074
3899 {
3900 I2C_BOARD_INFO("imx074", 0x1A),
3901 },
3902#endif
3903#ifdef CONFIG_OV2720
3904 {
3905 I2C_BOARD_INFO("ov2720", 0x6C),
3906 },
3907#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003908 {
3909 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3910 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303911#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3912 {
3913 I2C_BOARD_INFO("sc628a", 0x6E),
3914 },
3915#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003916};
3917#endif
3918
3919/* Sensors DSPS platform data */
3920#ifdef CONFIG_MSM_DSPS
3921#define DSPS_PIL_GENERIC_NAME "dsps"
3922#endif /* CONFIG_MSM_DSPS */
3923
3924static void __init msm8960_init_dsps(void)
3925{
3926#ifdef CONFIG_MSM_DSPS
3927 struct msm_dsps_platform_data *pdata =
3928 msm_dsps_device.dev.platform_data;
3929 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3930 pdata->gpios = NULL;
3931 pdata->gpios_num = 0;
3932
3933 platform_device_register(&msm_dsps_device);
3934#endif /* CONFIG_MSM_DSPS */
3935}
3936
Amir Samuelov5137e392011-09-21 17:31:25 +03003937#ifdef CONFIG_ISL9519_CHARGER
3938static struct isl_platform_data isl_data __initdata = {
3939 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3940 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3941 .max_system_voltage = 4200,
3942 .min_system_voltage = 3200,
3943 .chgcurrent = 1000, /* 1900, */
3944 .term_current = 400, /* Need fine tuning */
3945 .input_current = 2048,
3946};
3947
3948static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3949 {
3950 I2C_BOARD_INFO("isl9519q", 0x9),
3951 .irq = 0, /* Not required when notify-by-pmic */
3952 .platform_data = &isl_data,
3953 },
3954};
3955#endif /* CONFIG_ISL9519_CHARGER */
3956
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003957static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3958#ifdef CONFIG_MSM_CAMERA
3959 {
Amir Samuelov05f87802011-08-27 18:30:12 +03003960 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003961 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3962 msm_camera_boardinfo,
3963 ARRAY_SIZE(msm_camera_boardinfo),
3964 },
3965#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03003966#ifdef CONFIG_ISL9519_CHARGER
3967 {
3968 I2C_LIQUID,
3969 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3970 isl_charger_i2c_info,
3971 ARRAY_SIZE(isl_charger_i2c_info),
3972 },
3973#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003974 {
3975 I2C_SURF | I2C_FFA | I2C_FLUID,
3976 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3977 cyttsp_info,
3978 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003979 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303980 {
3981 I2C_LIQUID,
3982 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3983 mxt_device_info,
3984 ARRAY_SIZE(mxt_device_info),
3985 },
3986
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003987};
3988#endif /* CONFIG_I2C */
3989
3990static void __init register_i2c_devices(void)
3991{
3992#ifdef CONFIG_I2C
3993 u8 mach_mask = 0;
3994 int i;
3995
3996 /* Build the matching 'supported_machs' bitmask */
3997 if (machine_is_msm8960_cdp())
3998 mach_mask = I2C_SURF;
3999 else if (machine_is_msm8960_rumi3())
4000 mach_mask = I2C_RUMI;
4001 else if (machine_is_msm8960_sim())
4002 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004003 else if (machine_is_msm8960_fluid())
4004 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004005 else if (machine_is_msm8960_liquid())
4006 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004007 else if (machine_is_msm8960_mtp())
4008 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004009 else
4010 pr_err("unmatched machine ID in register_i2c_devices\n");
4011
4012 /* Run the array and install devices as appropriate */
4013 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4014 if (msm8960_i2c_devices[i].machs & mach_mask)
4015 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4016 msm8960_i2c_devices[i].info,
4017 msm8960_i2c_devices[i].len);
4018 }
4019#endif
4020}
4021
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004022static void __init msm8960_sim_init(void)
4023{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004024 if (socinfo_init() < 0)
4025 pr_err("socinfo_init() failed!\n");
4026
4027 BUG_ON(msm_rpm_init(&msm_rpm_data));
4028 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4029 ARRAY_SIZE(msm_rpmrs_levels)));
4030 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004031 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004032 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004033 msm8960_device_ssbi_pm8921.dev.platform_data =
4034 &msm8960_ssbi_pm8921_pdata;
4035 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004036
4037 /* Simulator supports a QWERTY keypad */
4038 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4039
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004040 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4041 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4042 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004043 gpiomux_init();
4044 ethernet_init();
4045 msm8960_i2c_init();
4046 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4047 msm_spm_l2_init(msm_spm_l2_data);
4048 msm8960_init_buses();
4049 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4050 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004051 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004052 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004053
4054 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4055 &msm8960_qup_spi_gsbi1_pdata;
4056 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4057
4058 msm8960_init_mmc();
4059 msm_fb_add_devices();
4060 slim_register_board_info(msm_slim_devices,
4061 ARRAY_SIZE(msm_slim_devices));
4062 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4063 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4064 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4065 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004066}
4067
4068static void __init msm8960_rumi3_init(void)
4069{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004070 if (socinfo_init() < 0)
4071 pr_err("socinfo_init() failed!\n");
4072
4073 BUG_ON(msm_rpm_init(&msm_rpm_data));
4074 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4075 ARRAY_SIZE(msm_rpmrs_levels)));
4076 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004077 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004078 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004079 gpiomux_init();
4080 ethernet_init();
4081 msm8960_device_ssbi_pm8921.dev.platform_data =
4082 &msm8960_ssbi_pm8921_pdata;
4083 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4084 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4085 &msm8960_qup_spi_gsbi1_pdata;
4086 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4087 msm8960_i2c_init();
4088 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4089 msm_spm_l2_init(msm_spm_l2_data);
4090 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4091 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004092 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004093 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004094 register_i2c_devices();
4095 msm_fb_add_devices();
4096 slim_register_board_info(msm_slim_devices,
4097 ARRAY_SIZE(msm_slim_devices));
4098 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4099 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4100 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4101 msm_pm_data);
4102}
4103
4104static void __init msm8960_cdp_init(void)
4105{
4106 if (socinfo_init() < 0)
4107 pr_err("socinfo_init() failed!\n");
4108
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004109 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4110 pr_err("meminfo_init() failed!\n");
4111
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004112 BUG_ON(msm_rpm_init(&msm_rpm_data));
4113 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4114 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004115
4116 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004117 regulator_suppress_info_printing();
4118 if (msm_xo_init())
4119 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004120 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004121 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004122 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4123 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4124 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004125 gpiomux_init();
4126 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304127 if (machine_is_msm8960_liquid())
4128 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004129 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4130 &msm8960_qup_spi_gsbi1_pdata;
4131 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4132 msm8960_device_ssbi_pm8921.dev.platform_data =
4133 &msm8960_ssbi_pm8921_pdata;
4134 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4135 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004136 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004137 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4138 msm_spm_l2_init(msm_spm_l2_data);
4139 msm8960_init_buses();
4140 platform_add_devices(msm_footswitch_devices,
4141 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004142 if (machine_is_msm8960_liquid())
4143 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004144 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4145 pm8921_gpio_mpp_init();
4146 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4147 msm8960_init_cam();
4148 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004149 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304150 if (machine_is_msm8960_liquid())
4151 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004152 register_i2c_devices();
4153 msm8960_wcnss_init();
4154 msm_fb_add_devices();
4155 slim_register_board_info(msm_slim_devices,
4156 ARRAY_SIZE(msm_slim_devices));
4157 msm8960_init_dsps();
4158 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4159 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4160 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4161 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004162 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004163}
4164
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004165MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4166 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004167 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004168 .init_irq = msm8960_init_irq,
4169 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004170 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004171 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004172MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004173
4174MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4175 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004176 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004177 .init_irq = msm8960_init_irq,
4178 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004179 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004181MACHINE_END
4182
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004183MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4184 .map_io = msm8960_map_io,
4185 .reserve = msm8960_reserve,
4186 .init_irq = msm8960_init_irq,
4187 .timer = &msm_timer,
4188 .init_machine = msm8960_cdp_init,
4189 .init_early = msm8960_allocate_memory_regions,
4190MACHINE_END
4191
4192MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4193 .map_io = msm8960_map_io,
4194 .reserve = msm8960_reserve,
4195 .init_irq = msm8960_init_irq,
4196 .timer = &msm_timer,
4197 .init_machine = msm8960_cdp_init,
4198 .init_early = msm8960_allocate_memory_regions,
4199MACHINE_END
4200
4201MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4202 .map_io = msm8960_map_io,
4203 .reserve = msm8960_reserve,
4204 .init_irq = msm8960_init_irq,
4205 .timer = &msm_timer,
4206 .init_machine = msm8960_cdp_init,
4207 .init_early = msm8960_allocate_memory_regions,
4208MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004209
4210MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4211 .map_io = msm8960_map_io,
4212 .reserve = msm8960_reserve,
4213 .init_irq = msm8960_init_irq,
4214 .timer = &msm_timer,
4215 .init_machine = msm8960_cdp_init,
4216 .init_early = msm8960_allocate_memory_regions,
4217MACHINE_END