blob: e5f543c32082829f07d56a5152c894d25edbb4fb [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
1660static struct tabla_pdata tabla_platform_data = {
1661 .slimbus_slave_device = {
1662 .name = "tabla-slave",
1663 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1664 },
1665 .irq = MSM_GPIO_TO_INT(62),
1666 .irq_base = TABLA_INTERRUPT_BASE,
1667 .num_irqs = NR_TABLA_IRQS,
1668 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1669};
1670
1671static struct slim_device msm_slim_tabla = {
1672 .name = "tabla-slim",
1673 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1674 .dev = {
1675 .platform_data = &tabla_platform_data,
1676 },
1677};
1678#endif
1679
1680static struct slim_boardinfo msm_slim_devices[] = {
1681#ifdef CONFIG_WCD9310_CODEC
1682 {
1683 .bus_num = 1,
1684 .slim_slave = &msm_slim_tabla,
1685 },
1686#endif
1687 /* add more slimbus slaves as needed */
1688};
1689
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001690#define MSM_WCNSS_PHYS 0x03000000
1691#define MSM_WCNSS_SIZE 0x280000
1692
1693static struct resource resources_wcnss_wlan[] = {
1694 {
1695 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1696 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1697 .name = "wcnss_wlanrx_irq",
1698 .flags = IORESOURCE_IRQ,
1699 },
1700 {
1701 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1702 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1703 .name = "wcnss_wlantx_irq",
1704 .flags = IORESOURCE_IRQ,
1705 },
1706 {
1707 .start = MSM_WCNSS_PHYS,
1708 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1709 .name = "wcnss_mmio",
1710 .flags = IORESOURCE_MEM,
1711 },
1712};
1713
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001714static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1715 .has_48mhz_xo = 1,
1716};
1717
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001718static struct platform_device msm_device_wcnss_wlan = {
1719 .name = "wcnss_wlan",
1720 .id = 0,
1721 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1722 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001723 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001724};
1725
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001726#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1727 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1728 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1729 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1730
1731#define QCE_SIZE 0x10000
1732#define QCE_0_BASE 0x18500000
1733
1734#define QCE_HW_KEY_SUPPORT 0
1735#define QCE_SHA_HMAC_SUPPORT 1
1736#define QCE_SHARE_CE_RESOURCE 1
1737#define QCE_CE_SHARED 0
1738
1739static struct resource qcrypto_resources[] = {
1740 [0] = {
1741 .start = QCE_0_BASE,
1742 .end = QCE_0_BASE + QCE_SIZE - 1,
1743 .flags = IORESOURCE_MEM,
1744 },
1745 [1] = {
1746 .name = "crypto_channels",
1747 .start = DMOV_CE_IN_CHAN,
1748 .end = DMOV_CE_OUT_CHAN,
1749 .flags = IORESOURCE_DMA,
1750 },
1751 [2] = {
1752 .name = "crypto_crci_in",
1753 .start = DMOV_CE_IN_CRCI,
1754 .end = DMOV_CE_IN_CRCI,
1755 .flags = IORESOURCE_DMA,
1756 },
1757 [3] = {
1758 .name = "crypto_crci_out",
1759 .start = DMOV_CE_OUT_CRCI,
1760 .end = DMOV_CE_OUT_CRCI,
1761 .flags = IORESOURCE_DMA,
1762 },
1763};
1764
1765static struct resource qcedev_resources[] = {
1766 [0] = {
1767 .start = QCE_0_BASE,
1768 .end = QCE_0_BASE + QCE_SIZE - 1,
1769 .flags = IORESOURCE_MEM,
1770 },
1771 [1] = {
1772 .name = "crypto_channels",
1773 .start = DMOV_CE_IN_CHAN,
1774 .end = DMOV_CE_OUT_CHAN,
1775 .flags = IORESOURCE_DMA,
1776 },
1777 [2] = {
1778 .name = "crypto_crci_in",
1779 .start = DMOV_CE_IN_CRCI,
1780 .end = DMOV_CE_IN_CRCI,
1781 .flags = IORESOURCE_DMA,
1782 },
1783 [3] = {
1784 .name = "crypto_crci_out",
1785 .start = DMOV_CE_OUT_CRCI,
1786 .end = DMOV_CE_OUT_CRCI,
1787 .flags = IORESOURCE_DMA,
1788 },
1789};
1790
1791#endif
1792
1793#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1794 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1795
1796static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1797 .ce_shared = QCE_CE_SHARED,
1798 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1799 .hw_key_support = QCE_HW_KEY_SUPPORT,
1800 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1801};
1802
1803static struct platform_device qcrypto_device = {
1804 .name = "qcrypto",
1805 .id = 0,
1806 .num_resources = ARRAY_SIZE(qcrypto_resources),
1807 .resource = qcrypto_resources,
1808 .dev = {
1809 .coherent_dma_mask = DMA_BIT_MASK(32),
1810 .platform_data = &qcrypto_ce_hw_suppport,
1811 },
1812};
1813#endif
1814
1815#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1816 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1817
1818static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1819 .ce_shared = QCE_CE_SHARED,
1820 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1821 .hw_key_support = QCE_HW_KEY_SUPPORT,
1822 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1823};
1824
1825static struct platform_device qcedev_device = {
1826 .name = "qce",
1827 .id = 0,
1828 .num_resources = ARRAY_SIZE(qcedev_resources),
1829 .resource = qcedev_resources,
1830 .dev = {
1831 .coherent_dma_mask = DMA_BIT_MASK(32),
1832 .platform_data = &qcedev_ce_hw_suppport,
1833 },
1834};
1835#endif
1836
1837
1838static int __init gpiomux_init(void)
1839{
1840 int rc;
1841
1842 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1843 if (rc) {
1844 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1845 return rc;
1846 }
1847
1848 msm_gpiomux_install(msm8960_cam_configs,
1849 ARRAY_SIZE(msm8960_cam_configs));
1850
1851 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001852 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001853
1854 msm_gpiomux_install(msm8960_gsbi_configs,
1855 ARRAY_SIZE(msm8960_gsbi_configs));
1856
1857 msm_gpiomux_install(msm8960_cyts_configs,
1858 ARRAY_SIZE(msm8960_cyts_configs));
1859
1860 msm_gpiomux_install(msm8960_slimbus_config,
1861 ARRAY_SIZE(msm8960_slimbus_config));
1862
1863 msm_gpiomux_install(msm8960_audio_codec_configs,
1864 ARRAY_SIZE(msm8960_audio_codec_configs));
1865
1866#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1867 msm_gpiomux_install(msm8960_hdmi_configs,
1868 ARRAY_SIZE(msm8960_hdmi_configs));
1869#endif
1870
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001871 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1872 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1873
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874 msm_gpiomux_install(wcnss_5wire_interface,
1875 ARRAY_SIZE(wcnss_5wire_interface));
1876
1877 return 0;
1878}
1879
1880static struct msm_acpu_clock_platform_data msm8960_acpu_clock_data = {
1881 .acpu_switch_time_us = 0,
1882 .vdd_switch_time_us = 0,
1883};
1884
1885#define MSM_SHARED_RAM_PHYS 0x80000000
1886
1887static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1888 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1889 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1890 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1891 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1892 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1893 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1894 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1895 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1896 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1897 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1898 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1899 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1900 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1901 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1902 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1903 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1904 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1905 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1906 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1907 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1908 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1909 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1910 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1911 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1912 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1913 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1914 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1915 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1916 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1917 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1918};
1919
1920static struct pm8921_adc_properties pm8921_adc_data = {
1921 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1922 .bitresolution = 15,
1923 .bipolar = 0,
1924};
1925
1926static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1927 .adc_channel = pm8921_adc_channels_data,
1928 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1929 .adc_prop = &pm8921_adc_data,
1930};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001931
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001932static void __init msm8960_map_io(void)
1933{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001935 msm_map_msm8960_io();
1936}
1937
1938static void __init msm8960_init_irq(void)
1939{
1940 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001941
1942 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001943 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001945
1946 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001947 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001949 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1950 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001951
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001952 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1953 * as they are configured as level, which does not play nice with
1954 * handle_percpu_irq.
1955 */
1956 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1957 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001958 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001959 }
1960}
1961
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001962/* MSM8960 have 5 SDCC controllers */
1963enum sdcc_controllers {
1964 SDCC1,
1965 SDCC2,
1966 SDCC3,
1967 SDCC4,
1968 SDCC5,
1969 MAX_SDCC_CONTROLLER
1970};
1971
1972/* All SDCC controllers requires VDD/VCC voltage */
1973static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
1974 /* SDCC1 : eMMC card connected */
1975 [SDCC1] = {
1976 .name = "sdc_vdd",
1977 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301978 .high_vol_level = 2950000,
1979 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05301980 .always_on = 1,
1981 .lpm_sup = 1,
1982 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983 .hpm_uA = 200000, /* 200mA */
1984 },
1985 /* SDCC3 : External card slot connected */
1986 [SDCC3] = {
1987 .name = "sdc_vdd",
1988 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301989 .high_vol_level = 2950000,
1990 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001991 .hpm_uA = 600000, /* 600mA */
1992 }
1993};
1994
1995/* Only slots having eMMC card will require VCCQ voltage */
1996static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
1997 /* SDCC1 : eMMC card connected */
1998 [SDCC1] = {
1999 .name = "sdc_vccq",
2000 .set_voltage_sup = 1,
2001 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302002 .high_vol_level = 1800000,
2003 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002004 .hpm_uA = 200000, /* 200mA */
2005 }
2006};
2007
2008/* All SDCC controllers may require voting for VDD PAD voltage */
2009static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2010 /* SDCC3 : External card slot connected */
2011 [SDCC3] = {
2012 .name = "sdc_vddp",
2013 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302014 .high_vol_level = 2950000,
2015 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002016 .always_on = 1,
2017 .lpm_sup = 1,
2018 /* Max. Active current required is 16 mA */
2019 .hpm_uA = 16000,
2020 /*
2021 * Sleep current required is ~300 uA. But min. vote can be
2022 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2023 * during sleep.
2024 */
2025 .lpm_uA = 2000,
2026 }
2027};
2028
2029static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2030 /* SDCC1 : eMMC card connected */
2031 [SDCC1] = {
2032 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2033 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2034 },
2035 /* SDCC3 : External card slot connected */
2036 [SDCC3] = {
2037 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2038 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2039 }
2040};
2041
2042/* SDC1 pad data */
2043static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2044 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
2045 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2046 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
2047};
2048
2049static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2050 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2051 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2052 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2053};
2054
2055static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2056 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2057 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2058};
2059
2060static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2061 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2062 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2063};
2064
2065/* SDC3 pad data */
2066static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2067 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2068 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2069 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2070};
2071
2072static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2073 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2074 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2075 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2076};
2077
2078static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2079 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2080 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2081};
2082
2083static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2084 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2085 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2086};
2087
2088struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2089 [SDCC1] = {
2090 .on = sdc1_pad_pull_on_cfg,
2091 .off = sdc1_pad_pull_off_cfg,
2092 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2093 },
2094 [SDCC3] = {
2095 .on = sdc3_pad_pull_on_cfg,
2096 .off = sdc3_pad_pull_off_cfg,
2097 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2098 },
2099};
2100
2101struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2102 [SDCC1] = {
2103 .on = sdc1_pad_drv_on_cfg,
2104 .off = sdc1_pad_drv_off_cfg,
2105 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2106 },
2107 [SDCC3] = {
2108 .on = sdc3_pad_drv_on_cfg,
2109 .off = sdc3_pad_drv_off_cfg,
2110 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2111 },
2112};
2113
2114struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2115 [SDCC1] = {
2116 .pull = &mmc_pad_pull_data[SDCC1],
2117 .drv = &mmc_pad_drv_data[SDCC1]
2118 },
2119 [SDCC3] = {
2120 .pull = &mmc_pad_pull_data[SDCC3],
2121 .drv = &mmc_pad_drv_data[SDCC3]
2122 },
2123};
2124
2125struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2126 [SDCC1] = {
2127 .pad_data = &mmc_pad_data[SDCC1],
2128 },
2129 [SDCC3] = {
2130 .pad_data = &mmc_pad_data[SDCC3],
2131 },
2132};
2133
2134static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002135 400000, 24000000, 48000000, 96000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002136};
2137
2138static unsigned int sdc3_sup_clk_rates[] = {
2139 400000, 24000000, 48000000, 96000000
2140};
2141
2142#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2143static struct mmc_platform_data msm8960_sdc1_data = {
2144 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2145#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2146 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2147#else
2148 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2149#endif
2150 .sup_clk_table = sdc1_sup_clk_rates,
2151 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2152 .nonremovable = 1,
2153 .sdcc_v4_sup = true,
2154 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002155 .pin_data = &mmc_slot_pin_data[SDCC1],
2156 .uhs_caps = MMC_CAP_1_8V_DDR
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002157};
2158#endif
2159
2160#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2161static struct mmc_platform_data msm8960_sdc3_data = {
2162 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2163 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2164 .sup_clk_table = sdc3_sup_clk_rates,
2165 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2166 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2167 .sdcc_v4_sup = true,
2168 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2169 .pin_data = &mmc_slot_pin_data[SDCC3],
2170#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2171 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2172 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2173 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2174#endif
2175 .xpc_cap = 1,
2176 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2177 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002178 MMC_CAP_MAX_CURRENT_600 | MMC_CAP_1_8V_DDR)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002179};
2180#endif
2181
2182static void __init msm8960_init_mmc(void)
2183{
2184#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2185 /* SDC1 : eMMC card connected */
2186 msm_add_sdcc(1, &msm8960_sdc1_data);
2187#endif
2188#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2189 /* SDC3: External card slot */
2190 msm_add_sdcc(3, &msm8960_sdc3_data);
2191#endif
2192}
2193
2194static void __init msm8960_init_buses(void)
2195{
2196#ifdef CONFIG_MSM_BUS_SCALING
2197 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2198 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2199 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2200 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2201 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2202 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2203 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2204 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2205 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2206 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2207#endif
2208}
2209
2210static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2211 .max_clock_speed = 15060000,
2212};
2213
2214#ifdef CONFIG_USB_MSM_OTG_72K
2215static struct msm_otg_platform_data msm_otg_pdata;
2216#else
2217#define USB_5V_EN 42
2218static void msm_hsusb_vbus_power(bool on)
2219{
2220 int rc;
2221 static bool vbus_is_on;
2222 static struct regulator *mvs_otg_switch;
2223 struct pm_gpio param = {
2224 .direction = PM_GPIO_DIR_OUT,
2225 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2226 .output_value = 1,
2227 .pull = PM_GPIO_PULL_NO,
2228 .vin_sel = PM_GPIO_VIN_S4,
2229 .out_strength = PM_GPIO_STRENGTH_MED,
2230 .function = PM_GPIO_FUNC_NORMAL,
2231 };
2232
2233 if (vbus_is_on == on)
2234 return;
2235
2236 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002237 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2238 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239 if (IS_ERR(mvs_otg_switch)) {
2240 pr_err("Unable to get mvs_otg_switch\n");
2241 return;
2242 }
2243
2244 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2245 "usb_5v_en");
2246 if (rc < 0) {
2247 pr_err("failed to request usb_5v_en gpio\n");
2248 goto put_mvs_otg;
2249 }
2250
2251 if (regulator_enable(mvs_otg_switch)) {
2252 pr_err("unable to enable mvs_otg_switch\n");
2253 goto free_usb_5v_en;
2254 }
2255
2256 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2257 &param);
2258 if (rc < 0) {
2259 pr_err("failed to configure usb_5v_en gpio\n");
2260 goto disable_mvs_otg;
2261 }
2262 vbus_is_on = true;
2263 return;
2264 }
2265disable_mvs_otg:
2266 regulator_disable(mvs_otg_switch);
2267free_usb_5v_en:
2268 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2269put_mvs_otg:
2270 regulator_put(mvs_otg_switch);
2271 vbus_is_on = false;
2272}
2273
2274static struct msm_otg_platform_data msm_otg_pdata = {
2275 .mode = USB_OTG,
2276 .otg_control = OTG_PMIC_CONTROL,
2277 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2278 .pclk_src_name = "dfab_usb_hs_clk",
2279 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2280 .vbus_power = msm_hsusb_vbus_power,
2281};
2282#endif
2283
2284#define PID_MAGIC_ID 0x71432909
2285#define SERIAL_NUM_MAGIC_ID 0x61945374
2286#define SERIAL_NUMBER_LENGTH 127
2287#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2288
2289struct magic_num_struct {
2290 uint32_t pid;
2291 uint32_t serial_num;
2292};
2293
2294struct dload_struct {
2295 uint32_t reserved1;
2296 uint32_t reserved2;
2297 uint32_t reserved3;
2298 uint16_t reserved4;
2299 uint16_t pid;
2300 char serial_number[SERIAL_NUMBER_LENGTH];
2301 uint16_t reserved5;
2302 struct magic_num_struct magic_struct;
2303};
2304
2305static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2306{
2307 struct dload_struct __iomem *dload = 0;
2308
2309 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2310 if (!dload) {
2311 pr_err("%s: cannot remap I/O memory region: %08x\n",
2312 __func__, DLOAD_USB_BASE_ADD);
2313 return -ENXIO;
2314 }
2315
2316 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2317 __func__, dload, pid, snum);
2318 /* update pid */
2319 dload->magic_struct.pid = PID_MAGIC_ID;
2320 dload->pid = pid;
2321
2322 /* update serial number */
2323 dload->magic_struct.serial_num = 0;
2324 if (!snum) {
2325 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2326 goto out;
2327 }
2328
2329 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2330 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2331 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2332out:
2333 iounmap(dload);
2334 return 0;
2335}
2336
2337static struct android_usb_platform_data android_usb_pdata = {
2338 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2339};
2340
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002341static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002342 .name = "android_usb",
2343 .id = -1,
2344 .dev = {
2345 .platform_data = &android_usb_pdata,
2346 },
2347};
2348
2349static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2350 0x03, 0x0f,
2351};
2352
2353static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2354 0x00, 0x24, 0x54, 0x10,
2355 0x09, 0x03, 0x01,
2356 0x10, 0x54, 0x30, 0x0C,
2357 0x24, 0x30, 0x0f,
2358};
2359
2360static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2361 0x00, 0x24, 0x54, 0x10,
2362 0x09, 0x07, 0x01, 0x0B,
2363 0x10, 0x54, 0x30, 0x0C,
2364 0x24, 0x30, 0x0f,
2365};
2366
2367static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2368 [0] = {
2369 .mode = MSM_SPM_MODE_CLOCK_GATING,
2370 .notify_rpm = false,
2371 .cmd = spm_wfi_cmd_sequence,
2372 },
2373 [1] = {
2374 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2375 .notify_rpm = false,
2376 .cmd = spm_power_collapse_without_rpm,
2377 },
2378 [2] = {
2379 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2380 .notify_rpm = true,
2381 .cmd = spm_power_collapse_with_rpm,
2382 },
2383};
2384
2385static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2386 [0] = {
2387 .reg_base_addr = MSM_SAW0_BASE,
2388 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2389 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2390 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2391#if defined(CONFIG_MSM_AVS_HW)
2392 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2393 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2394#endif
2395 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2396 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2397 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2398 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2399 .vctl_timeout_us = 50,
2400 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2401 .modes = msm_spm_seq_list,
2402 },
2403 [1] = {
2404 .reg_base_addr = MSM_SAW1_BASE,
2405 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2406 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2407 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2408#if defined(CONFIG_MSM_AVS_HW)
2409 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2410 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2411#endif
2412 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2413 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2414 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2415 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2416 .vctl_timeout_us = 50,
2417 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2418 .modes = msm_spm_seq_list,
2419 },
2420};
2421
2422static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2423 0x00, 0x20, 0x03, 0x20,
2424 0x00, 0x0f,
2425};
2426
2427static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2428 0x00, 0x20, 0x34, 0x64,
2429 0x48, 0x07, 0x48, 0x20,
2430 0x50, 0x64, 0x04, 0x34,
2431 0x50, 0x0f,
2432};
2433static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2434 0x00, 0x10, 0x34, 0x64,
2435 0x48, 0x07, 0x48, 0x10,
2436 0x50, 0x64, 0x04, 0x34,
2437 0x50, 0x0F,
2438};
2439
2440static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2441 [0] = {
2442 .mode = MSM_SPM_L2_MODE_RETENTION,
2443 .notify_rpm = false,
2444 .cmd = l2_spm_wfi_cmd_sequence,
2445 },
2446 [1] = {
2447 .mode = MSM_SPM_L2_MODE_GDHS,
2448 .notify_rpm = true,
2449 .cmd = l2_spm_gdhs_cmd_sequence,
2450 },
2451 [2] = {
2452 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2453 .notify_rpm = true,
2454 .cmd = l2_spm_power_off_cmd_sequence,
2455 },
2456};
2457
2458
2459static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2460 [0] = {
2461 .reg_base_addr = MSM_SAW_L2_BASE,
2462 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2463 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2464 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2465 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2466 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2467 .modes = msm_spm_l2_seq_list,
2468 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2469 },
2470};
2471
2472#define CYTTSP_TS_GPIO_IRQ 11
2473#define CYTTSP_TS_SLEEP_GPIO 50
2474#define CYTTSP_TS_RESOUT_N_GPIO 52
2475
2476/*virtual key support */
2477static ssize_t tma340_vkeys_show(struct kobject *kobj,
2478 struct kobj_attribute *attr, char *buf)
2479{
2480 return snprintf(buf, 200,
2481 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2482 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2483 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2484 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2485 "\n");
2486}
2487
2488static struct kobj_attribute tma340_vkeys_attr = {
2489 .attr = {
2490 .mode = S_IRUGO,
2491 },
2492 .show = &tma340_vkeys_show,
2493};
2494
2495static struct attribute *tma340_properties_attrs[] = {
2496 &tma340_vkeys_attr.attr,
2497 NULL
2498};
2499
2500static struct attribute_group tma340_properties_attr_group = {
2501 .attrs = tma340_properties_attrs,
2502};
2503
2504
2505static int cyttsp_platform_init(struct i2c_client *client)
2506{
2507 int rc = 0;
2508 static struct kobject *tma340_properties_kobj;
2509
2510 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2511 tma340_properties_kobj = kobject_create_and_add("board_properties",
2512 NULL);
2513 if (tma340_properties_kobj)
2514 rc = sysfs_create_group(tma340_properties_kobj,
2515 &tma340_properties_attr_group);
2516 if (!tma340_properties_kobj || rc)
2517 pr_err("%s: failed to create board_properties\n",
2518 __func__);
2519
2520 return 0;
2521}
2522
2523static struct cyttsp_regulator regulator_data[] = {
2524 {
2525 .name = "vdd",
2526 .min_uV = CY_TMA300_VTG_MIN_UV,
2527 .max_uV = CY_TMA300_VTG_MAX_UV,
2528 .load_uA = CY_TMA300_CURR_24HZ_UA,
2529 },
2530 /* TODO: Remove after runtime PM is enabled in I2C driver */
2531 {
2532 .name = "vcc_i2c",
2533 .min_uV = CY_I2C_VTG_MIN_UV,
2534 .max_uV = CY_I2C_VTG_MAX_UV,
2535 .load_uA = CY_I2C_CURR_UA,
2536 },
2537};
2538
2539static struct cyttsp_platform_data cyttsp_pdata = {
2540 .panel_maxx = 634,
2541 .panel_maxy = 1166,
2542 .disp_maxx = 616,
2543 .disp_maxy = 1023,
2544 .disp_minx = 0,
2545 .disp_miny = 16,
2546 .flags = 0x01,
2547 .gen = CY_GEN3, /* or */
2548 .use_st = CY_USE_ST,
2549 .use_mt = CY_USE_MT,
2550 .use_hndshk = CY_SEND_HNDSHK,
2551 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302552 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002553 .use_gestures = CY_USE_GESTURES,
2554 .fw_fname = "cyttsp_8960_cdp.hex",
2555 /* activate up to 4 groups
2556 * and set active distance
2557 */
2558 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2559 CY_GEST_GRP3 | CY_GEST_GRP4 |
2560 CY_ACT_DIST,
2561 /* change act_intrvl to customize the Active power state
2562 * scanning/processing refresh interval for Operating mode
2563 */
2564 .act_intrvl = CY_ACT_INTRVL_DFLT,
2565 /* change tch_tmout to customize the touch timeout for the
2566 * Active power state for Operating mode
2567 */
2568 .tch_tmout = CY_TCH_TMOUT_DFLT,
2569 /* change lp_intrvl to customize the Low Power power state
2570 * scanning/processing refresh interval for Operating mode
2571 */
2572 .lp_intrvl = CY_LP_INTRVL_DFLT,
2573 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2574 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2575 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2576 .regulator_info = regulator_data,
2577 .num_regulators = ARRAY_SIZE(regulator_data),
2578 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302579 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002580};
2581
2582static struct i2c_board_info cyttsp_info[] __initdata = {
2583 {
2584 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2585 .platform_data = &cyttsp_pdata,
2586#ifndef CY_USE_TIMER
2587 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2588#endif /* CY_USE_TIMER */
2589 },
2590};
2591
2592static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2593{
2594}
2595
2596static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2597 .clk_freq = 100000,
2598 .src_clk_rate = 24000000,
2599 .clk = "gsbi_qup_clk",
2600 .pclk = "gsbi_pclk",
2601 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2602};
2603
2604static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2605 .clk_freq = 100000,
2606 .src_clk_rate = 24000000,
2607 .clk = "gsbi_qup_clk",
2608 .pclk = "gsbi_pclk",
2609 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2610};
2611
2612static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2613 .clk_freq = 100000,
2614 .src_clk_rate = 24000000,
2615 .clk = "gsbi_qup_clk",
2616 .pclk = "gsbi_pclk",
2617 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2618};
2619
2620static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2621 .clk_freq = 100000,
2622 .src_clk_rate = 24000000,
2623 .clk = "gsbi_qup_clk",
2624 .pclk = "gsbi_pclk",
2625 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2626};
2627
2628static struct msm_rpm_platform_data msm_rpm_data = {
2629 .reg_base_addrs = {
2630 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2631 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2632 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2633 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2634 },
2635
2636 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2637 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2638 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2639 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2640 .msm_apps_ipc_rpm_val = 4,
2641};
2642
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002643static struct platform_device msm_rpm_device = {
2644 .name = "msm_rpm",
2645 .id = -1,
2646};
2647
2648
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002649static struct spi_board_info spi_board_info[] __initdata = {
2650 {
2651 .modalias = "ks8851",
2652 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2653 .max_speed_hz = 19200000,
2654 .bus_num = 0,
2655 .chip_select = 0,
2656 .mode = SPI_MODE_0,
2657 },
2658};
2659
2660static struct platform_device msm_device_saw_core0 = {
2661 .name = "saw-regulator",
2662 .id = 0,
2663 .dev = {
2664 .platform_data = &msm_saw_regulator_pdata_s5,
2665 },
2666};
2667
2668static struct platform_device msm_device_saw_core1 = {
2669 .name = "saw-regulator",
2670 .id = 1,
2671 .dev = {
2672 .platform_data = &msm_saw_regulator_pdata_s6,
2673 },
2674};
2675
2676#ifdef CONFIG_MSM_FAKE_BATTERY
2677static struct platform_device fish_battery_device = {
2678 .name = "fish_battery",
2679};
2680#endif
2681
David Collins26f05562011-06-20 09:56:28 -07002682static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002683 .name = GPIO_REGULATOR_DEV_NAME,
2684 .id = PM8921_MPP_PM_TO_SYS(7),
2685 .dev = {
2686 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2687 },
2688};
2689
David Collins26f05562011-06-20 09:56:28 -07002690static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 .name = GPIO_REGULATOR_DEV_NAME,
2692 .id = 91,
2693 .dev = {
2694 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2695 },
2696};
2697
David Collins26f05562011-06-20 09:56:28 -07002698static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2699 .name = "rpm-regulator",
2700 .id = -1,
2701 .dev = {
2702 .platform_data = &msm_rpm_regulator_pdata,
2703 },
2704};
2705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002707 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002708 &msm_device_smd,
2709 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302710 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711 &msm_device_saw_core0,
2712 &msm_device_saw_core1,
2713 &msm8960_device_ext_5v_vreg,
2714 &msm8960_device_ext_l2_vreg,
2715 &msm8960_device_ssbi_pm8921,
2716 &msm8960_device_qup_spi_gsbi1,
2717 &msm8960_device_qup_i2c_gsbi3,
2718 &msm8960_device_qup_i2c_gsbi4,
2719 &msm8960_device_qup_i2c_gsbi10,
2720#ifndef CONFIG_MSM_DSPS
2721 &msm8960_device_qup_i2c_gsbi12,
2722#endif
2723 &msm_slim_ctrl,
2724 &msm_device_wcnss_wlan,
2725#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2726 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2727 &qcrypto_device,
2728#endif
2729
2730#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2731 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2732 &qcedev_device,
2733#endif
2734#ifdef CONFIG_MSM_ROTATOR
2735 &msm_rotator_device,
2736#endif
2737 &msm_device_sps,
2738#ifdef CONFIG_MSM_FAKE_BATTERY
2739 &fish_battery_device,
2740#endif
2741#ifdef CONFIG_ANDROID_PMEM
2742 &android_pmem_device,
2743 &android_pmem_adsp_device,
2744 &android_pmem_audio_device,
2745#endif
2746 &msm_fb_device,
2747 &msm_device_vidc,
2748 &msm_device_bam_dmux,
2749 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002750
2751#ifdef CONFIG_HW_RANDOM_MSM
2752 &msm_device_rng,
2753#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002754 &msm_rpm_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002755};
2756
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002757static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002758 &msm8960_device_otg,
2759 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 &msm_device_hsusb_host,
2761 &android_usb_device,
2762 &msm_device_vidc,
2763 &mipi_dsi_simulator_panel_device,
2764 &msm_bus_apps_fabric,
2765 &msm_bus_sys_fabric,
2766 &msm_bus_mm_fabric,
2767 &msm_bus_sys_fpb,
2768 &msm_bus_cpss_fpb,
2769 &msm_pcm,
2770 &msm_pcm_routing,
2771 &msm_cpudai0,
2772 &msm_cpudai1,
2773 &msm_cpudai_hdmi_rx,
2774 &msm_cpudai_bt_rx,
2775 &msm_cpudai_bt_tx,
2776 &msm_cpudai_fm_rx,
2777 &msm_cpudai_fm_tx,
2778 &msm_cpu_fe,
2779 &msm_stub_codec,
2780 &msm_voice,
2781 &msm_voip,
2782 &msm_lpa_pcm,
2783
2784#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2785 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2786 &qcrypto_device,
2787#endif
2788
2789#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2790 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2791 &qcedev_device,
2792#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002793};
2794
2795static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002796 &msm_kgsl_3d0,
2797 &msm_kgsl_2d0,
2798 &msm_kgsl_2d1,
2799 &mipi_dsi_renesas_panel_device,
2800#ifdef CONFIG_MSM_GEMINI
2801 &msm8960_gemini_device,
2802#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002803};
2804
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002805static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002806 &msm8960_device_otg,
2807 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002808 &msm_device_hsusb_host,
2809 &android_usb_device,
2810 &msm_pcm,
2811 &msm_pcm_routing,
2812 &msm_cpudai0,
2813 &msm_cpudai1,
2814 &msm_cpudai_hdmi_rx,
2815 &msm_cpudai_bt_rx,
2816 &msm_cpudai_bt_tx,
2817 &msm_cpudai_fm_rx,
2818 &msm_cpudai_fm_tx,
2819 &msm_cpu_fe,
2820 &msm_stub_codec,
2821 &msm_kgsl_3d0,
2822#ifdef CONFIG_MSM_KGSL_2D
2823 &msm_kgsl_2d0,
2824 &msm_kgsl_2d1,
2825#endif
2826 &mipi_dsi_toshiba_panel_device,
2827#ifdef CONFIG_MSM_GEMINI
2828 &msm8960_gemini_device,
2829#endif
2830 &msm_voice,
2831 &msm_voip,
2832 &msm_lpa_pcm,
2833#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2834 &hdmi_msm_device,
2835#endif
2836 &msm_pcm_hostless,
2837 &msm_bus_apps_fabric,
2838 &msm_bus_sys_fabric,
2839 &msm_bus_mm_fabric,
2840 &msm_bus_sys_fpb,
2841 &msm_bus_cpss_fpb,
2842};
2843
2844static void __init msm8960_i2c_init(void)
2845{
2846 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2847 &msm8960_i2c_qup_gsbi4_pdata;
2848
2849 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2850 &msm8960_i2c_qup_gsbi3_pdata;
2851
2852 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2853 &msm8960_i2c_qup_gsbi10_pdata;
2854
2855 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2856 &msm8960_i2c_qup_gsbi12_pdata;
2857}
2858
2859static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2860 .irq_base = PM8921_IRQ_BASE,
2861 .devirq = MSM_GPIO_TO_INT(104),
2862 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2863};
2864
2865static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2866 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2867};
2868
2869static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2870 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2871};
2872
2873static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2874 .rtc_write_enable = false,
2875};
2876
2877static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2878 .pull_up = 1,
2879 .kpd_trigger_delay_us = 970,
2880 .wakeup = 1,
2881};
2882
2883static const unsigned int keymap[] = {
2884 KEY(0, 0, KEY_VOLUMEUP),
2885 KEY(0, 1, KEY_VOLUMEDOWN),
2886 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2887 KEY(0, 3, KEY_CAMERA_FOCUS),
2888};
2889
2890static struct matrix_keymap_data keymap_data = {
2891 .keymap_size = ARRAY_SIZE(keymap),
2892 .keymap = keymap,
2893};
2894
2895static struct pm8xxx_keypad_platform_data keypad_data = {
2896 .input_name = "keypad_8960",
2897 .input_phys_device = "keypad_8960/input0",
2898 .num_rows = 1,
2899 .num_cols = 5,
2900 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2901 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2902 .debounce_ms = 15,
2903 .scan_delay_ms = 32,
2904 .row_hold_ns = 91500,
2905 .wakeup = 1,
2906 .keymap_data = &keymap_data,
2907};
2908
2909static const unsigned int keymap_sim[] = {
2910 KEY(0, 0, KEY_7),
2911 KEY(0, 1, KEY_DOWN),
2912 KEY(0, 2, KEY_UP),
2913 KEY(0, 3, KEY_RIGHT),
2914 KEY(0, 4, KEY_ENTER),
2915 KEY(0, 5, KEY_L),
2916 KEY(0, 6, KEY_BACK),
2917 KEY(0, 7, KEY_M),
2918
2919 KEY(1, 0, KEY_LEFT),
2920 KEY(1, 1, KEY_SEND),
2921 KEY(1, 2, KEY_1),
2922 KEY(1, 3, KEY_4),
2923 KEY(1, 4, KEY_CLEAR),
2924 KEY(1, 5, KEY_MSDOS),
2925 KEY(1, 6, KEY_SPACE),
2926 KEY(1, 7, KEY_COMMA),
2927
2928 KEY(2, 0, KEY_6),
2929 KEY(2, 1, KEY_5),
2930 KEY(2, 2, KEY_8),
2931 KEY(2, 3, KEY_3),
2932 KEY(2, 4, KEY_NUMERIC_STAR),
2933 KEY(2, 5, KEY_UP),
2934 KEY(2, 6, KEY_DOWN),
2935 KEY(2, 7, KEY_LEFTSHIFT),
2936
2937 KEY(3, 0, KEY_9),
2938 KEY(3, 1, KEY_NUMERIC_POUND),
2939 KEY(3, 2, KEY_0),
2940 KEY(3, 3, KEY_2),
2941 KEY(3, 4, KEY_SLEEP),
2942 KEY(3, 5, KEY_F1),
2943 KEY(3, 6, KEY_F2),
2944 KEY(3, 7, KEY_F3),
2945
2946 KEY(4, 0, KEY_BACK),
2947 KEY(4, 1, KEY_HOME),
2948 KEY(4, 2, KEY_MENU),
2949 KEY(4, 3, KEY_VOLUMEUP),
2950 KEY(4, 4, KEY_VOLUMEDOWN),
2951 KEY(4, 5, KEY_F4),
2952 KEY(4, 6, KEY_F5),
2953 KEY(4, 7, KEY_F6),
2954
2955 KEY(5, 0, KEY_R),
2956 KEY(5, 1, KEY_T),
2957 KEY(5, 2, KEY_Y),
2958 KEY(5, 3, KEY_LEFTALT),
2959 KEY(5, 4, KEY_KPENTER),
2960 KEY(5, 5, KEY_Q),
2961 KEY(5, 6, KEY_W),
2962 KEY(5, 7, KEY_E),
2963
2964 KEY(6, 0, KEY_F),
2965 KEY(6, 1, KEY_G),
2966 KEY(6, 2, KEY_H),
2967 KEY(6, 3, KEY_CAPSLOCK),
2968 KEY(6, 4, KEY_PAGEUP),
2969 KEY(6, 5, KEY_A),
2970 KEY(6, 6, KEY_S),
2971 KEY(6, 7, KEY_D),
2972
2973 KEY(7, 0, KEY_V),
2974 KEY(7, 1, KEY_B),
2975 KEY(7, 2, KEY_N),
2976 KEY(7, 3, KEY_MENU),
2977 KEY(7, 4, KEY_PAGEDOWN),
2978 KEY(7, 5, KEY_Z),
2979 KEY(7, 6, KEY_X),
2980 KEY(7, 7, KEY_C),
2981
2982 KEY(8, 0, KEY_P),
2983 KEY(8, 1, KEY_J),
2984 KEY(8, 2, KEY_K),
2985 KEY(8, 3, KEY_INSERT),
2986 KEY(8, 4, KEY_LINEFEED),
2987 KEY(8, 5, KEY_U),
2988 KEY(8, 6, KEY_I),
2989 KEY(8, 7, KEY_O),
2990
2991 KEY(9, 0, KEY_4),
2992 KEY(9, 1, KEY_5),
2993 KEY(9, 2, KEY_6),
2994 KEY(9, 3, KEY_7),
2995 KEY(9, 4, KEY_8),
2996 KEY(9, 5, KEY_1),
2997 KEY(9, 6, KEY_2),
2998 KEY(9, 7, KEY_3),
2999
3000 KEY(10, 0, KEY_F7),
3001 KEY(10, 1, KEY_F8),
3002 KEY(10, 2, KEY_F9),
3003 KEY(10, 3, KEY_F10),
3004 KEY(10, 4, KEY_FN),
3005 KEY(10, 5, KEY_9),
3006 KEY(10, 6, KEY_0),
3007 KEY(10, 7, KEY_DOT),
3008
3009 KEY(11, 0, KEY_LEFTCTRL),
3010 KEY(11, 1, KEY_F11),
3011 KEY(11, 2, KEY_ENTER),
3012 KEY(11, 3, KEY_SEARCH),
3013 KEY(11, 4, KEY_DELETE),
3014 KEY(11, 5, KEY_RIGHT),
3015 KEY(11, 6, KEY_LEFT),
3016 KEY(11, 7, KEY_RIGHTSHIFT),
3017 KEY(0, 0, KEY_VOLUMEUP),
3018 KEY(0, 1, KEY_VOLUMEDOWN),
3019 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3020 KEY(0, 3, KEY_CAMERA_FOCUS),
3021};
3022
3023static struct matrix_keymap_data keymap_data_sim = {
3024 .keymap_size = ARRAY_SIZE(keymap_sim),
3025 .keymap = keymap_sim,
3026};
3027
3028static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3029 .input_name = "keypad_8960",
3030 .input_phys_device = "keypad_8960/input0",
3031 .num_rows = 12,
3032 .num_cols = 8,
3033 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3034 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3035 .debounce_ms = 15,
3036 .scan_delay_ms = 32,
3037 .row_hold_ns = 91500,
3038 .wakeup = 1,
3039 .keymap_data = &keymap_data_sim,
3040};
3041
3042static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
3043 .safety_time = 180,
3044 .update_time = 1,
3045 .max_voltage = 4200,
3046 .min_voltage = 3200,
3047 .resume_voltage = 4100,
3048 .term_current = 100,
3049};
3050
3051static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3052 .priority = 0,
3053};
3054
3055static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3056 .r_sense = 10,
3057 .i_test = 2500,
3058 .v_failure = 3000,
3059 .calib_delay_ms = 600000,
3060 .batt_data = &palladium_1500_data,
3061};
3062
3063static struct led_info pm8921_led_info[] = {
3064 [0] = {
3065 .name = "led:drv1",
3066 .flags = PM8XXX_ID_LED_1,
3067 },
3068};
3069
3070static struct led_platform_data pm8xxx_leds_pdata = {
3071 .num_leds = ARRAY_SIZE(pm8921_led_info),
3072 .leds = pm8921_led_info,
3073};
3074
3075static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3076 .irq_pdata = &pm8xxx_irq_pdata,
3077 .gpio_pdata = &pm8xxx_gpio_pdata,
3078 .mpp_pdata = &pm8xxx_mpp_pdata,
3079 .rtc_pdata = &pm8xxx_rtc_pdata,
3080 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3081 .keypad_pdata = &keypad_data,
3082 .misc_pdata = &pm8xxx_misc_pdata,
3083 .regulator_pdatas = msm_pm8921_regulator_pdata,
3084 .charger_pdata = &pm8921_chg_pdata,
3085 .bms_pdata = &pm8921_bms_pdata,
3086 .adc_pdata = &pm8921_adc_pdata,
3087 .leds_pdata = &pm8xxx_leds_pdata,
3088};
3089
3090static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3091 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3092 .slave = {
3093 .name = "pm8921-core",
3094 .platform_data = &pm8921_platform_data,
3095 },
3096};
3097
3098static void msm8960_wcnss_init(void)
3099{
3100 int i, ret, j;
3101
3102 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3103 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3104 "wcnss_5_wire");
3105 if (ret) {
3106 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3107 wcnss_5wire_interface[i].gpio, ret);
3108 goto fail;
3109 }
3110 }
3111
3112 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3113
3114 return;
3115
3116fail:
3117 for (j = 0; j < i; j++)
3118 gpio_free(wcnss_5wire_interface[j].gpio);
3119}
3120
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003121#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003122static int ethernet_init(void)
3123{
3124 int ret;
3125 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3126 if (ret) {
3127 pr_err("ks8851 gpio_request failed: %d\n", ret);
3128 goto fail;
3129 }
3130
3131 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3132 if (ret) {
3133 pr_err("ks8851 gpio_request failed: %d\n", ret);
3134 goto fail_rst;
3135 }
3136
3137 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3138 if (ret) {
3139 pr_err("ks8851 gpio_request failed: %d\n", ret);
3140 goto fail_cs;
3141 }
3142
3143 gpio_direction_output(FPGA_CS_GPIO, 1);
3144 gpio_direction_output(KS8851_RST_GPIO, 1);
3145 return 0;
3146fail_cs:
3147 gpio_free(KS8851_RST_GPIO);
3148fail_rst:
3149 gpio_free(KS8851_IRQ_GPIO);
3150fail:
3151 return ret;
3152}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003153#else
3154static int ethernet_init(void)
3155{
3156 return 0;
3157}
3158#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003159
3160static struct msm_cpuidle_state msm_cstates[] __initdata = {
3161 {0, 0, "C0", "WFI",
3162 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3163
3164 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3165 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3166
3167 {0, 2, "C2", "POWER_COLLAPSE",
3168 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3169
3170 {1, 0, "C0", "WFI",
3171 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3172
3173 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3174 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3175};
3176
3177static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3178 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3179 .idle_supported = 1,
3180 .suspend_supported = 1,
3181 .idle_enabled = 0,
3182 .suspend_enabled = 0,
3183 .latency = 4000,
3184 .residency = 13000,
3185 },
3186
3187 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3188 .idle_supported = 1,
3189 .suspend_supported = 1,
3190 .idle_enabled = 0,
3191 .suspend_enabled = 0,
3192 .latency = 500,
3193 .residency = 6000,
3194 },
3195
3196 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3197 .idle_supported = 1,
3198 .suspend_supported = 1,
3199 .idle_enabled = 1,
3200 .suspend_enabled = 1,
3201 .latency = 2,
3202 .residency = 0,
3203 },
3204
3205 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3206 .idle_supported = 0,
3207 .suspend_supported = 1,
3208 .idle_enabled = 0,
3209 .suspend_enabled = 0,
3210 .latency = 600,
3211 .residency = 7200,
3212 },
3213
3214 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3215 .idle_supported = 1,
3216 .suspend_supported = 1,
3217 .idle_enabled = 0,
3218 .suspend_enabled = 0,
3219 .latency = 500,
3220 .residency = 6000,
3221 },
3222
3223 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3224 .idle_supported = 1,
3225 .suspend_supported = 0,
3226 .idle_enabled = 1,
3227 .suspend_enabled = 0,
3228 .latency = 2,
3229 .residency = 0,
3230 },
3231};
3232
3233static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3234 {
3235 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3236 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3237 true,
3238 1, 8000, 100000, 1,
3239 },
3240
3241 {
3242 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3243 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3244 true,
3245 1500, 5000, 60100000, 3000,
3246 },
3247
3248 {
3249 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3250 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3251 false,
3252 1800, 5000, 60350000, 3500,
3253 },
3254
3255 {
3256 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3257 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3258 false,
3259 2800, 2500, 65350000, 4800,
3260 },
3261
3262 {
3263 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3264 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3265 false,
3266 3800, 4500, 67850000, 5500,
3267 },
3268
3269 {
3270 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3271 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3272 false,
3273 4800, 2000, 71850000, 6800,
3274 },
3275
3276 {
3277 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3278 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3279 false,
3280 6800, 500, 75850000, 8800,
3281 },
3282
3283 {
3284 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3285 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3286 false,
3287 7800, 0, 76350000, 9800,
3288 },
3289};
3290
3291#ifdef CONFIG_I2C
3292#define I2C_SURF 1
3293#define I2C_FFA (1 << 1)
3294#define I2C_RUMI (1 << 2)
3295#define I2C_SIM (1 << 3)
3296#define I2C_FLUID (1 << 4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003297
3298struct i2c_registry {
3299 u8 machs;
3300 int bus;
3301 struct i2c_board_info *info;
3302 int len;
3303};
3304
3305#ifdef CONFIG_MSM_CAMERA
3306static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3307#ifdef CONFIG_IMX074
3308 {
3309 I2C_BOARD_INFO("imx074", 0x1A),
3310 },
3311#endif
3312#ifdef CONFIG_OV2720
3313 {
3314 I2C_BOARD_INFO("ov2720", 0x6C),
3315 },
3316#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003317 {
3318 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3319 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303320#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3321 {
3322 I2C_BOARD_INFO("sc628a", 0x6E),
3323 },
3324#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003325};
3326#endif
3327
3328/* Sensors DSPS platform data */
3329#ifdef CONFIG_MSM_DSPS
3330#define DSPS_PIL_GENERIC_NAME "dsps"
3331#endif /* CONFIG_MSM_DSPS */
3332
3333static void __init msm8960_init_dsps(void)
3334{
3335#ifdef CONFIG_MSM_DSPS
3336 struct msm_dsps_platform_data *pdata =
3337 msm_dsps_device.dev.platform_data;
3338 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3339 pdata->gpios = NULL;
3340 pdata->gpios_num = 0;
3341
3342 platform_device_register(&msm_dsps_device);
3343#endif /* CONFIG_MSM_DSPS */
3344}
3345
3346static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3347#ifdef CONFIG_MSM_CAMERA
3348 {
3349 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3350 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3351 msm_camera_boardinfo,
3352 ARRAY_SIZE(msm_camera_boardinfo),
3353 },
3354#endif
3355 {
3356 I2C_SURF | I2C_FFA | I2C_FLUID,
3357 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3358 cyttsp_info,
3359 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003360 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003361};
3362#endif /* CONFIG_I2C */
3363
3364static void __init register_i2c_devices(void)
3365{
3366#ifdef CONFIG_I2C
3367 u8 mach_mask = 0;
3368 int i;
3369
3370 /* Build the matching 'supported_machs' bitmask */
3371 if (machine_is_msm8960_cdp())
3372 mach_mask = I2C_SURF;
3373 else if (machine_is_msm8960_rumi3())
3374 mach_mask = I2C_RUMI;
3375 else if (machine_is_msm8960_sim())
3376 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003377 else if (machine_is_msm8960_fluid())
3378 mach_mask = I2C_FLUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003379 else if (machine_is_msm8960_mtp())
3380 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003381 else
3382 pr_err("unmatched machine ID in register_i2c_devices\n");
3383
3384 /* Run the array and install devices as appropriate */
3385 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3386 if (msm8960_i2c_devices[i].machs & mach_mask)
3387 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3388 msm8960_i2c_devices[i].info,
3389 msm8960_i2c_devices[i].len);
3390 }
3391#endif
3392}
3393
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003394static void __init msm8960_sim_init(void)
3395{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003396 if (socinfo_init() < 0)
3397 pr_err("socinfo_init() failed!\n");
3398
3399 BUG_ON(msm_rpm_init(&msm_rpm_data));
3400 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3401 ARRAY_SIZE(msm_rpmrs_levels)));
3402 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003403 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003404 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003405 msm8960_device_ssbi_pm8921.dev.platform_data =
3406 &msm8960_ssbi_pm8921_pdata;
3407 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003408
3409 /* Simulator supports a QWERTY keypad */
3410 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3411
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003412 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3413 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3414 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003415 gpiomux_init();
3416 ethernet_init();
3417 msm8960_i2c_init();
3418 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3419 msm_spm_l2_init(msm_spm_l2_data);
3420 msm8960_init_buses();
3421 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3422 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003423 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003424 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3425
3426 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3427 &msm8960_qup_spi_gsbi1_pdata;
3428 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3429
3430 msm8960_init_mmc();
3431 msm_fb_add_devices();
3432 slim_register_board_info(msm_slim_devices,
3433 ARRAY_SIZE(msm_slim_devices));
3434 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3435 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3436 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3437 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003438}
3439
3440static void __init msm8960_rumi3_init(void)
3441{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003442 if (socinfo_init() < 0)
3443 pr_err("socinfo_init() failed!\n");
3444
3445 BUG_ON(msm_rpm_init(&msm_rpm_data));
3446 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3447 ARRAY_SIZE(msm_rpmrs_levels)));
3448 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003449 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003450 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003451 gpiomux_init();
3452 ethernet_init();
3453 msm8960_device_ssbi_pm8921.dev.platform_data =
3454 &msm8960_ssbi_pm8921_pdata;
3455 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3456 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3457 &msm8960_qup_spi_gsbi1_pdata;
3458 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3459 msm8960_i2c_init();
3460 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3461 msm_spm_l2_init(msm_spm_l2_data);
3462 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3463 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003464 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003465 msm8960_init_mmc();
3466
3467 register_i2c_devices();
3468 msm_fb_add_devices();
3469 slim_register_board_info(msm_slim_devices,
3470 ARRAY_SIZE(msm_slim_devices));
3471 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3472 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3473 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3474 msm_pm_data);
3475}
3476
3477static void __init msm8960_cdp_init(void)
3478{
3479 if (socinfo_init() < 0)
3480 pr_err("socinfo_init() failed!\n");
3481
3482 BUG_ON(msm_rpm_init(&msm_rpm_data));
3483 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3484 ARRAY_SIZE(msm_rpmrs_levels)));
3485 regulator_suppress_info_printing();
3486 if (msm_xo_init())
3487 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003488 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003489 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003490 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3491 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3492 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003493 gpiomux_init();
3494 ethernet_init();
3495 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3496 &msm8960_qup_spi_gsbi1_pdata;
3497 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3498 msm8960_device_ssbi_pm8921.dev.platform_data =
3499 &msm8960_ssbi_pm8921_pdata;
3500 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3501 msm8960_i2c_init();
3502 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3503 msm_spm_l2_init(msm_spm_l2_data);
3504 msm8960_init_buses();
3505 platform_add_devices(msm_footswitch_devices,
3506 msm_num_footswitch_devices);
3507 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3508 pm8921_gpio_mpp_init();
3509 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3510 msm8960_init_cam();
3511 msm8960_init_mmc();
3512 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3513 register_i2c_devices();
3514 msm8960_wcnss_init();
3515 msm_fb_add_devices();
3516 slim_register_board_info(msm_slim_devices,
3517 ARRAY_SIZE(msm_slim_devices));
3518 msm8960_init_dsps();
3519 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3520 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3521 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3522 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003523 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003524}
3525
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003526MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3527 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003528 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003529 .init_irq = msm8960_init_irq,
3530 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003531 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003532 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003533MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003534
3535MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3536 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003537 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003538 .init_irq = msm8960_init_irq,
3539 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003540 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003541 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003542MACHINE_END
3543
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003544MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3545 .map_io = msm8960_map_io,
3546 .reserve = msm8960_reserve,
3547 .init_irq = msm8960_init_irq,
3548 .timer = &msm_timer,
3549 .init_machine = msm8960_cdp_init,
3550 .init_early = msm8960_allocate_memory_regions,
3551MACHINE_END
3552
3553MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3554 .map_io = msm8960_map_io,
3555 .reserve = msm8960_reserve,
3556 .init_irq = msm8960_init_irq,
3557 .timer = &msm_timer,
3558 .init_machine = msm8960_cdp_init,
3559 .init_early = msm8960_allocate_memory_regions,
3560MACHINE_END
3561
3562MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3563 .map_io = msm8960_map_io,
3564 .reserve = msm8960_reserve,
3565 .init_irq = msm8960_init_irq,
3566 .timer = &msm_timer,
3567 .init_machine = msm8960_cdp_init,
3568 .init_early = msm8960_allocate_memory_regions,
3569MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003570
3571MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3572 .map_io = msm8960_map_io,
3573 .reserve = msm8960_reserve,
3574 .init_irq = msm8960_init_irq,
3575 .timer = &msm_timer,
3576 .init_machine = msm8960_cdp_init,
3577 .init_early = msm8960_allocate_memory_regions,
3578MACHINE_END