blob: 1c277c80ead1e1c6c27d1927f1088fa1e5432f66 [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
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530236static struct gpiomux_setting gsbi3_suspended_cfg = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_2MA,
239 .pull = GPIOMUX_PULL_KEEPER,
240};
241
242static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700248static struct gpiomux_setting gsbi5 = {
249 .func = GPIOMUX_FUNC_1,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi10 = {
255 .func = GPIOMUX_FUNC_2,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting gsbi12 = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
266static struct gpiomux_setting cdc_mclk = {
267 .func = GPIOMUX_FUNC_1,
268 .drv = GPIOMUX_DRV_8MA,
269 .pull = GPIOMUX_PULL_NONE,
270};
271
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700272static struct gpiomux_setting audio_auxpcm[] = {
273 /* Suspended state */
274 {
275 .func = GPIOMUX_FUNC_GPIO,
276 .drv = GPIOMUX_DRV_2MA,
277 .pull = GPIOMUX_PULL_NONE,
278 },
279 /* Active state */
280 {
281 .func = GPIOMUX_FUNC_1,
282 .drv = GPIOMUX_DRV_2MA,
283 .pull = GPIOMUX_PULL_NONE,
284 },
285};
286
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700287#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288static struct gpiomux_setting gpio_eth_config = {
289 .pull = GPIOMUX_PULL_NONE,
290 .drv = GPIOMUX_DRV_8MA,
291 .func = GPIOMUX_FUNC_GPIO,
292};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700293#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700294
295static struct gpiomux_setting slimbus = {
296 .func = GPIOMUX_FUNC_1,
297 .drv = GPIOMUX_DRV_8MA,
298 .pull = GPIOMUX_PULL_KEEPER,
299};
300
301struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700302#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303 {
304 .gpio = KS8851_IRQ_GPIO,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
307 }
308 },
309 {
310 .gpio = KS8851_RST_GPIO,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
313 }
314 },
315 {
316 .gpio = FPGA_CS_GPIO,
317 .settings = {
318 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
319 }
320 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700321#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322};
323
324static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
325 {
326 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
327 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600328 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
329 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 },
331 },
332 {
333 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
334 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600335 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
336 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337 },
338 },
339 {
340 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
341 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600342 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
343 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344 },
345 },
346 {
347 .gpio = 9, /* GSBI1 QUP SPI_CLK */
348 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600349 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
350 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700351 },
352 },
353 {
354 .gpio = 16, /* GSBI3 I2C QUP SDA */
355 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530356 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
357 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 },
359 },
360 {
361 .gpio = 17, /* GSBI3 I2C QUP SCL */
362 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530363 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
364 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365 },
366 },
367 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700368 .gpio = 22, /* GSBI5 UART2 */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &gsbi5,
371 },
372 },
373 {
374 .gpio = 23, /* GSBI5 UART2 */
375 .settings = {
376 [GPIOMUX_SUSPENDED] = &gsbi5,
377 },
378 },
379 {
380 .gpio = 24, /* GSBI5 UART2 */
381 .settings = {
382 [GPIOMUX_SUSPENDED] = &gsbi5,
383 },
384 },
385 {
386 .gpio = 25, /* GSBI5 UART2 */
387 .settings = {
388 [GPIOMUX_SUSPENDED] = &gsbi5,
389 },
390 },
391 {
392 .gpio = 44, /* GSBI12 I2C QUP SDA */
393 .settings = {
394 [GPIOMUX_SUSPENDED] = &gsbi12,
395 },
396 },
397 {
398 .gpio = 45, /* GSBI12 I2C QUP SCL */
399 .settings = {
400 [GPIOMUX_SUSPENDED] = &gsbi12,
401 },
402 },
403 {
404 .gpio = 73, /* GSBI10 I2C QUP SDA */
405 .settings = {
406 [GPIOMUX_SUSPENDED] = &gsbi10,
407 },
408 },
409 {
410 .gpio = 74, /* GSBI10 I2C QUP SCL */
411 .settings = {
412 [GPIOMUX_SUSPENDED] = &gsbi10,
413 },
414 },
415};
416
417static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
418 {
419 .gpio = 60, /* slimbus data */
420 .settings = {
421 [GPIOMUX_SUSPENDED] = &slimbus,
422 },
423 },
424 {
425 .gpio = 61, /* slimbus clk */
426 .settings = {
427 [GPIOMUX_SUSPENDED] = &slimbus,
428 },
429 },
430};
431
432static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
433 {
434 .gpio = 59,
435 .settings = {
436 [GPIOMUX_SUSPENDED] = &cdc_mclk,
437 },
438 },
439};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700440
441static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
442 {
443 .gpio = 63,
444 .settings = {
445 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
446 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
447 },
448 },
449 {
450 .gpio = 64,
451 .settings = {
452 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
453 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
454 },
455 },
456 {
457 .gpio = 65,
458 .settings = {
459 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
460 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
461 },
462 },
463 {
464 .gpio = 66,
465 .settings = {
466 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
467 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
468 },
469 },
470};
471
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
473 .func = GPIOMUX_FUNC_GPIO,
474 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700475 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700476};
477
478static struct gpiomux_setting wcnss_5wire_active_cfg = {
479 .func = GPIOMUX_FUNC_1,
480 .drv = GPIOMUX_DRV_6MA,
481 .pull = GPIOMUX_PULL_DOWN,
482};
483
484static struct msm_gpiomux_config wcnss_5wire_interface[] = {
485 {
486 .gpio = 84,
487 .settings = {
488 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
489 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
490 },
491 },
492 {
493 .gpio = 85,
494 .settings = {
495 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
496 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
497 },
498 },
499 {
500 .gpio = 86,
501 .settings = {
502 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
503 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
504 },
505 },
506 {
507 .gpio = 87,
508 .settings = {
509 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
510 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
511 },
512 },
513 {
514 .gpio = 88,
515 .settings = {
516 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
517 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
518 },
519 },
520};
Nishant Pandit24153d82011-08-27 16:05:13 +0530521static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530522 {
523 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
524 .drv = GPIOMUX_DRV_2MA,
525 .pull = GPIOMUX_PULL_DOWN,
526 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527
Nishant Pandit474f2252011-07-23 23:17:56 +0530528 {
529 .func = GPIOMUX_FUNC_1, /*active 1*/
530 .drv = GPIOMUX_DRV_2MA,
531 .pull = GPIOMUX_PULL_NONE,
532 },
533
534 {
535 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
536 .drv = GPIOMUX_DRV_2MA,
537 .pull = GPIOMUX_PULL_NONE,
538 },
539
540 {
541 .func = GPIOMUX_FUNC_1, /*active 3*/
542 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700543 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530544 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530545
546 {
547 .func = GPIOMUX_FUNC_5, /*active 4*/
548 .drv = GPIOMUX_DRV_8MA,
549 .pull = GPIOMUX_PULL_UP,
550 },
551
552 {
553 .func = GPIOMUX_FUNC_6, /*active 5*/
554 .drv = GPIOMUX_DRV_8MA,
555 .pull = GPIOMUX_PULL_UP,
556 },
557
558 {
559 .func = GPIOMUX_FUNC_2, /*active 6*/
560 .drv = GPIOMUX_DRV_2MA,
561 .pull = GPIOMUX_PULL_UP,
562 },
563
564 {
565 .func = GPIOMUX_FUNC_3, /*active 7*/
566 .drv = GPIOMUX_DRV_8MA,
567 .pull = GPIOMUX_PULL_UP,
568 },
569
Kevin Chan4c58d292011-09-13 11:03:25 -0700570 {
571 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
572 .drv = GPIOMUX_DRV_2MA,
573 .pull = GPIOMUX_PULL_KEEPER,
574 },
575
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576};
577
Nishant Pandit24153d82011-08-27 16:05:13 +0530578static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579 {
580 .gpio = 2,
581 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530582 [GPIOMUX_ACTIVE] = &cam_settings[2],
583 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584 },
585 },
586 {
587 .gpio = 3,
588 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530589 [GPIOMUX_ACTIVE] = &cam_settings[1],
590 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591 },
592 },
593 {
594 .gpio = 4,
595 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530596 [GPIOMUX_ACTIVE] = &cam_settings[1],
597 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598 },
599 },
600 {
601 .gpio = 5,
602 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530603 [GPIOMUX_ACTIVE] = &cam_settings[1],
604 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700605 },
606 },
607 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530608 .gpio = 76,
609 .settings = {
610 [GPIOMUX_ACTIVE] = &cam_settings[2],
611 [GPIOMUX_SUSPENDED] = &cam_settings[0],
612 },
613 },
614 {
615 .gpio = 107,
616 .settings = {
617 [GPIOMUX_ACTIVE] = &cam_settings[2],
618 [GPIOMUX_SUSPENDED] = &cam_settings[0],
619 },
620 },
621};
622
623static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
624 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700625 .gpio = 18,
626 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530627 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700628 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700629 },
630 },
631 {
632 .gpio = 19,
633 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530634 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700635 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700636 },
637 },
638 {
639 .gpio = 20,
640 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530641 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700642 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643 },
644 },
645 {
646 .gpio = 21,
647 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530648 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700649 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650 },
651 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700652};
653
654static struct gpiomux_setting cyts_resout_sus_cfg = {
655 .func = GPIOMUX_FUNC_GPIO,
656 .drv = GPIOMUX_DRV_6MA,
657 .pull = GPIOMUX_PULL_UP,
658};
659
660static struct gpiomux_setting cyts_resout_act_cfg = {
661 .func = GPIOMUX_FUNC_GPIO,
662 .drv = GPIOMUX_DRV_6MA,
663 .pull = GPIOMUX_PULL_UP,
664};
665
666static struct gpiomux_setting cyts_sleep_sus_cfg = {
667 .func = GPIOMUX_FUNC_GPIO,
668 .drv = GPIOMUX_DRV_6MA,
669 .pull = GPIOMUX_PULL_DOWN,
670};
671
672static struct gpiomux_setting cyts_sleep_act_cfg = {
673 .func = GPIOMUX_FUNC_GPIO,
674 .drv = GPIOMUX_DRV_6MA,
675 .pull = GPIOMUX_PULL_DOWN,
676};
677
678static struct gpiomux_setting cyts_int_act_cfg = {
679 .func = GPIOMUX_FUNC_GPIO,
680 .drv = GPIOMUX_DRV_8MA,
681 .pull = GPIOMUX_PULL_UP,
682};
683
684static struct gpiomux_setting cyts_int_sus_cfg = {
685 .func = GPIOMUX_FUNC_GPIO,
686 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530687 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700688};
689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700690static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
691 { /* TS INTERRUPT */
692 .gpio = 11,
693 .settings = {
694 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
695 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
696 },
697 },
698 { /* TS SLEEP */
699 .gpio = 50,
700 .settings = {
701 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
702 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
703 },
704 },
705 { /* TS RESOUT */
706 .gpio = 52,
707 .settings = {
708 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
709 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
710 },
711 },
712};
713
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700714#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
715enum {
716 SX150X_CAM,
717};
718
Nishant Pandit474f2252011-07-23 23:17:56 +0530719static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700720 [SX150X_CAM] = {
721 .gpio_base = GPIO_CAM_EXPANDER_BASE,
722 .oscio_is_gpo = false,
723 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530724 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700725 .io_open_drain_ena = 0x0,
726 .irq_summary = -1,
727 },
728};
Nishant Pandit474f2252011-07-23 23:17:56 +0530729
730#endif
731
732#ifdef CONFIG_I2C
733
734#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
735#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300736#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530737
738#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
739
740static struct i2c_board_info cam_expander_i2c_info[] = {
741 {
742 I2C_BOARD_INFO("sx1508q", 0x22),
743 .platform_data = &sx150x_data[SX150X_CAM]
744 },
745};
746
747static struct msm_cam_expander_info cam_expander_info[] = {
748 {
749 cam_expander_i2c_info,
750 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
751 },
752};
753#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700754#endif
755
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700756#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
757#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700758#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700759#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
760#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
761#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700762#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700763#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700764#define MSM_ION_EBI_SIZE SZ_8M
765
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700766#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
767static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
768static int __init pmem_kernel_ebi1_size_setup(char *p)
769{
770 pmem_kernel_ebi1_size = memparse(p, NULL);
771 return 0;
772}
773early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
774#endif
775
776#ifdef CONFIG_ANDROID_PMEM
777static unsigned pmem_size = MSM_PMEM_SIZE;
778static int __init pmem_size_setup(char *p)
779{
780 pmem_size = memparse(p, NULL);
781 return 0;
782}
783early_param("pmem_size", pmem_size_setup);
784
785static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
786
787static int __init pmem_adsp_size_setup(char *p)
788{
789 pmem_adsp_size = memparse(p, NULL);
790 return 0;
791}
792early_param("pmem_adsp_size", pmem_adsp_size_setup);
793
794static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
795
796static int __init pmem_audio_size_setup(char *p)
797{
798 pmem_audio_size = memparse(p, NULL);
799 return 0;
800}
801early_param("pmem_audio_size", pmem_audio_size_setup);
802#endif
803
804#ifdef CONFIG_ANDROID_PMEM
805static struct android_pmem_platform_data android_pmem_pdata = {
806 .name = "pmem",
807 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
808 .cached = 1,
809 .memory_type = MEMTYPE_EBI1,
810};
811
812static struct platform_device android_pmem_device = {
813 .name = "android_pmem",
814 .id = 0,
815 .dev = {.platform_data = &android_pmem_pdata},
816};
817
818static struct android_pmem_platform_data android_pmem_adsp_pdata = {
819 .name = "pmem_adsp",
820 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
821 .cached = 0,
822 .memory_type = MEMTYPE_EBI1,
823};
824static struct platform_device android_pmem_adsp_device = {
825 .name = "android_pmem",
826 .id = 2,
827 .dev = { .platform_data = &android_pmem_adsp_pdata },
828};
829
830static struct android_pmem_platform_data android_pmem_audio_pdata = {
831 .name = "pmem_audio",
832 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
833 .cached = 0,
834 .memory_type = MEMTYPE_EBI1,
835};
836
837static struct platform_device android_pmem_audio_device = {
838 .name = "android_pmem",
839 .id = 4,
840 .dev = { .platform_data = &android_pmem_audio_pdata },
841};
842#endif
843
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700844#define DSP_RAM_BASE_8960 0x8da00000
845#define DSP_RAM_SIZE_8960 0x1800000
846static int dspcrashd_pdata_8960 = 0xDEADDEAD;
847
848static struct resource resources_dspcrashd_8960[] = {
849 {
850 .name = "msm_dspcrashd",
851 .start = DSP_RAM_BASE_8960,
852 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
853 .flags = IORESOURCE_DMA,
854 },
855};
856
857struct platform_device msm_device_dspcrashd_8960 = {
858 .name = "msm_dspcrashd",
859 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
860 .resource = resources_dspcrashd_8960,
861 .dev = { .platform_data = &dspcrashd_pdata_8960 },
862};
863
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864static struct memtype_reserve msm8960_reserve_table[] __initdata = {
865 [MEMTYPE_SMI] = {
866 },
867 [MEMTYPE_EBI0] = {
868 .flags = MEMTYPE_FLAGS_1M_ALIGN,
869 },
870 [MEMTYPE_EBI1] = {
871 .flags = MEMTYPE_FLAGS_1M_ALIGN,
872 },
873};
874
875static void __init size_pmem_devices(void)
876{
877#ifdef CONFIG_ANDROID_PMEM
878 android_pmem_adsp_pdata.size = pmem_adsp_size;
879 android_pmem_pdata.size = pmem_size;
880 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
881#endif
882}
883
884static void __init reserve_memory_for(struct android_pmem_platform_data *p)
885{
886 msm8960_reserve_table[p->memory_type].size += p->size;
887}
888
889static void __init reserve_pmem_memory(void)
890{
891#ifdef CONFIG_ANDROID_PMEM
892 reserve_memory_for(&android_pmem_adsp_pdata);
893 reserve_memory_for(&android_pmem_pdata);
894 reserve_memory_for(&android_pmem_audio_pdata);
895 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
896#endif
897}
898
Larry Basselb4126da2011-07-18 14:31:33 -0700899static int msm8960_paddr_to_memtype(unsigned int paddr)
900{
901 return MEMTYPE_EBI1;
902}
903
Laura Abbottd6183792011-08-19 13:42:24 -0700904#ifdef CONFIG_ION_MSM
905struct ion_platform_data ion_pdata = {
906 .nr = 3,
907 .heaps = {
908 {
909 .id = ION_HEAP_SYSTEM_ID,
910 .type = ION_HEAP_TYPE_SYSTEM,
911 .name = ION_KMALLOC_HEAP_NAME,
912 },
913 {
914 .id = ION_HEAP_SYSTEM_CONTIG_ID,
915 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
916 .name = ION_VMALLOC_HEAP_NAME,
917 },
918 {
919 .id = ION_HEAP_EBI_ID,
920 .type = ION_HEAP_TYPE_CARVEOUT,
921 .name = ION_EBI1_HEAP_NAME,
922 .size = MSM_ION_EBI_SIZE,
923 .memory_type = ION_EBI_TYPE,
924 },
925 }
926};
927
928struct platform_device ion_dev = {
929 .name = "ion-msm",
930 .id = 1,
931 .dev = { .platform_data = &ion_pdata },
932};
933#endif
934
935static void reserve_ion_memory(void)
936{
937#ifdef CONFIG_ION_MSM
938 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
939#endif
940}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700941static void __init msm8960_calculate_reserve_sizes(void)
942{
943 size_pmem_devices();
944 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700945 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700946}
947
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700948static struct reserve_info msm8960_reserve_info __initdata = {
949 .memtype_reserve_table = msm8960_reserve_table,
950 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
951 .paddr_to_memtype = msm8960_paddr_to_memtype,
952};
953
Larry Basselb4126da2011-07-18 14:31:33 -0700954static int msm8960_memory_bank_size(void)
955{
956 return 1<<29;
957}
958
959static void __init locate_unstable_memory(void)
960{
961 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
962 unsigned long bank_size;
963 unsigned long low, high;
964
965 bank_size = msm8960_memory_bank_size();
966 low = meminfo.bank[0].start;
967 high = mb->start + mb->size;
968 low &= ~(bank_size - 1);
969
970 if (high - low <= bank_size)
971 return;
972 msm8960_reserve_info.low_unstable_address = low + bank_size;
973 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
974 msm8960_reserve_info.bank_size = bank_size;
975 pr_info("low unstable address %lx max size %lx bank size %lx\n",
976 msm8960_reserve_info.low_unstable_address,
977 msm8960_reserve_info.max_unstable_size,
978 msm8960_reserve_info.bank_size);
979}
980
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700981static void __init msm8960_reserve(void)
982{
983 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700984 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700985 msm_reserve();
986}
987
Larry Bassela4414b12011-08-04 11:11:02 -0700988static int msm8960_change_memory_power(u64 start, u64 size,
989 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700990{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700991 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700992}
993
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700994#ifdef CONFIG_MSM_CAMERA
995
Nishant Pandit24153d82011-08-27 16:05:13 +0530996static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700997 5, /*CAMIF_MCLK*/
998 20, /*CAMIF_I2C_DATA*/
999 21, /*CAMIF_I2C_CLK*/
1000};
1001
Nishant Pandit24153d82011-08-27 16:05:13 +05301002static struct msm_camera_gpio_conf gpio_conf = {
1003 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1004 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1005 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1006 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1007};
1008
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001009#define VFE_CAMIF_TIMER1_GPIO 2
1010#define VFE_CAMIF_TIMER2_GPIO 3
1011#define VFE_CAMIF_TIMER3_GPIO_INT 4
1012struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1013 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1014 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1015 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1016 .flash_recharge_duration = 50000,
1017 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1018};
1019
Nishant Pandit474f2252011-07-23 23:17:56 +05301020#ifdef CONFIG_MSM_CAMERA_FLASH
1021static struct msm_camera_sensor_flash_src msm_flash_src = {
1022 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1023 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1024 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1025#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1026 defined(CONFIG_GPIO_SX150X_MODULE))
1027 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1028#endif
1029};
1030#endif
1031
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001032static struct msm_bus_vectors cam_init_vectors[] = {
1033 {
1034 .src = MSM_BUS_MASTER_VFE,
1035 .dst = MSM_BUS_SLAVE_EBI_CH0,
1036 .ab = 0,
1037 .ib = 0,
1038 },
1039 {
1040 .src = MSM_BUS_MASTER_VPE,
1041 .dst = MSM_BUS_SLAVE_EBI_CH0,
1042 .ab = 0,
1043 .ib = 0,
1044 },
1045 {
1046 .src = MSM_BUS_MASTER_JPEG_ENC,
1047 .dst = MSM_BUS_SLAVE_EBI_CH0,
1048 .ab = 0,
1049 .ib = 0,
1050 },
1051};
1052
1053static struct msm_bus_vectors cam_preview_vectors[] = {
1054 {
1055 .src = MSM_BUS_MASTER_VFE,
1056 .dst = MSM_BUS_SLAVE_EBI_CH0,
1057 .ab = 27648000,
1058 .ib = 110592000,
1059 },
1060 {
1061 .src = MSM_BUS_MASTER_VPE,
1062 .dst = MSM_BUS_SLAVE_EBI_CH0,
1063 .ab = 0,
1064 .ib = 0,
1065 },
1066 {
1067 .src = MSM_BUS_MASTER_JPEG_ENC,
1068 .dst = MSM_BUS_SLAVE_EBI_CH0,
1069 .ab = 0,
1070 .ib = 0,
1071 },
1072};
1073
1074static struct msm_bus_vectors cam_video_vectors[] = {
1075 {
1076 .src = MSM_BUS_MASTER_VFE,
1077 .dst = MSM_BUS_SLAVE_EBI_CH0,
1078 .ab = 140451840,
1079 .ib = 561807360,
1080 },
1081 {
1082 .src = MSM_BUS_MASTER_VPE,
1083 .dst = MSM_BUS_SLAVE_EBI_CH0,
1084 .ab = 206807040,
1085 .ib = 488816640,
1086 },
1087 {
1088 .src = MSM_BUS_MASTER_JPEG_ENC,
1089 .dst = MSM_BUS_SLAVE_EBI_CH0,
1090 .ab = 0,
1091 .ib = 0,
1092 },
1093};
1094
1095static struct msm_bus_vectors cam_snapshot_vectors[] = {
1096 {
1097 .src = MSM_BUS_MASTER_VFE,
1098 .dst = MSM_BUS_SLAVE_EBI_CH0,
1099 .ab = 274423680,
1100 .ib = 1097694720,
1101 },
1102 {
1103 .src = MSM_BUS_MASTER_VPE,
1104 .dst = MSM_BUS_SLAVE_EBI_CH0,
1105 .ab = 0,
1106 .ib = 0,
1107 },
1108 {
1109 .src = MSM_BUS_MASTER_JPEG_ENC,
1110 .dst = MSM_BUS_SLAVE_EBI_CH0,
1111 .ab = 540000000,
1112 .ib = 1350000000,
1113 },
1114};
1115
1116static struct msm_bus_vectors cam_zsl_vectors[] = {
1117 {
1118 .src = MSM_BUS_MASTER_VFE,
1119 .dst = MSM_BUS_SLAVE_EBI_CH0,
1120 .ab = 302071680,
1121 .ib = 1208286720,
1122 },
1123 {
1124 .src = MSM_BUS_MASTER_VPE,
1125 .dst = MSM_BUS_SLAVE_EBI_CH0,
1126 .ab = 0,
1127 .ib = 0,
1128 },
1129 {
1130 .src = MSM_BUS_MASTER_JPEG_ENC,
1131 .dst = MSM_BUS_SLAVE_EBI_CH0,
1132 .ab = 540000000,
1133 .ib = 1350000000,
1134 },
1135};
1136
1137static struct msm_bus_paths cam_bus_client_config[] = {
1138 {
1139 ARRAY_SIZE(cam_init_vectors),
1140 cam_init_vectors,
1141 },
1142 {
1143 ARRAY_SIZE(cam_preview_vectors),
1144 cam_preview_vectors,
1145 },
1146 {
1147 ARRAY_SIZE(cam_video_vectors),
1148 cam_video_vectors,
1149 },
1150 {
1151 ARRAY_SIZE(cam_snapshot_vectors),
1152 cam_snapshot_vectors,
1153 },
1154 {
1155 ARRAY_SIZE(cam_zsl_vectors),
1156 cam_zsl_vectors,
1157 },
1158};
1159
1160static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1161 cam_bus_client_config,
1162 ARRAY_SIZE(cam_bus_client_config),
1163 .name = "msm_camera",
1164};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001165
Nishant Pandit24153d82011-08-27 16:05:13 +05301166struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1167 {
1168 .ioclk.mclk_clk_rate = 24000000,
1169 .ioclk.vfe_clk_rate = 228570000,
1170 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001171 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301172 },
1173 {
1174 .ioclk.mclk_clk_rate = 24000000,
1175 .ioclk.vfe_clk_rate = 228570000,
1176 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001177 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301178 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001179};
1180
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001181#ifdef CONFIG_IMX074_ACT
1182static struct i2c_board_info imx074_actuator_i2c_info = {
1183 I2C_BOARD_INFO("imx074_act", 0x11),
1184};
1185
1186static struct msm_actuator_info imx074_actuator_info = {
1187 .board_info = &imx074_actuator_i2c_info,
1188 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1189 .vcm_pwd = 0,
1190 .vcm_enable = 1,
1191};
1192#endif
1193
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001194#ifdef CONFIG_IMX074
1195static struct msm_camera_sensor_flash_data flash_imx074 = {
1196 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301197#ifdef CONFIG_MSM_CAMERA_FLASH
1198 .flash_src = &msm_flash_src
1199#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001200};
1201
Nishant Pandit24153d82011-08-27 16:05:13 +05301202static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1203 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001204 .sensor_reset = 107,
1205 .sensor_pwd = 85,
1206 .vcm_pwd = 0,
1207 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301208};
1209
1210static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1211 .sensor_name = "imx074",
1212 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001213 .flash_data = &flash_imx074,
1214 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301215 .sensor_platform_info = &sensor_board_info_imx074,
1216 .gpio_conf = &gpio_conf,
1217 .csi_if = 1,
1218 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001219#ifdef CONFIG_IMX074_ACT
1220 .actuator_info = &imx074_actuator_info
1221#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001222};
1223
1224struct platform_device msm8960_camera_sensor_imx074 = {
1225 .name = "msm_camera_imx074",
1226 .dev = {
1227 .platform_data = &msm_camera_sensor_imx074_data,
1228 },
1229};
1230#endif
1231#ifdef CONFIG_OV2720
1232static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001233 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001234};
1235
Nishant Pandit24153d82011-08-27 16:05:13 +05301236static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1237 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001238 .sensor_reset = 76,
1239 .sensor_pwd = 85,
1240 .vcm_pwd = 0,
1241 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301242};
1243
1244static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1245 .sensor_name = "ov2720",
1246 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001247 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301248 .sensor_platform_info = &sensor_board_info_ov2720,
1249 .gpio_conf = &gpio_conf,
1250 .csi_if = 1,
1251 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001252};
1253
1254struct platform_device msm8960_camera_sensor_ov2720 = {
1255 .name = "msm_camera_ov2720",
1256 .dev = {
1257 .platform_data = &msm_camera_sensor_ov2720_data,
1258 },
1259};
1260#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001261
1262static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1263 .flash_type = MSM_CAMERA_FLASH_LED,
1264};
1265
Nishant Pandit24153d82011-08-27 16:05:13 +05301266static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1267 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001268 .sensor_reset = 107,
1269 .sensor_pwd = 85,
1270 .vcm_pwd = 0,
1271 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301272};
1273
1274static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1275 .sensor_name = "qs_mt9p017",
1276 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001277 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301278 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1279 .gpio_conf = &gpio_conf,
1280 .csi_if = 1,
1281 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001282};
1283
1284struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1285 .name = "msm_camera_qs_mt9p017",
1286 .dev = {
1287 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1288 },
1289};
1290
Kevin Chan8b0d2322011-09-10 21:06:31 -07001291static struct msm8960_privacy_light_cfg privacy_light_info = {
1292 .mpp = PM8921_MPP_PM_TO_SYS(12),
1293};
1294
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001295static void __init msm8960_init_cam(void)
1296{
1297 int i;
1298 struct platform_device *cam_dev[] = {
1299 &msm8960_camera_sensor_imx074,
1300 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001301 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302 };
1303
Kevin Chan8b0d2322011-09-10 21:06:31 -07001304 if (machine_is_msm8960_liquid()) {
1305 struct msm_camera_sensor_info *s_info;
1306 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1307 s_info->sensor_platform_info->mount_angle = 180;
1308 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1309 s_info->sensor_platform_info->privacy_light = 1;
1310 s_info->sensor_platform_info->privacy_light_info =
1311 &privacy_light_info;
1312 }
1313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1315 struct msm_camera_sensor_info *s_info;
1316 s_info = cam_dev[i]->dev.platform_data;
1317 msm_get_cam_resources(s_info);
1318 platform_device_register(cam_dev[i]);
1319 }
1320}
1321#endif
1322
1323#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001324#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001325#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001326#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001327#endif
1328
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329
1330#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001331#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001333#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1334#else
1335#define MSM_FB_EXT_BUF_SIZE 0
1336#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001337
kuogee hsieh3830eb92011-09-12 15:25:57 -07001338#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1339/* width x height x 3 bpp x 2 frame buffer */
1340#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1341#define MSM_FB_WRITEBACK_OFFSET \
1342 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1343#else
1344#define MSM_FB_WRITEBACK_SIZE 0
1345#define MSM_FB_WRITEBACK_OFFSET 0
1346#endif
1347
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001348#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1349/* 4 bpp x 2 page HDMI case */
1350#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1351#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001352/* Note: must be multiple of 4096 */
1353#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1354 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001355#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001356
1357static int writeback_offset(void)
1358{
1359 return MSM_FB_WRITEBACK_OFFSET;
1360}
1361
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001362
1363#define MDP_VSYNC_GPIO 0
1364
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001365#define PANEL_NAME_MAX_LEN 30
1366#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1367#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1368#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1369#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1370#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1371#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1372#define HDMI_PANEL_NAME "hdmi_msm"
1373#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001374
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001375static struct resource msm_fb_resources[] = {
1376 {
1377 .flags = IORESOURCE_DMA,
1378 }
1379};
1380
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001381static int msm_fb_detect_panel(const char *name)
1382{
1383 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001384 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1385 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1386 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001387 return 0;
1388 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001389 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1390 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1391 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001392 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001393
1394#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1395 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1396 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1397 PANEL_NAME_MAX_LEN)))
1398 return 0;
1399
1400 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1401 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1402 PANEL_NAME_MAX_LEN)))
1403 return 0;
1404
1405 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1406 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1407 PANEL_NAME_MAX_LEN)))
1408 return 0;
1409
1410 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1411 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1412 PANEL_NAME_MAX_LEN)))
1413 return 0;
1414#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001415 }
1416
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001417 if (!strncmp(name, HDMI_PANEL_NAME,
1418 strnlen(HDMI_PANEL_NAME,
1419 PANEL_NAME_MAX_LEN)))
1420 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001421
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001422 if (!strncmp(name, TVOUT_PANEL_NAME,
1423 strnlen(TVOUT_PANEL_NAME,
1424 PANEL_NAME_MAX_LEN)))
1425 return 0;
1426
1427 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001428 return -ENODEV;
1429}
1430
1431static struct msm_fb_platform_data msm_fb_pdata = {
1432 .detect_client = msm_fb_detect_panel,
1433};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001434
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001435static struct platform_device msm_fb_device = {
1436 .name = "msm_fb",
1437 .id = 0,
1438 .num_resources = ARRAY_SIZE(msm_fb_resources),
1439 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001440 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441};
1442
1443static bool dsi_power_on;
1444
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001445/**
1446 * LiQUID panel on/off
1447 *
1448 * @param on
1449 *
1450 * @return int
1451 */
1452static int mipi_dsi_liquid_panel_power(int on)
1453{
1454 static struct regulator *reg_l2, *reg_ext_3p3v;
1455 static int gpio21, gpio24, gpio43;
1456 int rc;
1457
1458 pr_info("%s: on=%d\n", __func__, on);
1459
1460 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1461 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1462 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1463
1464 if (!dsi_power_on) {
1465
1466 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1467 "dsi_vdda");
1468 if (IS_ERR(reg_l2)) {
1469 pr_err("could not get 8921_l2, rc = %ld\n",
1470 PTR_ERR(reg_l2));
1471 return -ENODEV;
1472 }
1473
1474 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1475 if (rc) {
1476 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1477 return -EINVAL;
1478 }
1479
1480 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1481 "vdd_lvds_3p3v");
1482 if (IS_ERR(reg_ext_3p3v)) {
1483 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1484 PTR_ERR(reg_ext_3p3v));
1485 return -ENODEV;
1486 }
1487
1488 rc = gpio_request(gpio21, "disp_pwr_en_n");
1489 if (rc) {
1490 pr_err("request gpio 21 failed, rc=%d\n", rc);
1491 return -ENODEV;
1492 }
1493
1494 rc = gpio_request(gpio43, "disp_rst_n");
1495 if (rc) {
1496 pr_err("request gpio 43 failed, rc=%d\n", rc);
1497 return -ENODEV;
1498 }
1499
1500 rc = gpio_request(gpio24, "disp_backlight_pwm");
1501 if (rc) {
1502 pr_err("request gpio 24 failed, rc=%d\n", rc);
1503 return -ENODEV;
1504 }
1505
1506 dsi_power_on = true;
1507 }
1508
1509 if (on) {
1510 rc = regulator_set_optimum_mode(reg_l2, 100000);
1511 if (rc < 0) {
1512 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1513 return -EINVAL;
1514 }
1515 rc = regulator_enable(reg_l2);
1516 if (rc) {
1517 pr_err("enable l2 failed, rc=%d\n", rc);
1518 return -ENODEV;
1519 }
1520
1521 rc = regulator_enable(reg_ext_3p3v);
1522 if (rc) {
1523 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1524 return -ENODEV;
1525 }
1526
1527 /* set reset pin before power enable */
1528 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1529
1530 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1531 msleep(20);
1532 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1533 msleep(20);
1534 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1535 msleep(20);
1536 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1537 msleep(20);
1538 } else {
1539 gpio_set_value_cansleep(gpio43, 0);
1540 gpio_set_value_cansleep(gpio21, 1);
1541
1542 rc = regulator_disable(reg_l2);
1543 if (rc) {
1544 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1545 return -ENODEV;
1546 }
1547 rc = regulator_disable(reg_ext_3p3v);
1548 if (rc) {
1549 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1550 return -ENODEV;
1551 }
1552 rc = regulator_set_optimum_mode(reg_l2, 100);
1553 if (rc < 0) {
1554 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1555 return -EINVAL;
1556 }
1557 }
1558
1559 return 0;
1560}
1561
1562static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001563{
1564 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001565 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001566 int rc;
1567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001568 pr_info("%s: state : %d\n", __func__, on);
1569
1570 if (!dsi_power_on) {
1571
1572 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1573 "dsi_vdc");
1574 if (IS_ERR(reg_l8)) {
1575 pr_err("could not get 8921_l8, rc = %ld\n",
1576 PTR_ERR(reg_l8));
1577 return -ENODEV;
1578 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001579 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1580 "dsi_vddio");
1581 if (IS_ERR(reg_l23)) {
1582 pr_err("could not get 8921_l23, rc = %ld\n",
1583 PTR_ERR(reg_l23));
1584 return -ENODEV;
1585 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001586 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1587 "dsi_vdda");
1588 if (IS_ERR(reg_l2)) {
1589 pr_err("could not get 8921_l2, rc = %ld\n",
1590 PTR_ERR(reg_l2));
1591 return -ENODEV;
1592 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001593 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1594 if (rc) {
1595 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1596 return -EINVAL;
1597 }
1598 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1599 if (rc) {
1600 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1601 return -EINVAL;
1602 }
1603 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1604 if (rc) {
1605 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1606 return -EINVAL;
1607 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001608 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1609 rc = gpio_request(gpio43, "disp_rst_n");
1610 if (rc) {
1611 pr_err("request gpio 43 failed, rc=%d\n", rc);
1612 return -ENODEV;
1613 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001614 dsi_power_on = true;
1615 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616 if (on) {
1617 rc = regulator_set_optimum_mode(reg_l8, 100000);
1618 if (rc < 0) {
1619 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1620 return -EINVAL;
1621 }
1622 rc = regulator_set_optimum_mode(reg_l23, 100000);
1623 if (rc < 0) {
1624 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1625 return -EINVAL;
1626 }
1627 rc = regulator_set_optimum_mode(reg_l2, 100000);
1628 if (rc < 0) {
1629 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1630 return -EINVAL;
1631 }
1632 rc = regulator_enable(reg_l8);
1633 if (rc) {
1634 pr_err("enable l8 failed, rc=%d\n", rc);
1635 return -ENODEV;
1636 }
1637 rc = regulator_enable(reg_l23);
1638 if (rc) {
1639 pr_err("enable l8 failed, rc=%d\n", rc);
1640 return -ENODEV;
1641 }
1642 rc = regulator_enable(reg_l2);
1643 if (rc) {
1644 pr_err("enable l2 failed, rc=%d\n", rc);
1645 return -ENODEV;
1646 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001647 gpio_set_value_cansleep(gpio43, 1);
1648 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001649 rc = regulator_disable(reg_l2);
1650 if (rc) {
1651 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1652 return -ENODEV;
1653 }
1654 rc = regulator_disable(reg_l8);
1655 if (rc) {
1656 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1657 return -ENODEV;
1658 }
1659 rc = regulator_disable(reg_l23);
1660 if (rc) {
1661 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1662 return -ENODEV;
1663 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001664 rc = regulator_set_optimum_mode(reg_l8, 100);
1665 if (rc < 0) {
1666 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1667 return -EINVAL;
1668 }
1669 rc = regulator_set_optimum_mode(reg_l23, 100);
1670 if (rc < 0) {
1671 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1672 return -EINVAL;
1673 }
1674 rc = regulator_set_optimum_mode(reg_l2, 100);
1675 if (rc < 0) {
1676 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1677 return -EINVAL;
1678 }
1679 gpio_set_value_cansleep(gpio43, 0);
1680 }
1681 return 0;
1682}
1683
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001684static int mipi_dsi_panel_power(int on)
1685{
1686 int ret;
1687
1688 pr_info("%s: on=%d\n", __func__, on);
1689
1690 if (machine_is_msm8960_liquid())
1691 ret = mipi_dsi_liquid_panel_power(on);
1692 else
1693 ret = mipi_dsi_cdp_panel_power(on);
1694
1695 return ret;
1696}
1697
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1699 .vsync_gpio = MDP_VSYNC_GPIO,
1700 .dsi_power_save = mipi_dsi_panel_power,
1701};
1702
1703#ifdef CONFIG_MSM_BUS_SCALING
1704
1705static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001706 {
1707 .src = MSM_BUS_MASTER_MDP_PORT0,
1708 .dst = MSM_BUS_SLAVE_EBI_CH0,
1709 .ab = 0,
1710 .ib = 0,
1711 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001712};
1713
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001714#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1715static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1716 /* If HDMI is used as primary */
1717 {
1718 .src = MSM_BUS_MASTER_MDP_PORT0,
1719 .dst = MSM_BUS_SLAVE_EBI_CH0,
1720 .ab = 2000000000,
1721 .ib = 2000000000,
1722 },
1723};
1724static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1725 {
1726 ARRAY_SIZE(mdp_init_vectors),
1727 mdp_init_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 ARRAY_SIZE(hdmi_as_primary_vectors),
1743 hdmi_as_primary_vectors,
1744 },
1745 {
1746 ARRAY_SIZE(hdmi_as_primary_vectors),
1747 hdmi_as_primary_vectors,
1748 },
1749};
1750#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001751static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752 {
1753 .src = MSM_BUS_MASTER_MDP_PORT0,
1754 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001755 .ab = 216000000 * 2,
1756 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001757 },
1758};
1759
1760static struct msm_bus_vectors mdp_vga_vectors[] = {
1761 /* VGA and less video */
1762 {
1763 .src = MSM_BUS_MASTER_MDP_PORT0,
1764 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001765 .ab = 216000000 * 2,
1766 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001767 },
1768};
1769
1770static struct msm_bus_vectors mdp_720p_vectors[] = {
1771 /* 720p and less video */
1772 {
1773 .src = MSM_BUS_MASTER_MDP_PORT0,
1774 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001775 .ab = 230400000 * 2,
1776 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001777 },
1778};
1779
1780static struct msm_bus_vectors mdp_1080p_vectors[] = {
1781 /* 1080p and less video */
1782 {
1783 .src = MSM_BUS_MASTER_MDP_PORT0,
1784 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001785 .ab = 334080000 * 2,
1786 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001787 },
1788};
1789
1790static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1791 {
1792 ARRAY_SIZE(mdp_init_vectors),
1793 mdp_init_vectors,
1794 },
1795 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001796 ARRAY_SIZE(mdp_ui_vectors),
1797 mdp_ui_vectors,
1798 },
1799 {
1800 ARRAY_SIZE(mdp_ui_vectors),
1801 mdp_ui_vectors,
1802 },
1803 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001804 ARRAY_SIZE(mdp_vga_vectors),
1805 mdp_vga_vectors,
1806 },
1807 {
1808 ARRAY_SIZE(mdp_720p_vectors),
1809 mdp_720p_vectors,
1810 },
1811 {
1812 ARRAY_SIZE(mdp_1080p_vectors),
1813 mdp_1080p_vectors,
1814 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001815};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001816#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001817
1818static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1819 mdp_bus_scale_usecases,
1820 ARRAY_SIZE(mdp_bus_scale_usecases),
1821 .name = "mdp",
1822};
1823
1824#endif
1825
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001826#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1827int mdp_core_clk_rate_table[] = {
1828 200000000,
1829 200000000,
1830 200000000,
1831 200000000,
1832};
1833#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001834int mdp_core_clk_rate_table[] = {
1835 85330000,
1836 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001837 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001838 200000000,
1839};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001840#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841
1842static struct msm_panel_common_pdata mdp_pdata = {
1843 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001844#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1845 .mdp_core_clk_rate = 200000000,
1846#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001847 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001848#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001849 .mdp_core_clk_table = mdp_core_clk_rate_table,
1850 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1851#ifdef CONFIG_MSM_BUS_SCALING
1852 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1853#endif
1854 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001855 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001856};
1857
1858static struct platform_device mipi_dsi_renesas_panel_device = {
1859 .name = "mipi_renesas",
1860 .id = 0,
1861};
1862
1863static struct platform_device mipi_dsi_simulator_panel_device = {
1864 .name = "mipi_simulator",
1865 .id = 0,
1866};
1867
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001868#define LPM_CHANNEL0 0
1869static int toshiba_gpio[] = {LPM_CHANNEL0};
1870
1871static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1872 .gpio = toshiba_gpio,
1873};
1874
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001875static struct platform_device mipi_dsi_toshiba_panel_device = {
1876 .name = "mipi_toshiba",
1877 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001878 .dev = {
1879 .platform_data = &toshiba_pdata,
1880 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881};
1882
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001883static int dsi2lvds_gpio[2] = {
1884 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1885 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1886 };
1887
1888static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1889 .gpio_num = dsi2lvds_gpio,
1890};
1891
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001892static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1893
1894/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1895 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1896 /* timing */
1897 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1898 0x0c, 0x03, 0x04, 0xa0},
1899 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1900 {0xff, 0x00, 0x06, 0x00}, /* strength */
1901 /* pll control */
1902 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1903 0x40, 0x07, 0x03,
1904 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1905};
1906
1907static struct mipi_dsi_panel_platform_data novatek_pdata = {
1908 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1909};
1910
1911static struct platform_device mipi_dsi_novatek_panel_device = {
1912 .name = "mipi_novatek",
1913 .id = 0,
1914 .dev = {
1915 .platform_data = &novatek_pdata,
1916 }
1917};
1918
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001919static struct platform_device mipi_dsi2lvds_bridge_device = {
1920 .name = "mipi_tc358764",
1921 .id = 0,
1922 .dev.platform_data = &mipi_dsi2lvds_pdata,
1923};
1924
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001925#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1926static struct resource hdmi_msm_resources[] = {
1927 {
1928 .name = "hdmi_msm_qfprom_addr",
1929 .start = 0x00700000,
1930 .end = 0x007060FF,
1931 .flags = IORESOURCE_MEM,
1932 },
1933 {
1934 .name = "hdmi_msm_hdmi_addr",
1935 .start = 0x04A00000,
1936 .end = 0x04A00FFF,
1937 .flags = IORESOURCE_MEM,
1938 },
1939 {
1940 .name = "hdmi_msm_irq",
1941 .start = HDMI_IRQ,
1942 .end = HDMI_IRQ,
1943 .flags = IORESOURCE_IRQ,
1944 },
1945};
1946
1947static int hdmi_enable_5v(int on);
1948static int hdmi_core_power(int on, int show);
1949static int hdmi_cec_power(int on);
1950
1951static struct msm_hdmi_platform_data hdmi_msm_data = {
1952 .irq = HDMI_IRQ,
1953 .enable_5v = hdmi_enable_5v,
1954 .core_power = hdmi_core_power,
1955 .cec_power = hdmi_cec_power,
1956};
1957
1958static struct platform_device hdmi_msm_device = {
1959 .name = "hdmi_msm",
1960 .id = 0,
1961 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1962 .resource = hdmi_msm_resources,
1963 .dev.platform_data = &hdmi_msm_data,
1964};
1965#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1966
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001967#ifdef CONFIG_MSM_BUS_SCALING
1968static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1969 {
1970 .src = MSM_BUS_MASTER_MDP_PORT0,
1971 .dst = MSM_BUS_SLAVE_EBI_CH0,
1972 .ab = 0,
1973 .ib = 0,
1974 },
1975};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001976
1977#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1978static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1979 {
1980 .src = MSM_BUS_MASTER_MDP_PORT0,
1981 .dst = MSM_BUS_SLAVE_EBI_CH0,
1982 .ab = 2000000000,
1983 .ib = 2000000000,
1984 },
1985};
1986#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001987static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1988 {
1989 .src = MSM_BUS_MASTER_MDP_PORT0,
1990 .dst = MSM_BUS_SLAVE_EBI_CH0,
1991 .ab = 566092800 * 2,
1992 .ib = 707616000 * 2,
1993 },
1994};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001995#endif
1996
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001997static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1998 {
1999 ARRAY_SIZE(dtv_bus_init_vectors),
2000 dtv_bus_init_vectors,
2001 },
2002 {
2003 ARRAY_SIZE(dtv_bus_def_vectors),
2004 dtv_bus_def_vectors,
2005 },
2006};
2007static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2008 dtv_bus_scale_usecases,
2009 ARRAY_SIZE(dtv_bus_scale_usecases),
2010 .name = "dtv",
2011};
2012
2013static struct lcdc_platform_data dtv_pdata = {
2014 .bus_scale_table = &dtv_bus_scale_pdata,
2015};
2016#endif
2017
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002018static void __init msm_fb_add_devices(void)
2019{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002020 struct platform_device *ptr = NULL;
2021
2022 if (machine_is_msm8960_liquid())
2023 ptr = &mipi_dsi2lvds_bridge_device;
2024 else
2025 ptr = &mipi_dsi_toshiba_panel_device;
2026 platform_add_devices(&ptr, 1);
2027
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002028 if (machine_is_msm8x60_rumi3()) {
2029 msm_fb_register_device("mdp", NULL);
2030 mipi_dsi_pdata.target_type = 1;
2031 } else
2032 msm_fb_register_device("mdp", &mdp_pdata);
2033 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002034#ifdef CONFIG_MSM_BUS_SCALING
2035 msm_fb_register_device("dtv", &dtv_pdata);
2036#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002037}
2038
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002039static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2040 .func = GPIOMUX_FUNC_GPIO,
2041 .drv = GPIOMUX_DRV_2MA,
2042 .pull = GPIOMUX_PULL_DOWN,
2043};
2044
2045static struct gpiomux_setting mdp_vsync_active_cfg = {
2046 .func = GPIOMUX_FUNC_1,
2047 .drv = GPIOMUX_DRV_2MA,
2048 .pull = GPIOMUX_PULL_DOWN,
2049};
2050
2051static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2052 {
2053 .gpio = MDP_VSYNC_GPIO,
2054 .settings = {
2055 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2056 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2057 },
2058 }
2059};
2060
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002061#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2062static struct gpiomux_setting hdmi_suspend_cfg = {
2063 .func = GPIOMUX_FUNC_GPIO,
2064 .drv = GPIOMUX_DRV_2MA,
2065 .pull = GPIOMUX_PULL_DOWN,
2066};
2067
2068static struct gpiomux_setting hdmi_active_1_cfg = {
2069 .func = GPIOMUX_FUNC_1,
2070 .drv = GPIOMUX_DRV_2MA,
2071 .pull = GPIOMUX_PULL_UP,
2072};
2073
2074static struct gpiomux_setting hdmi_active_2_cfg = {
2075 .func = GPIOMUX_FUNC_1,
2076 .drv = GPIOMUX_DRV_2MA,
2077 .pull = GPIOMUX_PULL_DOWN,
2078};
2079
2080static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2081 {
2082 .gpio = 99,
2083 .settings = {
2084 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2085 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2086 },
2087 },
2088 {
2089 .gpio = 100,
2090 .settings = {
2091 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2092 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2093 },
2094 },
2095 {
2096 .gpio = 101,
2097 .settings = {
2098 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2099 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2100 },
2101 },
2102 {
2103 .gpio = 102,
2104 .settings = {
2105 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2106 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2107 },
2108 },
2109};
2110
2111static int hdmi_enable_5v(int on)
2112{
2113 /* TBD: PM8921 regulator instead of 8901 */
2114 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2115 static int prev_on;
2116 int rc;
2117
2118 if (on == prev_on)
2119 return 0;
2120
2121 if (!reg_8921_hdmi_mvs)
2122 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2123 "hdmi_mvs");
2124
2125 if (on) {
2126 rc = regulator_enable(reg_8921_hdmi_mvs);
2127 if (rc) {
2128 pr_err("'%s' regulator enable failed, rc=%d\n",
2129 "8921_hdmi_mvs", rc);
2130 return rc;
2131 }
2132 pr_debug("%s(on): success\n", __func__);
2133 } else {
2134 rc = regulator_disable(reg_8921_hdmi_mvs);
2135 if (rc)
2136 pr_warning("'%s' regulator disable failed, rc=%d\n",
2137 "8921_hdmi_mvs", rc);
2138 pr_debug("%s(off): success\n", __func__);
2139 }
2140
2141 prev_on = on;
2142
2143 return 0;
2144}
2145
2146static int hdmi_core_power(int on, int show)
2147{
2148 static struct regulator *reg_8921_l23, *reg_8921_s4;
2149 static int prev_on;
2150 int rc;
2151
2152 if (on == prev_on)
2153 return 0;
2154
2155 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002156 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002157 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002158 if (IS_ERR(reg_8921_l23)) {
2159 pr_err("could not get reg_8921_l23, rc = %ld\n",
2160 PTR_ERR(reg_8921_l23));
2161 return -ENODEV;
2162 }
2163 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2164 if (rc) {
2165 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2166 return -EINVAL;
2167 }
2168 }
2169 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002170 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002171 if (IS_ERR(reg_8921_s4)) {
2172 pr_err("could not get reg_8921_s4, rc = %ld\n",
2173 PTR_ERR(reg_8921_s4));
2174 return -ENODEV;
2175 }
2176 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2177 if (rc) {
2178 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2179 return -EINVAL;
2180 }
2181 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182
2183 if (on) {
2184 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2185 if (rc < 0) {
2186 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2187 return -EINVAL;
2188 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002189 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002190 if (rc) {
2191 pr_err("'%s' regulator enable failed, rc=%d\n",
2192 "hdmi_avdd", rc);
2193 return rc;
2194 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002195 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002196 if (rc) {
2197 pr_err("'%s' regulator enable failed, rc=%d\n",
2198 "hdmi_vcc", rc);
2199 return rc;
2200 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002201 rc = gpio_request(100, "HDMI_DDC_CLK");
2202 if (rc) {
2203 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2204 "HDMI_DDC_CLK", 100, rc);
2205 goto error1;
2206 }
2207 rc = gpio_request(101, "HDMI_DDC_DATA");
2208 if (rc) {
2209 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2210 "HDMI_DDC_DATA", 101, rc);
2211 goto error2;
2212 }
2213 rc = gpio_request(102, "HDMI_HPD");
2214 if (rc) {
2215 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2216 "HDMI_HPD", 102, rc);
2217 goto error3;
2218 }
2219 pr_debug("%s(on): success\n", __func__);
2220 } else {
2221 gpio_free(100);
2222 gpio_free(101);
2223 gpio_free(102);
2224
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002225 rc = regulator_disable(reg_8921_l23);
2226 if (rc) {
2227 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2228 return -ENODEV;
2229 }
2230 rc = regulator_disable(reg_8921_s4);
2231 if (rc) {
2232 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2233 return -ENODEV;
2234 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002235 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2236 if (rc < 0) {
2237 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2238 return -EINVAL;
2239 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240 pr_debug("%s(off): success\n", __func__);
2241 }
2242
2243 prev_on = on;
2244
2245 return 0;
2246
2247error3:
2248 gpio_free(101);
2249error2:
2250 gpio_free(100);
2251error1:
2252 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002253 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002254 return rc;
2255}
2256
2257static int hdmi_cec_power(int on)
2258{
2259 static int prev_on;
2260 int rc;
2261
2262 if (on == prev_on)
2263 return 0;
2264
2265 if (on) {
2266 rc = gpio_request(99, "HDMI_CEC_VAR");
2267 if (rc) {
2268 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2269 "HDMI_CEC_VAR", 99, rc);
2270 goto error;
2271 }
2272 pr_debug("%s(on): success\n", __func__);
2273 } else {
2274 gpio_free(99);
2275 pr_debug("%s(off): success\n", __func__);
2276 }
2277
2278 prev_on = on;
2279
2280 return 0;
2281error:
2282 return rc;
2283}
2284#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2285
2286static void __init msm8960_allocate_memory_regions(void)
2287{
2288 void *addr;
2289 unsigned long size;
2290
2291 size = MSM_FB_SIZE;
2292 addr = alloc_bootmem_align(size, 0x1000);
2293 msm_fb_resources[0].start = __pa(addr);
2294 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2295 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2296 size, addr, __pa(addr));
2297
2298}
2299#ifdef CONFIG_WCD9310_CODEC
2300
2301#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2302
Patrick Lai3043fba2011-08-01 14:15:57 -07002303/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2304 * 4 micbiases are used to power various analog and digital
2305 * microphones operating at 1800 mV. Technically, all micbiases
2306 * can source from single cfilter since all microphones operate
2307 * at the same voltage level. The arrangement below is to make
2308 * sure all cfilters are exercised. LDO_H regulator ouput level
2309 * does not need to be as high as 2.85V. It is choosen for
2310 * microphone sensitivity purpose.
2311 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002312static struct tabla_pdata tabla_platform_data = {
2313 .slimbus_slave_device = {
2314 .name = "tabla-slave",
2315 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2316 },
2317 .irq = MSM_GPIO_TO_INT(62),
2318 .irq_base = TABLA_INTERRUPT_BASE,
2319 .num_irqs = NR_TABLA_IRQS,
2320 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002321 .micbias = {
2322 .ldoh_v = TABLA_LDOH_2P85_V,
2323 .cfilt1_mv = 1800,
2324 .cfilt2_mv = 1800,
2325 .cfilt3_mv = 1800,
2326 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2327 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2328 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2329 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2330 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002331};
2332
2333static struct slim_device msm_slim_tabla = {
2334 .name = "tabla-slim",
2335 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2336 .dev = {
2337 .platform_data = &tabla_platform_data,
2338 },
2339};
2340#endif
2341
2342static struct slim_boardinfo msm_slim_devices[] = {
2343#ifdef CONFIG_WCD9310_CODEC
2344 {
2345 .bus_num = 1,
2346 .slim_slave = &msm_slim_tabla,
2347 },
2348#endif
2349 /* add more slimbus slaves as needed */
2350};
2351
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002352#define MSM_WCNSS_PHYS 0x03000000
2353#define MSM_WCNSS_SIZE 0x280000
2354
2355static struct resource resources_wcnss_wlan[] = {
2356 {
2357 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2358 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2359 .name = "wcnss_wlanrx_irq",
2360 .flags = IORESOURCE_IRQ,
2361 },
2362 {
2363 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2364 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2365 .name = "wcnss_wlantx_irq",
2366 .flags = IORESOURCE_IRQ,
2367 },
2368 {
2369 .start = MSM_WCNSS_PHYS,
2370 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2371 .name = "wcnss_mmio",
2372 .flags = IORESOURCE_MEM,
2373 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002374 {
2375 .start = 84,
2376 .end = 88,
2377 .name = "wcnss_gpios_5wire",
2378 .flags = IORESOURCE_IO,
2379 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002380};
2381
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002382static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2383 .has_48mhz_xo = 1,
2384};
2385
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002386static struct platform_device msm_device_wcnss_wlan = {
2387 .name = "wcnss_wlan",
2388 .id = 0,
2389 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2390 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002391 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002392};
2393
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002394#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2395 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2396 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2397 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2398
2399#define QCE_SIZE 0x10000
2400#define QCE_0_BASE 0x18500000
2401
2402#define QCE_HW_KEY_SUPPORT 0
2403#define QCE_SHA_HMAC_SUPPORT 1
2404#define QCE_SHARE_CE_RESOURCE 1
2405#define QCE_CE_SHARED 0
2406
2407static struct resource qcrypto_resources[] = {
2408 [0] = {
2409 .start = QCE_0_BASE,
2410 .end = QCE_0_BASE + QCE_SIZE - 1,
2411 .flags = IORESOURCE_MEM,
2412 },
2413 [1] = {
2414 .name = "crypto_channels",
2415 .start = DMOV_CE_IN_CHAN,
2416 .end = DMOV_CE_OUT_CHAN,
2417 .flags = IORESOURCE_DMA,
2418 },
2419 [2] = {
2420 .name = "crypto_crci_in",
2421 .start = DMOV_CE_IN_CRCI,
2422 .end = DMOV_CE_IN_CRCI,
2423 .flags = IORESOURCE_DMA,
2424 },
2425 [3] = {
2426 .name = "crypto_crci_out",
2427 .start = DMOV_CE_OUT_CRCI,
2428 .end = DMOV_CE_OUT_CRCI,
2429 .flags = IORESOURCE_DMA,
2430 },
2431};
2432
2433static struct resource qcedev_resources[] = {
2434 [0] = {
2435 .start = QCE_0_BASE,
2436 .end = QCE_0_BASE + QCE_SIZE - 1,
2437 .flags = IORESOURCE_MEM,
2438 },
2439 [1] = {
2440 .name = "crypto_channels",
2441 .start = DMOV_CE_IN_CHAN,
2442 .end = DMOV_CE_OUT_CHAN,
2443 .flags = IORESOURCE_DMA,
2444 },
2445 [2] = {
2446 .name = "crypto_crci_in",
2447 .start = DMOV_CE_IN_CRCI,
2448 .end = DMOV_CE_IN_CRCI,
2449 .flags = IORESOURCE_DMA,
2450 },
2451 [3] = {
2452 .name = "crypto_crci_out",
2453 .start = DMOV_CE_OUT_CRCI,
2454 .end = DMOV_CE_OUT_CRCI,
2455 .flags = IORESOURCE_DMA,
2456 },
2457};
2458
2459#endif
2460
2461#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2462 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2463
2464static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2465 .ce_shared = QCE_CE_SHARED,
2466 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2467 .hw_key_support = QCE_HW_KEY_SUPPORT,
2468 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2469};
2470
2471static struct platform_device qcrypto_device = {
2472 .name = "qcrypto",
2473 .id = 0,
2474 .num_resources = ARRAY_SIZE(qcrypto_resources),
2475 .resource = qcrypto_resources,
2476 .dev = {
2477 .coherent_dma_mask = DMA_BIT_MASK(32),
2478 .platform_data = &qcrypto_ce_hw_suppport,
2479 },
2480};
2481#endif
2482
2483#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2484 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2485
2486static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2487 .ce_shared = QCE_CE_SHARED,
2488 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2489 .hw_key_support = QCE_HW_KEY_SUPPORT,
2490 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2491};
2492
2493static struct platform_device qcedev_device = {
2494 .name = "qce",
2495 .id = 0,
2496 .num_resources = ARRAY_SIZE(qcedev_resources),
2497 .resource = qcedev_resources,
2498 .dev = {
2499 .coherent_dma_mask = DMA_BIT_MASK(32),
2500 .platform_data = &qcedev_ce_hw_suppport,
2501 },
2502};
2503#endif
2504
2505
2506static int __init gpiomux_init(void)
2507{
2508 int rc;
2509
2510 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2511 if (rc) {
2512 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2513 return rc;
2514 }
2515
Nishant Pandit24153d82011-08-27 16:05:13 +05302516 msm_gpiomux_install(msm8960_cam_common_configs,
2517 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002518
2519 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002520 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521
2522 msm_gpiomux_install(msm8960_gsbi_configs,
2523 ARRAY_SIZE(msm8960_gsbi_configs));
2524
2525 msm_gpiomux_install(msm8960_cyts_configs,
2526 ARRAY_SIZE(msm8960_cyts_configs));
2527
2528 msm_gpiomux_install(msm8960_slimbus_config,
2529 ARRAY_SIZE(msm8960_slimbus_config));
2530
2531 msm_gpiomux_install(msm8960_audio_codec_configs,
2532 ARRAY_SIZE(msm8960_audio_codec_configs));
2533
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002534 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2535 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2536
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002537#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2538 msm_gpiomux_install(msm8960_hdmi_configs,
2539 ARRAY_SIZE(msm8960_hdmi_configs));
2540#endif
2541
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002542 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2543 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2544
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002545 msm_gpiomux_install(wcnss_5wire_interface,
2546 ARRAY_SIZE(wcnss_5wire_interface));
2547
2548 return 0;
2549}
2550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002551#define MSM_SHARED_RAM_PHYS 0x80000000
2552
2553static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2554 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2555 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2556 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2557 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2558 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2559 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2560 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2561 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2562 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2563 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2564 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2565 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002566 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2567 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2568 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2569 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2570 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2571 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2572 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2573 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2574 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2575 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2576 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2577 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2578 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2579 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002580 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002581 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2582 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2583 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002584 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2585 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002586};
2587
2588static struct pm8921_adc_properties pm8921_adc_data = {
2589 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2590 .bitresolution = 15,
2591 .bipolar = 0,
2592};
2593
2594static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2595 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002596 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002598 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002599};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002600
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002601static void __init msm8960_map_io(void)
2602{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002603 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002604 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002605
2606 if (socinfo_init() < 0)
2607 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002608}
2609
2610static void __init msm8960_init_irq(void)
2611{
2612 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002613
2614 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002615 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002616 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002617
2618 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002619 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002620
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002621 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2622 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002623
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002624 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2625 * as they are configured as level, which does not play nice with
2626 * handle_percpu_irq.
2627 */
2628 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2629 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002630 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002631 }
2632}
2633
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002634/* MSM8960 have 5 SDCC controllers */
2635enum sdcc_controllers {
2636 SDCC1,
2637 SDCC2,
2638 SDCC3,
2639 SDCC4,
2640 SDCC5,
2641 MAX_SDCC_CONTROLLER
2642};
2643
2644/* All SDCC controllers requires VDD/VCC voltage */
2645static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2646 /* SDCC1 : eMMC card connected */
2647 [SDCC1] = {
2648 .name = "sdc_vdd",
2649 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302650 .high_vol_level = 2950000,
2651 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302652 .always_on = 1,
2653 .lpm_sup = 1,
2654 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002655 .hpm_uA = 200000, /* 200mA */
2656 },
2657 /* SDCC3 : External card slot connected */
2658 [SDCC3] = {
2659 .name = "sdc_vdd",
2660 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302661 .high_vol_level = 2950000,
2662 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002663 .hpm_uA = 600000, /* 600mA */
2664 }
2665};
2666
2667/* Only slots having eMMC card will require VCCQ voltage */
2668static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2669 /* SDCC1 : eMMC card connected */
2670 [SDCC1] = {
2671 .name = "sdc_vccq",
2672 .set_voltage_sup = 1,
2673 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302674 .high_vol_level = 1800000,
2675 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002676 .hpm_uA = 200000, /* 200mA */
2677 }
2678};
2679
2680/* All SDCC controllers may require voting for VDD PAD voltage */
2681static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2682 /* SDCC3 : External card slot connected */
2683 [SDCC3] = {
2684 .name = "sdc_vddp",
2685 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302686 .high_vol_level = 2950000,
2687 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002688 .always_on = 1,
2689 .lpm_sup = 1,
2690 /* Max. Active current required is 16 mA */
2691 .hpm_uA = 16000,
2692 /*
2693 * Sleep current required is ~300 uA. But min. vote can be
2694 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2695 * during sleep.
2696 */
2697 .lpm_uA = 2000,
2698 }
2699};
2700
2701static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2702 /* SDCC1 : eMMC card connected */
2703 [SDCC1] = {
2704 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2705 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2706 },
2707 /* SDCC3 : External card slot connected */
2708 [SDCC3] = {
2709 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2710 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2711 }
2712};
2713
2714/* SDC1 pad data */
2715static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2716 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302717 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2718 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002719};
2720
2721static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2722 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2723 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2724 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2725};
2726
2727static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302728 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002729 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2730 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2731};
2732
2733static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302734 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2736 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2737};
2738
2739/* SDC3 pad data */
2740static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2741 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2742 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2743 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2744};
2745
2746static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2747 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2748 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2749 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2750};
2751
2752static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302753 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002754 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2755 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2756};
2757
2758static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302759 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302760 /*
2761 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2762 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2763 * which would result in false card detection interrupts.
2764 */
2765 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2766 /*
2767 * Keeping DATA lines status to PULL UP will make sure that
2768 * there is no current leak during sleep if external pull up
2769 * is connected to DATA lines.
2770 */
2771 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772};
2773
2774struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2775 [SDCC1] = {
2776 .on = sdc1_pad_pull_on_cfg,
2777 .off = sdc1_pad_pull_off_cfg,
2778 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2779 },
2780 [SDCC3] = {
2781 .on = sdc3_pad_pull_on_cfg,
2782 .off = sdc3_pad_pull_off_cfg,
2783 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2784 },
2785};
2786
2787struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2788 [SDCC1] = {
2789 .on = sdc1_pad_drv_on_cfg,
2790 .off = sdc1_pad_drv_off_cfg,
2791 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2792 },
2793 [SDCC3] = {
2794 .on = sdc3_pad_drv_on_cfg,
2795 .off = sdc3_pad_drv_off_cfg,
2796 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2797 },
2798};
2799
2800struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2801 [SDCC1] = {
2802 .pull = &mmc_pad_pull_data[SDCC1],
2803 .drv = &mmc_pad_drv_data[SDCC1]
2804 },
2805 [SDCC3] = {
2806 .pull = &mmc_pad_pull_data[SDCC3],
2807 .drv = &mmc_pad_drv_data[SDCC3]
2808 },
2809};
2810
2811struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2812 [SDCC1] = {
2813 .pad_data = &mmc_pad_data[SDCC1],
2814 },
2815 [SDCC3] = {
2816 .pad_data = &mmc_pad_data[SDCC3],
2817 },
2818};
2819
2820static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302821 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002822};
2823
2824static unsigned int sdc3_sup_clk_rates[] = {
2825 400000, 24000000, 48000000, 96000000
2826};
2827
2828#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2829static struct mmc_platform_data msm8960_sdc1_data = {
2830 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2831#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2832 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2833#else
2834 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2835#endif
2836 .sup_clk_table = sdc1_sup_clk_rates,
2837 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302838 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002839 .nonremovable = 1,
2840 .sdcc_v4_sup = true,
2841 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302842 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002843};
2844#endif
2845
2846#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2847static struct mmc_platform_data msm8960_sdc3_data = {
2848 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2849 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2850 .sup_clk_table = sdc3_sup_clk_rates,
2851 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302852 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302853#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002854 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302855#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002856 .sdcc_v4_sup = true,
2857 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2858 .pin_data = &mmc_slot_pin_data[SDCC3],
2859#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2860 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2861 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2862 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2863#endif
2864 .xpc_cap = 1,
2865 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2866 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302867 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002868};
2869#endif
2870
2871static void __init msm8960_init_mmc(void)
2872{
2873#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2874 /* SDC1 : eMMC card connected */
2875 msm_add_sdcc(1, &msm8960_sdc1_data);
2876#endif
2877#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2878 /* SDC3: External card slot */
2879 msm_add_sdcc(3, &msm8960_sdc3_data);
2880#endif
2881}
2882
2883static void __init msm8960_init_buses(void)
2884{
2885#ifdef CONFIG_MSM_BUS_SCALING
2886 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2887 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2888 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2889 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2890 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2891 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2892 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2893 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2894 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2895 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002896 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002897#endif
2898}
2899
2900static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2901 .max_clock_speed = 15060000,
2902};
2903
2904#ifdef CONFIG_USB_MSM_OTG_72K
2905static struct msm_otg_platform_data msm_otg_pdata;
2906#else
2907#define USB_5V_EN 42
2908static void msm_hsusb_vbus_power(bool on)
2909{
2910 int rc;
2911 static bool vbus_is_on;
2912 static struct regulator *mvs_otg_switch;
2913 struct pm_gpio param = {
2914 .direction = PM_GPIO_DIR_OUT,
2915 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2916 .output_value = 1,
2917 .pull = PM_GPIO_PULL_NO,
2918 .vin_sel = PM_GPIO_VIN_S4,
2919 .out_strength = PM_GPIO_STRENGTH_MED,
2920 .function = PM_GPIO_FUNC_NORMAL,
2921 };
2922
2923 if (vbus_is_on == on)
2924 return;
2925
2926 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002927 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2928 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929 if (IS_ERR(mvs_otg_switch)) {
2930 pr_err("Unable to get mvs_otg_switch\n");
2931 return;
2932 }
2933
2934 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2935 "usb_5v_en");
2936 if (rc < 0) {
2937 pr_err("failed to request usb_5v_en gpio\n");
2938 goto put_mvs_otg;
2939 }
2940
2941 if (regulator_enable(mvs_otg_switch)) {
2942 pr_err("unable to enable mvs_otg_switch\n");
2943 goto free_usb_5v_en;
2944 }
2945
2946 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2947 &param);
2948 if (rc < 0) {
2949 pr_err("failed to configure usb_5v_en gpio\n");
2950 goto disable_mvs_otg;
2951 }
2952 vbus_is_on = true;
2953 return;
2954 }
2955disable_mvs_otg:
2956 regulator_disable(mvs_otg_switch);
2957free_usb_5v_en:
2958 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2959put_mvs_otg:
2960 regulator_put(mvs_otg_switch);
2961 vbus_is_on = false;
2962}
2963
2964static struct msm_otg_platform_data msm_otg_pdata = {
2965 .mode = USB_OTG,
2966 .otg_control = OTG_PMIC_CONTROL,
2967 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2968 .pclk_src_name = "dfab_usb_hs_clk",
2969 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2970 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302971 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002972};
2973#endif
2974
2975#define PID_MAGIC_ID 0x71432909
2976#define SERIAL_NUM_MAGIC_ID 0x61945374
2977#define SERIAL_NUMBER_LENGTH 127
2978#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2979
2980struct magic_num_struct {
2981 uint32_t pid;
2982 uint32_t serial_num;
2983};
2984
2985struct dload_struct {
2986 uint32_t reserved1;
2987 uint32_t reserved2;
2988 uint32_t reserved3;
2989 uint16_t reserved4;
2990 uint16_t pid;
2991 char serial_number[SERIAL_NUMBER_LENGTH];
2992 uint16_t reserved5;
2993 struct magic_num_struct magic_struct;
2994};
2995
2996static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2997{
2998 struct dload_struct __iomem *dload = 0;
2999
3000 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3001 if (!dload) {
3002 pr_err("%s: cannot remap I/O memory region: %08x\n",
3003 __func__, DLOAD_USB_BASE_ADD);
3004 return -ENXIO;
3005 }
3006
3007 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3008 __func__, dload, pid, snum);
3009 /* update pid */
3010 dload->magic_struct.pid = PID_MAGIC_ID;
3011 dload->pid = pid;
3012
3013 /* update serial number */
3014 dload->magic_struct.serial_num = 0;
3015 if (!snum) {
3016 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3017 goto out;
3018 }
3019
3020 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
3021 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
3022 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
3023out:
3024 iounmap(dload);
3025 return 0;
3026}
3027
3028static struct android_usb_platform_data android_usb_pdata = {
3029 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3030};
3031
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003032static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003033 .name = "android_usb",
3034 .id = -1,
3035 .dev = {
3036 .platform_data = &android_usb_pdata,
3037 },
3038};
3039
3040static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3041 0x03, 0x0f,
3042};
3043
3044static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3045 0x00, 0x24, 0x54, 0x10,
3046 0x09, 0x03, 0x01,
3047 0x10, 0x54, 0x30, 0x0C,
3048 0x24, 0x30, 0x0f,
3049};
3050
3051static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3052 0x00, 0x24, 0x54, 0x10,
3053 0x09, 0x07, 0x01, 0x0B,
3054 0x10, 0x54, 0x30, 0x0C,
3055 0x24, 0x30, 0x0f,
3056};
3057
3058static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3059 [0] = {
3060 .mode = MSM_SPM_MODE_CLOCK_GATING,
3061 .notify_rpm = false,
3062 .cmd = spm_wfi_cmd_sequence,
3063 },
3064 [1] = {
3065 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3066 .notify_rpm = false,
3067 .cmd = spm_power_collapse_without_rpm,
3068 },
3069 [2] = {
3070 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3071 .notify_rpm = true,
3072 .cmd = spm_power_collapse_with_rpm,
3073 },
3074};
3075
3076static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3077 [0] = {
3078 .reg_base_addr = MSM_SAW0_BASE,
3079 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3080 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3081 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3082#if defined(CONFIG_MSM_AVS_HW)
3083 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3084 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3085#endif
3086 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3087 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3088 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3089 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3090 .vctl_timeout_us = 50,
3091 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3092 .modes = msm_spm_seq_list,
3093 },
3094 [1] = {
3095 .reg_base_addr = MSM_SAW1_BASE,
3096 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3097 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3098 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3099#if defined(CONFIG_MSM_AVS_HW)
3100 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3101 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3102#endif
3103 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3104 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3105 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3106 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3107 .vctl_timeout_us = 50,
3108 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3109 .modes = msm_spm_seq_list,
3110 },
3111};
3112
3113static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3114 0x00, 0x20, 0x03, 0x20,
3115 0x00, 0x0f,
3116};
3117
3118static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3119 0x00, 0x20, 0x34, 0x64,
3120 0x48, 0x07, 0x48, 0x20,
3121 0x50, 0x64, 0x04, 0x34,
3122 0x50, 0x0f,
3123};
3124static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3125 0x00, 0x10, 0x34, 0x64,
3126 0x48, 0x07, 0x48, 0x10,
3127 0x50, 0x64, 0x04, 0x34,
3128 0x50, 0x0F,
3129};
3130
3131static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3132 [0] = {
3133 .mode = MSM_SPM_L2_MODE_RETENTION,
3134 .notify_rpm = false,
3135 .cmd = l2_spm_wfi_cmd_sequence,
3136 },
3137 [1] = {
3138 .mode = MSM_SPM_L2_MODE_GDHS,
3139 .notify_rpm = true,
3140 .cmd = l2_spm_gdhs_cmd_sequence,
3141 },
3142 [2] = {
3143 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3144 .notify_rpm = true,
3145 .cmd = l2_spm_power_off_cmd_sequence,
3146 },
3147};
3148
3149
3150static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3151 [0] = {
3152 .reg_base_addr = MSM_SAW_L2_BASE,
3153 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3154 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3155 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3156 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3157 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3158 .modes = msm_spm_l2_seq_list,
3159 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3160 },
3161};
3162
3163#define CYTTSP_TS_GPIO_IRQ 11
3164#define CYTTSP_TS_SLEEP_GPIO 50
3165#define CYTTSP_TS_RESOUT_N_GPIO 52
3166
3167/*virtual key support */
3168static ssize_t tma340_vkeys_show(struct kobject *kobj,
3169 struct kobj_attribute *attr, char *buf)
3170{
3171 return snprintf(buf, 200,
3172 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3173 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3174 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3175 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3176 "\n");
3177}
3178
3179static struct kobj_attribute tma340_vkeys_attr = {
3180 .attr = {
3181 .mode = S_IRUGO,
3182 },
3183 .show = &tma340_vkeys_show,
3184};
3185
3186static struct attribute *tma340_properties_attrs[] = {
3187 &tma340_vkeys_attr.attr,
3188 NULL
3189};
3190
3191static struct attribute_group tma340_properties_attr_group = {
3192 .attrs = tma340_properties_attrs,
3193};
3194
3195
3196static int cyttsp_platform_init(struct i2c_client *client)
3197{
3198 int rc = 0;
3199 static struct kobject *tma340_properties_kobj;
3200
3201 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3202 tma340_properties_kobj = kobject_create_and_add("board_properties",
3203 NULL);
3204 if (tma340_properties_kobj)
3205 rc = sysfs_create_group(tma340_properties_kobj,
3206 &tma340_properties_attr_group);
3207 if (!tma340_properties_kobj || rc)
3208 pr_err("%s: failed to create board_properties\n",
3209 __func__);
3210
3211 return 0;
3212}
3213
3214static struct cyttsp_regulator regulator_data[] = {
3215 {
3216 .name = "vdd",
3217 .min_uV = CY_TMA300_VTG_MIN_UV,
3218 .max_uV = CY_TMA300_VTG_MAX_UV,
3219 .load_uA = CY_TMA300_CURR_24HZ_UA,
3220 },
3221 /* TODO: Remove after runtime PM is enabled in I2C driver */
3222 {
3223 .name = "vcc_i2c",
3224 .min_uV = CY_I2C_VTG_MIN_UV,
3225 .max_uV = CY_I2C_VTG_MAX_UV,
3226 .load_uA = CY_I2C_CURR_UA,
3227 },
3228};
3229
3230static struct cyttsp_platform_data cyttsp_pdata = {
3231 .panel_maxx = 634,
3232 .panel_maxy = 1166,
3233 .disp_maxx = 616,
3234 .disp_maxy = 1023,
3235 .disp_minx = 0,
3236 .disp_miny = 16,
3237 .flags = 0x01,
3238 .gen = CY_GEN3, /* or */
3239 .use_st = CY_USE_ST,
3240 .use_mt = CY_USE_MT,
3241 .use_hndshk = CY_SEND_HNDSHK,
3242 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303243 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003244 .use_gestures = CY_USE_GESTURES,
3245 .fw_fname = "cyttsp_8960_cdp.hex",
3246 /* activate up to 4 groups
3247 * and set active distance
3248 */
3249 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3250 CY_GEST_GRP3 | CY_GEST_GRP4 |
3251 CY_ACT_DIST,
3252 /* change act_intrvl to customize the Active power state
3253 * scanning/processing refresh interval for Operating mode
3254 */
3255 .act_intrvl = CY_ACT_INTRVL_DFLT,
3256 /* change tch_tmout to customize the touch timeout for the
3257 * Active power state for Operating mode
3258 */
3259 .tch_tmout = CY_TCH_TMOUT_DFLT,
3260 /* change lp_intrvl to customize the Low Power power state
3261 * scanning/processing refresh interval for Operating mode
3262 */
3263 .lp_intrvl = CY_LP_INTRVL_DFLT,
3264 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3265 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3266 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3267 .regulator_info = regulator_data,
3268 .num_regulators = ARRAY_SIZE(regulator_data),
3269 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303270 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003271};
3272
3273static struct i2c_board_info cyttsp_info[] __initdata = {
3274 {
3275 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3276 .platform_data = &cyttsp_pdata,
3277#ifndef CY_USE_TIMER
3278 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3279#endif /* CY_USE_TIMER */
3280 },
3281};
3282
Mohan Pallaka50837382011-09-07 11:00:57 +05303283/* configuration data */
3284static const u8 mxt_config_data[] = {
3285 /* T6 Object */
3286 0, 0, 0, 0, 0, 0,
3287 /* T38 Object */
3288 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3293 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3294 0, 0, 0, 0,
3295 /* T7 Object */
3296 10, 10, 50,
3297 /* T8 Object */
3298 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3299 /* T9 Object */
3300 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3301 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3302 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3303 0, 5, 45, 46,
3304 /* T15 Object */
3305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3306 0,
3307 /* T22 Object */
3308 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3309 0, 0, 255, 255, 255, 255, 0,
3310 /* T24 Object */
3311 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3312 0, 0, 0, 0, 0, 0, 0, 0, 0,
3313 /* T25 Object */
3314 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3315 0, 0, 0, 0,
3316 /* T27 Object */
3317 0, 0, 0, 0, 0, 0, 0,
3318 /* T28 Object */
3319 0, 0, 0, 8, 8, 8,
3320 /* T40 Object */
3321 0, 0, 0, 0, 0,
3322 /* T41 Object */
3323 0, 0, 0, 0, 0, 0,
3324 /* T43 Object */
3325 0, 0, 0, 0, 0, 0,
3326};
3327
3328#define MXT_TS_GPIO_IRQ 11
3329#define MXT_TS_LDO_EN_GPIO 50
3330#define MXT_TS_RESET_GPIO 52
3331
3332static void mxt_init_hw_liquid(void)
3333{
3334 int rc;
3335
3336 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3337 if (rc) {
3338 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3339 __func__, MXT_TS_GPIO_IRQ);
3340 return;
3341 }
3342
3343 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3344 if (rc) {
3345 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3346 __func__, MXT_TS_GPIO_IRQ);
3347 goto err_irq_gpio_req;
3348 }
3349
3350 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3351 if (rc) {
3352 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3353 __func__, MXT_TS_LDO_EN_GPIO);
3354 goto err_irq_gpio_req;
3355 }
3356
3357 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3358 if (rc) {
3359 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3360 __func__, MXT_TS_LDO_EN_GPIO);
3361 goto err_ldo_gpio_req;
3362 }
3363
3364 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3365 if (rc) {
3366 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3367 __func__, MXT_TS_RESET_GPIO);
3368 goto err_ldo_gpio_set_dir;
3369 }
3370
3371 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3372 if (rc) {
3373 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3374 __func__, MXT_TS_RESET_GPIO);
3375 goto err_reset_gpio_req;
3376 }
3377
3378 return;
3379
3380err_reset_gpio_req:
3381 gpio_free(MXT_TS_RESET_GPIO);
3382err_ldo_gpio_set_dir:
3383 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3384err_ldo_gpio_req:
3385 gpio_free(MXT_TS_LDO_EN_GPIO);
3386err_irq_gpio_req:
3387 gpio_free(MXT_TS_GPIO_IRQ);
3388}
3389
3390static struct mxt_platform_data mxt_platform_data = {
3391 .config = mxt_config_data,
3392 .config_length = ARRAY_SIZE(mxt_config_data),
3393 .x_line = 26,
3394 .y_line = 42,
3395 .x_size = 767,
3396 .y_size = 1365,
3397 .blen = 32,
3398 .threshold = 40,
3399 .voltage = 3300000, /* 3.3V */
3400 .orient = MXT_ROTATED_90,
3401 .irqflags = IRQF_TRIGGER_FALLING,
3402};
3403
3404static struct i2c_board_info mxt_device_info[] __initdata = {
3405 {
3406 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3407 .platform_data = &mxt_platform_data,
3408 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3409 },
3410};
3411
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003412static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3413{
3414}
3415
3416static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3417 .clk_freq = 100000,
3418 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003419 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3420};
3421
3422static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3423 .clk_freq = 100000,
3424 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003425 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3426};
3427
3428static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3429 .clk_freq = 100000,
3430 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003431 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3432};
3433
3434static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3435 .clk_freq = 100000,
3436 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003437 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3438};
3439
3440static struct msm_rpm_platform_data msm_rpm_data = {
3441 .reg_base_addrs = {
3442 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3443 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3444 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3445 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3446 },
3447
3448 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3449 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3450 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3451 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3452 .msm_apps_ipc_rpm_val = 4,
3453};
3454
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003455static struct ks8851_pdata spi_eth_pdata = {
3456 .irq_gpio = KS8851_IRQ_GPIO,
3457 .rst_gpio = KS8851_RST_GPIO,
3458};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003459
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003460static struct spi_board_info spi_board_info[] __initdata = {
3461 {
3462 .modalias = "ks8851",
3463 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3464 .max_speed_hz = 19200000,
3465 .bus_num = 0,
3466 .chip_select = 0,
3467 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003468 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003469 },
3470};
3471
3472static struct platform_device msm_device_saw_core0 = {
3473 .name = "saw-regulator",
3474 .id = 0,
3475 .dev = {
3476 .platform_data = &msm_saw_regulator_pdata_s5,
3477 },
3478};
3479
3480static struct platform_device msm_device_saw_core1 = {
3481 .name = "saw-regulator",
3482 .id = 1,
3483 .dev = {
3484 .platform_data = &msm_saw_regulator_pdata_s6,
3485 },
3486};
3487
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003488static struct tsens_platform_data msm_tsens_pdata = {
3489 .slope = 910,
3490 .tsens_factor = 1000,
3491 .hw_type = MSM_8960,
3492 .tsens_num_sensor = 5,
3493};
3494
3495static struct platform_device msm_tsens_device = {
3496 .name = "tsens8960-tm",
3497 .id = -1,
3498 .dev = {
3499 .platform_data = &msm_tsens_pdata,
3500 },
3501};
3502
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003503#ifdef CONFIG_MSM_FAKE_BATTERY
3504static struct platform_device fish_battery_device = {
3505 .name = "fish_battery",
3506};
3507#endif
3508
David Collins26f05562011-06-20 09:56:28 -07003509static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003510 .name = GPIO_REGULATOR_DEV_NAME,
3511 .id = PM8921_MPP_PM_TO_SYS(7),
3512 .dev = {
3513 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3514 },
3515};
3516
David Collins26f05562011-06-20 09:56:28 -07003517static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 .name = GPIO_REGULATOR_DEV_NAME,
3519 .id = 91,
3520 .dev = {
3521 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3522 },
3523};
3524
David Collinsb10be1d2011-09-02 10:29:31 -07003525static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3526 .name = GPIO_REGULATOR_DEV_NAME,
3527 .id = PM8921_GPIO_PM_TO_SYS(17),
3528 .dev = {
3529 .platform_data =
3530 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3531 },
3532};
3533
David Collins26f05562011-06-20 09:56:28 -07003534static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3535 .name = "rpm-regulator",
3536 .id = -1,
3537 .dev = {
3538 .platform_data = &msm_rpm_regulator_pdata,
3539 },
3540};
3541
David Collins4c31a872011-08-31 10:07:10 -07003542static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3543 .phys_addr_base = 0x0010C000,
3544 .reg_offsets = {
3545 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3546 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3547 },
3548 .phys_size = SZ_8K,
3549 .log_len = 4096, /* log's buffer length in bytes */
3550 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3551};
3552
3553static struct platform_device msm_rpm_log_device = {
3554 .name = "msm_rpm_log",
3555 .id = -1,
3556 .dev = {
3557 .platform_data = &msm_rpm_log_pdata,
3558 },
3559};
3560
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003561static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003562 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003563 &msm_device_smd,
3564 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303565 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003566 &msm_device_saw_core0,
3567 &msm_device_saw_core1,
3568 &msm8960_device_ext_5v_vreg,
3569 &msm8960_device_ext_l2_vreg,
3570 &msm8960_device_ssbi_pm8921,
3571 &msm8960_device_qup_spi_gsbi1,
3572 &msm8960_device_qup_i2c_gsbi3,
3573 &msm8960_device_qup_i2c_gsbi4,
3574 &msm8960_device_qup_i2c_gsbi10,
3575#ifndef CONFIG_MSM_DSPS
3576 &msm8960_device_qup_i2c_gsbi12,
3577#endif
3578 &msm_slim_ctrl,
3579 &msm_device_wcnss_wlan,
3580#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3581 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3582 &qcrypto_device,
3583#endif
3584
3585#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3586 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3587 &qcedev_device,
3588#endif
3589#ifdef CONFIG_MSM_ROTATOR
3590 &msm_rotator_device,
3591#endif
3592 &msm_device_sps,
3593#ifdef CONFIG_MSM_FAKE_BATTERY
3594 &fish_battery_device,
3595#endif
3596#ifdef CONFIG_ANDROID_PMEM
3597 &android_pmem_device,
3598 &android_pmem_adsp_device,
3599 &android_pmem_audio_device,
3600#endif
3601 &msm_fb_device,
3602 &msm_device_vidc,
3603 &msm_device_bam_dmux,
3604 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003605
3606#ifdef CONFIG_HW_RANDOM_MSM
3607 &msm_device_rng,
3608#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003609 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003610#ifdef CONFIG_ION_MSM
3611 &ion_dev,
3612#endif
David Collins4c31a872011-08-31 10:07:10 -07003613 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003614#ifdef CONFIG_MSM_QDSS
3615 &msm_etb_device,
3616 &msm_tpiu_device,
3617 &msm_funnel_device,
3618 &msm_ptm_device,
3619#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003620 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003621};
3622
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003623static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003624 &msm8960_device_otg,
3625 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003626 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303627 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003628 &android_usb_device,
3629 &msm_device_vidc,
3630 &mipi_dsi_simulator_panel_device,
3631 &msm_bus_apps_fabric,
3632 &msm_bus_sys_fabric,
3633 &msm_bus_mm_fabric,
3634 &msm_bus_sys_fpb,
3635 &msm_bus_cpss_fpb,
3636 &msm_pcm,
3637 &msm_pcm_routing,
3638 &msm_cpudai0,
3639 &msm_cpudai1,
3640 &msm_cpudai_hdmi_rx,
3641 &msm_cpudai_bt_rx,
3642 &msm_cpudai_bt_tx,
3643 &msm_cpudai_fm_rx,
3644 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003645 &msm_cpudai_auxpcm_rx,
3646 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003647 &msm_cpu_fe,
3648 &msm_stub_codec,
3649 &msm_voice,
3650 &msm_voip,
3651 &msm_lpa_pcm,
3652
3653#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3654 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3655 &qcrypto_device,
3656#endif
3657
3658#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3659 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3660 &qcedev_device,
3661#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003662};
3663
3664static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003665 &msm_kgsl_3d0,
3666 &msm_kgsl_2d0,
3667 &msm_kgsl_2d1,
3668 &mipi_dsi_renesas_panel_device,
3669#ifdef CONFIG_MSM_GEMINI
3670 &msm8960_gemini_device,
3671#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003672};
3673
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003674static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003675 &msm8960_device_otg,
3676 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003677 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303678 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003679 &android_usb_device,
3680 &msm_pcm,
3681 &msm_pcm_routing,
3682 &msm_cpudai0,
3683 &msm_cpudai1,
3684 &msm_cpudai_hdmi_rx,
3685 &msm_cpudai_bt_rx,
3686 &msm_cpudai_bt_tx,
3687 &msm_cpudai_fm_rx,
3688 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003689 &msm_cpudai_auxpcm_rx,
3690 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003691 &msm_cpu_fe,
3692 &msm_stub_codec,
3693 &msm_kgsl_3d0,
3694#ifdef CONFIG_MSM_KGSL_2D
3695 &msm_kgsl_2d0,
3696 &msm_kgsl_2d1,
3697#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003698 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003699#ifdef CONFIG_MSM_GEMINI
3700 &msm8960_gemini_device,
3701#endif
3702 &msm_voice,
3703 &msm_voip,
3704 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303705 &msm_cpudai_afe_01_rx,
3706 &msm_cpudai_afe_01_tx,
3707 &msm_cpudai_afe_02_rx,
3708 &msm_cpudai_afe_02_tx,
3709 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003710#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3711 &hdmi_msm_device,
3712#endif
3713 &msm_pcm_hostless,
3714 &msm_bus_apps_fabric,
3715 &msm_bus_sys_fabric,
3716 &msm_bus_mm_fabric,
3717 &msm_bus_sys_fpb,
3718 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003719 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003720};
3721
3722static void __init msm8960_i2c_init(void)
3723{
3724 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3725 &msm8960_i2c_qup_gsbi4_pdata;
3726
3727 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3728 &msm8960_i2c_qup_gsbi3_pdata;
3729
3730 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3731 &msm8960_i2c_qup_gsbi10_pdata;
3732
3733 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3734 &msm8960_i2c_qup_gsbi12_pdata;
3735}
3736
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003737static void __init msm8960_gfx_init(void)
3738{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003739 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003740 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3741 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3742 msm_kgsl_3d0.dev.platform_data;
3743 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3744 320000000;
3745 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3746 266667000;
3747 }
3748}
3749
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003750static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3751 .irq_base = PM8921_IRQ_BASE,
3752 .devirq = MSM_GPIO_TO_INT(104),
3753 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3754};
3755
3756static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3757 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3758};
3759
3760static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3761 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3762};
3763
3764static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3765 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303766 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003767};
3768
3769static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3770 .pull_up = 1,
3771 .kpd_trigger_delay_us = 970,
3772 .wakeup = 1,
3773};
3774
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303775/* Rotate lock key is not available so use F1 */
3776#define KEY_ROTATE_LOCK KEY_F1
3777
3778static const unsigned int keymap_liquid[] = {
3779 KEY(0, 0, KEY_VOLUMEUP),
3780 KEY(0, 1, KEY_VOLUMEDOWN),
3781 KEY(1, 3, KEY_ROTATE_LOCK),
3782 KEY(1, 4, KEY_HOME),
3783};
3784
3785static struct matrix_keymap_data keymap_data_liquid = {
3786 .keymap_size = ARRAY_SIZE(keymap_liquid),
3787 .keymap = keymap_liquid,
3788};
3789
3790static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3791 .input_name = "keypad_8960_liquid",
3792 .input_phys_device = "keypad_8960/input0",
3793 .num_rows = 2,
3794 .num_cols = 5,
3795 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3796 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3797 .debounce_ms = 15,
3798 .scan_delay_ms = 32,
3799 .row_hold_ns = 91500,
3800 .wakeup = 1,
3801 .keymap_data = &keymap_data_liquid,
3802};
3803
3804
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003805static const unsigned int keymap[] = {
3806 KEY(0, 0, KEY_VOLUMEUP),
3807 KEY(0, 1, KEY_VOLUMEDOWN),
3808 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3809 KEY(0, 3, KEY_CAMERA_FOCUS),
3810};
3811
3812static struct matrix_keymap_data keymap_data = {
3813 .keymap_size = ARRAY_SIZE(keymap),
3814 .keymap = keymap,
3815};
3816
3817static struct pm8xxx_keypad_platform_data keypad_data = {
3818 .input_name = "keypad_8960",
3819 .input_phys_device = "keypad_8960/input0",
3820 .num_rows = 1,
3821 .num_cols = 5,
3822 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3823 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3824 .debounce_ms = 15,
3825 .scan_delay_ms = 32,
3826 .row_hold_ns = 91500,
3827 .wakeup = 1,
3828 .keymap_data = &keymap_data,
3829};
3830
3831static const unsigned int keymap_sim[] = {
3832 KEY(0, 0, KEY_7),
3833 KEY(0, 1, KEY_DOWN),
3834 KEY(0, 2, KEY_UP),
3835 KEY(0, 3, KEY_RIGHT),
3836 KEY(0, 4, KEY_ENTER),
3837 KEY(0, 5, KEY_L),
3838 KEY(0, 6, KEY_BACK),
3839 KEY(0, 7, KEY_M),
3840
3841 KEY(1, 0, KEY_LEFT),
3842 KEY(1, 1, KEY_SEND),
3843 KEY(1, 2, KEY_1),
3844 KEY(1, 3, KEY_4),
3845 KEY(1, 4, KEY_CLEAR),
3846 KEY(1, 5, KEY_MSDOS),
3847 KEY(1, 6, KEY_SPACE),
3848 KEY(1, 7, KEY_COMMA),
3849
3850 KEY(2, 0, KEY_6),
3851 KEY(2, 1, KEY_5),
3852 KEY(2, 2, KEY_8),
3853 KEY(2, 3, KEY_3),
3854 KEY(2, 4, KEY_NUMERIC_STAR),
3855 KEY(2, 5, KEY_UP),
3856 KEY(2, 6, KEY_DOWN),
3857 KEY(2, 7, KEY_LEFTSHIFT),
3858
3859 KEY(3, 0, KEY_9),
3860 KEY(3, 1, KEY_NUMERIC_POUND),
3861 KEY(3, 2, KEY_0),
3862 KEY(3, 3, KEY_2),
3863 KEY(3, 4, KEY_SLEEP),
3864 KEY(3, 5, KEY_F1),
3865 KEY(3, 6, KEY_F2),
3866 KEY(3, 7, KEY_F3),
3867
3868 KEY(4, 0, KEY_BACK),
3869 KEY(4, 1, KEY_HOME),
3870 KEY(4, 2, KEY_MENU),
3871 KEY(4, 3, KEY_VOLUMEUP),
3872 KEY(4, 4, KEY_VOLUMEDOWN),
3873 KEY(4, 5, KEY_F4),
3874 KEY(4, 6, KEY_F5),
3875 KEY(4, 7, KEY_F6),
3876
3877 KEY(5, 0, KEY_R),
3878 KEY(5, 1, KEY_T),
3879 KEY(5, 2, KEY_Y),
3880 KEY(5, 3, KEY_LEFTALT),
3881 KEY(5, 4, KEY_KPENTER),
3882 KEY(5, 5, KEY_Q),
3883 KEY(5, 6, KEY_W),
3884 KEY(5, 7, KEY_E),
3885
3886 KEY(6, 0, KEY_F),
3887 KEY(6, 1, KEY_G),
3888 KEY(6, 2, KEY_H),
3889 KEY(6, 3, KEY_CAPSLOCK),
3890 KEY(6, 4, KEY_PAGEUP),
3891 KEY(6, 5, KEY_A),
3892 KEY(6, 6, KEY_S),
3893 KEY(6, 7, KEY_D),
3894
3895 KEY(7, 0, KEY_V),
3896 KEY(7, 1, KEY_B),
3897 KEY(7, 2, KEY_N),
3898 KEY(7, 3, KEY_MENU),
3899 KEY(7, 4, KEY_PAGEDOWN),
3900 KEY(7, 5, KEY_Z),
3901 KEY(7, 6, KEY_X),
3902 KEY(7, 7, KEY_C),
3903
3904 KEY(8, 0, KEY_P),
3905 KEY(8, 1, KEY_J),
3906 KEY(8, 2, KEY_K),
3907 KEY(8, 3, KEY_INSERT),
3908 KEY(8, 4, KEY_LINEFEED),
3909 KEY(8, 5, KEY_U),
3910 KEY(8, 6, KEY_I),
3911 KEY(8, 7, KEY_O),
3912
3913 KEY(9, 0, KEY_4),
3914 KEY(9, 1, KEY_5),
3915 KEY(9, 2, KEY_6),
3916 KEY(9, 3, KEY_7),
3917 KEY(9, 4, KEY_8),
3918 KEY(9, 5, KEY_1),
3919 KEY(9, 6, KEY_2),
3920 KEY(9, 7, KEY_3),
3921
3922 KEY(10, 0, KEY_F7),
3923 KEY(10, 1, KEY_F8),
3924 KEY(10, 2, KEY_F9),
3925 KEY(10, 3, KEY_F10),
3926 KEY(10, 4, KEY_FN),
3927 KEY(10, 5, KEY_9),
3928 KEY(10, 6, KEY_0),
3929 KEY(10, 7, KEY_DOT),
3930
3931 KEY(11, 0, KEY_LEFTCTRL),
3932 KEY(11, 1, KEY_F11),
3933 KEY(11, 2, KEY_ENTER),
3934 KEY(11, 3, KEY_SEARCH),
3935 KEY(11, 4, KEY_DELETE),
3936 KEY(11, 5, KEY_RIGHT),
3937 KEY(11, 6, KEY_LEFT),
3938 KEY(11, 7, KEY_RIGHTSHIFT),
3939 KEY(0, 0, KEY_VOLUMEUP),
3940 KEY(0, 1, KEY_VOLUMEDOWN),
3941 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3942 KEY(0, 3, KEY_CAMERA_FOCUS),
3943};
3944
3945static struct matrix_keymap_data keymap_data_sim = {
3946 .keymap_size = ARRAY_SIZE(keymap_sim),
3947 .keymap = keymap_sim,
3948};
3949
3950static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3951 .input_name = "keypad_8960",
3952 .input_phys_device = "keypad_8960/input0",
3953 .num_rows = 12,
3954 .num_cols = 8,
3955 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3956 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3957 .debounce_ms = 15,
3958 .scan_delay_ms = 32,
3959 .row_hold_ns = 91500,
3960 .wakeup = 1,
3961 .keymap_data = &keymap_data_sim,
3962};
3963
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003964static int pm8921_therm_mitigation[] = {
3965 1100,
3966 700,
3967 600,
3968 325,
3969};
3970
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003971static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003972 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003973 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003974 .max_voltage = 4200,
3975 .min_voltage = 3200,
3976 .resume_voltage = 4100,
3977 .term_current = 100,
3978 .cool_temp = 10,
3979 .warm_temp = 40,
3980 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003981 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003982 .cool_bat_chg_current = 350,
3983 .warm_bat_chg_current = 350,
3984 .cool_bat_voltage = 4100,
3985 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003986 .thermal_mitigation = pm8921_therm_mitigation,
3987 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003988};
3989
3990static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3991 .priority = 0,
3992};
3993
3994static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3995 .r_sense = 10,
3996 .i_test = 2500,
3997 .v_failure = 3000,
3998 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003999};
4000
Jay Chokshide4cefb2011-08-04 18:10:44 -07004001#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
4002
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004003static struct led_info pm8921_led_info[] = {
4004 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07004005 .name = "led:usb",
4006 .default_trigger = "usb-online",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004007 },
4008 [1] = {
4009 .name = "led:ac",
4010 .default_trigger = "ac-online",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004011 },
4012};
4013
Jay Chokshi8994e392011-09-14 18:20:39 -07004014static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004015 .num_leds = ARRAY_SIZE(pm8921_led_info),
4016 .leds = pm8921_led_info,
4017};
4018
Jay Chokshi8994e392011-09-14 18:20:39 -07004019static struct pm8xxx_led_config pm8921_led_configs[] = {
4020 [0] = {
4021 .id = PM8XXX_ID_LED_0,
4022 .mode = PM8XXX_LED_MODE_MANUAL,
4023 .max_current = PM8921_LC_LED_MAX_CURRENT,
4024 },
4025 [1] = {
4026 .id = PM8XXX_ID_LED_1,
4027 .mode = PM8XXX_LED_MODE_MANUAL,
4028 .max_current = PM8921_LC_LED_MAX_CURRENT,
4029 },
4030};
4031
4032static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4033 .led_core = &pm8921_led_core_pdata,
4034 .configs = pm8921_led_configs,
4035 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4036};
4037
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004038static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4039 .irq_pdata = &pm8xxx_irq_pdata,
4040 .gpio_pdata = &pm8xxx_gpio_pdata,
4041 .mpp_pdata = &pm8xxx_mpp_pdata,
4042 .rtc_pdata = &pm8xxx_rtc_pdata,
4043 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4044 .keypad_pdata = &keypad_data,
4045 .misc_pdata = &pm8xxx_misc_pdata,
4046 .regulator_pdatas = msm_pm8921_regulator_pdata,
4047 .charger_pdata = &pm8921_chg_pdata,
4048 .bms_pdata = &pm8921_bms_pdata,
4049 .adc_pdata = &pm8921_adc_pdata,
4050 .leds_pdata = &pm8xxx_leds_pdata,
4051};
4052
4053static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4054 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4055 .slave = {
4056 .name = "pm8921-core",
4057 .platform_data = &pm8921_platform_data,
4058 },
4059};
4060
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004061#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
4062static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004063{
4064 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004065
4066 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
4067 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004068 pr_err("FPGA CS gpio_request failed: %d\n", ret);
4069 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004070 }
4071
4072 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004074 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004075fail:
4076 return ret;
4077}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004078#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004079static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004080{
4081 return 0;
4082}
4083#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004084
4085static struct msm_cpuidle_state msm_cstates[] __initdata = {
4086 {0, 0, "C0", "WFI",
4087 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4088
4089 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4090 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4091
4092 {0, 2, "C2", "POWER_COLLAPSE",
4093 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4094
4095 {1, 0, "C0", "WFI",
4096 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4097
4098 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4099 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4100};
4101
4102static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4103 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4104 .idle_supported = 1,
4105 .suspend_supported = 1,
4106 .idle_enabled = 0,
4107 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004108 },
4109
4110 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4111 .idle_supported = 1,
4112 .suspend_supported = 1,
4113 .idle_enabled = 0,
4114 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004115 },
4116
4117 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4118 .idle_supported = 1,
4119 .suspend_supported = 1,
4120 .idle_enabled = 1,
4121 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004122 },
4123
4124 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4125 .idle_supported = 0,
4126 .suspend_supported = 1,
4127 .idle_enabled = 0,
4128 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004129 },
4130
4131 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4132 .idle_supported = 1,
4133 .suspend_supported = 1,
4134 .idle_enabled = 0,
4135 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004136 },
4137
4138 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4139 .idle_supported = 1,
4140 .suspend_supported = 0,
4141 .idle_enabled = 1,
4142 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004143 },
4144};
4145
4146static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4147 {
4148 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4149 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4150 true,
4151 1, 8000, 100000, 1,
4152 },
4153
4154 {
4155 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4156 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4157 true,
4158 1500, 5000, 60100000, 3000,
4159 },
4160
4161 {
4162 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4163 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4164 false,
4165 1800, 5000, 60350000, 3500,
4166 },
4167
4168 {
4169 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4170 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4171 false,
4172 2800, 2500, 65350000, 4800,
4173 },
4174
4175 {
4176 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4177 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4178 false,
4179 3800, 4500, 67850000, 5500,
4180 },
4181
4182 {
4183 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4184 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4185 false,
4186 4800, 2000, 71850000, 6800,
4187 },
4188
4189 {
4190 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4191 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4192 false,
4193 6800, 500, 75850000, 8800,
4194 },
4195
4196 {
4197 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4198 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4199 false,
4200 7800, 0, 76350000, 9800,
4201 },
4202};
4203
4204#ifdef CONFIG_I2C
4205#define I2C_SURF 1
4206#define I2C_FFA (1 << 1)
4207#define I2C_RUMI (1 << 2)
4208#define I2C_SIM (1 << 3)
4209#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004210#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004211
4212struct i2c_registry {
4213 u8 machs;
4214 int bus;
4215 struct i2c_board_info *info;
4216 int len;
4217};
4218
4219#ifdef CONFIG_MSM_CAMERA
4220static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4221#ifdef CONFIG_IMX074
4222 {
4223 I2C_BOARD_INFO("imx074", 0x1A),
4224 },
4225#endif
4226#ifdef CONFIG_OV2720
4227 {
4228 I2C_BOARD_INFO("ov2720", 0x6C),
4229 },
4230#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004231 {
4232 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4233 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304234#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4235 {
4236 I2C_BOARD_INFO("sc628a", 0x6E),
4237 },
4238#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004239};
4240#endif
4241
4242/* Sensors DSPS platform data */
4243#ifdef CONFIG_MSM_DSPS
4244#define DSPS_PIL_GENERIC_NAME "dsps"
4245#endif /* CONFIG_MSM_DSPS */
4246
4247static void __init msm8960_init_dsps(void)
4248{
4249#ifdef CONFIG_MSM_DSPS
4250 struct msm_dsps_platform_data *pdata =
4251 msm_dsps_device.dev.platform_data;
4252 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4253 pdata->gpios = NULL;
4254 pdata->gpios_num = 0;
4255
4256 platform_device_register(&msm_dsps_device);
4257#endif /* CONFIG_MSM_DSPS */
4258}
4259
Amir Samuelov5137e392011-09-21 17:31:25 +03004260#ifdef CONFIG_ISL9519_CHARGER
4261static struct isl_platform_data isl_data __initdata = {
4262 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4263 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4264 .max_system_voltage = 4200,
4265 .min_system_voltage = 3200,
4266 .chgcurrent = 1000, /* 1900, */
4267 .term_current = 400, /* Need fine tuning */
4268 .input_current = 2048,
4269};
4270
4271static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4272 {
4273 I2C_BOARD_INFO("isl9519q", 0x9),
4274 .irq = 0, /* Not required when notify-by-pmic */
4275 .platform_data = &isl_data,
4276 },
4277};
4278#endif /* CONFIG_ISL9519_CHARGER */
4279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004280static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4281#ifdef CONFIG_MSM_CAMERA
4282 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004283 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004284 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4285 msm_camera_boardinfo,
4286 ARRAY_SIZE(msm_camera_boardinfo),
4287 },
4288#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004289#ifdef CONFIG_ISL9519_CHARGER
4290 {
4291 I2C_LIQUID,
4292 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4293 isl_charger_i2c_info,
4294 ARRAY_SIZE(isl_charger_i2c_info),
4295 },
4296#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004297 {
4298 I2C_SURF | I2C_FFA | I2C_FLUID,
4299 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4300 cyttsp_info,
4301 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004302 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304303 {
4304 I2C_LIQUID,
4305 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4306 mxt_device_info,
4307 ARRAY_SIZE(mxt_device_info),
4308 },
4309
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004310};
4311#endif /* CONFIG_I2C */
4312
4313static void __init register_i2c_devices(void)
4314{
4315#ifdef CONFIG_I2C
4316 u8 mach_mask = 0;
4317 int i;
4318
4319 /* Build the matching 'supported_machs' bitmask */
4320 if (machine_is_msm8960_cdp())
4321 mach_mask = I2C_SURF;
4322 else if (machine_is_msm8960_rumi3())
4323 mach_mask = I2C_RUMI;
4324 else if (machine_is_msm8960_sim())
4325 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004326 else if (machine_is_msm8960_fluid())
4327 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004328 else if (machine_is_msm8960_liquid())
4329 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004330 else if (machine_is_msm8960_mtp())
4331 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004332 else
4333 pr_err("unmatched machine ID in register_i2c_devices\n");
4334
4335 /* Run the array and install devices as appropriate */
4336 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4337 if (msm8960_i2c_devices[i].machs & mach_mask)
4338 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4339 msm8960_i2c_devices[i].info,
4340 msm8960_i2c_devices[i].len);
4341 }
4342#endif
4343}
4344
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004345static void __init msm8960_sim_init(void)
4346{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004347 BUG_ON(msm_rpm_init(&msm_rpm_data));
4348 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4349 ARRAY_SIZE(msm_rpmrs_levels)));
4350 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004351 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004352 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 msm8960_device_ssbi_pm8921.dev.platform_data =
4354 &msm8960_ssbi_pm8921_pdata;
4355 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356
4357 /* Simulator supports a QWERTY keypad */
4358 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4359
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004360 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4361 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4362 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004363 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004364 msm8960_i2c_init();
4365 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4366 msm_spm_l2_init(msm_spm_l2_data);
4367 msm8960_init_buses();
4368 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4369 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004370 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004371 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004372
4373 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4374 &msm8960_qup_spi_gsbi1_pdata;
4375 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4376
4377 msm8960_init_mmc();
4378 msm_fb_add_devices();
4379 slim_register_board_info(msm_slim_devices,
4380 ARRAY_SIZE(msm_slim_devices));
4381 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4382 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4383 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4384 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004385}
4386
4387static void __init msm8960_rumi3_init(void)
4388{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004389 BUG_ON(msm_rpm_init(&msm_rpm_data));
4390 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4391 ARRAY_SIZE(msm_rpmrs_levels)));
4392 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004393 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004394 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004395 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004396 msm8960_device_ssbi_pm8921.dev.platform_data =
4397 &msm8960_ssbi_pm8921_pdata;
4398 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4399 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4400 &msm8960_qup_spi_gsbi1_pdata;
4401 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4402 msm8960_i2c_init();
4403 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4404 msm_spm_l2_init(msm_spm_l2_data);
4405 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4406 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004407 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004408 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004409 register_i2c_devices();
4410 msm_fb_add_devices();
4411 slim_register_board_info(msm_slim_devices,
4412 ARRAY_SIZE(msm_slim_devices));
4413 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4414 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4415 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4416 msm_pm_data);
4417}
4418
4419static void __init msm8960_cdp_init(void)
4420{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004421 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4422 pr_err("meminfo_init() failed!\n");
4423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004424 BUG_ON(msm_rpm_init(&msm_rpm_data));
4425 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4426 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004427
4428 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004429 regulator_suppress_info_printing();
4430 if (msm_xo_init())
4431 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004432 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004433 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004434 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4435 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4436 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004437 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004438 if (machine_is_msm8960_cdp())
4439 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304440 if (machine_is_msm8960_liquid())
4441 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004442 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4443 &msm8960_qup_spi_gsbi1_pdata;
4444 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4445 msm8960_device_ssbi_pm8921.dev.platform_data =
4446 &msm8960_ssbi_pm8921_pdata;
4447 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4448 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004449 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004450 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4451 msm_spm_l2_init(msm_spm_l2_data);
4452 msm8960_init_buses();
4453 platform_add_devices(msm_footswitch_devices,
4454 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004455 if (machine_is_msm8960_liquid())
4456 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004457 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4458 pm8921_gpio_mpp_init();
4459 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4460 msm8960_init_cam();
4461 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004462 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304463 if (machine_is_msm8960_liquid())
4464 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004465 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004466 msm_fb_add_devices();
4467 slim_register_board_info(msm_slim_devices,
4468 ARRAY_SIZE(msm_slim_devices));
4469 msm8960_init_dsps();
4470 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4471 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4472 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4473 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004474 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004475}
4476
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004477MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4478 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004479 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004480 .init_irq = msm8960_init_irq,
4481 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004482 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004483 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004484MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004485
4486MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4487 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004488 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004489 .init_irq = msm8960_init_irq,
4490 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004491 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004492 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004493MACHINE_END
4494
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004495MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4496 .map_io = msm8960_map_io,
4497 .reserve = msm8960_reserve,
4498 .init_irq = msm8960_init_irq,
4499 .timer = &msm_timer,
4500 .init_machine = msm8960_cdp_init,
4501 .init_early = msm8960_allocate_memory_regions,
4502MACHINE_END
4503
4504MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4505 .map_io = msm8960_map_io,
4506 .reserve = msm8960_reserve,
4507 .init_irq = msm8960_init_irq,
4508 .timer = &msm_timer,
4509 .init_machine = msm8960_cdp_init,
4510 .init_early = msm8960_allocate_memory_regions,
4511MACHINE_END
4512
4513MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4514 .map_io = msm8960_map_io,
4515 .reserve = msm8960_reserve,
4516 .init_irq = msm8960_init_irq,
4517 .timer = &msm_timer,
4518 .init_machine = msm8960_cdp_init,
4519 .init_early = msm8960_allocate_memory_regions,
4520MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004521
4522MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4523 .map_io = msm8960_map_io,
4524 .reserve = msm8960_reserve,
4525 .init_irq = msm8960_init_irq,
4526 .timer = &msm_timer,
4527 .init_machine = msm8960_cdp_init,
4528 .init_early = msm8960_allocate_memory_regions,
4529MACHINE_END