blob: 9610e330ab345acd37ccb4b6a70dee865d719497 [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,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700466 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700467};
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 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002102 {
2103 .start = 84,
2104 .end = 88,
2105 .name = "wcnss_gpios_5wire",
2106 .flags = IORESOURCE_IO,
2107 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002108};
2109
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002110static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2111 .has_48mhz_xo = 1,
2112};
2113
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002114static struct platform_device msm_device_wcnss_wlan = {
2115 .name = "wcnss_wlan",
2116 .id = 0,
2117 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2118 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002119 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002120};
2121
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2123 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2124 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2125 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2126
2127#define QCE_SIZE 0x10000
2128#define QCE_0_BASE 0x18500000
2129
2130#define QCE_HW_KEY_SUPPORT 0
2131#define QCE_SHA_HMAC_SUPPORT 1
2132#define QCE_SHARE_CE_RESOURCE 1
2133#define QCE_CE_SHARED 0
2134
2135static struct resource qcrypto_resources[] = {
2136 [0] = {
2137 .start = QCE_0_BASE,
2138 .end = QCE_0_BASE + QCE_SIZE - 1,
2139 .flags = IORESOURCE_MEM,
2140 },
2141 [1] = {
2142 .name = "crypto_channels",
2143 .start = DMOV_CE_IN_CHAN,
2144 .end = DMOV_CE_OUT_CHAN,
2145 .flags = IORESOURCE_DMA,
2146 },
2147 [2] = {
2148 .name = "crypto_crci_in",
2149 .start = DMOV_CE_IN_CRCI,
2150 .end = DMOV_CE_IN_CRCI,
2151 .flags = IORESOURCE_DMA,
2152 },
2153 [3] = {
2154 .name = "crypto_crci_out",
2155 .start = DMOV_CE_OUT_CRCI,
2156 .end = DMOV_CE_OUT_CRCI,
2157 .flags = IORESOURCE_DMA,
2158 },
2159};
2160
2161static struct resource qcedev_resources[] = {
2162 [0] = {
2163 .start = QCE_0_BASE,
2164 .end = QCE_0_BASE + QCE_SIZE - 1,
2165 .flags = IORESOURCE_MEM,
2166 },
2167 [1] = {
2168 .name = "crypto_channels",
2169 .start = DMOV_CE_IN_CHAN,
2170 .end = DMOV_CE_OUT_CHAN,
2171 .flags = IORESOURCE_DMA,
2172 },
2173 [2] = {
2174 .name = "crypto_crci_in",
2175 .start = DMOV_CE_IN_CRCI,
2176 .end = DMOV_CE_IN_CRCI,
2177 .flags = IORESOURCE_DMA,
2178 },
2179 [3] = {
2180 .name = "crypto_crci_out",
2181 .start = DMOV_CE_OUT_CRCI,
2182 .end = DMOV_CE_OUT_CRCI,
2183 .flags = IORESOURCE_DMA,
2184 },
2185};
2186
2187#endif
2188
2189#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2190 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2191
2192static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2193 .ce_shared = QCE_CE_SHARED,
2194 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2195 .hw_key_support = QCE_HW_KEY_SUPPORT,
2196 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2197};
2198
2199static struct platform_device qcrypto_device = {
2200 .name = "qcrypto",
2201 .id = 0,
2202 .num_resources = ARRAY_SIZE(qcrypto_resources),
2203 .resource = qcrypto_resources,
2204 .dev = {
2205 .coherent_dma_mask = DMA_BIT_MASK(32),
2206 .platform_data = &qcrypto_ce_hw_suppport,
2207 },
2208};
2209#endif
2210
2211#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2212 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2213
2214static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2215 .ce_shared = QCE_CE_SHARED,
2216 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2217 .hw_key_support = QCE_HW_KEY_SUPPORT,
2218 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2219};
2220
2221static struct platform_device qcedev_device = {
2222 .name = "qce",
2223 .id = 0,
2224 .num_resources = ARRAY_SIZE(qcedev_resources),
2225 .resource = qcedev_resources,
2226 .dev = {
2227 .coherent_dma_mask = DMA_BIT_MASK(32),
2228 .platform_data = &qcedev_ce_hw_suppport,
2229 },
2230};
2231#endif
2232
2233
2234static int __init gpiomux_init(void)
2235{
2236 int rc;
2237
2238 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2239 if (rc) {
2240 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2241 return rc;
2242 }
2243
Nishant Pandit24153d82011-08-27 16:05:13 +05302244 msm_gpiomux_install(msm8960_cam_common_configs,
2245 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002246
2247 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002248 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002249
2250 msm_gpiomux_install(msm8960_gsbi_configs,
2251 ARRAY_SIZE(msm8960_gsbi_configs));
2252
2253 msm_gpiomux_install(msm8960_cyts_configs,
2254 ARRAY_SIZE(msm8960_cyts_configs));
2255
2256 msm_gpiomux_install(msm8960_slimbus_config,
2257 ARRAY_SIZE(msm8960_slimbus_config));
2258
2259 msm_gpiomux_install(msm8960_audio_codec_configs,
2260 ARRAY_SIZE(msm8960_audio_codec_configs));
2261
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002262 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2263 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2264
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002265#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2266 msm_gpiomux_install(msm8960_hdmi_configs,
2267 ARRAY_SIZE(msm8960_hdmi_configs));
2268#endif
2269
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002270 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2271 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2272
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 msm_gpiomux_install(wcnss_5wire_interface,
2274 ARRAY_SIZE(wcnss_5wire_interface));
2275
2276 return 0;
2277}
2278
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002279#define MSM_SHARED_RAM_PHYS 0x80000000
2280
2281static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2282 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2283 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2284 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2285 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2286 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2287 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2288 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2289 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2290 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2291 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2292 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2293 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2295 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2296 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2297 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2298 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2299 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2300 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2301 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2302 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2303 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2304 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2305 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2306 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2307 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002308 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002309 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2310 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2311 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002312 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2313 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314};
2315
2316static struct pm8921_adc_properties pm8921_adc_data = {
2317 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2318 .bitresolution = 15,
2319 .bipolar = 0,
2320};
2321
2322static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2323 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002324 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002326 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002327};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002328
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002329static void __init msm8960_map_io(void)
2330{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002331 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002332 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002333
2334 if (socinfo_init() < 0)
2335 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002336}
2337
2338static void __init msm8960_init_irq(void)
2339{
2340 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002341
2342 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002343 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002344 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002345
2346 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002348
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002349 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2350 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002351
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002352 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2353 * as they are configured as level, which does not play nice with
2354 * handle_percpu_irq.
2355 */
2356 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2357 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002358 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002359 }
2360}
2361
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362/* MSM8960 have 5 SDCC controllers */
2363enum sdcc_controllers {
2364 SDCC1,
2365 SDCC2,
2366 SDCC3,
2367 SDCC4,
2368 SDCC5,
2369 MAX_SDCC_CONTROLLER
2370};
2371
2372/* All SDCC controllers requires VDD/VCC voltage */
2373static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2374 /* SDCC1 : eMMC card connected */
2375 [SDCC1] = {
2376 .name = "sdc_vdd",
2377 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302378 .high_vol_level = 2950000,
2379 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302380 .always_on = 1,
2381 .lpm_sup = 1,
2382 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002383 .hpm_uA = 200000, /* 200mA */
2384 },
2385 /* SDCC3 : External card slot connected */
2386 [SDCC3] = {
2387 .name = "sdc_vdd",
2388 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302389 .high_vol_level = 2950000,
2390 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002391 .hpm_uA = 600000, /* 600mA */
2392 }
2393};
2394
2395/* Only slots having eMMC card will require VCCQ voltage */
2396static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2397 /* SDCC1 : eMMC card connected */
2398 [SDCC1] = {
2399 .name = "sdc_vccq",
2400 .set_voltage_sup = 1,
2401 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302402 .high_vol_level = 1800000,
2403 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002404 .hpm_uA = 200000, /* 200mA */
2405 }
2406};
2407
2408/* All SDCC controllers may require voting for VDD PAD voltage */
2409static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2410 /* SDCC3 : External card slot connected */
2411 [SDCC3] = {
2412 .name = "sdc_vddp",
2413 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302414 .high_vol_level = 2950000,
2415 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002416 .always_on = 1,
2417 .lpm_sup = 1,
2418 /* Max. Active current required is 16 mA */
2419 .hpm_uA = 16000,
2420 /*
2421 * Sleep current required is ~300 uA. But min. vote can be
2422 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2423 * during sleep.
2424 */
2425 .lpm_uA = 2000,
2426 }
2427};
2428
2429static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2430 /* SDCC1 : eMMC card connected */
2431 [SDCC1] = {
2432 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2433 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2434 },
2435 /* SDCC3 : External card slot connected */
2436 [SDCC3] = {
2437 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2438 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2439 }
2440};
2441
2442/* SDC1 pad data */
2443static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2444 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302445 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2446 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002447};
2448
2449static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2450 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2451 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2452 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2453};
2454
2455static struct msm_mmc_pad_pull sdc1_pad_pull_on_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_UP},
2458 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2459};
2460
2461static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302462 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002463 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2464 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2465};
2466
2467/* SDC3 pad data */
2468static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2469 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2470 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2471 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2472};
2473
2474static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2475 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2476 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2477 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2478};
2479
2480static struct msm_mmc_pad_pull sdc3_pad_pull_on_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_UP},
2483 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2484};
2485
2486static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302487 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002488 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2489 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2490};
2491
2492struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2493 [SDCC1] = {
2494 .on = sdc1_pad_pull_on_cfg,
2495 .off = sdc1_pad_pull_off_cfg,
2496 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2497 },
2498 [SDCC3] = {
2499 .on = sdc3_pad_pull_on_cfg,
2500 .off = sdc3_pad_pull_off_cfg,
2501 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2502 },
2503};
2504
2505struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2506 [SDCC1] = {
2507 .on = sdc1_pad_drv_on_cfg,
2508 .off = sdc1_pad_drv_off_cfg,
2509 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2510 },
2511 [SDCC3] = {
2512 .on = sdc3_pad_drv_on_cfg,
2513 .off = sdc3_pad_drv_off_cfg,
2514 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2515 },
2516};
2517
2518struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2519 [SDCC1] = {
2520 .pull = &mmc_pad_pull_data[SDCC1],
2521 .drv = &mmc_pad_drv_data[SDCC1]
2522 },
2523 [SDCC3] = {
2524 .pull = &mmc_pad_pull_data[SDCC3],
2525 .drv = &mmc_pad_drv_data[SDCC3]
2526 },
2527};
2528
2529struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2530 [SDCC1] = {
2531 .pad_data = &mmc_pad_data[SDCC1],
2532 },
2533 [SDCC3] = {
2534 .pad_data = &mmc_pad_data[SDCC3],
2535 },
2536};
2537
2538static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302539 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002540};
2541
2542static unsigned int sdc3_sup_clk_rates[] = {
2543 400000, 24000000, 48000000, 96000000
2544};
2545
2546#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2547static struct mmc_platform_data msm8960_sdc1_data = {
2548 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2549#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2550 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2551#else
2552 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2553#endif
2554 .sup_clk_table = sdc1_sup_clk_rates,
2555 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302556 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002557 .nonremovable = 1,
2558 .sdcc_v4_sup = true,
2559 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302560 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002561};
2562#endif
2563
2564#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2565static struct mmc_platform_data msm8960_sdc3_data = {
2566 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2567 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2568 .sup_clk_table = sdc3_sup_clk_rates,
2569 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302570 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302571#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002572 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302573#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002574 .sdcc_v4_sup = true,
2575 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2576 .pin_data = &mmc_slot_pin_data[SDCC3],
2577#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2578 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2579 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2580 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2581#endif
2582 .xpc_cap = 1,
2583 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2584 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302585 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002586};
2587#endif
2588
2589static void __init msm8960_init_mmc(void)
2590{
2591#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2592 /* SDC1 : eMMC card connected */
2593 msm_add_sdcc(1, &msm8960_sdc1_data);
2594#endif
2595#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2596 /* SDC3: External card slot */
2597 msm_add_sdcc(3, &msm8960_sdc3_data);
2598#endif
2599}
2600
2601static void __init msm8960_init_buses(void)
2602{
2603#ifdef CONFIG_MSM_BUS_SCALING
2604 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2605 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2606 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2607 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2608 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2609 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2610 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2611 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2612 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2613 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002614 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002615#endif
2616}
2617
2618static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2619 .max_clock_speed = 15060000,
2620};
2621
2622#ifdef CONFIG_USB_MSM_OTG_72K
2623static struct msm_otg_platform_data msm_otg_pdata;
2624#else
2625#define USB_5V_EN 42
2626static void msm_hsusb_vbus_power(bool on)
2627{
2628 int rc;
2629 static bool vbus_is_on;
2630 static struct regulator *mvs_otg_switch;
2631 struct pm_gpio param = {
2632 .direction = PM_GPIO_DIR_OUT,
2633 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2634 .output_value = 1,
2635 .pull = PM_GPIO_PULL_NO,
2636 .vin_sel = PM_GPIO_VIN_S4,
2637 .out_strength = PM_GPIO_STRENGTH_MED,
2638 .function = PM_GPIO_FUNC_NORMAL,
2639 };
2640
2641 if (vbus_is_on == on)
2642 return;
2643
2644 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002645 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2646 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002647 if (IS_ERR(mvs_otg_switch)) {
2648 pr_err("Unable to get mvs_otg_switch\n");
2649 return;
2650 }
2651
2652 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2653 "usb_5v_en");
2654 if (rc < 0) {
2655 pr_err("failed to request usb_5v_en gpio\n");
2656 goto put_mvs_otg;
2657 }
2658
2659 if (regulator_enable(mvs_otg_switch)) {
2660 pr_err("unable to enable mvs_otg_switch\n");
2661 goto free_usb_5v_en;
2662 }
2663
2664 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2665 &param);
2666 if (rc < 0) {
2667 pr_err("failed to configure usb_5v_en gpio\n");
2668 goto disable_mvs_otg;
2669 }
2670 vbus_is_on = true;
2671 return;
2672 }
2673disable_mvs_otg:
2674 regulator_disable(mvs_otg_switch);
2675free_usb_5v_en:
2676 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2677put_mvs_otg:
2678 regulator_put(mvs_otg_switch);
2679 vbus_is_on = false;
2680}
2681
2682static struct msm_otg_platform_data msm_otg_pdata = {
2683 .mode = USB_OTG,
2684 .otg_control = OTG_PMIC_CONTROL,
2685 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2686 .pclk_src_name = "dfab_usb_hs_clk",
2687 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2688 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302689 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002690};
2691#endif
2692
2693#define PID_MAGIC_ID 0x71432909
2694#define SERIAL_NUM_MAGIC_ID 0x61945374
2695#define SERIAL_NUMBER_LENGTH 127
2696#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2697
2698struct magic_num_struct {
2699 uint32_t pid;
2700 uint32_t serial_num;
2701};
2702
2703struct dload_struct {
2704 uint32_t reserved1;
2705 uint32_t reserved2;
2706 uint32_t reserved3;
2707 uint16_t reserved4;
2708 uint16_t pid;
2709 char serial_number[SERIAL_NUMBER_LENGTH];
2710 uint16_t reserved5;
2711 struct magic_num_struct magic_struct;
2712};
2713
2714static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2715{
2716 struct dload_struct __iomem *dload = 0;
2717
2718 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2719 if (!dload) {
2720 pr_err("%s: cannot remap I/O memory region: %08x\n",
2721 __func__, DLOAD_USB_BASE_ADD);
2722 return -ENXIO;
2723 }
2724
2725 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2726 __func__, dload, pid, snum);
2727 /* update pid */
2728 dload->magic_struct.pid = PID_MAGIC_ID;
2729 dload->pid = pid;
2730
2731 /* update serial number */
2732 dload->magic_struct.serial_num = 0;
2733 if (!snum) {
2734 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2735 goto out;
2736 }
2737
2738 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2739 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2740 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2741out:
2742 iounmap(dload);
2743 return 0;
2744}
2745
2746static struct android_usb_platform_data android_usb_pdata = {
2747 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2748};
2749
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002750static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751 .name = "android_usb",
2752 .id = -1,
2753 .dev = {
2754 .platform_data = &android_usb_pdata,
2755 },
2756};
2757
2758static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2759 0x03, 0x0f,
2760};
2761
2762static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2763 0x00, 0x24, 0x54, 0x10,
2764 0x09, 0x03, 0x01,
2765 0x10, 0x54, 0x30, 0x0C,
2766 0x24, 0x30, 0x0f,
2767};
2768
2769static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2770 0x00, 0x24, 0x54, 0x10,
2771 0x09, 0x07, 0x01, 0x0B,
2772 0x10, 0x54, 0x30, 0x0C,
2773 0x24, 0x30, 0x0f,
2774};
2775
2776static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2777 [0] = {
2778 .mode = MSM_SPM_MODE_CLOCK_GATING,
2779 .notify_rpm = false,
2780 .cmd = spm_wfi_cmd_sequence,
2781 },
2782 [1] = {
2783 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2784 .notify_rpm = false,
2785 .cmd = spm_power_collapse_without_rpm,
2786 },
2787 [2] = {
2788 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2789 .notify_rpm = true,
2790 .cmd = spm_power_collapse_with_rpm,
2791 },
2792};
2793
2794static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2795 [0] = {
2796 .reg_base_addr = MSM_SAW0_BASE,
2797 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2798 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2799 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2800#if defined(CONFIG_MSM_AVS_HW)
2801 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2802 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2803#endif
2804 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2805 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2806 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2807 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2808 .vctl_timeout_us = 50,
2809 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2810 .modes = msm_spm_seq_list,
2811 },
2812 [1] = {
2813 .reg_base_addr = MSM_SAW1_BASE,
2814 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2815 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2816 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2817#if defined(CONFIG_MSM_AVS_HW)
2818 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2819 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2820#endif
2821 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2822 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2823 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2824 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2825 .vctl_timeout_us = 50,
2826 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2827 .modes = msm_spm_seq_list,
2828 },
2829};
2830
2831static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2832 0x00, 0x20, 0x03, 0x20,
2833 0x00, 0x0f,
2834};
2835
2836static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2837 0x00, 0x20, 0x34, 0x64,
2838 0x48, 0x07, 0x48, 0x20,
2839 0x50, 0x64, 0x04, 0x34,
2840 0x50, 0x0f,
2841};
2842static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2843 0x00, 0x10, 0x34, 0x64,
2844 0x48, 0x07, 0x48, 0x10,
2845 0x50, 0x64, 0x04, 0x34,
2846 0x50, 0x0F,
2847};
2848
2849static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2850 [0] = {
2851 .mode = MSM_SPM_L2_MODE_RETENTION,
2852 .notify_rpm = false,
2853 .cmd = l2_spm_wfi_cmd_sequence,
2854 },
2855 [1] = {
2856 .mode = MSM_SPM_L2_MODE_GDHS,
2857 .notify_rpm = true,
2858 .cmd = l2_spm_gdhs_cmd_sequence,
2859 },
2860 [2] = {
2861 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2862 .notify_rpm = true,
2863 .cmd = l2_spm_power_off_cmd_sequence,
2864 },
2865};
2866
2867
2868static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2869 [0] = {
2870 .reg_base_addr = MSM_SAW_L2_BASE,
2871 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2872 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2873 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2874 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2875 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2876 .modes = msm_spm_l2_seq_list,
2877 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2878 },
2879};
2880
2881#define CYTTSP_TS_GPIO_IRQ 11
2882#define CYTTSP_TS_SLEEP_GPIO 50
2883#define CYTTSP_TS_RESOUT_N_GPIO 52
2884
2885/*virtual key support */
2886static ssize_t tma340_vkeys_show(struct kobject *kobj,
2887 struct kobj_attribute *attr, char *buf)
2888{
2889 return snprintf(buf, 200,
2890 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2891 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2892 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2893 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2894 "\n");
2895}
2896
2897static struct kobj_attribute tma340_vkeys_attr = {
2898 .attr = {
2899 .mode = S_IRUGO,
2900 },
2901 .show = &tma340_vkeys_show,
2902};
2903
2904static struct attribute *tma340_properties_attrs[] = {
2905 &tma340_vkeys_attr.attr,
2906 NULL
2907};
2908
2909static struct attribute_group tma340_properties_attr_group = {
2910 .attrs = tma340_properties_attrs,
2911};
2912
2913
2914static int cyttsp_platform_init(struct i2c_client *client)
2915{
2916 int rc = 0;
2917 static struct kobject *tma340_properties_kobj;
2918
2919 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2920 tma340_properties_kobj = kobject_create_and_add("board_properties",
2921 NULL);
2922 if (tma340_properties_kobj)
2923 rc = sysfs_create_group(tma340_properties_kobj,
2924 &tma340_properties_attr_group);
2925 if (!tma340_properties_kobj || rc)
2926 pr_err("%s: failed to create board_properties\n",
2927 __func__);
2928
2929 return 0;
2930}
2931
2932static struct cyttsp_regulator regulator_data[] = {
2933 {
2934 .name = "vdd",
2935 .min_uV = CY_TMA300_VTG_MIN_UV,
2936 .max_uV = CY_TMA300_VTG_MAX_UV,
2937 .load_uA = CY_TMA300_CURR_24HZ_UA,
2938 },
2939 /* TODO: Remove after runtime PM is enabled in I2C driver */
2940 {
2941 .name = "vcc_i2c",
2942 .min_uV = CY_I2C_VTG_MIN_UV,
2943 .max_uV = CY_I2C_VTG_MAX_UV,
2944 .load_uA = CY_I2C_CURR_UA,
2945 },
2946};
2947
2948static struct cyttsp_platform_data cyttsp_pdata = {
2949 .panel_maxx = 634,
2950 .panel_maxy = 1166,
2951 .disp_maxx = 616,
2952 .disp_maxy = 1023,
2953 .disp_minx = 0,
2954 .disp_miny = 16,
2955 .flags = 0x01,
2956 .gen = CY_GEN3, /* or */
2957 .use_st = CY_USE_ST,
2958 .use_mt = CY_USE_MT,
2959 .use_hndshk = CY_SEND_HNDSHK,
2960 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302961 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002962 .use_gestures = CY_USE_GESTURES,
2963 .fw_fname = "cyttsp_8960_cdp.hex",
2964 /* activate up to 4 groups
2965 * and set active distance
2966 */
2967 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2968 CY_GEST_GRP3 | CY_GEST_GRP4 |
2969 CY_ACT_DIST,
2970 /* change act_intrvl to customize the Active power state
2971 * scanning/processing refresh interval for Operating mode
2972 */
2973 .act_intrvl = CY_ACT_INTRVL_DFLT,
2974 /* change tch_tmout to customize the touch timeout for the
2975 * Active power state for Operating mode
2976 */
2977 .tch_tmout = CY_TCH_TMOUT_DFLT,
2978 /* change lp_intrvl to customize the Low Power power state
2979 * scanning/processing refresh interval for Operating mode
2980 */
2981 .lp_intrvl = CY_LP_INTRVL_DFLT,
2982 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2983 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2984 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2985 .regulator_info = regulator_data,
2986 .num_regulators = ARRAY_SIZE(regulator_data),
2987 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302988 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002989};
2990
2991static struct i2c_board_info cyttsp_info[] __initdata = {
2992 {
2993 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2994 .platform_data = &cyttsp_pdata,
2995#ifndef CY_USE_TIMER
2996 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2997#endif /* CY_USE_TIMER */
2998 },
2999};
3000
Mohan Pallaka50837382011-09-07 11:00:57 +05303001/* configuration data */
3002static const u8 mxt_config_data[] = {
3003 /* T6 Object */
3004 0, 0, 0, 0, 0, 0,
3005 /* T38 Object */
3006 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3009 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3010 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3011 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3012 0, 0, 0, 0,
3013 /* T7 Object */
3014 10, 10, 50,
3015 /* T8 Object */
3016 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3017 /* T9 Object */
3018 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3019 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3020 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3021 0, 5, 45, 46,
3022 /* T15 Object */
3023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3024 0,
3025 /* T22 Object */
3026 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3027 0, 0, 255, 255, 255, 255, 0,
3028 /* T24 Object */
3029 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3030 0, 0, 0, 0, 0, 0, 0, 0, 0,
3031 /* T25 Object */
3032 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3033 0, 0, 0, 0,
3034 /* T27 Object */
3035 0, 0, 0, 0, 0, 0, 0,
3036 /* T28 Object */
3037 0, 0, 0, 8, 8, 8,
3038 /* T40 Object */
3039 0, 0, 0, 0, 0,
3040 /* T41 Object */
3041 0, 0, 0, 0, 0, 0,
3042 /* T43 Object */
3043 0, 0, 0, 0, 0, 0,
3044};
3045
3046#define MXT_TS_GPIO_IRQ 11
3047#define MXT_TS_LDO_EN_GPIO 50
3048#define MXT_TS_RESET_GPIO 52
3049
3050static void mxt_init_hw_liquid(void)
3051{
3052 int rc;
3053
3054 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3055 if (rc) {
3056 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3057 __func__, MXT_TS_GPIO_IRQ);
3058 return;
3059 }
3060
3061 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3062 if (rc) {
3063 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3064 __func__, MXT_TS_GPIO_IRQ);
3065 goto err_irq_gpio_req;
3066 }
3067
3068 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3069 if (rc) {
3070 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3071 __func__, MXT_TS_LDO_EN_GPIO);
3072 goto err_irq_gpio_req;
3073 }
3074
3075 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3076 if (rc) {
3077 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3078 __func__, MXT_TS_LDO_EN_GPIO);
3079 goto err_ldo_gpio_req;
3080 }
3081
3082 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3083 if (rc) {
3084 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3085 __func__, MXT_TS_RESET_GPIO);
3086 goto err_ldo_gpio_set_dir;
3087 }
3088
3089 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3090 if (rc) {
3091 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3092 __func__, MXT_TS_RESET_GPIO);
3093 goto err_reset_gpio_req;
3094 }
3095
3096 return;
3097
3098err_reset_gpio_req:
3099 gpio_free(MXT_TS_RESET_GPIO);
3100err_ldo_gpio_set_dir:
3101 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3102err_ldo_gpio_req:
3103 gpio_free(MXT_TS_LDO_EN_GPIO);
3104err_irq_gpio_req:
3105 gpio_free(MXT_TS_GPIO_IRQ);
3106}
3107
3108static struct mxt_platform_data mxt_platform_data = {
3109 .config = mxt_config_data,
3110 .config_length = ARRAY_SIZE(mxt_config_data),
3111 .x_line = 26,
3112 .y_line = 42,
3113 .x_size = 767,
3114 .y_size = 1365,
3115 .blen = 32,
3116 .threshold = 40,
3117 .voltage = 3300000, /* 3.3V */
3118 .orient = MXT_ROTATED_90,
3119 .irqflags = IRQF_TRIGGER_FALLING,
3120};
3121
3122static struct i2c_board_info mxt_device_info[] __initdata = {
3123 {
3124 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3125 .platform_data = &mxt_platform_data,
3126 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3127 },
3128};
3129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003130static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3131{
3132}
3133
3134static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_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_gsbi3_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_gsbi10_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_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3153 .clk_freq = 100000,
3154 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003155 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3156};
3157
3158static struct msm_rpm_platform_data msm_rpm_data = {
3159 .reg_base_addrs = {
3160 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3161 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3162 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3163 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3164 },
3165
3166 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3167 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3168 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3169 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3170 .msm_apps_ipc_rpm_val = 4,
3171};
3172
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003173
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003174static struct spi_board_info spi_board_info[] __initdata = {
3175 {
3176 .modalias = "ks8851",
3177 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3178 .max_speed_hz = 19200000,
3179 .bus_num = 0,
3180 .chip_select = 0,
3181 .mode = SPI_MODE_0,
3182 },
3183};
3184
3185static struct platform_device msm_device_saw_core0 = {
3186 .name = "saw-regulator",
3187 .id = 0,
3188 .dev = {
3189 .platform_data = &msm_saw_regulator_pdata_s5,
3190 },
3191};
3192
3193static struct platform_device msm_device_saw_core1 = {
3194 .name = "saw-regulator",
3195 .id = 1,
3196 .dev = {
3197 .platform_data = &msm_saw_regulator_pdata_s6,
3198 },
3199};
3200
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003201static struct tsens_platform_data msm_tsens_pdata = {
3202 .slope = 910,
3203 .tsens_factor = 1000,
3204 .hw_type = MSM_8960,
3205 .tsens_num_sensor = 5,
3206};
3207
3208static struct platform_device msm_tsens_device = {
3209 .name = "tsens8960-tm",
3210 .id = -1,
3211 .dev = {
3212 .platform_data = &msm_tsens_pdata,
3213 },
3214};
3215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003216#ifdef CONFIG_MSM_FAKE_BATTERY
3217static struct platform_device fish_battery_device = {
3218 .name = "fish_battery",
3219};
3220#endif
3221
David Collins26f05562011-06-20 09:56:28 -07003222static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003223 .name = GPIO_REGULATOR_DEV_NAME,
3224 .id = PM8921_MPP_PM_TO_SYS(7),
3225 .dev = {
3226 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3227 },
3228};
3229
David Collins26f05562011-06-20 09:56:28 -07003230static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003231 .name = GPIO_REGULATOR_DEV_NAME,
3232 .id = 91,
3233 .dev = {
3234 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3235 },
3236};
3237
David Collinsb10be1d2011-09-02 10:29:31 -07003238static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3239 .name = GPIO_REGULATOR_DEV_NAME,
3240 .id = PM8921_GPIO_PM_TO_SYS(17),
3241 .dev = {
3242 .platform_data =
3243 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3244 },
3245};
3246
David Collins26f05562011-06-20 09:56:28 -07003247static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3248 .name = "rpm-regulator",
3249 .id = -1,
3250 .dev = {
3251 .platform_data = &msm_rpm_regulator_pdata,
3252 },
3253};
3254
David Collins4c31a872011-08-31 10:07:10 -07003255static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3256 .phys_addr_base = 0x0010C000,
3257 .reg_offsets = {
3258 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3259 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3260 },
3261 .phys_size = SZ_8K,
3262 .log_len = 4096, /* log's buffer length in bytes */
3263 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3264};
3265
3266static struct platform_device msm_rpm_log_device = {
3267 .name = "msm_rpm_log",
3268 .id = -1,
3269 .dev = {
3270 .platform_data = &msm_rpm_log_pdata,
3271 },
3272};
3273
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003274static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003275 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003276 &msm_device_smd,
3277 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303278 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003279 &msm_device_saw_core0,
3280 &msm_device_saw_core1,
3281 &msm8960_device_ext_5v_vreg,
3282 &msm8960_device_ext_l2_vreg,
3283 &msm8960_device_ssbi_pm8921,
3284 &msm8960_device_qup_spi_gsbi1,
3285 &msm8960_device_qup_i2c_gsbi3,
3286 &msm8960_device_qup_i2c_gsbi4,
3287 &msm8960_device_qup_i2c_gsbi10,
3288#ifndef CONFIG_MSM_DSPS
3289 &msm8960_device_qup_i2c_gsbi12,
3290#endif
3291 &msm_slim_ctrl,
3292 &msm_device_wcnss_wlan,
3293#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3294 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3295 &qcrypto_device,
3296#endif
3297
3298#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3299 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3300 &qcedev_device,
3301#endif
3302#ifdef CONFIG_MSM_ROTATOR
3303 &msm_rotator_device,
3304#endif
3305 &msm_device_sps,
3306#ifdef CONFIG_MSM_FAKE_BATTERY
3307 &fish_battery_device,
3308#endif
3309#ifdef CONFIG_ANDROID_PMEM
3310 &android_pmem_device,
3311 &android_pmem_adsp_device,
3312 &android_pmem_audio_device,
3313#endif
3314 &msm_fb_device,
3315 &msm_device_vidc,
3316 &msm_device_bam_dmux,
3317 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003318
3319#ifdef CONFIG_HW_RANDOM_MSM
3320 &msm_device_rng,
3321#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003322 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003323#ifdef CONFIG_ION_MSM
3324 &ion_dev,
3325#endif
David Collins4c31a872011-08-31 10:07:10 -07003326 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003327#ifdef CONFIG_MSM_QDSS
3328 &msm_etb_device,
3329 &msm_tpiu_device,
3330 &msm_funnel_device,
3331 &msm_ptm_device,
3332#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333};
3334
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003335static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003336 &msm8960_device_otg,
3337 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003338 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303339 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003340 &android_usb_device,
3341 &msm_device_vidc,
3342 &mipi_dsi_simulator_panel_device,
3343 &msm_bus_apps_fabric,
3344 &msm_bus_sys_fabric,
3345 &msm_bus_mm_fabric,
3346 &msm_bus_sys_fpb,
3347 &msm_bus_cpss_fpb,
3348 &msm_pcm,
3349 &msm_pcm_routing,
3350 &msm_cpudai0,
3351 &msm_cpudai1,
3352 &msm_cpudai_hdmi_rx,
3353 &msm_cpudai_bt_rx,
3354 &msm_cpudai_bt_tx,
3355 &msm_cpudai_fm_rx,
3356 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003357 &msm_cpudai_auxpcm_rx,
3358 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003359 &msm_cpu_fe,
3360 &msm_stub_codec,
3361 &msm_voice,
3362 &msm_voip,
3363 &msm_lpa_pcm,
3364
3365#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3366 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3367 &qcrypto_device,
3368#endif
3369
3370#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3371 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3372 &qcedev_device,
3373#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003374};
3375
3376static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003377 &msm_kgsl_3d0,
3378 &msm_kgsl_2d0,
3379 &msm_kgsl_2d1,
3380 &mipi_dsi_renesas_panel_device,
3381#ifdef CONFIG_MSM_GEMINI
3382 &msm8960_gemini_device,
3383#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003384};
3385
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003386static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003387 &msm8960_device_otg,
3388 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003389 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303390 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003391 &android_usb_device,
3392 &msm_pcm,
3393 &msm_pcm_routing,
3394 &msm_cpudai0,
3395 &msm_cpudai1,
3396 &msm_cpudai_hdmi_rx,
3397 &msm_cpudai_bt_rx,
3398 &msm_cpudai_bt_tx,
3399 &msm_cpudai_fm_rx,
3400 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003401 &msm_cpudai_auxpcm_rx,
3402 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003403 &msm_cpu_fe,
3404 &msm_stub_codec,
3405 &msm_kgsl_3d0,
3406#ifdef CONFIG_MSM_KGSL_2D
3407 &msm_kgsl_2d0,
3408 &msm_kgsl_2d1,
3409#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003410 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003411#ifdef CONFIG_MSM_GEMINI
3412 &msm8960_gemini_device,
3413#endif
3414 &msm_voice,
3415 &msm_voip,
3416 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303417 &msm_cpudai_afe_01_rx,
3418 &msm_cpudai_afe_01_tx,
3419 &msm_cpudai_afe_02_rx,
3420 &msm_cpudai_afe_02_tx,
3421 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003422#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3423 &hdmi_msm_device,
3424#endif
3425 &msm_pcm_hostless,
3426 &msm_bus_apps_fabric,
3427 &msm_bus_sys_fabric,
3428 &msm_bus_mm_fabric,
3429 &msm_bus_sys_fpb,
3430 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003431 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003432};
3433
3434static void __init msm8960_i2c_init(void)
3435{
3436 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3437 &msm8960_i2c_qup_gsbi4_pdata;
3438
3439 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3440 &msm8960_i2c_qup_gsbi3_pdata;
3441
3442 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3443 &msm8960_i2c_qup_gsbi10_pdata;
3444
3445 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3446 &msm8960_i2c_qup_gsbi12_pdata;
3447}
3448
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003449static void __init msm8960_gfx_init(void)
3450{
3451 uint32_t soc_platform_version = socinfo_get_platform_version();
3452 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3453 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3454 msm_kgsl_3d0.dev.platform_data;
3455 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3456 320000000;
3457 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3458 266667000;
3459 }
3460}
3461
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003462static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3463 .irq_base = PM8921_IRQ_BASE,
3464 .devirq = MSM_GPIO_TO_INT(104),
3465 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3466};
3467
3468static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3469 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3470};
3471
3472static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3473 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3474};
3475
3476static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3477 .rtc_write_enable = false,
3478};
3479
3480static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3481 .pull_up = 1,
3482 .kpd_trigger_delay_us = 970,
3483 .wakeup = 1,
3484};
3485
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303486/* Rotate lock key is not available so use F1 */
3487#define KEY_ROTATE_LOCK KEY_F1
3488
3489static const unsigned int keymap_liquid[] = {
3490 KEY(0, 0, KEY_VOLUMEUP),
3491 KEY(0, 1, KEY_VOLUMEDOWN),
3492 KEY(1, 3, KEY_ROTATE_LOCK),
3493 KEY(1, 4, KEY_HOME),
3494};
3495
3496static struct matrix_keymap_data keymap_data_liquid = {
3497 .keymap_size = ARRAY_SIZE(keymap_liquid),
3498 .keymap = keymap_liquid,
3499};
3500
3501static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3502 .input_name = "keypad_8960_liquid",
3503 .input_phys_device = "keypad_8960/input0",
3504 .num_rows = 2,
3505 .num_cols = 5,
3506 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3507 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3508 .debounce_ms = 15,
3509 .scan_delay_ms = 32,
3510 .row_hold_ns = 91500,
3511 .wakeup = 1,
3512 .keymap_data = &keymap_data_liquid,
3513};
3514
3515
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003516static const unsigned int keymap[] = {
3517 KEY(0, 0, KEY_VOLUMEUP),
3518 KEY(0, 1, KEY_VOLUMEDOWN),
3519 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3520 KEY(0, 3, KEY_CAMERA_FOCUS),
3521};
3522
3523static struct matrix_keymap_data keymap_data = {
3524 .keymap_size = ARRAY_SIZE(keymap),
3525 .keymap = keymap,
3526};
3527
3528static struct pm8xxx_keypad_platform_data keypad_data = {
3529 .input_name = "keypad_8960",
3530 .input_phys_device = "keypad_8960/input0",
3531 .num_rows = 1,
3532 .num_cols = 5,
3533 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3534 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3535 .debounce_ms = 15,
3536 .scan_delay_ms = 32,
3537 .row_hold_ns = 91500,
3538 .wakeup = 1,
3539 .keymap_data = &keymap_data,
3540};
3541
3542static const unsigned int keymap_sim[] = {
3543 KEY(0, 0, KEY_7),
3544 KEY(0, 1, KEY_DOWN),
3545 KEY(0, 2, KEY_UP),
3546 KEY(0, 3, KEY_RIGHT),
3547 KEY(0, 4, KEY_ENTER),
3548 KEY(0, 5, KEY_L),
3549 KEY(0, 6, KEY_BACK),
3550 KEY(0, 7, KEY_M),
3551
3552 KEY(1, 0, KEY_LEFT),
3553 KEY(1, 1, KEY_SEND),
3554 KEY(1, 2, KEY_1),
3555 KEY(1, 3, KEY_4),
3556 KEY(1, 4, KEY_CLEAR),
3557 KEY(1, 5, KEY_MSDOS),
3558 KEY(1, 6, KEY_SPACE),
3559 KEY(1, 7, KEY_COMMA),
3560
3561 KEY(2, 0, KEY_6),
3562 KEY(2, 1, KEY_5),
3563 KEY(2, 2, KEY_8),
3564 KEY(2, 3, KEY_3),
3565 KEY(2, 4, KEY_NUMERIC_STAR),
3566 KEY(2, 5, KEY_UP),
3567 KEY(2, 6, KEY_DOWN),
3568 KEY(2, 7, KEY_LEFTSHIFT),
3569
3570 KEY(3, 0, KEY_9),
3571 KEY(3, 1, KEY_NUMERIC_POUND),
3572 KEY(3, 2, KEY_0),
3573 KEY(3, 3, KEY_2),
3574 KEY(3, 4, KEY_SLEEP),
3575 KEY(3, 5, KEY_F1),
3576 KEY(3, 6, KEY_F2),
3577 KEY(3, 7, KEY_F3),
3578
3579 KEY(4, 0, KEY_BACK),
3580 KEY(4, 1, KEY_HOME),
3581 KEY(4, 2, KEY_MENU),
3582 KEY(4, 3, KEY_VOLUMEUP),
3583 KEY(4, 4, KEY_VOLUMEDOWN),
3584 KEY(4, 5, KEY_F4),
3585 KEY(4, 6, KEY_F5),
3586 KEY(4, 7, KEY_F6),
3587
3588 KEY(5, 0, KEY_R),
3589 KEY(5, 1, KEY_T),
3590 KEY(5, 2, KEY_Y),
3591 KEY(5, 3, KEY_LEFTALT),
3592 KEY(5, 4, KEY_KPENTER),
3593 KEY(5, 5, KEY_Q),
3594 KEY(5, 6, KEY_W),
3595 KEY(5, 7, KEY_E),
3596
3597 KEY(6, 0, KEY_F),
3598 KEY(6, 1, KEY_G),
3599 KEY(6, 2, KEY_H),
3600 KEY(6, 3, KEY_CAPSLOCK),
3601 KEY(6, 4, KEY_PAGEUP),
3602 KEY(6, 5, KEY_A),
3603 KEY(6, 6, KEY_S),
3604 KEY(6, 7, KEY_D),
3605
3606 KEY(7, 0, KEY_V),
3607 KEY(7, 1, KEY_B),
3608 KEY(7, 2, KEY_N),
3609 KEY(7, 3, KEY_MENU),
3610 KEY(7, 4, KEY_PAGEDOWN),
3611 KEY(7, 5, KEY_Z),
3612 KEY(7, 6, KEY_X),
3613 KEY(7, 7, KEY_C),
3614
3615 KEY(8, 0, KEY_P),
3616 KEY(8, 1, KEY_J),
3617 KEY(8, 2, KEY_K),
3618 KEY(8, 3, KEY_INSERT),
3619 KEY(8, 4, KEY_LINEFEED),
3620 KEY(8, 5, KEY_U),
3621 KEY(8, 6, KEY_I),
3622 KEY(8, 7, KEY_O),
3623
3624 KEY(9, 0, KEY_4),
3625 KEY(9, 1, KEY_5),
3626 KEY(9, 2, KEY_6),
3627 KEY(9, 3, KEY_7),
3628 KEY(9, 4, KEY_8),
3629 KEY(9, 5, KEY_1),
3630 KEY(9, 6, KEY_2),
3631 KEY(9, 7, KEY_3),
3632
3633 KEY(10, 0, KEY_F7),
3634 KEY(10, 1, KEY_F8),
3635 KEY(10, 2, KEY_F9),
3636 KEY(10, 3, KEY_F10),
3637 KEY(10, 4, KEY_FN),
3638 KEY(10, 5, KEY_9),
3639 KEY(10, 6, KEY_0),
3640 KEY(10, 7, KEY_DOT),
3641
3642 KEY(11, 0, KEY_LEFTCTRL),
3643 KEY(11, 1, KEY_F11),
3644 KEY(11, 2, KEY_ENTER),
3645 KEY(11, 3, KEY_SEARCH),
3646 KEY(11, 4, KEY_DELETE),
3647 KEY(11, 5, KEY_RIGHT),
3648 KEY(11, 6, KEY_LEFT),
3649 KEY(11, 7, KEY_RIGHTSHIFT),
3650 KEY(0, 0, KEY_VOLUMEUP),
3651 KEY(0, 1, KEY_VOLUMEDOWN),
3652 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3653 KEY(0, 3, KEY_CAMERA_FOCUS),
3654};
3655
3656static struct matrix_keymap_data keymap_data_sim = {
3657 .keymap_size = ARRAY_SIZE(keymap_sim),
3658 .keymap = keymap_sim,
3659};
3660
3661static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3662 .input_name = "keypad_8960",
3663 .input_phys_device = "keypad_8960/input0",
3664 .num_rows = 12,
3665 .num_cols = 8,
3666 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3667 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3668 .debounce_ms = 15,
3669 .scan_delay_ms = 32,
3670 .row_hold_ns = 91500,
3671 .wakeup = 1,
3672 .keymap_data = &keymap_data_sim,
3673};
3674
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003675static int pm8921_therm_mitigation[] = {
3676 1100,
3677 700,
3678 600,
3679 325,
3680};
3681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003682static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003683 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003684 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003685 .max_voltage = 4200,
3686 .min_voltage = 3200,
3687 .resume_voltage = 4100,
3688 .term_current = 100,
3689 .cool_temp = 10,
3690 .warm_temp = 40,
3691 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003692 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003693 .cool_bat_chg_current = 350,
3694 .warm_bat_chg_current = 350,
3695 .cool_bat_voltage = 4100,
3696 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003697 .thermal_mitigation = pm8921_therm_mitigation,
3698 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003699};
3700
3701static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3702 .priority = 0,
3703};
3704
3705static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3706 .r_sense = 10,
3707 .i_test = 2500,
3708 .v_failure = 3000,
3709 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003710};
3711
Jay Chokshide4cefb2011-08-04 18:10:44 -07003712#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3713
3714/**
3715 * 'flag' stores three values; led id, led mode, and max current of led.
3716 * The bit packing format is as follow,
3717 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3718 * led_id (1 nibble)
3719 */
3720#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3721 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3722 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3723 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3724 PM8XXX_LED_MAX_CURRENT_MASK))
3725
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003726static struct led_info pm8921_led_info[] = {
3727 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003728 .name = "led:usb",
3729 .default_trigger = "usb-online",
3730 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3731 PM8XXX_LED_MODE_MANUAL,
3732 PM8921_LC_LED_MAX_CURRENT),
3733 },
3734 [1] = {
3735 .name = "led:ac",
3736 .default_trigger = "ac-online",
3737 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3738 PM8XXX_LED_MODE_MANUAL,
3739 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003740 },
3741};
3742
3743static struct led_platform_data pm8xxx_leds_pdata = {
3744 .num_leds = ARRAY_SIZE(pm8921_led_info),
3745 .leds = pm8921_led_info,
3746};
3747
3748static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3749 .irq_pdata = &pm8xxx_irq_pdata,
3750 .gpio_pdata = &pm8xxx_gpio_pdata,
3751 .mpp_pdata = &pm8xxx_mpp_pdata,
3752 .rtc_pdata = &pm8xxx_rtc_pdata,
3753 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3754 .keypad_pdata = &keypad_data,
3755 .misc_pdata = &pm8xxx_misc_pdata,
3756 .regulator_pdatas = msm_pm8921_regulator_pdata,
3757 .charger_pdata = &pm8921_chg_pdata,
3758 .bms_pdata = &pm8921_bms_pdata,
3759 .adc_pdata = &pm8921_adc_pdata,
3760 .leds_pdata = &pm8xxx_leds_pdata,
3761};
3762
3763static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3764 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3765 .slave = {
3766 .name = "pm8921-core",
3767 .platform_data = &pm8921_platform_data,
3768 },
3769};
3770
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003771#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003772static int ethernet_init(void)
3773{
3774 int ret;
3775 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3776 if (ret) {
3777 pr_err("ks8851 gpio_request failed: %d\n", ret);
3778 goto fail;
3779 }
3780
3781 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3782 if (ret) {
3783 pr_err("ks8851 gpio_request failed: %d\n", ret);
3784 goto fail_rst;
3785 }
3786
3787 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3788 if (ret) {
3789 pr_err("ks8851 gpio_request failed: %d\n", ret);
3790 goto fail_cs;
3791 }
3792
3793 gpio_direction_output(FPGA_CS_GPIO, 1);
3794 gpio_direction_output(KS8851_RST_GPIO, 1);
3795 return 0;
3796fail_cs:
3797 gpio_free(KS8851_RST_GPIO);
3798fail_rst:
3799 gpio_free(KS8851_IRQ_GPIO);
3800fail:
3801 return ret;
3802}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003803#else
3804static int ethernet_init(void)
3805{
3806 return 0;
3807}
3808#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003809
3810static struct msm_cpuidle_state msm_cstates[] __initdata = {
3811 {0, 0, "C0", "WFI",
3812 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3813
3814 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3815 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3816
3817 {0, 2, "C2", "POWER_COLLAPSE",
3818 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3819
3820 {1, 0, "C0", "WFI",
3821 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3822
3823 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3824 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3825};
3826
3827static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3828 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3829 .idle_supported = 1,
3830 .suspend_supported = 1,
3831 .idle_enabled = 0,
3832 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003833 },
3834
3835 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3836 .idle_supported = 1,
3837 .suspend_supported = 1,
3838 .idle_enabled = 0,
3839 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003840 },
3841
3842 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3843 .idle_supported = 1,
3844 .suspend_supported = 1,
3845 .idle_enabled = 1,
3846 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003847 },
3848
3849 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3850 .idle_supported = 0,
3851 .suspend_supported = 1,
3852 .idle_enabled = 0,
3853 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003854 },
3855
3856 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3857 .idle_supported = 1,
3858 .suspend_supported = 1,
3859 .idle_enabled = 0,
3860 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003861 },
3862
3863 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3864 .idle_supported = 1,
3865 .suspend_supported = 0,
3866 .idle_enabled = 1,
3867 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003868 },
3869};
3870
3871static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3872 {
3873 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3874 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3875 true,
3876 1, 8000, 100000, 1,
3877 },
3878
3879 {
3880 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3881 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3882 true,
3883 1500, 5000, 60100000, 3000,
3884 },
3885
3886 {
3887 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3888 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3889 false,
3890 1800, 5000, 60350000, 3500,
3891 },
3892
3893 {
3894 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3895 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3896 false,
3897 2800, 2500, 65350000, 4800,
3898 },
3899
3900 {
3901 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3902 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3903 false,
3904 3800, 4500, 67850000, 5500,
3905 },
3906
3907 {
3908 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3909 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3910 false,
3911 4800, 2000, 71850000, 6800,
3912 },
3913
3914 {
3915 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3916 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3917 false,
3918 6800, 500, 75850000, 8800,
3919 },
3920
3921 {
3922 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3923 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3924 false,
3925 7800, 0, 76350000, 9800,
3926 },
3927};
3928
3929#ifdef CONFIG_I2C
3930#define I2C_SURF 1
3931#define I2C_FFA (1 << 1)
3932#define I2C_RUMI (1 << 2)
3933#define I2C_SIM (1 << 3)
3934#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003935#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003936
3937struct i2c_registry {
3938 u8 machs;
3939 int bus;
3940 struct i2c_board_info *info;
3941 int len;
3942};
3943
3944#ifdef CONFIG_MSM_CAMERA
3945static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3946#ifdef CONFIG_IMX074
3947 {
3948 I2C_BOARD_INFO("imx074", 0x1A),
3949 },
3950#endif
3951#ifdef CONFIG_OV2720
3952 {
3953 I2C_BOARD_INFO("ov2720", 0x6C),
3954 },
3955#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003956 {
3957 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3958 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303959#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3960 {
3961 I2C_BOARD_INFO("sc628a", 0x6E),
3962 },
3963#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003964};
3965#endif
3966
3967/* Sensors DSPS platform data */
3968#ifdef CONFIG_MSM_DSPS
3969#define DSPS_PIL_GENERIC_NAME "dsps"
3970#endif /* CONFIG_MSM_DSPS */
3971
3972static void __init msm8960_init_dsps(void)
3973{
3974#ifdef CONFIG_MSM_DSPS
3975 struct msm_dsps_platform_data *pdata =
3976 msm_dsps_device.dev.platform_data;
3977 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3978 pdata->gpios = NULL;
3979 pdata->gpios_num = 0;
3980
3981 platform_device_register(&msm_dsps_device);
3982#endif /* CONFIG_MSM_DSPS */
3983}
3984
Amir Samuelov5137e392011-09-21 17:31:25 +03003985#ifdef CONFIG_ISL9519_CHARGER
3986static struct isl_platform_data isl_data __initdata = {
3987 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3988 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3989 .max_system_voltage = 4200,
3990 .min_system_voltage = 3200,
3991 .chgcurrent = 1000, /* 1900, */
3992 .term_current = 400, /* Need fine tuning */
3993 .input_current = 2048,
3994};
3995
3996static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3997 {
3998 I2C_BOARD_INFO("isl9519q", 0x9),
3999 .irq = 0, /* Not required when notify-by-pmic */
4000 .platform_data = &isl_data,
4001 },
4002};
4003#endif /* CONFIG_ISL9519_CHARGER */
4004
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004005static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4006#ifdef CONFIG_MSM_CAMERA
4007 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004008 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004009 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4010 msm_camera_boardinfo,
4011 ARRAY_SIZE(msm_camera_boardinfo),
4012 },
4013#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004014#ifdef CONFIG_ISL9519_CHARGER
4015 {
4016 I2C_LIQUID,
4017 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4018 isl_charger_i2c_info,
4019 ARRAY_SIZE(isl_charger_i2c_info),
4020 },
4021#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004022 {
4023 I2C_SURF | I2C_FFA | I2C_FLUID,
4024 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4025 cyttsp_info,
4026 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004027 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304028 {
4029 I2C_LIQUID,
4030 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4031 mxt_device_info,
4032 ARRAY_SIZE(mxt_device_info),
4033 },
4034
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004035};
4036#endif /* CONFIG_I2C */
4037
4038static void __init register_i2c_devices(void)
4039{
4040#ifdef CONFIG_I2C
4041 u8 mach_mask = 0;
4042 int i;
4043
4044 /* Build the matching 'supported_machs' bitmask */
4045 if (machine_is_msm8960_cdp())
4046 mach_mask = I2C_SURF;
4047 else if (machine_is_msm8960_rumi3())
4048 mach_mask = I2C_RUMI;
4049 else if (machine_is_msm8960_sim())
4050 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004051 else if (machine_is_msm8960_fluid())
4052 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004053 else if (machine_is_msm8960_liquid())
4054 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004055 else if (machine_is_msm8960_mtp())
4056 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004057 else
4058 pr_err("unmatched machine ID in register_i2c_devices\n");
4059
4060 /* Run the array and install devices as appropriate */
4061 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4062 if (msm8960_i2c_devices[i].machs & mach_mask)
4063 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4064 msm8960_i2c_devices[i].info,
4065 msm8960_i2c_devices[i].len);
4066 }
4067#endif
4068}
4069
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004070static void __init msm8960_sim_init(void)
4071{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004072 BUG_ON(msm_rpm_init(&msm_rpm_data));
4073 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4074 ARRAY_SIZE(msm_rpmrs_levels)));
4075 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004076 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004077 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004078 msm8960_device_ssbi_pm8921.dev.platform_data =
4079 &msm8960_ssbi_pm8921_pdata;
4080 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004081
4082 /* Simulator supports a QWERTY keypad */
4083 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4084
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004085 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4086 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4087 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004088 gpiomux_init();
4089 ethernet_init();
4090 msm8960_i2c_init();
4091 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4092 msm_spm_l2_init(msm_spm_l2_data);
4093 msm8960_init_buses();
4094 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4095 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004096 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004097 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004098
4099 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4100 &msm8960_qup_spi_gsbi1_pdata;
4101 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4102
4103 msm8960_init_mmc();
4104 msm_fb_add_devices();
4105 slim_register_board_info(msm_slim_devices,
4106 ARRAY_SIZE(msm_slim_devices));
4107 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4108 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4109 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4110 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004111}
4112
4113static void __init msm8960_rumi3_init(void)
4114{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004115 BUG_ON(msm_rpm_init(&msm_rpm_data));
4116 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4117 ARRAY_SIZE(msm_rpmrs_levels)));
4118 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004119 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004120 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004121 gpiomux_init();
4122 ethernet_init();
4123 msm8960_device_ssbi_pm8921.dev.platform_data =
4124 &msm8960_ssbi_pm8921_pdata;
4125 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4126 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4127 &msm8960_qup_spi_gsbi1_pdata;
4128 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4129 msm8960_i2c_init();
4130 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4131 msm_spm_l2_init(msm_spm_l2_data);
4132 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4133 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004134 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004135 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004136 register_i2c_devices();
4137 msm_fb_add_devices();
4138 slim_register_board_info(msm_slim_devices,
4139 ARRAY_SIZE(msm_slim_devices));
4140 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4141 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4142 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4143 msm_pm_data);
4144}
4145
4146static void __init msm8960_cdp_init(void)
4147{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004148 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4149 pr_err("meminfo_init() failed!\n");
4150
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004151 BUG_ON(msm_rpm_init(&msm_rpm_data));
4152 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4153 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004154
4155 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004156 regulator_suppress_info_printing();
4157 if (msm_xo_init())
4158 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004159 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004160 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004161 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4162 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4163 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004164 gpiomux_init();
4165 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304166 if (machine_is_msm8960_liquid())
4167 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004168 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4169 &msm8960_qup_spi_gsbi1_pdata;
4170 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4171 msm8960_device_ssbi_pm8921.dev.platform_data =
4172 &msm8960_ssbi_pm8921_pdata;
4173 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4174 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004175 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004176 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4177 msm_spm_l2_init(msm_spm_l2_data);
4178 msm8960_init_buses();
4179 platform_add_devices(msm_footswitch_devices,
4180 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004181 if (machine_is_msm8960_liquid())
4182 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004183 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4184 pm8921_gpio_mpp_init();
4185 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4186 msm8960_init_cam();
4187 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004188 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304189 if (machine_is_msm8960_liquid())
4190 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004191 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004192 msm_fb_add_devices();
4193 slim_register_board_info(msm_slim_devices,
4194 ARRAY_SIZE(msm_slim_devices));
4195 msm8960_init_dsps();
4196 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4197 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4198 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4199 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004200 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004201}
4202
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004203MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4204 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004205 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004206 .init_irq = msm8960_init_irq,
4207 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004208 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004209 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004210MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004211
4212MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4213 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004214 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004215 .init_irq = msm8960_init_irq,
4216 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004217 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004218 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004219MACHINE_END
4220
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004221MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4222 .map_io = msm8960_map_io,
4223 .reserve = msm8960_reserve,
4224 .init_irq = msm8960_init_irq,
4225 .timer = &msm_timer,
4226 .init_machine = msm8960_cdp_init,
4227 .init_early = msm8960_allocate_memory_regions,
4228MACHINE_END
4229
4230MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4231 .map_io = msm8960_map_io,
4232 .reserve = msm8960_reserve,
4233 .init_irq = msm8960_init_irq,
4234 .timer = &msm_timer,
4235 .init_machine = msm8960_cdp_init,
4236 .init_early = msm8960_allocate_memory_regions,
4237MACHINE_END
4238
4239MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
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
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004247
4248MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
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