blob: 8e76c487eaa96ba69daa5fb6636e7b268bf7446d [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>
27#ifdef CONFIG_ANDROID_PMEM
28#include <linux/android_pmem.h>
29#endif
30#include <linux/cyttsp.h>
31#include <linux/dma-mapping.h>
32#include <linux/platform_data/qcom_crypto_device.h>
33#include <linux/leds.h>
34#include <linux/leds-pm8xxx.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080035
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070038#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080039#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080041
42#include <mach/board.h>
43#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044#include <mach/msm_spi.h>
45#ifdef CONFIG_USB_MSM_OTG_72K
46#include <mach/msm_hsusb.h>
47#else
48#include <linux/usb/msm_hsusb.h>
49#endif
50#include <linux/usb/android.h>
51#include <mach/usbdiag.h>
52#include <mach/socinfo.h>
53#include <mach/rpm.h>
54#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070055#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_bus_board.h>
57#include <mach/msm_memtypes.h>
58#include <mach/dma.h>
59#include <mach/msm_dsps.h>
60#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#ifdef CONFIG_WCD9310_CODEC
63#include <linux/slimbus/slimbus.h>
64#include <linux/mfd/wcd9310/core.h>
65#include <linux/mfd/wcd9310/pdata.h>
66#endif
67
68#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080069#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#include "spm.h"
72#include "board-msm8960.h"
73#include "pm.h"
74#include "cpuidle.h"
75#include "rpm_resources.h"
76#include "mpm.h"
77
78static struct platform_device msm_fm_platform_init = {
79 .name = "iris_fm",
80 .id = -1,
81};
82
83struct pm8xxx_gpio_init {
84 unsigned gpio;
85 struct pm_gpio config;
86};
87
88struct pm8xxx_mpp_init {
89 unsigned mpp;
90 struct pm8xxx_mpp_config_data config;
91};
92
93#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
94 _func, _inv, _disable) \
95{ \
96 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
97 .config = { \
98 .direction = _dir, \
99 .output_buffer = _buf, \
100 .output_value = _val, \
101 .pull = _pull, \
102 .vin_sel = _vin, \
103 .out_strength = _out_strength, \
104 .function = _func, \
105 .inv_int_pol = _inv, \
106 .disable_pin = _disable, \
107 } \
108}
109
110#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
111{ \
112 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
113 .config = { \
114 .type = PM8XXX_MPP_TYPE_##_type, \
115 .level = _level, \
116 .control = PM8XXX_MPP_##_control, \
117 } \
118}
119
120#define PM8XXX_GPIO_DISABLE(_gpio) \
121 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
122 0, 0, 0, 1)
123
124#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
125 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
126 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
127 PM_GPIO_STRENGTH_HIGH, \
128 PM_GPIO_FUNC_NORMAL, 0, 0)
129
130#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
131 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
132 _pull, PM_GPIO_VIN_S4, \
133 PM_GPIO_STRENGTH_NO, \
134 PM_GPIO_FUNC_NORMAL, 0, 0)
135
136#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
138 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_HIGH, \
140 _func, 0, 0)
141
142/* Initial PM8921 GPIO configurations */
143static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
144 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
145 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
146 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
147 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700148 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
150 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
151};
152
153/* Initial PM8921 MPP configurations */
154static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
155 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
156 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
157 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
158 DOUT_CTRL_LOW),
159 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
160 DOUT_CTRL_LOW),
161};
162
163static void __init pm8921_gpio_mpp_init(void)
164{
165 int i, rc;
166
167 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
168 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
169 &pm8921_gpios[i].config);
170 if (rc) {
171 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
172 break;
173 }
174 }
175
176 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
177 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
178 &pm8921_mpps[i].config);
179 if (rc) {
180 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
181 break;
182 }
183 }
184}
185
186#define FPGA_CS_GPIO 14
187#define KS8851_RST_GPIO 89
188#define KS8851_IRQ_GPIO 90
189
190/* Macros assume PMIC GPIOs and MPPs start at 1 */
191#define PM8921_GPIO_BASE NR_GPIO_IRQS
192#define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE)
193#define PM8921_MPP_BASE (PM8921_GPIO_BASE + PM8921_NR_GPIOS)
194#define PM8921_MPP_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_MPP_BASE)
195#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
196#define PM8921_MPP_IRQ_BASE (PM8921_IRQ_BASE + NR_GPIO_IRQS)
197
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700198#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
199enum {
200 GPIO_EXPANDER_IRQ_BASE = (PM8921_MPP_IRQ_BASE + PM8921_NR_MPPS),
201 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
202 /* CAM Expander */
203 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
204 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
205 GPIO_CAM_GP_AFBUSY,
206 GPIO_CAM_GP_STROBE_CE,
207 GPIO_CAM_GP_CAM1MP_XCLR,
208 GPIO_CAM_GP_CAMIF_RESET_N,
209 GPIO_CAM_GP_XMT_FLASH_INT,
210 GPIO_CAM_GP_LED_EN1,
211 GPIO_CAM_GP_LED_EN2,
212
213};
214#endif
215
Harini Jayaraman608d0462011-08-09 19:10:03 -0600216/* The SPI configurations apply to GSBI 1*/
217static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700218 .func = GPIOMUX_FUNC_1,
219 .drv = GPIOMUX_DRV_8MA,
220 .pull = GPIOMUX_PULL_NONE,
221};
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223static struct gpiomux_setting spi_suspended_config = {
224 .func = GPIOMUX_FUNC_GPIO,
225 .drv = GPIOMUX_DRV_2MA,
226 .pull = GPIOMUX_PULL_DOWN,
227};
228
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700229static struct gpiomux_setting gsbi3 = {
230 .func = GPIOMUX_FUNC_1,
231 .drv = GPIOMUX_DRV_8MA,
232 .pull = GPIOMUX_PULL_NONE,
233};
234
235static struct gpiomux_setting gsbi4 = {
236 .func = GPIOMUX_FUNC_1,
237 .drv = GPIOMUX_DRV_8MA,
238 .pull = GPIOMUX_PULL_NONE,
239};
240
241static struct gpiomux_setting gsbi5 = {
242 .func = GPIOMUX_FUNC_1,
243 .drv = GPIOMUX_DRV_8MA,
244 .pull = GPIOMUX_PULL_NONE,
245};
246
247static struct gpiomux_setting gsbi10 = {
248 .func = GPIOMUX_FUNC_2,
249 .drv = GPIOMUX_DRV_8MA,
250 .pull = GPIOMUX_PULL_NONE,
251};
252
253static struct gpiomux_setting gsbi12 = {
254 .func = GPIOMUX_FUNC_1,
255 .drv = GPIOMUX_DRV_8MA,
256 .pull = GPIOMUX_PULL_NONE,
257};
258
259static struct gpiomux_setting cdc_mclk = {
260 .func = GPIOMUX_FUNC_1,
261 .drv = GPIOMUX_DRV_8MA,
262 .pull = GPIOMUX_PULL_NONE,
263};
264
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700265#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700266static struct gpiomux_setting gpio_eth_config = {
267 .pull = GPIOMUX_PULL_NONE,
268 .drv = GPIOMUX_DRV_8MA,
269 .func = GPIOMUX_FUNC_GPIO,
270};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700271#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272
273static struct gpiomux_setting slimbus = {
274 .func = GPIOMUX_FUNC_1,
275 .drv = GPIOMUX_DRV_8MA,
276 .pull = GPIOMUX_PULL_KEEPER,
277};
278
279struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700280#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281 {
282 .gpio = KS8851_IRQ_GPIO,
283 .settings = {
284 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
285 }
286 },
287 {
288 .gpio = KS8851_RST_GPIO,
289 .settings = {
290 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
291 }
292 },
293 {
294 .gpio = FPGA_CS_GPIO,
295 .settings = {
296 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
297 }
298 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700299#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700300};
301
302static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
303 {
304 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
305 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600306 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
307 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308 },
309 },
310 {
311 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
312 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600313 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
314 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315 },
316 },
317 {
318 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
319 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600320 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
321 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 },
323 },
324 {
325 .gpio = 9, /* GSBI1 QUP SPI_CLK */
326 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600327 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
328 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 },
330 },
331 {
332 .gpio = 16, /* GSBI3 I2C QUP SDA */
333 .settings = {
334 [GPIOMUX_SUSPENDED] = &gsbi3,
335 },
336 },
337 {
338 .gpio = 17, /* GSBI3 I2C QUP SCL */
339 .settings = {
340 [GPIOMUX_SUSPENDED] = &gsbi3,
341 },
342 },
343 {
344 .gpio = 20, /* GSBI4 I2C QUP SDA */
345 .settings = {
346 [GPIOMUX_SUSPENDED] = &gsbi4,
347 },
348 },
349 {
350 .gpio = 21, /* GSBI4 I2C QUP SCL */
351 .settings = {
352 [GPIOMUX_SUSPENDED] = &gsbi4,
353 },
354 },
355 {
356 .gpio = 22, /* GSBI5 UART2 */
357 .settings = {
358 [GPIOMUX_SUSPENDED] = &gsbi5,
359 },
360 },
361 {
362 .gpio = 23, /* GSBI5 UART2 */
363 .settings = {
364 [GPIOMUX_SUSPENDED] = &gsbi5,
365 },
366 },
367 {
368 .gpio = 24, /* GSBI5 UART2 */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &gsbi5,
371 },
372 },
373 {
374 .gpio = 25, /* GSBI5 UART2 */
375 .settings = {
376 [GPIOMUX_SUSPENDED] = &gsbi5,
377 },
378 },
379 {
380 .gpio = 44, /* GSBI12 I2C QUP SDA */
381 .settings = {
382 [GPIOMUX_SUSPENDED] = &gsbi12,
383 },
384 },
385 {
386 .gpio = 45, /* GSBI12 I2C QUP SCL */
387 .settings = {
388 [GPIOMUX_SUSPENDED] = &gsbi12,
389 },
390 },
391 {
392 .gpio = 73, /* GSBI10 I2C QUP SDA */
393 .settings = {
394 [GPIOMUX_SUSPENDED] = &gsbi10,
395 },
396 },
397 {
398 .gpio = 74, /* GSBI10 I2C QUP SCL */
399 .settings = {
400 [GPIOMUX_SUSPENDED] = &gsbi10,
401 },
402 },
403};
404
405static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
406 {
407 .gpio = 60, /* slimbus data */
408 .settings = {
409 [GPIOMUX_SUSPENDED] = &slimbus,
410 },
411 },
412 {
413 .gpio = 61, /* slimbus clk */
414 .settings = {
415 [GPIOMUX_SUSPENDED] = &slimbus,
416 },
417 },
418};
419
420static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
421 {
422 .gpio = 59,
423 .settings = {
424 [GPIOMUX_SUSPENDED] = &cdc_mclk,
425 },
426 },
427};
428static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
429 .func = GPIOMUX_FUNC_GPIO,
430 .drv = GPIOMUX_DRV_2MA,
431 .pull = GPIOMUX_PULL_NONE,
432};
433
434static struct gpiomux_setting wcnss_5wire_active_cfg = {
435 .func = GPIOMUX_FUNC_1,
436 .drv = GPIOMUX_DRV_6MA,
437 .pull = GPIOMUX_PULL_DOWN,
438};
439
440static struct msm_gpiomux_config wcnss_5wire_interface[] = {
441 {
442 .gpio = 84,
443 .settings = {
444 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
445 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
446 },
447 },
448 {
449 .gpio = 85,
450 .settings = {
451 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
452 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
453 },
454 },
455 {
456 .gpio = 86,
457 .settings = {
458 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
459 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
460 },
461 },
462 {
463 .gpio = 87,
464 .settings = {
465 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
466 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
467 },
468 },
469 {
470 .gpio = 88,
471 .settings = {
472 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
473 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
474 },
475 },
476};
Nishant Pandit474f2252011-07-23 23:17:56 +0530477static struct gpiomux_setting cam_settings[4] = {
478 {
479 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
480 .drv = GPIOMUX_DRV_2MA,
481 .pull = GPIOMUX_PULL_DOWN,
482 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700483
Nishant Pandit474f2252011-07-23 23:17:56 +0530484 {
485 .func = GPIOMUX_FUNC_1, /*active 1*/
486 .drv = GPIOMUX_DRV_2MA,
487 .pull = GPIOMUX_PULL_NONE,
488 },
489
490 {
491 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
492 .drv = GPIOMUX_DRV_2MA,
493 .pull = GPIOMUX_PULL_NONE,
494 },
495
496 {
497 .func = GPIOMUX_FUNC_1, /*active 3*/
498 .drv = GPIOMUX_DRV_8MA,
499 .pull = GPIOMUX_PULL_UP,
500 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700501};
502
Nishant Pandit474f2252011-07-23 23:17:56 +0530503static struct msm_gpiomux_config msm8960_cam_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504 {
505 .gpio = 2,
506 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530507 [GPIOMUX_ACTIVE] = &cam_settings[2],
508 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700509 },
510 },
511 {
512 .gpio = 3,
513 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530514 [GPIOMUX_ACTIVE] = &cam_settings[1],
515 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700516 },
517 },
518 {
519 .gpio = 4,
520 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530521 [GPIOMUX_ACTIVE] = &cam_settings[1],
522 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523 },
524 },
525 {
526 .gpio = 5,
527 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530528 [GPIOMUX_ACTIVE] = &cam_settings[1],
529 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700530 },
531 },
532 {
533 .gpio = 18,
534 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530535 [GPIOMUX_ACTIVE] = &cam_settings[3],
536 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700537 },
538 },
539 {
540 .gpio = 19,
541 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530542 [GPIOMUX_ACTIVE] = &cam_settings[3],
543 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700544 },
545 },
546 {
547 .gpio = 20,
548 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530549 [GPIOMUX_ACTIVE] = &cam_settings[3],
550 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700551 },
552 },
553 {
554 .gpio = 21,
555 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530556 [GPIOMUX_ACTIVE] = &cam_settings[3],
557 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700558 },
559 },
560 {
561 .gpio = 76,
562 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530563 [GPIOMUX_ACTIVE] = &cam_settings[2],
564 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565 },
566 },
567 {
568 .gpio = 107,
569 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530570 [GPIOMUX_ACTIVE] = &cam_settings[2],
571 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700572 },
573 },
574};
575
576static struct gpiomux_setting cyts_resout_sus_cfg = {
577 .func = GPIOMUX_FUNC_GPIO,
578 .drv = GPIOMUX_DRV_6MA,
579 .pull = GPIOMUX_PULL_UP,
580};
581
582static struct gpiomux_setting cyts_resout_act_cfg = {
583 .func = GPIOMUX_FUNC_GPIO,
584 .drv = GPIOMUX_DRV_6MA,
585 .pull = GPIOMUX_PULL_UP,
586};
587
588static struct gpiomux_setting cyts_sleep_sus_cfg = {
589 .func = GPIOMUX_FUNC_GPIO,
590 .drv = GPIOMUX_DRV_6MA,
591 .pull = GPIOMUX_PULL_DOWN,
592};
593
594static struct gpiomux_setting cyts_sleep_act_cfg = {
595 .func = GPIOMUX_FUNC_GPIO,
596 .drv = GPIOMUX_DRV_6MA,
597 .pull = GPIOMUX_PULL_DOWN,
598};
599
600static struct gpiomux_setting cyts_int_act_cfg = {
601 .func = GPIOMUX_FUNC_GPIO,
602 .drv = GPIOMUX_DRV_8MA,
603 .pull = GPIOMUX_PULL_UP,
604};
605
606static struct gpiomux_setting cyts_int_sus_cfg = {
607 .func = GPIOMUX_FUNC_GPIO,
608 .drv = GPIOMUX_DRV_2MA,
609 .pull = GPIOMUX_PULL_UP,
610};
611
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700612static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
613 { /* TS INTERRUPT */
614 .gpio = 11,
615 .settings = {
616 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
617 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
618 },
619 },
620 { /* TS SLEEP */
621 .gpio = 50,
622 .settings = {
623 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
624 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
625 },
626 },
627 { /* TS RESOUT */
628 .gpio = 52,
629 .settings = {
630 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
631 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
632 },
633 },
634};
635
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700636#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
637enum {
638 SX150X_CAM,
639};
640
Nishant Pandit474f2252011-07-23 23:17:56 +0530641static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700642 [SX150X_CAM] = {
643 .gpio_base = GPIO_CAM_EXPANDER_BASE,
644 .oscio_is_gpo = false,
645 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530646 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700647 .io_open_drain_ena = 0x0,
648 .irq_summary = -1,
649 },
650};
Nishant Pandit474f2252011-07-23 23:17:56 +0530651
652#endif
653
654#ifdef CONFIG_I2C
655
656#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
657#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
658
659#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
660
661static struct i2c_board_info cam_expander_i2c_info[] = {
662 {
663 I2C_BOARD_INFO("sx1508q", 0x22),
664 .platform_data = &sx150x_data[SX150X_CAM]
665 },
666};
667
668static struct msm_cam_expander_info cam_expander_info[] = {
669 {
670 cam_expander_i2c_info,
671 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
672 },
673};
674#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700675#endif
676
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700677#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
678#define MSM_PMEM_ADSP_SIZE 0x3800000
679#define MSM_PMEM_AUDIO_SIZE 0x279000
680#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
681
682#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
683static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
684static int __init pmem_kernel_ebi1_size_setup(char *p)
685{
686 pmem_kernel_ebi1_size = memparse(p, NULL);
687 return 0;
688}
689early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
690#endif
691
692#ifdef CONFIG_ANDROID_PMEM
693static unsigned pmem_size = MSM_PMEM_SIZE;
694static int __init pmem_size_setup(char *p)
695{
696 pmem_size = memparse(p, NULL);
697 return 0;
698}
699early_param("pmem_size", pmem_size_setup);
700
701static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
702
703static int __init pmem_adsp_size_setup(char *p)
704{
705 pmem_adsp_size = memparse(p, NULL);
706 return 0;
707}
708early_param("pmem_adsp_size", pmem_adsp_size_setup);
709
710static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
711
712static int __init pmem_audio_size_setup(char *p)
713{
714 pmem_audio_size = memparse(p, NULL);
715 return 0;
716}
717early_param("pmem_audio_size", pmem_audio_size_setup);
718#endif
719
720#ifdef CONFIG_ANDROID_PMEM
721static struct android_pmem_platform_data android_pmem_pdata = {
722 .name = "pmem",
723 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
724 .cached = 1,
725 .memory_type = MEMTYPE_EBI1,
726};
727
728static struct platform_device android_pmem_device = {
729 .name = "android_pmem",
730 .id = 0,
731 .dev = {.platform_data = &android_pmem_pdata},
732};
733
734static struct android_pmem_platform_data android_pmem_adsp_pdata = {
735 .name = "pmem_adsp",
736 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
737 .cached = 0,
738 .memory_type = MEMTYPE_EBI1,
739};
740static struct platform_device android_pmem_adsp_device = {
741 .name = "android_pmem",
742 .id = 2,
743 .dev = { .platform_data = &android_pmem_adsp_pdata },
744};
745
746static struct android_pmem_platform_data android_pmem_audio_pdata = {
747 .name = "pmem_audio",
748 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
749 .cached = 0,
750 .memory_type = MEMTYPE_EBI1,
751};
752
753static struct platform_device android_pmem_audio_device = {
754 .name = "android_pmem",
755 .id = 4,
756 .dev = { .platform_data = &android_pmem_audio_pdata },
757};
758#endif
759
760static struct memtype_reserve msm8960_reserve_table[] __initdata = {
761 [MEMTYPE_SMI] = {
762 },
763 [MEMTYPE_EBI0] = {
764 .flags = MEMTYPE_FLAGS_1M_ALIGN,
765 },
766 [MEMTYPE_EBI1] = {
767 .flags = MEMTYPE_FLAGS_1M_ALIGN,
768 },
769};
770
771static void __init size_pmem_devices(void)
772{
773#ifdef CONFIG_ANDROID_PMEM
774 android_pmem_adsp_pdata.size = pmem_adsp_size;
775 android_pmem_pdata.size = pmem_size;
776 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
777#endif
778}
779
780static void __init reserve_memory_for(struct android_pmem_platform_data *p)
781{
782 msm8960_reserve_table[p->memory_type].size += p->size;
783}
784
785static void __init reserve_pmem_memory(void)
786{
787#ifdef CONFIG_ANDROID_PMEM
788 reserve_memory_for(&android_pmem_adsp_pdata);
789 reserve_memory_for(&android_pmem_pdata);
790 reserve_memory_for(&android_pmem_audio_pdata);
791 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
792#endif
793}
794
Larry Basselb4126da2011-07-18 14:31:33 -0700795static int msm8960_paddr_to_memtype(unsigned int paddr)
796{
797 return MEMTYPE_EBI1;
798}
799
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700800static void __init msm8960_calculate_reserve_sizes(void)
801{
802 size_pmem_devices();
803 reserve_pmem_memory();
804}
805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806static struct reserve_info msm8960_reserve_info __initdata = {
807 .memtype_reserve_table = msm8960_reserve_table,
808 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
809 .paddr_to_memtype = msm8960_paddr_to_memtype,
810};
811
Larry Basselb4126da2011-07-18 14:31:33 -0700812static int msm8960_memory_bank_size(void)
813{
814 return 1<<29;
815}
816
817static void __init locate_unstable_memory(void)
818{
819 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
820 unsigned long bank_size;
821 unsigned long low, high;
822
823 bank_size = msm8960_memory_bank_size();
824 low = meminfo.bank[0].start;
825 high = mb->start + mb->size;
826 low &= ~(bank_size - 1);
827
828 if (high - low <= bank_size)
829 return;
830 msm8960_reserve_info.low_unstable_address = low + bank_size;
831 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
832 msm8960_reserve_info.bank_size = bank_size;
833 pr_info("low unstable address %lx max size %lx bank size %lx\n",
834 msm8960_reserve_info.low_unstable_address,
835 msm8960_reserve_info.max_unstable_size,
836 msm8960_reserve_info.bank_size);
837}
838
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700839static void __init msm8960_reserve(void)
840{
841 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700842 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700843 msm_reserve();
844}
845
Larry Bassela7eadea2011-07-14 10:46:00 -0700846static int msm8960_change_memory_power(unsigned long start_pfn,
847 unsigned long nr_pages, int change_type)
848{
849 return 1;
850}
851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852#ifdef CONFIG_MSM_CAMERA
853
854static int msm_cam_gpio_tbl[] = {
855 5, /*CAMIF_MCLK*/
856 20, /*CAMIF_I2C_DATA*/
857 21, /*CAMIF_I2C_CLK*/
858};
859
860#define VFE_CAMIF_TIMER1_GPIO 2
861#define VFE_CAMIF_TIMER2_GPIO 3
862#define VFE_CAMIF_TIMER3_GPIO_INT 4
863struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
864 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
865 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
866 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
867 .flash_recharge_duration = 50000,
868 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
869};
870
Nishant Pandit474f2252011-07-23 23:17:56 +0530871#ifdef CONFIG_MSM_CAMERA_FLASH
872static struct msm_camera_sensor_flash_src msm_flash_src = {
873 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
874 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
875 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
876#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
877 defined(CONFIG_GPIO_SX150X_MODULE))
878 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
879#endif
880};
881#endif
882
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700883#ifdef CONFIG_IMX074
884static struct msm_camera_sensor_platform_info sensor_board_info = {
Mansoor Aftab6d6ff5e2011-07-20 17:25:36 -0700885 .mount_angle = 90
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700886};
887#endif
888
889static int config_gpio_table(int gpio_en)
890{
891 int rc = 0, i = 0;
892 if (gpio_en) {
893 for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++) {
894 rc = gpio_request(msm_cam_gpio_tbl[i], "CAM_GPIO");
895 if (rc < 0) {
896 pr_err("%s not able to get gpio\n", __func__);
897 for (i--; i >= 0; i--)
898 gpio_free(msm_cam_gpio_tbl[i]);
899 break;
900 }
901 }
902 } else {
903 for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++)
904 gpio_free(msm_cam_gpio_tbl[i]);
905 }
906 return rc;
907}
908
909static int config_camera_on_gpios(void)
910{
911 int rc = 0;
912
913 rc = config_gpio_table(1);
914 if (rc < 0) {
915 printk(KERN_ERR "%s: CAMSENSOR gpio table request"
916 "failed\n", __func__);
917 return rc;
918 }
919 return rc;
920}
921
922static void config_camera_off_gpios(void)
923{
924 config_gpio_table(0);
925}
926
927struct msm_camera_device_platform_data msm_camera_csi0_device_data = {
928 .camera_gpio_on = config_camera_on_gpios,
929 .camera_gpio_off = config_camera_off_gpios,
930 .ioclk.mclk_clk_rate = 24000000,
931 .ioclk.vfe_clk_rate = 228570000,
932 .csid_core = 0,
933};
934
935struct msm_camera_device_platform_data msm_camera_csi1_device_data = {
936 .camera_gpio_on = config_camera_on_gpios,
937 .camera_gpio_off = config_camera_off_gpios,
938 .ioclk.mclk_clk_rate = 24000000,
939 .ioclk.vfe_clk_rate = 228570000,
940 .csid_core = 1,
941};
942
943#ifdef CONFIG_IMX074
944static struct msm_camera_sensor_flash_data flash_imx074 = {
945 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530946#ifdef CONFIG_MSM_CAMERA_FLASH
947 .flash_src = &msm_flash_src
948#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949};
950
951static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
952 .sensor_name = "imx074",
953 .sensor_reset = 107,
954 .sensor_pwd = 85,
955 .vcm_pwd = 0,
956 .vcm_enable = 1,
957 .pdata = &msm_camera_csi0_device_data,
958 .flash_data = &flash_imx074,
959 .strobe_flash_data = &strobe_flash_xenon,
960 .sensor_platform_info = &sensor_board_info,
961 .csi_if = 1
962};
963
964struct platform_device msm8960_camera_sensor_imx074 = {
965 .name = "msm_camera_imx074",
966 .dev = {
967 .platform_data = &msm_camera_sensor_imx074_data,
968 },
969};
970#endif
971#ifdef CONFIG_OV2720
972static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -0700973 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700974};
975
976static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
977 .sensor_name = "ov2720",
978 .sensor_reset = 76,
979 .sensor_pwd = 85,
980 .vcm_pwd = 0,
981 .vcm_enable = 1,
982 .pdata = &msm_camera_csi1_device_data,
983 .flash_data = &flash_ov2720,
984 .csi_if = 1
985};
986
987struct platform_device msm8960_camera_sensor_ov2720 = {
988 .name = "msm_camera_ov2720",
989 .dev = {
990 .platform_data = &msm_camera_sensor_ov2720_data,
991 },
992};
993#endif
Kevin Chandfecce22011-07-13 10:52:41 -0700994
995static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
996 .flash_type = MSM_CAMERA_FLASH_LED,
997};
998
999static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1000 .sensor_name = "qs_mt9p017",
1001 .sensor_reset = 107,
1002 .sensor_pwd = 85,
1003 .vcm_pwd = 0,
1004 .vcm_enable = 1,
1005 .pdata = &msm_camera_csi0_device_data,
1006 .flash_data = &flash_qs_mt9p017,
1007 .sensor_platform_info = &sensor_board_info,
1008 .csi_if = 1
1009};
1010
1011struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1012 .name = "msm_camera_qs_mt9p017",
1013 .dev = {
1014 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1015 },
1016};
1017
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001018static void __init msm8960_init_cam(void)
1019{
1020 int i;
1021 struct platform_device *cam_dev[] = {
1022 &msm8960_camera_sensor_imx074,
1023 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001024 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001025 };
1026
1027 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1028 struct msm_camera_sensor_info *s_info;
1029 s_info = cam_dev[i]->dev.platform_data;
1030 msm_get_cam_resources(s_info);
1031 platform_device_register(cam_dev[i]);
1032 }
1033}
1034#endif
1035
1036#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1037/* prim = 608 x 1024 x 4(bpp) x 3(pages) */
1038#define MSM_FB_PRIM_BUF_SIZE 0x720000
1039#else
1040/* prim = 608 x 1024 x 4(bpp) x 2(pages) */
1041#define MSM_FB_PRIM_BUF_SIZE 0x4C0000
1042#endif
1043
1044#ifdef CONFIG_FB_MSM_MIPI_DSI
1045/* 960 x 540 x 3 x 2 */
1046#define MIPI_DSI_WRITEBACK_SIZE 0x300000
1047#else
1048#define MIPI_DSI_WRITEBACK_SIZE 0
1049#endif
1050
1051#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1052/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1053#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1054#elif defined(CONFIG_FB_MSM_TVOUT)
1055/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1056#define MSM_FB_EXT_BUF_SIZE 0x195000
1057#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1058#define MSM_FB_EXT_BUF_SIZE 0
1059#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1060
1061#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1062 MIPI_DSI_WRITEBACK_SIZE, 4096)
1063
1064#define MDP_VSYNC_GPIO 0
1065
1066static struct resource msm_fb_resources[] = {
1067 {
1068 .flags = IORESOURCE_DMA,
1069 }
1070};
1071
1072static struct platform_device msm_fb_device = {
1073 .name = "msm_fb",
1074 .id = 0,
1075 .num_resources = ARRAY_SIZE(msm_fb_resources),
1076 .resource = msm_fb_resources,
1077};
1078
1079static bool dsi_power_on;
1080
1081static int mipi_dsi_panel_power(int on)
1082{
1083 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001084 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001085 int rc;
1086
1087 struct pm_gpio gpio43_param = {
1088 .direction = PM_GPIO_DIR_OUT,
1089 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1090 .output_value = 0,
1091 .pull = PM_GPIO_PULL_NO,
1092 .vin_sel = 2,
1093 .out_strength = PM_GPIO_STRENGTH_HIGH,
1094 .function = PM_GPIO_FUNC_PAIRED,
1095 .inv_int_pol = 0,
1096 .disable_pin = 0,
1097 };
1098
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001099 pr_info("%s: state : %d\n", __func__, on);
1100
1101 if (!dsi_power_on) {
1102
1103 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1104 "dsi_vdc");
1105 if (IS_ERR(reg_l8)) {
1106 pr_err("could not get 8921_l8, rc = %ld\n",
1107 PTR_ERR(reg_l8));
1108 return -ENODEV;
1109 }
1110
1111 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1112 "dsi_vddio");
1113 if (IS_ERR(reg_l23)) {
1114 pr_err("could not get 8921_l23, rc = %ld\n",
1115 PTR_ERR(reg_l23));
1116 return -ENODEV;
1117 }
1118
1119 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1120 "dsi_vdda");
1121 if (IS_ERR(reg_l2)) {
1122 pr_err("could not get 8921_l2, rc = %ld\n",
1123 PTR_ERR(reg_l2));
1124 return -ENODEV;
1125 }
1126
1127 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1128 if (rc) {
1129 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1130 return -EINVAL;
1131 }
1132 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1133 if (rc) {
1134 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1135 return -EINVAL;
1136 }
1137 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1138 if (rc) {
1139 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1140 return -EINVAL;
1141 }
1142
1143 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1144 rc = gpio_request(gpio43, "disp_rst_n");
1145 if (rc) {
1146 pr_err("request gpio 43 failed, rc=%d\n", rc);
1147 return -ENODEV;
1148 }
1149
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001150 dsi_power_on = true;
1151 }
1152
1153 if (on) {
1154 rc = regulator_set_optimum_mode(reg_l8, 100000);
1155 if (rc < 0) {
1156 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1157 return -EINVAL;
1158 }
1159 rc = regulator_set_optimum_mode(reg_l23, 100000);
1160 if (rc < 0) {
1161 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1162 return -EINVAL;
1163 }
1164 rc = regulator_set_optimum_mode(reg_l2, 100000);
1165 if (rc < 0) {
1166 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1167 return -EINVAL;
1168 }
1169 rc = regulator_enable(reg_l8);
1170 if (rc) {
1171 pr_err("enable l8 failed, rc=%d\n", rc);
1172 return -ENODEV;
1173 }
1174 rc = regulator_enable(reg_l23);
1175 if (rc) {
1176 pr_err("enable l8 failed, rc=%d\n", rc);
1177 return -ENODEV;
1178 }
1179 rc = regulator_enable(reg_l2);
1180 if (rc) {
1181 pr_err("enable l2 failed, rc=%d\n", rc);
1182 return -ENODEV;
1183 }
1184
1185 gpio43_param.pull = PM_GPIO_PULL_NO;
1186 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1187 if (rc) {
1188 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1189 return -EINVAL;
1190 }
1191 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1192 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1193 if (rc) {
1194 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1195 return -EINVAL;
1196 }
1197 gpio43_param.pull = PM_GPIO_PULL_NO;
1198 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1199 if (rc) {
1200 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1201 return -EINVAL;
1202 }
1203 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1204 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1205 if (rc) {
1206 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1207 return -EINVAL;
1208 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001209 gpio_set_value_cansleep(gpio43, 1);
1210 } else {
1211 rc = regulator_set_optimum_mode(reg_l8, 100);
1212 if (rc < 0) {
1213 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1214 return -EINVAL;
1215 }
1216 rc = regulator_set_optimum_mode(reg_l23, 100);
1217 if (rc < 0) {
1218 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1219 return -EINVAL;
1220 }
1221 rc = regulator_set_optimum_mode(reg_l2, 100);
1222 if (rc < 0) {
1223 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1224 return -EINVAL;
1225 }
1226 gpio_set_value_cansleep(gpio43, 0);
1227 }
1228 return 0;
1229}
1230
1231static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1232 .vsync_gpio = MDP_VSYNC_GPIO,
1233 .dsi_power_save = mipi_dsi_panel_power,
1234};
1235
1236#ifdef CONFIG_MSM_BUS_SCALING
1237
1238static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001239 {
1240 .src = MSM_BUS_MASTER_MDP_PORT0,
1241 .dst = MSM_BUS_SLAVE_EBI_CH0,
1242 .ab = 0,
1243 .ib = 0,
1244 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001245};
1246
1247static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001248 {
1249 .src = MSM_BUS_MASTER_MDP_PORT0,
1250 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001251 .ab = 216000000 * 2,
1252 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001253 },
1254};
1255
1256static struct msm_bus_vectors mdp_vga_vectors[] = {
1257 /* VGA and less video */
1258 {
1259 .src = MSM_BUS_MASTER_MDP_PORT0,
1260 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001261 .ab = 216000000 * 2,
1262 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263 },
1264};
1265
1266static struct msm_bus_vectors mdp_720p_vectors[] = {
1267 /* 720p and less video */
1268 {
1269 .src = MSM_BUS_MASTER_MDP_PORT0,
1270 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001271 .ab = 230400000 * 2,
1272 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001273 },
1274};
1275
1276static struct msm_bus_vectors mdp_1080p_vectors[] = {
1277 /* 1080p and less video */
1278 {
1279 .src = MSM_BUS_MASTER_MDP_PORT0,
1280 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001281 .ab = 334080000 * 2,
1282 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001283 },
1284};
1285
1286static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1287 {
1288 ARRAY_SIZE(mdp_init_vectors),
1289 mdp_init_vectors,
1290 },
1291 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001292 ARRAY_SIZE(mdp_ui_vectors),
1293 mdp_ui_vectors,
1294 },
1295 {
1296 ARRAY_SIZE(mdp_ui_vectors),
1297 mdp_ui_vectors,
1298 },
1299 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300 ARRAY_SIZE(mdp_vga_vectors),
1301 mdp_vga_vectors,
1302 },
1303 {
1304 ARRAY_SIZE(mdp_720p_vectors),
1305 mdp_720p_vectors,
1306 },
1307 {
1308 ARRAY_SIZE(mdp_1080p_vectors),
1309 mdp_1080p_vectors,
1310 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311};
1312
1313static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1314 mdp_bus_scale_usecases,
1315 ARRAY_SIZE(mdp_bus_scale_usecases),
1316 .name = "mdp",
1317};
1318
1319#endif
1320
1321int mdp_core_clk_rate_table[] = {
1322 85330000,
1323 85330000,
1324 128000000,
1325 200000000,
1326 200000000,
1327};
1328
1329static struct msm_panel_common_pdata mdp_pdata = {
1330 .gpio = MDP_VSYNC_GPIO,
1331 .mdp_core_clk_rate = 85330000,
1332 .mdp_core_clk_table = mdp_core_clk_rate_table,
1333 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1334#ifdef CONFIG_MSM_BUS_SCALING
1335 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1336#endif
1337 .mdp_rev = MDP_REV_42,
1338};
1339
1340static struct platform_device mipi_dsi_renesas_panel_device = {
1341 .name = "mipi_renesas",
1342 .id = 0,
1343};
1344
1345static struct platform_device mipi_dsi_simulator_panel_device = {
1346 .name = "mipi_simulator",
1347 .id = 0,
1348};
1349
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001350#define LPM_CHANNEL0 0
1351static int toshiba_gpio[] = {LPM_CHANNEL0};
1352
1353static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1354 .gpio = toshiba_gpio,
1355};
1356
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357static struct platform_device mipi_dsi_toshiba_panel_device = {
1358 .name = "mipi_toshiba",
1359 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001360 .dev = {
1361 .platform_data = &toshiba_pdata,
1362 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001363};
1364
1365#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1366static struct resource hdmi_msm_resources[] = {
1367 {
1368 .name = "hdmi_msm_qfprom_addr",
1369 .start = 0x00700000,
1370 .end = 0x007060FF,
1371 .flags = IORESOURCE_MEM,
1372 },
1373 {
1374 .name = "hdmi_msm_hdmi_addr",
1375 .start = 0x04A00000,
1376 .end = 0x04A00FFF,
1377 .flags = IORESOURCE_MEM,
1378 },
1379 {
1380 .name = "hdmi_msm_irq",
1381 .start = HDMI_IRQ,
1382 .end = HDMI_IRQ,
1383 .flags = IORESOURCE_IRQ,
1384 },
1385};
1386
1387static int hdmi_enable_5v(int on);
1388static int hdmi_core_power(int on, int show);
1389static int hdmi_cec_power(int on);
1390
1391static struct msm_hdmi_platform_data hdmi_msm_data = {
1392 .irq = HDMI_IRQ,
1393 .enable_5v = hdmi_enable_5v,
1394 .core_power = hdmi_core_power,
1395 .cec_power = hdmi_cec_power,
1396};
1397
1398static struct platform_device hdmi_msm_device = {
1399 .name = "hdmi_msm",
1400 .id = 0,
1401 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1402 .resource = hdmi_msm_resources,
1403 .dev.platform_data = &hdmi_msm_data,
1404};
1405#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1406
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001407#ifdef CONFIG_MSM_BUS_SCALING
1408static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1409 {
1410 .src = MSM_BUS_MASTER_MDP_PORT0,
1411 .dst = MSM_BUS_SLAVE_EBI_CH0,
1412 .ab = 0,
1413 .ib = 0,
1414 },
1415};
1416static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1417 {
1418 .src = MSM_BUS_MASTER_MDP_PORT0,
1419 .dst = MSM_BUS_SLAVE_EBI_CH0,
1420 .ab = 566092800 * 2,
1421 .ib = 707616000 * 2,
1422 },
1423};
1424static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1425 {
1426 ARRAY_SIZE(dtv_bus_init_vectors),
1427 dtv_bus_init_vectors,
1428 },
1429 {
1430 ARRAY_SIZE(dtv_bus_def_vectors),
1431 dtv_bus_def_vectors,
1432 },
1433};
1434static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1435 dtv_bus_scale_usecases,
1436 ARRAY_SIZE(dtv_bus_scale_usecases),
1437 .name = "dtv",
1438};
1439
1440static struct lcdc_platform_data dtv_pdata = {
1441 .bus_scale_table = &dtv_bus_scale_pdata,
1442};
1443#endif
1444
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445static void __init msm_fb_add_devices(void)
1446{
1447 if (machine_is_msm8x60_rumi3()) {
1448 msm_fb_register_device("mdp", NULL);
1449 mipi_dsi_pdata.target_type = 1;
1450 } else
1451 msm_fb_register_device("mdp", &mdp_pdata);
1452 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001453#ifdef CONFIG_MSM_BUS_SCALING
1454 msm_fb_register_device("dtv", &dtv_pdata);
1455#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456}
1457
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001458static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1459 .func = GPIOMUX_FUNC_GPIO,
1460 .drv = GPIOMUX_DRV_2MA,
1461 .pull = GPIOMUX_PULL_DOWN,
1462};
1463
1464static struct gpiomux_setting mdp_vsync_active_cfg = {
1465 .func = GPIOMUX_FUNC_1,
1466 .drv = GPIOMUX_DRV_2MA,
1467 .pull = GPIOMUX_PULL_DOWN,
1468};
1469
1470static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1471 {
1472 .gpio = MDP_VSYNC_GPIO,
1473 .settings = {
1474 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1475 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1476 },
1477 }
1478};
1479
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1481static struct gpiomux_setting hdmi_suspend_cfg = {
1482 .func = GPIOMUX_FUNC_GPIO,
1483 .drv = GPIOMUX_DRV_2MA,
1484 .pull = GPIOMUX_PULL_DOWN,
1485};
1486
1487static struct gpiomux_setting hdmi_active_1_cfg = {
1488 .func = GPIOMUX_FUNC_1,
1489 .drv = GPIOMUX_DRV_2MA,
1490 .pull = GPIOMUX_PULL_UP,
1491};
1492
1493static struct gpiomux_setting hdmi_active_2_cfg = {
1494 .func = GPIOMUX_FUNC_1,
1495 .drv = GPIOMUX_DRV_2MA,
1496 .pull = GPIOMUX_PULL_DOWN,
1497};
1498
1499static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1500 {
1501 .gpio = 99,
1502 .settings = {
1503 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1504 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1505 },
1506 },
1507 {
1508 .gpio = 100,
1509 .settings = {
1510 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1511 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1512 },
1513 },
1514 {
1515 .gpio = 101,
1516 .settings = {
1517 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1518 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1519 },
1520 },
1521 {
1522 .gpio = 102,
1523 .settings = {
1524 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1525 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1526 },
1527 },
1528};
1529
1530static int hdmi_enable_5v(int on)
1531{
1532 /* TBD: PM8921 regulator instead of 8901 */
1533 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1534 static int prev_on;
1535 int rc;
1536
1537 if (on == prev_on)
1538 return 0;
1539
1540 if (!reg_8921_hdmi_mvs)
1541 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1542 "hdmi_mvs");
1543
1544 if (on) {
1545 rc = regulator_enable(reg_8921_hdmi_mvs);
1546 if (rc) {
1547 pr_err("'%s' regulator enable failed, rc=%d\n",
1548 "8921_hdmi_mvs", rc);
1549 return rc;
1550 }
1551 pr_debug("%s(on): success\n", __func__);
1552 } else {
1553 rc = regulator_disable(reg_8921_hdmi_mvs);
1554 if (rc)
1555 pr_warning("'%s' regulator disable failed, rc=%d\n",
1556 "8921_hdmi_mvs", rc);
1557 pr_debug("%s(off): success\n", __func__);
1558 }
1559
1560 prev_on = on;
1561
1562 return 0;
1563}
1564
1565static int hdmi_core_power(int on, int show)
1566{
1567 static struct regulator *reg_8921_l23, *reg_8921_s4;
1568 static int prev_on;
1569 int rc;
1570
1571 if (on == prev_on)
1572 return 0;
1573
1574 /* TBD: PM8921 regulator instead of 8901 */
1575 if (!reg_8921_l23)
1576 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1577
1578 if (!reg_8921_s4)
1579 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1580
1581 if (on) {
1582 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1583 if (rc < 0) {
1584 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1585 return -EINVAL;
1586 }
1587
1588 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1589 if (!rc)
1590 rc = regulator_enable(reg_8921_l23);
1591 if (rc) {
1592 pr_err("'%s' regulator enable failed, rc=%d\n",
1593 "hdmi_avdd", rc);
1594 return rc;
1595 }
1596 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1597 if (!rc)
1598 rc = regulator_enable(reg_8921_s4);
1599 if (rc) {
1600 pr_err("'%s' regulator enable failed, rc=%d\n",
1601 "hdmi_vcc", rc);
1602 return rc;
1603 }
1604
1605 rc = gpio_request(100, "HDMI_DDC_CLK");
1606 if (rc) {
1607 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1608 "HDMI_DDC_CLK", 100, rc);
1609 goto error1;
1610 }
1611 rc = gpio_request(101, "HDMI_DDC_DATA");
1612 if (rc) {
1613 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1614 "HDMI_DDC_DATA", 101, rc);
1615 goto error2;
1616 }
1617 rc = gpio_request(102, "HDMI_HPD");
1618 if (rc) {
1619 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1620 "HDMI_HPD", 102, rc);
1621 goto error3;
1622 }
1623 pr_debug("%s(on): success\n", __func__);
1624 } else {
1625 gpio_free(100);
1626 gpio_free(101);
1627 gpio_free(102);
1628
1629 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1630 if (rc < 0) {
1631 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1632 return -EINVAL;
1633 }
1634
1635 pr_debug("%s(off): success\n", __func__);
1636 }
1637
1638 prev_on = on;
1639
1640 return 0;
1641
1642error3:
1643 gpio_free(101);
1644error2:
1645 gpio_free(100);
1646error1:
1647 regulator_disable(reg_8921_l23);
1648 return rc;
1649}
1650
1651static int hdmi_cec_power(int on)
1652{
1653 static int prev_on;
1654 int rc;
1655
1656 if (on == prev_on)
1657 return 0;
1658
1659 if (on) {
1660 rc = gpio_request(99, "HDMI_CEC_VAR");
1661 if (rc) {
1662 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1663 "HDMI_CEC_VAR", 99, rc);
1664 goto error;
1665 }
1666 pr_debug("%s(on): success\n", __func__);
1667 } else {
1668 gpio_free(99);
1669 pr_debug("%s(off): success\n", __func__);
1670 }
1671
1672 prev_on = on;
1673
1674 return 0;
1675error:
1676 return rc;
1677}
1678#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1679
1680static void __init msm8960_allocate_memory_regions(void)
1681{
1682 void *addr;
1683 unsigned long size;
1684
1685 size = MSM_FB_SIZE;
1686 addr = alloc_bootmem_align(size, 0x1000);
1687 msm_fb_resources[0].start = __pa(addr);
1688 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1689 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1690 size, addr, __pa(addr));
1691
1692}
1693#ifdef CONFIG_WCD9310_CODEC
1694
1695#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1696
1697static struct tabla_pdata tabla_platform_data = {
1698 .slimbus_slave_device = {
1699 .name = "tabla-slave",
1700 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1701 },
1702 .irq = MSM_GPIO_TO_INT(62),
1703 .irq_base = TABLA_INTERRUPT_BASE,
1704 .num_irqs = NR_TABLA_IRQS,
1705 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1706};
1707
1708static struct slim_device msm_slim_tabla = {
1709 .name = "tabla-slim",
1710 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1711 .dev = {
1712 .platform_data = &tabla_platform_data,
1713 },
1714};
1715#endif
1716
1717static struct slim_boardinfo msm_slim_devices[] = {
1718#ifdef CONFIG_WCD9310_CODEC
1719 {
1720 .bus_num = 1,
1721 .slim_slave = &msm_slim_tabla,
1722 },
1723#endif
1724 /* add more slimbus slaves as needed */
1725};
1726
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001727#define MSM_WCNSS_PHYS 0x03000000
1728#define MSM_WCNSS_SIZE 0x280000
1729
1730static struct resource resources_wcnss_wlan[] = {
1731 {
1732 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1733 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1734 .name = "wcnss_wlanrx_irq",
1735 .flags = IORESOURCE_IRQ,
1736 },
1737 {
1738 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1739 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1740 .name = "wcnss_wlantx_irq",
1741 .flags = IORESOURCE_IRQ,
1742 },
1743 {
1744 .start = MSM_WCNSS_PHYS,
1745 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1746 .name = "wcnss_mmio",
1747 .flags = IORESOURCE_MEM,
1748 },
1749};
1750
1751static struct platform_device msm_device_wcnss_wlan = {
1752 .name = "wcnss_wlan",
1753 .id = 0,
1754 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1755 .resource = resources_wcnss_wlan,
1756};
1757
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001758#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1759 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1760 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1761 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1762
1763#define QCE_SIZE 0x10000
1764#define QCE_0_BASE 0x18500000
1765
1766#define QCE_HW_KEY_SUPPORT 0
1767#define QCE_SHA_HMAC_SUPPORT 1
1768#define QCE_SHARE_CE_RESOURCE 1
1769#define QCE_CE_SHARED 0
1770
1771static struct resource qcrypto_resources[] = {
1772 [0] = {
1773 .start = QCE_0_BASE,
1774 .end = QCE_0_BASE + QCE_SIZE - 1,
1775 .flags = IORESOURCE_MEM,
1776 },
1777 [1] = {
1778 .name = "crypto_channels",
1779 .start = DMOV_CE_IN_CHAN,
1780 .end = DMOV_CE_OUT_CHAN,
1781 .flags = IORESOURCE_DMA,
1782 },
1783 [2] = {
1784 .name = "crypto_crci_in",
1785 .start = DMOV_CE_IN_CRCI,
1786 .end = DMOV_CE_IN_CRCI,
1787 .flags = IORESOURCE_DMA,
1788 },
1789 [3] = {
1790 .name = "crypto_crci_out",
1791 .start = DMOV_CE_OUT_CRCI,
1792 .end = DMOV_CE_OUT_CRCI,
1793 .flags = IORESOURCE_DMA,
1794 },
1795};
1796
1797static struct resource qcedev_resources[] = {
1798 [0] = {
1799 .start = QCE_0_BASE,
1800 .end = QCE_0_BASE + QCE_SIZE - 1,
1801 .flags = IORESOURCE_MEM,
1802 },
1803 [1] = {
1804 .name = "crypto_channels",
1805 .start = DMOV_CE_IN_CHAN,
1806 .end = DMOV_CE_OUT_CHAN,
1807 .flags = IORESOURCE_DMA,
1808 },
1809 [2] = {
1810 .name = "crypto_crci_in",
1811 .start = DMOV_CE_IN_CRCI,
1812 .end = DMOV_CE_IN_CRCI,
1813 .flags = IORESOURCE_DMA,
1814 },
1815 [3] = {
1816 .name = "crypto_crci_out",
1817 .start = DMOV_CE_OUT_CRCI,
1818 .end = DMOV_CE_OUT_CRCI,
1819 .flags = IORESOURCE_DMA,
1820 },
1821};
1822
1823#endif
1824
1825#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1826 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1827
1828static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1829 .ce_shared = QCE_CE_SHARED,
1830 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1831 .hw_key_support = QCE_HW_KEY_SUPPORT,
1832 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1833};
1834
1835static struct platform_device qcrypto_device = {
1836 .name = "qcrypto",
1837 .id = 0,
1838 .num_resources = ARRAY_SIZE(qcrypto_resources),
1839 .resource = qcrypto_resources,
1840 .dev = {
1841 .coherent_dma_mask = DMA_BIT_MASK(32),
1842 .platform_data = &qcrypto_ce_hw_suppport,
1843 },
1844};
1845#endif
1846
1847#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1848 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1849
1850static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1851 .ce_shared = QCE_CE_SHARED,
1852 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1853 .hw_key_support = QCE_HW_KEY_SUPPORT,
1854 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1855};
1856
1857static struct platform_device qcedev_device = {
1858 .name = "qce",
1859 .id = 0,
1860 .num_resources = ARRAY_SIZE(qcedev_resources),
1861 .resource = qcedev_resources,
1862 .dev = {
1863 .coherent_dma_mask = DMA_BIT_MASK(32),
1864 .platform_data = &qcedev_ce_hw_suppport,
1865 },
1866};
1867#endif
1868
1869
1870static int __init gpiomux_init(void)
1871{
1872 int rc;
1873
1874 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1875 if (rc) {
1876 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1877 return rc;
1878 }
1879
1880 msm_gpiomux_install(msm8960_cam_configs,
1881 ARRAY_SIZE(msm8960_cam_configs));
1882
1883 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001884 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001885
1886 msm_gpiomux_install(msm8960_gsbi_configs,
1887 ARRAY_SIZE(msm8960_gsbi_configs));
1888
1889 msm_gpiomux_install(msm8960_cyts_configs,
1890 ARRAY_SIZE(msm8960_cyts_configs));
1891
1892 msm_gpiomux_install(msm8960_slimbus_config,
1893 ARRAY_SIZE(msm8960_slimbus_config));
1894
1895 msm_gpiomux_install(msm8960_audio_codec_configs,
1896 ARRAY_SIZE(msm8960_audio_codec_configs));
1897
1898#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1899 msm_gpiomux_install(msm8960_hdmi_configs,
1900 ARRAY_SIZE(msm8960_hdmi_configs));
1901#endif
1902
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001903 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1904 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906 msm_gpiomux_install(wcnss_5wire_interface,
1907 ARRAY_SIZE(wcnss_5wire_interface));
1908
1909 return 0;
1910}
1911
1912static struct msm_acpu_clock_platform_data msm8960_acpu_clock_data = {
1913 .acpu_switch_time_us = 0,
1914 .vdd_switch_time_us = 0,
1915};
1916
1917#define MSM_SHARED_RAM_PHYS 0x80000000
1918
1919static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1920 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1921 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1922 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1923 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1924 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1925 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1926 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1927 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1928 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1929 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1930 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1931 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1932 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1933 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1934 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1935 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1936 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1937 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1938 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1939 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1940 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1941 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1942 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1943 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1944 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1945 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1946 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1947 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1948 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1949 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1950};
1951
1952static struct pm8921_adc_properties pm8921_adc_data = {
1953 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1954 .bitresolution = 15,
1955 .bipolar = 0,
1956};
1957
1958static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1959 .adc_channel = pm8921_adc_channels_data,
1960 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1961 .adc_prop = &pm8921_adc_data,
1962};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001963
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001964static void __init msm8960_map_io(void)
1965{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001966 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001967 msm_map_msm8960_io();
1968}
1969
1970static void __init msm8960_init_irq(void)
1971{
1972 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973
1974 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001975 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001976 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001977
1978 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001979 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001980
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001981 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1982 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001983
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001984 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1985 * as they are configured as level, which does not play nice with
1986 * handle_percpu_irq.
1987 */
1988 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1989 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001990 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001991 }
1992}
1993
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001994/* MSM8960 have 5 SDCC controllers */
1995enum sdcc_controllers {
1996 SDCC1,
1997 SDCC2,
1998 SDCC3,
1999 SDCC4,
2000 SDCC5,
2001 MAX_SDCC_CONTROLLER
2002};
2003
2004/* All SDCC controllers requires VDD/VCC voltage */
2005static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2006 /* SDCC1 : eMMC card connected */
2007 [SDCC1] = {
2008 .name = "sdc_vdd",
2009 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302010 .high_vol_level = 2950000,
2011 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002012 .hpm_uA = 200000, /* 200mA */
2013 },
2014 /* SDCC3 : External card slot connected */
2015 [SDCC3] = {
2016 .name = "sdc_vdd",
2017 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302018 .high_vol_level = 2950000,
2019 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002020 .hpm_uA = 600000, /* 600mA */
2021 }
2022};
2023
2024/* Only slots having eMMC card will require VCCQ voltage */
2025static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2026 /* SDCC1 : eMMC card connected */
2027 [SDCC1] = {
2028 .name = "sdc_vccq",
2029 .set_voltage_sup = 1,
2030 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302031 .high_vol_level = 1800000,
2032 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002033 .hpm_uA = 200000, /* 200mA */
2034 }
2035};
2036
2037/* All SDCC controllers may require voting for VDD PAD voltage */
2038static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2039 /* SDCC3 : External card slot connected */
2040 [SDCC3] = {
2041 .name = "sdc_vddp",
2042 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302043 .high_vol_level = 2950000,
2044 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002045 .always_on = 1,
2046 .lpm_sup = 1,
2047 /* Max. Active current required is 16 mA */
2048 .hpm_uA = 16000,
2049 /*
2050 * Sleep current required is ~300 uA. But min. vote can be
2051 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2052 * during sleep.
2053 */
2054 .lpm_uA = 2000,
2055 }
2056};
2057
2058static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2059 /* SDCC1 : eMMC card connected */
2060 [SDCC1] = {
2061 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2062 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2063 },
2064 /* SDCC3 : External card slot connected */
2065 [SDCC3] = {
2066 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2067 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2068 }
2069};
2070
2071/* SDC1 pad data */
2072static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2073 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
2074 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2075 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
2076};
2077
2078static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2079 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2080 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2081 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2082};
2083
2084static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2085 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2086 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2087};
2088
2089static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2090 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2091 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2092};
2093
2094/* SDC3 pad data */
2095static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2096 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2097 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2098 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2099};
2100
2101static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2102 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2103 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2104 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2105};
2106
2107static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2108 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2109 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2110};
2111
2112static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2113 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2114 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2115};
2116
2117struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2118 [SDCC1] = {
2119 .on = sdc1_pad_pull_on_cfg,
2120 .off = sdc1_pad_pull_off_cfg,
2121 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2122 },
2123 [SDCC3] = {
2124 .on = sdc3_pad_pull_on_cfg,
2125 .off = sdc3_pad_pull_off_cfg,
2126 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2127 },
2128};
2129
2130struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2131 [SDCC1] = {
2132 .on = sdc1_pad_drv_on_cfg,
2133 .off = sdc1_pad_drv_off_cfg,
2134 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2135 },
2136 [SDCC3] = {
2137 .on = sdc3_pad_drv_on_cfg,
2138 .off = sdc3_pad_drv_off_cfg,
2139 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2140 },
2141};
2142
2143struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2144 [SDCC1] = {
2145 .pull = &mmc_pad_pull_data[SDCC1],
2146 .drv = &mmc_pad_drv_data[SDCC1]
2147 },
2148 [SDCC3] = {
2149 .pull = &mmc_pad_pull_data[SDCC3],
2150 .drv = &mmc_pad_drv_data[SDCC3]
2151 },
2152};
2153
2154struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2155 [SDCC1] = {
2156 .pad_data = &mmc_pad_data[SDCC1],
2157 },
2158 [SDCC3] = {
2159 .pad_data = &mmc_pad_data[SDCC3],
2160 },
2161};
2162
2163static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002164 400000, 24000000, 48000000, 96000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002165};
2166
2167static unsigned int sdc3_sup_clk_rates[] = {
2168 400000, 24000000, 48000000, 96000000
2169};
2170
2171#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2172static struct mmc_platform_data msm8960_sdc1_data = {
2173 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2174#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2175 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2176#else
2177 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2178#endif
2179 .sup_clk_table = sdc1_sup_clk_rates,
2180 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2181 .nonremovable = 1,
2182 .sdcc_v4_sup = true,
2183 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002184 .pin_data = &mmc_slot_pin_data[SDCC1],
2185 .uhs_caps = MMC_CAP_1_8V_DDR
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002186};
2187#endif
2188
2189#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2190static struct mmc_platform_data msm8960_sdc3_data = {
2191 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2192 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2193 .sup_clk_table = sdc3_sup_clk_rates,
2194 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2195 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2196 .sdcc_v4_sup = true,
2197 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2198 .pin_data = &mmc_slot_pin_data[SDCC3],
2199#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2200 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2201 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2202 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2203#endif
2204 .xpc_cap = 1,
2205 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2206 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002207 MMC_CAP_MAX_CURRENT_600 | MMC_CAP_1_8V_DDR)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002208};
2209#endif
2210
2211static void __init msm8960_init_mmc(void)
2212{
2213#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2214 /* SDC1 : eMMC card connected */
2215 msm_add_sdcc(1, &msm8960_sdc1_data);
2216#endif
2217#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2218 /* SDC3: External card slot */
2219 msm_add_sdcc(3, &msm8960_sdc3_data);
2220#endif
2221}
2222
2223static void __init msm8960_init_buses(void)
2224{
2225#ifdef CONFIG_MSM_BUS_SCALING
2226 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2227 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2228 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2229 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2230 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2231 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2232 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2233 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2234 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2235 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2236#endif
2237}
2238
2239static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2240 .max_clock_speed = 15060000,
2241};
2242
2243#ifdef CONFIG_USB_MSM_OTG_72K
2244static struct msm_otg_platform_data msm_otg_pdata;
2245#else
2246#define USB_5V_EN 42
2247static void msm_hsusb_vbus_power(bool on)
2248{
2249 int rc;
2250 static bool vbus_is_on;
2251 static struct regulator *mvs_otg_switch;
2252 struct pm_gpio param = {
2253 .direction = PM_GPIO_DIR_OUT,
2254 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2255 .output_value = 1,
2256 .pull = PM_GPIO_PULL_NO,
2257 .vin_sel = PM_GPIO_VIN_S4,
2258 .out_strength = PM_GPIO_STRENGTH_MED,
2259 .function = PM_GPIO_FUNC_NORMAL,
2260 };
2261
2262 if (vbus_is_on == on)
2263 return;
2264
2265 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002266 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2267 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002268 if (IS_ERR(mvs_otg_switch)) {
2269 pr_err("Unable to get mvs_otg_switch\n");
2270 return;
2271 }
2272
2273 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2274 "usb_5v_en");
2275 if (rc < 0) {
2276 pr_err("failed to request usb_5v_en gpio\n");
2277 goto put_mvs_otg;
2278 }
2279
2280 if (regulator_enable(mvs_otg_switch)) {
2281 pr_err("unable to enable mvs_otg_switch\n");
2282 goto free_usb_5v_en;
2283 }
2284
2285 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2286 &param);
2287 if (rc < 0) {
2288 pr_err("failed to configure usb_5v_en gpio\n");
2289 goto disable_mvs_otg;
2290 }
2291 vbus_is_on = true;
2292 return;
2293 }
2294disable_mvs_otg:
2295 regulator_disable(mvs_otg_switch);
2296free_usb_5v_en:
2297 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2298put_mvs_otg:
2299 regulator_put(mvs_otg_switch);
2300 vbus_is_on = false;
2301}
2302
2303static struct msm_otg_platform_data msm_otg_pdata = {
2304 .mode = USB_OTG,
2305 .otg_control = OTG_PMIC_CONTROL,
2306 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2307 .pclk_src_name = "dfab_usb_hs_clk",
2308 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2309 .vbus_power = msm_hsusb_vbus_power,
2310};
2311#endif
2312
2313#define PID_MAGIC_ID 0x71432909
2314#define SERIAL_NUM_MAGIC_ID 0x61945374
2315#define SERIAL_NUMBER_LENGTH 127
2316#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2317
2318struct magic_num_struct {
2319 uint32_t pid;
2320 uint32_t serial_num;
2321};
2322
2323struct dload_struct {
2324 uint32_t reserved1;
2325 uint32_t reserved2;
2326 uint32_t reserved3;
2327 uint16_t reserved4;
2328 uint16_t pid;
2329 char serial_number[SERIAL_NUMBER_LENGTH];
2330 uint16_t reserved5;
2331 struct magic_num_struct magic_struct;
2332};
2333
2334static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2335{
2336 struct dload_struct __iomem *dload = 0;
2337
2338 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2339 if (!dload) {
2340 pr_err("%s: cannot remap I/O memory region: %08x\n",
2341 __func__, DLOAD_USB_BASE_ADD);
2342 return -ENXIO;
2343 }
2344
2345 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2346 __func__, dload, pid, snum);
2347 /* update pid */
2348 dload->magic_struct.pid = PID_MAGIC_ID;
2349 dload->pid = pid;
2350
2351 /* update serial number */
2352 dload->magic_struct.serial_num = 0;
2353 if (!snum) {
2354 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2355 goto out;
2356 }
2357
2358 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2359 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2360 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2361out:
2362 iounmap(dload);
2363 return 0;
2364}
2365
2366static struct android_usb_platform_data android_usb_pdata = {
2367 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2368};
2369
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002370static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002371 .name = "android_usb",
2372 .id = -1,
2373 .dev = {
2374 .platform_data = &android_usb_pdata,
2375 },
2376};
2377
2378static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2379 0x03, 0x0f,
2380};
2381
2382static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2383 0x00, 0x24, 0x54, 0x10,
2384 0x09, 0x03, 0x01,
2385 0x10, 0x54, 0x30, 0x0C,
2386 0x24, 0x30, 0x0f,
2387};
2388
2389static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2390 0x00, 0x24, 0x54, 0x10,
2391 0x09, 0x07, 0x01, 0x0B,
2392 0x10, 0x54, 0x30, 0x0C,
2393 0x24, 0x30, 0x0f,
2394};
2395
2396static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2397 [0] = {
2398 .mode = MSM_SPM_MODE_CLOCK_GATING,
2399 .notify_rpm = false,
2400 .cmd = spm_wfi_cmd_sequence,
2401 },
2402 [1] = {
2403 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2404 .notify_rpm = false,
2405 .cmd = spm_power_collapse_without_rpm,
2406 },
2407 [2] = {
2408 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2409 .notify_rpm = true,
2410 .cmd = spm_power_collapse_with_rpm,
2411 },
2412};
2413
2414static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2415 [0] = {
2416 .reg_base_addr = MSM_SAW0_BASE,
2417 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2418 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2419 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2420#if defined(CONFIG_MSM_AVS_HW)
2421 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2422 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2423#endif
2424 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2425 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2426 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2427 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2428 .vctl_timeout_us = 50,
2429 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2430 .modes = msm_spm_seq_list,
2431 },
2432 [1] = {
2433 .reg_base_addr = MSM_SAW1_BASE,
2434 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2435 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2436 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2437#if defined(CONFIG_MSM_AVS_HW)
2438 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2439 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2440#endif
2441 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2442 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2443 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2444 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2445 .vctl_timeout_us = 50,
2446 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2447 .modes = msm_spm_seq_list,
2448 },
2449};
2450
2451static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2452 0x00, 0x20, 0x03, 0x20,
2453 0x00, 0x0f,
2454};
2455
2456static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2457 0x00, 0x20, 0x34, 0x64,
2458 0x48, 0x07, 0x48, 0x20,
2459 0x50, 0x64, 0x04, 0x34,
2460 0x50, 0x0f,
2461};
2462static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2463 0x00, 0x10, 0x34, 0x64,
2464 0x48, 0x07, 0x48, 0x10,
2465 0x50, 0x64, 0x04, 0x34,
2466 0x50, 0x0F,
2467};
2468
2469static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2470 [0] = {
2471 .mode = MSM_SPM_L2_MODE_RETENTION,
2472 .notify_rpm = false,
2473 .cmd = l2_spm_wfi_cmd_sequence,
2474 },
2475 [1] = {
2476 .mode = MSM_SPM_L2_MODE_GDHS,
2477 .notify_rpm = true,
2478 .cmd = l2_spm_gdhs_cmd_sequence,
2479 },
2480 [2] = {
2481 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2482 .notify_rpm = true,
2483 .cmd = l2_spm_power_off_cmd_sequence,
2484 },
2485};
2486
2487
2488static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2489 [0] = {
2490 .reg_base_addr = MSM_SAW_L2_BASE,
2491 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2492 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2493 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2494 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2495 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2496 .modes = msm_spm_l2_seq_list,
2497 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2498 },
2499};
2500
2501#define CYTTSP_TS_GPIO_IRQ 11
2502#define CYTTSP_TS_SLEEP_GPIO 50
2503#define CYTTSP_TS_RESOUT_N_GPIO 52
2504
2505/*virtual key support */
2506static ssize_t tma340_vkeys_show(struct kobject *kobj,
2507 struct kobj_attribute *attr, char *buf)
2508{
2509 return snprintf(buf, 200,
2510 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2511 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2512 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2513 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2514 "\n");
2515}
2516
2517static struct kobj_attribute tma340_vkeys_attr = {
2518 .attr = {
2519 .mode = S_IRUGO,
2520 },
2521 .show = &tma340_vkeys_show,
2522};
2523
2524static struct attribute *tma340_properties_attrs[] = {
2525 &tma340_vkeys_attr.attr,
2526 NULL
2527};
2528
2529static struct attribute_group tma340_properties_attr_group = {
2530 .attrs = tma340_properties_attrs,
2531};
2532
2533
2534static int cyttsp_platform_init(struct i2c_client *client)
2535{
2536 int rc = 0;
2537 static struct kobject *tma340_properties_kobj;
2538
2539 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2540 tma340_properties_kobj = kobject_create_and_add("board_properties",
2541 NULL);
2542 if (tma340_properties_kobj)
2543 rc = sysfs_create_group(tma340_properties_kobj,
2544 &tma340_properties_attr_group);
2545 if (!tma340_properties_kobj || rc)
2546 pr_err("%s: failed to create board_properties\n",
2547 __func__);
2548
2549 return 0;
2550}
2551
2552static struct cyttsp_regulator regulator_data[] = {
2553 {
2554 .name = "vdd",
2555 .min_uV = CY_TMA300_VTG_MIN_UV,
2556 .max_uV = CY_TMA300_VTG_MAX_UV,
2557 .load_uA = CY_TMA300_CURR_24HZ_UA,
2558 },
2559 /* TODO: Remove after runtime PM is enabled in I2C driver */
2560 {
2561 .name = "vcc_i2c",
2562 .min_uV = CY_I2C_VTG_MIN_UV,
2563 .max_uV = CY_I2C_VTG_MAX_UV,
2564 .load_uA = CY_I2C_CURR_UA,
2565 },
2566};
2567
2568static struct cyttsp_platform_data cyttsp_pdata = {
2569 .panel_maxx = 634,
2570 .panel_maxy = 1166,
2571 .disp_maxx = 616,
2572 .disp_maxy = 1023,
2573 .disp_minx = 0,
2574 .disp_miny = 16,
2575 .flags = 0x01,
2576 .gen = CY_GEN3, /* or */
2577 .use_st = CY_USE_ST,
2578 .use_mt = CY_USE_MT,
2579 .use_hndshk = CY_SEND_HNDSHK,
2580 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayal15187772011-06-22 17:39:41 +05302581 .use_sleep = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002582 .use_gestures = CY_USE_GESTURES,
2583 .fw_fname = "cyttsp_8960_cdp.hex",
2584 /* activate up to 4 groups
2585 * and set active distance
2586 */
2587 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2588 CY_GEST_GRP3 | CY_GEST_GRP4 |
2589 CY_ACT_DIST,
2590 /* change act_intrvl to customize the Active power state
2591 * scanning/processing refresh interval for Operating mode
2592 */
2593 .act_intrvl = CY_ACT_INTRVL_DFLT,
2594 /* change tch_tmout to customize the touch timeout for the
2595 * Active power state for Operating mode
2596 */
2597 .tch_tmout = CY_TCH_TMOUT_DFLT,
2598 /* change lp_intrvl to customize the Low Power power state
2599 * scanning/processing refresh interval for Operating mode
2600 */
2601 .lp_intrvl = CY_LP_INTRVL_DFLT,
2602 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2603 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2604 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2605 .regulator_info = regulator_data,
2606 .num_regulators = ARRAY_SIZE(regulator_data),
2607 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302608 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002609};
2610
2611static struct i2c_board_info cyttsp_info[] __initdata = {
2612 {
2613 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2614 .platform_data = &cyttsp_pdata,
2615#ifndef CY_USE_TIMER
2616 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2617#endif /* CY_USE_TIMER */
2618 },
2619};
2620
2621static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2622{
2623}
2624
2625static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2626 .clk_freq = 100000,
2627 .src_clk_rate = 24000000,
2628 .clk = "gsbi_qup_clk",
2629 .pclk = "gsbi_pclk",
2630 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2631};
2632
2633static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2634 .clk_freq = 100000,
2635 .src_clk_rate = 24000000,
2636 .clk = "gsbi_qup_clk",
2637 .pclk = "gsbi_pclk",
2638 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2639};
2640
2641static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2642 .clk_freq = 100000,
2643 .src_clk_rate = 24000000,
2644 .clk = "gsbi_qup_clk",
2645 .pclk = "gsbi_pclk",
2646 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2647};
2648
2649static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2650 .clk_freq = 100000,
2651 .src_clk_rate = 24000000,
2652 .clk = "gsbi_qup_clk",
2653 .pclk = "gsbi_pclk",
2654 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2655};
2656
2657static struct msm_rpm_platform_data msm_rpm_data = {
2658 .reg_base_addrs = {
2659 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2660 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2661 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2662 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2663 },
2664
2665 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2666 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2667 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2668 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2669 .msm_apps_ipc_rpm_val = 4,
2670};
2671
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002672static struct platform_device msm_rpm_device = {
2673 .name = "msm_rpm",
2674 .id = -1,
2675};
2676
2677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002678static struct spi_board_info spi_board_info[] __initdata = {
2679 {
2680 .modalias = "ks8851",
2681 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2682 .max_speed_hz = 19200000,
2683 .bus_num = 0,
2684 .chip_select = 0,
2685 .mode = SPI_MODE_0,
2686 },
2687};
2688
2689static struct platform_device msm_device_saw_core0 = {
2690 .name = "saw-regulator",
2691 .id = 0,
2692 .dev = {
2693 .platform_data = &msm_saw_regulator_pdata_s5,
2694 },
2695};
2696
2697static struct platform_device msm_device_saw_core1 = {
2698 .name = "saw-regulator",
2699 .id = 1,
2700 .dev = {
2701 .platform_data = &msm_saw_regulator_pdata_s6,
2702 },
2703};
2704
2705#ifdef CONFIG_MSM_FAKE_BATTERY
2706static struct platform_device fish_battery_device = {
2707 .name = "fish_battery",
2708};
2709#endif
2710
2711struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
2712 .name = GPIO_REGULATOR_DEV_NAME,
2713 .id = PM8921_MPP_PM_TO_SYS(7),
2714 .dev = {
2715 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2716 },
2717};
2718
2719struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
2720 .name = GPIO_REGULATOR_DEV_NAME,
2721 .id = 91,
2722 .dev = {
2723 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2724 },
2725};
2726
2727static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002728 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002729 &msm_device_smd,
2730 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302731 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732 &msm_device_saw_core0,
2733 &msm_device_saw_core1,
2734 &msm8960_device_ext_5v_vreg,
2735 &msm8960_device_ext_l2_vreg,
2736 &msm8960_device_ssbi_pm8921,
2737 &msm8960_device_qup_spi_gsbi1,
2738 &msm8960_device_qup_i2c_gsbi3,
2739 &msm8960_device_qup_i2c_gsbi4,
2740 &msm8960_device_qup_i2c_gsbi10,
2741#ifndef CONFIG_MSM_DSPS
2742 &msm8960_device_qup_i2c_gsbi12,
2743#endif
2744 &msm_slim_ctrl,
2745 &msm_device_wcnss_wlan,
2746#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2747 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2748 &qcrypto_device,
2749#endif
2750
2751#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2752 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2753 &qcedev_device,
2754#endif
2755#ifdef CONFIG_MSM_ROTATOR
2756 &msm_rotator_device,
2757#endif
2758 &msm_device_sps,
2759#ifdef CONFIG_MSM_FAKE_BATTERY
2760 &fish_battery_device,
2761#endif
2762#ifdef CONFIG_ANDROID_PMEM
2763 &android_pmem_device,
2764 &android_pmem_adsp_device,
2765 &android_pmem_audio_device,
2766#endif
2767 &msm_fb_device,
2768 &msm_device_vidc,
2769 &msm_device_bam_dmux,
2770 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002771
2772#ifdef CONFIG_HW_RANDOM_MSM
2773 &msm_device_rng,
2774#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002775 &msm_rpm_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776};
2777
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002778static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002779 &msm8960_device_otg,
2780 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002781 &msm_device_hsusb_host,
2782 &android_usb_device,
2783 &msm_device_vidc,
2784 &mipi_dsi_simulator_panel_device,
2785 &msm_bus_apps_fabric,
2786 &msm_bus_sys_fabric,
2787 &msm_bus_mm_fabric,
2788 &msm_bus_sys_fpb,
2789 &msm_bus_cpss_fpb,
2790 &msm_pcm,
2791 &msm_pcm_routing,
2792 &msm_cpudai0,
2793 &msm_cpudai1,
2794 &msm_cpudai_hdmi_rx,
2795 &msm_cpudai_bt_rx,
2796 &msm_cpudai_bt_tx,
2797 &msm_cpudai_fm_rx,
2798 &msm_cpudai_fm_tx,
2799 &msm_cpu_fe,
2800 &msm_stub_codec,
2801 &msm_voice,
2802 &msm_voip,
2803 &msm_lpa_pcm,
2804
2805#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2806 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2807 &qcrypto_device,
2808#endif
2809
2810#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2811 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2812 &qcedev_device,
2813#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002814};
2815
2816static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002817 &msm_kgsl_3d0,
2818 &msm_kgsl_2d0,
2819 &msm_kgsl_2d1,
2820 &mipi_dsi_renesas_panel_device,
2821#ifdef CONFIG_MSM_GEMINI
2822 &msm8960_gemini_device,
2823#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002824};
2825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002827 &msm8960_device_otg,
2828 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829 &msm_device_hsusb_host,
2830 &android_usb_device,
2831 &msm_pcm,
2832 &msm_pcm_routing,
2833 &msm_cpudai0,
2834 &msm_cpudai1,
2835 &msm_cpudai_hdmi_rx,
2836 &msm_cpudai_bt_rx,
2837 &msm_cpudai_bt_tx,
2838 &msm_cpudai_fm_rx,
2839 &msm_cpudai_fm_tx,
2840 &msm_cpu_fe,
2841 &msm_stub_codec,
2842 &msm_kgsl_3d0,
2843#ifdef CONFIG_MSM_KGSL_2D
2844 &msm_kgsl_2d0,
2845 &msm_kgsl_2d1,
2846#endif
2847 &mipi_dsi_toshiba_panel_device,
2848#ifdef CONFIG_MSM_GEMINI
2849 &msm8960_gemini_device,
2850#endif
2851 &msm_voice,
2852 &msm_voip,
2853 &msm_lpa_pcm,
2854#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2855 &hdmi_msm_device,
2856#endif
2857 &msm_pcm_hostless,
2858 &msm_bus_apps_fabric,
2859 &msm_bus_sys_fabric,
2860 &msm_bus_mm_fabric,
2861 &msm_bus_sys_fpb,
2862 &msm_bus_cpss_fpb,
2863};
2864
2865static void __init msm8960_i2c_init(void)
2866{
2867 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2868 &msm8960_i2c_qup_gsbi4_pdata;
2869
2870 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2871 &msm8960_i2c_qup_gsbi3_pdata;
2872
2873 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2874 &msm8960_i2c_qup_gsbi10_pdata;
2875
2876 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2877 &msm8960_i2c_qup_gsbi12_pdata;
2878}
2879
2880static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2881 .irq_base = PM8921_IRQ_BASE,
2882 .devirq = MSM_GPIO_TO_INT(104),
2883 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2884};
2885
2886static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2887 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2888};
2889
2890static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2891 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2892};
2893
2894static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2895 .rtc_write_enable = false,
2896};
2897
2898static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2899 .pull_up = 1,
2900 .kpd_trigger_delay_us = 970,
2901 .wakeup = 1,
2902};
2903
2904static const unsigned int keymap[] = {
2905 KEY(0, 0, KEY_VOLUMEUP),
2906 KEY(0, 1, KEY_VOLUMEDOWN),
2907 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2908 KEY(0, 3, KEY_CAMERA_FOCUS),
2909};
2910
2911static struct matrix_keymap_data keymap_data = {
2912 .keymap_size = ARRAY_SIZE(keymap),
2913 .keymap = keymap,
2914};
2915
2916static struct pm8xxx_keypad_platform_data keypad_data = {
2917 .input_name = "keypad_8960",
2918 .input_phys_device = "keypad_8960/input0",
2919 .num_rows = 1,
2920 .num_cols = 5,
2921 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2922 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2923 .debounce_ms = 15,
2924 .scan_delay_ms = 32,
2925 .row_hold_ns = 91500,
2926 .wakeup = 1,
2927 .keymap_data = &keymap_data,
2928};
2929
2930static const unsigned int keymap_sim[] = {
2931 KEY(0, 0, KEY_7),
2932 KEY(0, 1, KEY_DOWN),
2933 KEY(0, 2, KEY_UP),
2934 KEY(0, 3, KEY_RIGHT),
2935 KEY(0, 4, KEY_ENTER),
2936 KEY(0, 5, KEY_L),
2937 KEY(0, 6, KEY_BACK),
2938 KEY(0, 7, KEY_M),
2939
2940 KEY(1, 0, KEY_LEFT),
2941 KEY(1, 1, KEY_SEND),
2942 KEY(1, 2, KEY_1),
2943 KEY(1, 3, KEY_4),
2944 KEY(1, 4, KEY_CLEAR),
2945 KEY(1, 5, KEY_MSDOS),
2946 KEY(1, 6, KEY_SPACE),
2947 KEY(1, 7, KEY_COMMA),
2948
2949 KEY(2, 0, KEY_6),
2950 KEY(2, 1, KEY_5),
2951 KEY(2, 2, KEY_8),
2952 KEY(2, 3, KEY_3),
2953 KEY(2, 4, KEY_NUMERIC_STAR),
2954 KEY(2, 5, KEY_UP),
2955 KEY(2, 6, KEY_DOWN),
2956 KEY(2, 7, KEY_LEFTSHIFT),
2957
2958 KEY(3, 0, KEY_9),
2959 KEY(3, 1, KEY_NUMERIC_POUND),
2960 KEY(3, 2, KEY_0),
2961 KEY(3, 3, KEY_2),
2962 KEY(3, 4, KEY_SLEEP),
2963 KEY(3, 5, KEY_F1),
2964 KEY(3, 6, KEY_F2),
2965 KEY(3, 7, KEY_F3),
2966
2967 KEY(4, 0, KEY_BACK),
2968 KEY(4, 1, KEY_HOME),
2969 KEY(4, 2, KEY_MENU),
2970 KEY(4, 3, KEY_VOLUMEUP),
2971 KEY(4, 4, KEY_VOLUMEDOWN),
2972 KEY(4, 5, KEY_F4),
2973 KEY(4, 6, KEY_F5),
2974 KEY(4, 7, KEY_F6),
2975
2976 KEY(5, 0, KEY_R),
2977 KEY(5, 1, KEY_T),
2978 KEY(5, 2, KEY_Y),
2979 KEY(5, 3, KEY_LEFTALT),
2980 KEY(5, 4, KEY_KPENTER),
2981 KEY(5, 5, KEY_Q),
2982 KEY(5, 6, KEY_W),
2983 KEY(5, 7, KEY_E),
2984
2985 KEY(6, 0, KEY_F),
2986 KEY(6, 1, KEY_G),
2987 KEY(6, 2, KEY_H),
2988 KEY(6, 3, KEY_CAPSLOCK),
2989 KEY(6, 4, KEY_PAGEUP),
2990 KEY(6, 5, KEY_A),
2991 KEY(6, 6, KEY_S),
2992 KEY(6, 7, KEY_D),
2993
2994 KEY(7, 0, KEY_V),
2995 KEY(7, 1, KEY_B),
2996 KEY(7, 2, KEY_N),
2997 KEY(7, 3, KEY_MENU),
2998 KEY(7, 4, KEY_PAGEDOWN),
2999 KEY(7, 5, KEY_Z),
3000 KEY(7, 6, KEY_X),
3001 KEY(7, 7, KEY_C),
3002
3003 KEY(8, 0, KEY_P),
3004 KEY(8, 1, KEY_J),
3005 KEY(8, 2, KEY_K),
3006 KEY(8, 3, KEY_INSERT),
3007 KEY(8, 4, KEY_LINEFEED),
3008 KEY(8, 5, KEY_U),
3009 KEY(8, 6, KEY_I),
3010 KEY(8, 7, KEY_O),
3011
3012 KEY(9, 0, KEY_4),
3013 KEY(9, 1, KEY_5),
3014 KEY(9, 2, KEY_6),
3015 KEY(9, 3, KEY_7),
3016 KEY(9, 4, KEY_8),
3017 KEY(9, 5, KEY_1),
3018 KEY(9, 6, KEY_2),
3019 KEY(9, 7, KEY_3),
3020
3021 KEY(10, 0, KEY_F7),
3022 KEY(10, 1, KEY_F8),
3023 KEY(10, 2, KEY_F9),
3024 KEY(10, 3, KEY_F10),
3025 KEY(10, 4, KEY_FN),
3026 KEY(10, 5, KEY_9),
3027 KEY(10, 6, KEY_0),
3028 KEY(10, 7, KEY_DOT),
3029
3030 KEY(11, 0, KEY_LEFTCTRL),
3031 KEY(11, 1, KEY_F11),
3032 KEY(11, 2, KEY_ENTER),
3033 KEY(11, 3, KEY_SEARCH),
3034 KEY(11, 4, KEY_DELETE),
3035 KEY(11, 5, KEY_RIGHT),
3036 KEY(11, 6, KEY_LEFT),
3037 KEY(11, 7, KEY_RIGHTSHIFT),
3038 KEY(0, 0, KEY_VOLUMEUP),
3039 KEY(0, 1, KEY_VOLUMEDOWN),
3040 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3041 KEY(0, 3, KEY_CAMERA_FOCUS),
3042};
3043
3044static struct matrix_keymap_data keymap_data_sim = {
3045 .keymap_size = ARRAY_SIZE(keymap_sim),
3046 .keymap = keymap_sim,
3047};
3048
3049static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3050 .input_name = "keypad_8960",
3051 .input_phys_device = "keypad_8960/input0",
3052 .num_rows = 12,
3053 .num_cols = 8,
3054 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3055 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3056 .debounce_ms = 15,
3057 .scan_delay_ms = 32,
3058 .row_hold_ns = 91500,
3059 .wakeup = 1,
3060 .keymap_data = &keymap_data_sim,
3061};
3062
3063static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
3064 .safety_time = 180,
3065 .update_time = 1,
3066 .max_voltage = 4200,
3067 .min_voltage = 3200,
3068 .resume_voltage = 4100,
3069 .term_current = 100,
3070};
3071
3072static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3073 .priority = 0,
3074};
3075
3076static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3077 .r_sense = 10,
3078 .i_test = 2500,
3079 .v_failure = 3000,
3080 .calib_delay_ms = 600000,
3081 .batt_data = &palladium_1500_data,
3082};
3083
3084static struct led_info pm8921_led_info[] = {
3085 [0] = {
3086 .name = "led:drv1",
3087 .flags = PM8XXX_ID_LED_1,
3088 },
3089};
3090
3091static struct led_platform_data pm8xxx_leds_pdata = {
3092 .num_leds = ARRAY_SIZE(pm8921_led_info),
3093 .leds = pm8921_led_info,
3094};
3095
3096static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3097 .irq_pdata = &pm8xxx_irq_pdata,
3098 .gpio_pdata = &pm8xxx_gpio_pdata,
3099 .mpp_pdata = &pm8xxx_mpp_pdata,
3100 .rtc_pdata = &pm8xxx_rtc_pdata,
3101 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3102 .keypad_pdata = &keypad_data,
3103 .misc_pdata = &pm8xxx_misc_pdata,
3104 .regulator_pdatas = msm_pm8921_regulator_pdata,
3105 .charger_pdata = &pm8921_chg_pdata,
3106 .bms_pdata = &pm8921_bms_pdata,
3107 .adc_pdata = &pm8921_adc_pdata,
3108 .leds_pdata = &pm8xxx_leds_pdata,
3109};
3110
3111static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3112 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3113 .slave = {
3114 .name = "pm8921-core",
3115 .platform_data = &pm8921_platform_data,
3116 },
3117};
3118
3119static void msm8960_wcnss_init(void)
3120{
3121 int i, ret, j;
3122
3123 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3124 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3125 "wcnss_5_wire");
3126 if (ret) {
3127 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3128 wcnss_5wire_interface[i].gpio, ret);
3129 goto fail;
3130 }
3131 }
3132
3133 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3134
3135 return;
3136
3137fail:
3138 for (j = 0; j < i; j++)
3139 gpio_free(wcnss_5wire_interface[j].gpio);
3140}
3141
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003142#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143static int ethernet_init(void)
3144{
3145 int ret;
3146 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3147 if (ret) {
3148 pr_err("ks8851 gpio_request failed: %d\n", ret);
3149 goto fail;
3150 }
3151
3152 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3153 if (ret) {
3154 pr_err("ks8851 gpio_request failed: %d\n", ret);
3155 goto fail_rst;
3156 }
3157
3158 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3159 if (ret) {
3160 pr_err("ks8851 gpio_request failed: %d\n", ret);
3161 goto fail_cs;
3162 }
3163
3164 gpio_direction_output(FPGA_CS_GPIO, 1);
3165 gpio_direction_output(KS8851_RST_GPIO, 1);
3166 return 0;
3167fail_cs:
3168 gpio_free(KS8851_RST_GPIO);
3169fail_rst:
3170 gpio_free(KS8851_IRQ_GPIO);
3171fail:
3172 return ret;
3173}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003174#else
3175static int ethernet_init(void)
3176{
3177 return 0;
3178}
3179#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003180
3181static struct msm_cpuidle_state msm_cstates[] __initdata = {
3182 {0, 0, "C0", "WFI",
3183 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3184
3185 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3186 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3187
3188 {0, 2, "C2", "POWER_COLLAPSE",
3189 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3190
3191 {1, 0, "C0", "WFI",
3192 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3193
3194 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3195 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3196};
3197
3198static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3199 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3200 .idle_supported = 1,
3201 .suspend_supported = 1,
3202 .idle_enabled = 0,
3203 .suspend_enabled = 0,
3204 .latency = 4000,
3205 .residency = 13000,
3206 },
3207
3208 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3209 .idle_supported = 1,
3210 .suspend_supported = 1,
3211 .idle_enabled = 0,
3212 .suspend_enabled = 0,
3213 .latency = 500,
3214 .residency = 6000,
3215 },
3216
3217 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3218 .idle_supported = 1,
3219 .suspend_supported = 1,
3220 .idle_enabled = 1,
3221 .suspend_enabled = 1,
3222 .latency = 2,
3223 .residency = 0,
3224 },
3225
3226 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3227 .idle_supported = 0,
3228 .suspend_supported = 1,
3229 .idle_enabled = 0,
3230 .suspend_enabled = 0,
3231 .latency = 600,
3232 .residency = 7200,
3233 },
3234
3235 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3236 .idle_supported = 1,
3237 .suspend_supported = 1,
3238 .idle_enabled = 0,
3239 .suspend_enabled = 0,
3240 .latency = 500,
3241 .residency = 6000,
3242 },
3243
3244 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3245 .idle_supported = 1,
3246 .suspend_supported = 0,
3247 .idle_enabled = 1,
3248 .suspend_enabled = 0,
3249 .latency = 2,
3250 .residency = 0,
3251 },
3252};
3253
3254static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3255 {
3256 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3257 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3258 true,
3259 1, 8000, 100000, 1,
3260 },
3261
3262 {
3263 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3264 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3265 true,
3266 1500, 5000, 60100000, 3000,
3267 },
3268
3269 {
3270 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3271 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3272 false,
3273 1800, 5000, 60350000, 3500,
3274 },
3275
3276 {
3277 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3278 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3279 false,
3280 2800, 2500, 65350000, 4800,
3281 },
3282
3283 {
3284 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3285 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3286 false,
3287 3800, 4500, 67850000, 5500,
3288 },
3289
3290 {
3291 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3292 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3293 false,
3294 4800, 2000, 71850000, 6800,
3295 },
3296
3297 {
3298 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3299 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3300 false,
3301 6800, 500, 75850000, 8800,
3302 },
3303
3304 {
3305 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3306 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3307 false,
3308 7800, 0, 76350000, 9800,
3309 },
3310};
3311
3312#ifdef CONFIG_I2C
3313#define I2C_SURF 1
3314#define I2C_FFA (1 << 1)
3315#define I2C_RUMI (1 << 2)
3316#define I2C_SIM (1 << 3)
3317#define I2C_FLUID (1 << 4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318
3319struct i2c_registry {
3320 u8 machs;
3321 int bus;
3322 struct i2c_board_info *info;
3323 int len;
3324};
3325
3326#ifdef CONFIG_MSM_CAMERA
3327static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3328#ifdef CONFIG_IMX074
3329 {
3330 I2C_BOARD_INFO("imx074", 0x1A),
3331 },
3332#endif
3333#ifdef CONFIG_OV2720
3334 {
3335 I2C_BOARD_INFO("ov2720", 0x6C),
3336 },
3337#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003338 {
3339 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3340 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303341#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3342 {
3343 I2C_BOARD_INFO("sc628a", 0x6E),
3344 },
3345#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003346};
3347#endif
3348
3349/* Sensors DSPS platform data */
3350#ifdef CONFIG_MSM_DSPS
3351#define DSPS_PIL_GENERIC_NAME "dsps"
3352#endif /* CONFIG_MSM_DSPS */
3353
3354static void __init msm8960_init_dsps(void)
3355{
3356#ifdef CONFIG_MSM_DSPS
3357 struct msm_dsps_platform_data *pdata =
3358 msm_dsps_device.dev.platform_data;
3359 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3360 pdata->gpios = NULL;
3361 pdata->gpios_num = 0;
3362
3363 platform_device_register(&msm_dsps_device);
3364#endif /* CONFIG_MSM_DSPS */
3365}
3366
3367static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3368#ifdef CONFIG_MSM_CAMERA
3369 {
3370 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3371 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3372 msm_camera_boardinfo,
3373 ARRAY_SIZE(msm_camera_boardinfo),
3374 },
3375#endif
3376 {
3377 I2C_SURF | I2C_FFA | I2C_FLUID,
3378 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3379 cyttsp_info,
3380 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003381 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382};
3383#endif /* CONFIG_I2C */
3384
3385static void __init register_i2c_devices(void)
3386{
3387#ifdef CONFIG_I2C
3388 u8 mach_mask = 0;
3389 int i;
3390
3391 /* Build the matching 'supported_machs' bitmask */
3392 if (machine_is_msm8960_cdp())
3393 mach_mask = I2C_SURF;
3394 else if (machine_is_msm8960_rumi3())
3395 mach_mask = I2C_RUMI;
3396 else if (machine_is_msm8960_sim())
3397 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003398 else if (machine_is_msm8960_fluid())
3399 mach_mask = I2C_FLUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003400 else if (machine_is_msm8960_mtp())
3401 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003402 else
3403 pr_err("unmatched machine ID in register_i2c_devices\n");
3404
3405 /* Run the array and install devices as appropriate */
3406 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3407 if (msm8960_i2c_devices[i].machs & mach_mask)
3408 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3409 msm8960_i2c_devices[i].info,
3410 msm8960_i2c_devices[i].len);
3411 }
3412#endif
3413}
3414
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003415static void __init msm8960_sim_init(void)
3416{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003417 if (socinfo_init() < 0)
3418 pr_err("socinfo_init() failed!\n");
3419
3420 BUG_ON(msm_rpm_init(&msm_rpm_data));
3421 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3422 ARRAY_SIZE(msm_rpmrs_levels)));
3423 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003424 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003425 msm8960_device_ssbi_pm8921.dev.platform_data =
3426 &msm8960_ssbi_pm8921_pdata;
3427 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003428
3429 /* Simulator supports a QWERTY keypad */
3430 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3431
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003432 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3433 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3434 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003435 gpiomux_init();
3436 ethernet_init();
3437 msm8960_i2c_init();
3438 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3439 msm_spm_l2_init(msm_spm_l2_data);
3440 msm8960_init_buses();
3441 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3442 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003443 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003444 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3445
3446 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3447 &msm8960_qup_spi_gsbi1_pdata;
3448 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3449
3450 msm8960_init_mmc();
3451 msm_fb_add_devices();
3452 slim_register_board_info(msm_slim_devices,
3453 ARRAY_SIZE(msm_slim_devices));
3454 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3455 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3456 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3457 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003458}
3459
3460static void __init msm8960_rumi3_init(void)
3461{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003462 if (socinfo_init() < 0)
3463 pr_err("socinfo_init() failed!\n");
3464
3465 BUG_ON(msm_rpm_init(&msm_rpm_data));
3466 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3467 ARRAY_SIZE(msm_rpmrs_levels)));
3468 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003469 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003470 gpiomux_init();
3471 ethernet_init();
3472 msm8960_device_ssbi_pm8921.dev.platform_data =
3473 &msm8960_ssbi_pm8921_pdata;
3474 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3475 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3476 &msm8960_qup_spi_gsbi1_pdata;
3477 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3478 msm8960_i2c_init();
3479 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3480 msm_spm_l2_init(msm_spm_l2_data);
3481 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3482 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003483 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003484 msm8960_init_mmc();
3485
3486 register_i2c_devices();
3487 msm_fb_add_devices();
3488 slim_register_board_info(msm_slim_devices,
3489 ARRAY_SIZE(msm_slim_devices));
3490 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3491 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3492 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3493 msm_pm_data);
3494}
3495
3496static void __init msm8960_cdp_init(void)
3497{
3498 if (socinfo_init() < 0)
3499 pr_err("socinfo_init() failed!\n");
3500
3501 BUG_ON(msm_rpm_init(&msm_rpm_data));
3502 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3503 ARRAY_SIZE(msm_rpmrs_levels)));
3504 regulator_suppress_info_printing();
3505 if (msm_xo_init())
3506 pr_err("Failed to initialize XO votes\n");
Stephen Boydbb600ae2011-08-02 20:11:40 -07003507 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003508 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3509 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3510 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003511 gpiomux_init();
3512 ethernet_init();
3513 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3514 &msm8960_qup_spi_gsbi1_pdata;
3515 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3516 msm8960_device_ssbi_pm8921.dev.platform_data =
3517 &msm8960_ssbi_pm8921_pdata;
3518 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3519 msm8960_i2c_init();
3520 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3521 msm_spm_l2_init(msm_spm_l2_data);
3522 msm8960_init_buses();
3523 platform_add_devices(msm_footswitch_devices,
3524 msm_num_footswitch_devices);
3525 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3526 pm8921_gpio_mpp_init();
3527 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3528 msm8960_init_cam();
3529 msm8960_init_mmc();
3530 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3531 register_i2c_devices();
3532 msm8960_wcnss_init();
3533 msm_fb_add_devices();
3534 slim_register_board_info(msm_slim_devices,
3535 ARRAY_SIZE(msm_slim_devices));
3536 msm8960_init_dsps();
3537 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3538 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3539 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3540 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003541 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003542}
3543
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003544MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3545 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003546 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003547 .init_irq = msm8960_init_irq,
3548 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003549 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003550 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003551MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003552
3553MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3554 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003555 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003556 .init_irq = msm8960_init_irq,
3557 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003558 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003559 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003560MACHINE_END
3561
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003562MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3563 .map_io = msm8960_map_io,
3564 .reserve = msm8960_reserve,
3565 .init_irq = msm8960_init_irq,
3566 .timer = &msm_timer,
3567 .init_machine = msm8960_cdp_init,
3568 .init_early = msm8960_allocate_memory_regions,
3569MACHINE_END
3570
3571MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3572 .map_io = msm8960_map_io,
3573 .reserve = msm8960_reserve,
3574 .init_irq = msm8960_init_irq,
3575 .timer = &msm_timer,
3576 .init_machine = msm8960_cdp_init,
3577 .init_early = msm8960_allocate_memory_regions,
3578MACHINE_END
3579
3580MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3581 .map_io = msm8960_map_io,
3582 .reserve = msm8960_reserve,
3583 .init_irq = msm8960_init_irq,
3584 .timer = &msm_timer,
3585 .init_machine = msm8960_cdp_init,
3586 .init_early = msm8960_allocate_memory_regions,
3587MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003588
3589MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3590 .map_io = msm8960_map_io,
3591 .reserve = msm8960_reserve,
3592 .init_irq = msm8960_init_irq,
3593 .timer = &msm_timer,
3594 .init_machine = msm8960_cdp_init,
3595 .init_early = msm8960_allocate_memory_regions,
3596MACHINE_END