blob: 22767cec49b2fb189815a63242b52e8d66adbf1c [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070046#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049
50#include <mach/board.h>
51#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <mach/msm_spi.h>
53#ifdef CONFIG_USB_MSM_OTG_72K
54#include <mach/msm_hsusb.h>
55#else
56#include <linux/usb/msm_hsusb.h>
57#endif
58#include <linux/usb/android.h>
59#include <mach/usbdiag.h>
60#include <mach/socinfo.h>
61#include <mach/rpm.h>
62#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070063#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#include <mach/msm_bus_board.h>
65#include <mach/msm_memtypes.h>
66#include <mach/dma.h>
67#include <mach/msm_dsps.h>
68#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070069#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080070
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
Laura Abbottd6183792011-08-19 13:42:24 -070077#include <linux/ion.h>
78#include <mach/ion.h>
79
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080081#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#include "spm.h"
84#include "board-msm8960.h"
85#include "pm.h"
86#include "cpuidle.h"
87#include "rpm_resources.h"
88#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070089#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070090#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070091#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060092#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070093#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094
95static struct platform_device msm_fm_platform_init = {
96 .name = "iris_fm",
97 .id = -1,
98};
99
100struct pm8xxx_gpio_init {
101 unsigned gpio;
102 struct pm_gpio config;
103};
104
105struct pm8xxx_mpp_init {
106 unsigned mpp;
107 struct pm8xxx_mpp_config_data config;
108};
109
110#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
111 _func, _inv, _disable) \
112{ \
113 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
114 .config = { \
115 .direction = _dir, \
116 .output_buffer = _buf, \
117 .output_value = _val, \
118 .pull = _pull, \
119 .vin_sel = _vin, \
120 .out_strength = _out_strength, \
121 .function = _func, \
122 .inv_int_pol = _inv, \
123 .disable_pin = _disable, \
124 } \
125}
126
127#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
128{ \
129 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
130 .config = { \
131 .type = PM8XXX_MPP_TYPE_##_type, \
132 .level = _level, \
133 .control = PM8XXX_MPP_##_control, \
134 } \
135}
136
137#define PM8XXX_GPIO_DISABLE(_gpio) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
139 0, 0, 0, 1)
140
141#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
142 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
143 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
144 PM_GPIO_STRENGTH_HIGH, \
145 PM_GPIO_FUNC_NORMAL, 0, 0)
146
147#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
148 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
149 _pull, PM_GPIO_VIN_S4, \
150 PM_GPIO_STRENGTH_NO, \
151 PM_GPIO_FUNC_NORMAL, 0, 0)
152
153#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
154 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
155 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
156 PM_GPIO_STRENGTH_HIGH, \
157 _func, 0, 0)
158
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200159#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
160 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
161 PM_GPIO_PULL_NO, _vin, \
162 PM_GPIO_STRENGTH_HIGH, \
163 PM_GPIO_FUNC_NORMAL, 0, 0)
164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165/* Initial PM8921 GPIO configurations */
166static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
167 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
168 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
169 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300170 /* External regulator shared by display and touchscreen on LiQUID */
171 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200172 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700174 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700176 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530177 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178};
179
180/* Initial PM8921 MPP configurations */
181static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
182 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
183 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
185 DOUT_CTRL_LOW),
186};
187
188static void __init pm8921_gpio_mpp_init(void)
189{
190 int i, rc;
191
192 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
193 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
194 &pm8921_gpios[i].config);
195 if (rc) {
196 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
197 break;
198 }
199 }
200
201 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
202 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
203 &pm8921_mpps[i].config);
204 if (rc) {
205 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
206 break;
207 }
208 }
209}
210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211#define KS8851_RST_GPIO 89
212#define KS8851_IRQ_GPIO 90
213
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700214#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
215enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700216 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700217 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
218 /* CAM Expander */
219 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
220 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
221 GPIO_CAM_GP_AFBUSY,
222 GPIO_CAM_GP_STROBE_CE,
223 GPIO_CAM_GP_CAM1MP_XCLR,
224 GPIO_CAM_GP_CAMIF_RESET_N,
225 GPIO_CAM_GP_XMT_FLASH_INT,
226 GPIO_CAM_GP_LED_EN1,
227 GPIO_CAM_GP_LED_EN2,
228
229};
230#endif
231
Harini Jayaraman608d0462011-08-09 19:10:03 -0600232/* The SPI configurations apply to GSBI 1*/
233static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700235 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 .pull = GPIOMUX_PULL_NONE,
237};
238
Harini Jayaraman608d0462011-08-09 19:10:03 -0600239static struct gpiomux_setting spi_suspended_config = {
240 .func = GPIOMUX_FUNC_GPIO,
241 .drv = GPIOMUX_DRV_2MA,
242 .pull = GPIOMUX_PULL_DOWN,
243};
244
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700245static struct gpiomux_setting spi_active_config2 = {
246 .func = GPIOMUX_FUNC_2,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_NONE,
249};
250
251static struct gpiomux_setting spi_suspended_config2 = {
252 .func = GPIOMUX_FUNC_GPIO,
253 .drv = GPIOMUX_DRV_2MA,
254 .pull = GPIOMUX_PULL_UP,
255};
256
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530257static struct gpiomux_setting gsbi3_suspended_cfg = {
258 .func = GPIOMUX_FUNC_1,
259 .drv = GPIOMUX_DRV_2MA,
260 .pull = GPIOMUX_PULL_KEEPER,
261};
262
263static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264 .func = GPIOMUX_FUNC_1,
265 .drv = GPIOMUX_DRV_8MA,
266 .pull = GPIOMUX_PULL_NONE,
267};
268
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700269static struct gpiomux_setting gsbi5 = {
270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_8MA,
272 .pull = GPIOMUX_PULL_NONE,
273};
274
275static struct gpiomux_setting gsbi10 = {
276 .func = GPIOMUX_FUNC_2,
277 .drv = GPIOMUX_DRV_8MA,
278 .pull = GPIOMUX_PULL_NONE,
279};
280
281static struct gpiomux_setting gsbi12 = {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_8MA,
284 .pull = GPIOMUX_PULL_NONE,
285};
286
287static struct gpiomux_setting cdc_mclk = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_8MA,
290 .pull = GPIOMUX_PULL_NONE,
291};
292
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700293static struct gpiomux_setting audio_auxpcm[] = {
294 /* Suspended state */
295 {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_NONE,
299 },
300 /* Active state */
301 {
302 .func = GPIOMUX_FUNC_1,
303 .drv = GPIOMUX_DRV_2MA,
304 .pull = GPIOMUX_PULL_NONE,
305 },
306};
307
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700308#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309static struct gpiomux_setting gpio_eth_config = {
310 .pull = GPIOMUX_PULL_NONE,
311 .drv = GPIOMUX_DRV_8MA,
312 .func = GPIOMUX_FUNC_GPIO,
313};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700314#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315
316static struct gpiomux_setting slimbus = {
317 .func = GPIOMUX_FUNC_1,
318 .drv = GPIOMUX_DRV_8MA,
319 .pull = GPIOMUX_PULL_KEEPER,
320};
321
322struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700323#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 {
325 .gpio = KS8851_IRQ_GPIO,
326 .settings = {
327 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
328 }
329 },
330 {
331 .gpio = KS8851_RST_GPIO,
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
334 }
335 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700336#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337};
338
339static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
340 {
341 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
349 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600350 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
351 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352 },
353 },
354 {
355 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
356 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600357 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
358 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 },
360 },
361 {
362 .gpio = 9, /* GSBI1 QUP SPI_CLK */
363 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600364 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
365 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 },
367 },
368 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700369 .gpio = 14, /* GSBI1 SPI_CS_1 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
372 [GPIOMUX_ACTIVE] = &spi_active_config2,
373 },
374 },
375 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700376 .gpio = 16, /* GSBI3 I2C QUP SDA */
377 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530378 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
379 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 },
381 },
382 {
383 .gpio = 17, /* GSBI3 I2C QUP SCL */
384 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530385 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
386 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387 },
388 },
389 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700390 .gpio = 22, /* GSBI5 UART2 */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi5,
393 },
394 },
395 {
396 .gpio = 23, /* GSBI5 UART2 */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi5,
399 },
400 },
401 {
402 .gpio = 24, /* GSBI5 UART2 */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi5,
405 },
406 },
407 {
408 .gpio = 25, /* GSBI5 UART2 */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi5,
411 },
412 },
413 {
414 .gpio = 44, /* GSBI12 I2C QUP SDA */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi12,
417 },
418 },
419 {
420 .gpio = 45, /* GSBI12 I2C QUP SCL */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi12,
423 },
424 },
425 {
426 .gpio = 73, /* GSBI10 I2C QUP SDA */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &gsbi10,
429 },
430 },
431 {
432 .gpio = 74, /* GSBI10 I2C QUP SCL */
433 .settings = {
434 [GPIOMUX_SUSPENDED] = &gsbi10,
435 },
436 },
437};
438
439static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
440 {
441 .gpio = 60, /* slimbus data */
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &slimbus,
444 },
445 },
446 {
447 .gpio = 61, /* slimbus clk */
448 .settings = {
449 [GPIOMUX_SUSPENDED] = &slimbus,
450 },
451 },
452};
453
454static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
455 {
456 .gpio = 59,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &cdc_mclk,
459 },
460 },
461};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700462
463static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
464 {
465 .gpio = 63,
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
468 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
469 },
470 },
471 {
472 .gpio = 64,
473 .settings = {
474 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
475 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
476 },
477 },
478 {
479 .gpio = 65,
480 .settings = {
481 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
482 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
483 },
484 },
485 {
486 .gpio = 66,
487 .settings = {
488 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
489 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
490 },
491 },
492};
493
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700494static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
495 .func = GPIOMUX_FUNC_GPIO,
496 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700497 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498};
499
500static struct gpiomux_setting wcnss_5wire_active_cfg = {
501 .func = GPIOMUX_FUNC_1,
502 .drv = GPIOMUX_DRV_6MA,
503 .pull = GPIOMUX_PULL_DOWN,
504};
505
506static struct msm_gpiomux_config wcnss_5wire_interface[] = {
507 {
508 .gpio = 84,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
511 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
512 },
513 },
514 {
515 .gpio = 85,
516 .settings = {
517 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
518 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
519 },
520 },
521 {
522 .gpio = 86,
523 .settings = {
524 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
525 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
526 },
527 },
528 {
529 .gpio = 87,
530 .settings = {
531 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
532 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
533 },
534 },
535 {
536 .gpio = 88,
537 .settings = {
538 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
539 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
540 },
541 },
542};
Nishant Pandit24153d82011-08-27 16:05:13 +0530543static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530544 {
545 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
546 .drv = GPIOMUX_DRV_2MA,
547 .pull = GPIOMUX_PULL_DOWN,
548 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549
Nishant Pandit474f2252011-07-23 23:17:56 +0530550 {
551 .func = GPIOMUX_FUNC_1, /*active 1*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_NONE,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
558 .drv = GPIOMUX_DRV_2MA,
559 .pull = GPIOMUX_PULL_NONE,
560 },
561
562 {
563 .func = GPIOMUX_FUNC_1, /*active 3*/
564 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700565 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530566 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530567
568 {
569 .func = GPIOMUX_FUNC_5, /*active 4*/
570 .drv = GPIOMUX_DRV_8MA,
571 .pull = GPIOMUX_PULL_UP,
572 },
573
574 {
575 .func = GPIOMUX_FUNC_6, /*active 5*/
576 .drv = GPIOMUX_DRV_8MA,
577 .pull = GPIOMUX_PULL_UP,
578 },
579
580 {
581 .func = GPIOMUX_FUNC_2, /*active 6*/
582 .drv = GPIOMUX_DRV_2MA,
583 .pull = GPIOMUX_PULL_UP,
584 },
585
586 {
587 .func = GPIOMUX_FUNC_3, /*active 7*/
588 .drv = GPIOMUX_DRV_8MA,
589 .pull = GPIOMUX_PULL_UP,
590 },
591
Kevin Chan4c58d292011-09-13 11:03:25 -0700592 {
593 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
594 .drv = GPIOMUX_DRV_2MA,
595 .pull = GPIOMUX_PULL_KEEPER,
596 },
597
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598};
599
Nishant Pandit24153d82011-08-27 16:05:13 +0530600static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700601 {
602 .gpio = 2,
603 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530604 [GPIOMUX_ACTIVE] = &cam_settings[2],
605 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 },
608 {
609 .gpio = 3,
610 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530611 [GPIOMUX_ACTIVE] = &cam_settings[1],
612 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613 },
614 },
615 {
616 .gpio = 4,
617 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530618 [GPIOMUX_ACTIVE] = &cam_settings[1],
619 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 },
621 },
622 {
623 .gpio = 5,
624 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530625 [GPIOMUX_ACTIVE] = &cam_settings[1],
626 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627 },
628 },
629 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530630 .gpio = 76,
631 .settings = {
632 [GPIOMUX_ACTIVE] = &cam_settings[2],
633 [GPIOMUX_SUSPENDED] = &cam_settings[0],
634 },
635 },
636 {
637 .gpio = 107,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &cam_settings[2],
640 [GPIOMUX_SUSPENDED] = &cam_settings[0],
641 },
642 },
643};
644
645static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
646 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700647 .gpio = 18,
648 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530649 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700650 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651 },
652 },
653 {
654 .gpio = 19,
655 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530656 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700657 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658 },
659 },
660 {
661 .gpio = 20,
662 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530663 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700664 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700665 },
666 },
667 {
668 .gpio = 21,
669 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530670 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700671 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672 },
673 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700674};
675
676static struct gpiomux_setting cyts_resout_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_6MA,
679 .pull = GPIOMUX_PULL_UP,
680};
681
682static struct gpiomux_setting cyts_resout_act_cfg = {
683 .func = GPIOMUX_FUNC_GPIO,
684 .drv = GPIOMUX_DRV_6MA,
685 .pull = GPIOMUX_PULL_UP,
686};
687
688static struct gpiomux_setting cyts_sleep_sus_cfg = {
689 .func = GPIOMUX_FUNC_GPIO,
690 .drv = GPIOMUX_DRV_6MA,
691 .pull = GPIOMUX_PULL_DOWN,
692};
693
694static struct gpiomux_setting cyts_sleep_act_cfg = {
695 .func = GPIOMUX_FUNC_GPIO,
696 .drv = GPIOMUX_DRV_6MA,
697 .pull = GPIOMUX_PULL_DOWN,
698};
699
700static struct gpiomux_setting cyts_int_act_cfg = {
701 .func = GPIOMUX_FUNC_GPIO,
702 .drv = GPIOMUX_DRV_8MA,
703 .pull = GPIOMUX_PULL_UP,
704};
705
706static struct gpiomux_setting cyts_int_sus_cfg = {
707 .func = GPIOMUX_FUNC_GPIO,
708 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530709 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700710};
711
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
713 { /* TS INTERRUPT */
714 .gpio = 11,
715 .settings = {
716 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
717 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
718 },
719 },
720 { /* TS SLEEP */
721 .gpio = 50,
722 .settings = {
723 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
724 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
725 },
726 },
727 { /* TS RESOUT */
728 .gpio = 52,
729 .settings = {
730 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
731 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
732 },
733 },
734};
735
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530736#ifdef CONFIG_USB_EHCI_MSM_HSIC
737static struct gpiomux_setting hsic_act_cfg = {
738 .func = GPIOMUX_FUNC_1,
739 .drv = GPIOMUX_DRV_12MA,
740 .pull = GPIOMUX_PULL_NONE,
741};
742
743static struct gpiomux_setting hsic_sus_cfg = {
744 .func = GPIOMUX_FUNC_GPIO,
745 .drv = GPIOMUX_DRV_2MA,
746 .pull = GPIOMUX_PULL_DOWN,
747};
748
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530749static struct gpiomux_setting hsic_hub_act_cfg = {
750 .func = GPIOMUX_FUNC_GPIO,
751 .drv = GPIOMUX_DRV_2MA,
752 .pull = GPIOMUX_PULL_NONE,
753};
754
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530755static struct msm_gpiomux_config msm8960_hsic_configs[] = {
756 {
757 .gpio = 150, /*HSIC_STROBE */
758 .settings = {
759 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
760 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
761 },
762 },
763 {
764 .gpio = 151, /* HSIC_DATA */
765 .settings = {
766 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
767 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
768 },
769 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530770 {
771 .gpio = 91, /* HSIC_HUB_RESET */
772 .settings = {
773 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
774 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
775 },
776 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530777};
778#endif
779
Mohan Pallaka5e490392011-09-09 15:18:41 +0530780#define HAP_SHIFT_LVL_OE_GPIO 47
781
782static struct gpiomux_setting hap_lvl_shft_suspended_config = {
783 .func = GPIOMUX_FUNC_GPIO,
784 .drv = GPIOMUX_DRV_2MA,
785 .pull = GPIOMUX_PULL_DOWN,
786};
787
788static struct gpiomux_setting hap_lvl_shft_active_config = {
789 .func = GPIOMUX_FUNC_GPIO,
790 .drv = GPIOMUX_DRV_8MA,
791 .pull = GPIOMUX_PULL_UP,
792};
793
794static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
795 {
796 .gpio = HAP_SHIFT_LVL_OE_GPIO,
797 .settings = {
798 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
799 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
800 },
801 },
802};
803
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700804#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
805enum {
806 SX150X_CAM,
807};
808
Nishant Pandit474f2252011-07-23 23:17:56 +0530809static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700810 [SX150X_CAM] = {
811 .gpio_base = GPIO_CAM_EXPANDER_BASE,
812 .oscio_is_gpo = false,
813 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530814 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700815 .io_open_drain_ena = 0x0,
816 .irq_summary = -1,
817 },
818};
Nishant Pandit474f2252011-07-23 23:17:56 +0530819
820#endif
821
822#ifdef CONFIG_I2C
823
824#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
825#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300826#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530827
828#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
829
830static struct i2c_board_info cam_expander_i2c_info[] = {
831 {
832 I2C_BOARD_INFO("sx1508q", 0x22),
833 .platform_data = &sx150x_data[SX150X_CAM]
834 },
835};
836
837static struct msm_cam_expander_info cam_expander_info[] = {
838 {
839 cam_expander_i2c_info,
840 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
841 },
842};
843#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700844#endif
845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700847#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700848#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
849#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
850#else
Chetan Kalyana25d0762011-11-11 17:41:29 -0800851#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700852#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700853
854
855#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700856#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
857#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700858#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
859#define MSM_ION_HEAP_NUM 4
860#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700861#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700862#define MSM_ION_HEAP_NUM 2
863#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700864
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
866static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
867static int __init pmem_kernel_ebi1_size_setup(char *p)
868{
869 pmem_kernel_ebi1_size = memparse(p, NULL);
870 return 0;
871}
872early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
873#endif
874
875#ifdef CONFIG_ANDROID_PMEM
876static unsigned pmem_size = MSM_PMEM_SIZE;
877static int __init pmem_size_setup(char *p)
878{
879 pmem_size = memparse(p, NULL);
880 return 0;
881}
882early_param("pmem_size", pmem_size_setup);
883
884static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
885
886static int __init pmem_adsp_size_setup(char *p)
887{
888 pmem_adsp_size = memparse(p, NULL);
889 return 0;
890}
891early_param("pmem_adsp_size", pmem_adsp_size_setup);
892
893static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
894
895static int __init pmem_audio_size_setup(char *p)
896{
897 pmem_audio_size = memparse(p, NULL);
898 return 0;
899}
900early_param("pmem_audio_size", pmem_audio_size_setup);
901#endif
902
903#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700904#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905static struct android_pmem_platform_data android_pmem_pdata = {
906 .name = "pmem",
907 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
908 .cached = 1,
909 .memory_type = MEMTYPE_EBI1,
910};
911
912static struct platform_device android_pmem_device = {
913 .name = "android_pmem",
914 .id = 0,
915 .dev = {.platform_data = &android_pmem_pdata},
916};
917
918static struct android_pmem_platform_data android_pmem_adsp_pdata = {
919 .name = "pmem_adsp",
920 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
921 .cached = 0,
922 .memory_type = MEMTYPE_EBI1,
923};
924static struct platform_device android_pmem_adsp_device = {
925 .name = "android_pmem",
926 .id = 2,
927 .dev = { .platform_data = &android_pmem_adsp_pdata },
928};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700929#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930
931static struct android_pmem_platform_data android_pmem_audio_pdata = {
932 .name = "pmem_audio",
933 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
934 .cached = 0,
935 .memory_type = MEMTYPE_EBI1,
936};
937
938static struct platform_device android_pmem_audio_device = {
939 .name = "android_pmem",
940 .id = 4,
941 .dev = { .platform_data = &android_pmem_audio_pdata },
942};
943#endif
944
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700945#define DSP_RAM_BASE_8960 0x8da00000
946#define DSP_RAM_SIZE_8960 0x1800000
947static int dspcrashd_pdata_8960 = 0xDEADDEAD;
948
949static struct resource resources_dspcrashd_8960[] = {
950 {
951 .name = "msm_dspcrashd",
952 .start = DSP_RAM_BASE_8960,
953 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
954 .flags = IORESOURCE_DMA,
955 },
956};
957
958struct platform_device msm_device_dspcrashd_8960 = {
959 .name = "msm_dspcrashd",
960 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
961 .resource = resources_dspcrashd_8960,
962 .dev = { .platform_data = &dspcrashd_pdata_8960 },
963};
964
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965static struct memtype_reserve msm8960_reserve_table[] __initdata = {
966 [MEMTYPE_SMI] = {
967 },
968 [MEMTYPE_EBI0] = {
969 .flags = MEMTYPE_FLAGS_1M_ALIGN,
970 },
971 [MEMTYPE_EBI1] = {
972 .flags = MEMTYPE_FLAGS_1M_ALIGN,
973 },
974};
975
976static void __init size_pmem_devices(void)
977{
978#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700979#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980 android_pmem_adsp_pdata.size = pmem_adsp_size;
981 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700982#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
984#endif
985}
986
987static void __init reserve_memory_for(struct android_pmem_platform_data *p)
988{
989 msm8960_reserve_table[p->memory_type].size += p->size;
990}
991
992static void __init reserve_pmem_memory(void)
993{
994#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700995#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700996 reserve_memory_for(&android_pmem_adsp_pdata);
997 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700998#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 reserve_memory_for(&android_pmem_audio_pdata);
1000 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1001#endif
1002}
1003
Larry Basselb4126da2011-07-18 14:31:33 -07001004static int msm8960_paddr_to_memtype(unsigned int paddr)
1005{
1006 return MEMTYPE_EBI1;
1007}
1008
Laura Abbottd6183792011-08-19 13:42:24 -07001009#ifdef CONFIG_ION_MSM
1010struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001011 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001012 .heaps = {
1013 {
1014 .id = ION_HEAP_SYSTEM_ID,
1015 .type = ION_HEAP_TYPE_SYSTEM,
1016 .name = ION_KMALLOC_HEAP_NAME,
1017 },
1018 {
1019 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1020 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1021 .name = ION_VMALLOC_HEAP_NAME,
1022 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001023#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001024 {
1025 .id = ION_HEAP_EBI_ID,
1026 .type = ION_HEAP_TYPE_CARVEOUT,
1027 .name = ION_EBI1_HEAP_NAME,
1028 .size = MSM_ION_EBI_SIZE,
1029 .memory_type = ION_EBI_TYPE,
1030 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001031 {
1032 .id = ION_HEAP_ADSP_ID,
1033 .type = ION_HEAP_TYPE_CARVEOUT,
1034 .name = ION_ADSP_HEAP_NAME,
1035 .size = MSM_ION_ADSP_SIZE,
1036 .memory_type = ION_EBI_TYPE,
1037 },
1038#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001039 }
1040};
1041
1042struct platform_device ion_dev = {
1043 .name = "ion-msm",
1044 .id = 1,
1045 .dev = { .platform_data = &ion_pdata },
1046};
1047#endif
1048
1049static void reserve_ion_memory(void)
1050{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001051#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001052 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001053 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001054#endif
1055}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001056static void __init msm8960_calculate_reserve_sizes(void)
1057{
1058 size_pmem_devices();
1059 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001060 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001061}
1062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063static struct reserve_info msm8960_reserve_info __initdata = {
1064 .memtype_reserve_table = msm8960_reserve_table,
1065 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1066 .paddr_to_memtype = msm8960_paddr_to_memtype,
1067};
1068
Larry Basselb4126da2011-07-18 14:31:33 -07001069static int msm8960_memory_bank_size(void)
1070{
1071 return 1<<29;
1072}
1073
1074static void __init locate_unstable_memory(void)
1075{
1076 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1077 unsigned long bank_size;
1078 unsigned long low, high;
1079
1080 bank_size = msm8960_memory_bank_size();
1081 low = meminfo.bank[0].start;
1082 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -07001083
1084 /* Check if 32 bit overflow occured */
1085 if (high < mb->start)
1086 high = ~0UL;
1087
Larry Basselb4126da2011-07-18 14:31:33 -07001088 low &= ~(bank_size - 1);
1089
1090 if (high - low <= bank_size)
1091 return;
1092 msm8960_reserve_info.low_unstable_address = low + bank_size;
Olav Haugan62052e42011-10-28 14:28:32 -07001093 /* To avoid overflow of u32 compute max_unstable_size
1094 * by first subtracting low from mb->start)
1095 * */
1096 msm8960_reserve_info.max_unstable_size = (mb->start - low) +
1097 mb->size - bank_size;
1098
Larry Basselb4126da2011-07-18 14:31:33 -07001099 msm8960_reserve_info.bank_size = bank_size;
1100 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1101 msm8960_reserve_info.low_unstable_address,
1102 msm8960_reserve_info.max_unstable_size,
1103 msm8960_reserve_info.bank_size);
1104}
1105
Larry Basselb830e182011-10-14 10:46:55 -07001106static void __init place_movable_zone(void)
1107{
1108 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1109 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1110 pr_info("movable zone start %lx size %lx\n",
1111 movable_reserved_start, movable_reserved_size);
1112}
1113
1114static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001115{
1116 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001117 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001118 place_movable_zone();
1119}
1120
1121static void __init msm8960_reserve(void)
1122{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001123 msm_reserve();
1124}
1125
Larry Bassela4414b12011-08-04 11:11:02 -07001126static int msm8960_change_memory_power(u64 start, u64 size,
1127 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001128{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001129 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001130}
1131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001132#ifdef CONFIG_MSM_CAMERA
1133
Nishant Pandit24153d82011-08-27 16:05:13 +05301134static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001135 5, /*CAMIF_MCLK*/
1136 20, /*CAMIF_I2C_DATA*/
1137 21, /*CAMIF_I2C_CLK*/
1138};
1139
Nishant Pandit24153d82011-08-27 16:05:13 +05301140static struct msm_camera_gpio_conf gpio_conf = {
1141 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1142 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1143 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1144 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1145};
1146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001147#define VFE_CAMIF_TIMER1_GPIO 2
1148#define VFE_CAMIF_TIMER2_GPIO 3
1149#define VFE_CAMIF_TIMER3_GPIO_INT 4
1150struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1151 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1152 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1153 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1154 .flash_recharge_duration = 50000,
1155 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1156};
1157
Nishant Pandit474f2252011-07-23 23:17:56 +05301158#ifdef CONFIG_MSM_CAMERA_FLASH
1159static struct msm_camera_sensor_flash_src msm_flash_src = {
1160 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1161 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1162 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1163#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1164 defined(CONFIG_GPIO_SX150X_MODULE))
1165 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1166#endif
1167};
1168#endif
1169
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001170static struct msm_bus_vectors cam_init_vectors[] = {
1171 {
1172 .src = MSM_BUS_MASTER_VFE,
1173 .dst = MSM_BUS_SLAVE_EBI_CH0,
1174 .ab = 0,
1175 .ib = 0,
1176 },
1177 {
1178 .src = MSM_BUS_MASTER_VPE,
1179 .dst = MSM_BUS_SLAVE_EBI_CH0,
1180 .ab = 0,
1181 .ib = 0,
1182 },
1183 {
1184 .src = MSM_BUS_MASTER_JPEG_ENC,
1185 .dst = MSM_BUS_SLAVE_EBI_CH0,
1186 .ab = 0,
1187 .ib = 0,
1188 },
1189};
1190
1191static struct msm_bus_vectors cam_preview_vectors[] = {
1192 {
1193 .src = MSM_BUS_MASTER_VFE,
1194 .dst = MSM_BUS_SLAVE_EBI_CH0,
1195 .ab = 27648000,
1196 .ib = 110592000,
1197 },
1198 {
1199 .src = MSM_BUS_MASTER_VPE,
1200 .dst = MSM_BUS_SLAVE_EBI_CH0,
1201 .ab = 0,
1202 .ib = 0,
1203 },
1204 {
1205 .src = MSM_BUS_MASTER_JPEG_ENC,
1206 .dst = MSM_BUS_SLAVE_EBI_CH0,
1207 .ab = 0,
1208 .ib = 0,
1209 },
1210};
1211
1212static struct msm_bus_vectors cam_video_vectors[] = {
1213 {
1214 .src = MSM_BUS_MASTER_VFE,
1215 .dst = MSM_BUS_SLAVE_EBI_CH0,
1216 .ab = 140451840,
1217 .ib = 561807360,
1218 },
1219 {
1220 .src = MSM_BUS_MASTER_VPE,
1221 .dst = MSM_BUS_SLAVE_EBI_CH0,
1222 .ab = 206807040,
1223 .ib = 488816640,
1224 },
1225 {
1226 .src = MSM_BUS_MASTER_JPEG_ENC,
1227 .dst = MSM_BUS_SLAVE_EBI_CH0,
1228 .ab = 0,
1229 .ib = 0,
1230 },
1231};
1232
1233static struct msm_bus_vectors cam_snapshot_vectors[] = {
1234 {
1235 .src = MSM_BUS_MASTER_VFE,
1236 .dst = MSM_BUS_SLAVE_EBI_CH0,
1237 .ab = 274423680,
1238 .ib = 1097694720,
1239 },
1240 {
1241 .src = MSM_BUS_MASTER_VPE,
1242 .dst = MSM_BUS_SLAVE_EBI_CH0,
1243 .ab = 0,
1244 .ib = 0,
1245 },
1246 {
1247 .src = MSM_BUS_MASTER_JPEG_ENC,
1248 .dst = MSM_BUS_SLAVE_EBI_CH0,
1249 .ab = 540000000,
1250 .ib = 1350000000,
1251 },
1252};
1253
1254static struct msm_bus_vectors cam_zsl_vectors[] = {
1255 {
1256 .src = MSM_BUS_MASTER_VFE,
1257 .dst = MSM_BUS_SLAVE_EBI_CH0,
1258 .ab = 302071680,
1259 .ib = 1208286720,
1260 },
1261 {
1262 .src = MSM_BUS_MASTER_VPE,
1263 .dst = MSM_BUS_SLAVE_EBI_CH0,
1264 .ab = 0,
1265 .ib = 0,
1266 },
1267 {
1268 .src = MSM_BUS_MASTER_JPEG_ENC,
1269 .dst = MSM_BUS_SLAVE_EBI_CH0,
1270 .ab = 540000000,
1271 .ib = 1350000000,
1272 },
1273};
1274
1275static struct msm_bus_paths cam_bus_client_config[] = {
1276 {
1277 ARRAY_SIZE(cam_init_vectors),
1278 cam_init_vectors,
1279 },
1280 {
1281 ARRAY_SIZE(cam_preview_vectors),
1282 cam_preview_vectors,
1283 },
1284 {
1285 ARRAY_SIZE(cam_video_vectors),
1286 cam_video_vectors,
1287 },
1288 {
1289 ARRAY_SIZE(cam_snapshot_vectors),
1290 cam_snapshot_vectors,
1291 },
1292 {
1293 ARRAY_SIZE(cam_zsl_vectors),
1294 cam_zsl_vectors,
1295 },
1296};
1297
1298static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1299 cam_bus_client_config,
1300 ARRAY_SIZE(cam_bus_client_config),
1301 .name = "msm_camera",
1302};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001303
Nishant Pandit24153d82011-08-27 16:05:13 +05301304struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1305 {
1306 .ioclk.mclk_clk_rate = 24000000,
1307 .ioclk.vfe_clk_rate = 228570000,
1308 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001309 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301310 },
1311 {
1312 .ioclk.mclk_clk_rate = 24000000,
1313 .ioclk.vfe_clk_rate = 228570000,
1314 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001315 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301316 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317};
1318
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001319#ifdef CONFIG_IMX074_ACT
1320static struct i2c_board_info imx074_actuator_i2c_info = {
1321 I2C_BOARD_INFO("imx074_act", 0x11),
1322};
1323
1324static struct msm_actuator_info imx074_actuator_info = {
1325 .board_info = &imx074_actuator_i2c_info,
1326 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1327 .vcm_pwd = 0,
1328 .vcm_enable = 1,
1329};
1330#endif
1331
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332#ifdef CONFIG_IMX074
1333static struct msm_camera_sensor_flash_data flash_imx074 = {
1334 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301335#ifdef CONFIG_MSM_CAMERA_FLASH
1336 .flash_src = &msm_flash_src
1337#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001338};
1339
Nishant Pandit24153d82011-08-27 16:05:13 +05301340static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1341 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001342 .sensor_reset = 107,
1343 .sensor_pwd = 85,
1344 .vcm_pwd = 0,
1345 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301346};
1347
1348static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1349 .sensor_name = "imx074",
1350 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351 .flash_data = &flash_imx074,
1352 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301353 .sensor_platform_info = &sensor_board_info_imx074,
1354 .gpio_conf = &gpio_conf,
1355 .csi_if = 1,
1356 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001357#ifdef CONFIG_IMX074_ACT
1358 .actuator_info = &imx074_actuator_info
1359#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360};
1361
1362struct platform_device msm8960_camera_sensor_imx074 = {
1363 .name = "msm_camera_imx074",
1364 .dev = {
1365 .platform_data = &msm_camera_sensor_imx074_data,
1366 },
1367};
1368#endif
1369#ifdef CONFIG_OV2720
1370static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001371 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372};
1373
Nishant Pandit24153d82011-08-27 16:05:13 +05301374static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1375 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001376 .sensor_reset = 76,
1377 .sensor_pwd = 85,
1378 .vcm_pwd = 0,
1379 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301380};
1381
1382static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1383 .sensor_name = "ov2720",
1384 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301386 .sensor_platform_info = &sensor_board_info_ov2720,
1387 .gpio_conf = &gpio_conf,
1388 .csi_if = 1,
1389 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001390};
1391
1392struct platform_device msm8960_camera_sensor_ov2720 = {
1393 .name = "msm_camera_ov2720",
1394 .dev = {
1395 .platform_data = &msm_camera_sensor_ov2720_data,
1396 },
1397};
1398#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001399
Kevin Chan8b0d2322011-09-10 21:06:31 -07001400static struct msm8960_privacy_light_cfg privacy_light_info = {
1401 .mpp = PM8921_MPP_PM_TO_SYS(12),
1402};
1403
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404static void __init msm8960_init_cam(void)
1405{
1406 int i;
1407 struct platform_device *cam_dev[] = {
1408 &msm8960_camera_sensor_imx074,
1409 &msm8960_camera_sensor_ov2720,
1410 };
1411
Kevin Chan8b0d2322011-09-10 21:06:31 -07001412 if (machine_is_msm8960_liquid()) {
1413 struct msm_camera_sensor_info *s_info;
1414 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1415 s_info->sensor_platform_info->mount_angle = 180;
1416 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1417 s_info->sensor_platform_info->privacy_light = 1;
1418 s_info->sensor_platform_info->privacy_light_info =
1419 &privacy_light_info;
1420 }
1421
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1423 struct msm_camera_sensor_info *s_info;
1424 s_info = cam_dev[i]->dev.platform_data;
1425 msm_get_cam_resources(s_info);
1426 platform_device_register(cam_dev[i]);
1427 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001428
1429 platform_device_register(&msm8960_device_csiphy0);
1430 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001431 platform_device_register(&msm8960_device_csid0);
1432 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001433 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001434 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001435 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001436}
1437#endif
1438
1439#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001440#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001442#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443#endif
1444
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445
1446#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001447#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001448#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001449#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1450#else
1451#define MSM_FB_EXT_BUF_SIZE 0
1452#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001453
kuogee hsieh3830eb92011-09-12 15:25:57 -07001454#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1455/* width x height x 3 bpp x 2 frame buffer */
1456#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1457#define MSM_FB_WRITEBACK_OFFSET \
1458 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1459#else
1460#define MSM_FB_WRITEBACK_SIZE 0
1461#define MSM_FB_WRITEBACK_OFFSET 0
1462#endif
1463
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001464#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1465/* 4 bpp x 2 page HDMI case */
1466#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1467#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001468/* Note: must be multiple of 4096 */
1469#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1470 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001471#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001472
1473static int writeback_offset(void)
1474{
1475 return MSM_FB_WRITEBACK_OFFSET;
1476}
1477
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478
1479#define MDP_VSYNC_GPIO 0
1480
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001481#define PANEL_NAME_MAX_LEN 30
1482#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1483#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1484#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1485#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1486#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1487#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1488#define HDMI_PANEL_NAME "hdmi_msm"
1489#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001490
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001491static struct resource msm_fb_resources[] = {
1492 {
1493 .flags = IORESOURCE_DMA,
1494 }
1495};
1496
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001497static int msm_fb_detect_panel(const char *name)
1498{
1499 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001500 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1501 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1502 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001503 return 0;
1504 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001505 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1506 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1507 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001508 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001509
1510#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1511 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1512 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1513 PANEL_NAME_MAX_LEN)))
1514 return 0;
1515
1516 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1517 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1518 PANEL_NAME_MAX_LEN)))
1519 return 0;
1520
1521 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1522 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1523 PANEL_NAME_MAX_LEN)))
1524 return 0;
1525
1526 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1527 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1528 PANEL_NAME_MAX_LEN)))
1529 return 0;
1530#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001531 }
1532
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001533 if (!strncmp(name, HDMI_PANEL_NAME,
1534 strnlen(HDMI_PANEL_NAME,
1535 PANEL_NAME_MAX_LEN)))
1536 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001537
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001538 if (!strncmp(name, TVOUT_PANEL_NAME,
1539 strnlen(TVOUT_PANEL_NAME,
1540 PANEL_NAME_MAX_LEN)))
1541 return 0;
1542
1543 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001544 return -ENODEV;
1545}
1546
1547static struct msm_fb_platform_data msm_fb_pdata = {
1548 .detect_client = msm_fb_detect_panel,
1549};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551static struct platform_device msm_fb_device = {
1552 .name = "msm_fb",
1553 .id = 0,
1554 .num_resources = ARRAY_SIZE(msm_fb_resources),
1555 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001556 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001557};
1558
1559static bool dsi_power_on;
1560
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001561/**
1562 * LiQUID panel on/off
1563 *
1564 * @param on
1565 *
1566 * @return int
1567 */
1568static int mipi_dsi_liquid_panel_power(int on)
1569{
1570 static struct regulator *reg_l2, *reg_ext_3p3v;
1571 static int gpio21, gpio24, gpio43;
1572 int rc;
1573
1574 pr_info("%s: on=%d\n", __func__, on);
1575
1576 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1577 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1578 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1579
1580 if (!dsi_power_on) {
1581
1582 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1583 "dsi_vdda");
1584 if (IS_ERR(reg_l2)) {
1585 pr_err("could not get 8921_l2, rc = %ld\n",
1586 PTR_ERR(reg_l2));
1587 return -ENODEV;
1588 }
1589
1590 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1591 if (rc) {
1592 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1593 return -EINVAL;
1594 }
1595
1596 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1597 "vdd_lvds_3p3v");
1598 if (IS_ERR(reg_ext_3p3v)) {
1599 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1600 PTR_ERR(reg_ext_3p3v));
1601 return -ENODEV;
1602 }
1603
1604 rc = gpio_request(gpio21, "disp_pwr_en_n");
1605 if (rc) {
1606 pr_err("request gpio 21 failed, rc=%d\n", rc);
1607 return -ENODEV;
1608 }
1609
1610 rc = gpio_request(gpio43, "disp_rst_n");
1611 if (rc) {
1612 pr_err("request gpio 43 failed, rc=%d\n", rc);
1613 return -ENODEV;
1614 }
1615
1616 rc = gpio_request(gpio24, "disp_backlight_pwm");
1617 if (rc) {
1618 pr_err("request gpio 24 failed, rc=%d\n", rc);
1619 return -ENODEV;
1620 }
1621
1622 dsi_power_on = true;
1623 }
1624
1625 if (on) {
1626 rc = regulator_set_optimum_mode(reg_l2, 100000);
1627 if (rc < 0) {
1628 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1629 return -EINVAL;
1630 }
1631 rc = regulator_enable(reg_l2);
1632 if (rc) {
1633 pr_err("enable l2 failed, rc=%d\n", rc);
1634 return -ENODEV;
1635 }
1636
1637 rc = regulator_enable(reg_ext_3p3v);
1638 if (rc) {
1639 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1640 return -ENODEV;
1641 }
1642
1643 /* set reset pin before power enable */
1644 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1645
1646 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1647 msleep(20);
1648 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1649 msleep(20);
1650 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1651 msleep(20);
1652 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1653 msleep(20);
1654 } else {
1655 gpio_set_value_cansleep(gpio43, 0);
1656 gpio_set_value_cansleep(gpio21, 1);
1657
1658 rc = regulator_disable(reg_l2);
1659 if (rc) {
1660 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1661 return -ENODEV;
1662 }
1663 rc = regulator_disable(reg_ext_3p3v);
1664 if (rc) {
1665 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1666 return -ENODEV;
1667 }
1668 rc = regulator_set_optimum_mode(reg_l2, 100);
1669 if (rc < 0) {
1670 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1671 return -EINVAL;
1672 }
1673 }
1674
1675 return 0;
1676}
1677
1678static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001679{
1680 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001681 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682 int rc;
1683
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684 pr_info("%s: state : %d\n", __func__, on);
1685
1686 if (!dsi_power_on) {
1687
1688 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1689 "dsi_vdc");
1690 if (IS_ERR(reg_l8)) {
1691 pr_err("could not get 8921_l8, rc = %ld\n",
1692 PTR_ERR(reg_l8));
1693 return -ENODEV;
1694 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001695 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1696 "dsi_vddio");
1697 if (IS_ERR(reg_l23)) {
1698 pr_err("could not get 8921_l23, rc = %ld\n",
1699 PTR_ERR(reg_l23));
1700 return -ENODEV;
1701 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1703 "dsi_vdda");
1704 if (IS_ERR(reg_l2)) {
1705 pr_err("could not get 8921_l2, rc = %ld\n",
1706 PTR_ERR(reg_l2));
1707 return -ENODEV;
1708 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1710 if (rc) {
1711 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1712 return -EINVAL;
1713 }
1714 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1715 if (rc) {
1716 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1717 return -EINVAL;
1718 }
1719 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1720 if (rc) {
1721 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1722 return -EINVAL;
1723 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001724 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1725 rc = gpio_request(gpio43, "disp_rst_n");
1726 if (rc) {
1727 pr_err("request gpio 43 failed, rc=%d\n", rc);
1728 return -ENODEV;
1729 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001730 dsi_power_on = true;
1731 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732 if (on) {
1733 rc = regulator_set_optimum_mode(reg_l8, 100000);
1734 if (rc < 0) {
1735 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1736 return -EINVAL;
1737 }
1738 rc = regulator_set_optimum_mode(reg_l23, 100000);
1739 if (rc < 0) {
1740 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1741 return -EINVAL;
1742 }
1743 rc = regulator_set_optimum_mode(reg_l2, 100000);
1744 if (rc < 0) {
1745 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1746 return -EINVAL;
1747 }
1748 rc = regulator_enable(reg_l8);
1749 if (rc) {
1750 pr_err("enable l8 failed, rc=%d\n", rc);
1751 return -ENODEV;
1752 }
1753 rc = regulator_enable(reg_l23);
1754 if (rc) {
1755 pr_err("enable l8 failed, rc=%d\n", rc);
1756 return -ENODEV;
1757 }
1758 rc = regulator_enable(reg_l2);
1759 if (rc) {
1760 pr_err("enable l2 failed, rc=%d\n", rc);
1761 return -ENODEV;
1762 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001763 gpio_set_value_cansleep(gpio43, 1);
1764 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001765 rc = regulator_disable(reg_l2);
1766 if (rc) {
1767 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1768 return -ENODEV;
1769 }
1770 rc = regulator_disable(reg_l8);
1771 if (rc) {
1772 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1773 return -ENODEV;
1774 }
1775 rc = regulator_disable(reg_l23);
1776 if (rc) {
1777 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1778 return -ENODEV;
1779 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001780 rc = regulator_set_optimum_mode(reg_l8, 100);
1781 if (rc < 0) {
1782 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1783 return -EINVAL;
1784 }
1785 rc = regulator_set_optimum_mode(reg_l23, 100);
1786 if (rc < 0) {
1787 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1788 return -EINVAL;
1789 }
1790 rc = regulator_set_optimum_mode(reg_l2, 100);
1791 if (rc < 0) {
1792 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1793 return -EINVAL;
1794 }
1795 gpio_set_value_cansleep(gpio43, 0);
1796 }
1797 return 0;
1798}
1799
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001800static int mipi_dsi_panel_power(int on)
1801{
1802 int ret;
1803
1804 pr_info("%s: on=%d\n", __func__, on);
1805
1806 if (machine_is_msm8960_liquid())
1807 ret = mipi_dsi_liquid_panel_power(on);
1808 else
1809 ret = mipi_dsi_cdp_panel_power(on);
1810
1811 return ret;
1812}
1813
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001814static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1815 .vsync_gpio = MDP_VSYNC_GPIO,
1816 .dsi_power_save = mipi_dsi_panel_power,
1817};
1818
1819#ifdef CONFIG_MSM_BUS_SCALING
1820
1821static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001822 {
1823 .src = MSM_BUS_MASTER_MDP_PORT0,
1824 .dst = MSM_BUS_SLAVE_EBI_CH0,
1825 .ab = 0,
1826 .ib = 0,
1827 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001828};
1829
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001830#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1831static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1832 /* If HDMI is used as primary */
1833 {
1834 .src = MSM_BUS_MASTER_MDP_PORT0,
1835 .dst = MSM_BUS_SLAVE_EBI_CH0,
1836 .ab = 2000000000,
1837 .ib = 2000000000,
1838 },
1839};
1840static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1841 {
1842 ARRAY_SIZE(mdp_init_vectors),
1843 mdp_init_vectors,
1844 },
1845 {
1846 ARRAY_SIZE(hdmi_as_primary_vectors),
1847 hdmi_as_primary_vectors,
1848 },
1849 {
1850 ARRAY_SIZE(hdmi_as_primary_vectors),
1851 hdmi_as_primary_vectors,
1852 },
1853 {
1854 ARRAY_SIZE(hdmi_as_primary_vectors),
1855 hdmi_as_primary_vectors,
1856 },
1857 {
1858 ARRAY_SIZE(hdmi_as_primary_vectors),
1859 hdmi_as_primary_vectors,
1860 },
1861 {
1862 ARRAY_SIZE(hdmi_as_primary_vectors),
1863 hdmi_as_primary_vectors,
1864 },
1865};
1866#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001867static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001868 {
1869 .src = MSM_BUS_MASTER_MDP_PORT0,
1870 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001871 .ab = 216000000 * 2,
1872 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873 },
1874};
1875
1876static struct msm_bus_vectors mdp_vga_vectors[] = {
1877 /* VGA and less video */
1878 {
1879 .src = MSM_BUS_MASTER_MDP_PORT0,
1880 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001881 .ab = 216000000 * 2,
1882 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001883 },
1884};
1885
1886static struct msm_bus_vectors mdp_720p_vectors[] = {
1887 /* 720p and less video */
1888 {
1889 .src = MSM_BUS_MASTER_MDP_PORT0,
1890 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001891 .ab = 230400000 * 2,
1892 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001893 },
1894};
1895
1896static struct msm_bus_vectors mdp_1080p_vectors[] = {
1897 /* 1080p and less video */
1898 {
1899 .src = MSM_BUS_MASTER_MDP_PORT0,
1900 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001901 .ab = 334080000 * 2,
1902 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 },
1904};
1905
1906static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1907 {
1908 ARRAY_SIZE(mdp_init_vectors),
1909 mdp_init_vectors,
1910 },
1911 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001912 ARRAY_SIZE(mdp_ui_vectors),
1913 mdp_ui_vectors,
1914 },
1915 {
1916 ARRAY_SIZE(mdp_ui_vectors),
1917 mdp_ui_vectors,
1918 },
1919 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920 ARRAY_SIZE(mdp_vga_vectors),
1921 mdp_vga_vectors,
1922 },
1923 {
1924 ARRAY_SIZE(mdp_720p_vectors),
1925 mdp_720p_vectors,
1926 },
1927 {
1928 ARRAY_SIZE(mdp_1080p_vectors),
1929 mdp_1080p_vectors,
1930 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001931};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001932#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001933
1934static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1935 mdp_bus_scale_usecases,
1936 ARRAY_SIZE(mdp_bus_scale_usecases),
1937 .name = "mdp",
1938};
1939
1940#endif
1941
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001942#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1943int mdp_core_clk_rate_table[] = {
1944 200000000,
1945 200000000,
1946 200000000,
1947 200000000,
1948};
1949#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950int mdp_core_clk_rate_table[] = {
1951 85330000,
1952 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001953 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001954 200000000,
1955};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001956#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001957
1958static struct msm_panel_common_pdata mdp_pdata = {
1959 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001960#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1961 .mdp_core_clk_rate = 200000000,
1962#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001963 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001964#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001965 .mdp_core_clk_table = mdp_core_clk_rate_table,
1966 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1967#ifdef CONFIG_MSM_BUS_SCALING
1968 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1969#endif
1970 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001971 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001972};
1973
1974static struct platform_device mipi_dsi_renesas_panel_device = {
1975 .name = "mipi_renesas",
1976 .id = 0,
1977};
1978
1979static struct platform_device mipi_dsi_simulator_panel_device = {
1980 .name = "mipi_simulator",
1981 .id = 0,
1982};
1983
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001984#define LPM_CHANNEL0 0
1985static int toshiba_gpio[] = {LPM_CHANNEL0};
1986
1987static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1988 .gpio = toshiba_gpio,
1989};
1990
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001991static struct platform_device mipi_dsi_toshiba_panel_device = {
1992 .name = "mipi_toshiba",
1993 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001994 .dev = {
1995 .platform_data = &toshiba_pdata,
1996 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001997};
1998
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001999#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002000static int dsi2lvds_gpio[2] = {
2001 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2002 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2003 };
2004
2005static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2006 .gpio_num = dsi2lvds_gpio,
2007};
2008
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002009static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2010
2011/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2012 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2013 /* timing */
2014 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2015 0x0c, 0x03, 0x04, 0xa0},
2016 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2017 {0xff, 0x00, 0x06, 0x00}, /* strength */
2018 /* pll control */
2019 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2020 0x40, 0x07, 0x03,
2021 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2022};
2023
2024static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002025 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2026 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002027 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2028};
2029
2030static struct platform_device mipi_dsi_novatek_panel_device = {
2031 .name = "mipi_novatek",
2032 .id = 0,
2033 .dev = {
2034 .platform_data = &novatek_pdata,
2035 }
2036};
2037
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002038static struct platform_device mipi_dsi2lvds_bridge_device = {
2039 .name = "mipi_tc358764",
2040 .id = 0,
2041 .dev.platform_data = &mipi_dsi2lvds_pdata,
2042};
2043
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002044#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2045static struct resource hdmi_msm_resources[] = {
2046 {
2047 .name = "hdmi_msm_qfprom_addr",
2048 .start = 0x00700000,
2049 .end = 0x007060FF,
2050 .flags = IORESOURCE_MEM,
2051 },
2052 {
2053 .name = "hdmi_msm_hdmi_addr",
2054 .start = 0x04A00000,
2055 .end = 0x04A00FFF,
2056 .flags = IORESOURCE_MEM,
2057 },
2058 {
2059 .name = "hdmi_msm_irq",
2060 .start = HDMI_IRQ,
2061 .end = HDMI_IRQ,
2062 .flags = IORESOURCE_IRQ,
2063 },
2064};
2065
2066static int hdmi_enable_5v(int on);
2067static int hdmi_core_power(int on, int show);
2068static int hdmi_cec_power(int on);
2069
2070static struct msm_hdmi_platform_data hdmi_msm_data = {
2071 .irq = HDMI_IRQ,
2072 .enable_5v = hdmi_enable_5v,
2073 .core_power = hdmi_core_power,
2074 .cec_power = hdmi_cec_power,
2075};
2076
2077static struct platform_device hdmi_msm_device = {
2078 .name = "hdmi_msm",
2079 .id = 0,
2080 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2081 .resource = hdmi_msm_resources,
2082 .dev.platform_data = &hdmi_msm_data,
2083};
2084#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2085
Vinay Kalia291263e2011-11-01 17:07:05 -07002086#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2087static struct platform_device wfd_panel_device = {
2088 .name = "wfd_panel",
2089 .id = 0,
2090 .dev.platform_data = NULL,
2091};
2092#endif
2093
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002094#ifdef CONFIG_MSM_BUS_SCALING
2095static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2096 {
2097 .src = MSM_BUS_MASTER_MDP_PORT0,
2098 .dst = MSM_BUS_SLAVE_EBI_CH0,
2099 .ab = 0,
2100 .ib = 0,
2101 },
2102};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002103
2104#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2105static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2106 {
2107 .src = MSM_BUS_MASTER_MDP_PORT0,
2108 .dst = MSM_BUS_SLAVE_EBI_CH0,
2109 .ab = 2000000000,
2110 .ib = 2000000000,
2111 },
2112};
2113#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002114static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2115 {
2116 .src = MSM_BUS_MASTER_MDP_PORT0,
2117 .dst = MSM_BUS_SLAVE_EBI_CH0,
2118 .ab = 566092800 * 2,
2119 .ib = 707616000 * 2,
2120 },
2121};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002122#endif
2123
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002124static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2125 {
2126 ARRAY_SIZE(dtv_bus_init_vectors),
2127 dtv_bus_init_vectors,
2128 },
2129 {
2130 ARRAY_SIZE(dtv_bus_def_vectors),
2131 dtv_bus_def_vectors,
2132 },
2133};
2134static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2135 dtv_bus_scale_usecases,
2136 ARRAY_SIZE(dtv_bus_scale_usecases),
2137 .name = "dtv",
2138};
2139
2140static struct lcdc_platform_data dtv_pdata = {
2141 .bus_scale_table = &dtv_bus_scale_pdata,
2142};
2143#endif
2144
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002145static void __init msm_fb_add_devices(void)
2146{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002147 struct platform_device *ptr = NULL;
2148
2149 if (machine_is_msm8960_liquid())
2150 ptr = &mipi_dsi2lvds_bridge_device;
2151 else
2152 ptr = &mipi_dsi_toshiba_panel_device;
2153 platform_add_devices(&ptr, 1);
2154
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002155 if (machine_is_msm8x60_rumi3()) {
2156 msm_fb_register_device("mdp", NULL);
2157 mipi_dsi_pdata.target_type = 1;
2158 } else
2159 msm_fb_register_device("mdp", &mdp_pdata);
2160 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002161#ifdef CONFIG_MSM_BUS_SCALING
2162 msm_fb_register_device("dtv", &dtv_pdata);
2163#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002164}
2165
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002166static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2167 .func = GPIOMUX_FUNC_GPIO,
2168 .drv = GPIOMUX_DRV_2MA,
2169 .pull = GPIOMUX_PULL_DOWN,
2170};
2171
2172static struct gpiomux_setting mdp_vsync_active_cfg = {
2173 .func = GPIOMUX_FUNC_1,
2174 .drv = GPIOMUX_DRV_2MA,
2175 .pull = GPIOMUX_PULL_DOWN,
2176};
2177
2178static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2179 {
2180 .gpio = MDP_VSYNC_GPIO,
2181 .settings = {
2182 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2183 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2184 },
2185 }
2186};
2187
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2189static struct gpiomux_setting hdmi_suspend_cfg = {
2190 .func = GPIOMUX_FUNC_GPIO,
2191 .drv = GPIOMUX_DRV_2MA,
2192 .pull = GPIOMUX_PULL_DOWN,
2193};
2194
2195static struct gpiomux_setting hdmi_active_1_cfg = {
2196 .func = GPIOMUX_FUNC_1,
2197 .drv = GPIOMUX_DRV_2MA,
2198 .pull = GPIOMUX_PULL_UP,
2199};
2200
2201static struct gpiomux_setting hdmi_active_2_cfg = {
2202 .func = GPIOMUX_FUNC_1,
2203 .drv = GPIOMUX_DRV_2MA,
2204 .pull = GPIOMUX_PULL_DOWN,
2205};
2206
2207static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2208 {
2209 .gpio = 99,
2210 .settings = {
2211 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2212 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2213 },
2214 },
2215 {
2216 .gpio = 100,
2217 .settings = {
2218 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2219 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2220 },
2221 },
2222 {
2223 .gpio = 101,
2224 .settings = {
2225 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2226 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2227 },
2228 },
2229 {
2230 .gpio = 102,
2231 .settings = {
2232 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2233 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2234 },
2235 },
2236};
2237
2238static int hdmi_enable_5v(int on)
2239{
2240 /* TBD: PM8921 regulator instead of 8901 */
2241 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2242 static int prev_on;
2243 int rc;
2244
2245 if (on == prev_on)
2246 return 0;
2247
2248 if (!reg_8921_hdmi_mvs)
2249 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2250 "hdmi_mvs");
2251
2252 if (on) {
2253 rc = regulator_enable(reg_8921_hdmi_mvs);
2254 if (rc) {
2255 pr_err("'%s' regulator enable failed, rc=%d\n",
2256 "8921_hdmi_mvs", rc);
2257 return rc;
2258 }
2259 pr_debug("%s(on): success\n", __func__);
2260 } else {
2261 rc = regulator_disable(reg_8921_hdmi_mvs);
2262 if (rc)
2263 pr_warning("'%s' regulator disable failed, rc=%d\n",
2264 "8921_hdmi_mvs", rc);
2265 pr_debug("%s(off): success\n", __func__);
2266 }
2267
2268 prev_on = on;
2269
2270 return 0;
2271}
2272
2273static int hdmi_core_power(int on, int show)
2274{
2275 static struct regulator *reg_8921_l23, *reg_8921_s4;
2276 static int prev_on;
2277 int rc;
2278
2279 if (on == prev_on)
2280 return 0;
2281
2282 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002283 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002285 if (IS_ERR(reg_8921_l23)) {
2286 pr_err("could not get reg_8921_l23, rc = %ld\n",
2287 PTR_ERR(reg_8921_l23));
2288 return -ENODEV;
2289 }
2290 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2291 if (rc) {
2292 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2293 return -EINVAL;
2294 }
2295 }
2296 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002297 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002298 if (IS_ERR(reg_8921_s4)) {
2299 pr_err("could not get reg_8921_s4, rc = %ld\n",
2300 PTR_ERR(reg_8921_s4));
2301 return -ENODEV;
2302 }
2303 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2304 if (rc) {
2305 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2306 return -EINVAL;
2307 }
2308 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309
2310 if (on) {
2311 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2312 if (rc < 0) {
2313 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2314 return -EINVAL;
2315 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002316 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317 if (rc) {
2318 pr_err("'%s' regulator enable failed, rc=%d\n",
2319 "hdmi_avdd", rc);
2320 return rc;
2321 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002322 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323 if (rc) {
2324 pr_err("'%s' regulator enable failed, rc=%d\n",
2325 "hdmi_vcc", rc);
2326 return rc;
2327 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002328 rc = gpio_request(100, "HDMI_DDC_CLK");
2329 if (rc) {
2330 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2331 "HDMI_DDC_CLK", 100, rc);
2332 goto error1;
2333 }
2334 rc = gpio_request(101, "HDMI_DDC_DATA");
2335 if (rc) {
2336 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2337 "HDMI_DDC_DATA", 101, rc);
2338 goto error2;
2339 }
2340 rc = gpio_request(102, "HDMI_HPD");
2341 if (rc) {
2342 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2343 "HDMI_HPD", 102, rc);
2344 goto error3;
2345 }
2346 pr_debug("%s(on): success\n", __func__);
2347 } else {
2348 gpio_free(100);
2349 gpio_free(101);
2350 gpio_free(102);
2351
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002352 rc = regulator_disable(reg_8921_l23);
2353 if (rc) {
2354 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2355 return -ENODEV;
2356 }
2357 rc = regulator_disable(reg_8921_s4);
2358 if (rc) {
2359 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2360 return -ENODEV;
2361 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2363 if (rc < 0) {
2364 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2365 return -EINVAL;
2366 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002367 pr_debug("%s(off): success\n", __func__);
2368 }
2369
2370 prev_on = on;
2371
2372 return 0;
2373
2374error3:
2375 gpio_free(101);
2376error2:
2377 gpio_free(100);
2378error1:
2379 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002380 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381 return rc;
2382}
2383
2384static int hdmi_cec_power(int on)
2385{
2386 static int prev_on;
2387 int rc;
2388
2389 if (on == prev_on)
2390 return 0;
2391
2392 if (on) {
2393 rc = gpio_request(99, "HDMI_CEC_VAR");
2394 if (rc) {
2395 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2396 "HDMI_CEC_VAR", 99, rc);
2397 goto error;
2398 }
2399 pr_debug("%s(on): success\n", __func__);
2400 } else {
2401 gpio_free(99);
2402 pr_debug("%s(off): success\n", __func__);
2403 }
2404
2405 prev_on = on;
2406
2407 return 0;
2408error:
2409 return rc;
2410}
2411#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2412
2413static void __init msm8960_allocate_memory_regions(void)
2414{
2415 void *addr;
2416 unsigned long size;
2417
2418 size = MSM_FB_SIZE;
2419 addr = alloc_bootmem_align(size, 0x1000);
2420 msm_fb_resources[0].start = __pa(addr);
2421 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2422 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2423 size, addr, __pa(addr));
2424
2425}
2426#ifdef CONFIG_WCD9310_CODEC
2427
2428#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2429
Patrick Lai3043fba2011-08-01 14:15:57 -07002430/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2431 * 4 micbiases are used to power various analog and digital
2432 * microphones operating at 1800 mV. Technically, all micbiases
2433 * can source from single cfilter since all microphones operate
2434 * at the same voltage level. The arrangement below is to make
2435 * sure all cfilters are exercised. LDO_H regulator ouput level
2436 * does not need to be as high as 2.85V. It is choosen for
2437 * microphone sensitivity purpose.
2438 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002439static struct tabla_pdata tabla_platform_data = {
2440 .slimbus_slave_device = {
2441 .name = "tabla-slave",
2442 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2443 },
2444 .irq = MSM_GPIO_TO_INT(62),
2445 .irq_base = TABLA_INTERRUPT_BASE,
2446 .num_irqs = NR_TABLA_IRQS,
2447 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002448 .micbias = {
2449 .ldoh_v = TABLA_LDOH_2P85_V,
2450 .cfilt1_mv = 1800,
2451 .cfilt2_mv = 1800,
2452 .cfilt3_mv = 1800,
2453 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2454 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2455 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2456 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2457 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002458};
2459
2460static struct slim_device msm_slim_tabla = {
2461 .name = "tabla-slim",
2462 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2463 .dev = {
2464 .platform_data = &tabla_platform_data,
2465 },
2466};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302467
2468static struct tabla_pdata tabla20_platform_data = {
2469 .slimbus_slave_device = {
2470 .name = "tabla-slave",
2471 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2472 },
2473 .irq = MSM_GPIO_TO_INT(62),
2474 .irq_base = TABLA_INTERRUPT_BASE,
2475 .num_irqs = NR_TABLA_IRQS,
2476 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2477 .micbias = {
2478 .ldoh_v = TABLA_LDOH_2P85_V,
2479 .cfilt1_mv = 1800,
2480 .cfilt2_mv = 1800,
2481 .cfilt3_mv = 1800,
2482 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2483 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2484 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2485 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2486 }
2487};
2488
2489static struct slim_device msm_slim_tabla20 = {
2490 .name = "tabla2x-slim",
2491 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2492 .dev = {
2493 .platform_data = &tabla20_platform_data,
2494 },
2495};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002496#endif
2497
2498static struct slim_boardinfo msm_slim_devices[] = {
2499#ifdef CONFIG_WCD9310_CODEC
2500 {
2501 .bus_num = 1,
2502 .slim_slave = &msm_slim_tabla,
2503 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302504 {
2505 .bus_num = 1,
2506 .slim_slave = &msm_slim_tabla20,
2507 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002508#endif
2509 /* add more slimbus slaves as needed */
2510};
2511
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002512#define MSM_WCNSS_PHYS 0x03000000
2513#define MSM_WCNSS_SIZE 0x280000
2514
2515static struct resource resources_wcnss_wlan[] = {
2516 {
2517 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2518 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2519 .name = "wcnss_wlanrx_irq",
2520 .flags = IORESOURCE_IRQ,
2521 },
2522 {
2523 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2524 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2525 .name = "wcnss_wlantx_irq",
2526 .flags = IORESOURCE_IRQ,
2527 },
2528 {
2529 .start = MSM_WCNSS_PHYS,
2530 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2531 .name = "wcnss_mmio",
2532 .flags = IORESOURCE_MEM,
2533 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002534 {
2535 .start = 84,
2536 .end = 88,
2537 .name = "wcnss_gpios_5wire",
2538 .flags = IORESOURCE_IO,
2539 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002540};
2541
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002542static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2543 .has_48mhz_xo = 1,
2544};
2545
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002546static struct platform_device msm_device_wcnss_wlan = {
2547 .name = "wcnss_wlan",
2548 .id = 0,
2549 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2550 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002551 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002552};
2553
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002554#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2555 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2556 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2557 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2558
2559#define QCE_SIZE 0x10000
2560#define QCE_0_BASE 0x18500000
2561
2562#define QCE_HW_KEY_SUPPORT 0
2563#define QCE_SHA_HMAC_SUPPORT 1
2564#define QCE_SHARE_CE_RESOURCE 1
2565#define QCE_CE_SHARED 0
2566
2567static struct resource qcrypto_resources[] = {
2568 [0] = {
2569 .start = QCE_0_BASE,
2570 .end = QCE_0_BASE + QCE_SIZE - 1,
2571 .flags = IORESOURCE_MEM,
2572 },
2573 [1] = {
2574 .name = "crypto_channels",
2575 .start = DMOV_CE_IN_CHAN,
2576 .end = DMOV_CE_OUT_CHAN,
2577 .flags = IORESOURCE_DMA,
2578 },
2579 [2] = {
2580 .name = "crypto_crci_in",
2581 .start = DMOV_CE_IN_CRCI,
2582 .end = DMOV_CE_IN_CRCI,
2583 .flags = IORESOURCE_DMA,
2584 },
2585 [3] = {
2586 .name = "crypto_crci_out",
2587 .start = DMOV_CE_OUT_CRCI,
2588 .end = DMOV_CE_OUT_CRCI,
2589 .flags = IORESOURCE_DMA,
2590 },
2591};
2592
2593static struct resource qcedev_resources[] = {
2594 [0] = {
2595 .start = QCE_0_BASE,
2596 .end = QCE_0_BASE + QCE_SIZE - 1,
2597 .flags = IORESOURCE_MEM,
2598 },
2599 [1] = {
2600 .name = "crypto_channels",
2601 .start = DMOV_CE_IN_CHAN,
2602 .end = DMOV_CE_OUT_CHAN,
2603 .flags = IORESOURCE_DMA,
2604 },
2605 [2] = {
2606 .name = "crypto_crci_in",
2607 .start = DMOV_CE_IN_CRCI,
2608 .end = DMOV_CE_IN_CRCI,
2609 .flags = IORESOURCE_DMA,
2610 },
2611 [3] = {
2612 .name = "crypto_crci_out",
2613 .start = DMOV_CE_OUT_CRCI,
2614 .end = DMOV_CE_OUT_CRCI,
2615 .flags = IORESOURCE_DMA,
2616 },
2617};
2618
2619#endif
2620
2621#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2622 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2623
2624static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2625 .ce_shared = QCE_CE_SHARED,
2626 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2627 .hw_key_support = QCE_HW_KEY_SUPPORT,
2628 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2629};
2630
2631static struct platform_device qcrypto_device = {
2632 .name = "qcrypto",
2633 .id = 0,
2634 .num_resources = ARRAY_SIZE(qcrypto_resources),
2635 .resource = qcrypto_resources,
2636 .dev = {
2637 .coherent_dma_mask = DMA_BIT_MASK(32),
2638 .platform_data = &qcrypto_ce_hw_suppport,
2639 },
2640};
2641#endif
2642
2643#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2644 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2645
2646static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2647 .ce_shared = QCE_CE_SHARED,
2648 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2649 .hw_key_support = QCE_HW_KEY_SUPPORT,
2650 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2651};
2652
2653static struct platform_device qcedev_device = {
2654 .name = "qce",
2655 .id = 0,
2656 .num_resources = ARRAY_SIZE(qcedev_resources),
2657 .resource = qcedev_resources,
2658 .dev = {
2659 .coherent_dma_mask = DMA_BIT_MASK(32),
2660 .platform_data = &qcedev_ce_hw_suppport,
2661 },
2662};
2663#endif
2664
2665
2666static int __init gpiomux_init(void)
2667{
2668 int rc;
2669
2670 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2671 if (rc) {
2672 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2673 return rc;
2674 }
2675
Nishant Pandit24153d82011-08-27 16:05:13 +05302676 msm_gpiomux_install(msm8960_cam_common_configs,
2677 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002678
2679 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002680 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002681
2682 msm_gpiomux_install(msm8960_gsbi_configs,
2683 ARRAY_SIZE(msm8960_gsbi_configs));
2684
2685 msm_gpiomux_install(msm8960_cyts_configs,
2686 ARRAY_SIZE(msm8960_cyts_configs));
2687
2688 msm_gpiomux_install(msm8960_slimbus_config,
2689 ARRAY_SIZE(msm8960_slimbus_config));
2690
2691 msm_gpiomux_install(msm8960_audio_codec_configs,
2692 ARRAY_SIZE(msm8960_audio_codec_configs));
2693
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002694 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2695 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2696
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2698 msm_gpiomux_install(msm8960_hdmi_configs,
2699 ARRAY_SIZE(msm8960_hdmi_configs));
2700#endif
2701
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002702 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2703 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2704
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002705 msm_gpiomux_install(wcnss_5wire_interface,
2706 ARRAY_SIZE(wcnss_5wire_interface));
2707
Mohan Pallaka5e490392011-09-09 15:18:41 +05302708 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2709 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2710 msm_gpiomux_install(hap_lvl_shft_config,
2711 ARRAY_SIZE(hap_lvl_shft_config));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002712 return 0;
2713}
2714
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002715#define MSM_SHARED_RAM_PHYS 0x80000000
2716
2717static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2718 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2719 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2720 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2721 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2722 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2723 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2724 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2725 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2726 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2727 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2728 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2729 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002730 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2731 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2732 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2733 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2734 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2735 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2736 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2737 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2738 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2739 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2740 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2741 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2742 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2743 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002744 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002745 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2746 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2747 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002748 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2749 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002750};
2751
2752static struct pm8921_adc_properties pm8921_adc_data = {
2753 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2754 .bitresolution = 15,
2755 .bipolar = 0,
2756};
2757
2758static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2759 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002760 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002761 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002762 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002763};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002764
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002765static void __init msm8960_map_io(void)
2766{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002767 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002768 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002769
2770 if (socinfo_init() < 0)
2771 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002772}
2773
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002774#ifdef CONFIG_ARCH_MSM8930
2775static void __init msm8930_map_io(void)
2776{
2777 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2778 msm_map_msm8930_io();
2779
2780 if (socinfo_init() < 0)
2781 pr_err("socinfo_init() failed!\n");
2782}
2783#endif
2784
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002785static void __init msm8960_init_irq(void)
2786{
2787 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002788
2789 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002790 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002792
2793 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002794 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002795
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002796 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2797 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002798
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002799 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2800 * as they are configured as level, which does not play nice with
2801 * handle_percpu_irq.
2802 */
2803 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2804 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002805 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002806 }
2807}
2808
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002809/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002810enum sdcc_controllers {
2811 SDCC1,
2812 SDCC2,
2813 SDCC3,
2814 SDCC4,
2815 SDCC5,
2816 MAX_SDCC_CONTROLLER
2817};
2818
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002819/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002820static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2821 /* SDCC1 : eMMC card connected */
2822 [SDCC1] = {
2823 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302824 .high_vol_level = 2950000,
2825 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302826 .always_on = 1,
2827 .lpm_sup = 1,
2828 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829 .hpm_uA = 200000, /* 200mA */
2830 },
2831 /* SDCC3 : External card slot connected */
2832 [SDCC3] = {
2833 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302834 .high_vol_level = 2950000,
2835 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836 .hpm_uA = 600000, /* 600mA */
2837 }
2838};
2839
2840/* Only slots having eMMC card will require VCCQ voltage */
2841static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2842 /* SDCC1 : eMMC card connected */
2843 [SDCC1] = {
2844 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002845 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302846 .high_vol_level = 1800000,
2847 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002848 .hpm_uA = 200000, /* 200mA */
2849 }
2850};
2851
2852/* All SDCC controllers may require voting for VDD PAD voltage */
2853static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2854 /* SDCC3 : External card slot connected */
2855 [SDCC3] = {
2856 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302857 .high_vol_level = 2950000,
2858 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002859 .always_on = 1,
2860 .lpm_sup = 1,
2861 /* Max. Active current required is 16 mA */
2862 .hpm_uA = 16000,
2863 /*
2864 * Sleep current required is ~300 uA. But min. vote can be
2865 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2866 * during sleep.
2867 */
2868 .lpm_uA = 2000,
2869 }
2870};
2871
2872static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2873 /* SDCC1 : eMMC card connected */
2874 [SDCC1] = {
2875 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2876 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2877 },
2878 /* SDCC3 : External card slot connected */
2879 [SDCC3] = {
2880 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2881 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2882 }
2883};
2884
2885/* SDC1 pad data */
2886static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2887 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302888 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2889 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890};
2891
2892static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2893 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2894 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2895 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2896};
2897
2898static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302899 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002900 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2901 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2902};
2903
2904static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302905 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002906 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2907 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2908};
2909
2910/* SDC3 pad data */
2911static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2912 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2913 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2914 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2915};
2916
2917static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2918 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2919 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2920 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2921};
2922
2923static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302924 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2926 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2927};
2928
2929static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302930 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302931 /*
2932 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2933 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2934 * which would result in false card detection interrupts.
2935 */
2936 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2937 /*
2938 * Keeping DATA lines status to PULL UP will make sure that
2939 * there is no current leak during sleep if external pull up
2940 * is connected to DATA lines.
2941 */
2942 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002943};
2944
2945struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2946 [SDCC1] = {
2947 .on = sdc1_pad_pull_on_cfg,
2948 .off = sdc1_pad_pull_off_cfg,
2949 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2950 },
2951 [SDCC3] = {
2952 .on = sdc3_pad_pull_on_cfg,
2953 .off = sdc3_pad_pull_off_cfg,
2954 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2955 },
2956};
2957
2958struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2959 [SDCC1] = {
2960 .on = sdc1_pad_drv_on_cfg,
2961 .off = sdc1_pad_drv_off_cfg,
2962 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2963 },
2964 [SDCC3] = {
2965 .on = sdc3_pad_drv_on_cfg,
2966 .off = sdc3_pad_drv_off_cfg,
2967 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2968 },
2969};
2970
2971struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2972 [SDCC1] = {
2973 .pull = &mmc_pad_pull_data[SDCC1],
2974 .drv = &mmc_pad_drv_data[SDCC1]
2975 },
2976 [SDCC3] = {
2977 .pull = &mmc_pad_pull_data[SDCC3],
2978 .drv = &mmc_pad_drv_data[SDCC3]
2979 },
2980};
2981
2982struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2983 [SDCC1] = {
2984 .pad_data = &mmc_pad_data[SDCC1],
2985 },
2986 [SDCC3] = {
2987 .pad_data = &mmc_pad_data[SDCC3],
2988 },
2989};
2990
2991static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302992 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002993};
2994
2995static unsigned int sdc3_sup_clk_rates[] = {
2996 400000, 24000000, 48000000, 96000000
2997};
2998
2999#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3000static struct mmc_platform_data msm8960_sdc1_data = {
3001 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3002#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3003 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3004#else
3005 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3006#endif
3007 .sup_clk_table = sdc1_sup_clk_rates,
3008 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303009 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003010 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003011 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303012 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013};
3014#endif
3015
3016#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3017static struct mmc_platform_data msm8960_sdc3_data = {
3018 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3019 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3020 .sup_clk_table = sdc3_sup_clk_rates,
3021 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303022 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303023#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003024 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303025#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003026 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3027 .pin_data = &mmc_slot_pin_data[SDCC3],
3028#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3029 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3030 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3031 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3032#endif
3033 .xpc_cap = 1,
3034 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3035 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303036 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003037};
3038#endif
3039
3040static void __init msm8960_init_mmc(void)
3041{
3042#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3043 /* SDC1 : eMMC card connected */
3044 msm_add_sdcc(1, &msm8960_sdc1_data);
3045#endif
3046#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3047 /* SDC3: External card slot */
3048 msm_add_sdcc(3, &msm8960_sdc3_data);
3049#endif
3050}
3051
3052static void __init msm8960_init_buses(void)
3053{
3054#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003055 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003056 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3057 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3058 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3059 msm_bus_apps_fabric.dev.platform_data =
3060 &msm_bus_8960_apps_fabric_pdata;
3061 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3062 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3063 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3064 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003065#endif
3066}
3067
3068static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3069 .max_clock_speed = 15060000,
3070};
3071
3072#ifdef CONFIG_USB_MSM_OTG_72K
3073static struct msm_otg_platform_data msm_otg_pdata;
3074#else
3075#define USB_5V_EN 42
3076static void msm_hsusb_vbus_power(bool on)
3077{
3078 int rc;
3079 static bool vbus_is_on;
3080 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003081
3082 if (vbus_is_on == on)
3083 return;
3084
3085 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003086 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3087 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003088 if (IS_ERR(mvs_otg_switch)) {
3089 pr_err("Unable to get mvs_otg_switch\n");
3090 return;
3091 }
3092
3093 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3094 "usb_5v_en");
3095 if (rc < 0) {
3096 pr_err("failed to request usb_5v_en gpio\n");
3097 goto put_mvs_otg;
3098 }
3099
Anji jonnala2936fd92011-11-09 15:39:22 +05303100 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3101 if (rc) {
3102 pr_err("%s: unable to set_direction for gpio [%d]\n",
3103 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003104 goto free_usb_5v_en;
3105 }
3106
Anji jonnala2936fd92011-11-09 15:39:22 +05303107 if (regulator_enable(mvs_otg_switch)) {
3108 pr_err("unable to enable mvs_otg_switch\n");
3109 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003110 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303111
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003112 vbus_is_on = true;
3113 return;
3114 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303115 regulator_disable(mvs_otg_switch);
3116err_ldo_gpio_set_dir:
3117 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003118free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303119 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003120put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303121 regulator_put(mvs_otg_switch);
3122 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003123}
3124
3125static struct msm_otg_platform_data msm_otg_pdata = {
3126 .mode = USB_OTG,
3127 .otg_control = OTG_PMIC_CONTROL,
3128 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3129 .pclk_src_name = "dfab_usb_hs_clk",
3130 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3131 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303132 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003133};
3134#endif
3135
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303136#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303137#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303138static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3139 .strobe = 150,
3140 .data = 151,
3141};
3142#else
3143static struct msm_hsic_host_platform_data msm_hsic_pdata;
3144#endif
3145
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003146#define PID_MAGIC_ID 0x71432909
3147#define SERIAL_NUM_MAGIC_ID 0x61945374
3148#define SERIAL_NUMBER_LENGTH 127
3149#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3150
3151struct magic_num_struct {
3152 uint32_t pid;
3153 uint32_t serial_num;
3154};
3155
3156struct dload_struct {
3157 uint32_t reserved1;
3158 uint32_t reserved2;
3159 uint32_t reserved3;
3160 uint16_t reserved4;
3161 uint16_t pid;
3162 char serial_number[SERIAL_NUMBER_LENGTH];
3163 uint16_t reserved5;
3164 struct magic_num_struct magic_struct;
3165};
3166
3167static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3168{
3169 struct dload_struct __iomem *dload = 0;
3170
3171 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3172 if (!dload) {
3173 pr_err("%s: cannot remap I/O memory region: %08x\n",
3174 __func__, DLOAD_USB_BASE_ADD);
3175 return -ENXIO;
3176 }
3177
3178 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3179 __func__, dload, pid, snum);
3180 /* update pid */
3181 dload->magic_struct.pid = PID_MAGIC_ID;
3182 dload->pid = pid;
3183
3184 /* update serial number */
3185 dload->magic_struct.serial_num = 0;
3186 if (!snum) {
3187 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3188 goto out;
3189 }
3190
3191 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003192 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003193out:
3194 iounmap(dload);
3195 return 0;
3196}
3197
3198static struct android_usb_platform_data android_usb_pdata = {
3199 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3200};
3201
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003202static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003203 .name = "android_usb",
3204 .id = -1,
3205 .dev = {
3206 .platform_data = &android_usb_pdata,
3207 },
3208};
3209
3210static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3211 0x03, 0x0f,
3212};
3213
3214static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3215 0x00, 0x24, 0x54, 0x10,
3216 0x09, 0x03, 0x01,
3217 0x10, 0x54, 0x30, 0x0C,
3218 0x24, 0x30, 0x0f,
3219};
3220
3221static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3222 0x00, 0x24, 0x54, 0x10,
3223 0x09, 0x07, 0x01, 0x0B,
3224 0x10, 0x54, 0x30, 0x0C,
3225 0x24, 0x30, 0x0f,
3226};
3227
3228static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3229 [0] = {
3230 .mode = MSM_SPM_MODE_CLOCK_GATING,
3231 .notify_rpm = false,
3232 .cmd = spm_wfi_cmd_sequence,
3233 },
3234 [1] = {
3235 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3236 .notify_rpm = false,
3237 .cmd = spm_power_collapse_without_rpm,
3238 },
3239 [2] = {
3240 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3241 .notify_rpm = true,
3242 .cmd = spm_power_collapse_with_rpm,
3243 },
3244};
3245
3246static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3247 [0] = {
3248 .reg_base_addr = MSM_SAW0_BASE,
3249 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3250 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3251 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3252#if defined(CONFIG_MSM_AVS_HW)
3253 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3254 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3255#endif
3256 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3257 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3258 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3259 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3260 .vctl_timeout_us = 50,
3261 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3262 .modes = msm_spm_seq_list,
3263 },
3264 [1] = {
3265 .reg_base_addr = MSM_SAW1_BASE,
3266 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3267 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3268 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3269#if defined(CONFIG_MSM_AVS_HW)
3270 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3271 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3272#endif
3273 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3274 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3275 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3276 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3277 .vctl_timeout_us = 50,
3278 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3279 .modes = msm_spm_seq_list,
3280 },
3281};
3282
3283static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3284 0x00, 0x20, 0x03, 0x20,
3285 0x00, 0x0f,
3286};
3287
3288static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3289 0x00, 0x20, 0x34, 0x64,
3290 0x48, 0x07, 0x48, 0x20,
3291 0x50, 0x64, 0x04, 0x34,
3292 0x50, 0x0f,
3293};
3294static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3295 0x00, 0x10, 0x34, 0x64,
3296 0x48, 0x07, 0x48, 0x10,
3297 0x50, 0x64, 0x04, 0x34,
3298 0x50, 0x0F,
3299};
3300
3301static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3302 [0] = {
3303 .mode = MSM_SPM_L2_MODE_RETENTION,
3304 .notify_rpm = false,
3305 .cmd = l2_spm_wfi_cmd_sequence,
3306 },
3307 [1] = {
3308 .mode = MSM_SPM_L2_MODE_GDHS,
3309 .notify_rpm = true,
3310 .cmd = l2_spm_gdhs_cmd_sequence,
3311 },
3312 [2] = {
3313 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3314 .notify_rpm = true,
3315 .cmd = l2_spm_power_off_cmd_sequence,
3316 },
3317};
3318
3319
3320static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3321 [0] = {
3322 .reg_base_addr = MSM_SAW_L2_BASE,
3323 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3324 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3325 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3326 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3327 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3328 .modes = msm_spm_l2_seq_list,
3329 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3330 },
3331};
3332
Mohan Pallaka5e490392011-09-09 15:18:41 +05303333#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3334#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3335
3336static struct msm_xo_voter *xo_handle_d1;
3337
3338static int isa1200_power(int on)
3339{
3340 int rc = 0;
3341
3342 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3343
3344 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3345 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3346 if (rc < 0) {
3347 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3348 __func__, on ? "" : "de-", rc);
3349 goto err_xo_vote;
3350 }
3351
3352 return 0;
3353
3354err_xo_vote:
3355 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3356 return rc;
3357}
3358
3359static int isa1200_dev_setup(bool enable)
3360{
3361 int rc = 0;
3362
3363 struct pm_gpio hap_gpio_config = {
3364 .direction = PM_GPIO_DIR_OUT,
3365 .pull = PM_GPIO_PULL_NO,
3366 .out_strength = PM_GPIO_STRENGTH_HIGH,
3367 .function = PM_GPIO_FUNC_NORMAL,
3368 .inv_int_pol = 0,
3369 .vin_sel = 2,
3370 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3371 .output_value = 0,
3372 };
3373
3374 if (enable == true) {
3375 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3376 if (rc) {
3377 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3378 __func__, PM_HAP_EN_GPIO, rc);
3379 return rc;
3380 }
3381
3382 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3383 if (rc) {
3384 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3385 __func__, PM_HAP_LEN_GPIO, rc);
3386 return rc;
3387 }
3388
3389 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3390 if (rc) {
3391 pr_err("%s: unable to request gpio %d (%d)\n",
3392 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3393 return rc;
3394 }
3395
3396 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3397 if (rc) {
3398 pr_err("%s: Unable to set direction\n", __func__);
3399 goto free_gpio;
3400 }
3401
3402 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3403 if (IS_ERR(xo_handle_d1)) {
3404 rc = PTR_ERR(xo_handle_d1);
3405 pr_err("%s: failed to get the handle for D1(%d)\n",
3406 __func__, rc);
3407 goto gpio_set_dir;
3408 }
3409 } else {
3410 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3411
3412 msm_xo_put(xo_handle_d1);
3413 }
3414
3415 return 0;
3416
3417gpio_set_dir:
3418 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3419free_gpio:
3420 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3421 return rc;
3422}
3423
3424static struct isa1200_regulator isa1200_reg_data[] = {
3425 {
3426 .name = "vcc_i2c",
3427 .min_uV = ISA_I2C_VTG_MIN_UV,
3428 .max_uV = ISA_I2C_VTG_MAX_UV,
3429 .load_uA = ISA_I2C_CURR_UA,
3430 },
3431};
3432
3433static struct isa1200_platform_data isa1200_1_pdata = {
3434 .name = "vibrator",
3435 .dev_setup = isa1200_dev_setup,
3436 .power_on = isa1200_power,
3437 .hap_en_gpio = PM_HAP_EN_GPIO,
3438 .hap_len_gpio = PM_HAP_LEN_GPIO,
3439 .max_timeout = 15000,
3440 .mode_ctrl = PWM_GEN_MODE,
3441 .pwm_fd = {
3442 .pwm_div = 256,
3443 },
3444 .is_erm = false,
3445 .smart_en = true,
3446 .ext_clk_en = true,
3447 .chip_en = 1,
3448 .regulator_info = isa1200_reg_data,
3449 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3450};
3451
3452static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3453 {
3454 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3455 .platform_data = &isa1200_1_pdata,
3456 },
3457};
3458
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003459#define CYTTSP_TS_GPIO_IRQ 11
3460#define CYTTSP_TS_SLEEP_GPIO 50
3461#define CYTTSP_TS_RESOUT_N_GPIO 52
3462
3463/*virtual key support */
3464static ssize_t tma340_vkeys_show(struct kobject *kobj,
3465 struct kobj_attribute *attr, char *buf)
3466{
3467 return snprintf(buf, 200,
3468 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3469 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3470 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3471 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3472 "\n");
3473}
3474
3475static struct kobj_attribute tma340_vkeys_attr = {
3476 .attr = {
3477 .mode = S_IRUGO,
3478 },
3479 .show = &tma340_vkeys_show,
3480};
3481
3482static struct attribute *tma340_properties_attrs[] = {
3483 &tma340_vkeys_attr.attr,
3484 NULL
3485};
3486
3487static struct attribute_group tma340_properties_attr_group = {
3488 .attrs = tma340_properties_attrs,
3489};
3490
3491
3492static int cyttsp_platform_init(struct i2c_client *client)
3493{
3494 int rc = 0;
3495 static struct kobject *tma340_properties_kobj;
3496
3497 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3498 tma340_properties_kobj = kobject_create_and_add("board_properties",
3499 NULL);
3500 if (tma340_properties_kobj)
3501 rc = sysfs_create_group(tma340_properties_kobj,
3502 &tma340_properties_attr_group);
3503 if (!tma340_properties_kobj || rc)
3504 pr_err("%s: failed to create board_properties\n",
3505 __func__);
3506
3507 return 0;
3508}
3509
3510static struct cyttsp_regulator regulator_data[] = {
3511 {
3512 .name = "vdd",
3513 .min_uV = CY_TMA300_VTG_MIN_UV,
3514 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303515 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3516 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003517 },
3518 /* TODO: Remove after runtime PM is enabled in I2C driver */
3519 {
3520 .name = "vcc_i2c",
3521 .min_uV = CY_I2C_VTG_MIN_UV,
3522 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303523 .hpm_load_uA = CY_I2C_CURR_UA,
3524 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003525 },
3526};
3527
3528static struct cyttsp_platform_data cyttsp_pdata = {
3529 .panel_maxx = 634,
3530 .panel_maxy = 1166,
3531 .disp_maxx = 616,
3532 .disp_maxy = 1023,
3533 .disp_minx = 0,
3534 .disp_miny = 16,
3535 .flags = 0x01,
3536 .gen = CY_GEN3, /* or */
3537 .use_st = CY_USE_ST,
3538 .use_mt = CY_USE_MT,
3539 .use_hndshk = CY_SEND_HNDSHK,
3540 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303541 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003542 .use_gestures = CY_USE_GESTURES,
3543 .fw_fname = "cyttsp_8960_cdp.hex",
3544 /* activate up to 4 groups
3545 * and set active distance
3546 */
3547 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3548 CY_GEST_GRP3 | CY_GEST_GRP4 |
3549 CY_ACT_DIST,
3550 /* change act_intrvl to customize the Active power state
3551 * scanning/processing refresh interval for Operating mode
3552 */
3553 .act_intrvl = CY_ACT_INTRVL_DFLT,
3554 /* change tch_tmout to customize the touch timeout for the
3555 * Active power state for Operating mode
3556 */
3557 .tch_tmout = CY_TCH_TMOUT_DFLT,
3558 /* change lp_intrvl to customize the Low Power power state
3559 * scanning/processing refresh interval for Operating mode
3560 */
3561 .lp_intrvl = CY_LP_INTRVL_DFLT,
3562 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3563 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3564 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3565 .regulator_info = regulator_data,
3566 .num_regulators = ARRAY_SIZE(regulator_data),
3567 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303568 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003569};
3570
3571static struct i2c_board_info cyttsp_info[] __initdata = {
3572 {
3573 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3574 .platform_data = &cyttsp_pdata,
3575#ifndef CY_USE_TIMER
3576 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3577#endif /* CY_USE_TIMER */
3578 },
3579};
3580
Mohan Pallaka50837382011-09-07 11:00:57 +05303581/* configuration data */
3582static const u8 mxt_config_data[] = {
3583 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003584 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303585 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003586 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07003587 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3588 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3589 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3591 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3592 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303593 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003594 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303595 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003596 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05303597 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003598 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
3599 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
3600 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
3601 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303602 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003603 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3604 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303605 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003606 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3607 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303608 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003609 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3610 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303611 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003612 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3613 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303614 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003615 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303616 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003617 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303618 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003619 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303620 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003621 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303622 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003623 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303624};
3625
3626#define MXT_TS_GPIO_IRQ 11
3627#define MXT_TS_LDO_EN_GPIO 50
3628#define MXT_TS_RESET_GPIO 52
3629
3630static void mxt_init_hw_liquid(void)
3631{
3632 int rc;
3633
3634 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3635 if (rc) {
3636 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3637 __func__, MXT_TS_GPIO_IRQ);
3638 return;
3639 }
3640
3641 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3642 if (rc) {
3643 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3644 __func__, MXT_TS_GPIO_IRQ);
3645 goto err_irq_gpio_req;
3646 }
3647
3648 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3649 if (rc) {
3650 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3651 __func__, MXT_TS_LDO_EN_GPIO);
3652 goto err_irq_gpio_req;
3653 }
3654
3655 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3656 if (rc) {
3657 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3658 __func__, MXT_TS_LDO_EN_GPIO);
3659 goto err_ldo_gpio_req;
3660 }
3661
3662 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3663 if (rc) {
3664 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3665 __func__, MXT_TS_RESET_GPIO);
3666 goto err_ldo_gpio_set_dir;
3667 }
3668
3669 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3670 if (rc) {
3671 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3672 __func__, MXT_TS_RESET_GPIO);
3673 goto err_reset_gpio_req;
3674 }
3675
3676 return;
3677
3678err_reset_gpio_req:
3679 gpio_free(MXT_TS_RESET_GPIO);
3680err_ldo_gpio_set_dir:
3681 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3682err_ldo_gpio_req:
3683 gpio_free(MXT_TS_LDO_EN_GPIO);
3684err_irq_gpio_req:
3685 gpio_free(MXT_TS_GPIO_IRQ);
3686}
3687
3688static struct mxt_platform_data mxt_platform_data = {
3689 .config = mxt_config_data,
3690 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003691 .x_size = 1365,
3692 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303693 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003694 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303695};
3696
3697static struct i2c_board_info mxt_device_info[] __initdata = {
3698 {
3699 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3700 .platform_data = &mxt_platform_data,
3701 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3702 },
3703};
3704
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003705static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3706{
3707}
3708
3709static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3710 .clk_freq = 100000,
3711 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003712 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3713};
3714
3715static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3716 .clk_freq = 100000,
3717 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003718 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3719};
3720
3721static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3722 .clk_freq = 100000,
3723 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003724 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3725};
3726
3727static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3728 .clk_freq = 100000,
3729 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003730 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3731};
3732
3733static struct msm_rpm_platform_data msm_rpm_data = {
3734 .reg_base_addrs = {
3735 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3736 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3737 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3738 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3739 },
3740
3741 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3742 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3743 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3744 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3745 .msm_apps_ipc_rpm_val = 4,
3746};
3747
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003748static struct ks8851_pdata spi_eth_pdata = {
3749 .irq_gpio = KS8851_IRQ_GPIO,
3750 .rst_gpio = KS8851_RST_GPIO,
3751};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003752
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003753static struct spi_board_info spi_board_info[] __initdata = {
3754 {
3755 .modalias = "ks8851",
3756 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3757 .max_speed_hz = 19200000,
3758 .bus_num = 0,
3759 .chip_select = 0,
3760 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003761 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003762 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003763 {
3764 .modalias = "dsi_novatek_3d_panel_spi",
3765 .max_speed_hz = 10800000,
3766 .bus_num = 0,
3767 .chip_select = 1,
3768 .mode = SPI_MODE_0,
3769 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003770};
3771
3772static struct platform_device msm_device_saw_core0 = {
3773 .name = "saw-regulator",
3774 .id = 0,
3775 .dev = {
3776 .platform_data = &msm_saw_regulator_pdata_s5,
3777 },
3778};
3779
3780static struct platform_device msm_device_saw_core1 = {
3781 .name = "saw-regulator",
3782 .id = 1,
3783 .dev = {
3784 .platform_data = &msm_saw_regulator_pdata_s6,
3785 },
3786};
3787
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003788#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3789static struct platform_device wfd_device = {
3790 .name = "msm_wfd",
3791 .id = -1,
3792};
3793#endif
3794
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003795static struct tsens_platform_data msm_tsens_pdata = {
3796 .slope = 910,
3797 .tsens_factor = 1000,
3798 .hw_type = MSM_8960,
3799 .tsens_num_sensor = 5,
3800};
3801
3802static struct platform_device msm_tsens_device = {
3803 .name = "tsens8960-tm",
3804 .id = -1,
3805 .dev = {
3806 .platform_data = &msm_tsens_pdata,
3807 },
3808};
3809
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003810#ifdef CONFIG_MSM_FAKE_BATTERY
3811static struct platform_device fish_battery_device = {
3812 .name = "fish_battery",
3813};
3814#endif
3815
David Collins26f05562011-06-20 09:56:28 -07003816static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003817 .name = GPIO_REGULATOR_DEV_NAME,
3818 .id = PM8921_MPP_PM_TO_SYS(7),
3819 .dev = {
3820 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3821 },
3822};
3823
David Collins26f05562011-06-20 09:56:28 -07003824static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003825 .name = GPIO_REGULATOR_DEV_NAME,
3826 .id = 91,
3827 .dev = {
3828 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3829 },
3830};
3831
David Collinsb10be1d2011-09-02 10:29:31 -07003832static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3833 .name = GPIO_REGULATOR_DEV_NAME,
3834 .id = PM8921_GPIO_PM_TO_SYS(17),
3835 .dev = {
3836 .platform_data =
3837 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3838 },
3839};
3840
David Collins26f05562011-06-20 09:56:28 -07003841static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3842 .name = "rpm-regulator",
3843 .id = -1,
3844 .dev = {
3845 .platform_data = &msm_rpm_regulator_pdata,
3846 },
3847};
3848
David Collins4c31a872011-08-31 10:07:10 -07003849static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3850 .phys_addr_base = 0x0010C000,
3851 .reg_offsets = {
3852 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3853 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3854 },
3855 .phys_size = SZ_8K,
3856 .log_len = 4096, /* log's buffer length in bytes */
3857 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3858};
3859
3860static struct platform_device msm_rpm_log_device = {
3861 .name = "msm_rpm_log",
3862 .id = -1,
3863 .dev = {
3864 .platform_data = &msm_rpm_log_pdata,
3865 },
3866};
3867
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003868static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003869 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003870 &msm_device_smd,
3871 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303872 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003873 &msm_device_saw_core0,
3874 &msm_device_saw_core1,
3875 &msm8960_device_ext_5v_vreg,
3876 &msm8960_device_ext_l2_vreg,
3877 &msm8960_device_ssbi_pm8921,
3878 &msm8960_device_qup_spi_gsbi1,
3879 &msm8960_device_qup_i2c_gsbi3,
3880 &msm8960_device_qup_i2c_gsbi4,
3881 &msm8960_device_qup_i2c_gsbi10,
3882#ifndef CONFIG_MSM_DSPS
3883 &msm8960_device_qup_i2c_gsbi12,
3884#endif
3885 &msm_slim_ctrl,
3886 &msm_device_wcnss_wlan,
3887#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3888 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3889 &qcrypto_device,
3890#endif
3891
3892#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3893 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3894 &qcedev_device,
3895#endif
3896#ifdef CONFIG_MSM_ROTATOR
3897 &msm_rotator_device,
3898#endif
3899 &msm_device_sps,
3900#ifdef CONFIG_MSM_FAKE_BATTERY
3901 &fish_battery_device,
3902#endif
3903#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003904#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003905 &android_pmem_device,
3906 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003907#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003908 &android_pmem_audio_device,
3909#endif
3910 &msm_fb_device,
3911 &msm_device_vidc,
3912 &msm_device_bam_dmux,
3913 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003914
3915#ifdef CONFIG_HW_RANDOM_MSM
3916 &msm_device_rng,
3917#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003918 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003919#ifdef CONFIG_ION_MSM
3920 &ion_dev,
3921#endif
David Collins4c31a872011-08-31 10:07:10 -07003922 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003923 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003924#ifdef CONFIG_MSM_QDSS
3925 &msm_etb_device,
3926 &msm_tpiu_device,
3927 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003928 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003929 &msm_ptm_device,
3930#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003931 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003932 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003933#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3934 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003935 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003936#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003937};
3938
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003939static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003940 &msm8960_device_otg,
3941 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003942 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303943 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003944 &android_usb_device,
3945 &msm_device_vidc,
3946 &mipi_dsi_simulator_panel_device,
3947 &msm_bus_apps_fabric,
3948 &msm_bus_sys_fabric,
3949 &msm_bus_mm_fabric,
3950 &msm_bus_sys_fpb,
3951 &msm_bus_cpss_fpb,
3952 &msm_pcm,
3953 &msm_pcm_routing,
3954 &msm_cpudai0,
3955 &msm_cpudai1,
3956 &msm_cpudai_hdmi_rx,
3957 &msm_cpudai_bt_rx,
3958 &msm_cpudai_bt_tx,
3959 &msm_cpudai_fm_rx,
3960 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003961 &msm_cpudai_auxpcm_rx,
3962 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003963 &msm_cpu_fe,
3964 &msm_stub_codec,
3965 &msm_voice,
3966 &msm_voip,
3967 &msm_lpa_pcm,
3968
3969#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3970 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3971 &qcrypto_device,
3972#endif
3973
3974#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3975 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3976 &qcedev_device,
3977#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003978};
3979
3980static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003981 &msm_kgsl_3d0,
3982 &msm_kgsl_2d0,
3983 &msm_kgsl_2d1,
3984 &mipi_dsi_renesas_panel_device,
3985#ifdef CONFIG_MSM_GEMINI
3986 &msm8960_gemini_device,
3987#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003988};
3989
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003990static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003991 &msm8960_device_otg,
3992 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003993 &msm_device_hsusb_host,
3994 &android_usb_device,
3995 &msm_pcm,
3996 &msm_pcm_routing,
3997 &msm_cpudai0,
3998 &msm_cpudai1,
3999 &msm_cpudai_hdmi_rx,
4000 &msm_cpudai_bt_rx,
4001 &msm_cpudai_bt_tx,
4002 &msm_cpudai_fm_rx,
4003 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004004 &msm_cpudai_auxpcm_rx,
4005 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004006 &msm_cpu_fe,
4007 &msm_stub_codec,
4008 &msm_kgsl_3d0,
4009#ifdef CONFIG_MSM_KGSL_2D
4010 &msm_kgsl_2d0,
4011 &msm_kgsl_2d1,
4012#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004013 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004014#ifdef CONFIG_MSM_GEMINI
4015 &msm8960_gemini_device,
4016#endif
4017 &msm_voice,
4018 &msm_voip,
4019 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304020 &msm_cpudai_afe_01_rx,
4021 &msm_cpudai_afe_01_tx,
4022 &msm_cpudai_afe_02_rx,
4023 &msm_cpudai_afe_02_tx,
4024 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004025#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4026 &hdmi_msm_device,
4027#endif
4028 &msm_pcm_hostless,
4029 &msm_bus_apps_fabric,
4030 &msm_bus_sys_fabric,
4031 &msm_bus_mm_fabric,
4032 &msm_bus_sys_fpb,
4033 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004034 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004035};
4036
4037static void __init msm8960_i2c_init(void)
4038{
4039 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4040 &msm8960_i2c_qup_gsbi4_pdata;
4041
4042 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4043 &msm8960_i2c_qup_gsbi3_pdata;
4044
4045 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4046 &msm8960_i2c_qup_gsbi10_pdata;
4047
4048 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4049 &msm8960_i2c_qup_gsbi12_pdata;
4050}
4051
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004052static void __init msm8960_gfx_init(void)
4053{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004054 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004055 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4056 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4057 msm_kgsl_3d0.dev.platform_data;
4058 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
4059 320000000;
4060 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
4061 266667000;
4062 }
4063}
4064
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004065static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4066 .irq_base = PM8921_IRQ_BASE,
4067 .devirq = MSM_GPIO_TO_INT(104),
4068 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4069};
4070
4071static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4072 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4073};
4074
4075static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4076 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4077};
4078
4079static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4080 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304081 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004082};
4083
4084static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4085 .pull_up = 1,
4086 .kpd_trigger_delay_us = 970,
4087 .wakeup = 1,
4088};
4089
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304090/* Rotate lock key is not available so use F1 */
4091#define KEY_ROTATE_LOCK KEY_F1
4092
4093static const unsigned int keymap_liquid[] = {
4094 KEY(0, 0, KEY_VOLUMEUP),
4095 KEY(0, 1, KEY_VOLUMEDOWN),
4096 KEY(1, 3, KEY_ROTATE_LOCK),
4097 KEY(1, 4, KEY_HOME),
4098};
4099
4100static struct matrix_keymap_data keymap_data_liquid = {
4101 .keymap_size = ARRAY_SIZE(keymap_liquid),
4102 .keymap = keymap_liquid,
4103};
4104
4105static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4106 .input_name = "keypad_8960_liquid",
4107 .input_phys_device = "keypad_8960/input0",
4108 .num_rows = 2,
4109 .num_cols = 5,
4110 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4111 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4112 .debounce_ms = 15,
4113 .scan_delay_ms = 32,
4114 .row_hold_ns = 91500,
4115 .wakeup = 1,
4116 .keymap_data = &keymap_data_liquid,
4117};
4118
4119
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004120static const unsigned int keymap[] = {
4121 KEY(0, 0, KEY_VOLUMEUP),
4122 KEY(0, 1, KEY_VOLUMEDOWN),
4123 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4124 KEY(0, 3, KEY_CAMERA_FOCUS),
4125};
4126
4127static struct matrix_keymap_data keymap_data = {
4128 .keymap_size = ARRAY_SIZE(keymap),
4129 .keymap = keymap,
4130};
4131
4132static struct pm8xxx_keypad_platform_data keypad_data = {
4133 .input_name = "keypad_8960",
4134 .input_phys_device = "keypad_8960/input0",
4135 .num_rows = 1,
4136 .num_cols = 5,
4137 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4138 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4139 .debounce_ms = 15,
4140 .scan_delay_ms = 32,
4141 .row_hold_ns = 91500,
4142 .wakeup = 1,
4143 .keymap_data = &keymap_data,
4144};
4145
4146static const unsigned int keymap_sim[] = {
4147 KEY(0, 0, KEY_7),
4148 KEY(0, 1, KEY_DOWN),
4149 KEY(0, 2, KEY_UP),
4150 KEY(0, 3, KEY_RIGHT),
4151 KEY(0, 4, KEY_ENTER),
4152 KEY(0, 5, KEY_L),
4153 KEY(0, 6, KEY_BACK),
4154 KEY(0, 7, KEY_M),
4155
4156 KEY(1, 0, KEY_LEFT),
4157 KEY(1, 1, KEY_SEND),
4158 KEY(1, 2, KEY_1),
4159 KEY(1, 3, KEY_4),
4160 KEY(1, 4, KEY_CLEAR),
4161 KEY(1, 5, KEY_MSDOS),
4162 KEY(1, 6, KEY_SPACE),
4163 KEY(1, 7, KEY_COMMA),
4164
4165 KEY(2, 0, KEY_6),
4166 KEY(2, 1, KEY_5),
4167 KEY(2, 2, KEY_8),
4168 KEY(2, 3, KEY_3),
4169 KEY(2, 4, KEY_NUMERIC_STAR),
4170 KEY(2, 5, KEY_UP),
4171 KEY(2, 6, KEY_DOWN),
4172 KEY(2, 7, KEY_LEFTSHIFT),
4173
4174 KEY(3, 0, KEY_9),
4175 KEY(3, 1, KEY_NUMERIC_POUND),
4176 KEY(3, 2, KEY_0),
4177 KEY(3, 3, KEY_2),
4178 KEY(3, 4, KEY_SLEEP),
4179 KEY(3, 5, KEY_F1),
4180 KEY(3, 6, KEY_F2),
4181 KEY(3, 7, KEY_F3),
4182
4183 KEY(4, 0, KEY_BACK),
4184 KEY(4, 1, KEY_HOME),
4185 KEY(4, 2, KEY_MENU),
4186 KEY(4, 3, KEY_VOLUMEUP),
4187 KEY(4, 4, KEY_VOLUMEDOWN),
4188 KEY(4, 5, KEY_F4),
4189 KEY(4, 6, KEY_F5),
4190 KEY(4, 7, KEY_F6),
4191
4192 KEY(5, 0, KEY_R),
4193 KEY(5, 1, KEY_T),
4194 KEY(5, 2, KEY_Y),
4195 KEY(5, 3, KEY_LEFTALT),
4196 KEY(5, 4, KEY_KPENTER),
4197 KEY(5, 5, KEY_Q),
4198 KEY(5, 6, KEY_W),
4199 KEY(5, 7, KEY_E),
4200
4201 KEY(6, 0, KEY_F),
4202 KEY(6, 1, KEY_G),
4203 KEY(6, 2, KEY_H),
4204 KEY(6, 3, KEY_CAPSLOCK),
4205 KEY(6, 4, KEY_PAGEUP),
4206 KEY(6, 5, KEY_A),
4207 KEY(6, 6, KEY_S),
4208 KEY(6, 7, KEY_D),
4209
4210 KEY(7, 0, KEY_V),
4211 KEY(7, 1, KEY_B),
4212 KEY(7, 2, KEY_N),
4213 KEY(7, 3, KEY_MENU),
4214 KEY(7, 4, KEY_PAGEDOWN),
4215 KEY(7, 5, KEY_Z),
4216 KEY(7, 6, KEY_X),
4217 KEY(7, 7, KEY_C),
4218
4219 KEY(8, 0, KEY_P),
4220 KEY(8, 1, KEY_J),
4221 KEY(8, 2, KEY_K),
4222 KEY(8, 3, KEY_INSERT),
4223 KEY(8, 4, KEY_LINEFEED),
4224 KEY(8, 5, KEY_U),
4225 KEY(8, 6, KEY_I),
4226 KEY(8, 7, KEY_O),
4227
4228 KEY(9, 0, KEY_4),
4229 KEY(9, 1, KEY_5),
4230 KEY(9, 2, KEY_6),
4231 KEY(9, 3, KEY_7),
4232 KEY(9, 4, KEY_8),
4233 KEY(9, 5, KEY_1),
4234 KEY(9, 6, KEY_2),
4235 KEY(9, 7, KEY_3),
4236
4237 KEY(10, 0, KEY_F7),
4238 KEY(10, 1, KEY_F8),
4239 KEY(10, 2, KEY_F9),
4240 KEY(10, 3, KEY_F10),
4241 KEY(10, 4, KEY_FN),
4242 KEY(10, 5, KEY_9),
4243 KEY(10, 6, KEY_0),
4244 KEY(10, 7, KEY_DOT),
4245
4246 KEY(11, 0, KEY_LEFTCTRL),
4247 KEY(11, 1, KEY_F11),
4248 KEY(11, 2, KEY_ENTER),
4249 KEY(11, 3, KEY_SEARCH),
4250 KEY(11, 4, KEY_DELETE),
4251 KEY(11, 5, KEY_RIGHT),
4252 KEY(11, 6, KEY_LEFT),
4253 KEY(11, 7, KEY_RIGHTSHIFT),
4254 KEY(0, 0, KEY_VOLUMEUP),
4255 KEY(0, 1, KEY_VOLUMEDOWN),
4256 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4257 KEY(0, 3, KEY_CAMERA_FOCUS),
4258};
4259
4260static struct matrix_keymap_data keymap_data_sim = {
4261 .keymap_size = ARRAY_SIZE(keymap_sim),
4262 .keymap = keymap_sim,
4263};
4264
4265static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4266 .input_name = "keypad_8960",
4267 .input_phys_device = "keypad_8960/input0",
4268 .num_rows = 12,
4269 .num_cols = 8,
4270 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4271 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4272 .debounce_ms = 15,
4273 .scan_delay_ms = 32,
4274 .row_hold_ns = 91500,
4275 .wakeup = 1,
4276 .keymap_data = &keymap_data_sim,
4277};
4278
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004279static int pm8921_therm_mitigation[] = {
4280 1100,
4281 700,
4282 600,
4283 325,
4284};
4285
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004286static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004287 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004288 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004289 .max_voltage = 4200,
4290 .min_voltage = 3200,
Abhijeet Dharmapurikard55878e2011-10-27 10:22:24 -07004291 .resume_voltage_delta = 100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004292 .term_current = 100,
4293 .cool_temp = 10,
4294 .warm_temp = 40,
4295 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004296 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004297 .cool_bat_chg_current = 350,
4298 .warm_bat_chg_current = 350,
4299 .cool_bat_voltage = 4100,
4300 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004301 .thermal_mitigation = pm8921_therm_mitigation,
4302 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004303};
4304
4305static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4306 .priority = 0,
4307};
4308
4309static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4310 .r_sense = 10,
4311 .i_test = 2500,
4312 .v_failure = 3000,
4313 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004314};
4315
Jay Chokshide4cefb2011-08-04 18:10:44 -07004316#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004317#define PM8XXX_LED_PWM_PERIOD 1000
4318#define PM8XXX_LED_PWM_DUTY_MS 20
4319/**
4320 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4321 * driven using PWM feature.
4322 */
4323#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004324
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004325static struct led_info pm8921_led_info[] = {
4326 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004327 .name = "led:battery_charging",
4328 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004329 },
4330 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004331 .name = "led:battery_full",
4332 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004333 },
4334};
4335
Jay Chokshi8994e392011-09-14 18:20:39 -07004336static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004337 .num_leds = ARRAY_SIZE(pm8921_led_info),
4338 .leds = pm8921_led_info,
4339};
4340
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004341static int pm8921_led0_pwm_duty_pcts[56] = {
4342 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4343 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4344 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4345 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4346 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4347 14, 10, 6, 4, 1
4348};
4349
4350static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4351 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4352 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4353 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4354 .start_idx = 0,
4355};
4356
Jay Chokshi8994e392011-09-14 18:20:39 -07004357static struct pm8xxx_led_config pm8921_led_configs[] = {
4358 [0] = {
4359 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004360 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004361 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004362 .pwm_channel = 5,
4363 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4364 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004365 },
4366 [1] = {
4367 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004368 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004369 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004370 .pwm_channel = 4,
4371 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004372 },
4373};
4374
4375static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4376 .led_core = &pm8921_led_core_pdata,
4377 .configs = pm8921_led_configs,
4378 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4379};
4380
Abhijeet Dharmapurikar82d93982011-11-09 15:52:25 -08004381static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
4382 .r_sense = 10,
4383};
4384
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004385static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4386 .irq_pdata = &pm8xxx_irq_pdata,
4387 .gpio_pdata = &pm8xxx_gpio_pdata,
4388 .mpp_pdata = &pm8xxx_mpp_pdata,
4389 .rtc_pdata = &pm8xxx_rtc_pdata,
4390 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4391 .keypad_pdata = &keypad_data,
4392 .misc_pdata = &pm8xxx_misc_pdata,
4393 .regulator_pdatas = msm_pm8921_regulator_pdata,
4394 .charger_pdata = &pm8921_chg_pdata,
4395 .bms_pdata = &pm8921_bms_pdata,
4396 .adc_pdata = &pm8921_adc_pdata,
4397 .leds_pdata = &pm8xxx_leds_pdata,
Abhijeet Dharmapurikar82d93982011-11-09 15:52:25 -08004398 .ccadc_pdata = &pm8xxx_ccadc_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004399};
4400
4401static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4402 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4403 .slave = {
4404 .name = "pm8921-core",
4405 .platform_data = &pm8921_platform_data,
4406 },
4407};
4408
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004409static struct msm_cpuidle_state msm_cstates[] __initdata = {
4410 {0, 0, "C0", "WFI",
4411 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4412
4413 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4414 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4415
4416 {0, 2, "C2", "POWER_COLLAPSE",
4417 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4418
4419 {1, 0, "C0", "WFI",
4420 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4421
4422 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4423 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4424};
4425
4426static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4427 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4428 .idle_supported = 1,
4429 .suspend_supported = 1,
4430 .idle_enabled = 0,
4431 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004432 },
4433
4434 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4435 .idle_supported = 1,
4436 .suspend_supported = 1,
4437 .idle_enabled = 0,
4438 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004439 },
4440
4441 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4442 .idle_supported = 1,
4443 .suspend_supported = 1,
4444 .idle_enabled = 1,
4445 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004446 },
4447
4448 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4449 .idle_supported = 0,
4450 .suspend_supported = 1,
4451 .idle_enabled = 0,
4452 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004453 },
4454
4455 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4456 .idle_supported = 1,
4457 .suspend_supported = 1,
4458 .idle_enabled = 0,
4459 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004460 },
4461
4462 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4463 .idle_supported = 1,
4464 .suspend_supported = 0,
4465 .idle_enabled = 1,
4466 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004467 },
4468};
4469
4470static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4471 {
4472 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4473 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4474 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004475 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004476 },
4477
4478 {
4479 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4480 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4481 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004482 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004483 },
4484
4485 {
4486 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4487 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4488 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004489 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004490 },
4491
4492 {
4493 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4494 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4495 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004496 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004497 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004498 {
4499 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4500 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4501 false,
4502 7000, 3500, 66600000, 5150,
4503 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004504
4505 {
4506 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4507 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4508 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004509 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004510 },
4511
4512 {
4513 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4514 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4515 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004516 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004517 },
4518
4519 {
4520 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4521 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4522 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004523 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004524 },
4525
4526 {
4527 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4528 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4529 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004530 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004531 },
4532};
4533
4534#ifdef CONFIG_I2C
4535#define I2C_SURF 1
4536#define I2C_FFA (1 << 1)
4537#define I2C_RUMI (1 << 2)
4538#define I2C_SIM (1 << 3)
4539#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004540#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004541
4542struct i2c_registry {
4543 u8 machs;
4544 int bus;
4545 struct i2c_board_info *info;
4546 int len;
4547};
4548
4549#ifdef CONFIG_MSM_CAMERA
4550static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4551#ifdef CONFIG_IMX074
4552 {
4553 I2C_BOARD_INFO("imx074", 0x1A),
4554 },
4555#endif
4556#ifdef CONFIG_OV2720
4557 {
4558 I2C_BOARD_INFO("ov2720", 0x6C),
4559 },
4560#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05304561#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4562 {
4563 I2C_BOARD_INFO("sc628a", 0x6E),
4564 },
4565#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566};
4567#endif
4568
4569/* Sensors DSPS platform data */
4570#ifdef CONFIG_MSM_DSPS
4571#define DSPS_PIL_GENERIC_NAME "dsps"
4572#endif /* CONFIG_MSM_DSPS */
4573
4574static void __init msm8960_init_dsps(void)
4575{
4576#ifdef CONFIG_MSM_DSPS
4577 struct msm_dsps_platform_data *pdata =
4578 msm_dsps_device.dev.platform_data;
4579 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4580 pdata->gpios = NULL;
4581 pdata->gpios_num = 0;
4582
4583 platform_device_register(&msm_dsps_device);
4584#endif /* CONFIG_MSM_DSPS */
4585}
4586
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004587static void __init msm8960_init_hsic(void)
4588{
4589#ifdef CONFIG_USB_EHCI_MSM_HSIC
4590 uint32_t version = socinfo_get_version();
4591
4592 pr_info("%s: version:%d mtp:%d\n", __func__,
4593 SOCINFO_VERSION_MAJOR(version),
4594 machine_is_msm8960_mtp());
4595
4596 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4597 machine_is_msm8960_mtp() ||
4598 machine_is_msm8960_fluid())
4599 return;
4600
4601 msm_gpiomux_install(msm8960_hsic_configs,
4602 ARRAY_SIZE(msm8960_hsic_configs));
4603
4604 platform_device_register(&msm_device_hsic_host);
4605#endif
4606}
4607
4608
Amir Samuelov5137e392011-09-21 17:31:25 +03004609#ifdef CONFIG_ISL9519_CHARGER
4610static struct isl_platform_data isl_data __initdata = {
4611 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4612 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4613 .max_system_voltage = 4200,
4614 .min_system_voltage = 3200,
4615 .chgcurrent = 1000, /* 1900, */
4616 .term_current = 400, /* Need fine tuning */
4617 .input_current = 2048,
4618};
4619
4620static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4621 {
4622 I2C_BOARD_INFO("isl9519q", 0x9),
4623 .irq = 0, /* Not required when notify-by-pmic */
4624 .platform_data = &isl_data,
4625 },
4626};
4627#endif /* CONFIG_ISL9519_CHARGER */
4628
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004629static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4630#ifdef CONFIG_MSM_CAMERA
4631 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004632 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004633 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4634 msm_camera_boardinfo,
4635 ARRAY_SIZE(msm_camera_boardinfo),
4636 },
4637#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004638#ifdef CONFIG_ISL9519_CHARGER
4639 {
4640 I2C_LIQUID,
4641 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4642 isl_charger_i2c_info,
4643 ARRAY_SIZE(isl_charger_i2c_info),
4644 },
4645#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004646 {
4647 I2C_SURF | I2C_FFA | I2C_FLUID,
4648 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4649 cyttsp_info,
4650 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004651 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304652 {
4653 I2C_LIQUID,
4654 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4655 mxt_device_info,
4656 ARRAY_SIZE(mxt_device_info),
4657 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304658 {
4659 I2C_LIQUID,
4660 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4661 msm_isa1200_board_info,
4662 ARRAY_SIZE(msm_isa1200_board_info),
4663 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004664};
4665#endif /* CONFIG_I2C */
4666
4667static void __init register_i2c_devices(void)
4668{
4669#ifdef CONFIG_I2C
4670 u8 mach_mask = 0;
4671 int i;
4672
4673 /* Build the matching 'supported_machs' bitmask */
4674 if (machine_is_msm8960_cdp())
4675 mach_mask = I2C_SURF;
4676 else if (machine_is_msm8960_rumi3())
4677 mach_mask = I2C_RUMI;
4678 else if (machine_is_msm8960_sim())
4679 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004680 else if (machine_is_msm8960_fluid())
4681 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004682 else if (machine_is_msm8960_liquid())
4683 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004684 else if (machine_is_msm8960_mtp())
4685 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004686 else
4687 pr_err("unmatched machine ID in register_i2c_devices\n");
4688
4689 /* Run the array and install devices as appropriate */
4690 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4691 if (msm8960_i2c_devices[i].machs & mach_mask)
4692 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4693 msm8960_i2c_devices[i].info,
4694 msm8960_i2c_devices[i].len);
4695 }
4696#endif
4697}
4698
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004699static void __init msm8960_sim_init(void)
4700{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004701 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4702 &msm8960_device_watchdog.dev.platform_data;
4703
4704 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004705 BUG_ON(msm_rpm_init(&msm_rpm_data));
4706 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4707 ARRAY_SIZE(msm_rpmrs_levels)));
4708 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004709 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004710 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004711 msm8960_device_ssbi_pm8921.dev.platform_data =
4712 &msm8960_ssbi_pm8921_pdata;
4713 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004714
4715 /* Simulator supports a QWERTY keypad */
4716 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4717
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004718 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004719 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004720 msm8960_i2c_init();
4721 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4722 msm_spm_l2_init(msm_spm_l2_data);
4723 msm8960_init_buses();
4724 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4725 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004726 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004727 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004728
4729 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4730 &msm8960_qup_spi_gsbi1_pdata;
4731 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4732
4733 msm8960_init_mmc();
4734 msm_fb_add_devices();
4735 slim_register_board_info(msm_slim_devices,
4736 ARRAY_SIZE(msm_slim_devices));
4737 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4738 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4739 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4740 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004741 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004742}
4743
4744static void __init msm8960_rumi3_init(void)
4745{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004746 BUG_ON(msm_rpm_init(&msm_rpm_data));
4747 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4748 ARRAY_SIZE(msm_rpmrs_levels)));
4749 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004750 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004751 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004752 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004753 msm8960_device_ssbi_pm8921.dev.platform_data =
4754 &msm8960_ssbi_pm8921_pdata;
4755 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4756 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4757 &msm8960_qup_spi_gsbi1_pdata;
4758 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4759 msm8960_i2c_init();
4760 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4761 msm_spm_l2_init(msm_spm_l2_data);
4762 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4763 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004764 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004765 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004766 register_i2c_devices();
4767 msm_fb_add_devices();
4768 slim_register_board_info(msm_slim_devices,
4769 ARRAY_SIZE(msm_slim_devices));
4770 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4771 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4772 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4773 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004774 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004775}
4776
4777static void __init msm8960_cdp_init(void)
4778{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004779 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4780 pr_err("meminfo_init() failed!\n");
4781
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004782 BUG_ON(msm_rpm_init(&msm_rpm_data));
4783 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4784 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004785
4786 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004787 regulator_suppress_info_printing();
4788 if (msm_xo_init())
4789 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004790 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004791 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304792 if (machine_is_msm8960_liquid())
4793 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004794 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304795#ifdef CONFIG_USB_EHCI_MSM_HSIC
4796 if (machine_is_msm8960_liquid()) {
4797 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4798 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4799 }
4800#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304801 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004802 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304803 if (machine_is_msm8960_liquid())
4804 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004805 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4806 &msm8960_qup_spi_gsbi1_pdata;
4807 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4808 msm8960_device_ssbi_pm8921.dev.platform_data =
4809 &msm8960_ssbi_pm8921_pdata;
4810 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4811 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004812 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004813 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4814 msm_spm_l2_init(msm_spm_l2_data);
4815 msm8960_init_buses();
4816 platform_add_devices(msm_footswitch_devices,
4817 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004818 if (machine_is_msm8960_liquid())
4819 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004820 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4821 pm8921_gpio_mpp_init();
4822 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004823 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004824 msm8960_init_cam();
4825 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004826 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304827 if (machine_is_msm8960_liquid())
4828 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004829 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004830 msm_fb_add_devices();
4831 slim_register_board_info(msm_slim_devices,
4832 ARRAY_SIZE(msm_slim_devices));
4833 msm8960_init_dsps();
4834 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4835 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4836 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4837 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004838 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004839 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004840}
4841
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004842MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4843 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004844 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004845 .init_irq = msm8960_init_irq,
4846 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004847 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004848 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004849 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004850MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004851
4852MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4853 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004854 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004855 .init_irq = msm8960_init_irq,
4856 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004857 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004858 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004859 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004860MACHINE_END
4861
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004862MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4863 .map_io = msm8960_map_io,
4864 .reserve = msm8960_reserve,
4865 .init_irq = msm8960_init_irq,
4866 .timer = &msm_timer,
4867 .init_machine = msm8960_cdp_init,
4868 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004869 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004870MACHINE_END
4871
4872MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4873 .map_io = msm8960_map_io,
4874 .reserve = msm8960_reserve,
4875 .init_irq = msm8960_init_irq,
4876 .timer = &msm_timer,
4877 .init_machine = msm8960_cdp_init,
4878 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004879 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004880MACHINE_END
4881
4882MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4883 .map_io = msm8960_map_io,
4884 .reserve = msm8960_reserve,
4885 .init_irq = msm8960_init_irq,
4886 .timer = &msm_timer,
4887 .init_machine = msm8960_cdp_init,
4888 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004889 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004890MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004891
4892MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4893 .map_io = msm8960_map_io,
4894 .reserve = msm8960_reserve,
4895 .init_irq = msm8960_init_irq,
4896 .timer = &msm_timer,
4897 .init_machine = msm8960_cdp_init,
4898 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004899 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004900MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004901
4902#ifdef CONFIG_ARCH_MSM8930
4903MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4904 .map_io = msm8930_map_io,
4905 .reserve = msm8960_reserve,
4906 .init_irq = msm8960_init_irq,
4907 .timer = &msm_timer,
4908 .init_machine = msm8960_cdp_init,
4909 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004910 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004911MACHINE_END
4912
4913MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4914 .map_io = msm8930_map_io,
4915 .reserve = msm8960_reserve,
4916 .init_irq = msm8960_init_irq,
4917 .timer = &msm_timer,
4918 .init_machine = msm8960_cdp_init,
4919 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004920 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004921MACHINE_END
4922
4923MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4924 .map_io = msm8930_map_io,
4925 .reserve = msm8960_reserve,
4926 .init_irq = msm8960_init_irq,
4927 .timer = &msm_timer,
4928 .init_machine = msm8960_cdp_init,
4929 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004930 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004931MACHINE_END
4932#endif