blob: acd7974b19809812eaab8dafdf93a1640aa0d96e [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/gpio.h>
20#include <linux/msm_ssbi.h>
21#include <linux/regulator/gpio-regulator.h>
22#include <linux/mfd/pm8xxx/pm8921.h>
23#include <linux/regulator/consumer.h>
24#include <linux/spi/spi.h>
25#include <linux/slimbus/slimbus.h>
26#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060027#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#ifdef CONFIG_ANDROID_PMEM
29#include <linux/android_pmem.h>
30#endif
31#include <linux/cyttsp.h>
32#include <linux/dma-mapping.h>
33#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070034#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <linux/leds.h>
36#include <linux/leds-pm8xxx.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080037
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070040#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080041#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <mach/board.h>
45#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <mach/msm_spi.h>
47#ifdef CONFIG_USB_MSM_OTG_72K
48#include <mach/msm_hsusb.h>
49#else
50#include <linux/usb/msm_hsusb.h>
51#endif
52#include <linux/usb/android.h>
53#include <mach/usbdiag.h>
54#include <mach/socinfo.h>
55#include <mach/rpm.h>
56#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070057#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#include <mach/msm_bus_board.h>
59#include <mach/msm_memtypes.h>
60#include <mach/dma.h>
61#include <mach/msm_dsps.h>
62#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080063
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#ifdef CONFIG_WCD9310_CODEC
65#include <linux/slimbus/slimbus.h>
66#include <linux/mfd/wcd9310/core.h>
67#include <linux/mfd/wcd9310/pdata.h>
68#endif
69
Laura Abbottd6183792011-08-19 13:42:24 -070070#include <linux/ion.h>
71#include <mach/ion.h>
72
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080074#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#include "spm.h"
77#include "board-msm8960.h"
78#include "pm.h"
79#include "cpuidle.h"
80#include "rpm_resources.h"
81#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070082#include "acpuclock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083
84static struct platform_device msm_fm_platform_init = {
85 .name = "iris_fm",
86 .id = -1,
87};
88
89struct pm8xxx_gpio_init {
90 unsigned gpio;
91 struct pm_gpio config;
92};
93
94struct pm8xxx_mpp_init {
95 unsigned mpp;
96 struct pm8xxx_mpp_config_data config;
97};
98
99#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
100 _func, _inv, _disable) \
101{ \
102 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
103 .config = { \
104 .direction = _dir, \
105 .output_buffer = _buf, \
106 .output_value = _val, \
107 .pull = _pull, \
108 .vin_sel = _vin, \
109 .out_strength = _out_strength, \
110 .function = _func, \
111 .inv_int_pol = _inv, \
112 .disable_pin = _disable, \
113 } \
114}
115
116#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
117{ \
118 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
119 .config = { \
120 .type = PM8XXX_MPP_TYPE_##_type, \
121 .level = _level, \
122 .control = PM8XXX_MPP_##_control, \
123 } \
124}
125
126#define PM8XXX_GPIO_DISABLE(_gpio) \
127 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
128 0, 0, 0, 1)
129
130#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
131 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
132 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
133 PM_GPIO_STRENGTH_HIGH, \
134 PM_GPIO_FUNC_NORMAL, 0, 0)
135
136#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
138 _pull, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_NO, \
140 PM_GPIO_FUNC_NORMAL, 0, 0)
141
142#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
143 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
144 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
145 PM_GPIO_STRENGTH_HIGH, \
146 _func, 0, 0)
147
148/* Initial PM8921 GPIO configurations */
149static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
150 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
151 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
152 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300153 /* External regulator shared by display and touchscreen on LiQUID */
154 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
155 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700156 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700157 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700158 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
159 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
160};
161
162/* Initial PM8921 MPP configurations */
163static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
164 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
165 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
166 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
167 DOUT_CTRL_LOW),
168 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
169 DOUT_CTRL_LOW),
170};
171
172static void __init pm8921_gpio_mpp_init(void)
173{
174 int i, rc;
175
176 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
177 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
178 &pm8921_gpios[i].config);
179 if (rc) {
180 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
181 break;
182 }
183 }
184
185 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
186 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
187 &pm8921_mpps[i].config);
188 if (rc) {
189 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
190 break;
191 }
192 }
193}
194
195#define FPGA_CS_GPIO 14
196#define KS8851_RST_GPIO 89
197#define KS8851_IRQ_GPIO 90
198
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700199#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
200enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700201 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700202 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
203 /* CAM Expander */
204 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
205 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
206 GPIO_CAM_GP_AFBUSY,
207 GPIO_CAM_GP_STROBE_CE,
208 GPIO_CAM_GP_CAM1MP_XCLR,
209 GPIO_CAM_GP_CAMIF_RESET_N,
210 GPIO_CAM_GP_XMT_FLASH_INT,
211 GPIO_CAM_GP_LED_EN1,
212 GPIO_CAM_GP_LED_EN2,
213
214};
215#endif
216
Harini Jayaraman608d0462011-08-09 19:10:03 -0600217/* The SPI configurations apply to GSBI 1*/
218static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700219 .func = GPIOMUX_FUNC_1,
220 .drv = GPIOMUX_DRV_8MA,
221 .pull = GPIOMUX_PULL_NONE,
222};
223
Harini Jayaraman608d0462011-08-09 19:10:03 -0600224static struct gpiomux_setting spi_suspended_config = {
225 .func = GPIOMUX_FUNC_GPIO,
226 .drv = GPIOMUX_DRV_2MA,
227 .pull = GPIOMUX_PULL_DOWN,
228};
229
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230static struct gpiomux_setting gsbi3 = {
231 .func = GPIOMUX_FUNC_1,
232 .drv = GPIOMUX_DRV_8MA,
233 .pull = GPIOMUX_PULL_NONE,
234};
235
236static struct gpiomux_setting gsbi4 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
242static struct gpiomux_setting gsbi5 = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
248static struct gpiomux_setting gsbi10 = {
249 .func = GPIOMUX_FUNC_2,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi12 = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting cdc_mclk = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700266#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267static struct gpiomux_setting gpio_eth_config = {
268 .pull = GPIOMUX_PULL_NONE,
269 .drv = GPIOMUX_DRV_8MA,
270 .func = GPIOMUX_FUNC_GPIO,
271};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700272#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273
274static struct gpiomux_setting slimbus = {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_8MA,
277 .pull = GPIOMUX_PULL_KEEPER,
278};
279
280struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700281#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282 {
283 .gpio = KS8851_IRQ_GPIO,
284 .settings = {
285 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
286 }
287 },
288 {
289 .gpio = KS8851_RST_GPIO,
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
292 }
293 },
294 {
295 .gpio = FPGA_CS_GPIO,
296 .settings = {
297 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
298 }
299 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700300#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301};
302
303static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
304 {
305 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
306 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600307 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
308 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309 },
310 },
311 {
312 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
313 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600314 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
315 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 },
317 },
318 {
319 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
320 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600321 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
322 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 },
324 },
325 {
326 .gpio = 9, /* GSBI1 QUP SPI_CLK */
327 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600328 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
329 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 },
331 },
332 {
333 .gpio = 16, /* GSBI3 I2C QUP SDA */
334 .settings = {
335 [GPIOMUX_SUSPENDED] = &gsbi3,
336 },
337 },
338 {
339 .gpio = 17, /* GSBI3 I2C QUP SCL */
340 .settings = {
341 [GPIOMUX_SUSPENDED] = &gsbi3,
342 },
343 },
344 {
345 .gpio = 20, /* GSBI4 I2C QUP SDA */
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gsbi4,
348 },
349 },
350 {
351 .gpio = 21, /* GSBI4 I2C QUP SCL */
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gsbi4,
354 },
355 },
356 {
357 .gpio = 22, /* GSBI5 UART2 */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gsbi5,
360 },
361 },
362 {
363 .gpio = 23, /* GSBI5 UART2 */
364 .settings = {
365 [GPIOMUX_SUSPENDED] = &gsbi5,
366 },
367 },
368 {
369 .gpio = 24, /* GSBI5 UART2 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi5,
372 },
373 },
374 {
375 .gpio = 25, /* GSBI5 UART2 */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi5,
378 },
379 },
380 {
381 .gpio = 44, /* GSBI12 I2C QUP SDA */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi12,
384 },
385 },
386 {
387 .gpio = 45, /* GSBI12 I2C QUP SCL */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi12,
390 },
391 },
392 {
393 .gpio = 73, /* GSBI10 I2C QUP SDA */
394 .settings = {
395 [GPIOMUX_SUSPENDED] = &gsbi10,
396 },
397 },
398 {
399 .gpio = 74, /* GSBI10 I2C QUP SCL */
400 .settings = {
401 [GPIOMUX_SUSPENDED] = &gsbi10,
402 },
403 },
404};
405
406static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
407 {
408 .gpio = 60, /* slimbus data */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &slimbus,
411 },
412 },
413 {
414 .gpio = 61, /* slimbus clk */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &slimbus,
417 },
418 },
419};
420
421static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
422 {
423 .gpio = 59,
424 .settings = {
425 [GPIOMUX_SUSPENDED] = &cdc_mclk,
426 },
427 },
428};
429static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
430 .func = GPIOMUX_FUNC_GPIO,
431 .drv = GPIOMUX_DRV_2MA,
432 .pull = GPIOMUX_PULL_NONE,
433};
434
435static struct gpiomux_setting wcnss_5wire_active_cfg = {
436 .func = GPIOMUX_FUNC_1,
437 .drv = GPIOMUX_DRV_6MA,
438 .pull = GPIOMUX_PULL_DOWN,
439};
440
441static struct msm_gpiomux_config wcnss_5wire_interface[] = {
442 {
443 .gpio = 84,
444 .settings = {
445 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
446 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
447 },
448 },
449 {
450 .gpio = 85,
451 .settings = {
452 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
453 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
454 },
455 },
456 {
457 .gpio = 86,
458 .settings = {
459 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
460 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
461 },
462 },
463 {
464 .gpio = 87,
465 .settings = {
466 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
467 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
468 },
469 },
470 {
471 .gpio = 88,
472 .settings = {
473 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
474 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
475 },
476 },
477};
Nishant Pandit24153d82011-08-27 16:05:13 +0530478static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530479 {
480 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
481 .drv = GPIOMUX_DRV_2MA,
482 .pull = GPIOMUX_PULL_DOWN,
483 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700484
Nishant Pandit474f2252011-07-23 23:17:56 +0530485 {
486 .func = GPIOMUX_FUNC_1, /*active 1*/
487 .drv = GPIOMUX_DRV_2MA,
488 .pull = GPIOMUX_PULL_NONE,
489 },
490
491 {
492 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
493 .drv = GPIOMUX_DRV_2MA,
494 .pull = GPIOMUX_PULL_NONE,
495 },
496
497 {
498 .func = GPIOMUX_FUNC_1, /*active 3*/
499 .drv = GPIOMUX_DRV_8MA,
500 .pull = GPIOMUX_PULL_UP,
501 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530502
503 {
504 .func = GPIOMUX_FUNC_5, /*active 4*/
505 .drv = GPIOMUX_DRV_8MA,
506 .pull = GPIOMUX_PULL_UP,
507 },
508
509 {
510 .func = GPIOMUX_FUNC_6, /*active 5*/
511 .drv = GPIOMUX_DRV_8MA,
512 .pull = GPIOMUX_PULL_UP,
513 },
514
515 {
516 .func = GPIOMUX_FUNC_2, /*active 6*/
517 .drv = GPIOMUX_DRV_2MA,
518 .pull = GPIOMUX_PULL_UP,
519 },
520
521 {
522 .func = GPIOMUX_FUNC_3, /*active 7*/
523 .drv = GPIOMUX_DRV_8MA,
524 .pull = GPIOMUX_PULL_UP,
525 },
526
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527};
528
Nishant Pandit24153d82011-08-27 16:05:13 +0530529static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700530 {
531 .gpio = 2,
532 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530533 [GPIOMUX_ACTIVE] = &cam_settings[2],
534 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700535 },
536 },
537 {
538 .gpio = 3,
539 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530540 [GPIOMUX_ACTIVE] = &cam_settings[1],
541 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700542 },
543 },
544 {
545 .gpio = 4,
546 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530547 [GPIOMUX_ACTIVE] = &cam_settings[1],
548 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549 },
550 },
551 {
552 .gpio = 5,
553 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530554 [GPIOMUX_ACTIVE] = &cam_settings[1],
555 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700556 },
557 },
558 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530559 .gpio = 76,
560 .settings = {
561 [GPIOMUX_ACTIVE] = &cam_settings[2],
562 [GPIOMUX_SUSPENDED] = &cam_settings[0],
563 },
564 },
565 {
566 .gpio = 107,
567 .settings = {
568 [GPIOMUX_ACTIVE] = &cam_settings[2],
569 [GPIOMUX_SUSPENDED] = &cam_settings[0],
570 },
571 },
572};
573
574static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
575 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 .gpio = 18,
577 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530578 [GPIOMUX_ACTIVE] = &cam_settings[3],
579 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580 },
581 },
582 {
583 .gpio = 19,
584 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530585 [GPIOMUX_ACTIVE] = &cam_settings[3],
586 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700587 },
588 },
589 {
590 .gpio = 20,
591 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530592 [GPIOMUX_ACTIVE] = &cam_settings[3],
593 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700594 },
595 },
596 {
597 .gpio = 21,
598 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530599 [GPIOMUX_ACTIVE] = &cam_settings[3],
600 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700601 },
602 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700603};
604
605static struct gpiomux_setting cyts_resout_sus_cfg = {
606 .func = GPIOMUX_FUNC_GPIO,
607 .drv = GPIOMUX_DRV_6MA,
608 .pull = GPIOMUX_PULL_UP,
609};
610
611static struct gpiomux_setting cyts_resout_act_cfg = {
612 .func = GPIOMUX_FUNC_GPIO,
613 .drv = GPIOMUX_DRV_6MA,
614 .pull = GPIOMUX_PULL_UP,
615};
616
617static struct gpiomux_setting cyts_sleep_sus_cfg = {
618 .func = GPIOMUX_FUNC_GPIO,
619 .drv = GPIOMUX_DRV_6MA,
620 .pull = GPIOMUX_PULL_DOWN,
621};
622
623static struct gpiomux_setting cyts_sleep_act_cfg = {
624 .func = GPIOMUX_FUNC_GPIO,
625 .drv = GPIOMUX_DRV_6MA,
626 .pull = GPIOMUX_PULL_DOWN,
627};
628
629static struct gpiomux_setting cyts_int_act_cfg = {
630 .func = GPIOMUX_FUNC_GPIO,
631 .drv = GPIOMUX_DRV_8MA,
632 .pull = GPIOMUX_PULL_UP,
633};
634
635static struct gpiomux_setting cyts_int_sus_cfg = {
636 .func = GPIOMUX_FUNC_GPIO,
637 .drv = GPIOMUX_DRV_2MA,
638 .pull = GPIOMUX_PULL_UP,
639};
640
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
642 { /* TS INTERRUPT */
643 .gpio = 11,
644 .settings = {
645 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
646 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
647 },
648 },
649 { /* TS SLEEP */
650 .gpio = 50,
651 .settings = {
652 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
653 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
654 },
655 },
656 { /* TS RESOUT */
657 .gpio = 52,
658 .settings = {
659 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
660 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
661 },
662 },
663};
664
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700665#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
666enum {
667 SX150X_CAM,
668};
669
Nishant Pandit474f2252011-07-23 23:17:56 +0530670static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700671 [SX150X_CAM] = {
672 .gpio_base = GPIO_CAM_EXPANDER_BASE,
673 .oscio_is_gpo = false,
674 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530675 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700676 .io_open_drain_ena = 0x0,
677 .irq_summary = -1,
678 },
679};
Nishant Pandit474f2252011-07-23 23:17:56 +0530680
681#endif
682
683#ifdef CONFIG_I2C
684
685#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
686#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
687
688#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
689
690static struct i2c_board_info cam_expander_i2c_info[] = {
691 {
692 I2C_BOARD_INFO("sx1508q", 0x22),
693 .platform_data = &sx150x_data[SX150X_CAM]
694 },
695};
696
697static struct msm_cam_expander_info cam_expander_info[] = {
698 {
699 cam_expander_i2c_info,
700 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
701 },
702};
703#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700704#endif
705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700706#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
707#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700708#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700709#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
710
Laura Abbottd6183792011-08-19 13:42:24 -0700711#define MSM_ION_EBI_SIZE SZ_8M
712
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700713#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
714static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
715static int __init pmem_kernel_ebi1_size_setup(char *p)
716{
717 pmem_kernel_ebi1_size = memparse(p, NULL);
718 return 0;
719}
720early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
721#endif
722
723#ifdef CONFIG_ANDROID_PMEM
724static unsigned pmem_size = MSM_PMEM_SIZE;
725static int __init pmem_size_setup(char *p)
726{
727 pmem_size = memparse(p, NULL);
728 return 0;
729}
730early_param("pmem_size", pmem_size_setup);
731
732static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
733
734static int __init pmem_adsp_size_setup(char *p)
735{
736 pmem_adsp_size = memparse(p, NULL);
737 return 0;
738}
739early_param("pmem_adsp_size", pmem_adsp_size_setup);
740
741static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
742
743static int __init pmem_audio_size_setup(char *p)
744{
745 pmem_audio_size = memparse(p, NULL);
746 return 0;
747}
748early_param("pmem_audio_size", pmem_audio_size_setup);
749#endif
750
751#ifdef CONFIG_ANDROID_PMEM
752static struct android_pmem_platform_data android_pmem_pdata = {
753 .name = "pmem",
754 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
755 .cached = 1,
756 .memory_type = MEMTYPE_EBI1,
757};
758
759static struct platform_device android_pmem_device = {
760 .name = "android_pmem",
761 .id = 0,
762 .dev = {.platform_data = &android_pmem_pdata},
763};
764
765static struct android_pmem_platform_data android_pmem_adsp_pdata = {
766 .name = "pmem_adsp",
767 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
768 .cached = 0,
769 .memory_type = MEMTYPE_EBI1,
770};
771static struct platform_device android_pmem_adsp_device = {
772 .name = "android_pmem",
773 .id = 2,
774 .dev = { .platform_data = &android_pmem_adsp_pdata },
775};
776
777static struct android_pmem_platform_data android_pmem_audio_pdata = {
778 .name = "pmem_audio",
779 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
780 .cached = 0,
781 .memory_type = MEMTYPE_EBI1,
782};
783
784static struct platform_device android_pmem_audio_device = {
785 .name = "android_pmem",
786 .id = 4,
787 .dev = { .platform_data = &android_pmem_audio_pdata },
788};
789#endif
790
791static struct memtype_reserve msm8960_reserve_table[] __initdata = {
792 [MEMTYPE_SMI] = {
793 },
794 [MEMTYPE_EBI0] = {
795 .flags = MEMTYPE_FLAGS_1M_ALIGN,
796 },
797 [MEMTYPE_EBI1] = {
798 .flags = MEMTYPE_FLAGS_1M_ALIGN,
799 },
800};
801
802static void __init size_pmem_devices(void)
803{
804#ifdef CONFIG_ANDROID_PMEM
805 android_pmem_adsp_pdata.size = pmem_adsp_size;
806 android_pmem_pdata.size = pmem_size;
807 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
808#endif
809}
810
811static void __init reserve_memory_for(struct android_pmem_platform_data *p)
812{
813 msm8960_reserve_table[p->memory_type].size += p->size;
814}
815
816static void __init reserve_pmem_memory(void)
817{
818#ifdef CONFIG_ANDROID_PMEM
819 reserve_memory_for(&android_pmem_adsp_pdata);
820 reserve_memory_for(&android_pmem_pdata);
821 reserve_memory_for(&android_pmem_audio_pdata);
822 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
823#endif
824}
825
Larry Basselb4126da2011-07-18 14:31:33 -0700826static int msm8960_paddr_to_memtype(unsigned int paddr)
827{
828 return MEMTYPE_EBI1;
829}
830
Laura Abbottd6183792011-08-19 13:42:24 -0700831#ifdef CONFIG_ION_MSM
832struct ion_platform_data ion_pdata = {
833 .nr = 3,
834 .heaps = {
835 {
836 .id = ION_HEAP_SYSTEM_ID,
837 .type = ION_HEAP_TYPE_SYSTEM,
838 .name = ION_KMALLOC_HEAP_NAME,
839 },
840 {
841 .id = ION_HEAP_SYSTEM_CONTIG_ID,
842 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
843 .name = ION_VMALLOC_HEAP_NAME,
844 },
845 {
846 .id = ION_HEAP_EBI_ID,
847 .type = ION_HEAP_TYPE_CARVEOUT,
848 .name = ION_EBI1_HEAP_NAME,
849 .size = MSM_ION_EBI_SIZE,
850 .memory_type = ION_EBI_TYPE,
851 },
852 }
853};
854
855struct platform_device ion_dev = {
856 .name = "ion-msm",
857 .id = 1,
858 .dev = { .platform_data = &ion_pdata },
859};
860#endif
861
862static void reserve_ion_memory(void)
863{
864#ifdef CONFIG_ION_MSM
865 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
866#endif
867}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868static void __init msm8960_calculate_reserve_sizes(void)
869{
870 size_pmem_devices();
871 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700872 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700873}
874
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700875static struct reserve_info msm8960_reserve_info __initdata = {
876 .memtype_reserve_table = msm8960_reserve_table,
877 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
878 .paddr_to_memtype = msm8960_paddr_to_memtype,
879};
880
Larry Basselb4126da2011-07-18 14:31:33 -0700881static int msm8960_memory_bank_size(void)
882{
883 return 1<<29;
884}
885
886static void __init locate_unstable_memory(void)
887{
888 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
889 unsigned long bank_size;
890 unsigned long low, high;
891
892 bank_size = msm8960_memory_bank_size();
893 low = meminfo.bank[0].start;
894 high = mb->start + mb->size;
895 low &= ~(bank_size - 1);
896
897 if (high - low <= bank_size)
898 return;
899 msm8960_reserve_info.low_unstable_address = low + bank_size;
900 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
901 msm8960_reserve_info.bank_size = bank_size;
902 pr_info("low unstable address %lx max size %lx bank size %lx\n",
903 msm8960_reserve_info.low_unstable_address,
904 msm8960_reserve_info.max_unstable_size,
905 msm8960_reserve_info.bank_size);
906}
907
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700908static void __init msm8960_reserve(void)
909{
910 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700911 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700912 msm_reserve();
913}
914
Larry Bassela4414b12011-08-04 11:11:02 -0700915static int msm8960_change_memory_power(u64 start, u64 size,
916 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700917{
Larry Bassela4414b12011-08-04 11:11:02 -0700918 return size;
Larry Bassela7eadea2011-07-14 10:46:00 -0700919}
920
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700921#ifdef CONFIG_MSM_CAMERA
922
Nishant Pandit24153d82011-08-27 16:05:13 +0530923static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924 5, /*CAMIF_MCLK*/
925 20, /*CAMIF_I2C_DATA*/
926 21, /*CAMIF_I2C_CLK*/
927};
928
Nishant Pandit24153d82011-08-27 16:05:13 +0530929static struct msm_camera_gpio_conf gpio_conf = {
930 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
931 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
932 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
933 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
934};
935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700936#define VFE_CAMIF_TIMER1_GPIO 2
937#define VFE_CAMIF_TIMER2_GPIO 3
938#define VFE_CAMIF_TIMER3_GPIO_INT 4
939struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
940 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
941 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
942 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
943 .flash_recharge_duration = 50000,
944 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
945};
946
Nishant Pandit474f2252011-07-23 23:17:56 +0530947#ifdef CONFIG_MSM_CAMERA_FLASH
948static struct msm_camera_sensor_flash_src msm_flash_src = {
949 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
950 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
951 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
952#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
953 defined(CONFIG_GPIO_SX150X_MODULE))
954 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
955#endif
956};
957#endif
958
Nishant Pandit24153d82011-08-27 16:05:13 +0530959struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
960 {
961 .ioclk.mclk_clk_rate = 24000000,
962 .ioclk.vfe_clk_rate = 228570000,
963 .csid_core = 0,
964 },
965 {
966 .ioclk.mclk_clk_rate = 24000000,
967 .ioclk.vfe_clk_rate = 228570000,
968 .csid_core = 1,
969 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970};
971
972#ifdef CONFIG_IMX074
973static struct msm_camera_sensor_flash_data flash_imx074 = {
974 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530975#ifdef CONFIG_MSM_CAMERA_FLASH
976 .flash_src = &msm_flash_src
977#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700978};
979
Nishant Pandit24153d82011-08-27 16:05:13 +0530980static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
981 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700982 .sensor_reset = 107,
983 .sensor_pwd = 85,
984 .vcm_pwd = 0,
985 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +0530986};
987
988static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
989 .sensor_name = "imx074",
990 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700991 .flash_data = &flash_imx074,
992 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +0530993 .sensor_platform_info = &sensor_board_info_imx074,
994 .gpio_conf = &gpio_conf,
995 .csi_if = 1,
996 .camera_type = BACK_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700997};
998
999struct platform_device msm8960_camera_sensor_imx074 = {
1000 .name = "msm_camera_imx074",
1001 .dev = {
1002 .platform_data = &msm_camera_sensor_imx074_data,
1003 },
1004};
1005#endif
1006#ifdef CONFIG_OV2720
1007static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001008 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001009};
1010
Nishant Pandit24153d82011-08-27 16:05:13 +05301011static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1012 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001013 .sensor_reset = 76,
1014 .sensor_pwd = 85,
1015 .vcm_pwd = 0,
1016 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301017};
1018
1019static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1020 .sensor_name = "ov2720",
1021 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001022 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301023 .sensor_platform_info = &sensor_board_info_ov2720,
1024 .gpio_conf = &gpio_conf,
1025 .csi_if = 1,
1026 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001027};
1028
1029struct platform_device msm8960_camera_sensor_ov2720 = {
1030 .name = "msm_camera_ov2720",
1031 .dev = {
1032 .platform_data = &msm_camera_sensor_ov2720_data,
1033 },
1034};
1035#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001036
1037static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1038 .flash_type = MSM_CAMERA_FLASH_LED,
1039};
1040
Nishant Pandit24153d82011-08-27 16:05:13 +05301041static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1042 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001043 .sensor_reset = 107,
1044 .sensor_pwd = 85,
1045 .vcm_pwd = 0,
1046 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301047};
1048
1049static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1050 .sensor_name = "qs_mt9p017",
1051 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001052 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301053 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1054 .gpio_conf = &gpio_conf,
1055 .csi_if = 1,
1056 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001057};
1058
1059struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1060 .name = "msm_camera_qs_mt9p017",
1061 .dev = {
1062 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1063 },
1064};
1065
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066static void __init msm8960_init_cam(void)
1067{
1068 int i;
1069 struct platform_device *cam_dev[] = {
1070 &msm8960_camera_sensor_imx074,
1071 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001072 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001073 };
1074
1075 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1076 struct msm_camera_sensor_info *s_info;
1077 s_info = cam_dev[i]->dev.platform_data;
1078 msm_get_cam_resources(s_info);
1079 platform_device_register(cam_dev[i]);
1080 }
1081}
1082#endif
1083
1084#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001085/* prim = 1366 x 768 x 3(bpp) x 3(pages) */
1086#define MSM_FB_PRIM_BUF_SIZE roundup(1366 * 768 * 3 * 3, 0x10000)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001087#else
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001088/* prim = 1366 x 768 x 3(bpp) x 2(pages) */
1089#define MSM_FB_PRIM_BUF_SIZE roundup(1366 * 768 * 3 * 2, 0x10000)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001090#endif
1091
1092#ifdef CONFIG_FB_MSM_MIPI_DSI
Nagamalleswararao Ganji0b8dbd02011-08-18 20:46:59 -07001093#define MIPI_DSI_WRITEBACK_SIZE (1024 * 600 * 3 * 2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001094#else
1095#define MIPI_DSI_WRITEBACK_SIZE 0
1096#endif
1097
1098#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1099/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1100#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1101#elif defined(CONFIG_FB_MSM_TVOUT)
1102/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1103#define MSM_FB_EXT_BUF_SIZE 0x195000
1104#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1105#define MSM_FB_EXT_BUF_SIZE 0
1106#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1107
1108#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1109 MIPI_DSI_WRITEBACK_SIZE, 4096)
1110
1111#define MDP_VSYNC_GPIO 0
1112
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001113#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1114#define TOSHIBA_PANEL_NAME_LEN 24
1115#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1116#define CHIMEI_PANEL_NAME_LEN 16
1117
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001118static struct resource msm_fb_resources[] = {
1119 {
1120 .flags = IORESOURCE_DMA,
1121 }
1122};
1123
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001124#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1125static int msm_fb_detect_panel(const char *name)
1126{
1127 if (machine_is_msm8960_liquid()) {
1128 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1129 return 0;
1130 } else {
1131 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1132 return 0;
1133 }
1134
1135 pr_warning("%s: not supported '%s'", __func__, name);
1136
1137 return -ENODEV;
1138}
1139
1140static struct msm_fb_platform_data msm_fb_pdata = {
1141 .detect_client = msm_fb_detect_panel,
1142};
1143#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1144
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001145static struct platform_device msm_fb_device = {
1146 .name = "msm_fb",
1147 .id = 0,
1148 .num_resources = ARRAY_SIZE(msm_fb_resources),
1149 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001150#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1151 .dev.platform_data = &msm_fb_pdata,
1152#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001153};
1154
1155static bool dsi_power_on;
1156
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001157/**
1158 * LiQUID panel on/off
1159 *
1160 * @param on
1161 *
1162 * @return int
1163 */
1164static int mipi_dsi_liquid_panel_power(int on)
1165{
1166 static struct regulator *reg_l2, *reg_ext_3p3v;
1167 static int gpio21, gpio24, gpio43;
1168 int rc;
1169
1170 pr_info("%s: on=%d\n", __func__, on);
1171
1172 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1173 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1174 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1175
1176 if (!dsi_power_on) {
1177
1178 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1179 "dsi_vdda");
1180 if (IS_ERR(reg_l2)) {
1181 pr_err("could not get 8921_l2, rc = %ld\n",
1182 PTR_ERR(reg_l2));
1183 return -ENODEV;
1184 }
1185
1186 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1187 if (rc) {
1188 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1189 return -EINVAL;
1190 }
1191
1192 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1193 "vdd_lvds_3p3v");
1194 if (IS_ERR(reg_ext_3p3v)) {
1195 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1196 PTR_ERR(reg_ext_3p3v));
1197 return -ENODEV;
1198 }
1199
1200 rc = gpio_request(gpio21, "disp_pwr_en_n");
1201 if (rc) {
1202 pr_err("request gpio 21 failed, rc=%d\n", rc);
1203 return -ENODEV;
1204 }
1205
1206 rc = gpio_request(gpio43, "disp_rst_n");
1207 if (rc) {
1208 pr_err("request gpio 43 failed, rc=%d\n", rc);
1209 return -ENODEV;
1210 }
1211
1212 rc = gpio_request(gpio24, "disp_backlight_pwm");
1213 if (rc) {
1214 pr_err("request gpio 24 failed, rc=%d\n", rc);
1215 return -ENODEV;
1216 }
1217
1218 dsi_power_on = true;
1219 }
1220
1221 if (on) {
1222 rc = regulator_set_optimum_mode(reg_l2, 100000);
1223 if (rc < 0) {
1224 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1225 return -EINVAL;
1226 }
1227 rc = regulator_enable(reg_l2);
1228 if (rc) {
1229 pr_err("enable l2 failed, rc=%d\n", rc);
1230 return -ENODEV;
1231 }
1232
1233 rc = regulator_enable(reg_ext_3p3v);
1234 if (rc) {
1235 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1236 return -ENODEV;
1237 }
1238
1239 /* set reset pin before power enable */
1240 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1241
1242 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1243 msleep(20);
1244 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1245 msleep(20);
1246 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1247 msleep(20);
1248 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1249 msleep(20);
1250 } else {
1251 gpio_set_value_cansleep(gpio43, 0);
1252 gpio_set_value_cansleep(gpio21, 1);
1253
1254 rc = regulator_disable(reg_l2);
1255 if (rc) {
1256 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1257 return -ENODEV;
1258 }
1259 rc = regulator_disable(reg_ext_3p3v);
1260 if (rc) {
1261 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1262 return -ENODEV;
1263 }
1264 rc = regulator_set_optimum_mode(reg_l2, 100);
1265 if (rc < 0) {
1266 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1267 return -EINVAL;
1268 }
1269 }
1270
1271 return 0;
1272}
1273
1274static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001275{
1276 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001277 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278 int rc;
1279
1280 struct pm_gpio gpio43_param = {
1281 .direction = PM_GPIO_DIR_OUT,
1282 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1283 .output_value = 0,
1284 .pull = PM_GPIO_PULL_NO,
1285 .vin_sel = 2,
1286 .out_strength = PM_GPIO_STRENGTH_HIGH,
1287 .function = PM_GPIO_FUNC_PAIRED,
1288 .inv_int_pol = 0,
1289 .disable_pin = 0,
1290 };
1291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292 pr_info("%s: state : %d\n", __func__, on);
1293
1294 if (!dsi_power_on) {
1295
1296 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1297 "dsi_vdc");
1298 if (IS_ERR(reg_l8)) {
1299 pr_err("could not get 8921_l8, rc = %ld\n",
1300 PTR_ERR(reg_l8));
1301 return -ENODEV;
1302 }
1303
1304 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1305 "dsi_vddio");
1306 if (IS_ERR(reg_l23)) {
1307 pr_err("could not get 8921_l23, rc = %ld\n",
1308 PTR_ERR(reg_l23));
1309 return -ENODEV;
1310 }
1311
1312 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1313 "dsi_vdda");
1314 if (IS_ERR(reg_l2)) {
1315 pr_err("could not get 8921_l2, rc = %ld\n",
1316 PTR_ERR(reg_l2));
1317 return -ENODEV;
1318 }
1319
1320 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1321 if (rc) {
1322 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1323 return -EINVAL;
1324 }
1325 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1326 if (rc) {
1327 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1328 return -EINVAL;
1329 }
1330 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1331 if (rc) {
1332 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1333 return -EINVAL;
1334 }
1335
1336 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1337 rc = gpio_request(gpio43, "disp_rst_n");
1338 if (rc) {
1339 pr_err("request gpio 43 failed, rc=%d\n", rc);
1340 return -ENODEV;
1341 }
1342
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001343 dsi_power_on = true;
1344 }
1345
1346 if (on) {
1347 rc = regulator_set_optimum_mode(reg_l8, 100000);
1348 if (rc < 0) {
1349 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1350 return -EINVAL;
1351 }
1352 rc = regulator_set_optimum_mode(reg_l23, 100000);
1353 if (rc < 0) {
1354 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1355 return -EINVAL;
1356 }
1357 rc = regulator_set_optimum_mode(reg_l2, 100000);
1358 if (rc < 0) {
1359 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1360 return -EINVAL;
1361 }
1362 rc = regulator_enable(reg_l8);
1363 if (rc) {
1364 pr_err("enable l8 failed, rc=%d\n", rc);
1365 return -ENODEV;
1366 }
1367 rc = regulator_enable(reg_l23);
1368 if (rc) {
1369 pr_err("enable l8 failed, rc=%d\n", rc);
1370 return -ENODEV;
1371 }
1372 rc = regulator_enable(reg_l2);
1373 if (rc) {
1374 pr_err("enable l2 failed, rc=%d\n", rc);
1375 return -ENODEV;
1376 }
1377
1378 gpio43_param.pull = PM_GPIO_PULL_NO;
1379 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1380 if (rc) {
1381 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1382 return -EINVAL;
1383 }
1384 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1385 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1386 if (rc) {
1387 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1388 return -EINVAL;
1389 }
1390 gpio43_param.pull = PM_GPIO_PULL_NO;
1391 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1392 if (rc) {
1393 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1394 return -EINVAL;
1395 }
1396 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1397 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1398 if (rc) {
1399 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1400 return -EINVAL;
1401 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001402 gpio_set_value_cansleep(gpio43, 1);
1403 } else {
1404 rc = regulator_set_optimum_mode(reg_l8, 100);
1405 if (rc < 0) {
1406 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1407 return -EINVAL;
1408 }
1409 rc = regulator_set_optimum_mode(reg_l23, 100);
1410 if (rc < 0) {
1411 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1412 return -EINVAL;
1413 }
1414 rc = regulator_set_optimum_mode(reg_l2, 100);
1415 if (rc < 0) {
1416 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1417 return -EINVAL;
1418 }
1419 gpio_set_value_cansleep(gpio43, 0);
1420 }
1421 return 0;
1422}
1423
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001424static int mipi_dsi_panel_power(int on)
1425{
1426 int ret;
1427
1428 pr_info("%s: on=%d\n", __func__, on);
1429
1430 if (machine_is_msm8960_liquid())
1431 ret = mipi_dsi_liquid_panel_power(on);
1432 else
1433 ret = mipi_dsi_cdp_panel_power(on);
1434
1435 return ret;
1436}
1437
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001438static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1439 .vsync_gpio = MDP_VSYNC_GPIO,
1440 .dsi_power_save = mipi_dsi_panel_power,
1441};
1442
1443#ifdef CONFIG_MSM_BUS_SCALING
1444
1445static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446 {
1447 .src = MSM_BUS_MASTER_MDP_PORT0,
1448 .dst = MSM_BUS_SLAVE_EBI_CH0,
1449 .ab = 0,
1450 .ib = 0,
1451 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001452};
1453
1454static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455 {
1456 .src = MSM_BUS_MASTER_MDP_PORT0,
1457 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001458 .ab = 216000000 * 2,
1459 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460 },
1461};
1462
1463static struct msm_bus_vectors mdp_vga_vectors[] = {
1464 /* VGA and less video */
1465 {
1466 .src = MSM_BUS_MASTER_MDP_PORT0,
1467 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001468 .ab = 216000000 * 2,
1469 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001470 },
1471};
1472
1473static struct msm_bus_vectors mdp_720p_vectors[] = {
1474 /* 720p and less video */
1475 {
1476 .src = MSM_BUS_MASTER_MDP_PORT0,
1477 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001478 .ab = 230400000 * 2,
1479 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480 },
1481};
1482
1483static struct msm_bus_vectors mdp_1080p_vectors[] = {
1484 /* 1080p and less video */
1485 {
1486 .src = MSM_BUS_MASTER_MDP_PORT0,
1487 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001488 .ab = 334080000 * 2,
1489 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490 },
1491};
1492
1493static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1494 {
1495 ARRAY_SIZE(mdp_init_vectors),
1496 mdp_init_vectors,
1497 },
1498 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001499 ARRAY_SIZE(mdp_ui_vectors),
1500 mdp_ui_vectors,
1501 },
1502 {
1503 ARRAY_SIZE(mdp_ui_vectors),
1504 mdp_ui_vectors,
1505 },
1506 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001507 ARRAY_SIZE(mdp_vga_vectors),
1508 mdp_vga_vectors,
1509 },
1510 {
1511 ARRAY_SIZE(mdp_720p_vectors),
1512 mdp_720p_vectors,
1513 },
1514 {
1515 ARRAY_SIZE(mdp_1080p_vectors),
1516 mdp_1080p_vectors,
1517 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001518};
1519
1520static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1521 mdp_bus_scale_usecases,
1522 ARRAY_SIZE(mdp_bus_scale_usecases),
1523 .name = "mdp",
1524};
1525
1526#endif
1527
1528int mdp_core_clk_rate_table[] = {
1529 85330000,
1530 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001531 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001532 200000000,
1533};
1534
1535static struct msm_panel_common_pdata mdp_pdata = {
1536 .gpio = MDP_VSYNC_GPIO,
1537 .mdp_core_clk_rate = 85330000,
1538 .mdp_core_clk_table = mdp_core_clk_rate_table,
1539 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1540#ifdef CONFIG_MSM_BUS_SCALING
1541 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1542#endif
1543 .mdp_rev = MDP_REV_42,
1544};
1545
1546static struct platform_device mipi_dsi_renesas_panel_device = {
1547 .name = "mipi_renesas",
1548 .id = 0,
1549};
1550
1551static struct platform_device mipi_dsi_simulator_panel_device = {
1552 .name = "mipi_simulator",
1553 .id = 0,
1554};
1555
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001556#define LPM_CHANNEL0 0
1557static int toshiba_gpio[] = {LPM_CHANNEL0};
1558
1559static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1560 .gpio = toshiba_gpio,
1561};
1562
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001563static struct platform_device mipi_dsi_toshiba_panel_device = {
1564 .name = "mipi_toshiba",
1565 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001566 .dev = {
1567 .platform_data = &toshiba_pdata,
1568 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001569};
1570
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001571static int dsi2lvds_gpio[2] = {
1572 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1573 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1574 };
1575
1576static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1577 .gpio_num = dsi2lvds_gpio,
1578};
1579
1580static struct platform_device mipi_dsi2lvds_bridge_device = {
1581 .name = "mipi_tc358764",
1582 .id = 0,
1583 .dev.platform_data = &mipi_dsi2lvds_pdata,
1584};
1585
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001586#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1587static struct resource hdmi_msm_resources[] = {
1588 {
1589 .name = "hdmi_msm_qfprom_addr",
1590 .start = 0x00700000,
1591 .end = 0x007060FF,
1592 .flags = IORESOURCE_MEM,
1593 },
1594 {
1595 .name = "hdmi_msm_hdmi_addr",
1596 .start = 0x04A00000,
1597 .end = 0x04A00FFF,
1598 .flags = IORESOURCE_MEM,
1599 },
1600 {
1601 .name = "hdmi_msm_irq",
1602 .start = HDMI_IRQ,
1603 .end = HDMI_IRQ,
1604 .flags = IORESOURCE_IRQ,
1605 },
1606};
1607
1608static int hdmi_enable_5v(int on);
1609static int hdmi_core_power(int on, int show);
1610static int hdmi_cec_power(int on);
1611
1612static struct msm_hdmi_platform_data hdmi_msm_data = {
1613 .irq = HDMI_IRQ,
1614 .enable_5v = hdmi_enable_5v,
1615 .core_power = hdmi_core_power,
1616 .cec_power = hdmi_cec_power,
1617};
1618
1619static struct platform_device hdmi_msm_device = {
1620 .name = "hdmi_msm",
1621 .id = 0,
1622 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1623 .resource = hdmi_msm_resources,
1624 .dev.platform_data = &hdmi_msm_data,
1625};
1626#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1627
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001628#ifdef CONFIG_MSM_BUS_SCALING
1629static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1630 {
1631 .src = MSM_BUS_MASTER_MDP_PORT0,
1632 .dst = MSM_BUS_SLAVE_EBI_CH0,
1633 .ab = 0,
1634 .ib = 0,
1635 },
1636};
1637static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1638 {
1639 .src = MSM_BUS_MASTER_MDP_PORT0,
1640 .dst = MSM_BUS_SLAVE_EBI_CH0,
1641 .ab = 566092800 * 2,
1642 .ib = 707616000 * 2,
1643 },
1644};
1645static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1646 {
1647 ARRAY_SIZE(dtv_bus_init_vectors),
1648 dtv_bus_init_vectors,
1649 },
1650 {
1651 ARRAY_SIZE(dtv_bus_def_vectors),
1652 dtv_bus_def_vectors,
1653 },
1654};
1655static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1656 dtv_bus_scale_usecases,
1657 ARRAY_SIZE(dtv_bus_scale_usecases),
1658 .name = "dtv",
1659};
1660
1661static struct lcdc_platform_data dtv_pdata = {
1662 .bus_scale_table = &dtv_bus_scale_pdata,
1663};
1664#endif
1665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666static void __init msm_fb_add_devices(void)
1667{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001668 struct platform_device *ptr = NULL;
1669
1670 if (machine_is_msm8960_liquid())
1671 ptr = &mipi_dsi2lvds_bridge_device;
1672 else
1673 ptr = &mipi_dsi_toshiba_panel_device;
1674 platform_add_devices(&ptr, 1);
1675
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001676 if (machine_is_msm8x60_rumi3()) {
1677 msm_fb_register_device("mdp", NULL);
1678 mipi_dsi_pdata.target_type = 1;
1679 } else
1680 msm_fb_register_device("mdp", &mdp_pdata);
1681 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001682#ifdef CONFIG_MSM_BUS_SCALING
1683 msm_fb_register_device("dtv", &dtv_pdata);
1684#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685}
1686
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001687static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1688 .func = GPIOMUX_FUNC_GPIO,
1689 .drv = GPIOMUX_DRV_2MA,
1690 .pull = GPIOMUX_PULL_DOWN,
1691};
1692
1693static struct gpiomux_setting mdp_vsync_active_cfg = {
1694 .func = GPIOMUX_FUNC_1,
1695 .drv = GPIOMUX_DRV_2MA,
1696 .pull = GPIOMUX_PULL_DOWN,
1697};
1698
1699static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1700 {
1701 .gpio = MDP_VSYNC_GPIO,
1702 .settings = {
1703 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1704 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1705 },
1706 }
1707};
1708
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1710static struct gpiomux_setting hdmi_suspend_cfg = {
1711 .func = GPIOMUX_FUNC_GPIO,
1712 .drv = GPIOMUX_DRV_2MA,
1713 .pull = GPIOMUX_PULL_DOWN,
1714};
1715
1716static struct gpiomux_setting hdmi_active_1_cfg = {
1717 .func = GPIOMUX_FUNC_1,
1718 .drv = GPIOMUX_DRV_2MA,
1719 .pull = GPIOMUX_PULL_UP,
1720};
1721
1722static struct gpiomux_setting hdmi_active_2_cfg = {
1723 .func = GPIOMUX_FUNC_1,
1724 .drv = GPIOMUX_DRV_2MA,
1725 .pull = GPIOMUX_PULL_DOWN,
1726};
1727
1728static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1729 {
1730 .gpio = 99,
1731 .settings = {
1732 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1733 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1734 },
1735 },
1736 {
1737 .gpio = 100,
1738 .settings = {
1739 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1740 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1741 },
1742 },
1743 {
1744 .gpio = 101,
1745 .settings = {
1746 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1747 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1748 },
1749 },
1750 {
1751 .gpio = 102,
1752 .settings = {
1753 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1754 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1755 },
1756 },
1757};
1758
1759static int hdmi_enable_5v(int on)
1760{
1761 /* TBD: PM8921 regulator instead of 8901 */
1762 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1763 static int prev_on;
1764 int rc;
1765
1766 if (on == prev_on)
1767 return 0;
1768
1769 if (!reg_8921_hdmi_mvs)
1770 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1771 "hdmi_mvs");
1772
1773 if (on) {
1774 rc = regulator_enable(reg_8921_hdmi_mvs);
1775 if (rc) {
1776 pr_err("'%s' regulator enable failed, rc=%d\n",
1777 "8921_hdmi_mvs", rc);
1778 return rc;
1779 }
1780 pr_debug("%s(on): success\n", __func__);
1781 } else {
1782 rc = regulator_disable(reg_8921_hdmi_mvs);
1783 if (rc)
1784 pr_warning("'%s' regulator disable failed, rc=%d\n",
1785 "8921_hdmi_mvs", rc);
1786 pr_debug("%s(off): success\n", __func__);
1787 }
1788
1789 prev_on = on;
1790
1791 return 0;
1792}
1793
1794static int hdmi_core_power(int on, int show)
1795{
1796 static struct regulator *reg_8921_l23, *reg_8921_s4;
1797 static int prev_on;
1798 int rc;
1799
1800 if (on == prev_on)
1801 return 0;
1802
1803 /* TBD: PM8921 regulator instead of 8901 */
1804 if (!reg_8921_l23)
1805 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1806
1807 if (!reg_8921_s4)
1808 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1809
1810 if (on) {
1811 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1812 if (rc < 0) {
1813 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1814 return -EINVAL;
1815 }
1816
1817 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1818 if (!rc)
1819 rc = regulator_enable(reg_8921_l23);
1820 if (rc) {
1821 pr_err("'%s' regulator enable failed, rc=%d\n",
1822 "hdmi_avdd", rc);
1823 return rc;
1824 }
1825 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1826 if (!rc)
1827 rc = regulator_enable(reg_8921_s4);
1828 if (rc) {
1829 pr_err("'%s' regulator enable failed, rc=%d\n",
1830 "hdmi_vcc", rc);
1831 return rc;
1832 }
1833
1834 rc = gpio_request(100, "HDMI_DDC_CLK");
1835 if (rc) {
1836 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1837 "HDMI_DDC_CLK", 100, rc);
1838 goto error1;
1839 }
1840 rc = gpio_request(101, "HDMI_DDC_DATA");
1841 if (rc) {
1842 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1843 "HDMI_DDC_DATA", 101, rc);
1844 goto error2;
1845 }
1846 rc = gpio_request(102, "HDMI_HPD");
1847 if (rc) {
1848 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1849 "HDMI_HPD", 102, rc);
1850 goto error3;
1851 }
1852 pr_debug("%s(on): success\n", __func__);
1853 } else {
1854 gpio_free(100);
1855 gpio_free(101);
1856 gpio_free(102);
1857
1858 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1859 if (rc < 0) {
1860 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1861 return -EINVAL;
1862 }
1863
1864 pr_debug("%s(off): success\n", __func__);
1865 }
1866
1867 prev_on = on;
1868
1869 return 0;
1870
1871error3:
1872 gpio_free(101);
1873error2:
1874 gpio_free(100);
1875error1:
1876 regulator_disable(reg_8921_l23);
1877 return rc;
1878}
1879
1880static int hdmi_cec_power(int on)
1881{
1882 static int prev_on;
1883 int rc;
1884
1885 if (on == prev_on)
1886 return 0;
1887
1888 if (on) {
1889 rc = gpio_request(99, "HDMI_CEC_VAR");
1890 if (rc) {
1891 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1892 "HDMI_CEC_VAR", 99, rc);
1893 goto error;
1894 }
1895 pr_debug("%s(on): success\n", __func__);
1896 } else {
1897 gpio_free(99);
1898 pr_debug("%s(off): success\n", __func__);
1899 }
1900
1901 prev_on = on;
1902
1903 return 0;
1904error:
1905 return rc;
1906}
1907#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1908
1909static void __init msm8960_allocate_memory_regions(void)
1910{
1911 void *addr;
1912 unsigned long size;
1913
1914 size = MSM_FB_SIZE;
1915 addr = alloc_bootmem_align(size, 0x1000);
1916 msm_fb_resources[0].start = __pa(addr);
1917 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1918 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1919 size, addr, __pa(addr));
1920
1921}
1922#ifdef CONFIG_WCD9310_CODEC
1923
1924#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1925
Patrick Lai3043fba2011-08-01 14:15:57 -07001926/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1927 * 4 micbiases are used to power various analog and digital
1928 * microphones operating at 1800 mV. Technically, all micbiases
1929 * can source from single cfilter since all microphones operate
1930 * at the same voltage level. The arrangement below is to make
1931 * sure all cfilters are exercised. LDO_H regulator ouput level
1932 * does not need to be as high as 2.85V. It is choosen for
1933 * microphone sensitivity purpose.
1934 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935static struct tabla_pdata tabla_platform_data = {
1936 .slimbus_slave_device = {
1937 .name = "tabla-slave",
1938 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1939 },
1940 .irq = MSM_GPIO_TO_INT(62),
1941 .irq_base = TABLA_INTERRUPT_BASE,
1942 .num_irqs = NR_TABLA_IRQS,
1943 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07001944 .micbias = {
1945 .ldoh_v = TABLA_LDOH_2P85_V,
1946 .cfilt1_mv = 1800,
1947 .cfilt2_mv = 1800,
1948 .cfilt3_mv = 1800,
1949 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1950 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1951 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1952 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1953 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001954};
1955
1956static struct slim_device msm_slim_tabla = {
1957 .name = "tabla-slim",
1958 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1959 .dev = {
1960 .platform_data = &tabla_platform_data,
1961 },
1962};
1963#endif
1964
1965static struct slim_boardinfo msm_slim_devices[] = {
1966#ifdef CONFIG_WCD9310_CODEC
1967 {
1968 .bus_num = 1,
1969 .slim_slave = &msm_slim_tabla,
1970 },
1971#endif
1972 /* add more slimbus slaves as needed */
1973};
1974
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001975#define MSM_WCNSS_PHYS 0x03000000
1976#define MSM_WCNSS_SIZE 0x280000
1977
1978static struct resource resources_wcnss_wlan[] = {
1979 {
1980 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1981 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1982 .name = "wcnss_wlanrx_irq",
1983 .flags = IORESOURCE_IRQ,
1984 },
1985 {
1986 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1987 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1988 .name = "wcnss_wlantx_irq",
1989 .flags = IORESOURCE_IRQ,
1990 },
1991 {
1992 .start = MSM_WCNSS_PHYS,
1993 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1994 .name = "wcnss_mmio",
1995 .flags = IORESOURCE_MEM,
1996 },
1997};
1998
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001999static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2000 .has_48mhz_xo = 1,
2001};
2002
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002003static struct platform_device msm_device_wcnss_wlan = {
2004 .name = "wcnss_wlan",
2005 .id = 0,
2006 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2007 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002008 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002009};
2010
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002011#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2012 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2013 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2014 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2015
2016#define QCE_SIZE 0x10000
2017#define QCE_0_BASE 0x18500000
2018
2019#define QCE_HW_KEY_SUPPORT 0
2020#define QCE_SHA_HMAC_SUPPORT 1
2021#define QCE_SHARE_CE_RESOURCE 1
2022#define QCE_CE_SHARED 0
2023
2024static struct resource qcrypto_resources[] = {
2025 [0] = {
2026 .start = QCE_0_BASE,
2027 .end = QCE_0_BASE + QCE_SIZE - 1,
2028 .flags = IORESOURCE_MEM,
2029 },
2030 [1] = {
2031 .name = "crypto_channels",
2032 .start = DMOV_CE_IN_CHAN,
2033 .end = DMOV_CE_OUT_CHAN,
2034 .flags = IORESOURCE_DMA,
2035 },
2036 [2] = {
2037 .name = "crypto_crci_in",
2038 .start = DMOV_CE_IN_CRCI,
2039 .end = DMOV_CE_IN_CRCI,
2040 .flags = IORESOURCE_DMA,
2041 },
2042 [3] = {
2043 .name = "crypto_crci_out",
2044 .start = DMOV_CE_OUT_CRCI,
2045 .end = DMOV_CE_OUT_CRCI,
2046 .flags = IORESOURCE_DMA,
2047 },
2048};
2049
2050static struct resource qcedev_resources[] = {
2051 [0] = {
2052 .start = QCE_0_BASE,
2053 .end = QCE_0_BASE + QCE_SIZE - 1,
2054 .flags = IORESOURCE_MEM,
2055 },
2056 [1] = {
2057 .name = "crypto_channels",
2058 .start = DMOV_CE_IN_CHAN,
2059 .end = DMOV_CE_OUT_CHAN,
2060 .flags = IORESOURCE_DMA,
2061 },
2062 [2] = {
2063 .name = "crypto_crci_in",
2064 .start = DMOV_CE_IN_CRCI,
2065 .end = DMOV_CE_IN_CRCI,
2066 .flags = IORESOURCE_DMA,
2067 },
2068 [3] = {
2069 .name = "crypto_crci_out",
2070 .start = DMOV_CE_OUT_CRCI,
2071 .end = DMOV_CE_OUT_CRCI,
2072 .flags = IORESOURCE_DMA,
2073 },
2074};
2075
2076#endif
2077
2078#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2079 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2080
2081static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2082 .ce_shared = QCE_CE_SHARED,
2083 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2084 .hw_key_support = QCE_HW_KEY_SUPPORT,
2085 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2086};
2087
2088static struct platform_device qcrypto_device = {
2089 .name = "qcrypto",
2090 .id = 0,
2091 .num_resources = ARRAY_SIZE(qcrypto_resources),
2092 .resource = qcrypto_resources,
2093 .dev = {
2094 .coherent_dma_mask = DMA_BIT_MASK(32),
2095 .platform_data = &qcrypto_ce_hw_suppport,
2096 },
2097};
2098#endif
2099
2100#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2101 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2102
2103static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2104 .ce_shared = QCE_CE_SHARED,
2105 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2106 .hw_key_support = QCE_HW_KEY_SUPPORT,
2107 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2108};
2109
2110static struct platform_device qcedev_device = {
2111 .name = "qce",
2112 .id = 0,
2113 .num_resources = ARRAY_SIZE(qcedev_resources),
2114 .resource = qcedev_resources,
2115 .dev = {
2116 .coherent_dma_mask = DMA_BIT_MASK(32),
2117 .platform_data = &qcedev_ce_hw_suppport,
2118 },
2119};
2120#endif
2121
2122
2123static int __init gpiomux_init(void)
2124{
2125 int rc;
2126
2127 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2128 if (rc) {
2129 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2130 return rc;
2131 }
2132
Nishant Pandit24153d82011-08-27 16:05:13 +05302133 msm_gpiomux_install(msm8960_cam_common_configs,
2134 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002135
2136 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002137 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002138
2139 msm_gpiomux_install(msm8960_gsbi_configs,
2140 ARRAY_SIZE(msm8960_gsbi_configs));
2141
2142 msm_gpiomux_install(msm8960_cyts_configs,
2143 ARRAY_SIZE(msm8960_cyts_configs));
2144
2145 msm_gpiomux_install(msm8960_slimbus_config,
2146 ARRAY_SIZE(msm8960_slimbus_config));
2147
2148 msm_gpiomux_install(msm8960_audio_codec_configs,
2149 ARRAY_SIZE(msm8960_audio_codec_configs));
2150
2151#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2152 msm_gpiomux_install(msm8960_hdmi_configs,
2153 ARRAY_SIZE(msm8960_hdmi_configs));
2154#endif
2155
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002156 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2157 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2158
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002159 msm_gpiomux_install(wcnss_5wire_interface,
2160 ARRAY_SIZE(wcnss_5wire_interface));
2161
2162 return 0;
2163}
2164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002165#define MSM_SHARED_RAM_PHYS 0x80000000
2166
2167static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2168 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2169 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2170 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2171 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2172 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2173 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2174 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2175 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2176 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2177 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2178 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2179 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2180 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
2181 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2182 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
2183 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2184 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2185 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2186 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2187 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2188 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2189 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2190 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2191 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2192 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2193 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2194 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2195 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2196 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2197 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2198};
2199
2200static struct pm8921_adc_properties pm8921_adc_data = {
2201 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2202 .bitresolution = 15,
2203 .bipolar = 0,
2204};
2205
2206static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2207 .adc_channel = pm8921_adc_channels_data,
2208 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
2209 .adc_prop = &pm8921_adc_data,
2210};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002211
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002212static void __init msm8960_map_io(void)
2213{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002214 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002215 msm_map_msm8960_io();
2216}
2217
2218static void __init msm8960_init_irq(void)
2219{
2220 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002221
2222 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002223 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002224 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002225
2226 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002228
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002229 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2230 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002231
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002232 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2233 * as they are configured as level, which does not play nice with
2234 * handle_percpu_irq.
2235 */
2236 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2237 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002238 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002239 }
2240}
2241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002242/* MSM8960 have 5 SDCC controllers */
2243enum sdcc_controllers {
2244 SDCC1,
2245 SDCC2,
2246 SDCC3,
2247 SDCC4,
2248 SDCC5,
2249 MAX_SDCC_CONTROLLER
2250};
2251
2252/* All SDCC controllers requires VDD/VCC voltage */
2253static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2254 /* SDCC1 : eMMC card connected */
2255 [SDCC1] = {
2256 .name = "sdc_vdd",
2257 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302258 .high_vol_level = 2950000,
2259 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302260 .always_on = 1,
2261 .lpm_sup = 1,
2262 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002263 .hpm_uA = 200000, /* 200mA */
2264 },
2265 /* SDCC3 : External card slot connected */
2266 [SDCC3] = {
2267 .name = "sdc_vdd",
2268 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302269 .high_vol_level = 2950000,
2270 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271 .hpm_uA = 600000, /* 600mA */
2272 }
2273};
2274
2275/* Only slots having eMMC card will require VCCQ voltage */
2276static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2277 /* SDCC1 : eMMC card connected */
2278 [SDCC1] = {
2279 .name = "sdc_vccq",
2280 .set_voltage_sup = 1,
2281 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302282 .high_vol_level = 1800000,
2283 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284 .hpm_uA = 200000, /* 200mA */
2285 }
2286};
2287
2288/* All SDCC controllers may require voting for VDD PAD voltage */
2289static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2290 /* SDCC3 : External card slot connected */
2291 [SDCC3] = {
2292 .name = "sdc_vddp",
2293 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302294 .high_vol_level = 2950000,
2295 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002296 .always_on = 1,
2297 .lpm_sup = 1,
2298 /* Max. Active current required is 16 mA */
2299 .hpm_uA = 16000,
2300 /*
2301 * Sleep current required is ~300 uA. But min. vote can be
2302 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2303 * during sleep.
2304 */
2305 .lpm_uA = 2000,
2306 }
2307};
2308
2309static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2310 /* SDCC1 : eMMC card connected */
2311 [SDCC1] = {
2312 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2313 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2314 },
2315 /* SDCC3 : External card slot connected */
2316 [SDCC3] = {
2317 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2318 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2319 }
2320};
2321
2322/* SDC1 pad data */
2323static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2324 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302325 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2326 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002327};
2328
2329static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2330 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2331 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2332 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2333};
2334
2335static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2336 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2337 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2338};
2339
2340static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2341 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2342 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2343};
2344
2345/* SDC3 pad data */
2346static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2347 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2348 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2349 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2350};
2351
2352static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2353 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2354 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2355 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2356};
2357
2358static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2359 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2360 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2361};
2362
2363static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2364 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2365 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2366};
2367
2368struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2369 [SDCC1] = {
2370 .on = sdc1_pad_pull_on_cfg,
2371 .off = sdc1_pad_pull_off_cfg,
2372 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2373 },
2374 [SDCC3] = {
2375 .on = sdc3_pad_pull_on_cfg,
2376 .off = sdc3_pad_pull_off_cfg,
2377 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2378 },
2379};
2380
2381struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2382 [SDCC1] = {
2383 .on = sdc1_pad_drv_on_cfg,
2384 .off = sdc1_pad_drv_off_cfg,
2385 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2386 },
2387 [SDCC3] = {
2388 .on = sdc3_pad_drv_on_cfg,
2389 .off = sdc3_pad_drv_off_cfg,
2390 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2391 },
2392};
2393
2394struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2395 [SDCC1] = {
2396 .pull = &mmc_pad_pull_data[SDCC1],
2397 .drv = &mmc_pad_drv_data[SDCC1]
2398 },
2399 [SDCC3] = {
2400 .pull = &mmc_pad_pull_data[SDCC3],
2401 .drv = &mmc_pad_drv_data[SDCC3]
2402 },
2403};
2404
2405struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2406 [SDCC1] = {
2407 .pad_data = &mmc_pad_data[SDCC1],
2408 },
2409 [SDCC3] = {
2410 .pad_data = &mmc_pad_data[SDCC3],
2411 },
2412};
2413
2414static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302415 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002416};
2417
2418static unsigned int sdc3_sup_clk_rates[] = {
2419 400000, 24000000, 48000000, 96000000
2420};
2421
2422#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2423static struct mmc_platform_data msm8960_sdc1_data = {
2424 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2425#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2426 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2427#else
2428 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2429#endif
2430 .sup_clk_table = sdc1_sup_clk_rates,
2431 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2432 .nonremovable = 1,
2433 .sdcc_v4_sup = true,
2434 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302435 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002436};
2437#endif
2438
2439#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2440static struct mmc_platform_data msm8960_sdc3_data = {
2441 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2442 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2443 .sup_clk_table = sdc3_sup_clk_rates,
2444 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2445 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2446 .sdcc_v4_sup = true,
2447 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2448 .pin_data = &mmc_slot_pin_data[SDCC3],
2449#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2450 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2451 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2452 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2453#endif
2454 .xpc_cap = 1,
2455 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2456 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302457 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002458};
2459#endif
2460
2461static void __init msm8960_init_mmc(void)
2462{
2463#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2464 /* SDC1 : eMMC card connected */
2465 msm_add_sdcc(1, &msm8960_sdc1_data);
2466#endif
2467#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2468 /* SDC3: External card slot */
2469 msm_add_sdcc(3, &msm8960_sdc3_data);
2470#endif
2471}
2472
2473static void __init msm8960_init_buses(void)
2474{
2475#ifdef CONFIG_MSM_BUS_SCALING
2476 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2477 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2478 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2479 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2480 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2481 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2482 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2483 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2484 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2485 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2486#endif
2487}
2488
2489static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2490 .max_clock_speed = 15060000,
2491};
2492
2493#ifdef CONFIG_USB_MSM_OTG_72K
2494static struct msm_otg_platform_data msm_otg_pdata;
2495#else
2496#define USB_5V_EN 42
2497static void msm_hsusb_vbus_power(bool on)
2498{
2499 int rc;
2500 static bool vbus_is_on;
2501 static struct regulator *mvs_otg_switch;
2502 struct pm_gpio param = {
2503 .direction = PM_GPIO_DIR_OUT,
2504 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2505 .output_value = 1,
2506 .pull = PM_GPIO_PULL_NO,
2507 .vin_sel = PM_GPIO_VIN_S4,
2508 .out_strength = PM_GPIO_STRENGTH_MED,
2509 .function = PM_GPIO_FUNC_NORMAL,
2510 };
2511
2512 if (vbus_is_on == on)
2513 return;
2514
2515 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002516 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2517 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002518 if (IS_ERR(mvs_otg_switch)) {
2519 pr_err("Unable to get mvs_otg_switch\n");
2520 return;
2521 }
2522
2523 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2524 "usb_5v_en");
2525 if (rc < 0) {
2526 pr_err("failed to request usb_5v_en gpio\n");
2527 goto put_mvs_otg;
2528 }
2529
2530 if (regulator_enable(mvs_otg_switch)) {
2531 pr_err("unable to enable mvs_otg_switch\n");
2532 goto free_usb_5v_en;
2533 }
2534
2535 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2536 &param);
2537 if (rc < 0) {
2538 pr_err("failed to configure usb_5v_en gpio\n");
2539 goto disable_mvs_otg;
2540 }
2541 vbus_is_on = true;
2542 return;
2543 }
2544disable_mvs_otg:
2545 regulator_disable(mvs_otg_switch);
2546free_usb_5v_en:
2547 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2548put_mvs_otg:
2549 regulator_put(mvs_otg_switch);
2550 vbus_is_on = false;
2551}
2552
2553static struct msm_otg_platform_data msm_otg_pdata = {
2554 .mode = USB_OTG,
2555 .otg_control = OTG_PMIC_CONTROL,
2556 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2557 .pclk_src_name = "dfab_usb_hs_clk",
2558 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2559 .vbus_power = msm_hsusb_vbus_power,
2560};
2561#endif
2562
2563#define PID_MAGIC_ID 0x71432909
2564#define SERIAL_NUM_MAGIC_ID 0x61945374
2565#define SERIAL_NUMBER_LENGTH 127
2566#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2567
2568struct magic_num_struct {
2569 uint32_t pid;
2570 uint32_t serial_num;
2571};
2572
2573struct dload_struct {
2574 uint32_t reserved1;
2575 uint32_t reserved2;
2576 uint32_t reserved3;
2577 uint16_t reserved4;
2578 uint16_t pid;
2579 char serial_number[SERIAL_NUMBER_LENGTH];
2580 uint16_t reserved5;
2581 struct magic_num_struct magic_struct;
2582};
2583
2584static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2585{
2586 struct dload_struct __iomem *dload = 0;
2587
2588 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2589 if (!dload) {
2590 pr_err("%s: cannot remap I/O memory region: %08x\n",
2591 __func__, DLOAD_USB_BASE_ADD);
2592 return -ENXIO;
2593 }
2594
2595 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2596 __func__, dload, pid, snum);
2597 /* update pid */
2598 dload->magic_struct.pid = PID_MAGIC_ID;
2599 dload->pid = pid;
2600
2601 /* update serial number */
2602 dload->magic_struct.serial_num = 0;
2603 if (!snum) {
2604 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2605 goto out;
2606 }
2607
2608 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2609 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2610 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2611out:
2612 iounmap(dload);
2613 return 0;
2614}
2615
2616static struct android_usb_platform_data android_usb_pdata = {
2617 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2618};
2619
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002620static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002621 .name = "android_usb",
2622 .id = -1,
2623 .dev = {
2624 .platform_data = &android_usb_pdata,
2625 },
2626};
2627
2628static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2629 0x03, 0x0f,
2630};
2631
2632static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2633 0x00, 0x24, 0x54, 0x10,
2634 0x09, 0x03, 0x01,
2635 0x10, 0x54, 0x30, 0x0C,
2636 0x24, 0x30, 0x0f,
2637};
2638
2639static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2640 0x00, 0x24, 0x54, 0x10,
2641 0x09, 0x07, 0x01, 0x0B,
2642 0x10, 0x54, 0x30, 0x0C,
2643 0x24, 0x30, 0x0f,
2644};
2645
2646static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2647 [0] = {
2648 .mode = MSM_SPM_MODE_CLOCK_GATING,
2649 .notify_rpm = false,
2650 .cmd = spm_wfi_cmd_sequence,
2651 },
2652 [1] = {
2653 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2654 .notify_rpm = false,
2655 .cmd = spm_power_collapse_without_rpm,
2656 },
2657 [2] = {
2658 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2659 .notify_rpm = true,
2660 .cmd = spm_power_collapse_with_rpm,
2661 },
2662};
2663
2664static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2665 [0] = {
2666 .reg_base_addr = MSM_SAW0_BASE,
2667 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2668 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2669 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2670#if defined(CONFIG_MSM_AVS_HW)
2671 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2672 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2673#endif
2674 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2675 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2676 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2677 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2678 .vctl_timeout_us = 50,
2679 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2680 .modes = msm_spm_seq_list,
2681 },
2682 [1] = {
2683 .reg_base_addr = MSM_SAW1_BASE,
2684 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2685 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2686 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2687#if defined(CONFIG_MSM_AVS_HW)
2688 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2689 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2690#endif
2691 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2692 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2693 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2694 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2695 .vctl_timeout_us = 50,
2696 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2697 .modes = msm_spm_seq_list,
2698 },
2699};
2700
2701static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2702 0x00, 0x20, 0x03, 0x20,
2703 0x00, 0x0f,
2704};
2705
2706static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2707 0x00, 0x20, 0x34, 0x64,
2708 0x48, 0x07, 0x48, 0x20,
2709 0x50, 0x64, 0x04, 0x34,
2710 0x50, 0x0f,
2711};
2712static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2713 0x00, 0x10, 0x34, 0x64,
2714 0x48, 0x07, 0x48, 0x10,
2715 0x50, 0x64, 0x04, 0x34,
2716 0x50, 0x0F,
2717};
2718
2719static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2720 [0] = {
2721 .mode = MSM_SPM_L2_MODE_RETENTION,
2722 .notify_rpm = false,
2723 .cmd = l2_spm_wfi_cmd_sequence,
2724 },
2725 [1] = {
2726 .mode = MSM_SPM_L2_MODE_GDHS,
2727 .notify_rpm = true,
2728 .cmd = l2_spm_gdhs_cmd_sequence,
2729 },
2730 [2] = {
2731 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2732 .notify_rpm = true,
2733 .cmd = l2_spm_power_off_cmd_sequence,
2734 },
2735};
2736
2737
2738static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2739 [0] = {
2740 .reg_base_addr = MSM_SAW_L2_BASE,
2741 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2742 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2743 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2744 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2746 .modes = msm_spm_l2_seq_list,
2747 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2748 },
2749};
2750
2751#define CYTTSP_TS_GPIO_IRQ 11
2752#define CYTTSP_TS_SLEEP_GPIO 50
2753#define CYTTSP_TS_RESOUT_N_GPIO 52
2754
2755/*virtual key support */
2756static ssize_t tma340_vkeys_show(struct kobject *kobj,
2757 struct kobj_attribute *attr, char *buf)
2758{
2759 return snprintf(buf, 200,
2760 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2761 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2762 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2763 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2764 "\n");
2765}
2766
2767static struct kobj_attribute tma340_vkeys_attr = {
2768 .attr = {
2769 .mode = S_IRUGO,
2770 },
2771 .show = &tma340_vkeys_show,
2772};
2773
2774static struct attribute *tma340_properties_attrs[] = {
2775 &tma340_vkeys_attr.attr,
2776 NULL
2777};
2778
2779static struct attribute_group tma340_properties_attr_group = {
2780 .attrs = tma340_properties_attrs,
2781};
2782
2783
2784static int cyttsp_platform_init(struct i2c_client *client)
2785{
2786 int rc = 0;
2787 static struct kobject *tma340_properties_kobj;
2788
2789 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2790 tma340_properties_kobj = kobject_create_and_add("board_properties",
2791 NULL);
2792 if (tma340_properties_kobj)
2793 rc = sysfs_create_group(tma340_properties_kobj,
2794 &tma340_properties_attr_group);
2795 if (!tma340_properties_kobj || rc)
2796 pr_err("%s: failed to create board_properties\n",
2797 __func__);
2798
2799 return 0;
2800}
2801
2802static struct cyttsp_regulator regulator_data[] = {
2803 {
2804 .name = "vdd",
2805 .min_uV = CY_TMA300_VTG_MIN_UV,
2806 .max_uV = CY_TMA300_VTG_MAX_UV,
2807 .load_uA = CY_TMA300_CURR_24HZ_UA,
2808 },
2809 /* TODO: Remove after runtime PM is enabled in I2C driver */
2810 {
2811 .name = "vcc_i2c",
2812 .min_uV = CY_I2C_VTG_MIN_UV,
2813 .max_uV = CY_I2C_VTG_MAX_UV,
2814 .load_uA = CY_I2C_CURR_UA,
2815 },
2816};
2817
2818static struct cyttsp_platform_data cyttsp_pdata = {
2819 .panel_maxx = 634,
2820 .panel_maxy = 1166,
2821 .disp_maxx = 616,
2822 .disp_maxy = 1023,
2823 .disp_minx = 0,
2824 .disp_miny = 16,
2825 .flags = 0x01,
2826 .gen = CY_GEN3, /* or */
2827 .use_st = CY_USE_ST,
2828 .use_mt = CY_USE_MT,
2829 .use_hndshk = CY_SEND_HNDSHK,
2830 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302831 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002832 .use_gestures = CY_USE_GESTURES,
2833 .fw_fname = "cyttsp_8960_cdp.hex",
2834 /* activate up to 4 groups
2835 * and set active distance
2836 */
2837 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2838 CY_GEST_GRP3 | CY_GEST_GRP4 |
2839 CY_ACT_DIST,
2840 /* change act_intrvl to customize the Active power state
2841 * scanning/processing refresh interval for Operating mode
2842 */
2843 .act_intrvl = CY_ACT_INTRVL_DFLT,
2844 /* change tch_tmout to customize the touch timeout for the
2845 * Active power state for Operating mode
2846 */
2847 .tch_tmout = CY_TCH_TMOUT_DFLT,
2848 /* change lp_intrvl to customize the Low Power power state
2849 * scanning/processing refresh interval for Operating mode
2850 */
2851 .lp_intrvl = CY_LP_INTRVL_DFLT,
2852 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2853 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2854 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2855 .regulator_info = regulator_data,
2856 .num_regulators = ARRAY_SIZE(regulator_data),
2857 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302858 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002859};
2860
2861static struct i2c_board_info cyttsp_info[] __initdata = {
2862 {
2863 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2864 .platform_data = &cyttsp_pdata,
2865#ifndef CY_USE_TIMER
2866 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2867#endif /* CY_USE_TIMER */
2868 },
2869};
2870
2871static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2872{
2873}
2874
2875static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2876 .clk_freq = 100000,
2877 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002878 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2879};
2880
2881static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2882 .clk_freq = 100000,
2883 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002884 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2885};
2886
2887static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2888 .clk_freq = 100000,
2889 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2891};
2892
2893static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2894 .clk_freq = 100000,
2895 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002896 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2897};
2898
2899static struct msm_rpm_platform_data msm_rpm_data = {
2900 .reg_base_addrs = {
2901 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2902 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2903 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2904 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2905 },
2906
2907 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2908 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2909 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2910 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2911 .msm_apps_ipc_rpm_val = 4,
2912};
2913
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002914static struct platform_device msm_rpm_device = {
2915 .name = "msm_rpm",
2916 .id = -1,
2917};
2918
2919
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002920static struct spi_board_info spi_board_info[] __initdata = {
2921 {
2922 .modalias = "ks8851",
2923 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2924 .max_speed_hz = 19200000,
2925 .bus_num = 0,
2926 .chip_select = 0,
2927 .mode = SPI_MODE_0,
2928 },
2929};
2930
2931static struct platform_device msm_device_saw_core0 = {
2932 .name = "saw-regulator",
2933 .id = 0,
2934 .dev = {
2935 .platform_data = &msm_saw_regulator_pdata_s5,
2936 },
2937};
2938
2939static struct platform_device msm_device_saw_core1 = {
2940 .name = "saw-regulator",
2941 .id = 1,
2942 .dev = {
2943 .platform_data = &msm_saw_regulator_pdata_s6,
2944 },
2945};
2946
2947#ifdef CONFIG_MSM_FAKE_BATTERY
2948static struct platform_device fish_battery_device = {
2949 .name = "fish_battery",
2950};
2951#endif
2952
David Collins26f05562011-06-20 09:56:28 -07002953static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954 .name = GPIO_REGULATOR_DEV_NAME,
2955 .id = PM8921_MPP_PM_TO_SYS(7),
2956 .dev = {
2957 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2958 },
2959};
2960
David Collins26f05562011-06-20 09:56:28 -07002961static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002962 .name = GPIO_REGULATOR_DEV_NAME,
2963 .id = 91,
2964 .dev = {
2965 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2966 },
2967};
2968
David Collinsb10be1d2011-09-02 10:29:31 -07002969static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2970 .name = GPIO_REGULATOR_DEV_NAME,
2971 .id = PM8921_GPIO_PM_TO_SYS(17),
2972 .dev = {
2973 .platform_data =
2974 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2975 },
2976};
2977
David Collins26f05562011-06-20 09:56:28 -07002978static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2979 .name = "rpm-regulator",
2980 .id = -1,
2981 .dev = {
2982 .platform_data = &msm_rpm_regulator_pdata,
2983 },
2984};
2985
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002986static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002987 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002988 &msm_device_smd,
2989 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302990 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002991 &msm_device_saw_core0,
2992 &msm_device_saw_core1,
2993 &msm8960_device_ext_5v_vreg,
2994 &msm8960_device_ext_l2_vreg,
2995 &msm8960_device_ssbi_pm8921,
2996 &msm8960_device_qup_spi_gsbi1,
2997 &msm8960_device_qup_i2c_gsbi3,
2998 &msm8960_device_qup_i2c_gsbi4,
2999 &msm8960_device_qup_i2c_gsbi10,
3000#ifndef CONFIG_MSM_DSPS
3001 &msm8960_device_qup_i2c_gsbi12,
3002#endif
3003 &msm_slim_ctrl,
3004 &msm_device_wcnss_wlan,
3005#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3006 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3007 &qcrypto_device,
3008#endif
3009
3010#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3011 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3012 &qcedev_device,
3013#endif
3014#ifdef CONFIG_MSM_ROTATOR
3015 &msm_rotator_device,
3016#endif
3017 &msm_device_sps,
3018#ifdef CONFIG_MSM_FAKE_BATTERY
3019 &fish_battery_device,
3020#endif
3021#ifdef CONFIG_ANDROID_PMEM
3022 &android_pmem_device,
3023 &android_pmem_adsp_device,
3024 &android_pmem_audio_device,
3025#endif
3026 &msm_fb_device,
3027 &msm_device_vidc,
3028 &msm_device_bam_dmux,
3029 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003030
3031#ifdef CONFIG_HW_RANDOM_MSM
3032 &msm_device_rng,
3033#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003034 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003035#ifdef CONFIG_ION_MSM
3036 &ion_dev,
3037#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003038};
3039
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003040static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003041 &msm8960_device_otg,
3042 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003043 &msm_device_hsusb_host,
3044 &android_usb_device,
3045 &msm_device_vidc,
3046 &mipi_dsi_simulator_panel_device,
3047 &msm_bus_apps_fabric,
3048 &msm_bus_sys_fabric,
3049 &msm_bus_mm_fabric,
3050 &msm_bus_sys_fpb,
3051 &msm_bus_cpss_fpb,
3052 &msm_pcm,
3053 &msm_pcm_routing,
3054 &msm_cpudai0,
3055 &msm_cpudai1,
3056 &msm_cpudai_hdmi_rx,
3057 &msm_cpudai_bt_rx,
3058 &msm_cpudai_bt_tx,
3059 &msm_cpudai_fm_rx,
3060 &msm_cpudai_fm_tx,
3061 &msm_cpu_fe,
3062 &msm_stub_codec,
3063 &msm_voice,
3064 &msm_voip,
3065 &msm_lpa_pcm,
3066
3067#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3068 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3069 &qcrypto_device,
3070#endif
3071
3072#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3073 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3074 &qcedev_device,
3075#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003076};
3077
3078static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003079 &msm_kgsl_3d0,
3080 &msm_kgsl_2d0,
3081 &msm_kgsl_2d1,
3082 &mipi_dsi_renesas_panel_device,
3083#ifdef CONFIG_MSM_GEMINI
3084 &msm8960_gemini_device,
3085#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003086};
3087
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003088static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003089 &msm8960_device_otg,
3090 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003091 &msm_device_hsusb_host,
3092 &android_usb_device,
3093 &msm_pcm,
3094 &msm_pcm_routing,
3095 &msm_cpudai0,
3096 &msm_cpudai1,
3097 &msm_cpudai_hdmi_rx,
3098 &msm_cpudai_bt_rx,
3099 &msm_cpudai_bt_tx,
3100 &msm_cpudai_fm_rx,
3101 &msm_cpudai_fm_tx,
3102 &msm_cpu_fe,
3103 &msm_stub_codec,
3104 &msm_kgsl_3d0,
3105#ifdef CONFIG_MSM_KGSL_2D
3106 &msm_kgsl_2d0,
3107 &msm_kgsl_2d1,
3108#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003109#ifdef CONFIG_MSM_GEMINI
3110 &msm8960_gemini_device,
3111#endif
3112 &msm_voice,
3113 &msm_voip,
3114 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303115 &msm_cpudai_afe_01_rx,
3116 &msm_cpudai_afe_01_tx,
3117 &msm_cpudai_afe_02_rx,
3118 &msm_cpudai_afe_02_tx,
3119 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003120#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3121 &hdmi_msm_device,
3122#endif
3123 &msm_pcm_hostless,
3124 &msm_bus_apps_fabric,
3125 &msm_bus_sys_fabric,
3126 &msm_bus_mm_fabric,
3127 &msm_bus_sys_fpb,
3128 &msm_bus_cpss_fpb,
3129};
3130
3131static void __init msm8960_i2c_init(void)
3132{
3133 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3134 &msm8960_i2c_qup_gsbi4_pdata;
3135
3136 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3137 &msm8960_i2c_qup_gsbi3_pdata;
3138
3139 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3140 &msm8960_i2c_qup_gsbi10_pdata;
3141
3142 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3143 &msm8960_i2c_qup_gsbi12_pdata;
3144}
3145
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003146static void __init msm8960_gfx_init(void)
3147{
3148 uint32_t soc_platform_version = socinfo_get_platform_version();
3149 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3150 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3151 msm_kgsl_3d0.dev.platform_data;
3152 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3153 320000000;
3154 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3155 266667000;
3156 }
3157}
3158
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003159static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3160 .irq_base = PM8921_IRQ_BASE,
3161 .devirq = MSM_GPIO_TO_INT(104),
3162 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3163};
3164
3165static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3166 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3167};
3168
3169static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3170 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3171};
3172
3173static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3174 .rtc_write_enable = false,
3175};
3176
3177static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3178 .pull_up = 1,
3179 .kpd_trigger_delay_us = 970,
3180 .wakeup = 1,
3181};
3182
3183static const unsigned int keymap[] = {
3184 KEY(0, 0, KEY_VOLUMEUP),
3185 KEY(0, 1, KEY_VOLUMEDOWN),
3186 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3187 KEY(0, 3, KEY_CAMERA_FOCUS),
3188};
3189
3190static struct matrix_keymap_data keymap_data = {
3191 .keymap_size = ARRAY_SIZE(keymap),
3192 .keymap = keymap,
3193};
3194
3195static struct pm8xxx_keypad_platform_data keypad_data = {
3196 .input_name = "keypad_8960",
3197 .input_phys_device = "keypad_8960/input0",
3198 .num_rows = 1,
3199 .num_cols = 5,
3200 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3201 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3202 .debounce_ms = 15,
3203 .scan_delay_ms = 32,
3204 .row_hold_ns = 91500,
3205 .wakeup = 1,
3206 .keymap_data = &keymap_data,
3207};
3208
3209static const unsigned int keymap_sim[] = {
3210 KEY(0, 0, KEY_7),
3211 KEY(0, 1, KEY_DOWN),
3212 KEY(0, 2, KEY_UP),
3213 KEY(0, 3, KEY_RIGHT),
3214 KEY(0, 4, KEY_ENTER),
3215 KEY(0, 5, KEY_L),
3216 KEY(0, 6, KEY_BACK),
3217 KEY(0, 7, KEY_M),
3218
3219 KEY(1, 0, KEY_LEFT),
3220 KEY(1, 1, KEY_SEND),
3221 KEY(1, 2, KEY_1),
3222 KEY(1, 3, KEY_4),
3223 KEY(1, 4, KEY_CLEAR),
3224 KEY(1, 5, KEY_MSDOS),
3225 KEY(1, 6, KEY_SPACE),
3226 KEY(1, 7, KEY_COMMA),
3227
3228 KEY(2, 0, KEY_6),
3229 KEY(2, 1, KEY_5),
3230 KEY(2, 2, KEY_8),
3231 KEY(2, 3, KEY_3),
3232 KEY(2, 4, KEY_NUMERIC_STAR),
3233 KEY(2, 5, KEY_UP),
3234 KEY(2, 6, KEY_DOWN),
3235 KEY(2, 7, KEY_LEFTSHIFT),
3236
3237 KEY(3, 0, KEY_9),
3238 KEY(3, 1, KEY_NUMERIC_POUND),
3239 KEY(3, 2, KEY_0),
3240 KEY(3, 3, KEY_2),
3241 KEY(3, 4, KEY_SLEEP),
3242 KEY(3, 5, KEY_F1),
3243 KEY(3, 6, KEY_F2),
3244 KEY(3, 7, KEY_F3),
3245
3246 KEY(4, 0, KEY_BACK),
3247 KEY(4, 1, KEY_HOME),
3248 KEY(4, 2, KEY_MENU),
3249 KEY(4, 3, KEY_VOLUMEUP),
3250 KEY(4, 4, KEY_VOLUMEDOWN),
3251 KEY(4, 5, KEY_F4),
3252 KEY(4, 6, KEY_F5),
3253 KEY(4, 7, KEY_F6),
3254
3255 KEY(5, 0, KEY_R),
3256 KEY(5, 1, KEY_T),
3257 KEY(5, 2, KEY_Y),
3258 KEY(5, 3, KEY_LEFTALT),
3259 KEY(5, 4, KEY_KPENTER),
3260 KEY(5, 5, KEY_Q),
3261 KEY(5, 6, KEY_W),
3262 KEY(5, 7, KEY_E),
3263
3264 KEY(6, 0, KEY_F),
3265 KEY(6, 1, KEY_G),
3266 KEY(6, 2, KEY_H),
3267 KEY(6, 3, KEY_CAPSLOCK),
3268 KEY(6, 4, KEY_PAGEUP),
3269 KEY(6, 5, KEY_A),
3270 KEY(6, 6, KEY_S),
3271 KEY(6, 7, KEY_D),
3272
3273 KEY(7, 0, KEY_V),
3274 KEY(7, 1, KEY_B),
3275 KEY(7, 2, KEY_N),
3276 KEY(7, 3, KEY_MENU),
3277 KEY(7, 4, KEY_PAGEDOWN),
3278 KEY(7, 5, KEY_Z),
3279 KEY(7, 6, KEY_X),
3280 KEY(7, 7, KEY_C),
3281
3282 KEY(8, 0, KEY_P),
3283 KEY(8, 1, KEY_J),
3284 KEY(8, 2, KEY_K),
3285 KEY(8, 3, KEY_INSERT),
3286 KEY(8, 4, KEY_LINEFEED),
3287 KEY(8, 5, KEY_U),
3288 KEY(8, 6, KEY_I),
3289 KEY(8, 7, KEY_O),
3290
3291 KEY(9, 0, KEY_4),
3292 KEY(9, 1, KEY_5),
3293 KEY(9, 2, KEY_6),
3294 KEY(9, 3, KEY_7),
3295 KEY(9, 4, KEY_8),
3296 KEY(9, 5, KEY_1),
3297 KEY(9, 6, KEY_2),
3298 KEY(9, 7, KEY_3),
3299
3300 KEY(10, 0, KEY_F7),
3301 KEY(10, 1, KEY_F8),
3302 KEY(10, 2, KEY_F9),
3303 KEY(10, 3, KEY_F10),
3304 KEY(10, 4, KEY_FN),
3305 KEY(10, 5, KEY_9),
3306 KEY(10, 6, KEY_0),
3307 KEY(10, 7, KEY_DOT),
3308
3309 KEY(11, 0, KEY_LEFTCTRL),
3310 KEY(11, 1, KEY_F11),
3311 KEY(11, 2, KEY_ENTER),
3312 KEY(11, 3, KEY_SEARCH),
3313 KEY(11, 4, KEY_DELETE),
3314 KEY(11, 5, KEY_RIGHT),
3315 KEY(11, 6, KEY_LEFT),
3316 KEY(11, 7, KEY_RIGHTSHIFT),
3317 KEY(0, 0, KEY_VOLUMEUP),
3318 KEY(0, 1, KEY_VOLUMEDOWN),
3319 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3320 KEY(0, 3, KEY_CAMERA_FOCUS),
3321};
3322
3323static struct matrix_keymap_data keymap_data_sim = {
3324 .keymap_size = ARRAY_SIZE(keymap_sim),
3325 .keymap = keymap_sim,
3326};
3327
3328static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3329 .input_name = "keypad_8960",
3330 .input_phys_device = "keypad_8960/input0",
3331 .num_rows = 12,
3332 .num_cols = 8,
3333 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3334 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3335 .debounce_ms = 15,
3336 .scan_delay_ms = 32,
3337 .row_hold_ns = 91500,
3338 .wakeup = 1,
3339 .keymap_data = &keymap_data_sim,
3340};
3341
3342static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003343 .safety_time = 180,
3344 .update_time = 1,
3345 .max_voltage = 4200,
3346 .min_voltage = 3200,
3347 .resume_voltage = 4100,
3348 .term_current = 100,
3349 .cool_temp = 10,
3350 .warm_temp = 40,
3351 .temp_check_period = 1,
3352 .max_bat_chg_current = 400,
3353 .cool_bat_chg_current = 350,
3354 .warm_bat_chg_current = 350,
3355 .cool_bat_voltage = 4100,
3356 .warm_bat_voltage = 4100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003357};
3358
3359static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3360 .priority = 0,
3361};
3362
3363static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3364 .r_sense = 10,
3365 .i_test = 2500,
3366 .v_failure = 3000,
3367 .calib_delay_ms = 600000,
3368 .batt_data = &palladium_1500_data,
3369};
3370
Jay Chokshide4cefb2011-08-04 18:10:44 -07003371#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3372
3373/**
3374 * 'flag' stores three values; led id, led mode, and max current of led.
3375 * The bit packing format is as follow,
3376 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3377 * led_id (1 nibble)
3378 */
3379#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3380 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3381 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3382 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3383 PM8XXX_LED_MAX_CURRENT_MASK))
3384
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385static struct led_info pm8921_led_info[] = {
3386 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003387 .name = "led:usb",
3388 .default_trigger = "usb-online",
3389 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3390 PM8XXX_LED_MODE_MANUAL,
3391 PM8921_LC_LED_MAX_CURRENT),
3392 },
3393 [1] = {
3394 .name = "led:ac",
3395 .default_trigger = "ac-online",
3396 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3397 PM8XXX_LED_MODE_MANUAL,
3398 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003399 },
3400};
3401
3402static struct led_platform_data pm8xxx_leds_pdata = {
3403 .num_leds = ARRAY_SIZE(pm8921_led_info),
3404 .leds = pm8921_led_info,
3405};
3406
3407static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3408 .irq_pdata = &pm8xxx_irq_pdata,
3409 .gpio_pdata = &pm8xxx_gpio_pdata,
3410 .mpp_pdata = &pm8xxx_mpp_pdata,
3411 .rtc_pdata = &pm8xxx_rtc_pdata,
3412 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3413 .keypad_pdata = &keypad_data,
3414 .misc_pdata = &pm8xxx_misc_pdata,
3415 .regulator_pdatas = msm_pm8921_regulator_pdata,
3416 .charger_pdata = &pm8921_chg_pdata,
3417 .bms_pdata = &pm8921_bms_pdata,
3418 .adc_pdata = &pm8921_adc_pdata,
3419 .leds_pdata = &pm8xxx_leds_pdata,
3420};
3421
3422static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3423 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3424 .slave = {
3425 .name = "pm8921-core",
3426 .platform_data = &pm8921_platform_data,
3427 },
3428};
3429
3430static void msm8960_wcnss_init(void)
3431{
3432 int i, ret, j;
3433
3434 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3435 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3436 "wcnss_5_wire");
3437 if (ret) {
3438 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3439 wcnss_5wire_interface[i].gpio, ret);
3440 goto fail;
3441 }
3442 }
3443
3444 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3445
3446 return;
3447
3448fail:
3449 for (j = 0; j < i; j++)
3450 gpio_free(wcnss_5wire_interface[j].gpio);
3451}
3452
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003453#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003454static int ethernet_init(void)
3455{
3456 int ret;
3457 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3458 if (ret) {
3459 pr_err("ks8851 gpio_request failed: %d\n", ret);
3460 goto fail;
3461 }
3462
3463 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3464 if (ret) {
3465 pr_err("ks8851 gpio_request failed: %d\n", ret);
3466 goto fail_rst;
3467 }
3468
3469 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3470 if (ret) {
3471 pr_err("ks8851 gpio_request failed: %d\n", ret);
3472 goto fail_cs;
3473 }
3474
3475 gpio_direction_output(FPGA_CS_GPIO, 1);
3476 gpio_direction_output(KS8851_RST_GPIO, 1);
3477 return 0;
3478fail_cs:
3479 gpio_free(KS8851_RST_GPIO);
3480fail_rst:
3481 gpio_free(KS8851_IRQ_GPIO);
3482fail:
3483 return ret;
3484}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003485#else
3486static int ethernet_init(void)
3487{
3488 return 0;
3489}
3490#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003491
3492static struct msm_cpuidle_state msm_cstates[] __initdata = {
3493 {0, 0, "C0", "WFI",
3494 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3495
3496 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3497 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3498
3499 {0, 2, "C2", "POWER_COLLAPSE",
3500 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3501
3502 {1, 0, "C0", "WFI",
3503 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3504
3505 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3506 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3507};
3508
3509static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3510 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3511 .idle_supported = 1,
3512 .suspend_supported = 1,
3513 .idle_enabled = 0,
3514 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003515 },
3516
3517 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3518 .idle_supported = 1,
3519 .suspend_supported = 1,
3520 .idle_enabled = 0,
3521 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003522 },
3523
3524 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3525 .idle_supported = 1,
3526 .suspend_supported = 1,
3527 .idle_enabled = 1,
3528 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003529 },
3530
3531 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3532 .idle_supported = 0,
3533 .suspend_supported = 1,
3534 .idle_enabled = 0,
3535 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003536 },
3537
3538 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3539 .idle_supported = 1,
3540 .suspend_supported = 1,
3541 .idle_enabled = 0,
3542 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003543 },
3544
3545 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3546 .idle_supported = 1,
3547 .suspend_supported = 0,
3548 .idle_enabled = 1,
3549 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003550 },
3551};
3552
3553static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3554 {
3555 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3556 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3557 true,
3558 1, 8000, 100000, 1,
3559 },
3560
3561 {
3562 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3563 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3564 true,
3565 1500, 5000, 60100000, 3000,
3566 },
3567
3568 {
3569 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3570 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3571 false,
3572 1800, 5000, 60350000, 3500,
3573 },
3574
3575 {
3576 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3577 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3578 false,
3579 2800, 2500, 65350000, 4800,
3580 },
3581
3582 {
3583 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3584 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3585 false,
3586 3800, 4500, 67850000, 5500,
3587 },
3588
3589 {
3590 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3591 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3592 false,
3593 4800, 2000, 71850000, 6800,
3594 },
3595
3596 {
3597 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3598 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3599 false,
3600 6800, 500, 75850000, 8800,
3601 },
3602
3603 {
3604 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3605 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3606 false,
3607 7800, 0, 76350000, 9800,
3608 },
3609};
3610
3611#ifdef CONFIG_I2C
3612#define I2C_SURF 1
3613#define I2C_FFA (1 << 1)
3614#define I2C_RUMI (1 << 2)
3615#define I2C_SIM (1 << 3)
3616#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003617#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003618
3619struct i2c_registry {
3620 u8 machs;
3621 int bus;
3622 struct i2c_board_info *info;
3623 int len;
3624};
3625
3626#ifdef CONFIG_MSM_CAMERA
3627static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3628#ifdef CONFIG_IMX074
3629 {
3630 I2C_BOARD_INFO("imx074", 0x1A),
3631 },
3632#endif
3633#ifdef CONFIG_OV2720
3634 {
3635 I2C_BOARD_INFO("ov2720", 0x6C),
3636 },
3637#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003638 {
3639 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3640 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303641#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3642 {
3643 I2C_BOARD_INFO("sc628a", 0x6E),
3644 },
3645#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003646};
3647#endif
3648
3649/* Sensors DSPS platform data */
3650#ifdef CONFIG_MSM_DSPS
3651#define DSPS_PIL_GENERIC_NAME "dsps"
3652#endif /* CONFIG_MSM_DSPS */
3653
3654static void __init msm8960_init_dsps(void)
3655{
3656#ifdef CONFIG_MSM_DSPS
3657 struct msm_dsps_platform_data *pdata =
3658 msm_dsps_device.dev.platform_data;
3659 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3660 pdata->gpios = NULL;
3661 pdata->gpios_num = 0;
3662
3663 platform_device_register(&msm_dsps_device);
3664#endif /* CONFIG_MSM_DSPS */
3665}
3666
3667static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3668#ifdef CONFIG_MSM_CAMERA
3669 {
Amir Samuelov05f87802011-08-27 18:30:12 +03003670 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003671 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3672 msm_camera_boardinfo,
3673 ARRAY_SIZE(msm_camera_boardinfo),
3674 },
3675#endif
3676 {
3677 I2C_SURF | I2C_FFA | I2C_FLUID,
3678 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3679 cyttsp_info,
3680 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003681 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003682};
3683#endif /* CONFIG_I2C */
3684
3685static void __init register_i2c_devices(void)
3686{
3687#ifdef CONFIG_I2C
3688 u8 mach_mask = 0;
3689 int i;
3690
3691 /* Build the matching 'supported_machs' bitmask */
3692 if (machine_is_msm8960_cdp())
3693 mach_mask = I2C_SURF;
3694 else if (machine_is_msm8960_rumi3())
3695 mach_mask = I2C_RUMI;
3696 else if (machine_is_msm8960_sim())
3697 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003698 else if (machine_is_msm8960_fluid())
3699 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003700 else if (machine_is_msm8960_liquid())
3701 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003702 else if (machine_is_msm8960_mtp())
3703 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003704 else
3705 pr_err("unmatched machine ID in register_i2c_devices\n");
3706
3707 /* Run the array and install devices as appropriate */
3708 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3709 if (msm8960_i2c_devices[i].machs & mach_mask)
3710 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3711 msm8960_i2c_devices[i].info,
3712 msm8960_i2c_devices[i].len);
3713 }
3714#endif
3715}
3716
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003717static void __init msm8960_sim_init(void)
3718{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003719 if (socinfo_init() < 0)
3720 pr_err("socinfo_init() failed!\n");
3721
3722 BUG_ON(msm_rpm_init(&msm_rpm_data));
3723 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3724 ARRAY_SIZE(msm_rpmrs_levels)));
3725 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003726 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003727 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003728 msm8960_device_ssbi_pm8921.dev.platform_data =
3729 &msm8960_ssbi_pm8921_pdata;
3730 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003731
3732 /* Simulator supports a QWERTY keypad */
3733 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3734
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003735 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3736 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3737 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738 gpiomux_init();
3739 ethernet_init();
3740 msm8960_i2c_init();
3741 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3742 msm_spm_l2_init(msm_spm_l2_data);
3743 msm8960_init_buses();
3744 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3745 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003746 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07003747 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003748
3749 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3750 &msm8960_qup_spi_gsbi1_pdata;
3751 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3752
3753 msm8960_init_mmc();
3754 msm_fb_add_devices();
3755 slim_register_board_info(msm_slim_devices,
3756 ARRAY_SIZE(msm_slim_devices));
3757 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3758 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3759 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3760 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003761}
3762
3763static void __init msm8960_rumi3_init(void)
3764{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003765 if (socinfo_init() < 0)
3766 pr_err("socinfo_init() failed!\n");
3767
3768 BUG_ON(msm_rpm_init(&msm_rpm_data));
3769 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3770 ARRAY_SIZE(msm_rpmrs_levels)));
3771 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003772 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003773 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003774 gpiomux_init();
3775 ethernet_init();
3776 msm8960_device_ssbi_pm8921.dev.platform_data =
3777 &msm8960_ssbi_pm8921_pdata;
3778 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3779 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3780 &msm8960_qup_spi_gsbi1_pdata;
3781 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3782 msm8960_i2c_init();
3783 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3784 msm_spm_l2_init(msm_spm_l2_data);
3785 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3786 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003787 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003788 msm8960_init_mmc();
3789
3790 register_i2c_devices();
3791 msm_fb_add_devices();
3792 slim_register_board_info(msm_slim_devices,
3793 ARRAY_SIZE(msm_slim_devices));
3794 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3795 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3796 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3797 msm_pm_data);
3798}
3799
3800static void __init msm8960_cdp_init(void)
3801{
3802 if (socinfo_init() < 0)
3803 pr_err("socinfo_init() failed!\n");
3804
3805 BUG_ON(msm_rpm_init(&msm_rpm_data));
3806 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3807 ARRAY_SIZE(msm_rpmrs_levels)));
3808 regulator_suppress_info_printing();
3809 if (msm_xo_init())
3810 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003811 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003812 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003813 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3814 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3815 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003816 gpiomux_init();
3817 ethernet_init();
3818 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3819 &msm8960_qup_spi_gsbi1_pdata;
3820 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3821 msm8960_device_ssbi_pm8921.dev.platform_data =
3822 &msm8960_ssbi_pm8921_pdata;
3823 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3824 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003825 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003826 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3827 msm_spm_l2_init(msm_spm_l2_data);
3828 msm8960_init_buses();
3829 platform_add_devices(msm_footswitch_devices,
3830 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07003831 if (machine_is_msm8960_liquid())
3832 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003833 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3834 pm8921_gpio_mpp_init();
3835 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3836 msm8960_init_cam();
3837 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003838 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003839 register_i2c_devices();
3840 msm8960_wcnss_init();
3841 msm_fb_add_devices();
3842 slim_register_board_info(msm_slim_devices,
3843 ARRAY_SIZE(msm_slim_devices));
3844 msm8960_init_dsps();
3845 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3846 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3847 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3848 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003849 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003850}
3851
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003852MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3853 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003854 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003855 .init_irq = msm8960_init_irq,
3856 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003857 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003858 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003859MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003860
3861MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3862 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003863 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003864 .init_irq = msm8960_init_irq,
3865 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003866 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003867 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003868MACHINE_END
3869
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003870MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3871 .map_io = msm8960_map_io,
3872 .reserve = msm8960_reserve,
3873 .init_irq = msm8960_init_irq,
3874 .timer = &msm_timer,
3875 .init_machine = msm8960_cdp_init,
3876 .init_early = msm8960_allocate_memory_regions,
3877MACHINE_END
3878
3879MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3880 .map_io = msm8960_map_io,
3881 .reserve = msm8960_reserve,
3882 .init_irq = msm8960_init_irq,
3883 .timer = &msm_timer,
3884 .init_machine = msm8960_cdp_init,
3885 .init_early = msm8960_allocate_memory_regions,
3886MACHINE_END
3887
3888MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3889 .map_io = msm8960_map_io,
3890 .reserve = msm8960_reserve,
3891 .init_irq = msm8960_init_irq,
3892 .timer = &msm_timer,
3893 .init_machine = msm8960_cdp_init,
3894 .init_early = msm8960_allocate_memory_regions,
3895MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003896
3897MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3898 .map_io = msm8960_map_io,
3899 .reserve = msm8960_reserve,
3900 .init_irq = msm8960_init_irq,
3901 .timer = &msm_timer,
3902 .init_machine = msm8960_cdp_init,
3903 .init_early = msm8960_allocate_memory_regions,
3904MACHINE_END