blob: 058bc47b857878a062a69de5b8b44f45223e23f2 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070045#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <mach/msm_spi.h>
52#ifdef CONFIG_USB_MSM_OTG_72K
53#include <mach/msm_hsusb.h>
54#else
55#include <linux/usb/msm_hsusb.h>
56#endif
57#include <linux/usb/android.h>
58#include <mach/usbdiag.h>
59#include <mach/socinfo.h>
60#include <mach/rpm.h>
61#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070062#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#include <mach/msm_bus_board.h>
64#include <mach/msm_memtypes.h>
65#include <mach/dma.h>
66#include <mach/msm_dsps.h>
67#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070068#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
Laura Abbottd6183792011-08-19 13:42:24 -070076#include <linux/ion.h>
77#include <mach/ion.h>
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080080#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "spm.h"
83#include "board-msm8960.h"
84#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070088#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070089#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070090#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091
92static struct platform_device msm_fm_platform_init = {
93 .name = "iris_fm",
94 .id = -1,
95};
96
97struct pm8xxx_gpio_init {
98 unsigned gpio;
99 struct pm_gpio config;
100};
101
102struct pm8xxx_mpp_init {
103 unsigned mpp;
104 struct pm8xxx_mpp_config_data config;
105};
106
107#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
108 _func, _inv, _disable) \
109{ \
110 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
111 .config = { \
112 .direction = _dir, \
113 .output_buffer = _buf, \
114 .output_value = _val, \
115 .pull = _pull, \
116 .vin_sel = _vin, \
117 .out_strength = _out_strength, \
118 .function = _func, \
119 .inv_int_pol = _inv, \
120 .disable_pin = _disable, \
121 } \
122}
123
124#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
125{ \
126 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
127 .config = { \
128 .type = PM8XXX_MPP_TYPE_##_type, \
129 .level = _level, \
130 .control = PM8XXX_MPP_##_control, \
131 } \
132}
133
134#define PM8XXX_GPIO_DISABLE(_gpio) \
135 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
136 0, 0, 0, 1)
137
138#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
139 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
140 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
141 PM_GPIO_STRENGTH_HIGH, \
142 PM_GPIO_FUNC_NORMAL, 0, 0)
143
144#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
145 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
146 _pull, PM_GPIO_VIN_S4, \
147 PM_GPIO_STRENGTH_NO, \
148 PM_GPIO_FUNC_NORMAL, 0, 0)
149
150#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
151 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
152 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
153 PM_GPIO_STRENGTH_HIGH, \
154 _func, 0, 0)
155
156/* Initial PM8921 GPIO configurations */
157static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
158 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
159 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
160 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300161 /* External regulator shared by display and touchscreen on LiQUID */
162 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
163 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700165 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700167 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168};
169
170/* Initial PM8921 MPP configurations */
171static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
172 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
173 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
175 DOUT_CTRL_LOW),
176};
177
178static void __init pm8921_gpio_mpp_init(void)
179{
180 int i, rc;
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
183 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
184 &pm8921_gpios[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
192 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
193 &pm8921_mpps[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199}
200
201#define FPGA_CS_GPIO 14
202#define KS8851_RST_GPIO 89
203#define KS8851_IRQ_GPIO 90
204
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
206enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700207 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700208 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
209 /* CAM Expander */
210 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
211 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
212 GPIO_CAM_GP_AFBUSY,
213 GPIO_CAM_GP_STROBE_CE,
214 GPIO_CAM_GP_CAM1MP_XCLR,
215 GPIO_CAM_GP_CAMIF_RESET_N,
216 GPIO_CAM_GP_XMT_FLASH_INT,
217 GPIO_CAM_GP_LED_EN1,
218 GPIO_CAM_GP_LED_EN2,
219
220};
221#endif
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223/* The SPI configurations apply to GSBI 1*/
224static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225 .func = GPIOMUX_FUNC_1,
226 .drv = GPIOMUX_DRV_8MA,
227 .pull = GPIOMUX_PULL_NONE,
228};
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230static struct gpiomux_setting spi_suspended_config = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_DOWN,
234};
235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236static struct gpiomux_setting gsbi3 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242static 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
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700266static struct gpiomux_setting audio_auxpcm[] = {
267 /* Suspended state */
268 {
269 .func = GPIOMUX_FUNC_GPIO,
270 .drv = GPIOMUX_DRV_2MA,
271 .pull = GPIOMUX_PULL_NONE,
272 },
273 /* Active state */
274 {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_2MA,
277 .pull = GPIOMUX_PULL_NONE,
278 },
279};
280
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700281#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282static struct gpiomux_setting gpio_eth_config = {
283 .pull = GPIOMUX_PULL_NONE,
284 .drv = GPIOMUX_DRV_8MA,
285 .func = GPIOMUX_FUNC_GPIO,
286};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700287#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288
289static struct gpiomux_setting slimbus = {
290 .func = GPIOMUX_FUNC_1,
291 .drv = GPIOMUX_DRV_8MA,
292 .pull = GPIOMUX_PULL_KEEPER,
293};
294
295struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700296#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700297 {
298 .gpio = KS8851_IRQ_GPIO,
299 .settings = {
300 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
301 }
302 },
303 {
304 .gpio = KS8851_RST_GPIO,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
307 }
308 },
309 {
310 .gpio = FPGA_CS_GPIO,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
313 }
314 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700315#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316};
317
318static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
319 {
320 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
321 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600322 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
323 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 },
325 },
326 {
327 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
328 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600329 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
330 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331 },
332 },
333 {
334 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
335 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600336 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
337 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700338 },
339 },
340 {
341 .gpio = 9, /* GSBI1 QUP SPI_CLK */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 16, /* GSBI3 I2C QUP SDA */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gsbi3,
351 },
352 },
353 {
354 .gpio = 17, /* GSBI3 I2C QUP SCL */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gsbi3,
357 },
358 },
359 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700360 .gpio = 22, /* GSBI5 UART2 */
361 .settings = {
362 [GPIOMUX_SUSPENDED] = &gsbi5,
363 },
364 },
365 {
366 .gpio = 23, /* GSBI5 UART2 */
367 .settings = {
368 [GPIOMUX_SUSPENDED] = &gsbi5,
369 },
370 },
371 {
372 .gpio = 24, /* GSBI5 UART2 */
373 .settings = {
374 [GPIOMUX_SUSPENDED] = &gsbi5,
375 },
376 },
377 {
378 .gpio = 25, /* GSBI5 UART2 */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi5,
381 },
382 },
383 {
384 .gpio = 44, /* GSBI12 I2C QUP SDA */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi12,
387 },
388 },
389 {
390 .gpio = 45, /* GSBI12 I2C QUP SCL */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi12,
393 },
394 },
395 {
396 .gpio = 73, /* GSBI10 I2C QUP SDA */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi10,
399 },
400 },
401 {
402 .gpio = 74, /* GSBI10 I2C QUP SCL */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi10,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
410 {
411 .gpio = 60, /* slimbus data */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &slimbus,
414 },
415 },
416 {
417 .gpio = 61, /* slimbus clk */
418 .settings = {
419 [GPIOMUX_SUSPENDED] = &slimbus,
420 },
421 },
422};
423
424static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
425 {
426 .gpio = 59,
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &cdc_mclk,
429 },
430 },
431};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700432
433static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
434 {
435 .gpio = 63,
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
438 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
439 },
440 },
441 {
442 .gpio = 64,
443 .settings = {
444 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
445 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
446 },
447 },
448 {
449 .gpio = 65,
450 .settings = {
451 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
452 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
453 },
454 },
455 {
456 .gpio = 66,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
459 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
460 },
461 },
462};
463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
465 .func = GPIOMUX_FUNC_GPIO,
466 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700467 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700468};
469
470static struct gpiomux_setting wcnss_5wire_active_cfg = {
471 .func = GPIOMUX_FUNC_1,
472 .drv = GPIOMUX_DRV_6MA,
473 .pull = GPIOMUX_PULL_DOWN,
474};
475
476static struct msm_gpiomux_config wcnss_5wire_interface[] = {
477 {
478 .gpio = 84,
479 .settings = {
480 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
481 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
482 },
483 },
484 {
485 .gpio = 85,
486 .settings = {
487 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
488 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
489 },
490 },
491 {
492 .gpio = 86,
493 .settings = {
494 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
495 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
496 },
497 },
498 {
499 .gpio = 87,
500 .settings = {
501 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
502 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
503 },
504 },
505 {
506 .gpio = 88,
507 .settings = {
508 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
509 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
510 },
511 },
512};
Nishant Pandit24153d82011-08-27 16:05:13 +0530513static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530514 {
515 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
516 .drv = GPIOMUX_DRV_2MA,
517 .pull = GPIOMUX_PULL_DOWN,
518 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519
Nishant Pandit474f2252011-07-23 23:17:56 +0530520 {
521 .func = GPIOMUX_FUNC_1, /*active 1*/
522 .drv = GPIOMUX_DRV_2MA,
523 .pull = GPIOMUX_PULL_NONE,
524 },
525
526 {
527 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
528 .drv = GPIOMUX_DRV_2MA,
529 .pull = GPIOMUX_PULL_NONE,
530 },
531
532 {
533 .func = GPIOMUX_FUNC_1, /*active 3*/
534 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700535 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530536 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530537
538 {
539 .func = GPIOMUX_FUNC_5, /*active 4*/
540 .drv = GPIOMUX_DRV_8MA,
541 .pull = GPIOMUX_PULL_UP,
542 },
543
544 {
545 .func = GPIOMUX_FUNC_6, /*active 5*/
546 .drv = GPIOMUX_DRV_8MA,
547 .pull = GPIOMUX_PULL_UP,
548 },
549
550 {
551 .func = GPIOMUX_FUNC_2, /*active 6*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_UP,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_3, /*active 7*/
558 .drv = GPIOMUX_DRV_8MA,
559 .pull = GPIOMUX_PULL_UP,
560 },
561
Kevin Chan4c58d292011-09-13 11:03:25 -0700562 {
563 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
564 .drv = GPIOMUX_DRV_2MA,
565 .pull = GPIOMUX_PULL_KEEPER,
566 },
567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568};
569
Nishant Pandit24153d82011-08-27 16:05:13 +0530570static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700571 {
572 .gpio = 2,
573 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530574 [GPIOMUX_ACTIVE] = &cam_settings[2],
575 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 },
577 },
578 {
579 .gpio = 3,
580 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530581 [GPIOMUX_ACTIVE] = &cam_settings[1],
582 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700583 },
584 },
585 {
586 .gpio = 4,
587 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530588 [GPIOMUX_ACTIVE] = &cam_settings[1],
589 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700590 },
591 },
592 {
593 .gpio = 5,
594 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530595 [GPIOMUX_ACTIVE] = &cam_settings[1],
596 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597 },
598 },
599 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530600 .gpio = 76,
601 .settings = {
602 [GPIOMUX_ACTIVE] = &cam_settings[2],
603 [GPIOMUX_SUSPENDED] = &cam_settings[0],
604 },
605 },
606 {
607 .gpio = 107,
608 .settings = {
609 [GPIOMUX_ACTIVE] = &cam_settings[2],
610 [GPIOMUX_SUSPENDED] = &cam_settings[0],
611 },
612 },
613};
614
615static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
616 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617 .gpio = 18,
618 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530619 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700620 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700621 },
622 },
623 {
624 .gpio = 19,
625 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530626 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700627 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700628 },
629 },
630 {
631 .gpio = 20,
632 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530633 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700634 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635 },
636 },
637 {
638 .gpio = 21,
639 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530640 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700641 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642 },
643 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644};
645
646static struct gpiomux_setting cyts_resout_sus_cfg = {
647 .func = GPIOMUX_FUNC_GPIO,
648 .drv = GPIOMUX_DRV_6MA,
649 .pull = GPIOMUX_PULL_UP,
650};
651
652static struct gpiomux_setting cyts_resout_act_cfg = {
653 .func = GPIOMUX_FUNC_GPIO,
654 .drv = GPIOMUX_DRV_6MA,
655 .pull = GPIOMUX_PULL_UP,
656};
657
658static struct gpiomux_setting cyts_sleep_sus_cfg = {
659 .func = GPIOMUX_FUNC_GPIO,
660 .drv = GPIOMUX_DRV_6MA,
661 .pull = GPIOMUX_PULL_DOWN,
662};
663
664static struct gpiomux_setting cyts_sleep_act_cfg = {
665 .func = GPIOMUX_FUNC_GPIO,
666 .drv = GPIOMUX_DRV_6MA,
667 .pull = GPIOMUX_PULL_DOWN,
668};
669
670static struct gpiomux_setting cyts_int_act_cfg = {
671 .func = GPIOMUX_FUNC_GPIO,
672 .drv = GPIOMUX_DRV_8MA,
673 .pull = GPIOMUX_PULL_UP,
674};
675
676static struct gpiomux_setting cyts_int_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530679 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680};
681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
683 { /* TS INTERRUPT */
684 .gpio = 11,
685 .settings = {
686 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
687 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
688 },
689 },
690 { /* TS SLEEP */
691 .gpio = 50,
692 .settings = {
693 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
694 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
695 },
696 },
697 { /* TS RESOUT */
698 .gpio = 52,
699 .settings = {
700 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
701 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
702 },
703 },
704};
705
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700706#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
707enum {
708 SX150X_CAM,
709};
710
Nishant Pandit474f2252011-07-23 23:17:56 +0530711static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700712 [SX150X_CAM] = {
713 .gpio_base = GPIO_CAM_EXPANDER_BASE,
714 .oscio_is_gpo = false,
715 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530716 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700717 .io_open_drain_ena = 0x0,
718 .irq_summary = -1,
719 },
720};
Nishant Pandit474f2252011-07-23 23:17:56 +0530721
722#endif
723
724#ifdef CONFIG_I2C
725
726#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
727#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300728#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530729
730#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
731
732static struct i2c_board_info cam_expander_i2c_info[] = {
733 {
734 I2C_BOARD_INFO("sx1508q", 0x22),
735 .platform_data = &sx150x_data[SX150X_CAM]
736 },
737};
738
739static struct msm_cam_expander_info cam_expander_info[] = {
740 {
741 cam_expander_i2c_info,
742 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
743 },
744};
745#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700746#endif
747
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700748#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
749#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700750#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700751#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
752#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
753#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700755#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700756#define MSM_ION_EBI_SIZE SZ_8M
757
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700758#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
759static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
760static int __init pmem_kernel_ebi1_size_setup(char *p)
761{
762 pmem_kernel_ebi1_size = memparse(p, NULL);
763 return 0;
764}
765early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
766#endif
767
768#ifdef CONFIG_ANDROID_PMEM
769static unsigned pmem_size = MSM_PMEM_SIZE;
770static int __init pmem_size_setup(char *p)
771{
772 pmem_size = memparse(p, NULL);
773 return 0;
774}
775early_param("pmem_size", pmem_size_setup);
776
777static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
778
779static int __init pmem_adsp_size_setup(char *p)
780{
781 pmem_adsp_size = memparse(p, NULL);
782 return 0;
783}
784early_param("pmem_adsp_size", pmem_adsp_size_setup);
785
786static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
787
788static int __init pmem_audio_size_setup(char *p)
789{
790 pmem_audio_size = memparse(p, NULL);
791 return 0;
792}
793early_param("pmem_audio_size", pmem_audio_size_setup);
794#endif
795
796#ifdef CONFIG_ANDROID_PMEM
797static struct android_pmem_platform_data android_pmem_pdata = {
798 .name = "pmem",
799 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
800 .cached = 1,
801 .memory_type = MEMTYPE_EBI1,
802};
803
804static struct platform_device android_pmem_device = {
805 .name = "android_pmem",
806 .id = 0,
807 .dev = {.platform_data = &android_pmem_pdata},
808};
809
810static struct android_pmem_platform_data android_pmem_adsp_pdata = {
811 .name = "pmem_adsp",
812 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
813 .cached = 0,
814 .memory_type = MEMTYPE_EBI1,
815};
816static struct platform_device android_pmem_adsp_device = {
817 .name = "android_pmem",
818 .id = 2,
819 .dev = { .platform_data = &android_pmem_adsp_pdata },
820};
821
822static struct android_pmem_platform_data android_pmem_audio_pdata = {
823 .name = "pmem_audio",
824 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
825 .cached = 0,
826 .memory_type = MEMTYPE_EBI1,
827};
828
829static struct platform_device android_pmem_audio_device = {
830 .name = "android_pmem",
831 .id = 4,
832 .dev = { .platform_data = &android_pmem_audio_pdata },
833};
834#endif
835
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700836#define DSP_RAM_BASE_8960 0x8da00000
837#define DSP_RAM_SIZE_8960 0x1800000
838static int dspcrashd_pdata_8960 = 0xDEADDEAD;
839
840static struct resource resources_dspcrashd_8960[] = {
841 {
842 .name = "msm_dspcrashd",
843 .start = DSP_RAM_BASE_8960,
844 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
845 .flags = IORESOURCE_DMA,
846 },
847};
848
849struct platform_device msm_device_dspcrashd_8960 = {
850 .name = "msm_dspcrashd",
851 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
852 .resource = resources_dspcrashd_8960,
853 .dev = { .platform_data = &dspcrashd_pdata_8960 },
854};
855
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700856static struct memtype_reserve msm8960_reserve_table[] __initdata = {
857 [MEMTYPE_SMI] = {
858 },
859 [MEMTYPE_EBI0] = {
860 .flags = MEMTYPE_FLAGS_1M_ALIGN,
861 },
862 [MEMTYPE_EBI1] = {
863 .flags = MEMTYPE_FLAGS_1M_ALIGN,
864 },
865};
866
867static void __init size_pmem_devices(void)
868{
869#ifdef CONFIG_ANDROID_PMEM
870 android_pmem_adsp_pdata.size = pmem_adsp_size;
871 android_pmem_pdata.size = pmem_size;
872 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
873#endif
874}
875
876static void __init reserve_memory_for(struct android_pmem_platform_data *p)
877{
878 msm8960_reserve_table[p->memory_type].size += p->size;
879}
880
881static void __init reserve_pmem_memory(void)
882{
883#ifdef CONFIG_ANDROID_PMEM
884 reserve_memory_for(&android_pmem_adsp_pdata);
885 reserve_memory_for(&android_pmem_pdata);
886 reserve_memory_for(&android_pmem_audio_pdata);
887 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
888#endif
889}
890
Larry Basselb4126da2011-07-18 14:31:33 -0700891static int msm8960_paddr_to_memtype(unsigned int paddr)
892{
893 return MEMTYPE_EBI1;
894}
895
Laura Abbottd6183792011-08-19 13:42:24 -0700896#ifdef CONFIG_ION_MSM
897struct ion_platform_data ion_pdata = {
898 .nr = 3,
899 .heaps = {
900 {
901 .id = ION_HEAP_SYSTEM_ID,
902 .type = ION_HEAP_TYPE_SYSTEM,
903 .name = ION_KMALLOC_HEAP_NAME,
904 },
905 {
906 .id = ION_HEAP_SYSTEM_CONTIG_ID,
907 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
908 .name = ION_VMALLOC_HEAP_NAME,
909 },
910 {
911 .id = ION_HEAP_EBI_ID,
912 .type = ION_HEAP_TYPE_CARVEOUT,
913 .name = ION_EBI1_HEAP_NAME,
914 .size = MSM_ION_EBI_SIZE,
915 .memory_type = ION_EBI_TYPE,
916 },
917 }
918};
919
920struct platform_device ion_dev = {
921 .name = "ion-msm",
922 .id = 1,
923 .dev = { .platform_data = &ion_pdata },
924};
925#endif
926
927static void reserve_ion_memory(void)
928{
929#ifdef CONFIG_ION_MSM
930 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
931#endif
932}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700933static void __init msm8960_calculate_reserve_sizes(void)
934{
935 size_pmem_devices();
936 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700937 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700938}
939
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700940static struct reserve_info msm8960_reserve_info __initdata = {
941 .memtype_reserve_table = msm8960_reserve_table,
942 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
943 .paddr_to_memtype = msm8960_paddr_to_memtype,
944};
945
Larry Basselb4126da2011-07-18 14:31:33 -0700946static int msm8960_memory_bank_size(void)
947{
948 return 1<<29;
949}
950
951static void __init locate_unstable_memory(void)
952{
953 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
954 unsigned long bank_size;
955 unsigned long low, high;
956
957 bank_size = msm8960_memory_bank_size();
958 low = meminfo.bank[0].start;
959 high = mb->start + mb->size;
960 low &= ~(bank_size - 1);
961
962 if (high - low <= bank_size)
963 return;
964 msm8960_reserve_info.low_unstable_address = low + bank_size;
965 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
966 msm8960_reserve_info.bank_size = bank_size;
967 pr_info("low unstable address %lx max size %lx bank size %lx\n",
968 msm8960_reserve_info.low_unstable_address,
969 msm8960_reserve_info.max_unstable_size,
970 msm8960_reserve_info.bank_size);
971}
972
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700973static void __init msm8960_reserve(void)
974{
975 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700976 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700977 msm_reserve();
978}
979
Larry Bassela4414b12011-08-04 11:11:02 -0700980static int msm8960_change_memory_power(u64 start, u64 size,
981 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700982{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700983 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700984}
985
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986#ifdef CONFIG_MSM_CAMERA
987
Nishant Pandit24153d82011-08-27 16:05:13 +0530988static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700989 5, /*CAMIF_MCLK*/
990 20, /*CAMIF_I2C_DATA*/
991 21, /*CAMIF_I2C_CLK*/
992};
993
Nishant Pandit24153d82011-08-27 16:05:13 +0530994static struct msm_camera_gpio_conf gpio_conf = {
995 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
996 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
997 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
998 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
999};
1000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001001#define VFE_CAMIF_TIMER1_GPIO 2
1002#define VFE_CAMIF_TIMER2_GPIO 3
1003#define VFE_CAMIF_TIMER3_GPIO_INT 4
1004struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1005 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1006 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1007 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1008 .flash_recharge_duration = 50000,
1009 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1010};
1011
Nishant Pandit474f2252011-07-23 23:17:56 +05301012#ifdef CONFIG_MSM_CAMERA_FLASH
1013static struct msm_camera_sensor_flash_src msm_flash_src = {
1014 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1015 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1016 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1017#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1018 defined(CONFIG_GPIO_SX150X_MODULE))
1019 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1020#endif
1021};
1022#endif
1023
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001024static struct msm_bus_vectors cam_init_vectors[] = {
1025 {
1026 .src = MSM_BUS_MASTER_VFE,
1027 .dst = MSM_BUS_SLAVE_EBI_CH0,
1028 .ab = 0,
1029 .ib = 0,
1030 },
1031 {
1032 .src = MSM_BUS_MASTER_VPE,
1033 .dst = MSM_BUS_SLAVE_EBI_CH0,
1034 .ab = 0,
1035 .ib = 0,
1036 },
1037 {
1038 .src = MSM_BUS_MASTER_JPEG_ENC,
1039 .dst = MSM_BUS_SLAVE_EBI_CH0,
1040 .ab = 0,
1041 .ib = 0,
1042 },
1043};
1044
1045static struct msm_bus_vectors cam_preview_vectors[] = {
1046 {
1047 .src = MSM_BUS_MASTER_VFE,
1048 .dst = MSM_BUS_SLAVE_EBI_CH0,
1049 .ab = 27648000,
1050 .ib = 110592000,
1051 },
1052 {
1053 .src = MSM_BUS_MASTER_VPE,
1054 .dst = MSM_BUS_SLAVE_EBI_CH0,
1055 .ab = 0,
1056 .ib = 0,
1057 },
1058 {
1059 .src = MSM_BUS_MASTER_JPEG_ENC,
1060 .dst = MSM_BUS_SLAVE_EBI_CH0,
1061 .ab = 0,
1062 .ib = 0,
1063 },
1064};
1065
1066static struct msm_bus_vectors cam_video_vectors[] = {
1067 {
1068 .src = MSM_BUS_MASTER_VFE,
1069 .dst = MSM_BUS_SLAVE_EBI_CH0,
1070 .ab = 140451840,
1071 .ib = 561807360,
1072 },
1073 {
1074 .src = MSM_BUS_MASTER_VPE,
1075 .dst = MSM_BUS_SLAVE_EBI_CH0,
1076 .ab = 206807040,
1077 .ib = 488816640,
1078 },
1079 {
1080 .src = MSM_BUS_MASTER_JPEG_ENC,
1081 .dst = MSM_BUS_SLAVE_EBI_CH0,
1082 .ab = 0,
1083 .ib = 0,
1084 },
1085};
1086
1087static struct msm_bus_vectors cam_snapshot_vectors[] = {
1088 {
1089 .src = MSM_BUS_MASTER_VFE,
1090 .dst = MSM_BUS_SLAVE_EBI_CH0,
1091 .ab = 274423680,
1092 .ib = 1097694720,
1093 },
1094 {
1095 .src = MSM_BUS_MASTER_VPE,
1096 .dst = MSM_BUS_SLAVE_EBI_CH0,
1097 .ab = 0,
1098 .ib = 0,
1099 },
1100 {
1101 .src = MSM_BUS_MASTER_JPEG_ENC,
1102 .dst = MSM_BUS_SLAVE_EBI_CH0,
1103 .ab = 540000000,
1104 .ib = 1350000000,
1105 },
1106};
1107
1108static struct msm_bus_vectors cam_zsl_vectors[] = {
1109 {
1110 .src = MSM_BUS_MASTER_VFE,
1111 .dst = MSM_BUS_SLAVE_EBI_CH0,
1112 .ab = 302071680,
1113 .ib = 1208286720,
1114 },
1115 {
1116 .src = MSM_BUS_MASTER_VPE,
1117 .dst = MSM_BUS_SLAVE_EBI_CH0,
1118 .ab = 0,
1119 .ib = 0,
1120 },
1121 {
1122 .src = MSM_BUS_MASTER_JPEG_ENC,
1123 .dst = MSM_BUS_SLAVE_EBI_CH0,
1124 .ab = 540000000,
1125 .ib = 1350000000,
1126 },
1127};
1128
1129static struct msm_bus_paths cam_bus_client_config[] = {
1130 {
1131 ARRAY_SIZE(cam_init_vectors),
1132 cam_init_vectors,
1133 },
1134 {
1135 ARRAY_SIZE(cam_preview_vectors),
1136 cam_preview_vectors,
1137 },
1138 {
1139 ARRAY_SIZE(cam_video_vectors),
1140 cam_video_vectors,
1141 },
1142 {
1143 ARRAY_SIZE(cam_snapshot_vectors),
1144 cam_snapshot_vectors,
1145 },
1146 {
1147 ARRAY_SIZE(cam_zsl_vectors),
1148 cam_zsl_vectors,
1149 },
1150};
1151
1152static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1153 cam_bus_client_config,
1154 ARRAY_SIZE(cam_bus_client_config),
1155 .name = "msm_camera",
1156};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001157
Nishant Pandit24153d82011-08-27 16:05:13 +05301158struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1159 {
1160 .ioclk.mclk_clk_rate = 24000000,
1161 .ioclk.vfe_clk_rate = 228570000,
1162 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001163 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301164 },
1165 {
1166 .ioclk.mclk_clk_rate = 24000000,
1167 .ioclk.vfe_clk_rate = 228570000,
1168 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001169 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301170 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001171};
1172
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001173#ifdef CONFIG_IMX074_ACT
1174static struct i2c_board_info imx074_actuator_i2c_info = {
1175 I2C_BOARD_INFO("imx074_act", 0x11),
1176};
1177
1178static struct msm_actuator_info imx074_actuator_info = {
1179 .board_info = &imx074_actuator_i2c_info,
1180 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1181 .vcm_pwd = 0,
1182 .vcm_enable = 1,
1183};
1184#endif
1185
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001186#ifdef CONFIG_IMX074
1187static struct msm_camera_sensor_flash_data flash_imx074 = {
1188 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301189#ifdef CONFIG_MSM_CAMERA_FLASH
1190 .flash_src = &msm_flash_src
1191#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001192};
1193
Nishant Pandit24153d82011-08-27 16:05:13 +05301194static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1195 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001196 .sensor_reset = 107,
1197 .sensor_pwd = 85,
1198 .vcm_pwd = 0,
1199 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301200};
1201
1202static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1203 .sensor_name = "imx074",
1204 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001205 .flash_data = &flash_imx074,
1206 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301207 .sensor_platform_info = &sensor_board_info_imx074,
1208 .gpio_conf = &gpio_conf,
1209 .csi_if = 1,
1210 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001211#ifdef CONFIG_IMX074_ACT
1212 .actuator_info = &imx074_actuator_info
1213#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001214};
1215
1216struct platform_device msm8960_camera_sensor_imx074 = {
1217 .name = "msm_camera_imx074",
1218 .dev = {
1219 .platform_data = &msm_camera_sensor_imx074_data,
1220 },
1221};
1222#endif
1223#ifdef CONFIG_OV2720
1224static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001225 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001226};
1227
Nishant Pandit24153d82011-08-27 16:05:13 +05301228static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1229 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001230 .sensor_reset = 76,
1231 .sensor_pwd = 85,
1232 .vcm_pwd = 0,
1233 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301234};
1235
1236static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1237 .sensor_name = "ov2720",
1238 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001239 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301240 .sensor_platform_info = &sensor_board_info_ov2720,
1241 .gpio_conf = &gpio_conf,
1242 .csi_if = 1,
1243 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001244};
1245
1246struct platform_device msm8960_camera_sensor_ov2720 = {
1247 .name = "msm_camera_ov2720",
1248 .dev = {
1249 .platform_data = &msm_camera_sensor_ov2720_data,
1250 },
1251};
1252#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001253
1254static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1255 .flash_type = MSM_CAMERA_FLASH_LED,
1256};
1257
Nishant Pandit24153d82011-08-27 16:05:13 +05301258static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1259 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001260 .sensor_reset = 107,
1261 .sensor_pwd = 85,
1262 .vcm_pwd = 0,
1263 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301264};
1265
1266static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1267 .sensor_name = "qs_mt9p017",
1268 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001269 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301270 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1271 .gpio_conf = &gpio_conf,
1272 .csi_if = 1,
1273 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001274};
1275
1276struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1277 .name = "msm_camera_qs_mt9p017",
1278 .dev = {
1279 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1280 },
1281};
1282
Kevin Chan8b0d2322011-09-10 21:06:31 -07001283static struct msm8960_privacy_light_cfg privacy_light_info = {
1284 .mpp = PM8921_MPP_PM_TO_SYS(12),
1285};
1286
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001287static void __init msm8960_init_cam(void)
1288{
1289 int i;
1290 struct platform_device *cam_dev[] = {
1291 &msm8960_camera_sensor_imx074,
1292 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001293 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001294 };
1295
Kevin Chan8b0d2322011-09-10 21:06:31 -07001296 if (machine_is_msm8960_liquid()) {
1297 struct msm_camera_sensor_info *s_info;
1298 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1299 s_info->sensor_platform_info->mount_angle = 180;
1300 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1301 s_info->sensor_platform_info->privacy_light = 1;
1302 s_info->sensor_platform_info->privacy_light_info =
1303 &privacy_light_info;
1304 }
1305
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1307 struct msm_camera_sensor_info *s_info;
1308 s_info = cam_dev[i]->dev.platform_data;
1309 msm_get_cam_resources(s_info);
1310 platform_device_register(cam_dev[i]);
1311 }
1312}
1313#endif
1314
1315#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001316#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001318#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001319#endif
1320
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321
1322#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001323#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001325#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1326#else
1327#define MSM_FB_EXT_BUF_SIZE 0
1328#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329
kuogee hsieh3830eb92011-09-12 15:25:57 -07001330#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1331/* width x height x 3 bpp x 2 frame buffer */
1332#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1333#define MSM_FB_WRITEBACK_OFFSET \
1334 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1335#else
1336#define MSM_FB_WRITEBACK_SIZE 0
1337#define MSM_FB_WRITEBACK_OFFSET 0
1338#endif
1339
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001340#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1341/* 4 bpp x 2 page HDMI case */
1342#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1343#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001344/* Note: must be multiple of 4096 */
1345#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1346 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001347#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001348
1349static int writeback_offset(void)
1350{
1351 return MSM_FB_WRITEBACK_OFFSET;
1352}
1353
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354
1355#define MDP_VSYNC_GPIO 0
1356
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001357#define PANEL_NAME_MAX_LEN 30
1358#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1359#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1360#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1361#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1362#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1363#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1364#define HDMI_PANEL_NAME "hdmi_msm"
1365#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001366
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001367static struct resource msm_fb_resources[] = {
1368 {
1369 .flags = IORESOURCE_DMA,
1370 }
1371};
1372
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001373static int msm_fb_detect_panel(const char *name)
1374{
1375 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001376 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1377 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1378 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001379 return 0;
1380 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001381 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1382 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1383 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001384 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001385
1386#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1387 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1388 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1389 PANEL_NAME_MAX_LEN)))
1390 return 0;
1391
1392 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1393 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1394 PANEL_NAME_MAX_LEN)))
1395 return 0;
1396
1397 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1398 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1399 PANEL_NAME_MAX_LEN)))
1400 return 0;
1401
1402 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1403 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1404 PANEL_NAME_MAX_LEN)))
1405 return 0;
1406#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001407 }
1408
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001409 if (!strncmp(name, HDMI_PANEL_NAME,
1410 strnlen(HDMI_PANEL_NAME,
1411 PANEL_NAME_MAX_LEN)))
1412 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001413
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001414 if (!strncmp(name, TVOUT_PANEL_NAME,
1415 strnlen(TVOUT_PANEL_NAME,
1416 PANEL_NAME_MAX_LEN)))
1417 return 0;
1418
1419 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001420 return -ENODEV;
1421}
1422
1423static struct msm_fb_platform_data msm_fb_pdata = {
1424 .detect_client = msm_fb_detect_panel,
1425};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001426
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001427static struct platform_device msm_fb_device = {
1428 .name = "msm_fb",
1429 .id = 0,
1430 .num_resources = ARRAY_SIZE(msm_fb_resources),
1431 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001432 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433};
1434
1435static bool dsi_power_on;
1436
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001437/**
1438 * LiQUID panel on/off
1439 *
1440 * @param on
1441 *
1442 * @return int
1443 */
1444static int mipi_dsi_liquid_panel_power(int on)
1445{
1446 static struct regulator *reg_l2, *reg_ext_3p3v;
1447 static int gpio21, gpio24, gpio43;
1448 int rc;
1449
1450 pr_info("%s: on=%d\n", __func__, on);
1451
1452 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1453 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1454 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1455
1456 if (!dsi_power_on) {
1457
1458 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1459 "dsi_vdda");
1460 if (IS_ERR(reg_l2)) {
1461 pr_err("could not get 8921_l2, rc = %ld\n",
1462 PTR_ERR(reg_l2));
1463 return -ENODEV;
1464 }
1465
1466 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1467 if (rc) {
1468 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1469 return -EINVAL;
1470 }
1471
1472 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1473 "vdd_lvds_3p3v");
1474 if (IS_ERR(reg_ext_3p3v)) {
1475 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1476 PTR_ERR(reg_ext_3p3v));
1477 return -ENODEV;
1478 }
1479
1480 rc = gpio_request(gpio21, "disp_pwr_en_n");
1481 if (rc) {
1482 pr_err("request gpio 21 failed, rc=%d\n", rc);
1483 return -ENODEV;
1484 }
1485
1486 rc = gpio_request(gpio43, "disp_rst_n");
1487 if (rc) {
1488 pr_err("request gpio 43 failed, rc=%d\n", rc);
1489 return -ENODEV;
1490 }
1491
1492 rc = gpio_request(gpio24, "disp_backlight_pwm");
1493 if (rc) {
1494 pr_err("request gpio 24 failed, rc=%d\n", rc);
1495 return -ENODEV;
1496 }
1497
1498 dsi_power_on = true;
1499 }
1500
1501 if (on) {
1502 rc = regulator_set_optimum_mode(reg_l2, 100000);
1503 if (rc < 0) {
1504 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1505 return -EINVAL;
1506 }
1507 rc = regulator_enable(reg_l2);
1508 if (rc) {
1509 pr_err("enable l2 failed, rc=%d\n", rc);
1510 return -ENODEV;
1511 }
1512
1513 rc = regulator_enable(reg_ext_3p3v);
1514 if (rc) {
1515 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1516 return -ENODEV;
1517 }
1518
1519 /* set reset pin before power enable */
1520 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1521
1522 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1523 msleep(20);
1524 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1525 msleep(20);
1526 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1527 msleep(20);
1528 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1529 msleep(20);
1530 } else {
1531 gpio_set_value_cansleep(gpio43, 0);
1532 gpio_set_value_cansleep(gpio21, 1);
1533
1534 rc = regulator_disable(reg_l2);
1535 if (rc) {
1536 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1537 return -ENODEV;
1538 }
1539 rc = regulator_disable(reg_ext_3p3v);
1540 if (rc) {
1541 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1542 return -ENODEV;
1543 }
1544 rc = regulator_set_optimum_mode(reg_l2, 100);
1545 if (rc < 0) {
1546 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1547 return -EINVAL;
1548 }
1549 }
1550
1551 return 0;
1552}
1553
1554static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001555{
1556 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001557 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 int rc;
1559
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001560 pr_info("%s: state : %d\n", __func__, on);
1561
1562 if (!dsi_power_on) {
1563
1564 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1565 "dsi_vdc");
1566 if (IS_ERR(reg_l8)) {
1567 pr_err("could not get 8921_l8, rc = %ld\n",
1568 PTR_ERR(reg_l8));
1569 return -ENODEV;
1570 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1572 "dsi_vddio");
1573 if (IS_ERR(reg_l23)) {
1574 pr_err("could not get 8921_l23, rc = %ld\n",
1575 PTR_ERR(reg_l23));
1576 return -ENODEV;
1577 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001578 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1579 "dsi_vdda");
1580 if (IS_ERR(reg_l2)) {
1581 pr_err("could not get 8921_l2, rc = %ld\n",
1582 PTR_ERR(reg_l2));
1583 return -ENODEV;
1584 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001585 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1586 if (rc) {
1587 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1588 return -EINVAL;
1589 }
1590 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1591 if (rc) {
1592 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1593 return -EINVAL;
1594 }
1595 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1596 if (rc) {
1597 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1598 return -EINVAL;
1599 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001600 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1601 rc = gpio_request(gpio43, "disp_rst_n");
1602 if (rc) {
1603 pr_err("request gpio 43 failed, rc=%d\n", rc);
1604 return -ENODEV;
1605 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001606 dsi_power_on = true;
1607 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001608 if (on) {
1609 rc = regulator_set_optimum_mode(reg_l8, 100000);
1610 if (rc < 0) {
1611 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1612 return -EINVAL;
1613 }
1614 rc = regulator_set_optimum_mode(reg_l23, 100000);
1615 if (rc < 0) {
1616 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1617 return -EINVAL;
1618 }
1619 rc = regulator_set_optimum_mode(reg_l2, 100000);
1620 if (rc < 0) {
1621 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1622 return -EINVAL;
1623 }
1624 rc = regulator_enable(reg_l8);
1625 if (rc) {
1626 pr_err("enable l8 failed, rc=%d\n", rc);
1627 return -ENODEV;
1628 }
1629 rc = regulator_enable(reg_l23);
1630 if (rc) {
1631 pr_err("enable l8 failed, rc=%d\n", rc);
1632 return -ENODEV;
1633 }
1634 rc = regulator_enable(reg_l2);
1635 if (rc) {
1636 pr_err("enable l2 failed, rc=%d\n", rc);
1637 return -ENODEV;
1638 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001639 gpio_set_value_cansleep(gpio43, 1);
1640 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001641 rc = regulator_disable(reg_l2);
1642 if (rc) {
1643 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1644 return -ENODEV;
1645 }
1646 rc = regulator_disable(reg_l8);
1647 if (rc) {
1648 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1649 return -ENODEV;
1650 }
1651 rc = regulator_disable(reg_l23);
1652 if (rc) {
1653 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1654 return -ENODEV;
1655 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656 rc = regulator_set_optimum_mode(reg_l8, 100);
1657 if (rc < 0) {
1658 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1659 return -EINVAL;
1660 }
1661 rc = regulator_set_optimum_mode(reg_l23, 100);
1662 if (rc < 0) {
1663 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1664 return -EINVAL;
1665 }
1666 rc = regulator_set_optimum_mode(reg_l2, 100);
1667 if (rc < 0) {
1668 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1669 return -EINVAL;
1670 }
1671 gpio_set_value_cansleep(gpio43, 0);
1672 }
1673 return 0;
1674}
1675
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001676static int mipi_dsi_panel_power(int on)
1677{
1678 int ret;
1679
1680 pr_info("%s: on=%d\n", __func__, on);
1681
1682 if (machine_is_msm8960_liquid())
1683 ret = mipi_dsi_liquid_panel_power(on);
1684 else
1685 ret = mipi_dsi_cdp_panel_power(on);
1686
1687 return ret;
1688}
1689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1691 .vsync_gpio = MDP_VSYNC_GPIO,
1692 .dsi_power_save = mipi_dsi_panel_power,
1693};
1694
1695#ifdef CONFIG_MSM_BUS_SCALING
1696
1697static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698 {
1699 .src = MSM_BUS_MASTER_MDP_PORT0,
1700 .dst = MSM_BUS_SLAVE_EBI_CH0,
1701 .ab = 0,
1702 .ib = 0,
1703 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001704};
1705
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001706#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1707static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1708 /* If HDMI is used as primary */
1709 {
1710 .src = MSM_BUS_MASTER_MDP_PORT0,
1711 .dst = MSM_BUS_SLAVE_EBI_CH0,
1712 .ab = 2000000000,
1713 .ib = 2000000000,
1714 },
1715};
1716static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1717 {
1718 ARRAY_SIZE(mdp_init_vectors),
1719 mdp_init_vectors,
1720 },
1721 {
1722 ARRAY_SIZE(hdmi_as_primary_vectors),
1723 hdmi_as_primary_vectors,
1724 },
1725 {
1726 ARRAY_SIZE(hdmi_as_primary_vectors),
1727 hdmi_as_primary_vectors,
1728 },
1729 {
1730 ARRAY_SIZE(hdmi_as_primary_vectors),
1731 hdmi_as_primary_vectors,
1732 },
1733 {
1734 ARRAY_SIZE(hdmi_as_primary_vectors),
1735 hdmi_as_primary_vectors,
1736 },
1737 {
1738 ARRAY_SIZE(hdmi_as_primary_vectors),
1739 hdmi_as_primary_vectors,
1740 },
1741};
1742#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001743static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001744 {
1745 .src = MSM_BUS_MASTER_MDP_PORT0,
1746 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001747 .ab = 216000000 * 2,
1748 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749 },
1750};
1751
1752static struct msm_bus_vectors mdp_vga_vectors[] = {
1753 /* VGA and less video */
1754 {
1755 .src = MSM_BUS_MASTER_MDP_PORT0,
1756 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001757 .ab = 216000000 * 2,
1758 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001759 },
1760};
1761
1762static struct msm_bus_vectors mdp_720p_vectors[] = {
1763 /* 720p and less video */
1764 {
1765 .src = MSM_BUS_MASTER_MDP_PORT0,
1766 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001767 .ab = 230400000 * 2,
1768 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 },
1770};
1771
1772static struct msm_bus_vectors mdp_1080p_vectors[] = {
1773 /* 1080p and less video */
1774 {
1775 .src = MSM_BUS_MASTER_MDP_PORT0,
1776 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001777 .ab = 334080000 * 2,
1778 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001779 },
1780};
1781
1782static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1783 {
1784 ARRAY_SIZE(mdp_init_vectors),
1785 mdp_init_vectors,
1786 },
1787 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001788 ARRAY_SIZE(mdp_ui_vectors),
1789 mdp_ui_vectors,
1790 },
1791 {
1792 ARRAY_SIZE(mdp_ui_vectors),
1793 mdp_ui_vectors,
1794 },
1795 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001796 ARRAY_SIZE(mdp_vga_vectors),
1797 mdp_vga_vectors,
1798 },
1799 {
1800 ARRAY_SIZE(mdp_720p_vectors),
1801 mdp_720p_vectors,
1802 },
1803 {
1804 ARRAY_SIZE(mdp_1080p_vectors),
1805 mdp_1080p_vectors,
1806 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001807};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001808#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001809
1810static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1811 mdp_bus_scale_usecases,
1812 ARRAY_SIZE(mdp_bus_scale_usecases),
1813 .name = "mdp",
1814};
1815
1816#endif
1817
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001818#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1819int mdp_core_clk_rate_table[] = {
1820 200000000,
1821 200000000,
1822 200000000,
1823 200000000,
1824};
1825#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001826int mdp_core_clk_rate_table[] = {
1827 85330000,
1828 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001829 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001830 200000000,
1831};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001832#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001833
1834static struct msm_panel_common_pdata mdp_pdata = {
1835 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001836#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1837 .mdp_core_clk_rate = 200000000,
1838#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001839 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001840#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841 .mdp_core_clk_table = mdp_core_clk_rate_table,
1842 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1843#ifdef CONFIG_MSM_BUS_SCALING
1844 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1845#endif
1846 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001847 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001848};
1849
1850static struct platform_device mipi_dsi_renesas_panel_device = {
1851 .name = "mipi_renesas",
1852 .id = 0,
1853};
1854
1855static struct platform_device mipi_dsi_simulator_panel_device = {
1856 .name = "mipi_simulator",
1857 .id = 0,
1858};
1859
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001860#define LPM_CHANNEL0 0
1861static int toshiba_gpio[] = {LPM_CHANNEL0};
1862
1863static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1864 .gpio = toshiba_gpio,
1865};
1866
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001867static struct platform_device mipi_dsi_toshiba_panel_device = {
1868 .name = "mipi_toshiba",
1869 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001870 .dev = {
1871 .platform_data = &toshiba_pdata,
1872 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873};
1874
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001875static int dsi2lvds_gpio[2] = {
1876 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1877 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1878 };
1879
1880static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1881 .gpio_num = dsi2lvds_gpio,
1882};
1883
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001884static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1885
1886/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1887 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1888 /* timing */
1889 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1890 0x0c, 0x03, 0x04, 0xa0},
1891 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1892 {0xff, 0x00, 0x06, 0x00}, /* strength */
1893 /* pll control */
1894 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1895 0x40, 0x07, 0x03,
1896 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1897};
1898
1899static struct mipi_dsi_panel_platform_data novatek_pdata = {
1900 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1901};
1902
1903static struct platform_device mipi_dsi_novatek_panel_device = {
1904 .name = "mipi_novatek",
1905 .id = 0,
1906 .dev = {
1907 .platform_data = &novatek_pdata,
1908 }
1909};
1910
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001911static struct platform_device mipi_dsi2lvds_bridge_device = {
1912 .name = "mipi_tc358764",
1913 .id = 0,
1914 .dev.platform_data = &mipi_dsi2lvds_pdata,
1915};
1916
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001917#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1918static struct resource hdmi_msm_resources[] = {
1919 {
1920 .name = "hdmi_msm_qfprom_addr",
1921 .start = 0x00700000,
1922 .end = 0x007060FF,
1923 .flags = IORESOURCE_MEM,
1924 },
1925 {
1926 .name = "hdmi_msm_hdmi_addr",
1927 .start = 0x04A00000,
1928 .end = 0x04A00FFF,
1929 .flags = IORESOURCE_MEM,
1930 },
1931 {
1932 .name = "hdmi_msm_irq",
1933 .start = HDMI_IRQ,
1934 .end = HDMI_IRQ,
1935 .flags = IORESOURCE_IRQ,
1936 },
1937};
1938
1939static int hdmi_enable_5v(int on);
1940static int hdmi_core_power(int on, int show);
1941static int hdmi_cec_power(int on);
1942
1943static struct msm_hdmi_platform_data hdmi_msm_data = {
1944 .irq = HDMI_IRQ,
1945 .enable_5v = hdmi_enable_5v,
1946 .core_power = hdmi_core_power,
1947 .cec_power = hdmi_cec_power,
1948};
1949
1950static struct platform_device hdmi_msm_device = {
1951 .name = "hdmi_msm",
1952 .id = 0,
1953 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1954 .resource = hdmi_msm_resources,
1955 .dev.platform_data = &hdmi_msm_data,
1956};
1957#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1958
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001959#ifdef CONFIG_MSM_BUS_SCALING
1960static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1961 {
1962 .src = MSM_BUS_MASTER_MDP_PORT0,
1963 .dst = MSM_BUS_SLAVE_EBI_CH0,
1964 .ab = 0,
1965 .ib = 0,
1966 },
1967};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001968
1969#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1970static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1971 {
1972 .src = MSM_BUS_MASTER_MDP_PORT0,
1973 .dst = MSM_BUS_SLAVE_EBI_CH0,
1974 .ab = 2000000000,
1975 .ib = 2000000000,
1976 },
1977};
1978#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001979static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1980 {
1981 .src = MSM_BUS_MASTER_MDP_PORT0,
1982 .dst = MSM_BUS_SLAVE_EBI_CH0,
1983 .ab = 566092800 * 2,
1984 .ib = 707616000 * 2,
1985 },
1986};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001987#endif
1988
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001989static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1990 {
1991 ARRAY_SIZE(dtv_bus_init_vectors),
1992 dtv_bus_init_vectors,
1993 },
1994 {
1995 ARRAY_SIZE(dtv_bus_def_vectors),
1996 dtv_bus_def_vectors,
1997 },
1998};
1999static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2000 dtv_bus_scale_usecases,
2001 ARRAY_SIZE(dtv_bus_scale_usecases),
2002 .name = "dtv",
2003};
2004
2005static struct lcdc_platform_data dtv_pdata = {
2006 .bus_scale_table = &dtv_bus_scale_pdata,
2007};
2008#endif
2009
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002010static void __init msm_fb_add_devices(void)
2011{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002012 struct platform_device *ptr = NULL;
2013
2014 if (machine_is_msm8960_liquid())
2015 ptr = &mipi_dsi2lvds_bridge_device;
2016 else
2017 ptr = &mipi_dsi_toshiba_panel_device;
2018 platform_add_devices(&ptr, 1);
2019
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002020 if (machine_is_msm8x60_rumi3()) {
2021 msm_fb_register_device("mdp", NULL);
2022 mipi_dsi_pdata.target_type = 1;
2023 } else
2024 msm_fb_register_device("mdp", &mdp_pdata);
2025 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002026#ifdef CONFIG_MSM_BUS_SCALING
2027 msm_fb_register_device("dtv", &dtv_pdata);
2028#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002029}
2030
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002031static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2032 .func = GPIOMUX_FUNC_GPIO,
2033 .drv = GPIOMUX_DRV_2MA,
2034 .pull = GPIOMUX_PULL_DOWN,
2035};
2036
2037static struct gpiomux_setting mdp_vsync_active_cfg = {
2038 .func = GPIOMUX_FUNC_1,
2039 .drv = GPIOMUX_DRV_2MA,
2040 .pull = GPIOMUX_PULL_DOWN,
2041};
2042
2043static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2044 {
2045 .gpio = MDP_VSYNC_GPIO,
2046 .settings = {
2047 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2048 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2049 },
2050 }
2051};
2052
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002053#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2054static struct gpiomux_setting hdmi_suspend_cfg = {
2055 .func = GPIOMUX_FUNC_GPIO,
2056 .drv = GPIOMUX_DRV_2MA,
2057 .pull = GPIOMUX_PULL_DOWN,
2058};
2059
2060static struct gpiomux_setting hdmi_active_1_cfg = {
2061 .func = GPIOMUX_FUNC_1,
2062 .drv = GPIOMUX_DRV_2MA,
2063 .pull = GPIOMUX_PULL_UP,
2064};
2065
2066static struct gpiomux_setting hdmi_active_2_cfg = {
2067 .func = GPIOMUX_FUNC_1,
2068 .drv = GPIOMUX_DRV_2MA,
2069 .pull = GPIOMUX_PULL_DOWN,
2070};
2071
2072static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2073 {
2074 .gpio = 99,
2075 .settings = {
2076 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2077 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2078 },
2079 },
2080 {
2081 .gpio = 100,
2082 .settings = {
2083 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2084 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2085 },
2086 },
2087 {
2088 .gpio = 101,
2089 .settings = {
2090 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2091 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2092 },
2093 },
2094 {
2095 .gpio = 102,
2096 .settings = {
2097 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2098 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2099 },
2100 },
2101};
2102
2103static int hdmi_enable_5v(int on)
2104{
2105 /* TBD: PM8921 regulator instead of 8901 */
2106 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2107 static int prev_on;
2108 int rc;
2109
2110 if (on == prev_on)
2111 return 0;
2112
2113 if (!reg_8921_hdmi_mvs)
2114 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2115 "hdmi_mvs");
2116
2117 if (on) {
2118 rc = regulator_enable(reg_8921_hdmi_mvs);
2119 if (rc) {
2120 pr_err("'%s' regulator enable failed, rc=%d\n",
2121 "8921_hdmi_mvs", rc);
2122 return rc;
2123 }
2124 pr_debug("%s(on): success\n", __func__);
2125 } else {
2126 rc = regulator_disable(reg_8921_hdmi_mvs);
2127 if (rc)
2128 pr_warning("'%s' regulator disable failed, rc=%d\n",
2129 "8921_hdmi_mvs", rc);
2130 pr_debug("%s(off): success\n", __func__);
2131 }
2132
2133 prev_on = on;
2134
2135 return 0;
2136}
2137
2138static int hdmi_core_power(int on, int show)
2139{
2140 static struct regulator *reg_8921_l23, *reg_8921_s4;
2141 static int prev_on;
2142 int rc;
2143
2144 if (on == prev_on)
2145 return 0;
2146
2147 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002148 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002149 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002150 if (IS_ERR(reg_8921_l23)) {
2151 pr_err("could not get reg_8921_l23, rc = %ld\n",
2152 PTR_ERR(reg_8921_l23));
2153 return -ENODEV;
2154 }
2155 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2156 if (rc) {
2157 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2158 return -EINVAL;
2159 }
2160 }
2161 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002163 if (IS_ERR(reg_8921_s4)) {
2164 pr_err("could not get reg_8921_s4, rc = %ld\n",
2165 PTR_ERR(reg_8921_s4));
2166 return -ENODEV;
2167 }
2168 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2169 if (rc) {
2170 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2171 return -EINVAL;
2172 }
2173 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174
2175 if (on) {
2176 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2177 if (rc < 0) {
2178 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2179 return -EINVAL;
2180 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002181 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182 if (rc) {
2183 pr_err("'%s' regulator enable failed, rc=%d\n",
2184 "hdmi_avdd", rc);
2185 return rc;
2186 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002187 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188 if (rc) {
2189 pr_err("'%s' regulator enable failed, rc=%d\n",
2190 "hdmi_vcc", rc);
2191 return rc;
2192 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002193 rc = gpio_request(100, "HDMI_DDC_CLK");
2194 if (rc) {
2195 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2196 "HDMI_DDC_CLK", 100, rc);
2197 goto error1;
2198 }
2199 rc = gpio_request(101, "HDMI_DDC_DATA");
2200 if (rc) {
2201 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2202 "HDMI_DDC_DATA", 101, rc);
2203 goto error2;
2204 }
2205 rc = gpio_request(102, "HDMI_HPD");
2206 if (rc) {
2207 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2208 "HDMI_HPD", 102, rc);
2209 goto error3;
2210 }
2211 pr_debug("%s(on): success\n", __func__);
2212 } else {
2213 gpio_free(100);
2214 gpio_free(101);
2215 gpio_free(102);
2216
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002217 rc = regulator_disable(reg_8921_l23);
2218 if (rc) {
2219 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2220 return -ENODEV;
2221 }
2222 rc = regulator_disable(reg_8921_s4);
2223 if (rc) {
2224 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2225 return -ENODEV;
2226 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2228 if (rc < 0) {
2229 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2230 return -EINVAL;
2231 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002232 pr_debug("%s(off): success\n", __func__);
2233 }
2234
2235 prev_on = on;
2236
2237 return 0;
2238
2239error3:
2240 gpio_free(101);
2241error2:
2242 gpio_free(100);
2243error1:
2244 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002245 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002246 return rc;
2247}
2248
2249static int hdmi_cec_power(int on)
2250{
2251 static int prev_on;
2252 int rc;
2253
2254 if (on == prev_on)
2255 return 0;
2256
2257 if (on) {
2258 rc = gpio_request(99, "HDMI_CEC_VAR");
2259 if (rc) {
2260 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2261 "HDMI_CEC_VAR", 99, rc);
2262 goto error;
2263 }
2264 pr_debug("%s(on): success\n", __func__);
2265 } else {
2266 gpio_free(99);
2267 pr_debug("%s(off): success\n", __func__);
2268 }
2269
2270 prev_on = on;
2271
2272 return 0;
2273error:
2274 return rc;
2275}
2276#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2277
2278static void __init msm8960_allocate_memory_regions(void)
2279{
2280 void *addr;
2281 unsigned long size;
2282
2283 size = MSM_FB_SIZE;
2284 addr = alloc_bootmem_align(size, 0x1000);
2285 msm_fb_resources[0].start = __pa(addr);
2286 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2287 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2288 size, addr, __pa(addr));
2289
2290}
2291#ifdef CONFIG_WCD9310_CODEC
2292
2293#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2294
Patrick Lai3043fba2011-08-01 14:15:57 -07002295/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2296 * 4 micbiases are used to power various analog and digital
2297 * microphones operating at 1800 mV. Technically, all micbiases
2298 * can source from single cfilter since all microphones operate
2299 * at the same voltage level. The arrangement below is to make
2300 * sure all cfilters are exercised. LDO_H regulator ouput level
2301 * does not need to be as high as 2.85V. It is choosen for
2302 * microphone sensitivity purpose.
2303 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304static struct tabla_pdata tabla_platform_data = {
2305 .slimbus_slave_device = {
2306 .name = "tabla-slave",
2307 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2308 },
2309 .irq = MSM_GPIO_TO_INT(62),
2310 .irq_base = TABLA_INTERRUPT_BASE,
2311 .num_irqs = NR_TABLA_IRQS,
2312 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002313 .micbias = {
2314 .ldoh_v = TABLA_LDOH_2P85_V,
2315 .cfilt1_mv = 1800,
2316 .cfilt2_mv = 1800,
2317 .cfilt3_mv = 1800,
2318 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2319 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2320 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2321 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2322 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323};
2324
2325static struct slim_device msm_slim_tabla = {
2326 .name = "tabla-slim",
2327 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2328 .dev = {
2329 .platform_data = &tabla_platform_data,
2330 },
2331};
2332#endif
2333
2334static struct slim_boardinfo msm_slim_devices[] = {
2335#ifdef CONFIG_WCD9310_CODEC
2336 {
2337 .bus_num = 1,
2338 .slim_slave = &msm_slim_tabla,
2339 },
2340#endif
2341 /* add more slimbus slaves as needed */
2342};
2343
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002344#define MSM_WCNSS_PHYS 0x03000000
2345#define MSM_WCNSS_SIZE 0x280000
2346
2347static struct resource resources_wcnss_wlan[] = {
2348 {
2349 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2350 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2351 .name = "wcnss_wlanrx_irq",
2352 .flags = IORESOURCE_IRQ,
2353 },
2354 {
2355 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2356 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2357 .name = "wcnss_wlantx_irq",
2358 .flags = IORESOURCE_IRQ,
2359 },
2360 {
2361 .start = MSM_WCNSS_PHYS,
2362 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2363 .name = "wcnss_mmio",
2364 .flags = IORESOURCE_MEM,
2365 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002366 {
2367 .start = 84,
2368 .end = 88,
2369 .name = "wcnss_gpios_5wire",
2370 .flags = IORESOURCE_IO,
2371 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002372};
2373
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002374static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2375 .has_48mhz_xo = 1,
2376};
2377
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002378static struct platform_device msm_device_wcnss_wlan = {
2379 .name = "wcnss_wlan",
2380 .id = 0,
2381 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2382 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002383 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002384};
2385
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002386#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2387 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2388 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2389 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2390
2391#define QCE_SIZE 0x10000
2392#define QCE_0_BASE 0x18500000
2393
2394#define QCE_HW_KEY_SUPPORT 0
2395#define QCE_SHA_HMAC_SUPPORT 1
2396#define QCE_SHARE_CE_RESOURCE 1
2397#define QCE_CE_SHARED 0
2398
2399static struct resource qcrypto_resources[] = {
2400 [0] = {
2401 .start = QCE_0_BASE,
2402 .end = QCE_0_BASE + QCE_SIZE - 1,
2403 .flags = IORESOURCE_MEM,
2404 },
2405 [1] = {
2406 .name = "crypto_channels",
2407 .start = DMOV_CE_IN_CHAN,
2408 .end = DMOV_CE_OUT_CHAN,
2409 .flags = IORESOURCE_DMA,
2410 },
2411 [2] = {
2412 .name = "crypto_crci_in",
2413 .start = DMOV_CE_IN_CRCI,
2414 .end = DMOV_CE_IN_CRCI,
2415 .flags = IORESOURCE_DMA,
2416 },
2417 [3] = {
2418 .name = "crypto_crci_out",
2419 .start = DMOV_CE_OUT_CRCI,
2420 .end = DMOV_CE_OUT_CRCI,
2421 .flags = IORESOURCE_DMA,
2422 },
2423};
2424
2425static struct resource qcedev_resources[] = {
2426 [0] = {
2427 .start = QCE_0_BASE,
2428 .end = QCE_0_BASE + QCE_SIZE - 1,
2429 .flags = IORESOURCE_MEM,
2430 },
2431 [1] = {
2432 .name = "crypto_channels",
2433 .start = DMOV_CE_IN_CHAN,
2434 .end = DMOV_CE_OUT_CHAN,
2435 .flags = IORESOURCE_DMA,
2436 },
2437 [2] = {
2438 .name = "crypto_crci_in",
2439 .start = DMOV_CE_IN_CRCI,
2440 .end = DMOV_CE_IN_CRCI,
2441 .flags = IORESOURCE_DMA,
2442 },
2443 [3] = {
2444 .name = "crypto_crci_out",
2445 .start = DMOV_CE_OUT_CRCI,
2446 .end = DMOV_CE_OUT_CRCI,
2447 .flags = IORESOURCE_DMA,
2448 },
2449};
2450
2451#endif
2452
2453#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2454 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2455
2456static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2457 .ce_shared = QCE_CE_SHARED,
2458 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2459 .hw_key_support = QCE_HW_KEY_SUPPORT,
2460 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2461};
2462
2463static struct platform_device qcrypto_device = {
2464 .name = "qcrypto",
2465 .id = 0,
2466 .num_resources = ARRAY_SIZE(qcrypto_resources),
2467 .resource = qcrypto_resources,
2468 .dev = {
2469 .coherent_dma_mask = DMA_BIT_MASK(32),
2470 .platform_data = &qcrypto_ce_hw_suppport,
2471 },
2472};
2473#endif
2474
2475#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2476 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2477
2478static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2479 .ce_shared = QCE_CE_SHARED,
2480 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2481 .hw_key_support = QCE_HW_KEY_SUPPORT,
2482 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2483};
2484
2485static struct platform_device qcedev_device = {
2486 .name = "qce",
2487 .id = 0,
2488 .num_resources = ARRAY_SIZE(qcedev_resources),
2489 .resource = qcedev_resources,
2490 .dev = {
2491 .coherent_dma_mask = DMA_BIT_MASK(32),
2492 .platform_data = &qcedev_ce_hw_suppport,
2493 },
2494};
2495#endif
2496
2497
2498static int __init gpiomux_init(void)
2499{
2500 int rc;
2501
2502 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2503 if (rc) {
2504 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2505 return rc;
2506 }
2507
Nishant Pandit24153d82011-08-27 16:05:13 +05302508 msm_gpiomux_install(msm8960_cam_common_configs,
2509 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002510
2511 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002512 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513
2514 msm_gpiomux_install(msm8960_gsbi_configs,
2515 ARRAY_SIZE(msm8960_gsbi_configs));
2516
2517 msm_gpiomux_install(msm8960_cyts_configs,
2518 ARRAY_SIZE(msm8960_cyts_configs));
2519
2520 msm_gpiomux_install(msm8960_slimbus_config,
2521 ARRAY_SIZE(msm8960_slimbus_config));
2522
2523 msm_gpiomux_install(msm8960_audio_codec_configs,
2524 ARRAY_SIZE(msm8960_audio_codec_configs));
2525
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002526 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2527 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2528
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002529#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2530 msm_gpiomux_install(msm8960_hdmi_configs,
2531 ARRAY_SIZE(msm8960_hdmi_configs));
2532#endif
2533
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002534 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2535 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2536
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002537 msm_gpiomux_install(wcnss_5wire_interface,
2538 ARRAY_SIZE(wcnss_5wire_interface));
2539
2540 return 0;
2541}
2542
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002543#define MSM_SHARED_RAM_PHYS 0x80000000
2544
2545static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2546 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2547 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2548 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2549 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2550 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2551 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2552 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2553 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2554 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2555 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2556 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2557 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002558 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2559 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2560 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2561 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2562 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2563 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2564 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2565 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2566 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2567 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2568 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2569 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2570 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2571 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002572 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002573 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2574 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2575 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002576 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2577 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002578};
2579
2580static struct pm8921_adc_properties pm8921_adc_data = {
2581 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2582 .bitresolution = 15,
2583 .bipolar = 0,
2584};
2585
2586static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2587 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002588 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002589 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002590 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002591};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002592
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002593static void __init msm8960_map_io(void)
2594{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002595 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002596 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002597
2598 if (socinfo_init() < 0)
2599 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002600}
2601
2602static void __init msm8960_init_irq(void)
2603{
2604 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002605
2606 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002607 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002608 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002609
2610 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002611 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002612
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002613 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2614 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002615
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002616 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2617 * as they are configured as level, which does not play nice with
2618 * handle_percpu_irq.
2619 */
2620 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2621 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002622 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002623 }
2624}
2625
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002626/* MSM8960 have 5 SDCC controllers */
2627enum sdcc_controllers {
2628 SDCC1,
2629 SDCC2,
2630 SDCC3,
2631 SDCC4,
2632 SDCC5,
2633 MAX_SDCC_CONTROLLER
2634};
2635
2636/* All SDCC controllers requires VDD/VCC voltage */
2637static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2638 /* SDCC1 : eMMC card connected */
2639 [SDCC1] = {
2640 .name = "sdc_vdd",
2641 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302642 .high_vol_level = 2950000,
2643 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302644 .always_on = 1,
2645 .lpm_sup = 1,
2646 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002647 .hpm_uA = 200000, /* 200mA */
2648 },
2649 /* SDCC3 : External card slot connected */
2650 [SDCC3] = {
2651 .name = "sdc_vdd",
2652 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302653 .high_vol_level = 2950000,
2654 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002655 .hpm_uA = 600000, /* 600mA */
2656 }
2657};
2658
2659/* Only slots having eMMC card will require VCCQ voltage */
2660static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2661 /* SDCC1 : eMMC card connected */
2662 [SDCC1] = {
2663 .name = "sdc_vccq",
2664 .set_voltage_sup = 1,
2665 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302666 .high_vol_level = 1800000,
2667 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002668 .hpm_uA = 200000, /* 200mA */
2669 }
2670};
2671
2672/* All SDCC controllers may require voting for VDD PAD voltage */
2673static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2674 /* SDCC3 : External card slot connected */
2675 [SDCC3] = {
2676 .name = "sdc_vddp",
2677 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302678 .high_vol_level = 2950000,
2679 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002680 .always_on = 1,
2681 .lpm_sup = 1,
2682 /* Max. Active current required is 16 mA */
2683 .hpm_uA = 16000,
2684 /*
2685 * Sleep current required is ~300 uA. But min. vote can be
2686 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2687 * during sleep.
2688 */
2689 .lpm_uA = 2000,
2690 }
2691};
2692
2693static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2694 /* SDCC1 : eMMC card connected */
2695 [SDCC1] = {
2696 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2697 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2698 },
2699 /* SDCC3 : External card slot connected */
2700 [SDCC3] = {
2701 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2702 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2703 }
2704};
2705
2706/* SDC1 pad data */
2707static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2708 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302709 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2710 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711};
2712
2713static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2714 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2715 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2716 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2717};
2718
2719static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302720 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002721 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2722 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2723};
2724
2725static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302726 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002727 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2728 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2729};
2730
2731/* SDC3 pad data */
2732static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2733 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2734 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2735 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2736};
2737
2738static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2739 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2740 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2741 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2742};
2743
2744static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302745 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002746 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2747 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2748};
2749
2750static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302751 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302752 /*
2753 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2754 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2755 * which would result in false card detection interrupts.
2756 */
2757 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2758 /*
2759 * Keeping DATA lines status to PULL UP will make sure that
2760 * there is no current leak during sleep if external pull up
2761 * is connected to DATA lines.
2762 */
2763 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002764};
2765
2766struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2767 [SDCC1] = {
2768 .on = sdc1_pad_pull_on_cfg,
2769 .off = sdc1_pad_pull_off_cfg,
2770 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2771 },
2772 [SDCC3] = {
2773 .on = sdc3_pad_pull_on_cfg,
2774 .off = sdc3_pad_pull_off_cfg,
2775 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2776 },
2777};
2778
2779struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2780 [SDCC1] = {
2781 .on = sdc1_pad_drv_on_cfg,
2782 .off = sdc1_pad_drv_off_cfg,
2783 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2784 },
2785 [SDCC3] = {
2786 .on = sdc3_pad_drv_on_cfg,
2787 .off = sdc3_pad_drv_off_cfg,
2788 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2789 },
2790};
2791
2792struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2793 [SDCC1] = {
2794 .pull = &mmc_pad_pull_data[SDCC1],
2795 .drv = &mmc_pad_drv_data[SDCC1]
2796 },
2797 [SDCC3] = {
2798 .pull = &mmc_pad_pull_data[SDCC3],
2799 .drv = &mmc_pad_drv_data[SDCC3]
2800 },
2801};
2802
2803struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2804 [SDCC1] = {
2805 .pad_data = &mmc_pad_data[SDCC1],
2806 },
2807 [SDCC3] = {
2808 .pad_data = &mmc_pad_data[SDCC3],
2809 },
2810};
2811
2812static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302813 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814};
2815
2816static unsigned int sdc3_sup_clk_rates[] = {
2817 400000, 24000000, 48000000, 96000000
2818};
2819
2820#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2821static struct mmc_platform_data msm8960_sdc1_data = {
2822 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2823#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2824 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2825#else
2826 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2827#endif
2828 .sup_clk_table = sdc1_sup_clk_rates,
2829 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302830 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002831 .nonremovable = 1,
2832 .sdcc_v4_sup = true,
2833 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302834 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002835};
2836#endif
2837
2838#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2839static struct mmc_platform_data msm8960_sdc3_data = {
2840 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2841 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2842 .sup_clk_table = sdc3_sup_clk_rates,
2843 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302844 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302845#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002846 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302847#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002848 .sdcc_v4_sup = true,
2849 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2850 .pin_data = &mmc_slot_pin_data[SDCC3],
2851#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2852 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2853 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2854 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2855#endif
2856 .xpc_cap = 1,
2857 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2858 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302859 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002860};
2861#endif
2862
2863static void __init msm8960_init_mmc(void)
2864{
2865#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2866 /* SDC1 : eMMC card connected */
2867 msm_add_sdcc(1, &msm8960_sdc1_data);
2868#endif
2869#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2870 /* SDC3: External card slot */
2871 msm_add_sdcc(3, &msm8960_sdc3_data);
2872#endif
2873}
2874
2875static void __init msm8960_init_buses(void)
2876{
2877#ifdef CONFIG_MSM_BUS_SCALING
2878 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2879 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2880 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2881 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2882 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2883 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2884 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2885 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2886 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2887 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002888 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002889#endif
2890}
2891
2892static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2893 .max_clock_speed = 15060000,
2894};
2895
2896#ifdef CONFIG_USB_MSM_OTG_72K
2897static struct msm_otg_platform_data msm_otg_pdata;
2898#else
2899#define USB_5V_EN 42
2900static void msm_hsusb_vbus_power(bool on)
2901{
2902 int rc;
2903 static bool vbus_is_on;
2904 static struct regulator *mvs_otg_switch;
2905 struct pm_gpio param = {
2906 .direction = PM_GPIO_DIR_OUT,
2907 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2908 .output_value = 1,
2909 .pull = PM_GPIO_PULL_NO,
2910 .vin_sel = PM_GPIO_VIN_S4,
2911 .out_strength = PM_GPIO_STRENGTH_MED,
2912 .function = PM_GPIO_FUNC_NORMAL,
2913 };
2914
2915 if (vbus_is_on == on)
2916 return;
2917
2918 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002919 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2920 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002921 if (IS_ERR(mvs_otg_switch)) {
2922 pr_err("Unable to get mvs_otg_switch\n");
2923 return;
2924 }
2925
2926 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2927 "usb_5v_en");
2928 if (rc < 0) {
2929 pr_err("failed to request usb_5v_en gpio\n");
2930 goto put_mvs_otg;
2931 }
2932
2933 if (regulator_enable(mvs_otg_switch)) {
2934 pr_err("unable to enable mvs_otg_switch\n");
2935 goto free_usb_5v_en;
2936 }
2937
2938 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2939 &param);
2940 if (rc < 0) {
2941 pr_err("failed to configure usb_5v_en gpio\n");
2942 goto disable_mvs_otg;
2943 }
2944 vbus_is_on = true;
2945 return;
2946 }
2947disable_mvs_otg:
2948 regulator_disable(mvs_otg_switch);
2949free_usb_5v_en:
2950 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2951put_mvs_otg:
2952 regulator_put(mvs_otg_switch);
2953 vbus_is_on = false;
2954}
2955
2956static struct msm_otg_platform_data msm_otg_pdata = {
2957 .mode = USB_OTG,
2958 .otg_control = OTG_PMIC_CONTROL,
2959 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2960 .pclk_src_name = "dfab_usb_hs_clk",
2961 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2962 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302963 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002964};
2965#endif
2966
2967#define PID_MAGIC_ID 0x71432909
2968#define SERIAL_NUM_MAGIC_ID 0x61945374
2969#define SERIAL_NUMBER_LENGTH 127
2970#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2971
2972struct magic_num_struct {
2973 uint32_t pid;
2974 uint32_t serial_num;
2975};
2976
2977struct dload_struct {
2978 uint32_t reserved1;
2979 uint32_t reserved2;
2980 uint32_t reserved3;
2981 uint16_t reserved4;
2982 uint16_t pid;
2983 char serial_number[SERIAL_NUMBER_LENGTH];
2984 uint16_t reserved5;
2985 struct magic_num_struct magic_struct;
2986};
2987
2988static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2989{
2990 struct dload_struct __iomem *dload = 0;
2991
2992 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2993 if (!dload) {
2994 pr_err("%s: cannot remap I/O memory region: %08x\n",
2995 __func__, DLOAD_USB_BASE_ADD);
2996 return -ENXIO;
2997 }
2998
2999 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3000 __func__, dload, pid, snum);
3001 /* update pid */
3002 dload->magic_struct.pid = PID_MAGIC_ID;
3003 dload->pid = pid;
3004
3005 /* update serial number */
3006 dload->magic_struct.serial_num = 0;
3007 if (!snum) {
3008 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3009 goto out;
3010 }
3011
3012 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
3013 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
3014 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
3015out:
3016 iounmap(dload);
3017 return 0;
3018}
3019
3020static struct android_usb_platform_data android_usb_pdata = {
3021 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3022};
3023
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003024static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003025 .name = "android_usb",
3026 .id = -1,
3027 .dev = {
3028 .platform_data = &android_usb_pdata,
3029 },
3030};
3031
3032static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3033 0x03, 0x0f,
3034};
3035
3036static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3037 0x00, 0x24, 0x54, 0x10,
3038 0x09, 0x03, 0x01,
3039 0x10, 0x54, 0x30, 0x0C,
3040 0x24, 0x30, 0x0f,
3041};
3042
3043static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3044 0x00, 0x24, 0x54, 0x10,
3045 0x09, 0x07, 0x01, 0x0B,
3046 0x10, 0x54, 0x30, 0x0C,
3047 0x24, 0x30, 0x0f,
3048};
3049
3050static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3051 [0] = {
3052 .mode = MSM_SPM_MODE_CLOCK_GATING,
3053 .notify_rpm = false,
3054 .cmd = spm_wfi_cmd_sequence,
3055 },
3056 [1] = {
3057 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3058 .notify_rpm = false,
3059 .cmd = spm_power_collapse_without_rpm,
3060 },
3061 [2] = {
3062 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3063 .notify_rpm = true,
3064 .cmd = spm_power_collapse_with_rpm,
3065 },
3066};
3067
3068static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3069 [0] = {
3070 .reg_base_addr = MSM_SAW0_BASE,
3071 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3072 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3073 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3074#if defined(CONFIG_MSM_AVS_HW)
3075 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3076 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3077#endif
3078 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3079 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3080 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3081 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3082 .vctl_timeout_us = 50,
3083 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3084 .modes = msm_spm_seq_list,
3085 },
3086 [1] = {
3087 .reg_base_addr = MSM_SAW1_BASE,
3088 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3089 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3090 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3091#if defined(CONFIG_MSM_AVS_HW)
3092 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3093 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3094#endif
3095 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3096 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3097 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3098 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3099 .vctl_timeout_us = 50,
3100 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3101 .modes = msm_spm_seq_list,
3102 },
3103};
3104
3105static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3106 0x00, 0x20, 0x03, 0x20,
3107 0x00, 0x0f,
3108};
3109
3110static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3111 0x00, 0x20, 0x34, 0x64,
3112 0x48, 0x07, 0x48, 0x20,
3113 0x50, 0x64, 0x04, 0x34,
3114 0x50, 0x0f,
3115};
3116static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3117 0x00, 0x10, 0x34, 0x64,
3118 0x48, 0x07, 0x48, 0x10,
3119 0x50, 0x64, 0x04, 0x34,
3120 0x50, 0x0F,
3121};
3122
3123static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3124 [0] = {
3125 .mode = MSM_SPM_L2_MODE_RETENTION,
3126 .notify_rpm = false,
3127 .cmd = l2_spm_wfi_cmd_sequence,
3128 },
3129 [1] = {
3130 .mode = MSM_SPM_L2_MODE_GDHS,
3131 .notify_rpm = true,
3132 .cmd = l2_spm_gdhs_cmd_sequence,
3133 },
3134 [2] = {
3135 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3136 .notify_rpm = true,
3137 .cmd = l2_spm_power_off_cmd_sequence,
3138 },
3139};
3140
3141
3142static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3143 [0] = {
3144 .reg_base_addr = MSM_SAW_L2_BASE,
3145 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3146 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3147 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3148 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3149 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3150 .modes = msm_spm_l2_seq_list,
3151 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3152 },
3153};
3154
3155#define CYTTSP_TS_GPIO_IRQ 11
3156#define CYTTSP_TS_SLEEP_GPIO 50
3157#define CYTTSP_TS_RESOUT_N_GPIO 52
3158
3159/*virtual key support */
3160static ssize_t tma340_vkeys_show(struct kobject *kobj,
3161 struct kobj_attribute *attr, char *buf)
3162{
3163 return snprintf(buf, 200,
3164 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3165 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3166 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3167 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3168 "\n");
3169}
3170
3171static struct kobj_attribute tma340_vkeys_attr = {
3172 .attr = {
3173 .mode = S_IRUGO,
3174 },
3175 .show = &tma340_vkeys_show,
3176};
3177
3178static struct attribute *tma340_properties_attrs[] = {
3179 &tma340_vkeys_attr.attr,
3180 NULL
3181};
3182
3183static struct attribute_group tma340_properties_attr_group = {
3184 .attrs = tma340_properties_attrs,
3185};
3186
3187
3188static int cyttsp_platform_init(struct i2c_client *client)
3189{
3190 int rc = 0;
3191 static struct kobject *tma340_properties_kobj;
3192
3193 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3194 tma340_properties_kobj = kobject_create_and_add("board_properties",
3195 NULL);
3196 if (tma340_properties_kobj)
3197 rc = sysfs_create_group(tma340_properties_kobj,
3198 &tma340_properties_attr_group);
3199 if (!tma340_properties_kobj || rc)
3200 pr_err("%s: failed to create board_properties\n",
3201 __func__);
3202
3203 return 0;
3204}
3205
3206static struct cyttsp_regulator regulator_data[] = {
3207 {
3208 .name = "vdd",
3209 .min_uV = CY_TMA300_VTG_MIN_UV,
3210 .max_uV = CY_TMA300_VTG_MAX_UV,
3211 .load_uA = CY_TMA300_CURR_24HZ_UA,
3212 },
3213 /* TODO: Remove after runtime PM is enabled in I2C driver */
3214 {
3215 .name = "vcc_i2c",
3216 .min_uV = CY_I2C_VTG_MIN_UV,
3217 .max_uV = CY_I2C_VTG_MAX_UV,
3218 .load_uA = CY_I2C_CURR_UA,
3219 },
3220};
3221
3222static struct cyttsp_platform_data cyttsp_pdata = {
3223 .panel_maxx = 634,
3224 .panel_maxy = 1166,
3225 .disp_maxx = 616,
3226 .disp_maxy = 1023,
3227 .disp_minx = 0,
3228 .disp_miny = 16,
3229 .flags = 0x01,
3230 .gen = CY_GEN3, /* or */
3231 .use_st = CY_USE_ST,
3232 .use_mt = CY_USE_MT,
3233 .use_hndshk = CY_SEND_HNDSHK,
3234 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303235 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003236 .use_gestures = CY_USE_GESTURES,
3237 .fw_fname = "cyttsp_8960_cdp.hex",
3238 /* activate up to 4 groups
3239 * and set active distance
3240 */
3241 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3242 CY_GEST_GRP3 | CY_GEST_GRP4 |
3243 CY_ACT_DIST,
3244 /* change act_intrvl to customize the Active power state
3245 * scanning/processing refresh interval for Operating mode
3246 */
3247 .act_intrvl = CY_ACT_INTRVL_DFLT,
3248 /* change tch_tmout to customize the touch timeout for the
3249 * Active power state for Operating mode
3250 */
3251 .tch_tmout = CY_TCH_TMOUT_DFLT,
3252 /* change lp_intrvl to customize the Low Power power state
3253 * scanning/processing refresh interval for Operating mode
3254 */
3255 .lp_intrvl = CY_LP_INTRVL_DFLT,
3256 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3257 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3258 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3259 .regulator_info = regulator_data,
3260 .num_regulators = ARRAY_SIZE(regulator_data),
3261 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303262 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003263};
3264
3265static struct i2c_board_info cyttsp_info[] __initdata = {
3266 {
3267 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3268 .platform_data = &cyttsp_pdata,
3269#ifndef CY_USE_TIMER
3270 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3271#endif /* CY_USE_TIMER */
3272 },
3273};
3274
Mohan Pallaka50837382011-09-07 11:00:57 +05303275/* configuration data */
3276static const u8 mxt_config_data[] = {
3277 /* T6 Object */
3278 0, 0, 0, 0, 0, 0,
3279 /* T38 Object */
3280 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3286 0, 0, 0, 0,
3287 /* T7 Object */
3288 10, 10, 50,
3289 /* T8 Object */
3290 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3291 /* T9 Object */
3292 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3293 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3294 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3295 0, 5, 45, 46,
3296 /* T15 Object */
3297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3298 0,
3299 /* T22 Object */
3300 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3301 0, 0, 255, 255, 255, 255, 0,
3302 /* T24 Object */
3303 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3304 0, 0, 0, 0, 0, 0, 0, 0, 0,
3305 /* T25 Object */
3306 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3307 0, 0, 0, 0,
3308 /* T27 Object */
3309 0, 0, 0, 0, 0, 0, 0,
3310 /* T28 Object */
3311 0, 0, 0, 8, 8, 8,
3312 /* T40 Object */
3313 0, 0, 0, 0, 0,
3314 /* T41 Object */
3315 0, 0, 0, 0, 0, 0,
3316 /* T43 Object */
3317 0, 0, 0, 0, 0, 0,
3318};
3319
3320#define MXT_TS_GPIO_IRQ 11
3321#define MXT_TS_LDO_EN_GPIO 50
3322#define MXT_TS_RESET_GPIO 52
3323
3324static void mxt_init_hw_liquid(void)
3325{
3326 int rc;
3327
3328 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3329 if (rc) {
3330 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3331 __func__, MXT_TS_GPIO_IRQ);
3332 return;
3333 }
3334
3335 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3336 if (rc) {
3337 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3338 __func__, MXT_TS_GPIO_IRQ);
3339 goto err_irq_gpio_req;
3340 }
3341
3342 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3343 if (rc) {
3344 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3345 __func__, MXT_TS_LDO_EN_GPIO);
3346 goto err_irq_gpio_req;
3347 }
3348
3349 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3350 if (rc) {
3351 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3352 __func__, MXT_TS_LDO_EN_GPIO);
3353 goto err_ldo_gpio_req;
3354 }
3355
3356 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3357 if (rc) {
3358 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3359 __func__, MXT_TS_RESET_GPIO);
3360 goto err_ldo_gpio_set_dir;
3361 }
3362
3363 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3364 if (rc) {
3365 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3366 __func__, MXT_TS_RESET_GPIO);
3367 goto err_reset_gpio_req;
3368 }
3369
3370 return;
3371
3372err_reset_gpio_req:
3373 gpio_free(MXT_TS_RESET_GPIO);
3374err_ldo_gpio_set_dir:
3375 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3376err_ldo_gpio_req:
3377 gpio_free(MXT_TS_LDO_EN_GPIO);
3378err_irq_gpio_req:
3379 gpio_free(MXT_TS_GPIO_IRQ);
3380}
3381
3382static struct mxt_platform_data mxt_platform_data = {
3383 .config = mxt_config_data,
3384 .config_length = ARRAY_SIZE(mxt_config_data),
3385 .x_line = 26,
3386 .y_line = 42,
3387 .x_size = 767,
3388 .y_size = 1365,
3389 .blen = 32,
3390 .threshold = 40,
3391 .voltage = 3300000, /* 3.3V */
3392 .orient = MXT_ROTATED_90,
3393 .irqflags = IRQF_TRIGGER_FALLING,
3394};
3395
3396static struct i2c_board_info mxt_device_info[] __initdata = {
3397 {
3398 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3399 .platform_data = &mxt_platform_data,
3400 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3401 },
3402};
3403
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003404static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3405{
3406}
3407
3408static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3409 .clk_freq = 100000,
3410 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003411 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3412};
3413
3414static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3415 .clk_freq = 100000,
3416 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003417 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3418};
3419
3420static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3421 .clk_freq = 100000,
3422 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003423 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3424};
3425
3426static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3427 .clk_freq = 100000,
3428 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003429 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3430};
3431
3432static struct msm_rpm_platform_data msm_rpm_data = {
3433 .reg_base_addrs = {
3434 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3435 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3436 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3437 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3438 },
3439
3440 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3441 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3442 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3443 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3444 .msm_apps_ipc_rpm_val = 4,
3445};
3446
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003447static struct ks8851_pdata spi_eth_pdata = {
3448 .irq_gpio = KS8851_IRQ_GPIO,
3449 .rst_gpio = KS8851_RST_GPIO,
3450};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003451
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003452static struct spi_board_info spi_board_info[] __initdata = {
3453 {
3454 .modalias = "ks8851",
3455 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3456 .max_speed_hz = 19200000,
3457 .bus_num = 0,
3458 .chip_select = 0,
3459 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003460 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003461 },
3462};
3463
3464static struct platform_device msm_device_saw_core0 = {
3465 .name = "saw-regulator",
3466 .id = 0,
3467 .dev = {
3468 .platform_data = &msm_saw_regulator_pdata_s5,
3469 },
3470};
3471
3472static struct platform_device msm_device_saw_core1 = {
3473 .name = "saw-regulator",
3474 .id = 1,
3475 .dev = {
3476 .platform_data = &msm_saw_regulator_pdata_s6,
3477 },
3478};
3479
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003480static struct tsens_platform_data msm_tsens_pdata = {
3481 .slope = 910,
3482 .tsens_factor = 1000,
3483 .hw_type = MSM_8960,
3484 .tsens_num_sensor = 5,
3485};
3486
3487static struct platform_device msm_tsens_device = {
3488 .name = "tsens8960-tm",
3489 .id = -1,
3490 .dev = {
3491 .platform_data = &msm_tsens_pdata,
3492 },
3493};
3494
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003495#ifdef CONFIG_MSM_FAKE_BATTERY
3496static struct platform_device fish_battery_device = {
3497 .name = "fish_battery",
3498};
3499#endif
3500
David Collins26f05562011-06-20 09:56:28 -07003501static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003502 .name = GPIO_REGULATOR_DEV_NAME,
3503 .id = PM8921_MPP_PM_TO_SYS(7),
3504 .dev = {
3505 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3506 },
3507};
3508
David Collins26f05562011-06-20 09:56:28 -07003509static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003510 .name = GPIO_REGULATOR_DEV_NAME,
3511 .id = 91,
3512 .dev = {
3513 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3514 },
3515};
3516
David Collinsb10be1d2011-09-02 10:29:31 -07003517static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3518 .name = GPIO_REGULATOR_DEV_NAME,
3519 .id = PM8921_GPIO_PM_TO_SYS(17),
3520 .dev = {
3521 .platform_data =
3522 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3523 },
3524};
3525
David Collins26f05562011-06-20 09:56:28 -07003526static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3527 .name = "rpm-regulator",
3528 .id = -1,
3529 .dev = {
3530 .platform_data = &msm_rpm_regulator_pdata,
3531 },
3532};
3533
David Collins4c31a872011-08-31 10:07:10 -07003534static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3535 .phys_addr_base = 0x0010C000,
3536 .reg_offsets = {
3537 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3538 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3539 },
3540 .phys_size = SZ_8K,
3541 .log_len = 4096, /* log's buffer length in bytes */
3542 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3543};
3544
3545static struct platform_device msm_rpm_log_device = {
3546 .name = "msm_rpm_log",
3547 .id = -1,
3548 .dev = {
3549 .platform_data = &msm_rpm_log_pdata,
3550 },
3551};
3552
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003553static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003554 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003555 &msm_device_smd,
3556 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303557 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003558 &msm_device_saw_core0,
3559 &msm_device_saw_core1,
3560 &msm8960_device_ext_5v_vreg,
3561 &msm8960_device_ext_l2_vreg,
3562 &msm8960_device_ssbi_pm8921,
3563 &msm8960_device_qup_spi_gsbi1,
3564 &msm8960_device_qup_i2c_gsbi3,
3565 &msm8960_device_qup_i2c_gsbi4,
3566 &msm8960_device_qup_i2c_gsbi10,
3567#ifndef CONFIG_MSM_DSPS
3568 &msm8960_device_qup_i2c_gsbi12,
3569#endif
3570 &msm_slim_ctrl,
3571 &msm_device_wcnss_wlan,
3572#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3573 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3574 &qcrypto_device,
3575#endif
3576
3577#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3578 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3579 &qcedev_device,
3580#endif
3581#ifdef CONFIG_MSM_ROTATOR
3582 &msm_rotator_device,
3583#endif
3584 &msm_device_sps,
3585#ifdef CONFIG_MSM_FAKE_BATTERY
3586 &fish_battery_device,
3587#endif
3588#ifdef CONFIG_ANDROID_PMEM
3589 &android_pmem_device,
3590 &android_pmem_adsp_device,
3591 &android_pmem_audio_device,
3592#endif
3593 &msm_fb_device,
3594 &msm_device_vidc,
3595 &msm_device_bam_dmux,
3596 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003597
3598#ifdef CONFIG_HW_RANDOM_MSM
3599 &msm_device_rng,
3600#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003601 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003602#ifdef CONFIG_ION_MSM
3603 &ion_dev,
3604#endif
David Collins4c31a872011-08-31 10:07:10 -07003605 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003606#ifdef CONFIG_MSM_QDSS
3607 &msm_etb_device,
3608 &msm_tpiu_device,
3609 &msm_funnel_device,
3610 &msm_ptm_device,
3611#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003612 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003613};
3614
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003615static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003616 &msm8960_device_otg,
3617 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003618 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303619 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003620 &android_usb_device,
3621 &msm_device_vidc,
3622 &mipi_dsi_simulator_panel_device,
3623 &msm_bus_apps_fabric,
3624 &msm_bus_sys_fabric,
3625 &msm_bus_mm_fabric,
3626 &msm_bus_sys_fpb,
3627 &msm_bus_cpss_fpb,
3628 &msm_pcm,
3629 &msm_pcm_routing,
3630 &msm_cpudai0,
3631 &msm_cpudai1,
3632 &msm_cpudai_hdmi_rx,
3633 &msm_cpudai_bt_rx,
3634 &msm_cpudai_bt_tx,
3635 &msm_cpudai_fm_rx,
3636 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003637 &msm_cpudai_auxpcm_rx,
3638 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003639 &msm_cpu_fe,
3640 &msm_stub_codec,
3641 &msm_voice,
3642 &msm_voip,
3643 &msm_lpa_pcm,
3644
3645#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3646 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3647 &qcrypto_device,
3648#endif
3649
3650#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3651 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3652 &qcedev_device,
3653#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003654};
3655
3656static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003657 &msm_kgsl_3d0,
3658 &msm_kgsl_2d0,
3659 &msm_kgsl_2d1,
3660 &mipi_dsi_renesas_panel_device,
3661#ifdef CONFIG_MSM_GEMINI
3662 &msm8960_gemini_device,
3663#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003664};
3665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003666static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003667 &msm8960_device_otg,
3668 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003669 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303670 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003671 &android_usb_device,
3672 &msm_pcm,
3673 &msm_pcm_routing,
3674 &msm_cpudai0,
3675 &msm_cpudai1,
3676 &msm_cpudai_hdmi_rx,
3677 &msm_cpudai_bt_rx,
3678 &msm_cpudai_bt_tx,
3679 &msm_cpudai_fm_rx,
3680 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003681 &msm_cpudai_auxpcm_rx,
3682 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003683 &msm_cpu_fe,
3684 &msm_stub_codec,
3685 &msm_kgsl_3d0,
3686#ifdef CONFIG_MSM_KGSL_2D
3687 &msm_kgsl_2d0,
3688 &msm_kgsl_2d1,
3689#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003690 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003691#ifdef CONFIG_MSM_GEMINI
3692 &msm8960_gemini_device,
3693#endif
3694 &msm_voice,
3695 &msm_voip,
3696 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303697 &msm_cpudai_afe_01_rx,
3698 &msm_cpudai_afe_01_tx,
3699 &msm_cpudai_afe_02_rx,
3700 &msm_cpudai_afe_02_tx,
3701 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003702#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3703 &hdmi_msm_device,
3704#endif
3705 &msm_pcm_hostless,
3706 &msm_bus_apps_fabric,
3707 &msm_bus_sys_fabric,
3708 &msm_bus_mm_fabric,
3709 &msm_bus_sys_fpb,
3710 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003711 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003712};
3713
3714static void __init msm8960_i2c_init(void)
3715{
3716 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3717 &msm8960_i2c_qup_gsbi4_pdata;
3718
3719 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3720 &msm8960_i2c_qup_gsbi3_pdata;
3721
3722 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3723 &msm8960_i2c_qup_gsbi10_pdata;
3724
3725 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3726 &msm8960_i2c_qup_gsbi12_pdata;
3727}
3728
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003729static void __init msm8960_gfx_init(void)
3730{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003731 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003732 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3733 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3734 msm_kgsl_3d0.dev.platform_data;
3735 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3736 320000000;
3737 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3738 266667000;
3739 }
3740}
3741
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003742static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3743 .irq_base = PM8921_IRQ_BASE,
3744 .devirq = MSM_GPIO_TO_INT(104),
3745 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3746};
3747
3748static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3749 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3750};
3751
3752static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3753 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3754};
3755
3756static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3757 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303758 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003759};
3760
3761static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3762 .pull_up = 1,
3763 .kpd_trigger_delay_us = 970,
3764 .wakeup = 1,
3765};
3766
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303767/* Rotate lock key is not available so use F1 */
3768#define KEY_ROTATE_LOCK KEY_F1
3769
3770static const unsigned int keymap_liquid[] = {
3771 KEY(0, 0, KEY_VOLUMEUP),
3772 KEY(0, 1, KEY_VOLUMEDOWN),
3773 KEY(1, 3, KEY_ROTATE_LOCK),
3774 KEY(1, 4, KEY_HOME),
3775};
3776
3777static struct matrix_keymap_data keymap_data_liquid = {
3778 .keymap_size = ARRAY_SIZE(keymap_liquid),
3779 .keymap = keymap_liquid,
3780};
3781
3782static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3783 .input_name = "keypad_8960_liquid",
3784 .input_phys_device = "keypad_8960/input0",
3785 .num_rows = 2,
3786 .num_cols = 5,
3787 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3788 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3789 .debounce_ms = 15,
3790 .scan_delay_ms = 32,
3791 .row_hold_ns = 91500,
3792 .wakeup = 1,
3793 .keymap_data = &keymap_data_liquid,
3794};
3795
3796
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003797static const unsigned int keymap[] = {
3798 KEY(0, 0, KEY_VOLUMEUP),
3799 KEY(0, 1, KEY_VOLUMEDOWN),
3800 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3801 KEY(0, 3, KEY_CAMERA_FOCUS),
3802};
3803
3804static struct matrix_keymap_data keymap_data = {
3805 .keymap_size = ARRAY_SIZE(keymap),
3806 .keymap = keymap,
3807};
3808
3809static struct pm8xxx_keypad_platform_data keypad_data = {
3810 .input_name = "keypad_8960",
3811 .input_phys_device = "keypad_8960/input0",
3812 .num_rows = 1,
3813 .num_cols = 5,
3814 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3815 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3816 .debounce_ms = 15,
3817 .scan_delay_ms = 32,
3818 .row_hold_ns = 91500,
3819 .wakeup = 1,
3820 .keymap_data = &keymap_data,
3821};
3822
3823static const unsigned int keymap_sim[] = {
3824 KEY(0, 0, KEY_7),
3825 KEY(0, 1, KEY_DOWN),
3826 KEY(0, 2, KEY_UP),
3827 KEY(0, 3, KEY_RIGHT),
3828 KEY(0, 4, KEY_ENTER),
3829 KEY(0, 5, KEY_L),
3830 KEY(0, 6, KEY_BACK),
3831 KEY(0, 7, KEY_M),
3832
3833 KEY(1, 0, KEY_LEFT),
3834 KEY(1, 1, KEY_SEND),
3835 KEY(1, 2, KEY_1),
3836 KEY(1, 3, KEY_4),
3837 KEY(1, 4, KEY_CLEAR),
3838 KEY(1, 5, KEY_MSDOS),
3839 KEY(1, 6, KEY_SPACE),
3840 KEY(1, 7, KEY_COMMA),
3841
3842 KEY(2, 0, KEY_6),
3843 KEY(2, 1, KEY_5),
3844 KEY(2, 2, KEY_8),
3845 KEY(2, 3, KEY_3),
3846 KEY(2, 4, KEY_NUMERIC_STAR),
3847 KEY(2, 5, KEY_UP),
3848 KEY(2, 6, KEY_DOWN),
3849 KEY(2, 7, KEY_LEFTSHIFT),
3850
3851 KEY(3, 0, KEY_9),
3852 KEY(3, 1, KEY_NUMERIC_POUND),
3853 KEY(3, 2, KEY_0),
3854 KEY(3, 3, KEY_2),
3855 KEY(3, 4, KEY_SLEEP),
3856 KEY(3, 5, KEY_F1),
3857 KEY(3, 6, KEY_F2),
3858 KEY(3, 7, KEY_F3),
3859
3860 KEY(4, 0, KEY_BACK),
3861 KEY(4, 1, KEY_HOME),
3862 KEY(4, 2, KEY_MENU),
3863 KEY(4, 3, KEY_VOLUMEUP),
3864 KEY(4, 4, KEY_VOLUMEDOWN),
3865 KEY(4, 5, KEY_F4),
3866 KEY(4, 6, KEY_F5),
3867 KEY(4, 7, KEY_F6),
3868
3869 KEY(5, 0, KEY_R),
3870 KEY(5, 1, KEY_T),
3871 KEY(5, 2, KEY_Y),
3872 KEY(5, 3, KEY_LEFTALT),
3873 KEY(5, 4, KEY_KPENTER),
3874 KEY(5, 5, KEY_Q),
3875 KEY(5, 6, KEY_W),
3876 KEY(5, 7, KEY_E),
3877
3878 KEY(6, 0, KEY_F),
3879 KEY(6, 1, KEY_G),
3880 KEY(6, 2, KEY_H),
3881 KEY(6, 3, KEY_CAPSLOCK),
3882 KEY(6, 4, KEY_PAGEUP),
3883 KEY(6, 5, KEY_A),
3884 KEY(6, 6, KEY_S),
3885 KEY(6, 7, KEY_D),
3886
3887 KEY(7, 0, KEY_V),
3888 KEY(7, 1, KEY_B),
3889 KEY(7, 2, KEY_N),
3890 KEY(7, 3, KEY_MENU),
3891 KEY(7, 4, KEY_PAGEDOWN),
3892 KEY(7, 5, KEY_Z),
3893 KEY(7, 6, KEY_X),
3894 KEY(7, 7, KEY_C),
3895
3896 KEY(8, 0, KEY_P),
3897 KEY(8, 1, KEY_J),
3898 KEY(8, 2, KEY_K),
3899 KEY(8, 3, KEY_INSERT),
3900 KEY(8, 4, KEY_LINEFEED),
3901 KEY(8, 5, KEY_U),
3902 KEY(8, 6, KEY_I),
3903 KEY(8, 7, KEY_O),
3904
3905 KEY(9, 0, KEY_4),
3906 KEY(9, 1, KEY_5),
3907 KEY(9, 2, KEY_6),
3908 KEY(9, 3, KEY_7),
3909 KEY(9, 4, KEY_8),
3910 KEY(9, 5, KEY_1),
3911 KEY(9, 6, KEY_2),
3912 KEY(9, 7, KEY_3),
3913
3914 KEY(10, 0, KEY_F7),
3915 KEY(10, 1, KEY_F8),
3916 KEY(10, 2, KEY_F9),
3917 KEY(10, 3, KEY_F10),
3918 KEY(10, 4, KEY_FN),
3919 KEY(10, 5, KEY_9),
3920 KEY(10, 6, KEY_0),
3921 KEY(10, 7, KEY_DOT),
3922
3923 KEY(11, 0, KEY_LEFTCTRL),
3924 KEY(11, 1, KEY_F11),
3925 KEY(11, 2, KEY_ENTER),
3926 KEY(11, 3, KEY_SEARCH),
3927 KEY(11, 4, KEY_DELETE),
3928 KEY(11, 5, KEY_RIGHT),
3929 KEY(11, 6, KEY_LEFT),
3930 KEY(11, 7, KEY_RIGHTSHIFT),
3931 KEY(0, 0, KEY_VOLUMEUP),
3932 KEY(0, 1, KEY_VOLUMEDOWN),
3933 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3934 KEY(0, 3, KEY_CAMERA_FOCUS),
3935};
3936
3937static struct matrix_keymap_data keymap_data_sim = {
3938 .keymap_size = ARRAY_SIZE(keymap_sim),
3939 .keymap = keymap_sim,
3940};
3941
3942static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3943 .input_name = "keypad_8960",
3944 .input_phys_device = "keypad_8960/input0",
3945 .num_rows = 12,
3946 .num_cols = 8,
3947 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3948 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3949 .debounce_ms = 15,
3950 .scan_delay_ms = 32,
3951 .row_hold_ns = 91500,
3952 .wakeup = 1,
3953 .keymap_data = &keymap_data_sim,
3954};
3955
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003956static int pm8921_therm_mitigation[] = {
3957 1100,
3958 700,
3959 600,
3960 325,
3961};
3962
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003963static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003964 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003965 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003966 .max_voltage = 4200,
3967 .min_voltage = 3200,
3968 .resume_voltage = 4100,
3969 .term_current = 100,
3970 .cool_temp = 10,
3971 .warm_temp = 40,
3972 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003973 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003974 .cool_bat_chg_current = 350,
3975 .warm_bat_chg_current = 350,
3976 .cool_bat_voltage = 4100,
3977 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003978 .thermal_mitigation = pm8921_therm_mitigation,
3979 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003980};
3981
3982static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3983 .priority = 0,
3984};
3985
3986static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3987 .r_sense = 10,
3988 .i_test = 2500,
3989 .v_failure = 3000,
3990 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003991};
3992
Jay Chokshide4cefb2011-08-04 18:10:44 -07003993#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3994
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003995static struct led_info pm8921_led_info[] = {
3996 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003997 .name = "led:usb",
3998 .default_trigger = "usb-online",
Jay Chokshide4cefb2011-08-04 18:10:44 -07003999 },
4000 [1] = {
4001 .name = "led:ac",
4002 .default_trigger = "ac-online",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004003 },
4004};
4005
Jay Chokshi8994e392011-09-14 18:20:39 -07004006static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004007 .num_leds = ARRAY_SIZE(pm8921_led_info),
4008 .leds = pm8921_led_info,
4009};
4010
Jay Chokshi8994e392011-09-14 18:20:39 -07004011static struct pm8xxx_led_config pm8921_led_configs[] = {
4012 [0] = {
4013 .id = PM8XXX_ID_LED_0,
4014 .mode = PM8XXX_LED_MODE_MANUAL,
4015 .max_current = PM8921_LC_LED_MAX_CURRENT,
4016 },
4017 [1] = {
4018 .id = PM8XXX_ID_LED_1,
4019 .mode = PM8XXX_LED_MODE_MANUAL,
4020 .max_current = PM8921_LC_LED_MAX_CURRENT,
4021 },
4022};
4023
4024static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4025 .led_core = &pm8921_led_core_pdata,
4026 .configs = pm8921_led_configs,
4027 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4028};
4029
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004030static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4031 .irq_pdata = &pm8xxx_irq_pdata,
4032 .gpio_pdata = &pm8xxx_gpio_pdata,
4033 .mpp_pdata = &pm8xxx_mpp_pdata,
4034 .rtc_pdata = &pm8xxx_rtc_pdata,
4035 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4036 .keypad_pdata = &keypad_data,
4037 .misc_pdata = &pm8xxx_misc_pdata,
4038 .regulator_pdatas = msm_pm8921_regulator_pdata,
4039 .charger_pdata = &pm8921_chg_pdata,
4040 .bms_pdata = &pm8921_bms_pdata,
4041 .adc_pdata = &pm8921_adc_pdata,
4042 .leds_pdata = &pm8xxx_leds_pdata,
4043};
4044
4045static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4046 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4047 .slave = {
4048 .name = "pm8921-core",
4049 .platform_data = &pm8921_platform_data,
4050 },
4051};
4052
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004053#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
4054static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004055{
4056 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004057
4058 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
4059 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004060 pr_err("FPGA CS gpio_request failed: %d\n", ret);
4061 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004062 }
4063
4064 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004065
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004066 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004067fail:
4068 return ret;
4069}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004070#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004071static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004072{
4073 return 0;
4074}
4075#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004076
4077static struct msm_cpuidle_state msm_cstates[] __initdata = {
4078 {0, 0, "C0", "WFI",
4079 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4080
4081 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4082 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4083
4084 {0, 2, "C2", "POWER_COLLAPSE",
4085 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4086
4087 {1, 0, "C0", "WFI",
4088 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4089
4090 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4091 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4092};
4093
4094static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4095 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4096 .idle_supported = 1,
4097 .suspend_supported = 1,
4098 .idle_enabled = 0,
4099 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004100 },
4101
4102 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4103 .idle_supported = 1,
4104 .suspend_supported = 1,
4105 .idle_enabled = 0,
4106 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004107 },
4108
4109 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4110 .idle_supported = 1,
4111 .suspend_supported = 1,
4112 .idle_enabled = 1,
4113 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004114 },
4115
4116 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4117 .idle_supported = 0,
4118 .suspend_supported = 1,
4119 .idle_enabled = 0,
4120 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004121 },
4122
4123 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4124 .idle_supported = 1,
4125 .suspend_supported = 1,
4126 .idle_enabled = 0,
4127 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004128 },
4129
4130 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4131 .idle_supported = 1,
4132 .suspend_supported = 0,
4133 .idle_enabled = 1,
4134 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004135 },
4136};
4137
4138static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4139 {
4140 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4141 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4142 true,
4143 1, 8000, 100000, 1,
4144 },
4145
4146 {
4147 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4148 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4149 true,
4150 1500, 5000, 60100000, 3000,
4151 },
4152
4153 {
4154 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4155 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4156 false,
4157 1800, 5000, 60350000, 3500,
4158 },
4159
4160 {
4161 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4162 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4163 false,
4164 2800, 2500, 65350000, 4800,
4165 },
4166
4167 {
4168 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4169 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4170 false,
4171 3800, 4500, 67850000, 5500,
4172 },
4173
4174 {
4175 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4176 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4177 false,
4178 4800, 2000, 71850000, 6800,
4179 },
4180
4181 {
4182 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4183 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4184 false,
4185 6800, 500, 75850000, 8800,
4186 },
4187
4188 {
4189 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4190 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4191 false,
4192 7800, 0, 76350000, 9800,
4193 },
4194};
4195
4196#ifdef CONFIG_I2C
4197#define I2C_SURF 1
4198#define I2C_FFA (1 << 1)
4199#define I2C_RUMI (1 << 2)
4200#define I2C_SIM (1 << 3)
4201#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004202#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004203
4204struct i2c_registry {
4205 u8 machs;
4206 int bus;
4207 struct i2c_board_info *info;
4208 int len;
4209};
4210
4211#ifdef CONFIG_MSM_CAMERA
4212static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4213#ifdef CONFIG_IMX074
4214 {
4215 I2C_BOARD_INFO("imx074", 0x1A),
4216 },
4217#endif
4218#ifdef CONFIG_OV2720
4219 {
4220 I2C_BOARD_INFO("ov2720", 0x6C),
4221 },
4222#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004223 {
4224 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4225 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304226#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4227 {
4228 I2C_BOARD_INFO("sc628a", 0x6E),
4229 },
4230#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004231};
4232#endif
4233
4234/* Sensors DSPS platform data */
4235#ifdef CONFIG_MSM_DSPS
4236#define DSPS_PIL_GENERIC_NAME "dsps"
4237#endif /* CONFIG_MSM_DSPS */
4238
4239static void __init msm8960_init_dsps(void)
4240{
4241#ifdef CONFIG_MSM_DSPS
4242 struct msm_dsps_platform_data *pdata =
4243 msm_dsps_device.dev.platform_data;
4244 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4245 pdata->gpios = NULL;
4246 pdata->gpios_num = 0;
4247
4248 platform_device_register(&msm_dsps_device);
4249#endif /* CONFIG_MSM_DSPS */
4250}
4251
Amir Samuelov5137e392011-09-21 17:31:25 +03004252#ifdef CONFIG_ISL9519_CHARGER
4253static struct isl_platform_data isl_data __initdata = {
4254 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4255 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4256 .max_system_voltage = 4200,
4257 .min_system_voltage = 3200,
4258 .chgcurrent = 1000, /* 1900, */
4259 .term_current = 400, /* Need fine tuning */
4260 .input_current = 2048,
4261};
4262
4263static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4264 {
4265 I2C_BOARD_INFO("isl9519q", 0x9),
4266 .irq = 0, /* Not required when notify-by-pmic */
4267 .platform_data = &isl_data,
4268 },
4269};
4270#endif /* CONFIG_ISL9519_CHARGER */
4271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004272static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4273#ifdef CONFIG_MSM_CAMERA
4274 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004275 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004276 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4277 msm_camera_boardinfo,
4278 ARRAY_SIZE(msm_camera_boardinfo),
4279 },
4280#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004281#ifdef CONFIG_ISL9519_CHARGER
4282 {
4283 I2C_LIQUID,
4284 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4285 isl_charger_i2c_info,
4286 ARRAY_SIZE(isl_charger_i2c_info),
4287 },
4288#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004289 {
4290 I2C_SURF | I2C_FFA | I2C_FLUID,
4291 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4292 cyttsp_info,
4293 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004294 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304295 {
4296 I2C_LIQUID,
4297 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4298 mxt_device_info,
4299 ARRAY_SIZE(mxt_device_info),
4300 },
4301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004302};
4303#endif /* CONFIG_I2C */
4304
4305static void __init register_i2c_devices(void)
4306{
4307#ifdef CONFIG_I2C
4308 u8 mach_mask = 0;
4309 int i;
4310
4311 /* Build the matching 'supported_machs' bitmask */
4312 if (machine_is_msm8960_cdp())
4313 mach_mask = I2C_SURF;
4314 else if (machine_is_msm8960_rumi3())
4315 mach_mask = I2C_RUMI;
4316 else if (machine_is_msm8960_sim())
4317 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004318 else if (machine_is_msm8960_fluid())
4319 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004320 else if (machine_is_msm8960_liquid())
4321 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004322 else if (machine_is_msm8960_mtp())
4323 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004324 else
4325 pr_err("unmatched machine ID in register_i2c_devices\n");
4326
4327 /* Run the array and install devices as appropriate */
4328 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4329 if (msm8960_i2c_devices[i].machs & mach_mask)
4330 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4331 msm8960_i2c_devices[i].info,
4332 msm8960_i2c_devices[i].len);
4333 }
4334#endif
4335}
4336
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004337static void __init msm8960_sim_init(void)
4338{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004339 BUG_ON(msm_rpm_init(&msm_rpm_data));
4340 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4341 ARRAY_SIZE(msm_rpmrs_levels)));
4342 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004343 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004344 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004345 msm8960_device_ssbi_pm8921.dev.platform_data =
4346 &msm8960_ssbi_pm8921_pdata;
4347 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004348
4349 /* Simulator supports a QWERTY keypad */
4350 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4351
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004352 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4353 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4354 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004355 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356 msm8960_i2c_init();
4357 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4358 msm_spm_l2_init(msm_spm_l2_data);
4359 msm8960_init_buses();
4360 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4361 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004362 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004363 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004364
4365 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4366 &msm8960_qup_spi_gsbi1_pdata;
4367 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4368
4369 msm8960_init_mmc();
4370 msm_fb_add_devices();
4371 slim_register_board_info(msm_slim_devices,
4372 ARRAY_SIZE(msm_slim_devices));
4373 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4374 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4375 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4376 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004377}
4378
4379static void __init msm8960_rumi3_init(void)
4380{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004381 BUG_ON(msm_rpm_init(&msm_rpm_data));
4382 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4383 ARRAY_SIZE(msm_rpmrs_levels)));
4384 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004385 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004386 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004387 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004388 msm8960_device_ssbi_pm8921.dev.platform_data =
4389 &msm8960_ssbi_pm8921_pdata;
4390 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4391 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4392 &msm8960_qup_spi_gsbi1_pdata;
4393 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4394 msm8960_i2c_init();
4395 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4396 msm_spm_l2_init(msm_spm_l2_data);
4397 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4398 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004399 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004400 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004401 register_i2c_devices();
4402 msm_fb_add_devices();
4403 slim_register_board_info(msm_slim_devices,
4404 ARRAY_SIZE(msm_slim_devices));
4405 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4406 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4407 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4408 msm_pm_data);
4409}
4410
4411static void __init msm8960_cdp_init(void)
4412{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004413 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4414 pr_err("meminfo_init() failed!\n");
4415
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004416 BUG_ON(msm_rpm_init(&msm_rpm_data));
4417 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4418 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004419
4420 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004421 regulator_suppress_info_printing();
4422 if (msm_xo_init())
4423 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004424 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004425 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004426 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4427 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4428 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004429 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004430 if (machine_is_msm8960_cdp())
4431 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304432 if (machine_is_msm8960_liquid())
4433 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004434 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4435 &msm8960_qup_spi_gsbi1_pdata;
4436 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4437 msm8960_device_ssbi_pm8921.dev.platform_data =
4438 &msm8960_ssbi_pm8921_pdata;
4439 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4440 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004441 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004442 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4443 msm_spm_l2_init(msm_spm_l2_data);
4444 msm8960_init_buses();
4445 platform_add_devices(msm_footswitch_devices,
4446 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004447 if (machine_is_msm8960_liquid())
4448 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004449 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4450 pm8921_gpio_mpp_init();
4451 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4452 msm8960_init_cam();
4453 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004454 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304455 if (machine_is_msm8960_liquid())
4456 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004457 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004458 msm_fb_add_devices();
4459 slim_register_board_info(msm_slim_devices,
4460 ARRAY_SIZE(msm_slim_devices));
4461 msm8960_init_dsps();
4462 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4463 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4464 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4465 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004466 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004467}
4468
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004469MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4470 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004471 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004472 .init_irq = msm8960_init_irq,
4473 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004474 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004475 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004476MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004477
4478MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4479 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004480 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004481 .init_irq = msm8960_init_irq,
4482 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004483 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004484 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004485MACHINE_END
4486
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004487MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4488 .map_io = msm8960_map_io,
4489 .reserve = msm8960_reserve,
4490 .init_irq = msm8960_init_irq,
4491 .timer = &msm_timer,
4492 .init_machine = msm8960_cdp_init,
4493 .init_early = msm8960_allocate_memory_regions,
4494MACHINE_END
4495
4496MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4497 .map_io = msm8960_map_io,
4498 .reserve = msm8960_reserve,
4499 .init_irq = msm8960_init_irq,
4500 .timer = &msm_timer,
4501 .init_machine = msm8960_cdp_init,
4502 .init_early = msm8960_allocate_memory_regions,
4503MACHINE_END
4504
4505MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4506 .map_io = msm8960_map_io,
4507 .reserve = msm8960_reserve,
4508 .init_irq = msm8960_init_irq,
4509 .timer = &msm_timer,
4510 .init_machine = msm8960_cdp_init,
4511 .init_early = msm8960_allocate_memory_regions,
4512MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004513
4514MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4515 .map_io = msm8960_map_io,
4516 .reserve = msm8960_reserve,
4517 .init_irq = msm8960_init_irq,
4518 .timer = &msm_timer,
4519 .init_machine = msm8960_cdp_init,
4520 .init_early = msm8960_allocate_memory_regions,
4521MACHINE_END