blob: 97f1d3af0df84edc4b6ebf39c555317274dccfa4 [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 Moskovchenkof441ca22010-12-01 19:31:16 -080041
42#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070044#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080045#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047
48#include <mach/board.h>
49#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <mach/msm_spi.h>
51#ifdef CONFIG_USB_MSM_OTG_72K
52#include <mach/msm_hsusb.h>
53#else
54#include <linux/usb/msm_hsusb.h>
55#endif
56#include <linux/usb/android.h>
57#include <mach/usbdiag.h>
58#include <mach/socinfo.h>
59#include <mach/rpm.h>
60#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070061#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#include <mach/msm_bus_board.h>
63#include <mach/msm_memtypes.h>
64#include <mach/dma.h>
65#include <mach/msm_dsps.h>
66#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070067#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080068
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070069#ifdef CONFIG_WCD9310_CODEC
70#include <linux/slimbus/slimbus.h>
71#include <linux/mfd/wcd9310/core.h>
72#include <linux/mfd/wcd9310/pdata.h>
73#endif
74
Laura Abbottd6183792011-08-19 13:42:24 -070075#include <linux/ion.h>
76#include <mach/ion.h>
77
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080079#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "spm.h"
82#include "board-msm8960.h"
83#include "pm.h"
84#include "cpuidle.h"
85#include "rpm_resources.h"
86#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070087#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070088#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070089#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090
91static struct platform_device msm_fm_platform_init = {
92 .name = "iris_fm",
93 .id = -1,
94};
95
96struct pm8xxx_gpio_init {
97 unsigned gpio;
98 struct pm_gpio config;
99};
100
101struct pm8xxx_mpp_init {
102 unsigned mpp;
103 struct pm8xxx_mpp_config_data config;
104};
105
106#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
107 _func, _inv, _disable) \
108{ \
109 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
110 .config = { \
111 .direction = _dir, \
112 .output_buffer = _buf, \
113 .output_value = _val, \
114 .pull = _pull, \
115 .vin_sel = _vin, \
116 .out_strength = _out_strength, \
117 .function = _func, \
118 .inv_int_pol = _inv, \
119 .disable_pin = _disable, \
120 } \
121}
122
123#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
124{ \
125 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
126 .config = { \
127 .type = PM8XXX_MPP_TYPE_##_type, \
128 .level = _level, \
129 .control = PM8XXX_MPP_##_control, \
130 } \
131}
132
133#define PM8XXX_GPIO_DISABLE(_gpio) \
134 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
135 0, 0, 0, 1)
136
137#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
139 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
140 PM_GPIO_STRENGTH_HIGH, \
141 PM_GPIO_FUNC_NORMAL, 0, 0)
142
143#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
144 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
145 _pull, PM_GPIO_VIN_S4, \
146 PM_GPIO_STRENGTH_NO, \
147 PM_GPIO_FUNC_NORMAL, 0, 0)
148
149#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
150 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
151 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
152 PM_GPIO_STRENGTH_HIGH, \
153 _func, 0, 0)
154
155/* Initial PM8921 GPIO configurations */
156static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
157 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
158 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
159 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300160 /* External regulator shared by display and touchscreen on LiQUID */
161 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
162 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700163 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700164 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700166 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700167};
168
169/* Initial PM8921 MPP configurations */
170static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
171 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
172 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
174 DOUT_CTRL_LOW),
175};
176
177static void __init pm8921_gpio_mpp_init(void)
178{
179 int i, rc;
180
181 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
182 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
183 &pm8921_gpios[i].config);
184 if (rc) {
185 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
186 break;
187 }
188 }
189
190 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
191 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
192 &pm8921_mpps[i].config);
193 if (rc) {
194 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
195 break;
196 }
197 }
198}
199
200#define FPGA_CS_GPIO 14
201#define KS8851_RST_GPIO 89
202#define KS8851_IRQ_GPIO 90
203
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700204#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
205enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700206 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700207 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
208 /* CAM Expander */
209 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
210 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
211 GPIO_CAM_GP_AFBUSY,
212 GPIO_CAM_GP_STROBE_CE,
213 GPIO_CAM_GP_CAM1MP_XCLR,
214 GPIO_CAM_GP_CAMIF_RESET_N,
215 GPIO_CAM_GP_XMT_FLASH_INT,
216 GPIO_CAM_GP_LED_EN1,
217 GPIO_CAM_GP_LED_EN2,
218
219};
220#endif
221
Harini Jayaraman608d0462011-08-09 19:10:03 -0600222/* The SPI configurations apply to GSBI 1*/
223static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700224 .func = GPIOMUX_FUNC_1,
225 .drv = GPIOMUX_DRV_8MA,
226 .pull = GPIOMUX_PULL_NONE,
227};
228
Harini Jayaraman608d0462011-08-09 19:10:03 -0600229static struct gpiomux_setting spi_suspended_config = {
230 .func = GPIOMUX_FUNC_GPIO,
231 .drv = GPIOMUX_DRV_2MA,
232 .pull = GPIOMUX_PULL_DOWN,
233};
234
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700235static struct gpiomux_setting gsbi3 = {
236 .func = GPIOMUX_FUNC_1,
237 .drv = GPIOMUX_DRV_8MA,
238 .pull = GPIOMUX_PULL_NONE,
239};
240
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700241static struct gpiomux_setting gsbi5 = {
242 .func = GPIOMUX_FUNC_1,
243 .drv = GPIOMUX_DRV_8MA,
244 .pull = GPIOMUX_PULL_NONE,
245};
246
247static struct gpiomux_setting gsbi10 = {
248 .func = GPIOMUX_FUNC_2,
249 .drv = GPIOMUX_DRV_8MA,
250 .pull = GPIOMUX_PULL_NONE,
251};
252
253static struct gpiomux_setting gsbi12 = {
254 .func = GPIOMUX_FUNC_1,
255 .drv = GPIOMUX_DRV_8MA,
256 .pull = GPIOMUX_PULL_NONE,
257};
258
259static struct gpiomux_setting cdc_mclk = {
260 .func = GPIOMUX_FUNC_1,
261 .drv = GPIOMUX_DRV_8MA,
262 .pull = GPIOMUX_PULL_NONE,
263};
264
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700265static struct gpiomux_setting audio_auxpcm[] = {
266 /* Suspended state */
267 {
268 .func = GPIOMUX_FUNC_GPIO,
269 .drv = GPIOMUX_DRV_2MA,
270 .pull = GPIOMUX_PULL_NONE,
271 },
272 /* Active state */
273 {
274 .func = GPIOMUX_FUNC_1,
275 .drv = GPIOMUX_DRV_2MA,
276 .pull = GPIOMUX_PULL_NONE,
277 },
278};
279
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700280#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281static struct gpiomux_setting gpio_eth_config = {
282 .pull = GPIOMUX_PULL_NONE,
283 .drv = GPIOMUX_DRV_8MA,
284 .func = GPIOMUX_FUNC_GPIO,
285};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700286#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700287
288static struct gpiomux_setting slimbus = {
289 .func = GPIOMUX_FUNC_1,
290 .drv = GPIOMUX_DRV_8MA,
291 .pull = GPIOMUX_PULL_KEEPER,
292};
293
294struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700295#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 {
297 .gpio = KS8851_IRQ_GPIO,
298 .settings = {
299 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
300 }
301 },
302 {
303 .gpio = KS8851_RST_GPIO,
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
306 }
307 },
308 {
309 .gpio = FPGA_CS_GPIO,
310 .settings = {
311 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
312 }
313 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700314#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315};
316
317static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
318 {
319 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
320 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600321 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
322 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 },
324 },
325 {
326 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
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 = 8, /* GSBI1 QUP SPI_CS_N */
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 = 9, /* GSBI1 QUP SPI_CLK */
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 = 16, /* GSBI3 I2C QUP SDA */
348 .settings = {
349 [GPIOMUX_SUSPENDED] = &gsbi3,
350 },
351 },
352 {
353 .gpio = 17, /* GSBI3 I2C QUP SCL */
354 .settings = {
355 [GPIOMUX_SUSPENDED] = &gsbi3,
356 },
357 },
358 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 .gpio = 22, /* GSBI5 UART2 */
360 .settings = {
361 [GPIOMUX_SUSPENDED] = &gsbi5,
362 },
363 },
364 {
365 .gpio = 23, /* GSBI5 UART2 */
366 .settings = {
367 [GPIOMUX_SUSPENDED] = &gsbi5,
368 },
369 },
370 {
371 .gpio = 24, /* GSBI5 UART2 */
372 .settings = {
373 [GPIOMUX_SUSPENDED] = &gsbi5,
374 },
375 },
376 {
377 .gpio = 25, /* GSBI5 UART2 */
378 .settings = {
379 [GPIOMUX_SUSPENDED] = &gsbi5,
380 },
381 },
382 {
383 .gpio = 44, /* GSBI12 I2C QUP SDA */
384 .settings = {
385 [GPIOMUX_SUSPENDED] = &gsbi12,
386 },
387 },
388 {
389 .gpio = 45, /* GSBI12 I2C QUP SCL */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &gsbi12,
392 },
393 },
394 {
395 .gpio = 73, /* GSBI10 I2C QUP SDA */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &gsbi10,
398 },
399 },
400 {
401 .gpio = 74, /* GSBI10 I2C QUP SCL */
402 .settings = {
403 [GPIOMUX_SUSPENDED] = &gsbi10,
404 },
405 },
406};
407
408static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
409 {
410 .gpio = 60, /* slimbus data */
411 .settings = {
412 [GPIOMUX_SUSPENDED] = &slimbus,
413 },
414 },
415 {
416 .gpio = 61, /* slimbus clk */
417 .settings = {
418 [GPIOMUX_SUSPENDED] = &slimbus,
419 },
420 },
421};
422
423static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
424 {
425 .gpio = 59,
426 .settings = {
427 [GPIOMUX_SUSPENDED] = &cdc_mclk,
428 },
429 },
430};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700431
432static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
433 {
434 .gpio = 63,
435 .settings = {
436 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
437 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
438 },
439 },
440 {
441 .gpio = 64,
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
444 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
445 },
446 },
447 {
448 .gpio = 65,
449 .settings = {
450 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
451 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
452 },
453 },
454 {
455 .gpio = 66,
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
458 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
459 },
460 },
461};
462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700463static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
464 .func = GPIOMUX_FUNC_GPIO,
465 .drv = GPIOMUX_DRV_2MA,
466 .pull = GPIOMUX_PULL_NONE,
467};
468
469static struct gpiomux_setting wcnss_5wire_active_cfg = {
470 .func = GPIOMUX_FUNC_1,
471 .drv = GPIOMUX_DRV_6MA,
472 .pull = GPIOMUX_PULL_DOWN,
473};
474
475static struct msm_gpiomux_config wcnss_5wire_interface[] = {
476 {
477 .gpio = 84,
478 .settings = {
479 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
480 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
481 },
482 },
483 {
484 .gpio = 85,
485 .settings = {
486 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
487 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
488 },
489 },
490 {
491 .gpio = 86,
492 .settings = {
493 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
494 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
495 },
496 },
497 {
498 .gpio = 87,
499 .settings = {
500 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
501 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
502 },
503 },
504 {
505 .gpio = 88,
506 .settings = {
507 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
508 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
509 },
510 },
511};
Nishant Pandit24153d82011-08-27 16:05:13 +0530512static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530513 {
514 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
515 .drv = GPIOMUX_DRV_2MA,
516 .pull = GPIOMUX_PULL_DOWN,
517 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700518
Nishant Pandit474f2252011-07-23 23:17:56 +0530519 {
520 .func = GPIOMUX_FUNC_1, /*active 1*/
521 .drv = GPIOMUX_DRV_2MA,
522 .pull = GPIOMUX_PULL_NONE,
523 },
524
525 {
526 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
527 .drv = GPIOMUX_DRV_2MA,
528 .pull = GPIOMUX_PULL_NONE,
529 },
530
531 {
532 .func = GPIOMUX_FUNC_1, /*active 3*/
533 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700534 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530535 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530536
537 {
538 .func = GPIOMUX_FUNC_5, /*active 4*/
539 .drv = GPIOMUX_DRV_8MA,
540 .pull = GPIOMUX_PULL_UP,
541 },
542
543 {
544 .func = GPIOMUX_FUNC_6, /*active 5*/
545 .drv = GPIOMUX_DRV_8MA,
546 .pull = GPIOMUX_PULL_UP,
547 },
548
549 {
550 .func = GPIOMUX_FUNC_2, /*active 6*/
551 .drv = GPIOMUX_DRV_2MA,
552 .pull = GPIOMUX_PULL_UP,
553 },
554
555 {
556 .func = GPIOMUX_FUNC_3, /*active 7*/
557 .drv = GPIOMUX_DRV_8MA,
558 .pull = GPIOMUX_PULL_UP,
559 },
560
Kevin Chan4c58d292011-09-13 11:03:25 -0700561 {
562 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
563 .drv = GPIOMUX_DRV_2MA,
564 .pull = GPIOMUX_PULL_KEEPER,
565 },
566
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700567};
568
Nishant Pandit24153d82011-08-27 16:05:13 +0530569static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570 {
571 .gpio = 2,
572 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530573 [GPIOMUX_ACTIVE] = &cam_settings[2],
574 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700575 },
576 },
577 {
578 .gpio = 3,
579 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530580 [GPIOMUX_ACTIVE] = &cam_settings[1],
581 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 },
583 },
584 {
585 .gpio = 4,
586 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530587 [GPIOMUX_ACTIVE] = &cam_settings[1],
588 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589 },
590 },
591 {
592 .gpio = 5,
593 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530594 [GPIOMUX_ACTIVE] = &cam_settings[1],
595 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596 },
597 },
598 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530599 .gpio = 76,
600 .settings = {
601 [GPIOMUX_ACTIVE] = &cam_settings[2],
602 [GPIOMUX_SUSPENDED] = &cam_settings[0],
603 },
604 },
605 {
606 .gpio = 107,
607 .settings = {
608 [GPIOMUX_ACTIVE] = &cam_settings[2],
609 [GPIOMUX_SUSPENDED] = &cam_settings[0],
610 },
611 },
612};
613
614static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
615 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700616 .gpio = 18,
617 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530618 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700619 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 },
621 },
622 {
623 .gpio = 19,
624 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530625 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700626 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627 },
628 },
629 {
630 .gpio = 20,
631 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530632 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700633 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634 },
635 },
636 {
637 .gpio = 21,
638 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530639 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700640 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641 },
642 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643};
644
645static struct gpiomux_setting cyts_resout_sus_cfg = {
646 .func = GPIOMUX_FUNC_GPIO,
647 .drv = GPIOMUX_DRV_6MA,
648 .pull = GPIOMUX_PULL_UP,
649};
650
651static struct gpiomux_setting cyts_resout_act_cfg = {
652 .func = GPIOMUX_FUNC_GPIO,
653 .drv = GPIOMUX_DRV_6MA,
654 .pull = GPIOMUX_PULL_UP,
655};
656
657static struct gpiomux_setting cyts_sleep_sus_cfg = {
658 .func = GPIOMUX_FUNC_GPIO,
659 .drv = GPIOMUX_DRV_6MA,
660 .pull = GPIOMUX_PULL_DOWN,
661};
662
663static struct gpiomux_setting cyts_sleep_act_cfg = {
664 .func = GPIOMUX_FUNC_GPIO,
665 .drv = GPIOMUX_DRV_6MA,
666 .pull = GPIOMUX_PULL_DOWN,
667};
668
669static struct gpiomux_setting cyts_int_act_cfg = {
670 .func = GPIOMUX_FUNC_GPIO,
671 .drv = GPIOMUX_DRV_8MA,
672 .pull = GPIOMUX_PULL_UP,
673};
674
675static struct gpiomux_setting cyts_int_sus_cfg = {
676 .func = GPIOMUX_FUNC_GPIO,
677 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530678 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700679};
680
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
682 { /* TS INTERRUPT */
683 .gpio = 11,
684 .settings = {
685 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
686 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
687 },
688 },
689 { /* TS SLEEP */
690 .gpio = 50,
691 .settings = {
692 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
693 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
694 },
695 },
696 { /* TS RESOUT */
697 .gpio = 52,
698 .settings = {
699 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
700 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
701 },
702 },
703};
704
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700705#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
706enum {
707 SX150X_CAM,
708};
709
Nishant Pandit474f2252011-07-23 23:17:56 +0530710static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700711 [SX150X_CAM] = {
712 .gpio_base = GPIO_CAM_EXPANDER_BASE,
713 .oscio_is_gpo = false,
714 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530715 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700716 .io_open_drain_ena = 0x0,
717 .irq_summary = -1,
718 },
719};
Nishant Pandit474f2252011-07-23 23:17:56 +0530720
721#endif
722
723#ifdef CONFIG_I2C
724
725#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
726#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300727#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530728
729#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
730
731static struct i2c_board_info cam_expander_i2c_info[] = {
732 {
733 I2C_BOARD_INFO("sx1508q", 0x22),
734 .platform_data = &sx150x_data[SX150X_CAM]
735 },
736};
737
738static struct msm_cam_expander_info cam_expander_info[] = {
739 {
740 cam_expander_i2c_info,
741 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
742 },
743};
744#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700745#endif
746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700747#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
748#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700749#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700750#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
751
Laura Abbottd6183792011-08-19 13:42:24 -0700752#define MSM_ION_EBI_SIZE SZ_8M
753
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
755static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
756static int __init pmem_kernel_ebi1_size_setup(char *p)
757{
758 pmem_kernel_ebi1_size = memparse(p, NULL);
759 return 0;
760}
761early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
762#endif
763
764#ifdef CONFIG_ANDROID_PMEM
765static unsigned pmem_size = MSM_PMEM_SIZE;
766static int __init pmem_size_setup(char *p)
767{
768 pmem_size = memparse(p, NULL);
769 return 0;
770}
771early_param("pmem_size", pmem_size_setup);
772
773static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
774
775static int __init pmem_adsp_size_setup(char *p)
776{
777 pmem_adsp_size = memparse(p, NULL);
778 return 0;
779}
780early_param("pmem_adsp_size", pmem_adsp_size_setup);
781
782static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
783
784static int __init pmem_audio_size_setup(char *p)
785{
786 pmem_audio_size = memparse(p, NULL);
787 return 0;
788}
789early_param("pmem_audio_size", pmem_audio_size_setup);
790#endif
791
792#ifdef CONFIG_ANDROID_PMEM
793static struct android_pmem_platform_data android_pmem_pdata = {
794 .name = "pmem",
795 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
796 .cached = 1,
797 .memory_type = MEMTYPE_EBI1,
798};
799
800static struct platform_device android_pmem_device = {
801 .name = "android_pmem",
802 .id = 0,
803 .dev = {.platform_data = &android_pmem_pdata},
804};
805
806static struct android_pmem_platform_data android_pmem_adsp_pdata = {
807 .name = "pmem_adsp",
808 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
809 .cached = 0,
810 .memory_type = MEMTYPE_EBI1,
811};
812static struct platform_device android_pmem_adsp_device = {
813 .name = "android_pmem",
814 .id = 2,
815 .dev = { .platform_data = &android_pmem_adsp_pdata },
816};
817
818static struct android_pmem_platform_data android_pmem_audio_pdata = {
819 .name = "pmem_audio",
820 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
821 .cached = 0,
822 .memory_type = MEMTYPE_EBI1,
823};
824
825static struct platform_device android_pmem_audio_device = {
826 .name = "android_pmem",
827 .id = 4,
828 .dev = { .platform_data = &android_pmem_audio_pdata },
829};
830#endif
831
832static struct memtype_reserve msm8960_reserve_table[] __initdata = {
833 [MEMTYPE_SMI] = {
834 },
835 [MEMTYPE_EBI0] = {
836 .flags = MEMTYPE_FLAGS_1M_ALIGN,
837 },
838 [MEMTYPE_EBI1] = {
839 .flags = MEMTYPE_FLAGS_1M_ALIGN,
840 },
841};
842
843static void __init size_pmem_devices(void)
844{
845#ifdef CONFIG_ANDROID_PMEM
846 android_pmem_adsp_pdata.size = pmem_adsp_size;
847 android_pmem_pdata.size = pmem_size;
848 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
849#endif
850}
851
852static void __init reserve_memory_for(struct android_pmem_platform_data *p)
853{
854 msm8960_reserve_table[p->memory_type].size += p->size;
855}
856
857static void __init reserve_pmem_memory(void)
858{
859#ifdef CONFIG_ANDROID_PMEM
860 reserve_memory_for(&android_pmem_adsp_pdata);
861 reserve_memory_for(&android_pmem_pdata);
862 reserve_memory_for(&android_pmem_audio_pdata);
863 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
864#endif
865}
866
Larry Basselb4126da2011-07-18 14:31:33 -0700867static int msm8960_paddr_to_memtype(unsigned int paddr)
868{
869 return MEMTYPE_EBI1;
870}
871
Laura Abbottd6183792011-08-19 13:42:24 -0700872#ifdef CONFIG_ION_MSM
873struct ion_platform_data ion_pdata = {
874 .nr = 3,
875 .heaps = {
876 {
877 .id = ION_HEAP_SYSTEM_ID,
878 .type = ION_HEAP_TYPE_SYSTEM,
879 .name = ION_KMALLOC_HEAP_NAME,
880 },
881 {
882 .id = ION_HEAP_SYSTEM_CONTIG_ID,
883 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
884 .name = ION_VMALLOC_HEAP_NAME,
885 },
886 {
887 .id = ION_HEAP_EBI_ID,
888 .type = ION_HEAP_TYPE_CARVEOUT,
889 .name = ION_EBI1_HEAP_NAME,
890 .size = MSM_ION_EBI_SIZE,
891 .memory_type = ION_EBI_TYPE,
892 },
893 }
894};
895
896struct platform_device ion_dev = {
897 .name = "ion-msm",
898 .id = 1,
899 .dev = { .platform_data = &ion_pdata },
900};
901#endif
902
903static void reserve_ion_memory(void)
904{
905#ifdef CONFIG_ION_MSM
906 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
907#endif
908}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909static void __init msm8960_calculate_reserve_sizes(void)
910{
911 size_pmem_devices();
912 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700913 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700914}
915
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700916static struct reserve_info msm8960_reserve_info __initdata = {
917 .memtype_reserve_table = msm8960_reserve_table,
918 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
919 .paddr_to_memtype = msm8960_paddr_to_memtype,
920};
921
Larry Basselb4126da2011-07-18 14:31:33 -0700922static int msm8960_memory_bank_size(void)
923{
924 return 1<<29;
925}
926
927static void __init locate_unstable_memory(void)
928{
929 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
930 unsigned long bank_size;
931 unsigned long low, high;
932
933 bank_size = msm8960_memory_bank_size();
934 low = meminfo.bank[0].start;
935 high = mb->start + mb->size;
936 low &= ~(bank_size - 1);
937
938 if (high - low <= bank_size)
939 return;
940 msm8960_reserve_info.low_unstable_address = low + bank_size;
941 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
942 msm8960_reserve_info.bank_size = bank_size;
943 pr_info("low unstable address %lx max size %lx bank size %lx\n",
944 msm8960_reserve_info.low_unstable_address,
945 msm8960_reserve_info.max_unstable_size,
946 msm8960_reserve_info.bank_size);
947}
948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949static void __init msm8960_reserve(void)
950{
951 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700952 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700953 msm_reserve();
954}
955
Larry Bassela4414b12011-08-04 11:11:02 -0700956static int msm8960_change_memory_power(u64 start, u64 size,
957 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700958{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700959 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700960}
961
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700962#ifdef CONFIG_MSM_CAMERA
963
Nishant Pandit24153d82011-08-27 16:05:13 +0530964static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965 5, /*CAMIF_MCLK*/
966 20, /*CAMIF_I2C_DATA*/
967 21, /*CAMIF_I2C_CLK*/
968};
969
Nishant Pandit24153d82011-08-27 16:05:13 +0530970static struct msm_camera_gpio_conf gpio_conf = {
971 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
972 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
973 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
974 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
975};
976
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700977#define VFE_CAMIF_TIMER1_GPIO 2
978#define VFE_CAMIF_TIMER2_GPIO 3
979#define VFE_CAMIF_TIMER3_GPIO_INT 4
980struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
981 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
982 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
983 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
984 .flash_recharge_duration = 50000,
985 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
986};
987
Nishant Pandit474f2252011-07-23 23:17:56 +0530988#ifdef CONFIG_MSM_CAMERA_FLASH
989static struct msm_camera_sensor_flash_src msm_flash_src = {
990 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
991 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
992 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
993#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
994 defined(CONFIG_GPIO_SX150X_MODULE))
995 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
996#endif
997};
998#endif
999
Nishant Pandit24153d82011-08-27 16:05:13 +05301000struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1001 {
1002 .ioclk.mclk_clk_rate = 24000000,
1003 .ioclk.vfe_clk_rate = 228570000,
1004 .csid_core = 0,
1005 },
1006 {
1007 .ioclk.mclk_clk_rate = 24000000,
1008 .ioclk.vfe_clk_rate = 228570000,
1009 .csid_core = 1,
1010 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011};
1012
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001013#ifdef CONFIG_IMX074_ACT
1014static struct i2c_board_info imx074_actuator_i2c_info = {
1015 I2C_BOARD_INFO("imx074_act", 0x11),
1016};
1017
1018static struct msm_actuator_info imx074_actuator_info = {
1019 .board_info = &imx074_actuator_i2c_info,
1020 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1021 .vcm_pwd = 0,
1022 .vcm_enable = 1,
1023};
1024#endif
1025
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001026#ifdef CONFIG_IMX074
1027static struct msm_camera_sensor_flash_data flash_imx074 = {
1028 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301029#ifdef CONFIG_MSM_CAMERA_FLASH
1030 .flash_src = &msm_flash_src
1031#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001032};
1033
Nishant Pandit24153d82011-08-27 16:05:13 +05301034static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1035 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001036 .sensor_reset = 107,
1037 .sensor_pwd = 85,
1038 .vcm_pwd = 0,
1039 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301040};
1041
1042static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1043 .sensor_name = "imx074",
1044 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001045 .flash_data = &flash_imx074,
1046 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301047 .sensor_platform_info = &sensor_board_info_imx074,
1048 .gpio_conf = &gpio_conf,
1049 .csi_if = 1,
1050 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001051#ifdef CONFIG_IMX074_ACT
1052 .actuator_info = &imx074_actuator_info
1053#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001054};
1055
1056struct platform_device msm8960_camera_sensor_imx074 = {
1057 .name = "msm_camera_imx074",
1058 .dev = {
1059 .platform_data = &msm_camera_sensor_imx074_data,
1060 },
1061};
1062#endif
1063#ifdef CONFIG_OV2720
1064static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001065 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066};
1067
Nishant Pandit24153d82011-08-27 16:05:13 +05301068static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1069 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070 .sensor_reset = 76,
1071 .sensor_pwd = 85,
1072 .vcm_pwd = 0,
1073 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301074};
1075
1076static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1077 .sensor_name = "ov2720",
1078 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001079 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301080 .sensor_platform_info = &sensor_board_info_ov2720,
1081 .gpio_conf = &gpio_conf,
1082 .csi_if = 1,
1083 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001084};
1085
1086struct platform_device msm8960_camera_sensor_ov2720 = {
1087 .name = "msm_camera_ov2720",
1088 .dev = {
1089 .platform_data = &msm_camera_sensor_ov2720_data,
1090 },
1091};
1092#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001093
1094static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1095 .flash_type = MSM_CAMERA_FLASH_LED,
1096};
1097
Nishant Pandit24153d82011-08-27 16:05:13 +05301098static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1099 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001100 .sensor_reset = 107,
1101 .sensor_pwd = 85,
1102 .vcm_pwd = 0,
1103 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301104};
1105
1106static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1107 .sensor_name = "qs_mt9p017",
1108 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001109 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301110 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1111 .gpio_conf = &gpio_conf,
1112 .csi_if = 1,
1113 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001114};
1115
1116struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1117 .name = "msm_camera_qs_mt9p017",
1118 .dev = {
1119 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1120 },
1121};
1122
Kevin Chan8b0d2322011-09-10 21:06:31 -07001123static struct msm8960_privacy_light_cfg privacy_light_info = {
1124 .mpp = PM8921_MPP_PM_TO_SYS(12),
1125};
1126
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001127static void __init msm8960_init_cam(void)
1128{
1129 int i;
1130 struct platform_device *cam_dev[] = {
1131 &msm8960_camera_sensor_imx074,
1132 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001133 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001134 };
1135
Kevin Chan8b0d2322011-09-10 21:06:31 -07001136 if (machine_is_msm8960_liquid()) {
1137 struct msm_camera_sensor_info *s_info;
1138 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1139 s_info->sensor_platform_info->mount_angle = 180;
1140 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1141 s_info->sensor_platform_info->privacy_light = 1;
1142 s_info->sensor_platform_info->privacy_light_info =
1143 &privacy_light_info;
1144 }
1145
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001146 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1147 struct msm_camera_sensor_info *s_info;
1148 s_info = cam_dev[i]->dev.platform_data;
1149 msm_get_cam_resources(s_info);
1150 platform_device_register(cam_dev[i]);
1151 }
1152}
1153#endif
1154
1155#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001156#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001157#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001158#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159#endif
1160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001161
1162#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001163#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001164#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001165#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1166#else
1167#define MSM_FB_EXT_BUF_SIZE 0
1168#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001169
kuogee hsieh3830eb92011-09-12 15:25:57 -07001170#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1171/* width x height x 3 bpp x 2 frame buffer */
1172#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1173#define MSM_FB_WRITEBACK_OFFSET \
1174 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1175#else
1176#define MSM_FB_WRITEBACK_SIZE 0
1177#define MSM_FB_WRITEBACK_OFFSET 0
1178#endif
1179
1180
1181/* Note: must be multiple of 4096 */
1182#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1183 MSM_FB_WRITEBACK_SIZE, 4096)
1184
1185static int writeback_offset(void)
1186{
1187 return MSM_FB_WRITEBACK_OFFSET;
1188}
1189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001190
1191#define MDP_VSYNC_GPIO 0
1192
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001193#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1194#define TOSHIBA_PANEL_NAME_LEN 24
1195#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1196#define CHIMEI_PANEL_NAME_LEN 16
1197
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198static struct resource msm_fb_resources[] = {
1199 {
1200 .flags = IORESOURCE_DMA,
1201 }
1202};
1203
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001204#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1205static int msm_fb_detect_panel(const char *name)
1206{
1207 if (machine_is_msm8960_liquid()) {
1208 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1209 return 0;
1210 } else {
1211 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1212 return 0;
1213 }
1214
1215 pr_warning("%s: not supported '%s'", __func__, name);
1216
1217 return -ENODEV;
1218}
1219
1220static struct msm_fb_platform_data msm_fb_pdata = {
1221 .detect_client = msm_fb_detect_panel,
1222};
1223#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1224
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001225static struct platform_device msm_fb_device = {
1226 .name = "msm_fb",
1227 .id = 0,
1228 .num_resources = ARRAY_SIZE(msm_fb_resources),
1229 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001230#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1231 .dev.platform_data = &msm_fb_pdata,
1232#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001233};
1234
1235static bool dsi_power_on;
1236
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001237/**
1238 * LiQUID panel on/off
1239 *
1240 * @param on
1241 *
1242 * @return int
1243 */
1244static int mipi_dsi_liquid_panel_power(int on)
1245{
1246 static struct regulator *reg_l2, *reg_ext_3p3v;
1247 static int gpio21, gpio24, gpio43;
1248 int rc;
1249
1250 pr_info("%s: on=%d\n", __func__, on);
1251
1252 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1253 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1254 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1255
1256 if (!dsi_power_on) {
1257
1258 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1259 "dsi_vdda");
1260 if (IS_ERR(reg_l2)) {
1261 pr_err("could not get 8921_l2, rc = %ld\n",
1262 PTR_ERR(reg_l2));
1263 return -ENODEV;
1264 }
1265
1266 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1267 if (rc) {
1268 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1269 return -EINVAL;
1270 }
1271
1272 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1273 "vdd_lvds_3p3v");
1274 if (IS_ERR(reg_ext_3p3v)) {
1275 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1276 PTR_ERR(reg_ext_3p3v));
1277 return -ENODEV;
1278 }
1279
1280 rc = gpio_request(gpio21, "disp_pwr_en_n");
1281 if (rc) {
1282 pr_err("request gpio 21 failed, rc=%d\n", rc);
1283 return -ENODEV;
1284 }
1285
1286 rc = gpio_request(gpio43, "disp_rst_n");
1287 if (rc) {
1288 pr_err("request gpio 43 failed, rc=%d\n", rc);
1289 return -ENODEV;
1290 }
1291
1292 rc = gpio_request(gpio24, "disp_backlight_pwm");
1293 if (rc) {
1294 pr_err("request gpio 24 failed, rc=%d\n", rc);
1295 return -ENODEV;
1296 }
1297
1298 dsi_power_on = true;
1299 }
1300
1301 if (on) {
1302 rc = regulator_set_optimum_mode(reg_l2, 100000);
1303 if (rc < 0) {
1304 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1305 return -EINVAL;
1306 }
1307 rc = regulator_enable(reg_l2);
1308 if (rc) {
1309 pr_err("enable l2 failed, rc=%d\n", rc);
1310 return -ENODEV;
1311 }
1312
1313 rc = regulator_enable(reg_ext_3p3v);
1314 if (rc) {
1315 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1316 return -ENODEV;
1317 }
1318
1319 /* set reset pin before power enable */
1320 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1321
1322 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1323 msleep(20);
1324 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1325 msleep(20);
1326 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1327 msleep(20);
1328 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1329 msleep(20);
1330 } else {
1331 gpio_set_value_cansleep(gpio43, 0);
1332 gpio_set_value_cansleep(gpio21, 1);
1333
1334 rc = regulator_disable(reg_l2);
1335 if (rc) {
1336 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1337 return -ENODEV;
1338 }
1339 rc = regulator_disable(reg_ext_3p3v);
1340 if (rc) {
1341 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1342 return -ENODEV;
1343 }
1344 rc = regulator_set_optimum_mode(reg_l2, 100);
1345 if (rc < 0) {
1346 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1347 return -EINVAL;
1348 }
1349 }
1350
1351 return 0;
1352}
1353
1354static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001355{
1356 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001357 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 int rc;
1359
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360 pr_info("%s: state : %d\n", __func__, on);
1361
1362 if (!dsi_power_on) {
1363
1364 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1365 "dsi_vdc");
1366 if (IS_ERR(reg_l8)) {
1367 pr_err("could not get 8921_l8, rc = %ld\n",
1368 PTR_ERR(reg_l8));
1369 return -ENODEV;
1370 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1372 "dsi_vddio");
1373 if (IS_ERR(reg_l23)) {
1374 pr_err("could not get 8921_l23, rc = %ld\n",
1375 PTR_ERR(reg_l23));
1376 return -ENODEV;
1377 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001378 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1379 "dsi_vdda");
1380 if (IS_ERR(reg_l2)) {
1381 pr_err("could not get 8921_l2, rc = %ld\n",
1382 PTR_ERR(reg_l2));
1383 return -ENODEV;
1384 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1386 if (rc) {
1387 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1388 return -EINVAL;
1389 }
1390 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1391 if (rc) {
1392 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1393 return -EINVAL;
1394 }
1395 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1396 if (rc) {
1397 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1398 return -EINVAL;
1399 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001400 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1401 rc = gpio_request(gpio43, "disp_rst_n");
1402 if (rc) {
1403 pr_err("request gpio 43 failed, rc=%d\n", rc);
1404 return -ENODEV;
1405 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406 dsi_power_on = true;
1407 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001408 if (on) {
1409 rc = regulator_set_optimum_mode(reg_l8, 100000);
1410 if (rc < 0) {
1411 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1412 return -EINVAL;
1413 }
1414 rc = regulator_set_optimum_mode(reg_l23, 100000);
1415 if (rc < 0) {
1416 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1417 return -EINVAL;
1418 }
1419 rc = regulator_set_optimum_mode(reg_l2, 100000);
1420 if (rc < 0) {
1421 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1422 return -EINVAL;
1423 }
1424 rc = regulator_enable(reg_l8);
1425 if (rc) {
1426 pr_err("enable l8 failed, rc=%d\n", rc);
1427 return -ENODEV;
1428 }
1429 rc = regulator_enable(reg_l23);
1430 if (rc) {
1431 pr_err("enable l8 failed, rc=%d\n", rc);
1432 return -ENODEV;
1433 }
1434 rc = regulator_enable(reg_l2);
1435 if (rc) {
1436 pr_err("enable l2 failed, rc=%d\n", rc);
1437 return -ENODEV;
1438 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001439 gpio_set_value_cansleep(gpio43, 1);
1440 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001441 rc = regulator_disable(reg_l2);
1442 if (rc) {
1443 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1444 return -ENODEV;
1445 }
1446 rc = regulator_disable(reg_l8);
1447 if (rc) {
1448 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1449 return -ENODEV;
1450 }
1451 rc = regulator_disable(reg_l23);
1452 if (rc) {
1453 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1454 return -ENODEV;
1455 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456 rc = regulator_set_optimum_mode(reg_l8, 100);
1457 if (rc < 0) {
1458 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1459 return -EINVAL;
1460 }
1461 rc = regulator_set_optimum_mode(reg_l23, 100);
1462 if (rc < 0) {
1463 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1464 return -EINVAL;
1465 }
1466 rc = regulator_set_optimum_mode(reg_l2, 100);
1467 if (rc < 0) {
1468 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1469 return -EINVAL;
1470 }
1471 gpio_set_value_cansleep(gpio43, 0);
1472 }
1473 return 0;
1474}
1475
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001476static int mipi_dsi_panel_power(int on)
1477{
1478 int ret;
1479
1480 pr_info("%s: on=%d\n", __func__, on);
1481
1482 if (machine_is_msm8960_liquid())
1483 ret = mipi_dsi_liquid_panel_power(on);
1484 else
1485 ret = mipi_dsi_cdp_panel_power(on);
1486
1487 return ret;
1488}
1489
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1491 .vsync_gpio = MDP_VSYNC_GPIO,
1492 .dsi_power_save = mipi_dsi_panel_power,
1493};
1494
1495#ifdef CONFIG_MSM_BUS_SCALING
1496
1497static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498 {
1499 .src = MSM_BUS_MASTER_MDP_PORT0,
1500 .dst = MSM_BUS_SLAVE_EBI_CH0,
1501 .ab = 0,
1502 .ib = 0,
1503 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001504};
1505
1506static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001507 {
1508 .src = MSM_BUS_MASTER_MDP_PORT0,
1509 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001510 .ab = 216000000 * 2,
1511 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001512 },
1513};
1514
1515static struct msm_bus_vectors mdp_vga_vectors[] = {
1516 /* VGA and less video */
1517 {
1518 .src = MSM_BUS_MASTER_MDP_PORT0,
1519 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001520 .ab = 216000000 * 2,
1521 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001522 },
1523};
1524
1525static struct msm_bus_vectors mdp_720p_vectors[] = {
1526 /* 720p and less video */
1527 {
1528 .src = MSM_BUS_MASTER_MDP_PORT0,
1529 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001530 .ab = 230400000 * 2,
1531 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001532 },
1533};
1534
1535static struct msm_bus_vectors mdp_1080p_vectors[] = {
1536 /* 1080p and less video */
1537 {
1538 .src = MSM_BUS_MASTER_MDP_PORT0,
1539 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001540 .ab = 334080000 * 2,
1541 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 },
1543};
1544
1545static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1546 {
1547 ARRAY_SIZE(mdp_init_vectors),
1548 mdp_init_vectors,
1549 },
1550 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001551 ARRAY_SIZE(mdp_ui_vectors),
1552 mdp_ui_vectors,
1553 },
1554 {
1555 ARRAY_SIZE(mdp_ui_vectors),
1556 mdp_ui_vectors,
1557 },
1558 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001559 ARRAY_SIZE(mdp_vga_vectors),
1560 mdp_vga_vectors,
1561 },
1562 {
1563 ARRAY_SIZE(mdp_720p_vectors),
1564 mdp_720p_vectors,
1565 },
1566 {
1567 ARRAY_SIZE(mdp_1080p_vectors),
1568 mdp_1080p_vectors,
1569 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570};
1571
1572static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1573 mdp_bus_scale_usecases,
1574 ARRAY_SIZE(mdp_bus_scale_usecases),
1575 .name = "mdp",
1576};
1577
1578#endif
1579
1580int mdp_core_clk_rate_table[] = {
1581 85330000,
1582 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001583 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001584 200000000,
1585};
1586
1587static struct msm_panel_common_pdata mdp_pdata = {
1588 .gpio = MDP_VSYNC_GPIO,
1589 .mdp_core_clk_rate = 85330000,
1590 .mdp_core_clk_table = mdp_core_clk_rate_table,
1591 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1592#ifdef CONFIG_MSM_BUS_SCALING
1593 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1594#endif
1595 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001596 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001597};
1598
1599static struct platform_device mipi_dsi_renesas_panel_device = {
1600 .name = "mipi_renesas",
1601 .id = 0,
1602};
1603
1604static struct platform_device mipi_dsi_simulator_panel_device = {
1605 .name = "mipi_simulator",
1606 .id = 0,
1607};
1608
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001609#define LPM_CHANNEL0 0
1610static int toshiba_gpio[] = {LPM_CHANNEL0};
1611
1612static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1613 .gpio = toshiba_gpio,
1614};
1615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616static struct platform_device mipi_dsi_toshiba_panel_device = {
1617 .name = "mipi_toshiba",
1618 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001619 .dev = {
1620 .platform_data = &toshiba_pdata,
1621 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001622};
1623
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001624static int dsi2lvds_gpio[2] = {
1625 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1626 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1627 };
1628
1629static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1630 .gpio_num = dsi2lvds_gpio,
1631};
1632
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001633static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1634
1635/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1636 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1637 /* timing */
1638 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1639 0x0c, 0x03, 0x04, 0xa0},
1640 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1641 {0xff, 0x00, 0x06, 0x00}, /* strength */
1642 /* pll control */
1643 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1644 0x40, 0x07, 0x03,
1645 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1646};
1647
1648static struct mipi_dsi_panel_platform_data novatek_pdata = {
1649 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1650};
1651
1652static struct platform_device mipi_dsi_novatek_panel_device = {
1653 .name = "mipi_novatek",
1654 .id = 0,
1655 .dev = {
1656 .platform_data = &novatek_pdata,
1657 }
1658};
1659
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001660static struct platform_device mipi_dsi2lvds_bridge_device = {
1661 .name = "mipi_tc358764",
1662 .id = 0,
1663 .dev.platform_data = &mipi_dsi2lvds_pdata,
1664};
1665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1667static struct resource hdmi_msm_resources[] = {
1668 {
1669 .name = "hdmi_msm_qfprom_addr",
1670 .start = 0x00700000,
1671 .end = 0x007060FF,
1672 .flags = IORESOURCE_MEM,
1673 },
1674 {
1675 .name = "hdmi_msm_hdmi_addr",
1676 .start = 0x04A00000,
1677 .end = 0x04A00FFF,
1678 .flags = IORESOURCE_MEM,
1679 },
1680 {
1681 .name = "hdmi_msm_irq",
1682 .start = HDMI_IRQ,
1683 .end = HDMI_IRQ,
1684 .flags = IORESOURCE_IRQ,
1685 },
1686};
1687
1688static int hdmi_enable_5v(int on);
1689static int hdmi_core_power(int on, int show);
1690static int hdmi_cec_power(int on);
1691
1692static struct msm_hdmi_platform_data hdmi_msm_data = {
1693 .irq = HDMI_IRQ,
1694 .enable_5v = hdmi_enable_5v,
1695 .core_power = hdmi_core_power,
1696 .cec_power = hdmi_cec_power,
1697};
1698
1699static struct platform_device hdmi_msm_device = {
1700 .name = "hdmi_msm",
1701 .id = 0,
1702 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1703 .resource = hdmi_msm_resources,
1704 .dev.platform_data = &hdmi_msm_data,
1705};
1706#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1707
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001708#ifdef CONFIG_MSM_BUS_SCALING
1709static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1710 {
1711 .src = MSM_BUS_MASTER_MDP_PORT0,
1712 .dst = MSM_BUS_SLAVE_EBI_CH0,
1713 .ab = 0,
1714 .ib = 0,
1715 },
1716};
1717static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1718 {
1719 .src = MSM_BUS_MASTER_MDP_PORT0,
1720 .dst = MSM_BUS_SLAVE_EBI_CH0,
1721 .ab = 566092800 * 2,
1722 .ib = 707616000 * 2,
1723 },
1724};
1725static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1726 {
1727 ARRAY_SIZE(dtv_bus_init_vectors),
1728 dtv_bus_init_vectors,
1729 },
1730 {
1731 ARRAY_SIZE(dtv_bus_def_vectors),
1732 dtv_bus_def_vectors,
1733 },
1734};
1735static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1736 dtv_bus_scale_usecases,
1737 ARRAY_SIZE(dtv_bus_scale_usecases),
1738 .name = "dtv",
1739};
1740
1741static struct lcdc_platform_data dtv_pdata = {
1742 .bus_scale_table = &dtv_bus_scale_pdata,
1743};
1744#endif
1745
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001746static void __init msm_fb_add_devices(void)
1747{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001748 struct platform_device *ptr = NULL;
1749
1750 if (machine_is_msm8960_liquid())
1751 ptr = &mipi_dsi2lvds_bridge_device;
1752 else
1753 ptr = &mipi_dsi_toshiba_panel_device;
1754 platform_add_devices(&ptr, 1);
1755
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001756 if (machine_is_msm8x60_rumi3()) {
1757 msm_fb_register_device("mdp", NULL);
1758 mipi_dsi_pdata.target_type = 1;
1759 } else
1760 msm_fb_register_device("mdp", &mdp_pdata);
1761 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001762#ifdef CONFIG_MSM_BUS_SCALING
1763 msm_fb_register_device("dtv", &dtv_pdata);
1764#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765}
1766
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001767static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1768 .func = GPIOMUX_FUNC_GPIO,
1769 .drv = GPIOMUX_DRV_2MA,
1770 .pull = GPIOMUX_PULL_DOWN,
1771};
1772
1773static struct gpiomux_setting mdp_vsync_active_cfg = {
1774 .func = GPIOMUX_FUNC_1,
1775 .drv = GPIOMUX_DRV_2MA,
1776 .pull = GPIOMUX_PULL_DOWN,
1777};
1778
1779static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1780 {
1781 .gpio = MDP_VSYNC_GPIO,
1782 .settings = {
1783 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1784 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1785 },
1786 }
1787};
1788
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1790static struct gpiomux_setting hdmi_suspend_cfg = {
1791 .func = GPIOMUX_FUNC_GPIO,
1792 .drv = GPIOMUX_DRV_2MA,
1793 .pull = GPIOMUX_PULL_DOWN,
1794};
1795
1796static struct gpiomux_setting hdmi_active_1_cfg = {
1797 .func = GPIOMUX_FUNC_1,
1798 .drv = GPIOMUX_DRV_2MA,
1799 .pull = GPIOMUX_PULL_UP,
1800};
1801
1802static struct gpiomux_setting hdmi_active_2_cfg = {
1803 .func = GPIOMUX_FUNC_1,
1804 .drv = GPIOMUX_DRV_2MA,
1805 .pull = GPIOMUX_PULL_DOWN,
1806};
1807
1808static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1809 {
1810 .gpio = 99,
1811 .settings = {
1812 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1813 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1814 },
1815 },
1816 {
1817 .gpio = 100,
1818 .settings = {
1819 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1820 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1821 },
1822 },
1823 {
1824 .gpio = 101,
1825 .settings = {
1826 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1827 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1828 },
1829 },
1830 {
1831 .gpio = 102,
1832 .settings = {
1833 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1834 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1835 },
1836 },
1837};
1838
1839static int hdmi_enable_5v(int on)
1840{
1841 /* TBD: PM8921 regulator instead of 8901 */
1842 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1843 static int prev_on;
1844 int rc;
1845
1846 if (on == prev_on)
1847 return 0;
1848
1849 if (!reg_8921_hdmi_mvs)
1850 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1851 "hdmi_mvs");
1852
1853 if (on) {
1854 rc = regulator_enable(reg_8921_hdmi_mvs);
1855 if (rc) {
1856 pr_err("'%s' regulator enable failed, rc=%d\n",
1857 "8921_hdmi_mvs", rc);
1858 return rc;
1859 }
1860 pr_debug("%s(on): success\n", __func__);
1861 } else {
1862 rc = regulator_disable(reg_8921_hdmi_mvs);
1863 if (rc)
1864 pr_warning("'%s' regulator disable failed, rc=%d\n",
1865 "8921_hdmi_mvs", rc);
1866 pr_debug("%s(off): success\n", __func__);
1867 }
1868
1869 prev_on = on;
1870
1871 return 0;
1872}
1873
1874static int hdmi_core_power(int on, int show)
1875{
1876 static struct regulator *reg_8921_l23, *reg_8921_s4;
1877 static int prev_on;
1878 int rc;
1879
1880 if (on == prev_on)
1881 return 0;
1882
1883 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001884 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001885 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001886 if (IS_ERR(reg_8921_l23)) {
1887 pr_err("could not get reg_8921_l23, rc = %ld\n",
1888 PTR_ERR(reg_8921_l23));
1889 return -ENODEV;
1890 }
1891 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1892 if (rc) {
1893 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1894 return -EINVAL;
1895 }
1896 }
1897 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001898 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001899 if (IS_ERR(reg_8921_s4)) {
1900 pr_err("could not get reg_8921_s4, rc = %ld\n",
1901 PTR_ERR(reg_8921_s4));
1902 return -ENODEV;
1903 }
1904 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1905 if (rc) {
1906 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1907 return -EINVAL;
1908 }
1909 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910
1911 if (on) {
1912 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1913 if (rc < 0) {
1914 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1915 return -EINVAL;
1916 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001917 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001918 if (rc) {
1919 pr_err("'%s' regulator enable failed, rc=%d\n",
1920 "hdmi_avdd", rc);
1921 return rc;
1922 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001923 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001924 if (rc) {
1925 pr_err("'%s' regulator enable failed, rc=%d\n",
1926 "hdmi_vcc", rc);
1927 return rc;
1928 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929 rc = gpio_request(100, "HDMI_DDC_CLK");
1930 if (rc) {
1931 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1932 "HDMI_DDC_CLK", 100, rc);
1933 goto error1;
1934 }
1935 rc = gpio_request(101, "HDMI_DDC_DATA");
1936 if (rc) {
1937 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1938 "HDMI_DDC_DATA", 101, rc);
1939 goto error2;
1940 }
1941 rc = gpio_request(102, "HDMI_HPD");
1942 if (rc) {
1943 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1944 "HDMI_HPD", 102, rc);
1945 goto error3;
1946 }
1947 pr_debug("%s(on): success\n", __func__);
1948 } else {
1949 gpio_free(100);
1950 gpio_free(101);
1951 gpio_free(102);
1952
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001953 rc = regulator_disable(reg_8921_l23);
1954 if (rc) {
1955 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1956 return -ENODEV;
1957 }
1958 rc = regulator_disable(reg_8921_s4);
1959 if (rc) {
1960 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1961 return -ENODEV;
1962 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001963 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1964 if (rc < 0) {
1965 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1966 return -EINVAL;
1967 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001968 pr_debug("%s(off): success\n", __func__);
1969 }
1970
1971 prev_on = on;
1972
1973 return 0;
1974
1975error3:
1976 gpio_free(101);
1977error2:
1978 gpio_free(100);
1979error1:
1980 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001981 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982 return rc;
1983}
1984
1985static int hdmi_cec_power(int on)
1986{
1987 static int prev_on;
1988 int rc;
1989
1990 if (on == prev_on)
1991 return 0;
1992
1993 if (on) {
1994 rc = gpio_request(99, "HDMI_CEC_VAR");
1995 if (rc) {
1996 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1997 "HDMI_CEC_VAR", 99, rc);
1998 goto error;
1999 }
2000 pr_debug("%s(on): success\n", __func__);
2001 } else {
2002 gpio_free(99);
2003 pr_debug("%s(off): success\n", __func__);
2004 }
2005
2006 prev_on = on;
2007
2008 return 0;
2009error:
2010 return rc;
2011}
2012#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2013
2014static void __init msm8960_allocate_memory_regions(void)
2015{
2016 void *addr;
2017 unsigned long size;
2018
2019 size = MSM_FB_SIZE;
2020 addr = alloc_bootmem_align(size, 0x1000);
2021 msm_fb_resources[0].start = __pa(addr);
2022 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2023 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2024 size, addr, __pa(addr));
2025
2026}
2027#ifdef CONFIG_WCD9310_CODEC
2028
2029#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2030
Patrick Lai3043fba2011-08-01 14:15:57 -07002031/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2032 * 4 micbiases are used to power various analog and digital
2033 * microphones operating at 1800 mV. Technically, all micbiases
2034 * can source from single cfilter since all microphones operate
2035 * at the same voltage level. The arrangement below is to make
2036 * sure all cfilters are exercised. LDO_H regulator ouput level
2037 * does not need to be as high as 2.85V. It is choosen for
2038 * microphone sensitivity purpose.
2039 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002040static struct tabla_pdata tabla_platform_data = {
2041 .slimbus_slave_device = {
2042 .name = "tabla-slave",
2043 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2044 },
2045 .irq = MSM_GPIO_TO_INT(62),
2046 .irq_base = TABLA_INTERRUPT_BASE,
2047 .num_irqs = NR_TABLA_IRQS,
2048 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002049 .micbias = {
2050 .ldoh_v = TABLA_LDOH_2P85_V,
2051 .cfilt1_mv = 1800,
2052 .cfilt2_mv = 1800,
2053 .cfilt3_mv = 1800,
2054 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2055 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2056 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2057 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2058 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002059};
2060
2061static struct slim_device msm_slim_tabla = {
2062 .name = "tabla-slim",
2063 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2064 .dev = {
2065 .platform_data = &tabla_platform_data,
2066 },
2067};
2068#endif
2069
2070static struct slim_boardinfo msm_slim_devices[] = {
2071#ifdef CONFIG_WCD9310_CODEC
2072 {
2073 .bus_num = 1,
2074 .slim_slave = &msm_slim_tabla,
2075 },
2076#endif
2077 /* add more slimbus slaves as needed */
2078};
2079
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002080#define MSM_WCNSS_PHYS 0x03000000
2081#define MSM_WCNSS_SIZE 0x280000
2082
2083static struct resource resources_wcnss_wlan[] = {
2084 {
2085 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2086 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2087 .name = "wcnss_wlanrx_irq",
2088 .flags = IORESOURCE_IRQ,
2089 },
2090 {
2091 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2092 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2093 .name = "wcnss_wlantx_irq",
2094 .flags = IORESOURCE_IRQ,
2095 },
2096 {
2097 .start = MSM_WCNSS_PHYS,
2098 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2099 .name = "wcnss_mmio",
2100 .flags = IORESOURCE_MEM,
2101 },
2102};
2103
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002104static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2105 .has_48mhz_xo = 1,
2106};
2107
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002108static struct platform_device msm_device_wcnss_wlan = {
2109 .name = "wcnss_wlan",
2110 .id = 0,
2111 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2112 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002113 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002114};
2115
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002116#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2117 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2118 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2119 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2120
2121#define QCE_SIZE 0x10000
2122#define QCE_0_BASE 0x18500000
2123
2124#define QCE_HW_KEY_SUPPORT 0
2125#define QCE_SHA_HMAC_SUPPORT 1
2126#define QCE_SHARE_CE_RESOURCE 1
2127#define QCE_CE_SHARED 0
2128
2129static struct resource qcrypto_resources[] = {
2130 [0] = {
2131 .start = QCE_0_BASE,
2132 .end = QCE_0_BASE + QCE_SIZE - 1,
2133 .flags = IORESOURCE_MEM,
2134 },
2135 [1] = {
2136 .name = "crypto_channels",
2137 .start = DMOV_CE_IN_CHAN,
2138 .end = DMOV_CE_OUT_CHAN,
2139 .flags = IORESOURCE_DMA,
2140 },
2141 [2] = {
2142 .name = "crypto_crci_in",
2143 .start = DMOV_CE_IN_CRCI,
2144 .end = DMOV_CE_IN_CRCI,
2145 .flags = IORESOURCE_DMA,
2146 },
2147 [3] = {
2148 .name = "crypto_crci_out",
2149 .start = DMOV_CE_OUT_CRCI,
2150 .end = DMOV_CE_OUT_CRCI,
2151 .flags = IORESOURCE_DMA,
2152 },
2153};
2154
2155static struct resource qcedev_resources[] = {
2156 [0] = {
2157 .start = QCE_0_BASE,
2158 .end = QCE_0_BASE + QCE_SIZE - 1,
2159 .flags = IORESOURCE_MEM,
2160 },
2161 [1] = {
2162 .name = "crypto_channels",
2163 .start = DMOV_CE_IN_CHAN,
2164 .end = DMOV_CE_OUT_CHAN,
2165 .flags = IORESOURCE_DMA,
2166 },
2167 [2] = {
2168 .name = "crypto_crci_in",
2169 .start = DMOV_CE_IN_CRCI,
2170 .end = DMOV_CE_IN_CRCI,
2171 .flags = IORESOURCE_DMA,
2172 },
2173 [3] = {
2174 .name = "crypto_crci_out",
2175 .start = DMOV_CE_OUT_CRCI,
2176 .end = DMOV_CE_OUT_CRCI,
2177 .flags = IORESOURCE_DMA,
2178 },
2179};
2180
2181#endif
2182
2183#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2184 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2185
2186static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2187 .ce_shared = QCE_CE_SHARED,
2188 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2189 .hw_key_support = QCE_HW_KEY_SUPPORT,
2190 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2191};
2192
2193static struct platform_device qcrypto_device = {
2194 .name = "qcrypto",
2195 .id = 0,
2196 .num_resources = ARRAY_SIZE(qcrypto_resources),
2197 .resource = qcrypto_resources,
2198 .dev = {
2199 .coherent_dma_mask = DMA_BIT_MASK(32),
2200 .platform_data = &qcrypto_ce_hw_suppport,
2201 },
2202};
2203#endif
2204
2205#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2206 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2207
2208static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2209 .ce_shared = QCE_CE_SHARED,
2210 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2211 .hw_key_support = QCE_HW_KEY_SUPPORT,
2212 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2213};
2214
2215static struct platform_device qcedev_device = {
2216 .name = "qce",
2217 .id = 0,
2218 .num_resources = ARRAY_SIZE(qcedev_resources),
2219 .resource = qcedev_resources,
2220 .dev = {
2221 .coherent_dma_mask = DMA_BIT_MASK(32),
2222 .platform_data = &qcedev_ce_hw_suppport,
2223 },
2224};
2225#endif
2226
2227
2228static int __init gpiomux_init(void)
2229{
2230 int rc;
2231
2232 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2233 if (rc) {
2234 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2235 return rc;
2236 }
2237
Nishant Pandit24153d82011-08-27 16:05:13 +05302238 msm_gpiomux_install(msm8960_cam_common_configs,
2239 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240
2241 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002242 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002243
2244 msm_gpiomux_install(msm8960_gsbi_configs,
2245 ARRAY_SIZE(msm8960_gsbi_configs));
2246
2247 msm_gpiomux_install(msm8960_cyts_configs,
2248 ARRAY_SIZE(msm8960_cyts_configs));
2249
2250 msm_gpiomux_install(msm8960_slimbus_config,
2251 ARRAY_SIZE(msm8960_slimbus_config));
2252
2253 msm_gpiomux_install(msm8960_audio_codec_configs,
2254 ARRAY_SIZE(msm8960_audio_codec_configs));
2255
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002256 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2257 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2258
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2260 msm_gpiomux_install(msm8960_hdmi_configs,
2261 ARRAY_SIZE(msm8960_hdmi_configs));
2262#endif
2263
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002264 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2265 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2266
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 msm_gpiomux_install(wcnss_5wire_interface,
2268 ARRAY_SIZE(wcnss_5wire_interface));
2269
2270 return 0;
2271}
2272
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273#define MSM_SHARED_RAM_PHYS 0x80000000
2274
2275static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2276 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2277 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2278 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2279 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2280 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2281 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2282 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2283 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2284 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2285 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2286 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2287 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002288 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2289 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2290 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2291 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2292 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2293 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2294 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2295 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2296 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2297 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2298 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2299 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2300 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2301 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002302 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002303 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2304 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2305 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002306 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2307 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002308};
2309
2310static struct pm8921_adc_properties pm8921_adc_data = {
2311 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2312 .bitresolution = 15,
2313 .bipolar = 0,
2314};
2315
2316static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2317 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002318 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002319 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002320 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002321};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002322
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002323static void __init msm8960_map_io(void)
2324{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002326 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002327
2328 if (socinfo_init() < 0)
2329 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002330}
2331
2332static void __init msm8960_init_irq(void)
2333{
2334 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002335
2336 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002337 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002339
2340 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002341 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002342
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002343 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2344 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002345
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002346 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2347 * as they are configured as level, which does not play nice with
2348 * handle_percpu_irq.
2349 */
2350 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2351 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002352 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002353 }
2354}
2355
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002356/* MSM8960 have 5 SDCC controllers */
2357enum sdcc_controllers {
2358 SDCC1,
2359 SDCC2,
2360 SDCC3,
2361 SDCC4,
2362 SDCC5,
2363 MAX_SDCC_CONTROLLER
2364};
2365
2366/* All SDCC controllers requires VDD/VCC voltage */
2367static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2368 /* SDCC1 : eMMC card connected */
2369 [SDCC1] = {
2370 .name = "sdc_vdd",
2371 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302372 .high_vol_level = 2950000,
2373 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302374 .always_on = 1,
2375 .lpm_sup = 1,
2376 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002377 .hpm_uA = 200000, /* 200mA */
2378 },
2379 /* SDCC3 : External card slot connected */
2380 [SDCC3] = {
2381 .name = "sdc_vdd",
2382 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302383 .high_vol_level = 2950000,
2384 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002385 .hpm_uA = 600000, /* 600mA */
2386 }
2387};
2388
2389/* Only slots having eMMC card will require VCCQ voltage */
2390static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2391 /* SDCC1 : eMMC card connected */
2392 [SDCC1] = {
2393 .name = "sdc_vccq",
2394 .set_voltage_sup = 1,
2395 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302396 .high_vol_level = 1800000,
2397 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002398 .hpm_uA = 200000, /* 200mA */
2399 }
2400};
2401
2402/* All SDCC controllers may require voting for VDD PAD voltage */
2403static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2404 /* SDCC3 : External card slot connected */
2405 [SDCC3] = {
2406 .name = "sdc_vddp",
2407 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302408 .high_vol_level = 2950000,
2409 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002410 .always_on = 1,
2411 .lpm_sup = 1,
2412 /* Max. Active current required is 16 mA */
2413 .hpm_uA = 16000,
2414 /*
2415 * Sleep current required is ~300 uA. But min. vote can be
2416 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2417 * during sleep.
2418 */
2419 .lpm_uA = 2000,
2420 }
2421};
2422
2423static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2424 /* SDCC1 : eMMC card connected */
2425 [SDCC1] = {
2426 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2427 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2428 },
2429 /* SDCC3 : External card slot connected */
2430 [SDCC3] = {
2431 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2432 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2433 }
2434};
2435
2436/* SDC1 pad data */
2437static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2438 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302439 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2440 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002441};
2442
2443static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2444 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2445 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2446 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2447};
2448
2449static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302450 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002451 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2452 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2453};
2454
2455static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302456 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002457 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2458 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2459};
2460
2461/* SDC3 pad data */
2462static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2463 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2464 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2465 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2466};
2467
2468static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2469 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2470 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2471 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2472};
2473
2474static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302475 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002476 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2477 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2478};
2479
2480static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302481 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002482 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2483 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2484};
2485
2486struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2487 [SDCC1] = {
2488 .on = sdc1_pad_pull_on_cfg,
2489 .off = sdc1_pad_pull_off_cfg,
2490 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2491 },
2492 [SDCC3] = {
2493 .on = sdc3_pad_pull_on_cfg,
2494 .off = sdc3_pad_pull_off_cfg,
2495 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2496 },
2497};
2498
2499struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2500 [SDCC1] = {
2501 .on = sdc1_pad_drv_on_cfg,
2502 .off = sdc1_pad_drv_off_cfg,
2503 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2504 },
2505 [SDCC3] = {
2506 .on = sdc3_pad_drv_on_cfg,
2507 .off = sdc3_pad_drv_off_cfg,
2508 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2509 },
2510};
2511
2512struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2513 [SDCC1] = {
2514 .pull = &mmc_pad_pull_data[SDCC1],
2515 .drv = &mmc_pad_drv_data[SDCC1]
2516 },
2517 [SDCC3] = {
2518 .pull = &mmc_pad_pull_data[SDCC3],
2519 .drv = &mmc_pad_drv_data[SDCC3]
2520 },
2521};
2522
2523struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2524 [SDCC1] = {
2525 .pad_data = &mmc_pad_data[SDCC1],
2526 },
2527 [SDCC3] = {
2528 .pad_data = &mmc_pad_data[SDCC3],
2529 },
2530};
2531
2532static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302533 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002534};
2535
2536static unsigned int sdc3_sup_clk_rates[] = {
2537 400000, 24000000, 48000000, 96000000
2538};
2539
2540#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2541static struct mmc_platform_data msm8960_sdc1_data = {
2542 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2543#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2544 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2545#else
2546 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2547#endif
2548 .sup_clk_table = sdc1_sup_clk_rates,
2549 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302550 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002551 .nonremovable = 1,
2552 .sdcc_v4_sup = true,
2553 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302554 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555};
2556#endif
2557
2558#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2559static struct mmc_platform_data msm8960_sdc3_data = {
2560 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2561 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2562 .sup_clk_table = sdc3_sup_clk_rates,
2563 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302564 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302565#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002566 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302567#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002568 .sdcc_v4_sup = true,
2569 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2570 .pin_data = &mmc_slot_pin_data[SDCC3],
2571#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2572 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2573 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2574 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2575#endif
2576 .xpc_cap = 1,
2577 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2578 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302579 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002580};
2581#endif
2582
2583static void __init msm8960_init_mmc(void)
2584{
2585#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2586 /* SDC1 : eMMC card connected */
2587 msm_add_sdcc(1, &msm8960_sdc1_data);
2588#endif
2589#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2590 /* SDC3: External card slot */
2591 msm_add_sdcc(3, &msm8960_sdc3_data);
2592#endif
2593}
2594
2595static void __init msm8960_init_buses(void)
2596{
2597#ifdef CONFIG_MSM_BUS_SCALING
2598 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2599 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2600 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2601 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2602 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2603 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2604 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2605 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2606 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2607 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002608 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002609#endif
2610}
2611
2612static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2613 .max_clock_speed = 15060000,
2614};
2615
2616#ifdef CONFIG_USB_MSM_OTG_72K
2617static struct msm_otg_platform_data msm_otg_pdata;
2618#else
2619#define USB_5V_EN 42
2620static void msm_hsusb_vbus_power(bool on)
2621{
2622 int rc;
2623 static bool vbus_is_on;
2624 static struct regulator *mvs_otg_switch;
2625 struct pm_gpio param = {
2626 .direction = PM_GPIO_DIR_OUT,
2627 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2628 .output_value = 1,
2629 .pull = PM_GPIO_PULL_NO,
2630 .vin_sel = PM_GPIO_VIN_S4,
2631 .out_strength = PM_GPIO_STRENGTH_MED,
2632 .function = PM_GPIO_FUNC_NORMAL,
2633 };
2634
2635 if (vbus_is_on == on)
2636 return;
2637
2638 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002639 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2640 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002641 if (IS_ERR(mvs_otg_switch)) {
2642 pr_err("Unable to get mvs_otg_switch\n");
2643 return;
2644 }
2645
2646 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2647 "usb_5v_en");
2648 if (rc < 0) {
2649 pr_err("failed to request usb_5v_en gpio\n");
2650 goto put_mvs_otg;
2651 }
2652
2653 if (regulator_enable(mvs_otg_switch)) {
2654 pr_err("unable to enable mvs_otg_switch\n");
2655 goto free_usb_5v_en;
2656 }
2657
2658 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2659 &param);
2660 if (rc < 0) {
2661 pr_err("failed to configure usb_5v_en gpio\n");
2662 goto disable_mvs_otg;
2663 }
2664 vbus_is_on = true;
2665 return;
2666 }
2667disable_mvs_otg:
2668 regulator_disable(mvs_otg_switch);
2669free_usb_5v_en:
2670 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2671put_mvs_otg:
2672 regulator_put(mvs_otg_switch);
2673 vbus_is_on = false;
2674}
2675
2676static struct msm_otg_platform_data msm_otg_pdata = {
2677 .mode = USB_OTG,
2678 .otg_control = OTG_PMIC_CONTROL,
2679 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2680 .pclk_src_name = "dfab_usb_hs_clk",
2681 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2682 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302683 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002684};
2685#endif
2686
2687#define PID_MAGIC_ID 0x71432909
2688#define SERIAL_NUM_MAGIC_ID 0x61945374
2689#define SERIAL_NUMBER_LENGTH 127
2690#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2691
2692struct magic_num_struct {
2693 uint32_t pid;
2694 uint32_t serial_num;
2695};
2696
2697struct dload_struct {
2698 uint32_t reserved1;
2699 uint32_t reserved2;
2700 uint32_t reserved3;
2701 uint16_t reserved4;
2702 uint16_t pid;
2703 char serial_number[SERIAL_NUMBER_LENGTH];
2704 uint16_t reserved5;
2705 struct magic_num_struct magic_struct;
2706};
2707
2708static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2709{
2710 struct dload_struct __iomem *dload = 0;
2711
2712 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2713 if (!dload) {
2714 pr_err("%s: cannot remap I/O memory region: %08x\n",
2715 __func__, DLOAD_USB_BASE_ADD);
2716 return -ENXIO;
2717 }
2718
2719 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2720 __func__, dload, pid, snum);
2721 /* update pid */
2722 dload->magic_struct.pid = PID_MAGIC_ID;
2723 dload->pid = pid;
2724
2725 /* update serial number */
2726 dload->magic_struct.serial_num = 0;
2727 if (!snum) {
2728 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2729 goto out;
2730 }
2731
2732 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2733 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2734 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2735out:
2736 iounmap(dload);
2737 return 0;
2738}
2739
2740static struct android_usb_platform_data android_usb_pdata = {
2741 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2742};
2743
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002744static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002745 .name = "android_usb",
2746 .id = -1,
2747 .dev = {
2748 .platform_data = &android_usb_pdata,
2749 },
2750};
2751
2752static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2753 0x03, 0x0f,
2754};
2755
2756static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2757 0x00, 0x24, 0x54, 0x10,
2758 0x09, 0x03, 0x01,
2759 0x10, 0x54, 0x30, 0x0C,
2760 0x24, 0x30, 0x0f,
2761};
2762
2763static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2764 0x00, 0x24, 0x54, 0x10,
2765 0x09, 0x07, 0x01, 0x0B,
2766 0x10, 0x54, 0x30, 0x0C,
2767 0x24, 0x30, 0x0f,
2768};
2769
2770static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2771 [0] = {
2772 .mode = MSM_SPM_MODE_CLOCK_GATING,
2773 .notify_rpm = false,
2774 .cmd = spm_wfi_cmd_sequence,
2775 },
2776 [1] = {
2777 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2778 .notify_rpm = false,
2779 .cmd = spm_power_collapse_without_rpm,
2780 },
2781 [2] = {
2782 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2783 .notify_rpm = true,
2784 .cmd = spm_power_collapse_with_rpm,
2785 },
2786};
2787
2788static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2789 [0] = {
2790 .reg_base_addr = MSM_SAW0_BASE,
2791 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2792 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2793 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2794#if defined(CONFIG_MSM_AVS_HW)
2795 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2796 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2797#endif
2798 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2799 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2800 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2801 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2802 .vctl_timeout_us = 50,
2803 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2804 .modes = msm_spm_seq_list,
2805 },
2806 [1] = {
2807 .reg_base_addr = MSM_SAW1_BASE,
2808 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2809 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2810 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2811#if defined(CONFIG_MSM_AVS_HW)
2812 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2813 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2814#endif
2815 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2816 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2817 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2818 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2819 .vctl_timeout_us = 50,
2820 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2821 .modes = msm_spm_seq_list,
2822 },
2823};
2824
2825static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2826 0x00, 0x20, 0x03, 0x20,
2827 0x00, 0x0f,
2828};
2829
2830static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2831 0x00, 0x20, 0x34, 0x64,
2832 0x48, 0x07, 0x48, 0x20,
2833 0x50, 0x64, 0x04, 0x34,
2834 0x50, 0x0f,
2835};
2836static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2837 0x00, 0x10, 0x34, 0x64,
2838 0x48, 0x07, 0x48, 0x10,
2839 0x50, 0x64, 0x04, 0x34,
2840 0x50, 0x0F,
2841};
2842
2843static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2844 [0] = {
2845 .mode = MSM_SPM_L2_MODE_RETENTION,
2846 .notify_rpm = false,
2847 .cmd = l2_spm_wfi_cmd_sequence,
2848 },
2849 [1] = {
2850 .mode = MSM_SPM_L2_MODE_GDHS,
2851 .notify_rpm = true,
2852 .cmd = l2_spm_gdhs_cmd_sequence,
2853 },
2854 [2] = {
2855 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2856 .notify_rpm = true,
2857 .cmd = l2_spm_power_off_cmd_sequence,
2858 },
2859};
2860
2861
2862static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2863 [0] = {
2864 .reg_base_addr = MSM_SAW_L2_BASE,
2865 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2866 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2867 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2868 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2869 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2870 .modes = msm_spm_l2_seq_list,
2871 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2872 },
2873};
2874
2875#define CYTTSP_TS_GPIO_IRQ 11
2876#define CYTTSP_TS_SLEEP_GPIO 50
2877#define CYTTSP_TS_RESOUT_N_GPIO 52
2878
2879/*virtual key support */
2880static ssize_t tma340_vkeys_show(struct kobject *kobj,
2881 struct kobj_attribute *attr, char *buf)
2882{
2883 return snprintf(buf, 200,
2884 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2885 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2886 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2887 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2888 "\n");
2889}
2890
2891static struct kobj_attribute tma340_vkeys_attr = {
2892 .attr = {
2893 .mode = S_IRUGO,
2894 },
2895 .show = &tma340_vkeys_show,
2896};
2897
2898static struct attribute *tma340_properties_attrs[] = {
2899 &tma340_vkeys_attr.attr,
2900 NULL
2901};
2902
2903static struct attribute_group tma340_properties_attr_group = {
2904 .attrs = tma340_properties_attrs,
2905};
2906
2907
2908static int cyttsp_platform_init(struct i2c_client *client)
2909{
2910 int rc = 0;
2911 static struct kobject *tma340_properties_kobj;
2912
2913 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2914 tma340_properties_kobj = kobject_create_and_add("board_properties",
2915 NULL);
2916 if (tma340_properties_kobj)
2917 rc = sysfs_create_group(tma340_properties_kobj,
2918 &tma340_properties_attr_group);
2919 if (!tma340_properties_kobj || rc)
2920 pr_err("%s: failed to create board_properties\n",
2921 __func__);
2922
2923 return 0;
2924}
2925
2926static struct cyttsp_regulator regulator_data[] = {
2927 {
2928 .name = "vdd",
2929 .min_uV = CY_TMA300_VTG_MIN_UV,
2930 .max_uV = CY_TMA300_VTG_MAX_UV,
2931 .load_uA = CY_TMA300_CURR_24HZ_UA,
2932 },
2933 /* TODO: Remove after runtime PM is enabled in I2C driver */
2934 {
2935 .name = "vcc_i2c",
2936 .min_uV = CY_I2C_VTG_MIN_UV,
2937 .max_uV = CY_I2C_VTG_MAX_UV,
2938 .load_uA = CY_I2C_CURR_UA,
2939 },
2940};
2941
2942static struct cyttsp_platform_data cyttsp_pdata = {
2943 .panel_maxx = 634,
2944 .panel_maxy = 1166,
2945 .disp_maxx = 616,
2946 .disp_maxy = 1023,
2947 .disp_minx = 0,
2948 .disp_miny = 16,
2949 .flags = 0x01,
2950 .gen = CY_GEN3, /* or */
2951 .use_st = CY_USE_ST,
2952 .use_mt = CY_USE_MT,
2953 .use_hndshk = CY_SEND_HNDSHK,
2954 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302955 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002956 .use_gestures = CY_USE_GESTURES,
2957 .fw_fname = "cyttsp_8960_cdp.hex",
2958 /* activate up to 4 groups
2959 * and set active distance
2960 */
2961 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2962 CY_GEST_GRP3 | CY_GEST_GRP4 |
2963 CY_ACT_DIST,
2964 /* change act_intrvl to customize the Active power state
2965 * scanning/processing refresh interval for Operating mode
2966 */
2967 .act_intrvl = CY_ACT_INTRVL_DFLT,
2968 /* change tch_tmout to customize the touch timeout for the
2969 * Active power state for Operating mode
2970 */
2971 .tch_tmout = CY_TCH_TMOUT_DFLT,
2972 /* change lp_intrvl to customize the Low Power power state
2973 * scanning/processing refresh interval for Operating mode
2974 */
2975 .lp_intrvl = CY_LP_INTRVL_DFLT,
2976 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2977 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2978 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2979 .regulator_info = regulator_data,
2980 .num_regulators = ARRAY_SIZE(regulator_data),
2981 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302982 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002983};
2984
2985static struct i2c_board_info cyttsp_info[] __initdata = {
2986 {
2987 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2988 .platform_data = &cyttsp_pdata,
2989#ifndef CY_USE_TIMER
2990 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2991#endif /* CY_USE_TIMER */
2992 },
2993};
2994
Mohan Pallaka50837382011-09-07 11:00:57 +05302995/* configuration data */
2996static const u8 mxt_config_data[] = {
2997 /* T6 Object */
2998 0, 0, 0, 0, 0, 0,
2999 /* T38 Object */
3000 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3002 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3004 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3005 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3006 0, 0, 0, 0,
3007 /* T7 Object */
3008 10, 10, 50,
3009 /* T8 Object */
3010 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3011 /* T9 Object */
3012 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3013 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3014 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3015 0, 5, 45, 46,
3016 /* T15 Object */
3017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3018 0,
3019 /* T22 Object */
3020 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3021 0, 0, 255, 255, 255, 255, 0,
3022 /* T24 Object */
3023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3024 0, 0, 0, 0, 0, 0, 0, 0, 0,
3025 /* T25 Object */
3026 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3027 0, 0, 0, 0,
3028 /* T27 Object */
3029 0, 0, 0, 0, 0, 0, 0,
3030 /* T28 Object */
3031 0, 0, 0, 8, 8, 8,
3032 /* T40 Object */
3033 0, 0, 0, 0, 0,
3034 /* T41 Object */
3035 0, 0, 0, 0, 0, 0,
3036 /* T43 Object */
3037 0, 0, 0, 0, 0, 0,
3038};
3039
3040#define MXT_TS_GPIO_IRQ 11
3041#define MXT_TS_LDO_EN_GPIO 50
3042#define MXT_TS_RESET_GPIO 52
3043
3044static void mxt_init_hw_liquid(void)
3045{
3046 int rc;
3047
3048 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3049 if (rc) {
3050 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3051 __func__, MXT_TS_GPIO_IRQ);
3052 return;
3053 }
3054
3055 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3056 if (rc) {
3057 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3058 __func__, MXT_TS_GPIO_IRQ);
3059 goto err_irq_gpio_req;
3060 }
3061
3062 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3063 if (rc) {
3064 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3065 __func__, MXT_TS_LDO_EN_GPIO);
3066 goto err_irq_gpio_req;
3067 }
3068
3069 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3070 if (rc) {
3071 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3072 __func__, MXT_TS_LDO_EN_GPIO);
3073 goto err_ldo_gpio_req;
3074 }
3075
3076 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3077 if (rc) {
3078 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3079 __func__, MXT_TS_RESET_GPIO);
3080 goto err_ldo_gpio_set_dir;
3081 }
3082
3083 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3084 if (rc) {
3085 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3086 __func__, MXT_TS_RESET_GPIO);
3087 goto err_reset_gpio_req;
3088 }
3089
3090 return;
3091
3092err_reset_gpio_req:
3093 gpio_free(MXT_TS_RESET_GPIO);
3094err_ldo_gpio_set_dir:
3095 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3096err_ldo_gpio_req:
3097 gpio_free(MXT_TS_LDO_EN_GPIO);
3098err_irq_gpio_req:
3099 gpio_free(MXT_TS_GPIO_IRQ);
3100}
3101
3102static struct mxt_platform_data mxt_platform_data = {
3103 .config = mxt_config_data,
3104 .config_length = ARRAY_SIZE(mxt_config_data),
3105 .x_line = 26,
3106 .y_line = 42,
3107 .x_size = 767,
3108 .y_size = 1365,
3109 .blen = 32,
3110 .threshold = 40,
3111 .voltage = 3300000, /* 3.3V */
3112 .orient = MXT_ROTATED_90,
3113 .irqflags = IRQF_TRIGGER_FALLING,
3114};
3115
3116static struct i2c_board_info mxt_device_info[] __initdata = {
3117 {
3118 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3119 .platform_data = &mxt_platform_data,
3120 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3121 },
3122};
3123
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003124static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3125{
3126}
3127
3128static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3129 .clk_freq = 100000,
3130 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003131 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3132};
3133
3134static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3135 .clk_freq = 100000,
3136 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3138};
3139
3140static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3141 .clk_freq = 100000,
3142 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3144};
3145
3146static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3147 .clk_freq = 100000,
3148 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003149 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3150};
3151
3152static struct msm_rpm_platform_data msm_rpm_data = {
3153 .reg_base_addrs = {
3154 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3155 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3156 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3157 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3158 },
3159
3160 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3161 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3162 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3163 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3164 .msm_apps_ipc_rpm_val = 4,
3165};
3166
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003168static struct spi_board_info spi_board_info[] __initdata = {
3169 {
3170 .modalias = "ks8851",
3171 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3172 .max_speed_hz = 19200000,
3173 .bus_num = 0,
3174 .chip_select = 0,
3175 .mode = SPI_MODE_0,
3176 },
3177};
3178
3179static struct platform_device msm_device_saw_core0 = {
3180 .name = "saw-regulator",
3181 .id = 0,
3182 .dev = {
3183 .platform_data = &msm_saw_regulator_pdata_s5,
3184 },
3185};
3186
3187static struct platform_device msm_device_saw_core1 = {
3188 .name = "saw-regulator",
3189 .id = 1,
3190 .dev = {
3191 .platform_data = &msm_saw_regulator_pdata_s6,
3192 },
3193};
3194
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003195static struct tsens_platform_data msm_tsens_pdata = {
3196 .slope = 910,
3197 .tsens_factor = 1000,
3198 .hw_type = MSM_8960,
3199 .tsens_num_sensor = 5,
3200};
3201
3202static struct platform_device msm_tsens_device = {
3203 .name = "tsens8960-tm",
3204 .id = -1,
3205 .dev = {
3206 .platform_data = &msm_tsens_pdata,
3207 },
3208};
3209
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003210#ifdef CONFIG_MSM_FAKE_BATTERY
3211static struct platform_device fish_battery_device = {
3212 .name = "fish_battery",
3213};
3214#endif
3215
David Collins26f05562011-06-20 09:56:28 -07003216static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003217 .name = GPIO_REGULATOR_DEV_NAME,
3218 .id = PM8921_MPP_PM_TO_SYS(7),
3219 .dev = {
3220 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3221 },
3222};
3223
David Collins26f05562011-06-20 09:56:28 -07003224static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225 .name = GPIO_REGULATOR_DEV_NAME,
3226 .id = 91,
3227 .dev = {
3228 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3229 },
3230};
3231
David Collinsb10be1d2011-09-02 10:29:31 -07003232static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3233 .name = GPIO_REGULATOR_DEV_NAME,
3234 .id = PM8921_GPIO_PM_TO_SYS(17),
3235 .dev = {
3236 .platform_data =
3237 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3238 },
3239};
3240
David Collins26f05562011-06-20 09:56:28 -07003241static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3242 .name = "rpm-regulator",
3243 .id = -1,
3244 .dev = {
3245 .platform_data = &msm_rpm_regulator_pdata,
3246 },
3247};
3248
David Collins4c31a872011-08-31 10:07:10 -07003249static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3250 .phys_addr_base = 0x0010C000,
3251 .reg_offsets = {
3252 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3253 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3254 },
3255 .phys_size = SZ_8K,
3256 .log_len = 4096, /* log's buffer length in bytes */
3257 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3258};
3259
3260static struct platform_device msm_rpm_log_device = {
3261 .name = "msm_rpm_log",
3262 .id = -1,
3263 .dev = {
3264 .platform_data = &msm_rpm_log_pdata,
3265 },
3266};
3267
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003268static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003269 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003270 &msm_device_smd,
3271 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303272 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003273 &msm_device_saw_core0,
3274 &msm_device_saw_core1,
3275 &msm8960_device_ext_5v_vreg,
3276 &msm8960_device_ext_l2_vreg,
3277 &msm8960_device_ssbi_pm8921,
3278 &msm8960_device_qup_spi_gsbi1,
3279 &msm8960_device_qup_i2c_gsbi3,
3280 &msm8960_device_qup_i2c_gsbi4,
3281 &msm8960_device_qup_i2c_gsbi10,
3282#ifndef CONFIG_MSM_DSPS
3283 &msm8960_device_qup_i2c_gsbi12,
3284#endif
3285 &msm_slim_ctrl,
3286 &msm_device_wcnss_wlan,
3287#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3288 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3289 &qcrypto_device,
3290#endif
3291
3292#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3293 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3294 &qcedev_device,
3295#endif
3296#ifdef CONFIG_MSM_ROTATOR
3297 &msm_rotator_device,
3298#endif
3299 &msm_device_sps,
3300#ifdef CONFIG_MSM_FAKE_BATTERY
3301 &fish_battery_device,
3302#endif
3303#ifdef CONFIG_ANDROID_PMEM
3304 &android_pmem_device,
3305 &android_pmem_adsp_device,
3306 &android_pmem_audio_device,
3307#endif
3308 &msm_fb_device,
3309 &msm_device_vidc,
3310 &msm_device_bam_dmux,
3311 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003312
3313#ifdef CONFIG_HW_RANDOM_MSM
3314 &msm_device_rng,
3315#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003316 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003317#ifdef CONFIG_ION_MSM
3318 &ion_dev,
3319#endif
David Collins4c31a872011-08-31 10:07:10 -07003320 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003321#ifdef CONFIG_MSM_QDSS
3322 &msm_etb_device,
3323 &msm_tpiu_device,
3324 &msm_funnel_device,
3325 &msm_ptm_device,
3326#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003327};
3328
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003329static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003330 &msm8960_device_otg,
3331 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003332 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303333 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003334 &android_usb_device,
3335 &msm_device_vidc,
3336 &mipi_dsi_simulator_panel_device,
3337 &msm_bus_apps_fabric,
3338 &msm_bus_sys_fabric,
3339 &msm_bus_mm_fabric,
3340 &msm_bus_sys_fpb,
3341 &msm_bus_cpss_fpb,
3342 &msm_pcm,
3343 &msm_pcm_routing,
3344 &msm_cpudai0,
3345 &msm_cpudai1,
3346 &msm_cpudai_hdmi_rx,
3347 &msm_cpudai_bt_rx,
3348 &msm_cpudai_bt_tx,
3349 &msm_cpudai_fm_rx,
3350 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003351 &msm_cpudai_auxpcm_rx,
3352 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003353 &msm_cpu_fe,
3354 &msm_stub_codec,
3355 &msm_voice,
3356 &msm_voip,
3357 &msm_lpa_pcm,
3358
3359#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3360 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3361 &qcrypto_device,
3362#endif
3363
3364#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3365 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3366 &qcedev_device,
3367#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003368};
3369
3370static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003371 &msm_kgsl_3d0,
3372 &msm_kgsl_2d0,
3373 &msm_kgsl_2d1,
3374 &mipi_dsi_renesas_panel_device,
3375#ifdef CONFIG_MSM_GEMINI
3376 &msm8960_gemini_device,
3377#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003378};
3379
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003380static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003381 &msm8960_device_otg,
3382 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003383 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303384 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 &android_usb_device,
3386 &msm_pcm,
3387 &msm_pcm_routing,
3388 &msm_cpudai0,
3389 &msm_cpudai1,
3390 &msm_cpudai_hdmi_rx,
3391 &msm_cpudai_bt_rx,
3392 &msm_cpudai_bt_tx,
3393 &msm_cpudai_fm_rx,
3394 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003395 &msm_cpudai_auxpcm_rx,
3396 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 &msm_cpu_fe,
3398 &msm_stub_codec,
3399 &msm_kgsl_3d0,
3400#ifdef CONFIG_MSM_KGSL_2D
3401 &msm_kgsl_2d0,
3402 &msm_kgsl_2d1,
3403#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003404 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003405#ifdef CONFIG_MSM_GEMINI
3406 &msm8960_gemini_device,
3407#endif
3408 &msm_voice,
3409 &msm_voip,
3410 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303411 &msm_cpudai_afe_01_rx,
3412 &msm_cpudai_afe_01_tx,
3413 &msm_cpudai_afe_02_rx,
3414 &msm_cpudai_afe_02_tx,
3415 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003416#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3417 &hdmi_msm_device,
3418#endif
3419 &msm_pcm_hostless,
3420 &msm_bus_apps_fabric,
3421 &msm_bus_sys_fabric,
3422 &msm_bus_mm_fabric,
3423 &msm_bus_sys_fpb,
3424 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003425 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003426};
3427
3428static void __init msm8960_i2c_init(void)
3429{
3430 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3431 &msm8960_i2c_qup_gsbi4_pdata;
3432
3433 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3434 &msm8960_i2c_qup_gsbi3_pdata;
3435
3436 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3437 &msm8960_i2c_qup_gsbi10_pdata;
3438
3439 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3440 &msm8960_i2c_qup_gsbi12_pdata;
3441}
3442
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003443static void __init msm8960_gfx_init(void)
3444{
3445 uint32_t soc_platform_version = socinfo_get_platform_version();
3446 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3447 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3448 msm_kgsl_3d0.dev.platform_data;
3449 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3450 320000000;
3451 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3452 266667000;
3453 }
3454}
3455
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003456static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3457 .irq_base = PM8921_IRQ_BASE,
3458 .devirq = MSM_GPIO_TO_INT(104),
3459 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3460};
3461
3462static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3463 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3464};
3465
3466static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3467 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3468};
3469
3470static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3471 .rtc_write_enable = false,
3472};
3473
3474static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3475 .pull_up = 1,
3476 .kpd_trigger_delay_us = 970,
3477 .wakeup = 1,
3478};
3479
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303480/* Rotate lock key is not available so use F1 */
3481#define KEY_ROTATE_LOCK KEY_F1
3482
3483static const unsigned int keymap_liquid[] = {
3484 KEY(0, 0, KEY_VOLUMEUP),
3485 KEY(0, 1, KEY_VOLUMEDOWN),
3486 KEY(1, 3, KEY_ROTATE_LOCK),
3487 KEY(1, 4, KEY_HOME),
3488};
3489
3490static struct matrix_keymap_data keymap_data_liquid = {
3491 .keymap_size = ARRAY_SIZE(keymap_liquid),
3492 .keymap = keymap_liquid,
3493};
3494
3495static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3496 .input_name = "keypad_8960_liquid",
3497 .input_phys_device = "keypad_8960/input0",
3498 .num_rows = 2,
3499 .num_cols = 5,
3500 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3501 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3502 .debounce_ms = 15,
3503 .scan_delay_ms = 32,
3504 .row_hold_ns = 91500,
3505 .wakeup = 1,
3506 .keymap_data = &keymap_data_liquid,
3507};
3508
3509
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003510static const unsigned int keymap[] = {
3511 KEY(0, 0, KEY_VOLUMEUP),
3512 KEY(0, 1, KEY_VOLUMEDOWN),
3513 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3514 KEY(0, 3, KEY_CAMERA_FOCUS),
3515};
3516
3517static struct matrix_keymap_data keymap_data = {
3518 .keymap_size = ARRAY_SIZE(keymap),
3519 .keymap = keymap,
3520};
3521
3522static struct pm8xxx_keypad_platform_data keypad_data = {
3523 .input_name = "keypad_8960",
3524 .input_phys_device = "keypad_8960/input0",
3525 .num_rows = 1,
3526 .num_cols = 5,
3527 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3528 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3529 .debounce_ms = 15,
3530 .scan_delay_ms = 32,
3531 .row_hold_ns = 91500,
3532 .wakeup = 1,
3533 .keymap_data = &keymap_data,
3534};
3535
3536static const unsigned int keymap_sim[] = {
3537 KEY(0, 0, KEY_7),
3538 KEY(0, 1, KEY_DOWN),
3539 KEY(0, 2, KEY_UP),
3540 KEY(0, 3, KEY_RIGHT),
3541 KEY(0, 4, KEY_ENTER),
3542 KEY(0, 5, KEY_L),
3543 KEY(0, 6, KEY_BACK),
3544 KEY(0, 7, KEY_M),
3545
3546 KEY(1, 0, KEY_LEFT),
3547 KEY(1, 1, KEY_SEND),
3548 KEY(1, 2, KEY_1),
3549 KEY(1, 3, KEY_4),
3550 KEY(1, 4, KEY_CLEAR),
3551 KEY(1, 5, KEY_MSDOS),
3552 KEY(1, 6, KEY_SPACE),
3553 KEY(1, 7, KEY_COMMA),
3554
3555 KEY(2, 0, KEY_6),
3556 KEY(2, 1, KEY_5),
3557 KEY(2, 2, KEY_8),
3558 KEY(2, 3, KEY_3),
3559 KEY(2, 4, KEY_NUMERIC_STAR),
3560 KEY(2, 5, KEY_UP),
3561 KEY(2, 6, KEY_DOWN),
3562 KEY(2, 7, KEY_LEFTSHIFT),
3563
3564 KEY(3, 0, KEY_9),
3565 KEY(3, 1, KEY_NUMERIC_POUND),
3566 KEY(3, 2, KEY_0),
3567 KEY(3, 3, KEY_2),
3568 KEY(3, 4, KEY_SLEEP),
3569 KEY(3, 5, KEY_F1),
3570 KEY(3, 6, KEY_F2),
3571 KEY(3, 7, KEY_F3),
3572
3573 KEY(4, 0, KEY_BACK),
3574 KEY(4, 1, KEY_HOME),
3575 KEY(4, 2, KEY_MENU),
3576 KEY(4, 3, KEY_VOLUMEUP),
3577 KEY(4, 4, KEY_VOLUMEDOWN),
3578 KEY(4, 5, KEY_F4),
3579 KEY(4, 6, KEY_F5),
3580 KEY(4, 7, KEY_F6),
3581
3582 KEY(5, 0, KEY_R),
3583 KEY(5, 1, KEY_T),
3584 KEY(5, 2, KEY_Y),
3585 KEY(5, 3, KEY_LEFTALT),
3586 KEY(5, 4, KEY_KPENTER),
3587 KEY(5, 5, KEY_Q),
3588 KEY(5, 6, KEY_W),
3589 KEY(5, 7, KEY_E),
3590
3591 KEY(6, 0, KEY_F),
3592 KEY(6, 1, KEY_G),
3593 KEY(6, 2, KEY_H),
3594 KEY(6, 3, KEY_CAPSLOCK),
3595 KEY(6, 4, KEY_PAGEUP),
3596 KEY(6, 5, KEY_A),
3597 KEY(6, 6, KEY_S),
3598 KEY(6, 7, KEY_D),
3599
3600 KEY(7, 0, KEY_V),
3601 KEY(7, 1, KEY_B),
3602 KEY(7, 2, KEY_N),
3603 KEY(7, 3, KEY_MENU),
3604 KEY(7, 4, KEY_PAGEDOWN),
3605 KEY(7, 5, KEY_Z),
3606 KEY(7, 6, KEY_X),
3607 KEY(7, 7, KEY_C),
3608
3609 KEY(8, 0, KEY_P),
3610 KEY(8, 1, KEY_J),
3611 KEY(8, 2, KEY_K),
3612 KEY(8, 3, KEY_INSERT),
3613 KEY(8, 4, KEY_LINEFEED),
3614 KEY(8, 5, KEY_U),
3615 KEY(8, 6, KEY_I),
3616 KEY(8, 7, KEY_O),
3617
3618 KEY(9, 0, KEY_4),
3619 KEY(9, 1, KEY_5),
3620 KEY(9, 2, KEY_6),
3621 KEY(9, 3, KEY_7),
3622 KEY(9, 4, KEY_8),
3623 KEY(9, 5, KEY_1),
3624 KEY(9, 6, KEY_2),
3625 KEY(9, 7, KEY_3),
3626
3627 KEY(10, 0, KEY_F7),
3628 KEY(10, 1, KEY_F8),
3629 KEY(10, 2, KEY_F9),
3630 KEY(10, 3, KEY_F10),
3631 KEY(10, 4, KEY_FN),
3632 KEY(10, 5, KEY_9),
3633 KEY(10, 6, KEY_0),
3634 KEY(10, 7, KEY_DOT),
3635
3636 KEY(11, 0, KEY_LEFTCTRL),
3637 KEY(11, 1, KEY_F11),
3638 KEY(11, 2, KEY_ENTER),
3639 KEY(11, 3, KEY_SEARCH),
3640 KEY(11, 4, KEY_DELETE),
3641 KEY(11, 5, KEY_RIGHT),
3642 KEY(11, 6, KEY_LEFT),
3643 KEY(11, 7, KEY_RIGHTSHIFT),
3644 KEY(0, 0, KEY_VOLUMEUP),
3645 KEY(0, 1, KEY_VOLUMEDOWN),
3646 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3647 KEY(0, 3, KEY_CAMERA_FOCUS),
3648};
3649
3650static struct matrix_keymap_data keymap_data_sim = {
3651 .keymap_size = ARRAY_SIZE(keymap_sim),
3652 .keymap = keymap_sim,
3653};
3654
3655static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3656 .input_name = "keypad_8960",
3657 .input_phys_device = "keypad_8960/input0",
3658 .num_rows = 12,
3659 .num_cols = 8,
3660 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3661 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3662 .debounce_ms = 15,
3663 .scan_delay_ms = 32,
3664 .row_hold_ns = 91500,
3665 .wakeup = 1,
3666 .keymap_data = &keymap_data_sim,
3667};
3668
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003669static int pm8921_therm_mitigation[] = {
3670 1100,
3671 700,
3672 600,
3673 325,
3674};
3675
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003676static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003677 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003678 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003679 .max_voltage = 4200,
3680 .min_voltage = 3200,
3681 .resume_voltage = 4100,
3682 .term_current = 100,
3683 .cool_temp = 10,
3684 .warm_temp = 40,
3685 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003686 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003687 .cool_bat_chg_current = 350,
3688 .warm_bat_chg_current = 350,
3689 .cool_bat_voltage = 4100,
3690 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003691 .thermal_mitigation = pm8921_therm_mitigation,
3692 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003693};
3694
3695static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3696 .priority = 0,
3697};
3698
3699static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3700 .r_sense = 10,
3701 .i_test = 2500,
3702 .v_failure = 3000,
3703 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003704};
3705
Jay Chokshide4cefb2011-08-04 18:10:44 -07003706#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3707
3708/**
3709 * 'flag' stores three values; led id, led mode, and max current of led.
3710 * The bit packing format is as follow,
3711 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3712 * led_id (1 nibble)
3713 */
3714#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3715 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3716 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3717 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3718 PM8XXX_LED_MAX_CURRENT_MASK))
3719
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003720static struct led_info pm8921_led_info[] = {
3721 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003722 .name = "led:usb",
3723 .default_trigger = "usb-online",
3724 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3725 PM8XXX_LED_MODE_MANUAL,
3726 PM8921_LC_LED_MAX_CURRENT),
3727 },
3728 [1] = {
3729 .name = "led:ac",
3730 .default_trigger = "ac-online",
3731 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3732 PM8XXX_LED_MODE_MANUAL,
3733 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003734 },
3735};
3736
3737static struct led_platform_data pm8xxx_leds_pdata = {
3738 .num_leds = ARRAY_SIZE(pm8921_led_info),
3739 .leds = pm8921_led_info,
3740};
3741
3742static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3743 .irq_pdata = &pm8xxx_irq_pdata,
3744 .gpio_pdata = &pm8xxx_gpio_pdata,
3745 .mpp_pdata = &pm8xxx_mpp_pdata,
3746 .rtc_pdata = &pm8xxx_rtc_pdata,
3747 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3748 .keypad_pdata = &keypad_data,
3749 .misc_pdata = &pm8xxx_misc_pdata,
3750 .regulator_pdatas = msm_pm8921_regulator_pdata,
3751 .charger_pdata = &pm8921_chg_pdata,
3752 .bms_pdata = &pm8921_bms_pdata,
3753 .adc_pdata = &pm8921_adc_pdata,
3754 .leds_pdata = &pm8xxx_leds_pdata,
3755};
3756
3757static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3758 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3759 .slave = {
3760 .name = "pm8921-core",
3761 .platform_data = &pm8921_platform_data,
3762 },
3763};
3764
3765static void msm8960_wcnss_init(void)
3766{
3767 int i, ret, j;
3768
3769 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3770 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3771 "wcnss_5_wire");
3772 if (ret) {
3773 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3774 wcnss_5wire_interface[i].gpio, ret);
3775 goto fail;
3776 }
3777 }
3778
3779 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3780
3781 return;
3782
3783fail:
3784 for (j = 0; j < i; j++)
3785 gpio_free(wcnss_5wire_interface[j].gpio);
3786}
3787
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003788#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003789static int ethernet_init(void)
3790{
3791 int ret;
3792 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3793 if (ret) {
3794 pr_err("ks8851 gpio_request failed: %d\n", ret);
3795 goto fail;
3796 }
3797
3798 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3799 if (ret) {
3800 pr_err("ks8851 gpio_request failed: %d\n", ret);
3801 goto fail_rst;
3802 }
3803
3804 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3805 if (ret) {
3806 pr_err("ks8851 gpio_request failed: %d\n", ret);
3807 goto fail_cs;
3808 }
3809
3810 gpio_direction_output(FPGA_CS_GPIO, 1);
3811 gpio_direction_output(KS8851_RST_GPIO, 1);
3812 return 0;
3813fail_cs:
3814 gpio_free(KS8851_RST_GPIO);
3815fail_rst:
3816 gpio_free(KS8851_IRQ_GPIO);
3817fail:
3818 return ret;
3819}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003820#else
3821static int ethernet_init(void)
3822{
3823 return 0;
3824}
3825#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003826
3827static struct msm_cpuidle_state msm_cstates[] __initdata = {
3828 {0, 0, "C0", "WFI",
3829 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3830
3831 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3832 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3833
3834 {0, 2, "C2", "POWER_COLLAPSE",
3835 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3836
3837 {1, 0, "C0", "WFI",
3838 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3839
3840 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3841 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3842};
3843
3844static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3845 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3846 .idle_supported = 1,
3847 .suspend_supported = 1,
3848 .idle_enabled = 0,
3849 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003850 },
3851
3852 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3853 .idle_supported = 1,
3854 .suspend_supported = 1,
3855 .idle_enabled = 0,
3856 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003857 },
3858
3859 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3860 .idle_supported = 1,
3861 .suspend_supported = 1,
3862 .idle_enabled = 1,
3863 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003864 },
3865
3866 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3867 .idle_supported = 0,
3868 .suspend_supported = 1,
3869 .idle_enabled = 0,
3870 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003871 },
3872
3873 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3874 .idle_supported = 1,
3875 .suspend_supported = 1,
3876 .idle_enabled = 0,
3877 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003878 },
3879
3880 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3881 .idle_supported = 1,
3882 .suspend_supported = 0,
3883 .idle_enabled = 1,
3884 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003885 },
3886};
3887
3888static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3889 {
3890 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3891 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3892 true,
3893 1, 8000, 100000, 1,
3894 },
3895
3896 {
3897 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3898 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3899 true,
3900 1500, 5000, 60100000, 3000,
3901 },
3902
3903 {
3904 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3905 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3906 false,
3907 1800, 5000, 60350000, 3500,
3908 },
3909
3910 {
3911 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3912 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3913 false,
3914 2800, 2500, 65350000, 4800,
3915 },
3916
3917 {
3918 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3919 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3920 false,
3921 3800, 4500, 67850000, 5500,
3922 },
3923
3924 {
3925 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3926 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3927 false,
3928 4800, 2000, 71850000, 6800,
3929 },
3930
3931 {
3932 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3933 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3934 false,
3935 6800, 500, 75850000, 8800,
3936 },
3937
3938 {
3939 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3940 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3941 false,
3942 7800, 0, 76350000, 9800,
3943 },
3944};
3945
3946#ifdef CONFIG_I2C
3947#define I2C_SURF 1
3948#define I2C_FFA (1 << 1)
3949#define I2C_RUMI (1 << 2)
3950#define I2C_SIM (1 << 3)
3951#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003952#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003953
3954struct i2c_registry {
3955 u8 machs;
3956 int bus;
3957 struct i2c_board_info *info;
3958 int len;
3959};
3960
3961#ifdef CONFIG_MSM_CAMERA
3962static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3963#ifdef CONFIG_IMX074
3964 {
3965 I2C_BOARD_INFO("imx074", 0x1A),
3966 },
3967#endif
3968#ifdef CONFIG_OV2720
3969 {
3970 I2C_BOARD_INFO("ov2720", 0x6C),
3971 },
3972#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003973 {
3974 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3975 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303976#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3977 {
3978 I2C_BOARD_INFO("sc628a", 0x6E),
3979 },
3980#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003981};
3982#endif
3983
3984/* Sensors DSPS platform data */
3985#ifdef CONFIG_MSM_DSPS
3986#define DSPS_PIL_GENERIC_NAME "dsps"
3987#endif /* CONFIG_MSM_DSPS */
3988
3989static void __init msm8960_init_dsps(void)
3990{
3991#ifdef CONFIG_MSM_DSPS
3992 struct msm_dsps_platform_data *pdata =
3993 msm_dsps_device.dev.platform_data;
3994 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3995 pdata->gpios = NULL;
3996 pdata->gpios_num = 0;
3997
3998 platform_device_register(&msm_dsps_device);
3999#endif /* CONFIG_MSM_DSPS */
4000}
4001
Amir Samuelov5137e392011-09-21 17:31:25 +03004002#ifdef CONFIG_ISL9519_CHARGER
4003static struct isl_platform_data isl_data __initdata = {
4004 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4005 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4006 .max_system_voltage = 4200,
4007 .min_system_voltage = 3200,
4008 .chgcurrent = 1000, /* 1900, */
4009 .term_current = 400, /* Need fine tuning */
4010 .input_current = 2048,
4011};
4012
4013static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4014 {
4015 I2C_BOARD_INFO("isl9519q", 0x9),
4016 .irq = 0, /* Not required when notify-by-pmic */
4017 .platform_data = &isl_data,
4018 },
4019};
4020#endif /* CONFIG_ISL9519_CHARGER */
4021
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004022static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4023#ifdef CONFIG_MSM_CAMERA
4024 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004025 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004026 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4027 msm_camera_boardinfo,
4028 ARRAY_SIZE(msm_camera_boardinfo),
4029 },
4030#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004031#ifdef CONFIG_ISL9519_CHARGER
4032 {
4033 I2C_LIQUID,
4034 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4035 isl_charger_i2c_info,
4036 ARRAY_SIZE(isl_charger_i2c_info),
4037 },
4038#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004039 {
4040 I2C_SURF | I2C_FFA | I2C_FLUID,
4041 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4042 cyttsp_info,
4043 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004044 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304045 {
4046 I2C_LIQUID,
4047 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4048 mxt_device_info,
4049 ARRAY_SIZE(mxt_device_info),
4050 },
4051
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004052};
4053#endif /* CONFIG_I2C */
4054
4055static void __init register_i2c_devices(void)
4056{
4057#ifdef CONFIG_I2C
4058 u8 mach_mask = 0;
4059 int i;
4060
4061 /* Build the matching 'supported_machs' bitmask */
4062 if (machine_is_msm8960_cdp())
4063 mach_mask = I2C_SURF;
4064 else if (machine_is_msm8960_rumi3())
4065 mach_mask = I2C_RUMI;
4066 else if (machine_is_msm8960_sim())
4067 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004068 else if (machine_is_msm8960_fluid())
4069 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004070 else if (machine_is_msm8960_liquid())
4071 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004072 else if (machine_is_msm8960_mtp())
4073 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004074 else
4075 pr_err("unmatched machine ID in register_i2c_devices\n");
4076
4077 /* Run the array and install devices as appropriate */
4078 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4079 if (msm8960_i2c_devices[i].machs & mach_mask)
4080 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4081 msm8960_i2c_devices[i].info,
4082 msm8960_i2c_devices[i].len);
4083 }
4084#endif
4085}
4086
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004087static void __init msm8960_sim_init(void)
4088{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004089 BUG_ON(msm_rpm_init(&msm_rpm_data));
4090 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4091 ARRAY_SIZE(msm_rpmrs_levels)));
4092 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004093 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004094 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004095 msm8960_device_ssbi_pm8921.dev.platform_data =
4096 &msm8960_ssbi_pm8921_pdata;
4097 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004098
4099 /* Simulator supports a QWERTY keypad */
4100 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4101
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004102 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4103 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4104 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004105 gpiomux_init();
4106 ethernet_init();
4107 msm8960_i2c_init();
4108 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4109 msm_spm_l2_init(msm_spm_l2_data);
4110 msm8960_init_buses();
4111 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4112 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004113 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004114 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004115
4116 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4117 &msm8960_qup_spi_gsbi1_pdata;
4118 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4119
4120 msm8960_init_mmc();
4121 msm_fb_add_devices();
4122 slim_register_board_info(msm_slim_devices,
4123 ARRAY_SIZE(msm_slim_devices));
4124 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4125 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4126 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4127 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004128}
4129
4130static void __init msm8960_rumi3_init(void)
4131{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004132 BUG_ON(msm_rpm_init(&msm_rpm_data));
4133 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4134 ARRAY_SIZE(msm_rpmrs_levels)));
4135 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004136 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004137 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004138 gpiomux_init();
4139 ethernet_init();
4140 msm8960_device_ssbi_pm8921.dev.platform_data =
4141 &msm8960_ssbi_pm8921_pdata;
4142 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4143 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4144 &msm8960_qup_spi_gsbi1_pdata;
4145 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4146 msm8960_i2c_init();
4147 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4148 msm_spm_l2_init(msm_spm_l2_data);
4149 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4150 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004151 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004152 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004153 register_i2c_devices();
4154 msm_fb_add_devices();
4155 slim_register_board_info(msm_slim_devices,
4156 ARRAY_SIZE(msm_slim_devices));
4157 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4158 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4159 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4160 msm_pm_data);
4161}
4162
4163static void __init msm8960_cdp_init(void)
4164{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004165 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4166 pr_err("meminfo_init() failed!\n");
4167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004168 BUG_ON(msm_rpm_init(&msm_rpm_data));
4169 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4170 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004171
4172 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004173 regulator_suppress_info_printing();
4174 if (msm_xo_init())
4175 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004176 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004177 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004178 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4179 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4180 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004181 gpiomux_init();
4182 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304183 if (machine_is_msm8960_liquid())
4184 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004185 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4186 &msm8960_qup_spi_gsbi1_pdata;
4187 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4188 msm8960_device_ssbi_pm8921.dev.platform_data =
4189 &msm8960_ssbi_pm8921_pdata;
4190 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4191 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004192 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004193 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4194 msm_spm_l2_init(msm_spm_l2_data);
4195 msm8960_init_buses();
4196 platform_add_devices(msm_footswitch_devices,
4197 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004198 if (machine_is_msm8960_liquid())
4199 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004200 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4201 pm8921_gpio_mpp_init();
4202 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4203 msm8960_init_cam();
4204 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004205 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304206 if (machine_is_msm8960_liquid())
4207 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004208 register_i2c_devices();
4209 msm8960_wcnss_init();
4210 msm_fb_add_devices();
4211 slim_register_board_info(msm_slim_devices,
4212 ARRAY_SIZE(msm_slim_devices));
4213 msm8960_init_dsps();
4214 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4215 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4216 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4217 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004218 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004219}
4220
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004221MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4222 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004223 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004224 .init_irq = msm8960_init_irq,
4225 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004226 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004227 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004228MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004229
4230MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4231 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004232 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004233 .init_irq = msm8960_init_irq,
4234 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004235 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004236 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004237MACHINE_END
4238
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004239MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4240 .map_io = msm8960_map_io,
4241 .reserve = msm8960_reserve,
4242 .init_irq = msm8960_init_irq,
4243 .timer = &msm_timer,
4244 .init_machine = msm8960_cdp_init,
4245 .init_early = msm8960_allocate_memory_regions,
4246MACHINE_END
4247
4248MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4249 .map_io = msm8960_map_io,
4250 .reserve = msm8960_reserve,
4251 .init_irq = msm8960_init_irq,
4252 .timer = &msm_timer,
4253 .init_machine = msm8960_cdp_init,
4254 .init_early = msm8960_allocate_memory_regions,
4255MACHINE_END
4256
4257MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4258 .map_io = msm8960_map_io,
4259 .reserve = msm8960_reserve,
4260 .init_irq = msm8960_init_irq,
4261 .timer = &msm_timer,
4262 .init_machine = msm8960_cdp_init,
4263 .init_early = msm8960_allocate_memory_regions,
4264MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004265
4266MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4267 .map_io = msm8960_map_io,
4268 .reserve = msm8960_reserve,
4269 .init_irq = msm8960_init_irq,
4270 .timer = &msm_timer,
4271 .init_machine = msm8960_cdp_init,
4272 .init_early = msm8960_allocate_memory_regions,
4273MACHINE_END