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