blob: 895d6dc59ea997f6716c8f893398540456605d9a [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080041
42#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070044#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080045#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047
48#include <mach/board.h>
49#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <mach/msm_spi.h>
51#ifdef CONFIG_USB_MSM_OTG_72K
52#include <mach/msm_hsusb.h>
53#else
54#include <linux/usb/msm_hsusb.h>
55#endif
56#include <linux/usb/android.h>
57#include <mach/usbdiag.h>
58#include <mach/socinfo.h>
59#include <mach/rpm.h>
60#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070061#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#include <mach/msm_bus_board.h>
63#include <mach/msm_memtypes.h>
64#include <mach/dma.h>
65#include <mach/msm_dsps.h>
66#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070067#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080068
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070069#ifdef CONFIG_WCD9310_CODEC
70#include <linux/slimbus/slimbus.h>
71#include <linux/mfd/wcd9310/core.h>
72#include <linux/mfd/wcd9310/pdata.h>
73#endif
74
Laura Abbottd6183792011-08-19 13:42:24 -070075#include <linux/ion.h>
76#include <mach/ion.h>
77
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080079#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "spm.h"
82#include "board-msm8960.h"
83#include "pm.h"
84#include "cpuidle.h"
85#include "rpm_resources.h"
86#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070087#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070088#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070089#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090
91static struct platform_device msm_fm_platform_init = {
92 .name = "iris_fm",
93 .id = -1,
94};
95
96struct pm8xxx_gpio_init {
97 unsigned gpio;
98 struct pm_gpio config;
99};
100
101struct pm8xxx_mpp_init {
102 unsigned mpp;
103 struct pm8xxx_mpp_config_data config;
104};
105
106#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
107 _func, _inv, _disable) \
108{ \
109 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
110 .config = { \
111 .direction = _dir, \
112 .output_buffer = _buf, \
113 .output_value = _val, \
114 .pull = _pull, \
115 .vin_sel = _vin, \
116 .out_strength = _out_strength, \
117 .function = _func, \
118 .inv_int_pol = _inv, \
119 .disable_pin = _disable, \
120 } \
121}
122
123#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
124{ \
125 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
126 .config = { \
127 .type = PM8XXX_MPP_TYPE_##_type, \
128 .level = _level, \
129 .control = PM8XXX_MPP_##_control, \
130 } \
131}
132
133#define PM8XXX_GPIO_DISABLE(_gpio) \
134 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
135 0, 0, 0, 1)
136
137#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
139 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
140 PM_GPIO_STRENGTH_HIGH, \
141 PM_GPIO_FUNC_NORMAL, 0, 0)
142
143#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
144 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
145 _pull, PM_GPIO_VIN_S4, \
146 PM_GPIO_STRENGTH_NO, \
147 PM_GPIO_FUNC_NORMAL, 0, 0)
148
149#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
150 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
151 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
152 PM_GPIO_STRENGTH_HIGH, \
153 _func, 0, 0)
154
155/* Initial PM8921 GPIO configurations */
156static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
157 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
158 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
159 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300160 /* External regulator shared by display and touchscreen on LiQUID */
161 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
162 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700163 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700164 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700166 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700167};
168
169/* Initial PM8921 MPP configurations */
170static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
171 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
172 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
174 DOUT_CTRL_LOW),
175};
176
177static void __init pm8921_gpio_mpp_init(void)
178{
179 int i, rc;
180
181 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
182 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
183 &pm8921_gpios[i].config);
184 if (rc) {
185 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
186 break;
187 }
188 }
189
190 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
191 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
192 &pm8921_mpps[i].config);
193 if (rc) {
194 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
195 break;
196 }
197 }
198}
199
200#define FPGA_CS_GPIO 14
201#define KS8851_RST_GPIO 89
202#define KS8851_IRQ_GPIO 90
203
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700204#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
205enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700206 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700207 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
208 /* CAM Expander */
209 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
210 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
211 GPIO_CAM_GP_AFBUSY,
212 GPIO_CAM_GP_STROBE_CE,
213 GPIO_CAM_GP_CAM1MP_XCLR,
214 GPIO_CAM_GP_CAMIF_RESET_N,
215 GPIO_CAM_GP_XMT_FLASH_INT,
216 GPIO_CAM_GP_LED_EN1,
217 GPIO_CAM_GP_LED_EN2,
218
219};
220#endif
221
Harini Jayaraman608d0462011-08-09 19:10:03 -0600222/* The SPI configurations apply to GSBI 1*/
223static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700224 .func = GPIOMUX_FUNC_1,
225 .drv = GPIOMUX_DRV_8MA,
226 .pull = GPIOMUX_PULL_NONE,
227};
228
Harini Jayaraman608d0462011-08-09 19:10:03 -0600229static struct gpiomux_setting spi_suspended_config = {
230 .func = GPIOMUX_FUNC_GPIO,
231 .drv = GPIOMUX_DRV_2MA,
232 .pull = GPIOMUX_PULL_DOWN,
233};
234
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700235static struct gpiomux_setting gsbi3 = {
236 .func = GPIOMUX_FUNC_1,
237 .drv = GPIOMUX_DRV_8MA,
238 .pull = GPIOMUX_PULL_NONE,
239};
240
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700241static struct gpiomux_setting gsbi5 = {
242 .func = GPIOMUX_FUNC_1,
243 .drv = GPIOMUX_DRV_8MA,
244 .pull = GPIOMUX_PULL_NONE,
245};
246
247static struct gpiomux_setting gsbi10 = {
248 .func = GPIOMUX_FUNC_2,
249 .drv = GPIOMUX_DRV_8MA,
250 .pull = GPIOMUX_PULL_NONE,
251};
252
253static struct gpiomux_setting gsbi12 = {
254 .func = GPIOMUX_FUNC_1,
255 .drv = GPIOMUX_DRV_8MA,
256 .pull = GPIOMUX_PULL_NONE,
257};
258
259static struct gpiomux_setting cdc_mclk = {
260 .func = GPIOMUX_FUNC_1,
261 .drv = GPIOMUX_DRV_8MA,
262 .pull = GPIOMUX_PULL_NONE,
263};
264
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700265static struct gpiomux_setting audio_auxpcm[] = {
266 /* Suspended state */
267 {
268 .func = GPIOMUX_FUNC_GPIO,
269 .drv = GPIOMUX_DRV_2MA,
270 .pull = GPIOMUX_PULL_NONE,
271 },
272 /* Active state */
273 {
274 .func = GPIOMUX_FUNC_1,
275 .drv = GPIOMUX_DRV_2MA,
276 .pull = GPIOMUX_PULL_NONE,
277 },
278};
279
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700280#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281static struct gpiomux_setting gpio_eth_config = {
282 .pull = GPIOMUX_PULL_NONE,
283 .drv = GPIOMUX_DRV_8MA,
284 .func = GPIOMUX_FUNC_GPIO,
285};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700286#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700287
288static struct gpiomux_setting slimbus = {
289 .func = GPIOMUX_FUNC_1,
290 .drv = GPIOMUX_DRV_8MA,
291 .pull = GPIOMUX_PULL_KEEPER,
292};
293
294struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700295#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 {
297 .gpio = KS8851_IRQ_GPIO,
298 .settings = {
299 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
300 }
301 },
302 {
303 .gpio = KS8851_RST_GPIO,
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
306 }
307 },
308 {
309 .gpio = FPGA_CS_GPIO,
310 .settings = {
311 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
312 }
313 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700314#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315};
316
317static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
318 {
319 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
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 = 7, /* GSBI1 QUP SPI_DATA_MISO */
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 = 8, /* GSBI1 QUP SPI_CS_N */
334 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600335 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
336 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337 },
338 },
339 {
340 .gpio = 9, /* GSBI1 QUP SPI_CLK */
341 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600342 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
343 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344 },
345 },
346 {
347 .gpio = 16, /* GSBI3 I2C QUP SDA */
348 .settings = {
349 [GPIOMUX_SUSPENDED] = &gsbi3,
350 },
351 },
352 {
353 .gpio = 17, /* GSBI3 I2C QUP SCL */
354 .settings = {
355 [GPIOMUX_SUSPENDED] = &gsbi3,
356 },
357 },
358 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 .gpio = 22, /* GSBI5 UART2 */
360 .settings = {
361 [GPIOMUX_SUSPENDED] = &gsbi5,
362 },
363 },
364 {
365 .gpio = 23, /* GSBI5 UART2 */
366 .settings = {
367 [GPIOMUX_SUSPENDED] = &gsbi5,
368 },
369 },
370 {
371 .gpio = 24, /* GSBI5 UART2 */
372 .settings = {
373 [GPIOMUX_SUSPENDED] = &gsbi5,
374 },
375 },
376 {
377 .gpio = 25, /* GSBI5 UART2 */
378 .settings = {
379 [GPIOMUX_SUSPENDED] = &gsbi5,
380 },
381 },
382 {
383 .gpio = 44, /* GSBI12 I2C QUP SDA */
384 .settings = {
385 [GPIOMUX_SUSPENDED] = &gsbi12,
386 },
387 },
388 {
389 .gpio = 45, /* GSBI12 I2C QUP SCL */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &gsbi12,
392 },
393 },
394 {
395 .gpio = 73, /* GSBI10 I2C QUP SDA */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &gsbi10,
398 },
399 },
400 {
401 .gpio = 74, /* GSBI10 I2C QUP SCL */
402 .settings = {
403 [GPIOMUX_SUSPENDED] = &gsbi10,
404 },
405 },
406};
407
408static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
409 {
410 .gpio = 60, /* slimbus data */
411 .settings = {
412 [GPIOMUX_SUSPENDED] = &slimbus,
413 },
414 },
415 {
416 .gpio = 61, /* slimbus clk */
417 .settings = {
418 [GPIOMUX_SUSPENDED] = &slimbus,
419 },
420 },
421};
422
423static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
424 {
425 .gpio = 59,
426 .settings = {
427 [GPIOMUX_SUSPENDED] = &cdc_mclk,
428 },
429 },
430};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700431
432static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
433 {
434 .gpio = 63,
435 .settings = {
436 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
437 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
438 },
439 },
440 {
441 .gpio = 64,
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
444 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
445 },
446 },
447 {
448 .gpio = 65,
449 .settings = {
450 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
451 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
452 },
453 },
454 {
455 .gpio = 66,
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
458 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
459 },
460 },
461};
462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700463static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
464 .func = GPIOMUX_FUNC_GPIO,
465 .drv = GPIOMUX_DRV_2MA,
466 .pull = GPIOMUX_PULL_NONE,
467};
468
469static struct gpiomux_setting wcnss_5wire_active_cfg = {
470 .func = GPIOMUX_FUNC_1,
471 .drv = GPIOMUX_DRV_6MA,
472 .pull = GPIOMUX_PULL_DOWN,
473};
474
475static struct msm_gpiomux_config wcnss_5wire_interface[] = {
476 {
477 .gpio = 84,
478 .settings = {
479 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
480 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
481 },
482 },
483 {
484 .gpio = 85,
485 .settings = {
486 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
487 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
488 },
489 },
490 {
491 .gpio = 86,
492 .settings = {
493 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
494 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
495 },
496 },
497 {
498 .gpio = 87,
499 .settings = {
500 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
501 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
502 },
503 },
504 {
505 .gpio = 88,
506 .settings = {
507 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
508 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
509 },
510 },
511};
Nishant Pandit24153d82011-08-27 16:05:13 +0530512static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530513 {
514 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
515 .drv = GPIOMUX_DRV_2MA,
516 .pull = GPIOMUX_PULL_DOWN,
517 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700518
Nishant Pandit474f2252011-07-23 23:17:56 +0530519 {
520 .func = GPIOMUX_FUNC_1, /*active 1*/
521 .drv = GPIOMUX_DRV_2MA,
522 .pull = GPIOMUX_PULL_NONE,
523 },
524
525 {
526 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
527 .drv = GPIOMUX_DRV_2MA,
528 .pull = GPIOMUX_PULL_NONE,
529 },
530
531 {
532 .func = GPIOMUX_FUNC_1, /*active 3*/
533 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700534 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530535 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530536
537 {
538 .func = GPIOMUX_FUNC_5, /*active 4*/
539 .drv = GPIOMUX_DRV_8MA,
540 .pull = GPIOMUX_PULL_UP,
541 },
542
543 {
544 .func = GPIOMUX_FUNC_6, /*active 5*/
545 .drv = GPIOMUX_DRV_8MA,
546 .pull = GPIOMUX_PULL_UP,
547 },
548
549 {
550 .func = GPIOMUX_FUNC_2, /*active 6*/
551 .drv = GPIOMUX_DRV_2MA,
552 .pull = GPIOMUX_PULL_UP,
553 },
554
555 {
556 .func = GPIOMUX_FUNC_3, /*active 7*/
557 .drv = GPIOMUX_DRV_8MA,
558 .pull = GPIOMUX_PULL_UP,
559 },
560
Kevin Chan4c58d292011-09-13 11:03:25 -0700561 {
562 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
563 .drv = GPIOMUX_DRV_2MA,
564 .pull = GPIOMUX_PULL_KEEPER,
565 },
566
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700567};
568
Nishant Pandit24153d82011-08-27 16:05:13 +0530569static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570 {
571 .gpio = 2,
572 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530573 [GPIOMUX_ACTIVE] = &cam_settings[2],
574 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700575 },
576 },
577 {
578 .gpio = 3,
579 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530580 [GPIOMUX_ACTIVE] = &cam_settings[1],
581 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 },
583 },
584 {
585 .gpio = 4,
586 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530587 [GPIOMUX_ACTIVE] = &cam_settings[1],
588 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589 },
590 },
591 {
592 .gpio = 5,
593 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530594 [GPIOMUX_ACTIVE] = &cam_settings[1],
595 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596 },
597 },
598 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530599 .gpio = 76,
600 .settings = {
601 [GPIOMUX_ACTIVE] = &cam_settings[2],
602 [GPIOMUX_SUSPENDED] = &cam_settings[0],
603 },
604 },
605 {
606 .gpio = 107,
607 .settings = {
608 [GPIOMUX_ACTIVE] = &cam_settings[2],
609 [GPIOMUX_SUSPENDED] = &cam_settings[0],
610 },
611 },
612};
613
614static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
615 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700616 .gpio = 18,
617 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530618 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700619 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 },
621 },
622 {
623 .gpio = 19,
624 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530625 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700626 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627 },
628 },
629 {
630 .gpio = 20,
631 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530632 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700633 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634 },
635 },
636 {
637 .gpio = 21,
638 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530639 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700640 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641 },
642 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643};
644
645static struct gpiomux_setting cyts_resout_sus_cfg = {
646 .func = GPIOMUX_FUNC_GPIO,
647 .drv = GPIOMUX_DRV_6MA,
648 .pull = GPIOMUX_PULL_UP,
649};
650
651static struct gpiomux_setting cyts_resout_act_cfg = {
652 .func = GPIOMUX_FUNC_GPIO,
653 .drv = GPIOMUX_DRV_6MA,
654 .pull = GPIOMUX_PULL_UP,
655};
656
657static struct gpiomux_setting cyts_sleep_sus_cfg = {
658 .func = GPIOMUX_FUNC_GPIO,
659 .drv = GPIOMUX_DRV_6MA,
660 .pull = GPIOMUX_PULL_DOWN,
661};
662
663static struct gpiomux_setting cyts_sleep_act_cfg = {
664 .func = GPIOMUX_FUNC_GPIO,
665 .drv = GPIOMUX_DRV_6MA,
666 .pull = GPIOMUX_PULL_DOWN,
667};
668
669static struct gpiomux_setting cyts_int_act_cfg = {
670 .func = GPIOMUX_FUNC_GPIO,
671 .drv = GPIOMUX_DRV_8MA,
672 .pull = GPIOMUX_PULL_UP,
673};
674
675static struct gpiomux_setting cyts_int_sus_cfg = {
676 .func = GPIOMUX_FUNC_GPIO,
677 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530678 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700679};
680
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
682 { /* TS INTERRUPT */
683 .gpio = 11,
684 .settings = {
685 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
686 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
687 },
688 },
689 { /* TS SLEEP */
690 .gpio = 50,
691 .settings = {
692 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
693 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
694 },
695 },
696 { /* TS RESOUT */
697 .gpio = 52,
698 .settings = {
699 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
700 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
701 },
702 },
703};
704
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700705#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
706enum {
707 SX150X_CAM,
708};
709
Nishant Pandit474f2252011-07-23 23:17:56 +0530710static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700711 [SX150X_CAM] = {
712 .gpio_base = GPIO_CAM_EXPANDER_BASE,
713 .oscio_is_gpo = false,
714 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530715 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700716 .io_open_drain_ena = 0x0,
717 .irq_summary = -1,
718 },
719};
Nishant Pandit474f2252011-07-23 23:17:56 +0530720
721#endif
722
723#ifdef CONFIG_I2C
724
725#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
726#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300727#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530728
729#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
730
731static struct i2c_board_info cam_expander_i2c_info[] = {
732 {
733 I2C_BOARD_INFO("sx1508q", 0x22),
734 .platform_data = &sx150x_data[SX150X_CAM]
735 },
736};
737
738static struct msm_cam_expander_info cam_expander_info[] = {
739 {
740 cam_expander_i2c_info,
741 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
742 },
743};
744#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700745#endif
746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700747#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
748#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700749#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700750#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
751
Laura Abbottd6183792011-08-19 13:42:24 -0700752#define MSM_ION_EBI_SIZE SZ_8M
753
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
755static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
756static int __init pmem_kernel_ebi1_size_setup(char *p)
757{
758 pmem_kernel_ebi1_size = memparse(p, NULL);
759 return 0;
760}
761early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
762#endif
763
764#ifdef CONFIG_ANDROID_PMEM
765static unsigned pmem_size = MSM_PMEM_SIZE;
766static int __init pmem_size_setup(char *p)
767{
768 pmem_size = memparse(p, NULL);
769 return 0;
770}
771early_param("pmem_size", pmem_size_setup);
772
773static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
774
775static int __init pmem_adsp_size_setup(char *p)
776{
777 pmem_adsp_size = memparse(p, NULL);
778 return 0;
779}
780early_param("pmem_adsp_size", pmem_adsp_size_setup);
781
782static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
783
784static int __init pmem_audio_size_setup(char *p)
785{
786 pmem_audio_size = memparse(p, NULL);
787 return 0;
788}
789early_param("pmem_audio_size", pmem_audio_size_setup);
790#endif
791
792#ifdef CONFIG_ANDROID_PMEM
793static struct android_pmem_platform_data android_pmem_pdata = {
794 .name = "pmem",
795 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
796 .cached = 1,
797 .memory_type = MEMTYPE_EBI1,
798};
799
800static struct platform_device android_pmem_device = {
801 .name = "android_pmem",
802 .id = 0,
803 .dev = {.platform_data = &android_pmem_pdata},
804};
805
806static struct android_pmem_platform_data android_pmem_adsp_pdata = {
807 .name = "pmem_adsp",
808 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
809 .cached = 0,
810 .memory_type = MEMTYPE_EBI1,
811};
812static struct platform_device android_pmem_adsp_device = {
813 .name = "android_pmem",
814 .id = 2,
815 .dev = { .platform_data = &android_pmem_adsp_pdata },
816};
817
818static struct android_pmem_platform_data android_pmem_audio_pdata = {
819 .name = "pmem_audio",
820 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
821 .cached = 0,
822 .memory_type = MEMTYPE_EBI1,
823};
824
825static struct platform_device android_pmem_audio_device = {
826 .name = "android_pmem",
827 .id = 4,
828 .dev = { .platform_data = &android_pmem_audio_pdata },
829};
830#endif
831
832static struct memtype_reserve msm8960_reserve_table[] __initdata = {
833 [MEMTYPE_SMI] = {
834 },
835 [MEMTYPE_EBI0] = {
836 .flags = MEMTYPE_FLAGS_1M_ALIGN,
837 },
838 [MEMTYPE_EBI1] = {
839 .flags = MEMTYPE_FLAGS_1M_ALIGN,
840 },
841};
842
843static void __init size_pmem_devices(void)
844{
845#ifdef CONFIG_ANDROID_PMEM
846 android_pmem_adsp_pdata.size = pmem_adsp_size;
847 android_pmem_pdata.size = pmem_size;
848 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
849#endif
850}
851
852static void __init reserve_memory_for(struct android_pmem_platform_data *p)
853{
854 msm8960_reserve_table[p->memory_type].size += p->size;
855}
856
857static void __init reserve_pmem_memory(void)
858{
859#ifdef CONFIG_ANDROID_PMEM
860 reserve_memory_for(&android_pmem_adsp_pdata);
861 reserve_memory_for(&android_pmem_pdata);
862 reserve_memory_for(&android_pmem_audio_pdata);
863 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
864#endif
865}
866
Larry Basselb4126da2011-07-18 14:31:33 -0700867static int msm8960_paddr_to_memtype(unsigned int paddr)
868{
869 return MEMTYPE_EBI1;
870}
871
Laura Abbottd6183792011-08-19 13:42:24 -0700872#ifdef CONFIG_ION_MSM
873struct ion_platform_data ion_pdata = {
874 .nr = 3,
875 .heaps = {
876 {
877 .id = ION_HEAP_SYSTEM_ID,
878 .type = ION_HEAP_TYPE_SYSTEM,
879 .name = ION_KMALLOC_HEAP_NAME,
880 },
881 {
882 .id = ION_HEAP_SYSTEM_CONTIG_ID,
883 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
884 .name = ION_VMALLOC_HEAP_NAME,
885 },
886 {
887 .id = ION_HEAP_EBI_ID,
888 .type = ION_HEAP_TYPE_CARVEOUT,
889 .name = ION_EBI1_HEAP_NAME,
890 .size = MSM_ION_EBI_SIZE,
891 .memory_type = ION_EBI_TYPE,
892 },
893 }
894};
895
896struct platform_device ion_dev = {
897 .name = "ion-msm",
898 .id = 1,
899 .dev = { .platform_data = &ion_pdata },
900};
901#endif
902
903static void reserve_ion_memory(void)
904{
905#ifdef CONFIG_ION_MSM
906 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
907#endif
908}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909static void __init msm8960_calculate_reserve_sizes(void)
910{
911 size_pmem_devices();
912 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700913 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700914}
915
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700916static struct reserve_info msm8960_reserve_info __initdata = {
917 .memtype_reserve_table = msm8960_reserve_table,
918 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
919 .paddr_to_memtype = msm8960_paddr_to_memtype,
920};
921
Larry Basselb4126da2011-07-18 14:31:33 -0700922static int msm8960_memory_bank_size(void)
923{
924 return 1<<29;
925}
926
927static void __init locate_unstable_memory(void)
928{
929 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
930 unsigned long bank_size;
931 unsigned long low, high;
932
933 bank_size = msm8960_memory_bank_size();
934 low = meminfo.bank[0].start;
935 high = mb->start + mb->size;
936 low &= ~(bank_size - 1);
937
938 if (high - low <= bank_size)
939 return;
940 msm8960_reserve_info.low_unstable_address = low + bank_size;
941 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
942 msm8960_reserve_info.bank_size = bank_size;
943 pr_info("low unstable address %lx max size %lx bank size %lx\n",
944 msm8960_reserve_info.low_unstable_address,
945 msm8960_reserve_info.max_unstable_size,
946 msm8960_reserve_info.bank_size);
947}
948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949static void __init msm8960_reserve(void)
950{
951 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700952 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700953 msm_reserve();
954}
955
Larry Bassela4414b12011-08-04 11:11:02 -0700956static int msm8960_change_memory_power(u64 start, u64 size,
957 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700958{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700959 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700960}
961
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700962#ifdef CONFIG_MSM_CAMERA
963
Nishant Pandit24153d82011-08-27 16:05:13 +0530964static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965 5, /*CAMIF_MCLK*/
966 20, /*CAMIF_I2C_DATA*/
967 21, /*CAMIF_I2C_CLK*/
968};
969
Nishant Pandit24153d82011-08-27 16:05:13 +0530970static struct msm_camera_gpio_conf gpio_conf = {
971 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
972 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
973 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
974 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
975};
976
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700977#define VFE_CAMIF_TIMER1_GPIO 2
978#define VFE_CAMIF_TIMER2_GPIO 3
979#define VFE_CAMIF_TIMER3_GPIO_INT 4
980struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
981 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
982 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
983 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
984 .flash_recharge_duration = 50000,
985 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
986};
987
Nishant Pandit474f2252011-07-23 23:17:56 +0530988#ifdef CONFIG_MSM_CAMERA_FLASH
989static struct msm_camera_sensor_flash_src msm_flash_src = {
990 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
991 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
992 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
993#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
994 defined(CONFIG_GPIO_SX150X_MODULE))
995 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
996#endif
997};
998#endif
999
Nishant Pandit24153d82011-08-27 16:05:13 +05301000struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1001 {
1002 .ioclk.mclk_clk_rate = 24000000,
1003 .ioclk.vfe_clk_rate = 228570000,
1004 .csid_core = 0,
1005 },
1006 {
1007 .ioclk.mclk_clk_rate = 24000000,
1008 .ioclk.vfe_clk_rate = 228570000,
1009 .csid_core = 1,
1010 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011};
1012
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001013#ifdef CONFIG_IMX074_ACT
1014static struct i2c_board_info imx074_actuator_i2c_info = {
1015 I2C_BOARD_INFO("imx074_act", 0x11),
1016};
1017
1018static struct msm_actuator_info imx074_actuator_info = {
1019 .board_info = &imx074_actuator_i2c_info,
1020 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1021 .vcm_pwd = 0,
1022 .vcm_enable = 1,
1023};
1024#endif
1025
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001026#ifdef CONFIG_IMX074
1027static struct msm_camera_sensor_flash_data flash_imx074 = {
1028 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301029#ifdef CONFIG_MSM_CAMERA_FLASH
1030 .flash_src = &msm_flash_src
1031#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001032};
1033
Nishant Pandit24153d82011-08-27 16:05:13 +05301034static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1035 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001036 .sensor_reset = 107,
1037 .sensor_pwd = 85,
1038 .vcm_pwd = 0,
1039 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301040};
1041
1042static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1043 .sensor_name = "imx074",
1044 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001045 .flash_data = &flash_imx074,
1046 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301047 .sensor_platform_info = &sensor_board_info_imx074,
1048 .gpio_conf = &gpio_conf,
1049 .csi_if = 1,
1050 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001051#ifdef CONFIG_IMX074_ACT
1052 .actuator_info = &imx074_actuator_info
1053#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001054};
1055
1056struct platform_device msm8960_camera_sensor_imx074 = {
1057 .name = "msm_camera_imx074",
1058 .dev = {
1059 .platform_data = &msm_camera_sensor_imx074_data,
1060 },
1061};
1062#endif
1063#ifdef CONFIG_OV2720
1064static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001065 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066};
1067
Nishant Pandit24153d82011-08-27 16:05:13 +05301068static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1069 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070 .sensor_reset = 76,
1071 .sensor_pwd = 85,
1072 .vcm_pwd = 0,
1073 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301074};
1075
1076static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1077 .sensor_name = "ov2720",
1078 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001079 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301080 .sensor_platform_info = &sensor_board_info_ov2720,
1081 .gpio_conf = &gpio_conf,
1082 .csi_if = 1,
1083 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001084};
1085
1086struct platform_device msm8960_camera_sensor_ov2720 = {
1087 .name = "msm_camera_ov2720",
1088 .dev = {
1089 .platform_data = &msm_camera_sensor_ov2720_data,
1090 },
1091};
1092#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001093
1094static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1095 .flash_type = MSM_CAMERA_FLASH_LED,
1096};
1097
Nishant Pandit24153d82011-08-27 16:05:13 +05301098static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1099 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001100 .sensor_reset = 107,
1101 .sensor_pwd = 85,
1102 .vcm_pwd = 0,
1103 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301104};
1105
1106static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1107 .sensor_name = "qs_mt9p017",
1108 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001109 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301110 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1111 .gpio_conf = &gpio_conf,
1112 .csi_if = 1,
1113 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001114};
1115
1116struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1117 .name = "msm_camera_qs_mt9p017",
1118 .dev = {
1119 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1120 },
1121};
1122
Kevin Chan8b0d2322011-09-10 21:06:31 -07001123static struct msm8960_privacy_light_cfg privacy_light_info = {
1124 .mpp = PM8921_MPP_PM_TO_SYS(12),
1125};
1126
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001127static void __init msm8960_init_cam(void)
1128{
1129 int i;
1130 struct platform_device *cam_dev[] = {
1131 &msm8960_camera_sensor_imx074,
1132 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001133 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001134 };
1135
Kevin Chan8b0d2322011-09-10 21:06:31 -07001136 if (machine_is_msm8960_liquid()) {
1137 struct msm_camera_sensor_info *s_info;
1138 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1139 s_info->sensor_platform_info->mount_angle = 180;
1140 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1141 s_info->sensor_platform_info->privacy_light = 1;
1142 s_info->sensor_platform_info->privacy_light_info =
1143 &privacy_light_info;
1144 }
1145
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001146 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1147 struct msm_camera_sensor_info *s_info;
1148 s_info = cam_dev[i]->dev.platform_data;
1149 msm_get_cam_resources(s_info);
1150 platform_device_register(cam_dev[i]);
1151 }
1152}
1153#endif
1154
1155#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001156#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001157#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001158#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159#endif
1160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001161
1162#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001163#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001164#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001165#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1166#else
1167#define MSM_FB_EXT_BUF_SIZE 0
1168#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001169
kuogee hsieh3830eb92011-09-12 15:25:57 -07001170#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1171/* width x height x 3 bpp x 2 frame buffer */
1172#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1173#define MSM_FB_WRITEBACK_OFFSET \
1174 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1175#else
1176#define MSM_FB_WRITEBACK_SIZE 0
1177#define MSM_FB_WRITEBACK_OFFSET 0
1178#endif
1179
1180
1181/* Note: must be multiple of 4096 */
1182#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1183 MSM_FB_WRITEBACK_SIZE, 4096)
1184
1185static int writeback_offset(void)
1186{
1187 return MSM_FB_WRITEBACK_OFFSET;
1188}
1189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001190
1191#define MDP_VSYNC_GPIO 0
1192
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001193#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1194#define TOSHIBA_PANEL_NAME_LEN 24
1195#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1196#define CHIMEI_PANEL_NAME_LEN 16
1197
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198static struct resource msm_fb_resources[] = {
1199 {
1200 .flags = IORESOURCE_DMA,
1201 }
1202};
1203
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001204#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1205static int msm_fb_detect_panel(const char *name)
1206{
1207 if (machine_is_msm8960_liquid()) {
1208 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1209 return 0;
1210 } else {
1211 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1212 return 0;
1213 }
1214
1215 pr_warning("%s: not supported '%s'", __func__, name);
1216
1217 return -ENODEV;
1218}
1219
1220static struct msm_fb_platform_data msm_fb_pdata = {
1221 .detect_client = msm_fb_detect_panel,
1222};
1223#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1224
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001225static struct platform_device msm_fb_device = {
1226 .name = "msm_fb",
1227 .id = 0,
1228 .num_resources = ARRAY_SIZE(msm_fb_resources),
1229 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001230#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1231 .dev.platform_data = &msm_fb_pdata,
1232#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001233};
1234
1235static bool dsi_power_on;
1236
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001237/**
1238 * LiQUID panel on/off
1239 *
1240 * @param on
1241 *
1242 * @return int
1243 */
1244static int mipi_dsi_liquid_panel_power(int on)
1245{
1246 static struct regulator *reg_l2, *reg_ext_3p3v;
1247 static int gpio21, gpio24, gpio43;
1248 int rc;
1249
1250 pr_info("%s: on=%d\n", __func__, on);
1251
1252 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1253 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1254 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1255
1256 if (!dsi_power_on) {
1257
1258 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1259 "dsi_vdda");
1260 if (IS_ERR(reg_l2)) {
1261 pr_err("could not get 8921_l2, rc = %ld\n",
1262 PTR_ERR(reg_l2));
1263 return -ENODEV;
1264 }
1265
1266 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1267 if (rc) {
1268 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1269 return -EINVAL;
1270 }
1271
1272 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1273 "vdd_lvds_3p3v");
1274 if (IS_ERR(reg_ext_3p3v)) {
1275 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1276 PTR_ERR(reg_ext_3p3v));
1277 return -ENODEV;
1278 }
1279
1280 rc = gpio_request(gpio21, "disp_pwr_en_n");
1281 if (rc) {
1282 pr_err("request gpio 21 failed, rc=%d\n", rc);
1283 return -ENODEV;
1284 }
1285
1286 rc = gpio_request(gpio43, "disp_rst_n");
1287 if (rc) {
1288 pr_err("request gpio 43 failed, rc=%d\n", rc);
1289 return -ENODEV;
1290 }
1291
1292 rc = gpio_request(gpio24, "disp_backlight_pwm");
1293 if (rc) {
1294 pr_err("request gpio 24 failed, rc=%d\n", rc);
1295 return -ENODEV;
1296 }
1297
1298 dsi_power_on = true;
1299 }
1300
1301 if (on) {
1302 rc = regulator_set_optimum_mode(reg_l2, 100000);
1303 if (rc < 0) {
1304 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1305 return -EINVAL;
1306 }
1307 rc = regulator_enable(reg_l2);
1308 if (rc) {
1309 pr_err("enable l2 failed, rc=%d\n", rc);
1310 return -ENODEV;
1311 }
1312
1313 rc = regulator_enable(reg_ext_3p3v);
1314 if (rc) {
1315 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1316 return -ENODEV;
1317 }
1318
1319 /* set reset pin before power enable */
1320 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1321
1322 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1323 msleep(20);
1324 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1325 msleep(20);
1326 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1327 msleep(20);
1328 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1329 msleep(20);
1330 } else {
1331 gpio_set_value_cansleep(gpio43, 0);
1332 gpio_set_value_cansleep(gpio21, 1);
1333
1334 rc = regulator_disable(reg_l2);
1335 if (rc) {
1336 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1337 return -ENODEV;
1338 }
1339 rc = regulator_disable(reg_ext_3p3v);
1340 if (rc) {
1341 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1342 return -ENODEV;
1343 }
1344 rc = regulator_set_optimum_mode(reg_l2, 100);
1345 if (rc < 0) {
1346 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1347 return -EINVAL;
1348 }
1349 }
1350
1351 return 0;
1352}
1353
1354static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001355{
1356 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001357 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 int rc;
1359
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360 pr_info("%s: state : %d\n", __func__, on);
1361
1362 if (!dsi_power_on) {
1363
1364 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1365 "dsi_vdc");
1366 if (IS_ERR(reg_l8)) {
1367 pr_err("could not get 8921_l8, rc = %ld\n",
1368 PTR_ERR(reg_l8));
1369 return -ENODEV;
1370 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1372 "dsi_vddio");
1373 if (IS_ERR(reg_l23)) {
1374 pr_err("could not get 8921_l23, rc = %ld\n",
1375 PTR_ERR(reg_l23));
1376 return -ENODEV;
1377 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001378 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1379 "dsi_vdda");
1380 if (IS_ERR(reg_l2)) {
1381 pr_err("could not get 8921_l2, rc = %ld\n",
1382 PTR_ERR(reg_l2));
1383 return -ENODEV;
1384 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1386 if (rc) {
1387 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1388 return -EINVAL;
1389 }
1390 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1391 if (rc) {
1392 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1393 return -EINVAL;
1394 }
1395 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1396 if (rc) {
1397 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1398 return -EINVAL;
1399 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001400 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1401 rc = gpio_request(gpio43, "disp_rst_n");
1402 if (rc) {
1403 pr_err("request gpio 43 failed, rc=%d\n", rc);
1404 return -ENODEV;
1405 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406 dsi_power_on = true;
1407 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001408 if (on) {
1409 rc = regulator_set_optimum_mode(reg_l8, 100000);
1410 if (rc < 0) {
1411 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1412 return -EINVAL;
1413 }
1414 rc = regulator_set_optimum_mode(reg_l23, 100000);
1415 if (rc < 0) {
1416 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1417 return -EINVAL;
1418 }
1419 rc = regulator_set_optimum_mode(reg_l2, 100000);
1420 if (rc < 0) {
1421 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1422 return -EINVAL;
1423 }
1424 rc = regulator_enable(reg_l8);
1425 if (rc) {
1426 pr_err("enable l8 failed, rc=%d\n", rc);
1427 return -ENODEV;
1428 }
1429 rc = regulator_enable(reg_l23);
1430 if (rc) {
1431 pr_err("enable l8 failed, rc=%d\n", rc);
1432 return -ENODEV;
1433 }
1434 rc = regulator_enable(reg_l2);
1435 if (rc) {
1436 pr_err("enable l2 failed, rc=%d\n", rc);
1437 return -ENODEV;
1438 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001439 gpio_set_value_cansleep(gpio43, 1);
1440 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001441 rc = regulator_disable(reg_l2);
1442 if (rc) {
1443 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1444 return -ENODEV;
1445 }
1446 rc = regulator_disable(reg_l8);
1447 if (rc) {
1448 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1449 return -ENODEV;
1450 }
1451 rc = regulator_disable(reg_l23);
1452 if (rc) {
1453 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1454 return -ENODEV;
1455 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456 rc = regulator_set_optimum_mode(reg_l8, 100);
1457 if (rc < 0) {
1458 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1459 return -EINVAL;
1460 }
1461 rc = regulator_set_optimum_mode(reg_l23, 100);
1462 if (rc < 0) {
1463 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1464 return -EINVAL;
1465 }
1466 rc = regulator_set_optimum_mode(reg_l2, 100);
1467 if (rc < 0) {
1468 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1469 return -EINVAL;
1470 }
1471 gpio_set_value_cansleep(gpio43, 0);
1472 }
1473 return 0;
1474}
1475
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001476static int mipi_dsi_panel_power(int on)
1477{
1478 int ret;
1479
1480 pr_info("%s: on=%d\n", __func__, on);
1481
1482 if (machine_is_msm8960_liquid())
1483 ret = mipi_dsi_liquid_panel_power(on);
1484 else
1485 ret = mipi_dsi_cdp_panel_power(on);
1486
1487 return ret;
1488}
1489
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1491 .vsync_gpio = MDP_VSYNC_GPIO,
1492 .dsi_power_save = mipi_dsi_panel_power,
1493};
1494
1495#ifdef CONFIG_MSM_BUS_SCALING
1496
1497static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498 {
1499 .src = MSM_BUS_MASTER_MDP_PORT0,
1500 .dst = MSM_BUS_SLAVE_EBI_CH0,
1501 .ab = 0,
1502 .ib = 0,
1503 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001504};
1505
1506static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001507 {
1508 .src = MSM_BUS_MASTER_MDP_PORT0,
1509 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001510 .ab = 216000000 * 2,
1511 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001512 },
1513};
1514
1515static struct msm_bus_vectors mdp_vga_vectors[] = {
1516 /* VGA and less video */
1517 {
1518 .src = MSM_BUS_MASTER_MDP_PORT0,
1519 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001520 .ab = 216000000 * 2,
1521 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001522 },
1523};
1524
1525static struct msm_bus_vectors mdp_720p_vectors[] = {
1526 /* 720p and less video */
1527 {
1528 .src = MSM_BUS_MASTER_MDP_PORT0,
1529 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001530 .ab = 230400000 * 2,
1531 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001532 },
1533};
1534
1535static struct msm_bus_vectors mdp_1080p_vectors[] = {
1536 /* 1080p and less video */
1537 {
1538 .src = MSM_BUS_MASTER_MDP_PORT0,
1539 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001540 .ab = 334080000 * 2,
1541 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 },
1543};
1544
1545static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1546 {
1547 ARRAY_SIZE(mdp_init_vectors),
1548 mdp_init_vectors,
1549 },
1550 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001551 ARRAY_SIZE(mdp_ui_vectors),
1552 mdp_ui_vectors,
1553 },
1554 {
1555 ARRAY_SIZE(mdp_ui_vectors),
1556 mdp_ui_vectors,
1557 },
1558 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001559 ARRAY_SIZE(mdp_vga_vectors),
1560 mdp_vga_vectors,
1561 },
1562 {
1563 ARRAY_SIZE(mdp_720p_vectors),
1564 mdp_720p_vectors,
1565 },
1566 {
1567 ARRAY_SIZE(mdp_1080p_vectors),
1568 mdp_1080p_vectors,
1569 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570};
1571
1572static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1573 mdp_bus_scale_usecases,
1574 ARRAY_SIZE(mdp_bus_scale_usecases),
1575 .name = "mdp",
1576};
1577
1578#endif
1579
1580int mdp_core_clk_rate_table[] = {
1581 85330000,
1582 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001583 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001584 200000000,
1585};
1586
1587static struct msm_panel_common_pdata mdp_pdata = {
1588 .gpio = MDP_VSYNC_GPIO,
1589 .mdp_core_clk_rate = 85330000,
1590 .mdp_core_clk_table = mdp_core_clk_rate_table,
1591 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1592#ifdef CONFIG_MSM_BUS_SCALING
1593 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1594#endif
1595 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001596 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001597};
1598
1599static struct platform_device mipi_dsi_renesas_panel_device = {
1600 .name = "mipi_renesas",
1601 .id = 0,
1602};
1603
1604static struct platform_device mipi_dsi_simulator_panel_device = {
1605 .name = "mipi_simulator",
1606 .id = 0,
1607};
1608
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001609#define LPM_CHANNEL0 0
1610static int toshiba_gpio[] = {LPM_CHANNEL0};
1611
1612static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1613 .gpio = toshiba_gpio,
1614};
1615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616static struct platform_device mipi_dsi_toshiba_panel_device = {
1617 .name = "mipi_toshiba",
1618 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001619 .dev = {
1620 .platform_data = &toshiba_pdata,
1621 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001622};
1623
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001624static int dsi2lvds_gpio[2] = {
1625 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1626 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1627 };
1628
1629static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1630 .gpio_num = dsi2lvds_gpio,
1631};
1632
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001633static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1634
1635/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1636 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1637 /* timing */
1638 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1639 0x0c, 0x03, 0x04, 0xa0},
1640 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1641 {0xff, 0x00, 0x06, 0x00}, /* strength */
1642 /* pll control */
1643 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1644 0x40, 0x07, 0x03,
1645 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1646};
1647
1648static struct mipi_dsi_panel_platform_data novatek_pdata = {
1649 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1650};
1651
1652static struct platform_device mipi_dsi_novatek_panel_device = {
1653 .name = "mipi_novatek",
1654 .id = 0,
1655 .dev = {
1656 .platform_data = &novatek_pdata,
1657 }
1658};
1659
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001660static struct platform_device mipi_dsi2lvds_bridge_device = {
1661 .name = "mipi_tc358764",
1662 .id = 0,
1663 .dev.platform_data = &mipi_dsi2lvds_pdata,
1664};
1665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1667static struct resource hdmi_msm_resources[] = {
1668 {
1669 .name = "hdmi_msm_qfprom_addr",
1670 .start = 0x00700000,
1671 .end = 0x007060FF,
1672 .flags = IORESOURCE_MEM,
1673 },
1674 {
1675 .name = "hdmi_msm_hdmi_addr",
1676 .start = 0x04A00000,
1677 .end = 0x04A00FFF,
1678 .flags = IORESOURCE_MEM,
1679 },
1680 {
1681 .name = "hdmi_msm_irq",
1682 .start = HDMI_IRQ,
1683 .end = HDMI_IRQ,
1684 .flags = IORESOURCE_IRQ,
1685 },
1686};
1687
1688static int hdmi_enable_5v(int on);
1689static int hdmi_core_power(int on, int show);
1690static int hdmi_cec_power(int on);
1691
1692static struct msm_hdmi_platform_data hdmi_msm_data = {
1693 .irq = HDMI_IRQ,
1694 .enable_5v = hdmi_enable_5v,
1695 .core_power = hdmi_core_power,
1696 .cec_power = hdmi_cec_power,
1697};
1698
1699static struct platform_device hdmi_msm_device = {
1700 .name = "hdmi_msm",
1701 .id = 0,
1702 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1703 .resource = hdmi_msm_resources,
1704 .dev.platform_data = &hdmi_msm_data,
1705};
1706#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1707
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001708#ifdef CONFIG_MSM_BUS_SCALING
1709static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1710 {
1711 .src = MSM_BUS_MASTER_MDP_PORT0,
1712 .dst = MSM_BUS_SLAVE_EBI_CH0,
1713 .ab = 0,
1714 .ib = 0,
1715 },
1716};
1717static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1718 {
1719 .src = MSM_BUS_MASTER_MDP_PORT0,
1720 .dst = MSM_BUS_SLAVE_EBI_CH0,
1721 .ab = 566092800 * 2,
1722 .ib = 707616000 * 2,
1723 },
1724};
1725static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1726 {
1727 ARRAY_SIZE(dtv_bus_init_vectors),
1728 dtv_bus_init_vectors,
1729 },
1730 {
1731 ARRAY_SIZE(dtv_bus_def_vectors),
1732 dtv_bus_def_vectors,
1733 },
1734};
1735static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1736 dtv_bus_scale_usecases,
1737 ARRAY_SIZE(dtv_bus_scale_usecases),
1738 .name = "dtv",
1739};
1740
1741static struct lcdc_platform_data dtv_pdata = {
1742 .bus_scale_table = &dtv_bus_scale_pdata,
1743};
1744#endif
1745
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001746static void __init msm_fb_add_devices(void)
1747{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001748 struct platform_device *ptr = NULL;
1749
1750 if (machine_is_msm8960_liquid())
1751 ptr = &mipi_dsi2lvds_bridge_device;
1752 else
1753 ptr = &mipi_dsi_toshiba_panel_device;
1754 platform_add_devices(&ptr, 1);
1755
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001756 if (machine_is_msm8x60_rumi3()) {
1757 msm_fb_register_device("mdp", NULL);
1758 mipi_dsi_pdata.target_type = 1;
1759 } else
1760 msm_fb_register_device("mdp", &mdp_pdata);
1761 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001762#ifdef CONFIG_MSM_BUS_SCALING
1763 msm_fb_register_device("dtv", &dtv_pdata);
1764#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765}
1766
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001767static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1768 .func = GPIOMUX_FUNC_GPIO,
1769 .drv = GPIOMUX_DRV_2MA,
1770 .pull = GPIOMUX_PULL_DOWN,
1771};
1772
1773static struct gpiomux_setting mdp_vsync_active_cfg = {
1774 .func = GPIOMUX_FUNC_1,
1775 .drv = GPIOMUX_DRV_2MA,
1776 .pull = GPIOMUX_PULL_DOWN,
1777};
1778
1779static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1780 {
1781 .gpio = MDP_VSYNC_GPIO,
1782 .settings = {
1783 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1784 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1785 },
1786 }
1787};
1788
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1790static struct gpiomux_setting hdmi_suspend_cfg = {
1791 .func = GPIOMUX_FUNC_GPIO,
1792 .drv = GPIOMUX_DRV_2MA,
1793 .pull = GPIOMUX_PULL_DOWN,
1794};
1795
1796static struct gpiomux_setting hdmi_active_1_cfg = {
1797 .func = GPIOMUX_FUNC_1,
1798 .drv = GPIOMUX_DRV_2MA,
1799 .pull = GPIOMUX_PULL_UP,
1800};
1801
1802static struct gpiomux_setting hdmi_active_2_cfg = {
1803 .func = GPIOMUX_FUNC_1,
1804 .drv = GPIOMUX_DRV_2MA,
1805 .pull = GPIOMUX_PULL_DOWN,
1806};
1807
1808static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1809 {
1810 .gpio = 99,
1811 .settings = {
1812 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1813 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1814 },
1815 },
1816 {
1817 .gpio = 100,
1818 .settings = {
1819 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1820 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1821 },
1822 },
1823 {
1824 .gpio = 101,
1825 .settings = {
1826 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1827 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1828 },
1829 },
1830 {
1831 .gpio = 102,
1832 .settings = {
1833 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1834 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1835 },
1836 },
1837};
1838
1839static int hdmi_enable_5v(int on)
1840{
1841 /* TBD: PM8921 regulator instead of 8901 */
1842 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1843 static int prev_on;
1844 int rc;
1845
1846 if (on == prev_on)
1847 return 0;
1848
1849 if (!reg_8921_hdmi_mvs)
1850 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1851 "hdmi_mvs");
1852
1853 if (on) {
1854 rc = regulator_enable(reg_8921_hdmi_mvs);
1855 if (rc) {
1856 pr_err("'%s' regulator enable failed, rc=%d\n",
1857 "8921_hdmi_mvs", rc);
1858 return rc;
1859 }
1860 pr_debug("%s(on): success\n", __func__);
1861 } else {
1862 rc = regulator_disable(reg_8921_hdmi_mvs);
1863 if (rc)
1864 pr_warning("'%s' regulator disable failed, rc=%d\n",
1865 "8921_hdmi_mvs", rc);
1866 pr_debug("%s(off): success\n", __func__);
1867 }
1868
1869 prev_on = on;
1870
1871 return 0;
1872}
1873
1874static int hdmi_core_power(int on, int show)
1875{
1876 static struct regulator *reg_8921_l23, *reg_8921_s4;
1877 static int prev_on;
1878 int rc;
1879
1880 if (on == prev_on)
1881 return 0;
1882
1883 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001884 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001885 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001886 if (IS_ERR(reg_8921_l23)) {
1887 pr_err("could not get reg_8921_l23, rc = %ld\n",
1888 PTR_ERR(reg_8921_l23));
1889 return -ENODEV;
1890 }
1891 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1892 if (rc) {
1893 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1894 return -EINVAL;
1895 }
1896 }
1897 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001898 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001899 if (IS_ERR(reg_8921_s4)) {
1900 pr_err("could not get reg_8921_s4, rc = %ld\n",
1901 PTR_ERR(reg_8921_s4));
1902 return -ENODEV;
1903 }
1904 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1905 if (rc) {
1906 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1907 return -EINVAL;
1908 }
1909 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910
1911 if (on) {
1912 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1913 if (rc < 0) {
1914 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1915 return -EINVAL;
1916 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001917 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001918 if (rc) {
1919 pr_err("'%s' regulator enable failed, rc=%d\n",
1920 "hdmi_avdd", rc);
1921 return rc;
1922 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001923 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001924 if (rc) {
1925 pr_err("'%s' regulator enable failed, rc=%d\n",
1926 "hdmi_vcc", rc);
1927 return rc;
1928 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929 rc = gpio_request(100, "HDMI_DDC_CLK");
1930 if (rc) {
1931 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1932 "HDMI_DDC_CLK", 100, rc);
1933 goto error1;
1934 }
1935 rc = gpio_request(101, "HDMI_DDC_DATA");
1936 if (rc) {
1937 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1938 "HDMI_DDC_DATA", 101, rc);
1939 goto error2;
1940 }
1941 rc = gpio_request(102, "HDMI_HPD");
1942 if (rc) {
1943 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1944 "HDMI_HPD", 102, rc);
1945 goto error3;
1946 }
1947 pr_debug("%s(on): success\n", __func__);
1948 } else {
1949 gpio_free(100);
1950 gpio_free(101);
1951 gpio_free(102);
1952
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001953 rc = regulator_disable(reg_8921_l23);
1954 if (rc) {
1955 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1956 return -ENODEV;
1957 }
1958 rc = regulator_disable(reg_8921_s4);
1959 if (rc) {
1960 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1961 return -ENODEV;
1962 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001963 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1964 if (rc < 0) {
1965 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1966 return -EINVAL;
1967 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001968 pr_debug("%s(off): success\n", __func__);
1969 }
1970
1971 prev_on = on;
1972
1973 return 0;
1974
1975error3:
1976 gpio_free(101);
1977error2:
1978 gpio_free(100);
1979error1:
1980 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001981 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982 return rc;
1983}
1984
1985static int hdmi_cec_power(int on)
1986{
1987 static int prev_on;
1988 int rc;
1989
1990 if (on == prev_on)
1991 return 0;
1992
1993 if (on) {
1994 rc = gpio_request(99, "HDMI_CEC_VAR");
1995 if (rc) {
1996 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1997 "HDMI_CEC_VAR", 99, rc);
1998 goto error;
1999 }
2000 pr_debug("%s(on): success\n", __func__);
2001 } else {
2002 gpio_free(99);
2003 pr_debug("%s(off): success\n", __func__);
2004 }
2005
2006 prev_on = on;
2007
2008 return 0;
2009error:
2010 return rc;
2011}
2012#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2013
2014static void __init msm8960_allocate_memory_regions(void)
2015{
2016 void *addr;
2017 unsigned long size;
2018
2019 size = MSM_FB_SIZE;
2020 addr = alloc_bootmem_align(size, 0x1000);
2021 msm_fb_resources[0].start = __pa(addr);
2022 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2023 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2024 size, addr, __pa(addr));
2025
2026}
2027#ifdef CONFIG_WCD9310_CODEC
2028
2029#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2030
Patrick Lai3043fba2011-08-01 14:15:57 -07002031/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2032 * 4 micbiases are used to power various analog and digital
2033 * microphones operating at 1800 mV. Technically, all micbiases
2034 * can source from single cfilter since all microphones operate
2035 * at the same voltage level. The arrangement below is to make
2036 * sure all cfilters are exercised. LDO_H regulator ouput level
2037 * does not need to be as high as 2.85V. It is choosen for
2038 * microphone sensitivity purpose.
2039 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002040static struct tabla_pdata tabla_platform_data = {
2041 .slimbus_slave_device = {
2042 .name = "tabla-slave",
2043 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2044 },
2045 .irq = MSM_GPIO_TO_INT(62),
2046 .irq_base = TABLA_INTERRUPT_BASE,
2047 .num_irqs = NR_TABLA_IRQS,
2048 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002049 .micbias = {
2050 .ldoh_v = TABLA_LDOH_2P85_V,
2051 .cfilt1_mv = 1800,
2052 .cfilt2_mv = 1800,
2053 .cfilt3_mv = 1800,
2054 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2055 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2056 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2057 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2058 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002059};
2060
2061static struct slim_device msm_slim_tabla = {
2062 .name = "tabla-slim",
2063 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2064 .dev = {
2065 .platform_data = &tabla_platform_data,
2066 },
2067};
2068#endif
2069
2070static struct slim_boardinfo msm_slim_devices[] = {
2071#ifdef CONFIG_WCD9310_CODEC
2072 {
2073 .bus_num = 1,
2074 .slim_slave = &msm_slim_tabla,
2075 },
2076#endif
2077 /* add more slimbus slaves as needed */
2078};
2079
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002080#define MSM_WCNSS_PHYS 0x03000000
2081#define MSM_WCNSS_SIZE 0x280000
2082
2083static struct resource resources_wcnss_wlan[] = {
2084 {
2085 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2086 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2087 .name = "wcnss_wlanrx_irq",
2088 .flags = IORESOURCE_IRQ,
2089 },
2090 {
2091 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2092 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2093 .name = "wcnss_wlantx_irq",
2094 .flags = IORESOURCE_IRQ,
2095 },
2096 {
2097 .start = MSM_WCNSS_PHYS,
2098 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2099 .name = "wcnss_mmio",
2100 .flags = IORESOURCE_MEM,
2101 },
2102};
2103
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002104static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2105 .has_48mhz_xo = 1,
2106};
2107
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002108static struct platform_device msm_device_wcnss_wlan = {
2109 .name = "wcnss_wlan",
2110 .id = 0,
2111 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2112 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002113 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002114};
2115
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002116#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2117 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2118 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2119 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2120
2121#define QCE_SIZE 0x10000
2122#define QCE_0_BASE 0x18500000
2123
2124#define QCE_HW_KEY_SUPPORT 0
2125#define QCE_SHA_HMAC_SUPPORT 1
2126#define QCE_SHARE_CE_RESOURCE 1
2127#define QCE_CE_SHARED 0
2128
2129static struct resource qcrypto_resources[] = {
2130 [0] = {
2131 .start = QCE_0_BASE,
2132 .end = QCE_0_BASE + QCE_SIZE - 1,
2133 .flags = IORESOURCE_MEM,
2134 },
2135 [1] = {
2136 .name = "crypto_channels",
2137 .start = DMOV_CE_IN_CHAN,
2138 .end = DMOV_CE_OUT_CHAN,
2139 .flags = IORESOURCE_DMA,
2140 },
2141 [2] = {
2142 .name = "crypto_crci_in",
2143 .start = DMOV_CE_IN_CRCI,
2144 .end = DMOV_CE_IN_CRCI,
2145 .flags = IORESOURCE_DMA,
2146 },
2147 [3] = {
2148 .name = "crypto_crci_out",
2149 .start = DMOV_CE_OUT_CRCI,
2150 .end = DMOV_CE_OUT_CRCI,
2151 .flags = IORESOURCE_DMA,
2152 },
2153};
2154
2155static struct resource qcedev_resources[] = {
2156 [0] = {
2157 .start = QCE_0_BASE,
2158 .end = QCE_0_BASE + QCE_SIZE - 1,
2159 .flags = IORESOURCE_MEM,
2160 },
2161 [1] = {
2162 .name = "crypto_channels",
2163 .start = DMOV_CE_IN_CHAN,
2164 .end = DMOV_CE_OUT_CHAN,
2165 .flags = IORESOURCE_DMA,
2166 },
2167 [2] = {
2168 .name = "crypto_crci_in",
2169 .start = DMOV_CE_IN_CRCI,
2170 .end = DMOV_CE_IN_CRCI,
2171 .flags = IORESOURCE_DMA,
2172 },
2173 [3] = {
2174 .name = "crypto_crci_out",
2175 .start = DMOV_CE_OUT_CRCI,
2176 .end = DMOV_CE_OUT_CRCI,
2177 .flags = IORESOURCE_DMA,
2178 },
2179};
2180
2181#endif
2182
2183#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2184 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2185
2186static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2187 .ce_shared = QCE_CE_SHARED,
2188 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2189 .hw_key_support = QCE_HW_KEY_SUPPORT,
2190 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2191};
2192
2193static struct platform_device qcrypto_device = {
2194 .name = "qcrypto",
2195 .id = 0,
2196 .num_resources = ARRAY_SIZE(qcrypto_resources),
2197 .resource = qcrypto_resources,
2198 .dev = {
2199 .coherent_dma_mask = DMA_BIT_MASK(32),
2200 .platform_data = &qcrypto_ce_hw_suppport,
2201 },
2202};
2203#endif
2204
2205#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2206 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2207
2208static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2209 .ce_shared = QCE_CE_SHARED,
2210 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2211 .hw_key_support = QCE_HW_KEY_SUPPORT,
2212 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2213};
2214
2215static struct platform_device qcedev_device = {
2216 .name = "qce",
2217 .id = 0,
2218 .num_resources = ARRAY_SIZE(qcedev_resources),
2219 .resource = qcedev_resources,
2220 .dev = {
2221 .coherent_dma_mask = DMA_BIT_MASK(32),
2222 .platform_data = &qcedev_ce_hw_suppport,
2223 },
2224};
2225#endif
2226
2227
2228static int __init gpiomux_init(void)
2229{
2230 int rc;
2231
2232 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2233 if (rc) {
2234 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2235 return rc;
2236 }
2237
Nishant Pandit24153d82011-08-27 16:05:13 +05302238 msm_gpiomux_install(msm8960_cam_common_configs,
2239 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240
2241 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002242 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002243
2244 msm_gpiomux_install(msm8960_gsbi_configs,
2245 ARRAY_SIZE(msm8960_gsbi_configs));
2246
2247 msm_gpiomux_install(msm8960_cyts_configs,
2248 ARRAY_SIZE(msm8960_cyts_configs));
2249
2250 msm_gpiomux_install(msm8960_slimbus_config,
2251 ARRAY_SIZE(msm8960_slimbus_config));
2252
2253 msm_gpiomux_install(msm8960_audio_codec_configs,
2254 ARRAY_SIZE(msm8960_audio_codec_configs));
2255
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002256 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2257 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2258
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2260 msm_gpiomux_install(msm8960_hdmi_configs,
2261 ARRAY_SIZE(msm8960_hdmi_configs));
2262#endif
2263
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002264 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2265 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2266
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 msm_gpiomux_install(wcnss_5wire_interface,
2268 ARRAY_SIZE(wcnss_5wire_interface));
2269
2270 return 0;
2271}
2272
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273#define MSM_SHARED_RAM_PHYS 0x80000000
2274
2275static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2276 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2277 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2278 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2279 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2280 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2281 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2282 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2283 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2284 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2285 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2286 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2287 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002288 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2289 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2290 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2291 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2292 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2293 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2294 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2295 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2296 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2297 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2298 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2299 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2300 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2301 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002302 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002303 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2304 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2305 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002306 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2307 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002308};
2309
2310static struct pm8921_adc_properties pm8921_adc_data = {
2311 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2312 .bitresolution = 15,
2313 .bipolar = 0,
2314};
2315
2316static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2317 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002318 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002319 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002320 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002321};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002322
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002323static void __init msm8960_map_io(void)
2324{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002326 msm_map_msm8960_io();
2327}
2328
2329static void __init msm8960_init_irq(void)
2330{
2331 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002332
2333 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002334 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002335 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002336
2337 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002339
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002340 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2341 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002342
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002343 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2344 * as they are configured as level, which does not play nice with
2345 * handle_percpu_irq.
2346 */
2347 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2348 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002349 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002350 }
2351}
2352
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002353/* MSM8960 have 5 SDCC controllers */
2354enum sdcc_controllers {
2355 SDCC1,
2356 SDCC2,
2357 SDCC3,
2358 SDCC4,
2359 SDCC5,
2360 MAX_SDCC_CONTROLLER
2361};
2362
2363/* All SDCC controllers requires VDD/VCC voltage */
2364static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2365 /* SDCC1 : eMMC card connected */
2366 [SDCC1] = {
2367 .name = "sdc_vdd",
2368 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302369 .high_vol_level = 2950000,
2370 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302371 .always_on = 1,
2372 .lpm_sup = 1,
2373 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002374 .hpm_uA = 200000, /* 200mA */
2375 },
2376 /* SDCC3 : External card slot connected */
2377 [SDCC3] = {
2378 .name = "sdc_vdd",
2379 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302380 .high_vol_level = 2950000,
2381 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002382 .hpm_uA = 600000, /* 600mA */
2383 }
2384};
2385
2386/* Only slots having eMMC card will require VCCQ voltage */
2387static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2388 /* SDCC1 : eMMC card connected */
2389 [SDCC1] = {
2390 .name = "sdc_vccq",
2391 .set_voltage_sup = 1,
2392 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302393 .high_vol_level = 1800000,
2394 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002395 .hpm_uA = 200000, /* 200mA */
2396 }
2397};
2398
2399/* All SDCC controllers may require voting for VDD PAD voltage */
2400static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2401 /* SDCC3 : External card slot connected */
2402 [SDCC3] = {
2403 .name = "sdc_vddp",
2404 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302405 .high_vol_level = 2950000,
2406 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002407 .always_on = 1,
2408 .lpm_sup = 1,
2409 /* Max. Active current required is 16 mA */
2410 .hpm_uA = 16000,
2411 /*
2412 * Sleep current required is ~300 uA. But min. vote can be
2413 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2414 * during sleep.
2415 */
2416 .lpm_uA = 2000,
2417 }
2418};
2419
2420static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2421 /* SDCC1 : eMMC card connected */
2422 [SDCC1] = {
2423 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2424 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2425 },
2426 /* SDCC3 : External card slot connected */
2427 [SDCC3] = {
2428 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2429 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2430 }
2431};
2432
2433/* SDC1 pad data */
2434static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2435 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302436 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2437 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002438};
2439
2440static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2441 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2442 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2443 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2444};
2445
2446static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302447 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002448 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2449 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2450};
2451
2452static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302453 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002454 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2455 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2456};
2457
2458/* SDC3 pad data */
2459static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2460 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2461 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2462 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2463};
2464
2465static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2466 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2467 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2468 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2469};
2470
2471static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302472 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2474 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2475};
2476
2477static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302478 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002479 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2480 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2481};
2482
2483struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2484 [SDCC1] = {
2485 .on = sdc1_pad_pull_on_cfg,
2486 .off = sdc1_pad_pull_off_cfg,
2487 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2488 },
2489 [SDCC3] = {
2490 .on = sdc3_pad_pull_on_cfg,
2491 .off = sdc3_pad_pull_off_cfg,
2492 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2493 },
2494};
2495
2496struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2497 [SDCC1] = {
2498 .on = sdc1_pad_drv_on_cfg,
2499 .off = sdc1_pad_drv_off_cfg,
2500 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2501 },
2502 [SDCC3] = {
2503 .on = sdc3_pad_drv_on_cfg,
2504 .off = sdc3_pad_drv_off_cfg,
2505 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2506 },
2507};
2508
2509struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2510 [SDCC1] = {
2511 .pull = &mmc_pad_pull_data[SDCC1],
2512 .drv = &mmc_pad_drv_data[SDCC1]
2513 },
2514 [SDCC3] = {
2515 .pull = &mmc_pad_pull_data[SDCC3],
2516 .drv = &mmc_pad_drv_data[SDCC3]
2517 },
2518};
2519
2520struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2521 [SDCC1] = {
2522 .pad_data = &mmc_pad_data[SDCC1],
2523 },
2524 [SDCC3] = {
2525 .pad_data = &mmc_pad_data[SDCC3],
2526 },
2527};
2528
2529static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302530 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002531};
2532
2533static unsigned int sdc3_sup_clk_rates[] = {
2534 400000, 24000000, 48000000, 96000000
2535};
2536
2537#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2538static struct mmc_platform_data msm8960_sdc1_data = {
2539 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2540#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2541 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2542#else
2543 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2544#endif
2545 .sup_clk_table = sdc1_sup_clk_rates,
2546 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302547 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002548 .nonremovable = 1,
2549 .sdcc_v4_sup = true,
2550 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302551 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002552};
2553#endif
2554
2555#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2556static struct mmc_platform_data msm8960_sdc3_data = {
2557 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2558 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2559 .sup_clk_table = sdc3_sup_clk_rates,
2560 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302561 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302562#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002563 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302564#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002565 .sdcc_v4_sup = true,
2566 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2567 .pin_data = &mmc_slot_pin_data[SDCC3],
2568#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2569 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2570 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2571 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2572#endif
2573 .xpc_cap = 1,
2574 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2575 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302576 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577};
2578#endif
2579
2580static void __init msm8960_init_mmc(void)
2581{
2582#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2583 /* SDC1 : eMMC card connected */
2584 msm_add_sdcc(1, &msm8960_sdc1_data);
2585#endif
2586#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2587 /* SDC3: External card slot */
2588 msm_add_sdcc(3, &msm8960_sdc3_data);
2589#endif
2590}
2591
2592static void __init msm8960_init_buses(void)
2593{
2594#ifdef CONFIG_MSM_BUS_SCALING
2595 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2596 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2597 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2598 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2599 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2600 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2601 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2602 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2603 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2604 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2605#endif
2606}
2607
2608static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2609 .max_clock_speed = 15060000,
2610};
2611
2612#ifdef CONFIG_USB_MSM_OTG_72K
2613static struct msm_otg_platform_data msm_otg_pdata;
2614#else
2615#define USB_5V_EN 42
2616static void msm_hsusb_vbus_power(bool on)
2617{
2618 int rc;
2619 static bool vbus_is_on;
2620 static struct regulator *mvs_otg_switch;
2621 struct pm_gpio param = {
2622 .direction = PM_GPIO_DIR_OUT,
2623 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2624 .output_value = 1,
2625 .pull = PM_GPIO_PULL_NO,
2626 .vin_sel = PM_GPIO_VIN_S4,
2627 .out_strength = PM_GPIO_STRENGTH_MED,
2628 .function = PM_GPIO_FUNC_NORMAL,
2629 };
2630
2631 if (vbus_is_on == on)
2632 return;
2633
2634 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002635 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2636 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002637 if (IS_ERR(mvs_otg_switch)) {
2638 pr_err("Unable to get mvs_otg_switch\n");
2639 return;
2640 }
2641
2642 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2643 "usb_5v_en");
2644 if (rc < 0) {
2645 pr_err("failed to request usb_5v_en gpio\n");
2646 goto put_mvs_otg;
2647 }
2648
2649 if (regulator_enable(mvs_otg_switch)) {
2650 pr_err("unable to enable mvs_otg_switch\n");
2651 goto free_usb_5v_en;
2652 }
2653
2654 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2655 &param);
2656 if (rc < 0) {
2657 pr_err("failed to configure usb_5v_en gpio\n");
2658 goto disable_mvs_otg;
2659 }
2660 vbus_is_on = true;
2661 return;
2662 }
2663disable_mvs_otg:
2664 regulator_disable(mvs_otg_switch);
2665free_usb_5v_en:
2666 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2667put_mvs_otg:
2668 regulator_put(mvs_otg_switch);
2669 vbus_is_on = false;
2670}
2671
2672static struct msm_otg_platform_data msm_otg_pdata = {
2673 .mode = USB_OTG,
2674 .otg_control = OTG_PMIC_CONTROL,
2675 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2676 .pclk_src_name = "dfab_usb_hs_clk",
2677 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2678 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302679 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002680};
2681#endif
2682
2683#define PID_MAGIC_ID 0x71432909
2684#define SERIAL_NUM_MAGIC_ID 0x61945374
2685#define SERIAL_NUMBER_LENGTH 127
2686#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2687
2688struct magic_num_struct {
2689 uint32_t pid;
2690 uint32_t serial_num;
2691};
2692
2693struct dload_struct {
2694 uint32_t reserved1;
2695 uint32_t reserved2;
2696 uint32_t reserved3;
2697 uint16_t reserved4;
2698 uint16_t pid;
2699 char serial_number[SERIAL_NUMBER_LENGTH];
2700 uint16_t reserved5;
2701 struct magic_num_struct magic_struct;
2702};
2703
2704static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2705{
2706 struct dload_struct __iomem *dload = 0;
2707
2708 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2709 if (!dload) {
2710 pr_err("%s: cannot remap I/O memory region: %08x\n",
2711 __func__, DLOAD_USB_BASE_ADD);
2712 return -ENXIO;
2713 }
2714
2715 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2716 __func__, dload, pid, snum);
2717 /* update pid */
2718 dload->magic_struct.pid = PID_MAGIC_ID;
2719 dload->pid = pid;
2720
2721 /* update serial number */
2722 dload->magic_struct.serial_num = 0;
2723 if (!snum) {
2724 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2725 goto out;
2726 }
2727
2728 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2729 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2730 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2731out:
2732 iounmap(dload);
2733 return 0;
2734}
2735
2736static struct android_usb_platform_data android_usb_pdata = {
2737 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2738};
2739
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002740static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002741 .name = "android_usb",
2742 .id = -1,
2743 .dev = {
2744 .platform_data = &android_usb_pdata,
2745 },
2746};
2747
2748static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2749 0x03, 0x0f,
2750};
2751
2752static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2753 0x00, 0x24, 0x54, 0x10,
2754 0x09, 0x03, 0x01,
2755 0x10, 0x54, 0x30, 0x0C,
2756 0x24, 0x30, 0x0f,
2757};
2758
2759static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2760 0x00, 0x24, 0x54, 0x10,
2761 0x09, 0x07, 0x01, 0x0B,
2762 0x10, 0x54, 0x30, 0x0C,
2763 0x24, 0x30, 0x0f,
2764};
2765
2766static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2767 [0] = {
2768 .mode = MSM_SPM_MODE_CLOCK_GATING,
2769 .notify_rpm = false,
2770 .cmd = spm_wfi_cmd_sequence,
2771 },
2772 [1] = {
2773 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2774 .notify_rpm = false,
2775 .cmd = spm_power_collapse_without_rpm,
2776 },
2777 [2] = {
2778 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2779 .notify_rpm = true,
2780 .cmd = spm_power_collapse_with_rpm,
2781 },
2782};
2783
2784static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2785 [0] = {
2786 .reg_base_addr = MSM_SAW0_BASE,
2787 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2788 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2789 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2790#if defined(CONFIG_MSM_AVS_HW)
2791 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2792 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2793#endif
2794 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2795 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2796 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2797 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2798 .vctl_timeout_us = 50,
2799 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2800 .modes = msm_spm_seq_list,
2801 },
2802 [1] = {
2803 .reg_base_addr = MSM_SAW1_BASE,
2804 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2805 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2806 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2807#if defined(CONFIG_MSM_AVS_HW)
2808 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2809 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2810#endif
2811 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2812 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2813 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2814 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2815 .vctl_timeout_us = 50,
2816 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2817 .modes = msm_spm_seq_list,
2818 },
2819};
2820
2821static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2822 0x00, 0x20, 0x03, 0x20,
2823 0x00, 0x0f,
2824};
2825
2826static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2827 0x00, 0x20, 0x34, 0x64,
2828 0x48, 0x07, 0x48, 0x20,
2829 0x50, 0x64, 0x04, 0x34,
2830 0x50, 0x0f,
2831};
2832static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2833 0x00, 0x10, 0x34, 0x64,
2834 0x48, 0x07, 0x48, 0x10,
2835 0x50, 0x64, 0x04, 0x34,
2836 0x50, 0x0F,
2837};
2838
2839static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2840 [0] = {
2841 .mode = MSM_SPM_L2_MODE_RETENTION,
2842 .notify_rpm = false,
2843 .cmd = l2_spm_wfi_cmd_sequence,
2844 },
2845 [1] = {
2846 .mode = MSM_SPM_L2_MODE_GDHS,
2847 .notify_rpm = true,
2848 .cmd = l2_spm_gdhs_cmd_sequence,
2849 },
2850 [2] = {
2851 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2852 .notify_rpm = true,
2853 .cmd = l2_spm_power_off_cmd_sequence,
2854 },
2855};
2856
2857
2858static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2859 [0] = {
2860 .reg_base_addr = MSM_SAW_L2_BASE,
2861 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2862 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2863 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2864 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2865 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2866 .modes = msm_spm_l2_seq_list,
2867 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2868 },
2869};
2870
2871#define CYTTSP_TS_GPIO_IRQ 11
2872#define CYTTSP_TS_SLEEP_GPIO 50
2873#define CYTTSP_TS_RESOUT_N_GPIO 52
2874
2875/*virtual key support */
2876static ssize_t tma340_vkeys_show(struct kobject *kobj,
2877 struct kobj_attribute *attr, char *buf)
2878{
2879 return snprintf(buf, 200,
2880 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2881 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2882 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2883 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2884 "\n");
2885}
2886
2887static struct kobj_attribute tma340_vkeys_attr = {
2888 .attr = {
2889 .mode = S_IRUGO,
2890 },
2891 .show = &tma340_vkeys_show,
2892};
2893
2894static struct attribute *tma340_properties_attrs[] = {
2895 &tma340_vkeys_attr.attr,
2896 NULL
2897};
2898
2899static struct attribute_group tma340_properties_attr_group = {
2900 .attrs = tma340_properties_attrs,
2901};
2902
2903
2904static int cyttsp_platform_init(struct i2c_client *client)
2905{
2906 int rc = 0;
2907 static struct kobject *tma340_properties_kobj;
2908
2909 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2910 tma340_properties_kobj = kobject_create_and_add("board_properties",
2911 NULL);
2912 if (tma340_properties_kobj)
2913 rc = sysfs_create_group(tma340_properties_kobj,
2914 &tma340_properties_attr_group);
2915 if (!tma340_properties_kobj || rc)
2916 pr_err("%s: failed to create board_properties\n",
2917 __func__);
2918
2919 return 0;
2920}
2921
2922static struct cyttsp_regulator regulator_data[] = {
2923 {
2924 .name = "vdd",
2925 .min_uV = CY_TMA300_VTG_MIN_UV,
2926 .max_uV = CY_TMA300_VTG_MAX_UV,
2927 .load_uA = CY_TMA300_CURR_24HZ_UA,
2928 },
2929 /* TODO: Remove after runtime PM is enabled in I2C driver */
2930 {
2931 .name = "vcc_i2c",
2932 .min_uV = CY_I2C_VTG_MIN_UV,
2933 .max_uV = CY_I2C_VTG_MAX_UV,
2934 .load_uA = CY_I2C_CURR_UA,
2935 },
2936};
2937
2938static struct cyttsp_platform_data cyttsp_pdata = {
2939 .panel_maxx = 634,
2940 .panel_maxy = 1166,
2941 .disp_maxx = 616,
2942 .disp_maxy = 1023,
2943 .disp_minx = 0,
2944 .disp_miny = 16,
2945 .flags = 0x01,
2946 .gen = CY_GEN3, /* or */
2947 .use_st = CY_USE_ST,
2948 .use_mt = CY_USE_MT,
2949 .use_hndshk = CY_SEND_HNDSHK,
2950 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302951 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002952 .use_gestures = CY_USE_GESTURES,
2953 .fw_fname = "cyttsp_8960_cdp.hex",
2954 /* activate up to 4 groups
2955 * and set active distance
2956 */
2957 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2958 CY_GEST_GRP3 | CY_GEST_GRP4 |
2959 CY_ACT_DIST,
2960 /* change act_intrvl to customize the Active power state
2961 * scanning/processing refresh interval for Operating mode
2962 */
2963 .act_intrvl = CY_ACT_INTRVL_DFLT,
2964 /* change tch_tmout to customize the touch timeout for the
2965 * Active power state for Operating mode
2966 */
2967 .tch_tmout = CY_TCH_TMOUT_DFLT,
2968 /* change lp_intrvl to customize the Low Power power state
2969 * scanning/processing refresh interval for Operating mode
2970 */
2971 .lp_intrvl = CY_LP_INTRVL_DFLT,
2972 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2973 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2974 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2975 .regulator_info = regulator_data,
2976 .num_regulators = ARRAY_SIZE(regulator_data),
2977 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302978 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002979};
2980
2981static struct i2c_board_info cyttsp_info[] __initdata = {
2982 {
2983 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2984 .platform_data = &cyttsp_pdata,
2985#ifndef CY_USE_TIMER
2986 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2987#endif /* CY_USE_TIMER */
2988 },
2989};
2990
Mohan Pallaka50837382011-09-07 11:00:57 +05302991/* configuration data */
2992static const u8 mxt_config_data[] = {
2993 /* T6 Object */
2994 0, 0, 0, 0, 0, 0,
2995 /* T38 Object */
2996 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
2997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3002 0, 0, 0, 0,
3003 /* T7 Object */
3004 10, 10, 50,
3005 /* T8 Object */
3006 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3007 /* T9 Object */
3008 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3009 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3010 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3011 0, 5, 45, 46,
3012 /* T15 Object */
3013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3014 0,
3015 /* T22 Object */
3016 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3017 0, 0, 255, 255, 255, 255, 0,
3018 /* T24 Object */
3019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3020 0, 0, 0, 0, 0, 0, 0, 0, 0,
3021 /* T25 Object */
3022 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3023 0, 0, 0, 0,
3024 /* T27 Object */
3025 0, 0, 0, 0, 0, 0, 0,
3026 /* T28 Object */
3027 0, 0, 0, 8, 8, 8,
3028 /* T40 Object */
3029 0, 0, 0, 0, 0,
3030 /* T41 Object */
3031 0, 0, 0, 0, 0, 0,
3032 /* T43 Object */
3033 0, 0, 0, 0, 0, 0,
3034};
3035
3036#define MXT_TS_GPIO_IRQ 11
3037#define MXT_TS_LDO_EN_GPIO 50
3038#define MXT_TS_RESET_GPIO 52
3039
3040static void mxt_init_hw_liquid(void)
3041{
3042 int rc;
3043
3044 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3045 if (rc) {
3046 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3047 __func__, MXT_TS_GPIO_IRQ);
3048 return;
3049 }
3050
3051 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3052 if (rc) {
3053 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3054 __func__, MXT_TS_GPIO_IRQ);
3055 goto err_irq_gpio_req;
3056 }
3057
3058 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3059 if (rc) {
3060 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3061 __func__, MXT_TS_LDO_EN_GPIO);
3062 goto err_irq_gpio_req;
3063 }
3064
3065 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3066 if (rc) {
3067 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3068 __func__, MXT_TS_LDO_EN_GPIO);
3069 goto err_ldo_gpio_req;
3070 }
3071
3072 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3073 if (rc) {
3074 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3075 __func__, MXT_TS_RESET_GPIO);
3076 goto err_ldo_gpio_set_dir;
3077 }
3078
3079 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3080 if (rc) {
3081 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3082 __func__, MXT_TS_RESET_GPIO);
3083 goto err_reset_gpio_req;
3084 }
3085
3086 return;
3087
3088err_reset_gpio_req:
3089 gpio_free(MXT_TS_RESET_GPIO);
3090err_ldo_gpio_set_dir:
3091 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3092err_ldo_gpio_req:
3093 gpio_free(MXT_TS_LDO_EN_GPIO);
3094err_irq_gpio_req:
3095 gpio_free(MXT_TS_GPIO_IRQ);
3096}
3097
3098static struct mxt_platform_data mxt_platform_data = {
3099 .config = mxt_config_data,
3100 .config_length = ARRAY_SIZE(mxt_config_data),
3101 .x_line = 26,
3102 .y_line = 42,
3103 .x_size = 767,
3104 .y_size = 1365,
3105 .blen = 32,
3106 .threshold = 40,
3107 .voltage = 3300000, /* 3.3V */
3108 .orient = MXT_ROTATED_90,
3109 .irqflags = IRQF_TRIGGER_FALLING,
3110};
3111
3112static struct i2c_board_info mxt_device_info[] __initdata = {
3113 {
3114 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3115 .platform_data = &mxt_platform_data,
3116 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3117 },
3118};
3119
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003120static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3121{
3122}
3123
3124static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3125 .clk_freq = 100000,
3126 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003127 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3128};
3129
3130static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3131 .clk_freq = 100000,
3132 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003133 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3134};
3135
3136static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3137 .clk_freq = 100000,
3138 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003139 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3140};
3141
3142static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3143 .clk_freq = 100000,
3144 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003145 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3146};
3147
3148static struct msm_rpm_platform_data msm_rpm_data = {
3149 .reg_base_addrs = {
3150 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3151 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3152 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3153 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3154 },
3155
3156 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3157 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3158 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3159 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3160 .msm_apps_ipc_rpm_val = 4,
3161};
3162
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003164static struct spi_board_info spi_board_info[] __initdata = {
3165 {
3166 .modalias = "ks8851",
3167 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3168 .max_speed_hz = 19200000,
3169 .bus_num = 0,
3170 .chip_select = 0,
3171 .mode = SPI_MODE_0,
3172 },
3173};
3174
3175static struct platform_device msm_device_saw_core0 = {
3176 .name = "saw-regulator",
3177 .id = 0,
3178 .dev = {
3179 .platform_data = &msm_saw_regulator_pdata_s5,
3180 },
3181};
3182
3183static struct platform_device msm_device_saw_core1 = {
3184 .name = "saw-regulator",
3185 .id = 1,
3186 .dev = {
3187 .platform_data = &msm_saw_regulator_pdata_s6,
3188 },
3189};
3190
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003191static struct tsens_platform_data msm_tsens_pdata = {
3192 .slope = 910,
3193 .tsens_factor = 1000,
3194 .hw_type = MSM_8960,
3195 .tsens_num_sensor = 5,
3196};
3197
3198static struct platform_device msm_tsens_device = {
3199 .name = "tsens8960-tm",
3200 .id = -1,
3201 .dev = {
3202 .platform_data = &msm_tsens_pdata,
3203 },
3204};
3205
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003206#ifdef CONFIG_MSM_FAKE_BATTERY
3207static struct platform_device fish_battery_device = {
3208 .name = "fish_battery",
3209};
3210#endif
3211
David Collins26f05562011-06-20 09:56:28 -07003212static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003213 .name = GPIO_REGULATOR_DEV_NAME,
3214 .id = PM8921_MPP_PM_TO_SYS(7),
3215 .dev = {
3216 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3217 },
3218};
3219
David Collins26f05562011-06-20 09:56:28 -07003220static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003221 .name = GPIO_REGULATOR_DEV_NAME,
3222 .id = 91,
3223 .dev = {
3224 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3225 },
3226};
3227
David Collinsb10be1d2011-09-02 10:29:31 -07003228static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3229 .name = GPIO_REGULATOR_DEV_NAME,
3230 .id = PM8921_GPIO_PM_TO_SYS(17),
3231 .dev = {
3232 .platform_data =
3233 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3234 },
3235};
3236
David Collins26f05562011-06-20 09:56:28 -07003237static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3238 .name = "rpm-regulator",
3239 .id = -1,
3240 .dev = {
3241 .platform_data = &msm_rpm_regulator_pdata,
3242 },
3243};
3244
David Collins4c31a872011-08-31 10:07:10 -07003245static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3246 .phys_addr_base = 0x0010C000,
3247 .reg_offsets = {
3248 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3249 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3250 },
3251 .phys_size = SZ_8K,
3252 .log_len = 4096, /* log's buffer length in bytes */
3253 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3254};
3255
3256static struct platform_device msm_rpm_log_device = {
3257 .name = "msm_rpm_log",
3258 .id = -1,
3259 .dev = {
3260 .platform_data = &msm_rpm_log_pdata,
3261 },
3262};
3263
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003264static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003265 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003266 &msm_device_smd,
3267 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303268 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003269 &msm_device_saw_core0,
3270 &msm_device_saw_core1,
3271 &msm8960_device_ext_5v_vreg,
3272 &msm8960_device_ext_l2_vreg,
3273 &msm8960_device_ssbi_pm8921,
3274 &msm8960_device_qup_spi_gsbi1,
3275 &msm8960_device_qup_i2c_gsbi3,
3276 &msm8960_device_qup_i2c_gsbi4,
3277 &msm8960_device_qup_i2c_gsbi10,
3278#ifndef CONFIG_MSM_DSPS
3279 &msm8960_device_qup_i2c_gsbi12,
3280#endif
3281 &msm_slim_ctrl,
3282 &msm_device_wcnss_wlan,
3283#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3284 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3285 &qcrypto_device,
3286#endif
3287
3288#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3289 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3290 &qcedev_device,
3291#endif
3292#ifdef CONFIG_MSM_ROTATOR
3293 &msm_rotator_device,
3294#endif
3295 &msm_device_sps,
3296#ifdef CONFIG_MSM_FAKE_BATTERY
3297 &fish_battery_device,
3298#endif
3299#ifdef CONFIG_ANDROID_PMEM
3300 &android_pmem_device,
3301 &android_pmem_adsp_device,
3302 &android_pmem_audio_device,
3303#endif
3304 &msm_fb_device,
3305 &msm_device_vidc,
3306 &msm_device_bam_dmux,
3307 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003308
3309#ifdef CONFIG_HW_RANDOM_MSM
3310 &msm_device_rng,
3311#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003312 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003313#ifdef CONFIG_ION_MSM
3314 &ion_dev,
3315#endif
David Collins4c31a872011-08-31 10:07:10 -07003316 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003317#ifdef CONFIG_MSM_QDSS
3318 &msm_etb_device,
3319 &msm_tpiu_device,
3320 &msm_funnel_device,
3321 &msm_ptm_device,
3322#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003323};
3324
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003325static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003326 &msm8960_device_otg,
3327 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003328 &msm_device_hsusb_host,
3329 &android_usb_device,
3330 &msm_device_vidc,
3331 &mipi_dsi_simulator_panel_device,
3332 &msm_bus_apps_fabric,
3333 &msm_bus_sys_fabric,
3334 &msm_bus_mm_fabric,
3335 &msm_bus_sys_fpb,
3336 &msm_bus_cpss_fpb,
3337 &msm_pcm,
3338 &msm_pcm_routing,
3339 &msm_cpudai0,
3340 &msm_cpudai1,
3341 &msm_cpudai_hdmi_rx,
3342 &msm_cpudai_bt_rx,
3343 &msm_cpudai_bt_tx,
3344 &msm_cpudai_fm_rx,
3345 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003346 &msm_cpudai_auxpcm_rx,
3347 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003348 &msm_cpu_fe,
3349 &msm_stub_codec,
3350 &msm_voice,
3351 &msm_voip,
3352 &msm_lpa_pcm,
3353
3354#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3355 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3356 &qcrypto_device,
3357#endif
3358
3359#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3360 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3361 &qcedev_device,
3362#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003363};
3364
3365static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003366 &msm_kgsl_3d0,
3367 &msm_kgsl_2d0,
3368 &msm_kgsl_2d1,
3369 &mipi_dsi_renesas_panel_device,
3370#ifdef CONFIG_MSM_GEMINI
3371 &msm8960_gemini_device,
3372#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003373};
3374
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003375static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003376 &msm8960_device_otg,
3377 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003378 &msm_device_hsusb_host,
3379 &android_usb_device,
3380 &msm_pcm,
3381 &msm_pcm_routing,
3382 &msm_cpudai0,
3383 &msm_cpudai1,
3384 &msm_cpudai_hdmi_rx,
3385 &msm_cpudai_bt_rx,
3386 &msm_cpudai_bt_tx,
3387 &msm_cpudai_fm_rx,
3388 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003389 &msm_cpudai_auxpcm_rx,
3390 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003391 &msm_cpu_fe,
3392 &msm_stub_codec,
3393 &msm_kgsl_3d0,
3394#ifdef CONFIG_MSM_KGSL_2D
3395 &msm_kgsl_2d0,
3396 &msm_kgsl_2d1,
3397#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003398 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003399#ifdef CONFIG_MSM_GEMINI
3400 &msm8960_gemini_device,
3401#endif
3402 &msm_voice,
3403 &msm_voip,
3404 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303405 &msm_cpudai_afe_01_rx,
3406 &msm_cpudai_afe_01_tx,
3407 &msm_cpudai_afe_02_rx,
3408 &msm_cpudai_afe_02_tx,
3409 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003410#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3411 &hdmi_msm_device,
3412#endif
3413 &msm_pcm_hostless,
3414 &msm_bus_apps_fabric,
3415 &msm_bus_sys_fabric,
3416 &msm_bus_mm_fabric,
3417 &msm_bus_sys_fpb,
3418 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003419 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003420};
3421
3422static void __init msm8960_i2c_init(void)
3423{
3424 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3425 &msm8960_i2c_qup_gsbi4_pdata;
3426
3427 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3428 &msm8960_i2c_qup_gsbi3_pdata;
3429
3430 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3431 &msm8960_i2c_qup_gsbi10_pdata;
3432
3433 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3434 &msm8960_i2c_qup_gsbi12_pdata;
3435}
3436
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003437static void __init msm8960_gfx_init(void)
3438{
3439 uint32_t soc_platform_version = socinfo_get_platform_version();
3440 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3441 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3442 msm_kgsl_3d0.dev.platform_data;
3443 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3444 320000000;
3445 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3446 266667000;
3447 }
3448}
3449
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003450static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3451 .irq_base = PM8921_IRQ_BASE,
3452 .devirq = MSM_GPIO_TO_INT(104),
3453 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3454};
3455
3456static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3457 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3458};
3459
3460static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3461 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3462};
3463
3464static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3465 .rtc_write_enable = false,
3466};
3467
3468static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3469 .pull_up = 1,
3470 .kpd_trigger_delay_us = 970,
3471 .wakeup = 1,
3472};
3473
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303474/* Rotate lock key is not available so use F1 */
3475#define KEY_ROTATE_LOCK KEY_F1
3476
3477static const unsigned int keymap_liquid[] = {
3478 KEY(0, 0, KEY_VOLUMEUP),
3479 KEY(0, 1, KEY_VOLUMEDOWN),
3480 KEY(1, 3, KEY_ROTATE_LOCK),
3481 KEY(1, 4, KEY_HOME),
3482};
3483
3484static struct matrix_keymap_data keymap_data_liquid = {
3485 .keymap_size = ARRAY_SIZE(keymap_liquid),
3486 .keymap = keymap_liquid,
3487};
3488
3489static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3490 .input_name = "keypad_8960_liquid",
3491 .input_phys_device = "keypad_8960/input0",
3492 .num_rows = 2,
3493 .num_cols = 5,
3494 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3495 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3496 .debounce_ms = 15,
3497 .scan_delay_ms = 32,
3498 .row_hold_ns = 91500,
3499 .wakeup = 1,
3500 .keymap_data = &keymap_data_liquid,
3501};
3502
3503
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003504static const unsigned int keymap[] = {
3505 KEY(0, 0, KEY_VOLUMEUP),
3506 KEY(0, 1, KEY_VOLUMEDOWN),
3507 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3508 KEY(0, 3, KEY_CAMERA_FOCUS),
3509};
3510
3511static struct matrix_keymap_data keymap_data = {
3512 .keymap_size = ARRAY_SIZE(keymap),
3513 .keymap = keymap,
3514};
3515
3516static struct pm8xxx_keypad_platform_data keypad_data = {
3517 .input_name = "keypad_8960",
3518 .input_phys_device = "keypad_8960/input0",
3519 .num_rows = 1,
3520 .num_cols = 5,
3521 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3522 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3523 .debounce_ms = 15,
3524 .scan_delay_ms = 32,
3525 .row_hold_ns = 91500,
3526 .wakeup = 1,
3527 .keymap_data = &keymap_data,
3528};
3529
3530static const unsigned int keymap_sim[] = {
3531 KEY(0, 0, KEY_7),
3532 KEY(0, 1, KEY_DOWN),
3533 KEY(0, 2, KEY_UP),
3534 KEY(0, 3, KEY_RIGHT),
3535 KEY(0, 4, KEY_ENTER),
3536 KEY(0, 5, KEY_L),
3537 KEY(0, 6, KEY_BACK),
3538 KEY(0, 7, KEY_M),
3539
3540 KEY(1, 0, KEY_LEFT),
3541 KEY(1, 1, KEY_SEND),
3542 KEY(1, 2, KEY_1),
3543 KEY(1, 3, KEY_4),
3544 KEY(1, 4, KEY_CLEAR),
3545 KEY(1, 5, KEY_MSDOS),
3546 KEY(1, 6, KEY_SPACE),
3547 KEY(1, 7, KEY_COMMA),
3548
3549 KEY(2, 0, KEY_6),
3550 KEY(2, 1, KEY_5),
3551 KEY(2, 2, KEY_8),
3552 KEY(2, 3, KEY_3),
3553 KEY(2, 4, KEY_NUMERIC_STAR),
3554 KEY(2, 5, KEY_UP),
3555 KEY(2, 6, KEY_DOWN),
3556 KEY(2, 7, KEY_LEFTSHIFT),
3557
3558 KEY(3, 0, KEY_9),
3559 KEY(3, 1, KEY_NUMERIC_POUND),
3560 KEY(3, 2, KEY_0),
3561 KEY(3, 3, KEY_2),
3562 KEY(3, 4, KEY_SLEEP),
3563 KEY(3, 5, KEY_F1),
3564 KEY(3, 6, KEY_F2),
3565 KEY(3, 7, KEY_F3),
3566
3567 KEY(4, 0, KEY_BACK),
3568 KEY(4, 1, KEY_HOME),
3569 KEY(4, 2, KEY_MENU),
3570 KEY(4, 3, KEY_VOLUMEUP),
3571 KEY(4, 4, KEY_VOLUMEDOWN),
3572 KEY(4, 5, KEY_F4),
3573 KEY(4, 6, KEY_F5),
3574 KEY(4, 7, KEY_F6),
3575
3576 KEY(5, 0, KEY_R),
3577 KEY(5, 1, KEY_T),
3578 KEY(5, 2, KEY_Y),
3579 KEY(5, 3, KEY_LEFTALT),
3580 KEY(5, 4, KEY_KPENTER),
3581 KEY(5, 5, KEY_Q),
3582 KEY(5, 6, KEY_W),
3583 KEY(5, 7, KEY_E),
3584
3585 KEY(6, 0, KEY_F),
3586 KEY(6, 1, KEY_G),
3587 KEY(6, 2, KEY_H),
3588 KEY(6, 3, KEY_CAPSLOCK),
3589 KEY(6, 4, KEY_PAGEUP),
3590 KEY(6, 5, KEY_A),
3591 KEY(6, 6, KEY_S),
3592 KEY(6, 7, KEY_D),
3593
3594 KEY(7, 0, KEY_V),
3595 KEY(7, 1, KEY_B),
3596 KEY(7, 2, KEY_N),
3597 KEY(7, 3, KEY_MENU),
3598 KEY(7, 4, KEY_PAGEDOWN),
3599 KEY(7, 5, KEY_Z),
3600 KEY(7, 6, KEY_X),
3601 KEY(7, 7, KEY_C),
3602
3603 KEY(8, 0, KEY_P),
3604 KEY(8, 1, KEY_J),
3605 KEY(8, 2, KEY_K),
3606 KEY(8, 3, KEY_INSERT),
3607 KEY(8, 4, KEY_LINEFEED),
3608 KEY(8, 5, KEY_U),
3609 KEY(8, 6, KEY_I),
3610 KEY(8, 7, KEY_O),
3611
3612 KEY(9, 0, KEY_4),
3613 KEY(9, 1, KEY_5),
3614 KEY(9, 2, KEY_6),
3615 KEY(9, 3, KEY_7),
3616 KEY(9, 4, KEY_8),
3617 KEY(9, 5, KEY_1),
3618 KEY(9, 6, KEY_2),
3619 KEY(9, 7, KEY_3),
3620
3621 KEY(10, 0, KEY_F7),
3622 KEY(10, 1, KEY_F8),
3623 KEY(10, 2, KEY_F9),
3624 KEY(10, 3, KEY_F10),
3625 KEY(10, 4, KEY_FN),
3626 KEY(10, 5, KEY_9),
3627 KEY(10, 6, KEY_0),
3628 KEY(10, 7, KEY_DOT),
3629
3630 KEY(11, 0, KEY_LEFTCTRL),
3631 KEY(11, 1, KEY_F11),
3632 KEY(11, 2, KEY_ENTER),
3633 KEY(11, 3, KEY_SEARCH),
3634 KEY(11, 4, KEY_DELETE),
3635 KEY(11, 5, KEY_RIGHT),
3636 KEY(11, 6, KEY_LEFT),
3637 KEY(11, 7, KEY_RIGHTSHIFT),
3638 KEY(0, 0, KEY_VOLUMEUP),
3639 KEY(0, 1, KEY_VOLUMEDOWN),
3640 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3641 KEY(0, 3, KEY_CAMERA_FOCUS),
3642};
3643
3644static struct matrix_keymap_data keymap_data_sim = {
3645 .keymap_size = ARRAY_SIZE(keymap_sim),
3646 .keymap = keymap_sim,
3647};
3648
3649static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3650 .input_name = "keypad_8960",
3651 .input_phys_device = "keypad_8960/input0",
3652 .num_rows = 12,
3653 .num_cols = 8,
3654 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3655 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3656 .debounce_ms = 15,
3657 .scan_delay_ms = 32,
3658 .row_hold_ns = 91500,
3659 .wakeup = 1,
3660 .keymap_data = &keymap_data_sim,
3661};
3662
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003663static int pm8921_therm_mitigation[] = {
3664 1100,
3665 700,
3666 600,
3667 325,
3668};
3669
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003670static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003671 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003672 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003673 .max_voltage = 4200,
3674 .min_voltage = 3200,
3675 .resume_voltage = 4100,
3676 .term_current = 100,
3677 .cool_temp = 10,
3678 .warm_temp = 40,
3679 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003680 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003681 .cool_bat_chg_current = 350,
3682 .warm_bat_chg_current = 350,
3683 .cool_bat_voltage = 4100,
3684 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003685 .thermal_mitigation = pm8921_therm_mitigation,
3686 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003687};
3688
3689static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3690 .priority = 0,
3691};
3692
3693static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3694 .r_sense = 10,
3695 .i_test = 2500,
3696 .v_failure = 3000,
3697 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003698};
3699
Jay Chokshide4cefb2011-08-04 18:10:44 -07003700#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3701
3702/**
3703 * 'flag' stores three values; led id, led mode, and max current of led.
3704 * The bit packing format is as follow,
3705 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3706 * led_id (1 nibble)
3707 */
3708#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3709 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3710 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3711 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3712 PM8XXX_LED_MAX_CURRENT_MASK))
3713
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003714static struct led_info pm8921_led_info[] = {
3715 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003716 .name = "led:usb",
3717 .default_trigger = "usb-online",
3718 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3719 PM8XXX_LED_MODE_MANUAL,
3720 PM8921_LC_LED_MAX_CURRENT),
3721 },
3722 [1] = {
3723 .name = "led:ac",
3724 .default_trigger = "ac-online",
3725 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3726 PM8XXX_LED_MODE_MANUAL,
3727 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003728 },
3729};
3730
3731static struct led_platform_data pm8xxx_leds_pdata = {
3732 .num_leds = ARRAY_SIZE(pm8921_led_info),
3733 .leds = pm8921_led_info,
3734};
3735
3736static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3737 .irq_pdata = &pm8xxx_irq_pdata,
3738 .gpio_pdata = &pm8xxx_gpio_pdata,
3739 .mpp_pdata = &pm8xxx_mpp_pdata,
3740 .rtc_pdata = &pm8xxx_rtc_pdata,
3741 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3742 .keypad_pdata = &keypad_data,
3743 .misc_pdata = &pm8xxx_misc_pdata,
3744 .regulator_pdatas = msm_pm8921_regulator_pdata,
3745 .charger_pdata = &pm8921_chg_pdata,
3746 .bms_pdata = &pm8921_bms_pdata,
3747 .adc_pdata = &pm8921_adc_pdata,
3748 .leds_pdata = &pm8xxx_leds_pdata,
3749};
3750
3751static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3752 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3753 .slave = {
3754 .name = "pm8921-core",
3755 .platform_data = &pm8921_platform_data,
3756 },
3757};
3758
3759static void msm8960_wcnss_init(void)
3760{
3761 int i, ret, j;
3762
3763 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3764 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3765 "wcnss_5_wire");
3766 if (ret) {
3767 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3768 wcnss_5wire_interface[i].gpio, ret);
3769 goto fail;
3770 }
3771 }
3772
3773 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3774
3775 return;
3776
3777fail:
3778 for (j = 0; j < i; j++)
3779 gpio_free(wcnss_5wire_interface[j].gpio);
3780}
3781
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003782#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003783static int ethernet_init(void)
3784{
3785 int ret;
3786 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3787 if (ret) {
3788 pr_err("ks8851 gpio_request failed: %d\n", ret);
3789 goto fail;
3790 }
3791
3792 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3793 if (ret) {
3794 pr_err("ks8851 gpio_request failed: %d\n", ret);
3795 goto fail_rst;
3796 }
3797
3798 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3799 if (ret) {
3800 pr_err("ks8851 gpio_request failed: %d\n", ret);
3801 goto fail_cs;
3802 }
3803
3804 gpio_direction_output(FPGA_CS_GPIO, 1);
3805 gpio_direction_output(KS8851_RST_GPIO, 1);
3806 return 0;
3807fail_cs:
3808 gpio_free(KS8851_RST_GPIO);
3809fail_rst:
3810 gpio_free(KS8851_IRQ_GPIO);
3811fail:
3812 return ret;
3813}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003814#else
3815static int ethernet_init(void)
3816{
3817 return 0;
3818}
3819#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003820
3821static struct msm_cpuidle_state msm_cstates[] __initdata = {
3822 {0, 0, "C0", "WFI",
3823 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3824
3825 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3826 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3827
3828 {0, 2, "C2", "POWER_COLLAPSE",
3829 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3830
3831 {1, 0, "C0", "WFI",
3832 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3833
3834 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3835 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3836};
3837
3838static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3839 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3840 .idle_supported = 1,
3841 .suspend_supported = 1,
3842 .idle_enabled = 0,
3843 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003844 },
3845
3846 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3847 .idle_supported = 1,
3848 .suspend_supported = 1,
3849 .idle_enabled = 0,
3850 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003851 },
3852
3853 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3854 .idle_supported = 1,
3855 .suspend_supported = 1,
3856 .idle_enabled = 1,
3857 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003858 },
3859
3860 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3861 .idle_supported = 0,
3862 .suspend_supported = 1,
3863 .idle_enabled = 0,
3864 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003865 },
3866
3867 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3868 .idle_supported = 1,
3869 .suspend_supported = 1,
3870 .idle_enabled = 0,
3871 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003872 },
3873
3874 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3875 .idle_supported = 1,
3876 .suspend_supported = 0,
3877 .idle_enabled = 1,
3878 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003879 },
3880};
3881
3882static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3883 {
3884 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3885 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3886 true,
3887 1, 8000, 100000, 1,
3888 },
3889
3890 {
3891 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3892 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3893 true,
3894 1500, 5000, 60100000, 3000,
3895 },
3896
3897 {
3898 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3899 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3900 false,
3901 1800, 5000, 60350000, 3500,
3902 },
3903
3904 {
3905 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3906 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3907 false,
3908 2800, 2500, 65350000, 4800,
3909 },
3910
3911 {
3912 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3913 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3914 false,
3915 3800, 4500, 67850000, 5500,
3916 },
3917
3918 {
3919 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3920 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3921 false,
3922 4800, 2000, 71850000, 6800,
3923 },
3924
3925 {
3926 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3927 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3928 false,
3929 6800, 500, 75850000, 8800,
3930 },
3931
3932 {
3933 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3934 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3935 false,
3936 7800, 0, 76350000, 9800,
3937 },
3938};
3939
3940#ifdef CONFIG_I2C
3941#define I2C_SURF 1
3942#define I2C_FFA (1 << 1)
3943#define I2C_RUMI (1 << 2)
3944#define I2C_SIM (1 << 3)
3945#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003946#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003947
3948struct i2c_registry {
3949 u8 machs;
3950 int bus;
3951 struct i2c_board_info *info;
3952 int len;
3953};
3954
3955#ifdef CONFIG_MSM_CAMERA
3956static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3957#ifdef CONFIG_IMX074
3958 {
3959 I2C_BOARD_INFO("imx074", 0x1A),
3960 },
3961#endif
3962#ifdef CONFIG_OV2720
3963 {
3964 I2C_BOARD_INFO("ov2720", 0x6C),
3965 },
3966#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003967 {
3968 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3969 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303970#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3971 {
3972 I2C_BOARD_INFO("sc628a", 0x6E),
3973 },
3974#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003975};
3976#endif
3977
3978/* Sensors DSPS platform data */
3979#ifdef CONFIG_MSM_DSPS
3980#define DSPS_PIL_GENERIC_NAME "dsps"
3981#endif /* CONFIG_MSM_DSPS */
3982
3983static void __init msm8960_init_dsps(void)
3984{
3985#ifdef CONFIG_MSM_DSPS
3986 struct msm_dsps_platform_data *pdata =
3987 msm_dsps_device.dev.platform_data;
3988 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3989 pdata->gpios = NULL;
3990 pdata->gpios_num = 0;
3991
3992 platform_device_register(&msm_dsps_device);
3993#endif /* CONFIG_MSM_DSPS */
3994}
3995
Amir Samuelov5137e392011-09-21 17:31:25 +03003996#ifdef CONFIG_ISL9519_CHARGER
3997static struct isl_platform_data isl_data __initdata = {
3998 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3999 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4000 .max_system_voltage = 4200,
4001 .min_system_voltage = 3200,
4002 .chgcurrent = 1000, /* 1900, */
4003 .term_current = 400, /* Need fine tuning */
4004 .input_current = 2048,
4005};
4006
4007static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4008 {
4009 I2C_BOARD_INFO("isl9519q", 0x9),
4010 .irq = 0, /* Not required when notify-by-pmic */
4011 .platform_data = &isl_data,
4012 },
4013};
4014#endif /* CONFIG_ISL9519_CHARGER */
4015
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004016static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4017#ifdef CONFIG_MSM_CAMERA
4018 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004019 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004020 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4021 msm_camera_boardinfo,
4022 ARRAY_SIZE(msm_camera_boardinfo),
4023 },
4024#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004025#ifdef CONFIG_ISL9519_CHARGER
4026 {
4027 I2C_LIQUID,
4028 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4029 isl_charger_i2c_info,
4030 ARRAY_SIZE(isl_charger_i2c_info),
4031 },
4032#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004033 {
4034 I2C_SURF | I2C_FFA | I2C_FLUID,
4035 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4036 cyttsp_info,
4037 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004038 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304039 {
4040 I2C_LIQUID,
4041 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4042 mxt_device_info,
4043 ARRAY_SIZE(mxt_device_info),
4044 },
4045
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004046};
4047#endif /* CONFIG_I2C */
4048
4049static void __init register_i2c_devices(void)
4050{
4051#ifdef CONFIG_I2C
4052 u8 mach_mask = 0;
4053 int i;
4054
4055 /* Build the matching 'supported_machs' bitmask */
4056 if (machine_is_msm8960_cdp())
4057 mach_mask = I2C_SURF;
4058 else if (machine_is_msm8960_rumi3())
4059 mach_mask = I2C_RUMI;
4060 else if (machine_is_msm8960_sim())
4061 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004062 else if (machine_is_msm8960_fluid())
4063 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004064 else if (machine_is_msm8960_liquid())
4065 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004066 else if (machine_is_msm8960_mtp())
4067 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004068 else
4069 pr_err("unmatched machine ID in register_i2c_devices\n");
4070
4071 /* Run the array and install devices as appropriate */
4072 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4073 if (msm8960_i2c_devices[i].machs & mach_mask)
4074 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4075 msm8960_i2c_devices[i].info,
4076 msm8960_i2c_devices[i].len);
4077 }
4078#endif
4079}
4080
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004081static void __init msm8960_sim_init(void)
4082{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004083 if (socinfo_init() < 0)
4084 pr_err("socinfo_init() failed!\n");
4085
4086 BUG_ON(msm_rpm_init(&msm_rpm_data));
4087 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4088 ARRAY_SIZE(msm_rpmrs_levels)));
4089 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004090 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004091 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004092 msm8960_device_ssbi_pm8921.dev.platform_data =
4093 &msm8960_ssbi_pm8921_pdata;
4094 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004095
4096 /* Simulator supports a QWERTY keypad */
4097 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4098
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004099 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4100 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4101 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004102 gpiomux_init();
4103 ethernet_init();
4104 msm8960_i2c_init();
4105 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4106 msm_spm_l2_init(msm_spm_l2_data);
4107 msm8960_init_buses();
4108 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4109 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004110 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004111 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004112
4113 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4114 &msm8960_qup_spi_gsbi1_pdata;
4115 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4116
4117 msm8960_init_mmc();
4118 msm_fb_add_devices();
4119 slim_register_board_info(msm_slim_devices,
4120 ARRAY_SIZE(msm_slim_devices));
4121 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4122 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4123 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4124 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004125}
4126
4127static void __init msm8960_rumi3_init(void)
4128{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004129 if (socinfo_init() < 0)
4130 pr_err("socinfo_init() failed!\n");
4131
4132 BUG_ON(msm_rpm_init(&msm_rpm_data));
4133 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4134 ARRAY_SIZE(msm_rpmrs_levels)));
4135 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004136 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004137 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004138 gpiomux_init();
4139 ethernet_init();
4140 msm8960_device_ssbi_pm8921.dev.platform_data =
4141 &msm8960_ssbi_pm8921_pdata;
4142 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4143 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4144 &msm8960_qup_spi_gsbi1_pdata;
4145 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4146 msm8960_i2c_init();
4147 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4148 msm_spm_l2_init(msm_spm_l2_data);
4149 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4150 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004151 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004152 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004153 register_i2c_devices();
4154 msm_fb_add_devices();
4155 slim_register_board_info(msm_slim_devices,
4156 ARRAY_SIZE(msm_slim_devices));
4157 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4158 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4159 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4160 msm_pm_data);
4161}
4162
4163static void __init msm8960_cdp_init(void)
4164{
4165 if (socinfo_init() < 0)
4166 pr_err("socinfo_init() failed!\n");
4167
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004168 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4169 pr_err("meminfo_init() failed!\n");
4170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004171 BUG_ON(msm_rpm_init(&msm_rpm_data));
4172 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4173 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004174
4175 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004176 regulator_suppress_info_printing();
4177 if (msm_xo_init())
4178 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004179 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004180 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004181 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4182 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4183 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004184 gpiomux_init();
4185 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304186 if (machine_is_msm8960_liquid())
4187 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004188 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4189 &msm8960_qup_spi_gsbi1_pdata;
4190 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4191 msm8960_device_ssbi_pm8921.dev.platform_data =
4192 &msm8960_ssbi_pm8921_pdata;
4193 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4194 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004195 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004196 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4197 msm_spm_l2_init(msm_spm_l2_data);
4198 msm8960_init_buses();
4199 platform_add_devices(msm_footswitch_devices,
4200 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004201 if (machine_is_msm8960_liquid())
4202 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004203 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4204 pm8921_gpio_mpp_init();
4205 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4206 msm8960_init_cam();
4207 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004208 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304209 if (machine_is_msm8960_liquid())
4210 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004211 register_i2c_devices();
4212 msm8960_wcnss_init();
4213 msm_fb_add_devices();
4214 slim_register_board_info(msm_slim_devices,
4215 ARRAY_SIZE(msm_slim_devices));
4216 msm8960_init_dsps();
4217 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4218 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4219 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4220 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004221 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004222}
4223
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004224MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4225 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004226 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004227 .init_irq = msm8960_init_irq,
4228 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004229 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004230 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004231MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004232
4233MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4234 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004235 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004236 .init_irq = msm8960_init_irq,
4237 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004238 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004239 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004240MACHINE_END
4241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004242MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4243 .map_io = msm8960_map_io,
4244 .reserve = msm8960_reserve,
4245 .init_irq = msm8960_init_irq,
4246 .timer = &msm_timer,
4247 .init_machine = msm8960_cdp_init,
4248 .init_early = msm8960_allocate_memory_regions,
4249MACHINE_END
4250
4251MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4252 .map_io = msm8960_map_io,
4253 .reserve = msm8960_reserve,
4254 .init_irq = msm8960_init_irq,
4255 .timer = &msm_timer,
4256 .init_machine = msm8960_cdp_init,
4257 .init_early = msm8960_allocate_memory_regions,
4258MACHINE_END
4259
4260MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4261 .map_io = msm8960_map_io,
4262 .reserve = msm8960_reserve,
4263 .init_irq = msm8960_init_irq,
4264 .timer = &msm_timer,
4265 .init_machine = msm8960_cdp_init,
4266 .init_early = msm8960_allocate_memory_regions,
4267MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004268
4269MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4270 .map_io = msm8960_map_io,
4271 .reserve = msm8960_reserve,
4272 .init_irq = msm8960_init_irq,
4273 .timer = &msm_timer,
4274 .init_machine = msm8960_cdp_init,
4275 .init_early = msm8960_allocate_memory_regions,
4276MACHINE_END