blob: fece76d4bd54beaff0f2ee7bab20bc93292cae41 [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,
Vamsi Krishnaf0f7f712011-11-17 18:15:07 -0800747 .dir = GPIOMUX_OUT_LOW,
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530748};
749
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530750static struct gpiomux_setting hsic_hub_act_cfg = {
751 .func = GPIOMUX_FUNC_GPIO,
752 .drv = GPIOMUX_DRV_2MA,
753 .pull = GPIOMUX_PULL_NONE,
754};
755
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530756static struct msm_gpiomux_config msm8960_hsic_configs[] = {
757 {
758 .gpio = 150, /*HSIC_STROBE */
759 .settings = {
760 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
761 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
762 },
763 },
764 {
765 .gpio = 151, /* HSIC_DATA */
766 .settings = {
767 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
768 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
769 },
770 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530771 {
772 .gpio = 91, /* HSIC_HUB_RESET */
773 .settings = {
774 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
775 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
776 },
777 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530778};
779#endif
780
Mohan Pallaka5e490392011-09-09 15:18:41 +0530781#define HAP_SHIFT_LVL_OE_GPIO 47
782
783static struct gpiomux_setting hap_lvl_shft_suspended_config = {
784 .func = GPIOMUX_FUNC_GPIO,
785 .drv = GPIOMUX_DRV_2MA,
786 .pull = GPIOMUX_PULL_DOWN,
787};
788
789static struct gpiomux_setting hap_lvl_shft_active_config = {
790 .func = GPIOMUX_FUNC_GPIO,
791 .drv = GPIOMUX_DRV_8MA,
792 .pull = GPIOMUX_PULL_UP,
793};
794
795static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
796 {
797 .gpio = HAP_SHIFT_LVL_OE_GPIO,
798 .settings = {
799 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
800 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
801 },
802 },
803};
804
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700805#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
806enum {
807 SX150X_CAM,
808};
809
Nishant Pandit474f2252011-07-23 23:17:56 +0530810static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700811 [SX150X_CAM] = {
812 .gpio_base = GPIO_CAM_EXPANDER_BASE,
813 .oscio_is_gpo = false,
814 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530815 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700816 .io_open_drain_ena = 0x0,
817 .irq_summary = -1,
818 },
819};
Nishant Pandit474f2252011-07-23 23:17:56 +0530820
821#endif
822
823#ifdef CONFIG_I2C
824
825#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
826#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300827#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530828
829#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
830
831static struct i2c_board_info cam_expander_i2c_info[] = {
832 {
833 I2C_BOARD_INFO("sx1508q", 0x22),
834 .platform_data = &sx150x_data[SX150X_CAM]
835 },
836};
837
838static struct msm_cam_expander_info cam_expander_info[] = {
839 {
840 cam_expander_i2c_info,
841 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
842 },
843};
844#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700845#endif
846
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700847#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700848#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700849#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
850#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
851#else
Chetan Kalyana25d0762011-11-11 17:41:29 -0800852#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700853#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700854
855
856#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700857#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
858#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700859#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
860#define MSM_ION_HEAP_NUM 4
861#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700862#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700863#define MSM_ION_HEAP_NUM 2
864#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700865
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
867static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
868static int __init pmem_kernel_ebi1_size_setup(char *p)
869{
870 pmem_kernel_ebi1_size = memparse(p, NULL);
871 return 0;
872}
873early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
874#endif
875
876#ifdef CONFIG_ANDROID_PMEM
877static unsigned pmem_size = MSM_PMEM_SIZE;
878static int __init pmem_size_setup(char *p)
879{
880 pmem_size = memparse(p, NULL);
881 return 0;
882}
883early_param("pmem_size", pmem_size_setup);
884
885static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
886
887static int __init pmem_adsp_size_setup(char *p)
888{
889 pmem_adsp_size = memparse(p, NULL);
890 return 0;
891}
892early_param("pmem_adsp_size", pmem_adsp_size_setup);
893
894static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
895
896static int __init pmem_audio_size_setup(char *p)
897{
898 pmem_audio_size = memparse(p, NULL);
899 return 0;
900}
901early_param("pmem_audio_size", pmem_audio_size_setup);
902#endif
903
904#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700905#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906static struct android_pmem_platform_data android_pmem_pdata = {
907 .name = "pmem",
908 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
909 .cached = 1,
910 .memory_type = MEMTYPE_EBI1,
911};
912
913static struct platform_device android_pmem_device = {
914 .name = "android_pmem",
915 .id = 0,
916 .dev = {.platform_data = &android_pmem_pdata},
917};
918
919static struct android_pmem_platform_data android_pmem_adsp_pdata = {
920 .name = "pmem_adsp",
921 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
922 .cached = 0,
923 .memory_type = MEMTYPE_EBI1,
924};
925static struct platform_device android_pmem_adsp_device = {
926 .name = "android_pmem",
927 .id = 2,
928 .dev = { .platform_data = &android_pmem_adsp_pdata },
929};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700930#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700931
932static struct android_pmem_platform_data android_pmem_audio_pdata = {
933 .name = "pmem_audio",
934 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
935 .cached = 0,
936 .memory_type = MEMTYPE_EBI1,
937};
938
939static struct platform_device android_pmem_audio_device = {
940 .name = "android_pmem",
941 .id = 4,
942 .dev = { .platform_data = &android_pmem_audio_pdata },
943};
944#endif
945
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700946#define DSP_RAM_BASE_8960 0x8da00000
947#define DSP_RAM_SIZE_8960 0x1800000
948static int dspcrashd_pdata_8960 = 0xDEADDEAD;
949
950static struct resource resources_dspcrashd_8960[] = {
951 {
952 .name = "msm_dspcrashd",
953 .start = DSP_RAM_BASE_8960,
954 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
955 .flags = IORESOURCE_DMA,
956 },
957};
958
959struct platform_device msm_device_dspcrashd_8960 = {
960 .name = "msm_dspcrashd",
961 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
962 .resource = resources_dspcrashd_8960,
963 .dev = { .platform_data = &dspcrashd_pdata_8960 },
964};
965
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700966static struct memtype_reserve msm8960_reserve_table[] __initdata = {
967 [MEMTYPE_SMI] = {
968 },
969 [MEMTYPE_EBI0] = {
970 .flags = MEMTYPE_FLAGS_1M_ALIGN,
971 },
972 [MEMTYPE_EBI1] = {
973 .flags = MEMTYPE_FLAGS_1M_ALIGN,
974 },
975};
976
977static void __init size_pmem_devices(void)
978{
979#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700980#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700981 android_pmem_adsp_pdata.size = pmem_adsp_size;
982 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700983#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700984 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
985#endif
986}
987
988static void __init reserve_memory_for(struct android_pmem_platform_data *p)
989{
990 msm8960_reserve_table[p->memory_type].size += p->size;
991}
992
993static void __init reserve_pmem_memory(void)
994{
995#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700996#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700997 reserve_memory_for(&android_pmem_adsp_pdata);
998 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700999#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001000 reserve_memory_for(&android_pmem_audio_pdata);
1001 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1002#endif
1003}
1004
Larry Basselb4126da2011-07-18 14:31:33 -07001005static int msm8960_paddr_to_memtype(unsigned int paddr)
1006{
1007 return MEMTYPE_EBI1;
1008}
1009
Laura Abbottd6183792011-08-19 13:42:24 -07001010#ifdef CONFIG_ION_MSM
1011struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001012 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001013 .heaps = {
1014 {
1015 .id = ION_HEAP_SYSTEM_ID,
1016 .type = ION_HEAP_TYPE_SYSTEM,
1017 .name = ION_KMALLOC_HEAP_NAME,
1018 },
1019 {
1020 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1021 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1022 .name = ION_VMALLOC_HEAP_NAME,
1023 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001024#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001025 {
1026 .id = ION_HEAP_EBI_ID,
1027 .type = ION_HEAP_TYPE_CARVEOUT,
1028 .name = ION_EBI1_HEAP_NAME,
1029 .size = MSM_ION_EBI_SIZE,
1030 .memory_type = ION_EBI_TYPE,
1031 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001032 {
1033 .id = ION_HEAP_ADSP_ID,
1034 .type = ION_HEAP_TYPE_CARVEOUT,
1035 .name = ION_ADSP_HEAP_NAME,
1036 .size = MSM_ION_ADSP_SIZE,
1037 .memory_type = ION_EBI_TYPE,
1038 },
1039#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001040 }
1041};
1042
1043struct platform_device ion_dev = {
1044 .name = "ion-msm",
1045 .id = 1,
1046 .dev = { .platform_data = &ion_pdata },
1047};
1048#endif
1049
1050static void reserve_ion_memory(void)
1051{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001052#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001053 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001054 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001055#endif
1056}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001057static void __init msm8960_calculate_reserve_sizes(void)
1058{
1059 size_pmem_devices();
1060 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001061 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001062}
1063
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001064static struct reserve_info msm8960_reserve_info __initdata = {
1065 .memtype_reserve_table = msm8960_reserve_table,
1066 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1067 .paddr_to_memtype = msm8960_paddr_to_memtype,
1068};
1069
Larry Basselb4126da2011-07-18 14:31:33 -07001070static int msm8960_memory_bank_size(void)
1071{
1072 return 1<<29;
1073}
1074
1075static void __init locate_unstable_memory(void)
1076{
1077 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1078 unsigned long bank_size;
1079 unsigned long low, high;
1080
1081 bank_size = msm8960_memory_bank_size();
1082 low = meminfo.bank[0].start;
1083 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -07001084
1085 /* Check if 32 bit overflow occured */
1086 if (high < mb->start)
1087 high = ~0UL;
1088
Larry Basselb4126da2011-07-18 14:31:33 -07001089 low &= ~(bank_size - 1);
1090
1091 if (high - low <= bank_size)
1092 return;
1093 msm8960_reserve_info.low_unstable_address = low + bank_size;
Olav Haugan62052e42011-10-28 14:28:32 -07001094 /* To avoid overflow of u32 compute max_unstable_size
1095 * by first subtracting low from mb->start)
1096 * */
1097 msm8960_reserve_info.max_unstable_size = (mb->start - low) +
1098 mb->size - bank_size;
1099
Larry Basselb4126da2011-07-18 14:31:33 -07001100 msm8960_reserve_info.bank_size = bank_size;
1101 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1102 msm8960_reserve_info.low_unstable_address,
1103 msm8960_reserve_info.max_unstable_size,
1104 msm8960_reserve_info.bank_size);
1105}
1106
Larry Basselb830e182011-10-14 10:46:55 -07001107static void __init place_movable_zone(void)
1108{
1109 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1110 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1111 pr_info("movable zone start %lx size %lx\n",
1112 movable_reserved_start, movable_reserved_size);
1113}
1114
1115static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001116{
1117 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001118 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001119 place_movable_zone();
1120}
1121
1122static void __init msm8960_reserve(void)
1123{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001124 msm_reserve();
1125}
1126
Larry Bassela4414b12011-08-04 11:11:02 -07001127static int msm8960_change_memory_power(u64 start, u64 size,
1128 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001129{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001130 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001131}
1132
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001133#ifdef CONFIG_MSM_CAMERA
1134
Nishant Pandit24153d82011-08-27 16:05:13 +05301135static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001136 5, /*CAMIF_MCLK*/
1137 20, /*CAMIF_I2C_DATA*/
1138 21, /*CAMIF_I2C_CLK*/
1139};
1140
Nishant Pandit24153d82011-08-27 16:05:13 +05301141static struct msm_camera_gpio_conf gpio_conf = {
1142 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1143 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1144 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1145 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1146};
1147
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001148#define VFE_CAMIF_TIMER1_GPIO 2
1149#define VFE_CAMIF_TIMER2_GPIO 3
1150#define VFE_CAMIF_TIMER3_GPIO_INT 4
1151struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1152 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1153 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1154 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1155 .flash_recharge_duration = 50000,
1156 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1157};
1158
Nishant Pandit474f2252011-07-23 23:17:56 +05301159#ifdef CONFIG_MSM_CAMERA_FLASH
1160static struct msm_camera_sensor_flash_src msm_flash_src = {
1161 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1162 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1163 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1164#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1165 defined(CONFIG_GPIO_SX150X_MODULE))
1166 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1167#endif
1168};
1169#endif
1170
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001171static struct msm_bus_vectors cam_init_vectors[] = {
1172 {
1173 .src = MSM_BUS_MASTER_VFE,
1174 .dst = MSM_BUS_SLAVE_EBI_CH0,
1175 .ab = 0,
1176 .ib = 0,
1177 },
1178 {
1179 .src = MSM_BUS_MASTER_VPE,
1180 .dst = MSM_BUS_SLAVE_EBI_CH0,
1181 .ab = 0,
1182 .ib = 0,
1183 },
1184 {
1185 .src = MSM_BUS_MASTER_JPEG_ENC,
1186 .dst = MSM_BUS_SLAVE_EBI_CH0,
1187 .ab = 0,
1188 .ib = 0,
1189 },
1190};
1191
1192static struct msm_bus_vectors cam_preview_vectors[] = {
1193 {
1194 .src = MSM_BUS_MASTER_VFE,
1195 .dst = MSM_BUS_SLAVE_EBI_CH0,
1196 .ab = 27648000,
1197 .ib = 110592000,
1198 },
1199 {
1200 .src = MSM_BUS_MASTER_VPE,
1201 .dst = MSM_BUS_SLAVE_EBI_CH0,
1202 .ab = 0,
1203 .ib = 0,
1204 },
1205 {
1206 .src = MSM_BUS_MASTER_JPEG_ENC,
1207 .dst = MSM_BUS_SLAVE_EBI_CH0,
1208 .ab = 0,
1209 .ib = 0,
1210 },
1211};
1212
1213static struct msm_bus_vectors cam_video_vectors[] = {
1214 {
1215 .src = MSM_BUS_MASTER_VFE,
1216 .dst = MSM_BUS_SLAVE_EBI_CH0,
1217 .ab = 140451840,
1218 .ib = 561807360,
1219 },
1220 {
1221 .src = MSM_BUS_MASTER_VPE,
1222 .dst = MSM_BUS_SLAVE_EBI_CH0,
1223 .ab = 206807040,
1224 .ib = 488816640,
1225 },
1226 {
1227 .src = MSM_BUS_MASTER_JPEG_ENC,
1228 .dst = MSM_BUS_SLAVE_EBI_CH0,
1229 .ab = 0,
1230 .ib = 0,
1231 },
1232};
1233
1234static struct msm_bus_vectors cam_snapshot_vectors[] = {
1235 {
1236 .src = MSM_BUS_MASTER_VFE,
1237 .dst = MSM_BUS_SLAVE_EBI_CH0,
1238 .ab = 274423680,
1239 .ib = 1097694720,
1240 },
1241 {
1242 .src = MSM_BUS_MASTER_VPE,
1243 .dst = MSM_BUS_SLAVE_EBI_CH0,
1244 .ab = 0,
1245 .ib = 0,
1246 },
1247 {
1248 .src = MSM_BUS_MASTER_JPEG_ENC,
1249 .dst = MSM_BUS_SLAVE_EBI_CH0,
1250 .ab = 540000000,
1251 .ib = 1350000000,
1252 },
1253};
1254
1255static struct msm_bus_vectors cam_zsl_vectors[] = {
1256 {
1257 .src = MSM_BUS_MASTER_VFE,
1258 .dst = MSM_BUS_SLAVE_EBI_CH0,
1259 .ab = 302071680,
1260 .ib = 1208286720,
1261 },
1262 {
1263 .src = MSM_BUS_MASTER_VPE,
1264 .dst = MSM_BUS_SLAVE_EBI_CH0,
1265 .ab = 0,
1266 .ib = 0,
1267 },
1268 {
1269 .src = MSM_BUS_MASTER_JPEG_ENC,
1270 .dst = MSM_BUS_SLAVE_EBI_CH0,
1271 .ab = 540000000,
1272 .ib = 1350000000,
1273 },
1274};
1275
1276static struct msm_bus_paths cam_bus_client_config[] = {
1277 {
1278 ARRAY_SIZE(cam_init_vectors),
1279 cam_init_vectors,
1280 },
1281 {
1282 ARRAY_SIZE(cam_preview_vectors),
1283 cam_preview_vectors,
1284 },
1285 {
1286 ARRAY_SIZE(cam_video_vectors),
1287 cam_video_vectors,
1288 },
1289 {
1290 ARRAY_SIZE(cam_snapshot_vectors),
1291 cam_snapshot_vectors,
1292 },
1293 {
1294 ARRAY_SIZE(cam_zsl_vectors),
1295 cam_zsl_vectors,
1296 },
1297};
1298
1299static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1300 cam_bus_client_config,
1301 ARRAY_SIZE(cam_bus_client_config),
1302 .name = "msm_camera",
1303};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001304
Nishant Pandit24153d82011-08-27 16:05:13 +05301305struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1306 {
1307 .ioclk.mclk_clk_rate = 24000000,
1308 .ioclk.vfe_clk_rate = 228570000,
1309 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001310 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301311 },
1312 {
1313 .ioclk.mclk_clk_rate = 24000000,
1314 .ioclk.vfe_clk_rate = 228570000,
1315 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001316 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301317 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001318};
1319
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001320#ifdef CONFIG_IMX074_ACT
1321static struct i2c_board_info imx074_actuator_i2c_info = {
1322 I2C_BOARD_INFO("imx074_act", 0x11),
1323};
1324
1325static struct msm_actuator_info imx074_actuator_info = {
1326 .board_info = &imx074_actuator_i2c_info,
1327 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1328 .vcm_pwd = 0,
1329 .vcm_enable = 1,
1330};
1331#endif
1332
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333#ifdef CONFIG_IMX074
1334static struct msm_camera_sensor_flash_data flash_imx074 = {
1335 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301336#ifdef CONFIG_MSM_CAMERA_FLASH
1337 .flash_src = &msm_flash_src
1338#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001339};
1340
Nishant Pandit24153d82011-08-27 16:05:13 +05301341static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1342 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001343 .sensor_reset = 107,
1344 .sensor_pwd = 85,
1345 .vcm_pwd = 0,
1346 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301347};
1348
1349static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1350 .sensor_name = "imx074",
1351 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001352 .flash_data = &flash_imx074,
1353 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301354 .sensor_platform_info = &sensor_board_info_imx074,
1355 .gpio_conf = &gpio_conf,
1356 .csi_if = 1,
1357 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001358#ifdef CONFIG_IMX074_ACT
1359 .actuator_info = &imx074_actuator_info
1360#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361};
1362
1363struct platform_device msm8960_camera_sensor_imx074 = {
1364 .name = "msm_camera_imx074",
1365 .dev = {
1366 .platform_data = &msm_camera_sensor_imx074_data,
1367 },
1368};
1369#endif
1370#ifdef CONFIG_OV2720
1371static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001372 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001373};
1374
Nishant Pandit24153d82011-08-27 16:05:13 +05301375static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1376 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377 .sensor_reset = 76,
1378 .sensor_pwd = 85,
1379 .vcm_pwd = 0,
1380 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301381};
1382
1383static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1384 .sensor_name = "ov2720",
1385 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001386 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301387 .sensor_platform_info = &sensor_board_info_ov2720,
1388 .gpio_conf = &gpio_conf,
1389 .csi_if = 1,
1390 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001391};
1392
1393struct platform_device msm8960_camera_sensor_ov2720 = {
1394 .name = "msm_camera_ov2720",
1395 .dev = {
1396 .platform_data = &msm_camera_sensor_ov2720_data,
1397 },
1398};
1399#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001400
Kevin Chan8b0d2322011-09-10 21:06:31 -07001401static struct msm8960_privacy_light_cfg privacy_light_info = {
1402 .mpp = PM8921_MPP_PM_TO_SYS(12),
1403};
1404
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001405static void __init msm8960_init_cam(void)
1406{
1407 int i;
1408 struct platform_device *cam_dev[] = {
1409 &msm8960_camera_sensor_imx074,
1410 &msm8960_camera_sensor_ov2720,
1411 };
1412
Kevin Chan8b0d2322011-09-10 21:06:31 -07001413 if (machine_is_msm8960_liquid()) {
1414 struct msm_camera_sensor_info *s_info;
1415 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1416 s_info->sensor_platform_info->mount_angle = 180;
1417 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1418 s_info->sensor_platform_info->privacy_light = 1;
1419 s_info->sensor_platform_info->privacy_light_info =
1420 &privacy_light_info;
1421 }
1422
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001423 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1424 struct msm_camera_sensor_info *s_info;
1425 s_info = cam_dev[i]->dev.platform_data;
1426 msm_get_cam_resources(s_info);
1427 platform_device_register(cam_dev[i]);
1428 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001429
1430 platform_device_register(&msm8960_device_csiphy0);
1431 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001432 platform_device_register(&msm8960_device_csid0);
1433 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001434 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001435 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001436 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001437}
1438#endif
1439
1440#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001441#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001443#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001444#endif
1445
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446
1447#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001448#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001450#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1451#else
1452#define MSM_FB_EXT_BUF_SIZE 0
1453#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001454
kuogee hsieh3830eb92011-09-12 15:25:57 -07001455#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1456/* width x height x 3 bpp x 2 frame buffer */
1457#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1458#define MSM_FB_WRITEBACK_OFFSET \
1459 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1460#else
1461#define MSM_FB_WRITEBACK_SIZE 0
1462#define MSM_FB_WRITEBACK_OFFSET 0
1463#endif
1464
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001465#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1466/* 4 bpp x 2 page HDMI case */
1467#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1468#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001469/* Note: must be multiple of 4096 */
1470#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1471 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001472#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001473
1474static int writeback_offset(void)
1475{
1476 return MSM_FB_WRITEBACK_OFFSET;
1477}
1478
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001479
1480#define MDP_VSYNC_GPIO 0
1481
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001482#define PANEL_NAME_MAX_LEN 30
1483#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1484#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1485#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1486#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1487#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1488#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1489#define HDMI_PANEL_NAME "hdmi_msm"
1490#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001491
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492static struct resource msm_fb_resources[] = {
1493 {
1494 .flags = IORESOURCE_DMA,
1495 }
1496};
1497
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001498static int msm_fb_detect_panel(const char *name)
1499{
1500 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001501 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1502 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1503 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001504 return 0;
1505 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001506 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1507 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1508 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001509 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001510
1511#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1512 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1513 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1514 PANEL_NAME_MAX_LEN)))
1515 return 0;
1516
1517 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1518 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1519 PANEL_NAME_MAX_LEN)))
1520 return 0;
1521
1522 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1523 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1524 PANEL_NAME_MAX_LEN)))
1525 return 0;
1526
1527 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1528 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1529 PANEL_NAME_MAX_LEN)))
1530 return 0;
1531#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001532 }
1533
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001534 if (!strncmp(name, HDMI_PANEL_NAME,
1535 strnlen(HDMI_PANEL_NAME,
1536 PANEL_NAME_MAX_LEN)))
1537 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001538
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001539 if (!strncmp(name, TVOUT_PANEL_NAME,
1540 strnlen(TVOUT_PANEL_NAME,
1541 PANEL_NAME_MAX_LEN)))
1542 return 0;
1543
1544 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001545 return -ENODEV;
1546}
1547
1548static struct msm_fb_platform_data msm_fb_pdata = {
1549 .detect_client = msm_fb_detect_panel,
1550};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001551
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001552static struct platform_device msm_fb_device = {
1553 .name = "msm_fb",
1554 .id = 0,
1555 .num_resources = ARRAY_SIZE(msm_fb_resources),
1556 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001557 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558};
1559
1560static bool dsi_power_on;
1561
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001562/**
1563 * LiQUID panel on/off
1564 *
1565 * @param on
1566 *
1567 * @return int
1568 */
1569static int mipi_dsi_liquid_panel_power(int on)
1570{
1571 static struct regulator *reg_l2, *reg_ext_3p3v;
1572 static int gpio21, gpio24, gpio43;
1573 int rc;
1574
1575 pr_info("%s: on=%d\n", __func__, on);
1576
1577 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1578 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1579 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1580
1581 if (!dsi_power_on) {
1582
1583 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1584 "dsi_vdda");
1585 if (IS_ERR(reg_l2)) {
1586 pr_err("could not get 8921_l2, rc = %ld\n",
1587 PTR_ERR(reg_l2));
1588 return -ENODEV;
1589 }
1590
1591 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1592 if (rc) {
1593 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1594 return -EINVAL;
1595 }
1596
1597 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1598 "vdd_lvds_3p3v");
1599 if (IS_ERR(reg_ext_3p3v)) {
1600 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1601 PTR_ERR(reg_ext_3p3v));
1602 return -ENODEV;
1603 }
1604
1605 rc = gpio_request(gpio21, "disp_pwr_en_n");
1606 if (rc) {
1607 pr_err("request gpio 21 failed, rc=%d\n", rc);
1608 return -ENODEV;
1609 }
1610
1611 rc = gpio_request(gpio43, "disp_rst_n");
1612 if (rc) {
1613 pr_err("request gpio 43 failed, rc=%d\n", rc);
1614 return -ENODEV;
1615 }
1616
1617 rc = gpio_request(gpio24, "disp_backlight_pwm");
1618 if (rc) {
1619 pr_err("request gpio 24 failed, rc=%d\n", rc);
1620 return -ENODEV;
1621 }
1622
1623 dsi_power_on = true;
1624 }
1625
1626 if (on) {
1627 rc = regulator_set_optimum_mode(reg_l2, 100000);
1628 if (rc < 0) {
1629 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1630 return -EINVAL;
1631 }
1632 rc = regulator_enable(reg_l2);
1633 if (rc) {
1634 pr_err("enable l2 failed, rc=%d\n", rc);
1635 return -ENODEV;
1636 }
1637
1638 rc = regulator_enable(reg_ext_3p3v);
1639 if (rc) {
1640 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1641 return -ENODEV;
1642 }
1643
1644 /* set reset pin before power enable */
1645 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1646
1647 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1648 msleep(20);
1649 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1650 msleep(20);
1651 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1652 msleep(20);
1653 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1654 msleep(20);
1655 } else {
1656 gpio_set_value_cansleep(gpio43, 0);
1657 gpio_set_value_cansleep(gpio21, 1);
1658
1659 rc = regulator_disable(reg_l2);
1660 if (rc) {
1661 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1662 return -ENODEV;
1663 }
1664 rc = regulator_disable(reg_ext_3p3v);
1665 if (rc) {
1666 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1667 return -ENODEV;
1668 }
1669 rc = regulator_set_optimum_mode(reg_l2, 100);
1670 if (rc < 0) {
1671 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1672 return -EINVAL;
1673 }
1674 }
1675
1676 return 0;
1677}
1678
1679static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001680{
1681 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001682 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683 int rc;
1684
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685 pr_info("%s: state : %d\n", __func__, on);
1686
1687 if (!dsi_power_on) {
1688
1689 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1690 "dsi_vdc");
1691 if (IS_ERR(reg_l8)) {
1692 pr_err("could not get 8921_l8, rc = %ld\n",
1693 PTR_ERR(reg_l8));
1694 return -ENODEV;
1695 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001696 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1697 "dsi_vddio");
1698 if (IS_ERR(reg_l23)) {
1699 pr_err("could not get 8921_l23, rc = %ld\n",
1700 PTR_ERR(reg_l23));
1701 return -ENODEV;
1702 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001703 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1704 "dsi_vdda");
1705 if (IS_ERR(reg_l2)) {
1706 pr_err("could not get 8921_l2, rc = %ld\n",
1707 PTR_ERR(reg_l2));
1708 return -ENODEV;
1709 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1711 if (rc) {
1712 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1713 return -EINVAL;
1714 }
1715 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1716 if (rc) {
1717 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1718 return -EINVAL;
1719 }
1720 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1721 if (rc) {
1722 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1723 return -EINVAL;
1724 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1726 rc = gpio_request(gpio43, "disp_rst_n");
1727 if (rc) {
1728 pr_err("request gpio 43 failed, rc=%d\n", rc);
1729 return -ENODEV;
1730 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001731 dsi_power_on = true;
1732 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733 if (on) {
1734 rc = regulator_set_optimum_mode(reg_l8, 100000);
1735 if (rc < 0) {
1736 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1737 return -EINVAL;
1738 }
1739 rc = regulator_set_optimum_mode(reg_l23, 100000);
1740 if (rc < 0) {
1741 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1742 return -EINVAL;
1743 }
1744 rc = regulator_set_optimum_mode(reg_l2, 100000);
1745 if (rc < 0) {
1746 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1747 return -EINVAL;
1748 }
1749 rc = regulator_enable(reg_l8);
1750 if (rc) {
1751 pr_err("enable l8 failed, rc=%d\n", rc);
1752 return -ENODEV;
1753 }
1754 rc = regulator_enable(reg_l23);
1755 if (rc) {
1756 pr_err("enable l8 failed, rc=%d\n", rc);
1757 return -ENODEV;
1758 }
1759 rc = regulator_enable(reg_l2);
1760 if (rc) {
1761 pr_err("enable l2 failed, rc=%d\n", rc);
1762 return -ENODEV;
1763 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 gpio_set_value_cansleep(gpio43, 1);
1765 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001766 rc = regulator_disable(reg_l2);
1767 if (rc) {
1768 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1769 return -ENODEV;
1770 }
1771 rc = regulator_disable(reg_l8);
1772 if (rc) {
1773 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1774 return -ENODEV;
1775 }
1776 rc = regulator_disable(reg_l23);
1777 if (rc) {
1778 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1779 return -ENODEV;
1780 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001781 rc = regulator_set_optimum_mode(reg_l8, 100);
1782 if (rc < 0) {
1783 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1784 return -EINVAL;
1785 }
1786 rc = regulator_set_optimum_mode(reg_l23, 100);
1787 if (rc < 0) {
1788 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1789 return -EINVAL;
1790 }
1791 rc = regulator_set_optimum_mode(reg_l2, 100);
1792 if (rc < 0) {
1793 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1794 return -EINVAL;
1795 }
1796 gpio_set_value_cansleep(gpio43, 0);
1797 }
1798 return 0;
1799}
1800
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001801static int mipi_dsi_panel_power(int on)
1802{
1803 int ret;
1804
1805 pr_info("%s: on=%d\n", __func__, on);
1806
1807 if (machine_is_msm8960_liquid())
1808 ret = mipi_dsi_liquid_panel_power(on);
1809 else
1810 ret = mipi_dsi_cdp_panel_power(on);
1811
1812 return ret;
1813}
1814
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001815static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1816 .vsync_gpio = MDP_VSYNC_GPIO,
1817 .dsi_power_save = mipi_dsi_panel_power,
1818};
1819
1820#ifdef CONFIG_MSM_BUS_SCALING
1821
1822static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001823 {
1824 .src = MSM_BUS_MASTER_MDP_PORT0,
1825 .dst = MSM_BUS_SLAVE_EBI_CH0,
1826 .ab = 0,
1827 .ib = 0,
1828 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001829};
1830
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001831#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1832static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1833 /* If HDMI is used as primary */
1834 {
1835 .src = MSM_BUS_MASTER_MDP_PORT0,
1836 .dst = MSM_BUS_SLAVE_EBI_CH0,
1837 .ab = 2000000000,
1838 .ib = 2000000000,
1839 },
1840};
1841static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1842 {
1843 ARRAY_SIZE(mdp_init_vectors),
1844 mdp_init_vectors,
1845 },
1846 {
1847 ARRAY_SIZE(hdmi_as_primary_vectors),
1848 hdmi_as_primary_vectors,
1849 },
1850 {
1851 ARRAY_SIZE(hdmi_as_primary_vectors),
1852 hdmi_as_primary_vectors,
1853 },
1854 {
1855 ARRAY_SIZE(hdmi_as_primary_vectors),
1856 hdmi_as_primary_vectors,
1857 },
1858 {
1859 ARRAY_SIZE(hdmi_as_primary_vectors),
1860 hdmi_as_primary_vectors,
1861 },
1862 {
1863 ARRAY_SIZE(hdmi_as_primary_vectors),
1864 hdmi_as_primary_vectors,
1865 },
1866};
1867#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001868static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869 {
1870 .src = MSM_BUS_MASTER_MDP_PORT0,
1871 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001872 .ab = 216000000 * 2,
1873 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874 },
1875};
1876
1877static struct msm_bus_vectors mdp_vga_vectors[] = {
1878 /* VGA and less video */
1879 {
1880 .src = MSM_BUS_MASTER_MDP_PORT0,
1881 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001882 .ab = 216000000 * 2,
1883 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001884 },
1885};
1886
1887static struct msm_bus_vectors mdp_720p_vectors[] = {
1888 /* 720p and less video */
1889 {
1890 .src = MSM_BUS_MASTER_MDP_PORT0,
1891 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001892 .ab = 230400000 * 2,
1893 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001894 },
1895};
1896
1897static struct msm_bus_vectors mdp_1080p_vectors[] = {
1898 /* 1080p and less video */
1899 {
1900 .src = MSM_BUS_MASTER_MDP_PORT0,
1901 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001902 .ab = 334080000 * 2,
1903 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001904 },
1905};
1906
1907static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1908 {
1909 ARRAY_SIZE(mdp_init_vectors),
1910 mdp_init_vectors,
1911 },
1912 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001913 ARRAY_SIZE(mdp_ui_vectors),
1914 mdp_ui_vectors,
1915 },
1916 {
1917 ARRAY_SIZE(mdp_ui_vectors),
1918 mdp_ui_vectors,
1919 },
1920 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001921 ARRAY_SIZE(mdp_vga_vectors),
1922 mdp_vga_vectors,
1923 },
1924 {
1925 ARRAY_SIZE(mdp_720p_vectors),
1926 mdp_720p_vectors,
1927 },
1928 {
1929 ARRAY_SIZE(mdp_1080p_vectors),
1930 mdp_1080p_vectors,
1931 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001932};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001933#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934
1935static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1936 mdp_bus_scale_usecases,
1937 ARRAY_SIZE(mdp_bus_scale_usecases),
1938 .name = "mdp",
1939};
1940
1941#endif
1942
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001943#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1944int mdp_core_clk_rate_table[] = {
1945 200000000,
1946 200000000,
1947 200000000,
1948 200000000,
1949};
1950#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001951int mdp_core_clk_rate_table[] = {
1952 85330000,
1953 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001954 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955 200000000,
1956};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001957#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001958
1959static struct msm_panel_common_pdata mdp_pdata = {
1960 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001961#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1962 .mdp_core_clk_rate = 200000000,
1963#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001965#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001966 .mdp_core_clk_table = mdp_core_clk_rate_table,
1967 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1968#ifdef CONFIG_MSM_BUS_SCALING
1969 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1970#endif
1971 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001972 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973};
1974
1975static struct platform_device mipi_dsi_renesas_panel_device = {
1976 .name = "mipi_renesas",
1977 .id = 0,
1978};
1979
1980static struct platform_device mipi_dsi_simulator_panel_device = {
1981 .name = "mipi_simulator",
1982 .id = 0,
1983};
1984
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001985#define LPM_CHANNEL0 0
1986static int toshiba_gpio[] = {LPM_CHANNEL0};
1987
1988static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1989 .gpio = toshiba_gpio,
1990};
1991
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001992static struct platform_device mipi_dsi_toshiba_panel_device = {
1993 .name = "mipi_toshiba",
1994 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001995 .dev = {
1996 .platform_data = &toshiba_pdata,
1997 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001998};
1999
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002000#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002001static int dsi2lvds_gpio[2] = {
2002 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2003 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2004 };
2005
2006static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2007 .gpio_num = dsi2lvds_gpio,
2008};
2009
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002010static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2011
2012/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2013 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2014 /* timing */
2015 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2016 0x0c, 0x03, 0x04, 0xa0},
2017 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2018 {0xff, 0x00, 0x06, 0x00}, /* strength */
2019 /* pll control */
2020 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2021 0x40, 0x07, 0x03,
2022 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2023};
2024
2025static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002026 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2027 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002028 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2029};
2030
2031static struct platform_device mipi_dsi_novatek_panel_device = {
2032 .name = "mipi_novatek",
2033 .id = 0,
2034 .dev = {
2035 .platform_data = &novatek_pdata,
2036 }
2037};
2038
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002039static struct platform_device mipi_dsi2lvds_bridge_device = {
2040 .name = "mipi_tc358764",
2041 .id = 0,
2042 .dev.platform_data = &mipi_dsi2lvds_pdata,
2043};
2044
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002045#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2046static struct resource hdmi_msm_resources[] = {
2047 {
2048 .name = "hdmi_msm_qfprom_addr",
2049 .start = 0x00700000,
2050 .end = 0x007060FF,
2051 .flags = IORESOURCE_MEM,
2052 },
2053 {
2054 .name = "hdmi_msm_hdmi_addr",
2055 .start = 0x04A00000,
2056 .end = 0x04A00FFF,
2057 .flags = IORESOURCE_MEM,
2058 },
2059 {
2060 .name = "hdmi_msm_irq",
2061 .start = HDMI_IRQ,
2062 .end = HDMI_IRQ,
2063 .flags = IORESOURCE_IRQ,
2064 },
2065};
2066
2067static int hdmi_enable_5v(int on);
2068static int hdmi_core_power(int on, int show);
2069static int hdmi_cec_power(int on);
2070
2071static struct msm_hdmi_platform_data hdmi_msm_data = {
2072 .irq = HDMI_IRQ,
2073 .enable_5v = hdmi_enable_5v,
2074 .core_power = hdmi_core_power,
2075 .cec_power = hdmi_cec_power,
2076};
2077
2078static struct platform_device hdmi_msm_device = {
2079 .name = "hdmi_msm",
2080 .id = 0,
2081 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2082 .resource = hdmi_msm_resources,
2083 .dev.platform_data = &hdmi_msm_data,
2084};
2085#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2086
Vinay Kalia291263e2011-11-01 17:07:05 -07002087#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2088static struct platform_device wfd_panel_device = {
2089 .name = "wfd_panel",
2090 .id = 0,
2091 .dev.platform_data = NULL,
2092};
2093#endif
2094
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002095#ifdef CONFIG_MSM_BUS_SCALING
2096static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2097 {
2098 .src = MSM_BUS_MASTER_MDP_PORT0,
2099 .dst = MSM_BUS_SLAVE_EBI_CH0,
2100 .ab = 0,
2101 .ib = 0,
2102 },
2103};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002104
2105#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2106static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2107 {
2108 .src = MSM_BUS_MASTER_MDP_PORT0,
2109 .dst = MSM_BUS_SLAVE_EBI_CH0,
2110 .ab = 2000000000,
2111 .ib = 2000000000,
2112 },
2113};
2114#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002115static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2116 {
2117 .src = MSM_BUS_MASTER_MDP_PORT0,
2118 .dst = MSM_BUS_SLAVE_EBI_CH0,
2119 .ab = 566092800 * 2,
2120 .ib = 707616000 * 2,
2121 },
2122};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002123#endif
2124
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002125static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2126 {
2127 ARRAY_SIZE(dtv_bus_init_vectors),
2128 dtv_bus_init_vectors,
2129 },
2130 {
2131 ARRAY_SIZE(dtv_bus_def_vectors),
2132 dtv_bus_def_vectors,
2133 },
2134};
2135static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2136 dtv_bus_scale_usecases,
2137 ARRAY_SIZE(dtv_bus_scale_usecases),
2138 .name = "dtv",
2139};
2140
2141static struct lcdc_platform_data dtv_pdata = {
2142 .bus_scale_table = &dtv_bus_scale_pdata,
2143};
2144#endif
2145
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002146static void __init msm_fb_add_devices(void)
2147{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002148 struct platform_device *ptr = NULL;
2149
2150 if (machine_is_msm8960_liquid())
2151 ptr = &mipi_dsi2lvds_bridge_device;
2152 else
2153 ptr = &mipi_dsi_toshiba_panel_device;
2154 platform_add_devices(&ptr, 1);
2155
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156 if (machine_is_msm8x60_rumi3()) {
2157 msm_fb_register_device("mdp", NULL);
2158 mipi_dsi_pdata.target_type = 1;
2159 } else
2160 msm_fb_register_device("mdp", &mdp_pdata);
2161 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002162#ifdef CONFIG_MSM_BUS_SCALING
2163 msm_fb_register_device("dtv", &dtv_pdata);
2164#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002165}
2166
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002167static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2168 .func = GPIOMUX_FUNC_GPIO,
2169 .drv = GPIOMUX_DRV_2MA,
2170 .pull = GPIOMUX_PULL_DOWN,
2171};
2172
2173static struct gpiomux_setting mdp_vsync_active_cfg = {
2174 .func = GPIOMUX_FUNC_1,
2175 .drv = GPIOMUX_DRV_2MA,
2176 .pull = GPIOMUX_PULL_DOWN,
2177};
2178
2179static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2180 {
2181 .gpio = MDP_VSYNC_GPIO,
2182 .settings = {
2183 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2184 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2185 },
2186 }
2187};
2188
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002189#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2190static struct gpiomux_setting hdmi_suspend_cfg = {
2191 .func = GPIOMUX_FUNC_GPIO,
2192 .drv = GPIOMUX_DRV_2MA,
2193 .pull = GPIOMUX_PULL_DOWN,
2194};
2195
2196static struct gpiomux_setting hdmi_active_1_cfg = {
2197 .func = GPIOMUX_FUNC_1,
2198 .drv = GPIOMUX_DRV_2MA,
2199 .pull = GPIOMUX_PULL_UP,
2200};
2201
2202static struct gpiomux_setting hdmi_active_2_cfg = {
2203 .func = GPIOMUX_FUNC_1,
2204 .drv = GPIOMUX_DRV_2MA,
2205 .pull = GPIOMUX_PULL_DOWN,
2206};
2207
2208static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2209 {
2210 .gpio = 99,
2211 .settings = {
2212 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2213 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2214 },
2215 },
2216 {
2217 .gpio = 100,
2218 .settings = {
2219 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2220 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2221 },
2222 },
2223 {
2224 .gpio = 101,
2225 .settings = {
2226 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2227 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2228 },
2229 },
2230 {
2231 .gpio = 102,
2232 .settings = {
2233 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2234 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2235 },
2236 },
2237};
2238
2239static int hdmi_enable_5v(int on)
2240{
2241 /* TBD: PM8921 regulator instead of 8901 */
2242 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2243 static int prev_on;
2244 int rc;
2245
2246 if (on == prev_on)
2247 return 0;
2248
2249 if (!reg_8921_hdmi_mvs)
2250 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2251 "hdmi_mvs");
2252
2253 if (on) {
2254 rc = regulator_enable(reg_8921_hdmi_mvs);
2255 if (rc) {
2256 pr_err("'%s' regulator enable failed, rc=%d\n",
2257 "8921_hdmi_mvs", rc);
2258 return rc;
2259 }
2260 pr_debug("%s(on): success\n", __func__);
2261 } else {
2262 rc = regulator_disable(reg_8921_hdmi_mvs);
2263 if (rc)
2264 pr_warning("'%s' regulator disable failed, rc=%d\n",
2265 "8921_hdmi_mvs", rc);
2266 pr_debug("%s(off): success\n", __func__);
2267 }
2268
2269 prev_on = on;
2270
2271 return 0;
2272}
2273
2274static int hdmi_core_power(int on, int show)
2275{
2276 static struct regulator *reg_8921_l23, *reg_8921_s4;
2277 static int prev_on;
2278 int rc;
2279
2280 if (on == prev_on)
2281 return 0;
2282
2283 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002284 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002285 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002286 if (IS_ERR(reg_8921_l23)) {
2287 pr_err("could not get reg_8921_l23, rc = %ld\n",
2288 PTR_ERR(reg_8921_l23));
2289 return -ENODEV;
2290 }
2291 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2292 if (rc) {
2293 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2294 return -EINVAL;
2295 }
2296 }
2297 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002298 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002299 if (IS_ERR(reg_8921_s4)) {
2300 pr_err("could not get reg_8921_s4, rc = %ld\n",
2301 PTR_ERR(reg_8921_s4));
2302 return -ENODEV;
2303 }
2304 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2305 if (rc) {
2306 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2307 return -EINVAL;
2308 }
2309 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002310
2311 if (on) {
2312 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2313 if (rc < 0) {
2314 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2315 return -EINVAL;
2316 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002317 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002318 if (rc) {
2319 pr_err("'%s' regulator enable failed, rc=%d\n",
2320 "hdmi_avdd", rc);
2321 return rc;
2322 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002323 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002324 if (rc) {
2325 pr_err("'%s' regulator enable failed, rc=%d\n",
2326 "hdmi_vcc", rc);
2327 return rc;
2328 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329 rc = gpio_request(100, "HDMI_DDC_CLK");
2330 if (rc) {
2331 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2332 "HDMI_DDC_CLK", 100, rc);
2333 goto error1;
2334 }
2335 rc = gpio_request(101, "HDMI_DDC_DATA");
2336 if (rc) {
2337 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2338 "HDMI_DDC_DATA", 101, rc);
2339 goto error2;
2340 }
2341 rc = gpio_request(102, "HDMI_HPD");
2342 if (rc) {
2343 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2344 "HDMI_HPD", 102, rc);
2345 goto error3;
2346 }
2347 pr_debug("%s(on): success\n", __func__);
2348 } else {
2349 gpio_free(100);
2350 gpio_free(101);
2351 gpio_free(102);
2352
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002353 rc = regulator_disable(reg_8921_l23);
2354 if (rc) {
2355 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2356 return -ENODEV;
2357 }
2358 rc = regulator_disable(reg_8921_s4);
2359 if (rc) {
2360 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2361 return -ENODEV;
2362 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002363 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2364 if (rc < 0) {
2365 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2366 return -EINVAL;
2367 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002368 pr_debug("%s(off): success\n", __func__);
2369 }
2370
2371 prev_on = on;
2372
2373 return 0;
2374
2375error3:
2376 gpio_free(101);
2377error2:
2378 gpio_free(100);
2379error1:
2380 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002381 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002382 return rc;
2383}
2384
2385static int hdmi_cec_power(int on)
2386{
2387 static int prev_on;
2388 int rc;
2389
2390 if (on == prev_on)
2391 return 0;
2392
2393 if (on) {
2394 rc = gpio_request(99, "HDMI_CEC_VAR");
2395 if (rc) {
2396 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2397 "HDMI_CEC_VAR", 99, rc);
2398 goto error;
2399 }
2400 pr_debug("%s(on): success\n", __func__);
2401 } else {
2402 gpio_free(99);
2403 pr_debug("%s(off): success\n", __func__);
2404 }
2405
2406 prev_on = on;
2407
2408 return 0;
2409error:
2410 return rc;
2411}
2412#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2413
2414static void __init msm8960_allocate_memory_regions(void)
2415{
2416 void *addr;
2417 unsigned long size;
2418
2419 size = MSM_FB_SIZE;
2420 addr = alloc_bootmem_align(size, 0x1000);
2421 msm_fb_resources[0].start = __pa(addr);
2422 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2423 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2424 size, addr, __pa(addr));
2425
2426}
2427#ifdef CONFIG_WCD9310_CODEC
2428
2429#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2430
Patrick Lai3043fba2011-08-01 14:15:57 -07002431/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2432 * 4 micbiases are used to power various analog and digital
2433 * microphones operating at 1800 mV. Technically, all micbiases
2434 * can source from single cfilter since all microphones operate
2435 * at the same voltage level. The arrangement below is to make
2436 * sure all cfilters are exercised. LDO_H regulator ouput level
2437 * does not need to be as high as 2.85V. It is choosen for
2438 * microphone sensitivity purpose.
2439 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002440static struct tabla_pdata tabla_platform_data = {
2441 .slimbus_slave_device = {
2442 .name = "tabla-slave",
2443 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2444 },
2445 .irq = MSM_GPIO_TO_INT(62),
2446 .irq_base = TABLA_INTERRUPT_BASE,
2447 .num_irqs = NR_TABLA_IRQS,
2448 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002449 .micbias = {
2450 .ldoh_v = TABLA_LDOH_2P85_V,
2451 .cfilt1_mv = 1800,
2452 .cfilt2_mv = 1800,
2453 .cfilt3_mv = 1800,
2454 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2455 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2456 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2457 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2458 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459};
2460
2461static struct slim_device msm_slim_tabla = {
2462 .name = "tabla-slim",
2463 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2464 .dev = {
2465 .platform_data = &tabla_platform_data,
2466 },
2467};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302468
2469static struct tabla_pdata tabla20_platform_data = {
2470 .slimbus_slave_device = {
2471 .name = "tabla-slave",
2472 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2473 },
2474 .irq = MSM_GPIO_TO_INT(62),
2475 .irq_base = TABLA_INTERRUPT_BASE,
2476 .num_irqs = NR_TABLA_IRQS,
2477 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2478 .micbias = {
2479 .ldoh_v = TABLA_LDOH_2P85_V,
2480 .cfilt1_mv = 1800,
2481 .cfilt2_mv = 1800,
2482 .cfilt3_mv = 1800,
2483 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2484 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2485 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2486 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2487 }
2488};
2489
2490static struct slim_device msm_slim_tabla20 = {
2491 .name = "tabla2x-slim",
2492 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2493 .dev = {
2494 .platform_data = &tabla20_platform_data,
2495 },
2496};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002497#endif
2498
2499static struct slim_boardinfo msm_slim_devices[] = {
2500#ifdef CONFIG_WCD9310_CODEC
2501 {
2502 .bus_num = 1,
2503 .slim_slave = &msm_slim_tabla,
2504 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302505 {
2506 .bus_num = 1,
2507 .slim_slave = &msm_slim_tabla20,
2508 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002509#endif
2510 /* add more slimbus slaves as needed */
2511};
2512
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002513#define MSM_WCNSS_PHYS 0x03000000
2514#define MSM_WCNSS_SIZE 0x280000
2515
2516static struct resource resources_wcnss_wlan[] = {
2517 {
2518 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2519 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2520 .name = "wcnss_wlanrx_irq",
2521 .flags = IORESOURCE_IRQ,
2522 },
2523 {
2524 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2525 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2526 .name = "wcnss_wlantx_irq",
2527 .flags = IORESOURCE_IRQ,
2528 },
2529 {
2530 .start = MSM_WCNSS_PHYS,
2531 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2532 .name = "wcnss_mmio",
2533 .flags = IORESOURCE_MEM,
2534 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002535 {
2536 .start = 84,
2537 .end = 88,
2538 .name = "wcnss_gpios_5wire",
2539 .flags = IORESOURCE_IO,
2540 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002541};
2542
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002543static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2544 .has_48mhz_xo = 1,
2545};
2546
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002547static struct platform_device msm_device_wcnss_wlan = {
2548 .name = "wcnss_wlan",
2549 .id = 0,
2550 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2551 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002552 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002553};
2554
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2556 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2557 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2558 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2559
2560#define QCE_SIZE 0x10000
2561#define QCE_0_BASE 0x18500000
2562
2563#define QCE_HW_KEY_SUPPORT 0
2564#define QCE_SHA_HMAC_SUPPORT 1
2565#define QCE_SHARE_CE_RESOURCE 1
2566#define QCE_CE_SHARED 0
2567
2568static struct resource qcrypto_resources[] = {
2569 [0] = {
2570 .start = QCE_0_BASE,
2571 .end = QCE_0_BASE + QCE_SIZE - 1,
2572 .flags = IORESOURCE_MEM,
2573 },
2574 [1] = {
2575 .name = "crypto_channels",
2576 .start = DMOV_CE_IN_CHAN,
2577 .end = DMOV_CE_OUT_CHAN,
2578 .flags = IORESOURCE_DMA,
2579 },
2580 [2] = {
2581 .name = "crypto_crci_in",
2582 .start = DMOV_CE_IN_CRCI,
2583 .end = DMOV_CE_IN_CRCI,
2584 .flags = IORESOURCE_DMA,
2585 },
2586 [3] = {
2587 .name = "crypto_crci_out",
2588 .start = DMOV_CE_OUT_CRCI,
2589 .end = DMOV_CE_OUT_CRCI,
2590 .flags = IORESOURCE_DMA,
2591 },
2592};
2593
2594static struct resource qcedev_resources[] = {
2595 [0] = {
2596 .start = QCE_0_BASE,
2597 .end = QCE_0_BASE + QCE_SIZE - 1,
2598 .flags = IORESOURCE_MEM,
2599 },
2600 [1] = {
2601 .name = "crypto_channels",
2602 .start = DMOV_CE_IN_CHAN,
2603 .end = DMOV_CE_OUT_CHAN,
2604 .flags = IORESOURCE_DMA,
2605 },
2606 [2] = {
2607 .name = "crypto_crci_in",
2608 .start = DMOV_CE_IN_CRCI,
2609 .end = DMOV_CE_IN_CRCI,
2610 .flags = IORESOURCE_DMA,
2611 },
2612 [3] = {
2613 .name = "crypto_crci_out",
2614 .start = DMOV_CE_OUT_CRCI,
2615 .end = DMOV_CE_OUT_CRCI,
2616 .flags = IORESOURCE_DMA,
2617 },
2618};
2619
2620#endif
2621
2622#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2623 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2624
2625static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2626 .ce_shared = QCE_CE_SHARED,
2627 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2628 .hw_key_support = QCE_HW_KEY_SUPPORT,
2629 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2630};
2631
2632static struct platform_device qcrypto_device = {
2633 .name = "qcrypto",
2634 .id = 0,
2635 .num_resources = ARRAY_SIZE(qcrypto_resources),
2636 .resource = qcrypto_resources,
2637 .dev = {
2638 .coherent_dma_mask = DMA_BIT_MASK(32),
2639 .platform_data = &qcrypto_ce_hw_suppport,
2640 },
2641};
2642#endif
2643
2644#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2645 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2646
2647static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2648 .ce_shared = QCE_CE_SHARED,
2649 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2650 .hw_key_support = QCE_HW_KEY_SUPPORT,
2651 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2652};
2653
2654static struct platform_device qcedev_device = {
2655 .name = "qce",
2656 .id = 0,
2657 .num_resources = ARRAY_SIZE(qcedev_resources),
2658 .resource = qcedev_resources,
2659 .dev = {
2660 .coherent_dma_mask = DMA_BIT_MASK(32),
2661 .platform_data = &qcedev_ce_hw_suppport,
2662 },
2663};
2664#endif
2665
2666
2667static int __init gpiomux_init(void)
2668{
2669 int rc;
2670
2671 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2672 if (rc) {
2673 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2674 return rc;
2675 }
2676
Nishant Pandit24153d82011-08-27 16:05:13 +05302677 msm_gpiomux_install(msm8960_cam_common_configs,
2678 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002679
2680 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002681 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002682
2683 msm_gpiomux_install(msm8960_gsbi_configs,
2684 ARRAY_SIZE(msm8960_gsbi_configs));
2685
2686 msm_gpiomux_install(msm8960_cyts_configs,
2687 ARRAY_SIZE(msm8960_cyts_configs));
2688
2689 msm_gpiomux_install(msm8960_slimbus_config,
2690 ARRAY_SIZE(msm8960_slimbus_config));
2691
2692 msm_gpiomux_install(msm8960_audio_codec_configs,
2693 ARRAY_SIZE(msm8960_audio_codec_configs));
2694
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002695 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2696 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2697
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002698#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2699 msm_gpiomux_install(msm8960_hdmi_configs,
2700 ARRAY_SIZE(msm8960_hdmi_configs));
2701#endif
2702
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002703 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2704 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706 msm_gpiomux_install(wcnss_5wire_interface,
2707 ARRAY_SIZE(wcnss_5wire_interface));
2708
Mohan Pallaka5e490392011-09-09 15:18:41 +05302709 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2710 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2711 msm_gpiomux_install(hap_lvl_shft_config,
2712 ARRAY_SIZE(hap_lvl_shft_config));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002713 return 0;
2714}
2715
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002716#define MSM_SHARED_RAM_PHYS 0x80000000
2717
2718static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2719 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2720 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2721 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2722 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2723 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2724 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2725 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2726 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2727 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2728 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2729 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2730 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2732 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2733 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2734 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2735 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2736 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2737 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2738 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2739 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2740 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2741 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2742 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2743 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2744 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002745 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002746 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2747 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2748 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002749 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2750 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751};
2752
2753static struct pm8921_adc_properties pm8921_adc_data = {
2754 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2755 .bitresolution = 15,
2756 .bipolar = 0,
2757};
2758
2759static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2760 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002761 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002762 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002763 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002764};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002765
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002766static void __init msm8960_map_io(void)
2767{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002768 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002769 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002770
2771 if (socinfo_init() < 0)
2772 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002773}
2774
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002775#ifdef CONFIG_ARCH_MSM8930
2776static void __init msm8930_map_io(void)
2777{
2778 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2779 msm_map_msm8930_io();
2780
2781 if (socinfo_init() < 0)
2782 pr_err("socinfo_init() failed!\n");
2783}
2784#endif
2785
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002786static void __init msm8960_init_irq(void)
2787{
2788 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789
2790 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002791 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002793
2794 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002795 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002796
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002797 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2798 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002799
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002800 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2801 * as they are configured as level, which does not play nice with
2802 * handle_percpu_irq.
2803 */
2804 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2805 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002806 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002807 }
2808}
2809
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002810/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811enum sdcc_controllers {
2812 SDCC1,
2813 SDCC2,
2814 SDCC3,
2815 SDCC4,
2816 SDCC5,
2817 MAX_SDCC_CONTROLLER
2818};
2819
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002820/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002821static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2822 /* SDCC1 : eMMC card connected */
2823 [SDCC1] = {
2824 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302825 .high_vol_level = 2950000,
2826 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302827 .always_on = 1,
2828 .lpm_sup = 1,
2829 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002830 .hpm_uA = 200000, /* 200mA */
2831 },
2832 /* SDCC3 : External card slot connected */
2833 [SDCC3] = {
2834 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302835 .high_vol_level = 2950000,
2836 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002837 .hpm_uA = 600000, /* 600mA */
2838 }
2839};
2840
2841/* Only slots having eMMC card will require VCCQ voltage */
2842static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2843 /* SDCC1 : eMMC card connected */
2844 [SDCC1] = {
2845 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002846 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302847 .high_vol_level = 1800000,
2848 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002849 .hpm_uA = 200000, /* 200mA */
2850 }
2851};
2852
2853/* All SDCC controllers may require voting for VDD PAD voltage */
2854static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2855 /* SDCC3 : External card slot connected */
2856 [SDCC3] = {
2857 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302858 .high_vol_level = 2950000,
2859 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002860 .always_on = 1,
2861 .lpm_sup = 1,
2862 /* Max. Active current required is 16 mA */
2863 .hpm_uA = 16000,
2864 /*
2865 * Sleep current required is ~300 uA. But min. vote can be
2866 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2867 * during sleep.
2868 */
2869 .lpm_uA = 2000,
2870 }
2871};
2872
2873static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2874 /* SDCC1 : eMMC card connected */
2875 [SDCC1] = {
2876 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2877 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2878 },
2879 /* SDCC3 : External card slot connected */
2880 [SDCC3] = {
2881 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2882 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2883 }
2884};
2885
2886/* SDC1 pad data */
2887static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2888 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302889 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2890 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002891};
2892
2893static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2894 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2895 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2896 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2897};
2898
2899static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302900 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002901 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2902 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2903};
2904
2905static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302906 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2908 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2909};
2910
2911/* SDC3 pad data */
2912static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2913 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2914 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2915 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2916};
2917
2918static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2919 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2920 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2921 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2922};
2923
2924static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302925 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002926 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2927 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2928};
2929
2930static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302931 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302932 /*
2933 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2934 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2935 * which would result in false card detection interrupts.
2936 */
2937 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2938 /*
2939 * Keeping DATA lines status to PULL UP will make sure that
2940 * there is no current leak during sleep if external pull up
2941 * is connected to DATA lines.
2942 */
2943 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002944};
2945
2946struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2947 [SDCC1] = {
2948 .on = sdc1_pad_pull_on_cfg,
2949 .off = sdc1_pad_pull_off_cfg,
2950 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2951 },
2952 [SDCC3] = {
2953 .on = sdc3_pad_pull_on_cfg,
2954 .off = sdc3_pad_pull_off_cfg,
2955 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2956 },
2957};
2958
2959struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2960 [SDCC1] = {
2961 .on = sdc1_pad_drv_on_cfg,
2962 .off = sdc1_pad_drv_off_cfg,
2963 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2964 },
2965 [SDCC3] = {
2966 .on = sdc3_pad_drv_on_cfg,
2967 .off = sdc3_pad_drv_off_cfg,
2968 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2969 },
2970};
2971
2972struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2973 [SDCC1] = {
2974 .pull = &mmc_pad_pull_data[SDCC1],
2975 .drv = &mmc_pad_drv_data[SDCC1]
2976 },
2977 [SDCC3] = {
2978 .pull = &mmc_pad_pull_data[SDCC3],
2979 .drv = &mmc_pad_drv_data[SDCC3]
2980 },
2981};
2982
2983struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2984 [SDCC1] = {
2985 .pad_data = &mmc_pad_data[SDCC1],
2986 },
2987 [SDCC3] = {
2988 .pad_data = &mmc_pad_data[SDCC3],
2989 },
2990};
2991
2992static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302993 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002994};
2995
2996static unsigned int sdc3_sup_clk_rates[] = {
2997 400000, 24000000, 48000000, 96000000
2998};
2999
3000#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3001static struct mmc_platform_data msm8960_sdc1_data = {
3002 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3003#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3004 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3005#else
3006 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3007#endif
3008 .sup_clk_table = sdc1_sup_clk_rates,
3009 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303010 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003011 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003012 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303013 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003014};
3015#endif
3016
3017#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3018static struct mmc_platform_data msm8960_sdc3_data = {
3019 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3020 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3021 .sup_clk_table = sdc3_sup_clk_rates,
3022 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303023 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303024#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003025 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303026#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003027 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3028 .pin_data = &mmc_slot_pin_data[SDCC3],
3029#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3030 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3031 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3032 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3033#endif
3034 .xpc_cap = 1,
3035 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3036 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303037 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003038};
3039#endif
3040
3041static void __init msm8960_init_mmc(void)
3042{
3043#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3044 /* SDC1 : eMMC card connected */
3045 msm_add_sdcc(1, &msm8960_sdc1_data);
3046#endif
3047#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3048 /* SDC3: External card slot */
3049 msm_add_sdcc(3, &msm8960_sdc3_data);
3050#endif
3051}
3052
3053static void __init msm8960_init_buses(void)
3054{
3055#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003056 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003057 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3058 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3059 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3060 msm_bus_apps_fabric.dev.platform_data =
3061 &msm_bus_8960_apps_fabric_pdata;
3062 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3063 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3064 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3065 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003066#endif
3067}
3068
3069static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3070 .max_clock_speed = 15060000,
3071};
3072
3073#ifdef CONFIG_USB_MSM_OTG_72K
3074static struct msm_otg_platform_data msm_otg_pdata;
3075#else
3076#define USB_5V_EN 42
3077static void msm_hsusb_vbus_power(bool on)
3078{
3079 int rc;
3080 static bool vbus_is_on;
3081 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003082
3083 if (vbus_is_on == on)
3084 return;
3085
3086 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003087 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3088 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003089 if (IS_ERR(mvs_otg_switch)) {
3090 pr_err("Unable to get mvs_otg_switch\n");
3091 return;
3092 }
3093
3094 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3095 "usb_5v_en");
3096 if (rc < 0) {
3097 pr_err("failed to request usb_5v_en gpio\n");
3098 goto put_mvs_otg;
3099 }
3100
Anji jonnala2936fd92011-11-09 15:39:22 +05303101 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3102 if (rc) {
3103 pr_err("%s: unable to set_direction for gpio [%d]\n",
3104 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003105 goto free_usb_5v_en;
3106 }
3107
Anji jonnala2936fd92011-11-09 15:39:22 +05303108 if (regulator_enable(mvs_otg_switch)) {
3109 pr_err("unable to enable mvs_otg_switch\n");
3110 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303112
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003113 vbus_is_on = true;
3114 return;
3115 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303116 regulator_disable(mvs_otg_switch);
3117err_ldo_gpio_set_dir:
3118 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003119free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303120 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003121put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303122 regulator_put(mvs_otg_switch);
3123 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003124}
3125
3126static struct msm_otg_platform_data msm_otg_pdata = {
3127 .mode = USB_OTG,
3128 .otg_control = OTG_PMIC_CONTROL,
3129 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3130 .pclk_src_name = "dfab_usb_hs_clk",
3131 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3132 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303133 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134};
3135#endif
3136
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303137#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303138#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303139static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3140 .strobe = 150,
3141 .data = 151,
3142};
3143#else
3144static struct msm_hsic_host_platform_data msm_hsic_pdata;
3145#endif
3146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003147#define PID_MAGIC_ID 0x71432909
3148#define SERIAL_NUM_MAGIC_ID 0x61945374
3149#define SERIAL_NUMBER_LENGTH 127
3150#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3151
3152struct magic_num_struct {
3153 uint32_t pid;
3154 uint32_t serial_num;
3155};
3156
3157struct dload_struct {
3158 uint32_t reserved1;
3159 uint32_t reserved2;
3160 uint32_t reserved3;
3161 uint16_t reserved4;
3162 uint16_t pid;
3163 char serial_number[SERIAL_NUMBER_LENGTH];
3164 uint16_t reserved5;
3165 struct magic_num_struct magic_struct;
3166};
3167
3168static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3169{
3170 struct dload_struct __iomem *dload = 0;
3171
3172 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3173 if (!dload) {
3174 pr_err("%s: cannot remap I/O memory region: %08x\n",
3175 __func__, DLOAD_USB_BASE_ADD);
3176 return -ENXIO;
3177 }
3178
3179 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3180 __func__, dload, pid, snum);
3181 /* update pid */
3182 dload->magic_struct.pid = PID_MAGIC_ID;
3183 dload->pid = pid;
3184
3185 /* update serial number */
3186 dload->magic_struct.serial_num = 0;
3187 if (!snum) {
3188 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3189 goto out;
3190 }
3191
3192 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003193 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003194out:
3195 iounmap(dload);
3196 return 0;
3197}
3198
3199static struct android_usb_platform_data android_usb_pdata = {
3200 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3201};
3202
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003203static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003204 .name = "android_usb",
3205 .id = -1,
3206 .dev = {
3207 .platform_data = &android_usb_pdata,
3208 },
3209};
3210
3211static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3212 0x03, 0x0f,
3213};
3214
3215static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3216 0x00, 0x24, 0x54, 0x10,
3217 0x09, 0x03, 0x01,
3218 0x10, 0x54, 0x30, 0x0C,
3219 0x24, 0x30, 0x0f,
3220};
3221
3222static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3223 0x00, 0x24, 0x54, 0x10,
3224 0x09, 0x07, 0x01, 0x0B,
3225 0x10, 0x54, 0x30, 0x0C,
3226 0x24, 0x30, 0x0f,
3227};
3228
3229static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3230 [0] = {
3231 .mode = MSM_SPM_MODE_CLOCK_GATING,
3232 .notify_rpm = false,
3233 .cmd = spm_wfi_cmd_sequence,
3234 },
3235 [1] = {
3236 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3237 .notify_rpm = false,
3238 .cmd = spm_power_collapse_without_rpm,
3239 },
3240 [2] = {
3241 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3242 .notify_rpm = true,
3243 .cmd = spm_power_collapse_with_rpm,
3244 },
3245};
3246
3247static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3248 [0] = {
3249 .reg_base_addr = MSM_SAW0_BASE,
3250 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3251 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3252 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3253#if defined(CONFIG_MSM_AVS_HW)
3254 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3255 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3256#endif
3257 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3258 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3259 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3260 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3261 .vctl_timeout_us = 50,
3262 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3263 .modes = msm_spm_seq_list,
3264 },
3265 [1] = {
3266 .reg_base_addr = MSM_SAW1_BASE,
3267 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3268 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3269 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3270#if defined(CONFIG_MSM_AVS_HW)
3271 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3272 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3273#endif
3274 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3275 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3276 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3277 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3278 .vctl_timeout_us = 50,
3279 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3280 .modes = msm_spm_seq_list,
3281 },
3282};
3283
3284static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3285 0x00, 0x20, 0x03, 0x20,
3286 0x00, 0x0f,
3287};
3288
3289static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3290 0x00, 0x20, 0x34, 0x64,
3291 0x48, 0x07, 0x48, 0x20,
3292 0x50, 0x64, 0x04, 0x34,
3293 0x50, 0x0f,
3294};
3295static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3296 0x00, 0x10, 0x34, 0x64,
3297 0x48, 0x07, 0x48, 0x10,
3298 0x50, 0x64, 0x04, 0x34,
3299 0x50, 0x0F,
3300};
3301
3302static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3303 [0] = {
3304 .mode = MSM_SPM_L2_MODE_RETENTION,
3305 .notify_rpm = false,
3306 .cmd = l2_spm_wfi_cmd_sequence,
3307 },
3308 [1] = {
3309 .mode = MSM_SPM_L2_MODE_GDHS,
3310 .notify_rpm = true,
3311 .cmd = l2_spm_gdhs_cmd_sequence,
3312 },
3313 [2] = {
3314 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3315 .notify_rpm = true,
3316 .cmd = l2_spm_power_off_cmd_sequence,
3317 },
3318};
3319
3320
3321static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3322 [0] = {
3323 .reg_base_addr = MSM_SAW_L2_BASE,
3324 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3325 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3326 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3327 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3328 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3329 .modes = msm_spm_l2_seq_list,
3330 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3331 },
3332};
3333
Mohan Pallaka5e490392011-09-09 15:18:41 +05303334#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3335#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3336
3337static struct msm_xo_voter *xo_handle_d1;
3338
3339static int isa1200_power(int on)
3340{
3341 int rc = 0;
3342
3343 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3344
3345 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3346 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3347 if (rc < 0) {
3348 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3349 __func__, on ? "" : "de-", rc);
3350 goto err_xo_vote;
3351 }
3352
3353 return 0;
3354
3355err_xo_vote:
3356 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3357 return rc;
3358}
3359
3360static int isa1200_dev_setup(bool enable)
3361{
3362 int rc = 0;
3363
3364 struct pm_gpio hap_gpio_config = {
3365 .direction = PM_GPIO_DIR_OUT,
3366 .pull = PM_GPIO_PULL_NO,
3367 .out_strength = PM_GPIO_STRENGTH_HIGH,
3368 .function = PM_GPIO_FUNC_NORMAL,
3369 .inv_int_pol = 0,
3370 .vin_sel = 2,
3371 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3372 .output_value = 0,
3373 };
3374
3375 if (enable == true) {
3376 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3377 if (rc) {
3378 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3379 __func__, PM_HAP_EN_GPIO, rc);
3380 return rc;
3381 }
3382
3383 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3384 if (rc) {
3385 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3386 __func__, PM_HAP_LEN_GPIO, rc);
3387 return rc;
3388 }
3389
3390 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3391 if (rc) {
3392 pr_err("%s: unable to request gpio %d (%d)\n",
3393 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3394 return rc;
3395 }
3396
3397 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3398 if (rc) {
3399 pr_err("%s: Unable to set direction\n", __func__);
3400 goto free_gpio;
3401 }
3402
3403 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3404 if (IS_ERR(xo_handle_d1)) {
3405 rc = PTR_ERR(xo_handle_d1);
3406 pr_err("%s: failed to get the handle for D1(%d)\n",
3407 __func__, rc);
3408 goto gpio_set_dir;
3409 }
3410 } else {
3411 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3412
3413 msm_xo_put(xo_handle_d1);
3414 }
3415
3416 return 0;
3417
3418gpio_set_dir:
3419 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3420free_gpio:
3421 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3422 return rc;
3423}
3424
3425static struct isa1200_regulator isa1200_reg_data[] = {
3426 {
3427 .name = "vcc_i2c",
3428 .min_uV = ISA_I2C_VTG_MIN_UV,
3429 .max_uV = ISA_I2C_VTG_MAX_UV,
3430 .load_uA = ISA_I2C_CURR_UA,
3431 },
3432};
3433
3434static struct isa1200_platform_data isa1200_1_pdata = {
3435 .name = "vibrator",
3436 .dev_setup = isa1200_dev_setup,
3437 .power_on = isa1200_power,
3438 .hap_en_gpio = PM_HAP_EN_GPIO,
3439 .hap_len_gpio = PM_HAP_LEN_GPIO,
3440 .max_timeout = 15000,
3441 .mode_ctrl = PWM_GEN_MODE,
3442 .pwm_fd = {
3443 .pwm_div = 256,
3444 },
3445 .is_erm = false,
3446 .smart_en = true,
3447 .ext_clk_en = true,
3448 .chip_en = 1,
3449 .regulator_info = isa1200_reg_data,
3450 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3451};
3452
3453static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3454 {
3455 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3456 .platform_data = &isa1200_1_pdata,
3457 },
3458};
3459
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003460#define CYTTSP_TS_GPIO_IRQ 11
3461#define CYTTSP_TS_SLEEP_GPIO 50
3462#define CYTTSP_TS_RESOUT_N_GPIO 52
3463
3464/*virtual key support */
3465static ssize_t tma340_vkeys_show(struct kobject *kobj,
3466 struct kobj_attribute *attr, char *buf)
3467{
3468 return snprintf(buf, 200,
3469 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3470 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3471 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3472 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3473 "\n");
3474}
3475
3476static struct kobj_attribute tma340_vkeys_attr = {
3477 .attr = {
3478 .mode = S_IRUGO,
3479 },
3480 .show = &tma340_vkeys_show,
3481};
3482
3483static struct attribute *tma340_properties_attrs[] = {
3484 &tma340_vkeys_attr.attr,
3485 NULL
3486};
3487
3488static struct attribute_group tma340_properties_attr_group = {
3489 .attrs = tma340_properties_attrs,
3490};
3491
3492
3493static int cyttsp_platform_init(struct i2c_client *client)
3494{
3495 int rc = 0;
3496 static struct kobject *tma340_properties_kobj;
3497
3498 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3499 tma340_properties_kobj = kobject_create_and_add("board_properties",
3500 NULL);
3501 if (tma340_properties_kobj)
3502 rc = sysfs_create_group(tma340_properties_kobj,
3503 &tma340_properties_attr_group);
3504 if (!tma340_properties_kobj || rc)
3505 pr_err("%s: failed to create board_properties\n",
3506 __func__);
3507
3508 return 0;
3509}
3510
3511static struct cyttsp_regulator regulator_data[] = {
3512 {
3513 .name = "vdd",
3514 .min_uV = CY_TMA300_VTG_MIN_UV,
3515 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303516 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3517 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 },
3519 /* TODO: Remove after runtime PM is enabled in I2C driver */
3520 {
3521 .name = "vcc_i2c",
3522 .min_uV = CY_I2C_VTG_MIN_UV,
3523 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303524 .hpm_load_uA = CY_I2C_CURR_UA,
3525 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003526 },
3527};
3528
3529static struct cyttsp_platform_data cyttsp_pdata = {
3530 .panel_maxx = 634,
3531 .panel_maxy = 1166,
3532 .disp_maxx = 616,
3533 .disp_maxy = 1023,
3534 .disp_minx = 0,
3535 .disp_miny = 16,
3536 .flags = 0x01,
3537 .gen = CY_GEN3, /* or */
3538 .use_st = CY_USE_ST,
3539 .use_mt = CY_USE_MT,
3540 .use_hndshk = CY_SEND_HNDSHK,
3541 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303542 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003543 .use_gestures = CY_USE_GESTURES,
3544 .fw_fname = "cyttsp_8960_cdp.hex",
3545 /* activate up to 4 groups
3546 * and set active distance
3547 */
3548 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3549 CY_GEST_GRP3 | CY_GEST_GRP4 |
3550 CY_ACT_DIST,
3551 /* change act_intrvl to customize the Active power state
3552 * scanning/processing refresh interval for Operating mode
3553 */
3554 .act_intrvl = CY_ACT_INTRVL_DFLT,
3555 /* change tch_tmout to customize the touch timeout for the
3556 * Active power state for Operating mode
3557 */
3558 .tch_tmout = CY_TCH_TMOUT_DFLT,
3559 /* change lp_intrvl to customize the Low Power power state
3560 * scanning/processing refresh interval for Operating mode
3561 */
3562 .lp_intrvl = CY_LP_INTRVL_DFLT,
3563 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3564 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3565 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3566 .regulator_info = regulator_data,
3567 .num_regulators = ARRAY_SIZE(regulator_data),
3568 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303569 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003570};
3571
3572static struct i2c_board_info cyttsp_info[] __initdata = {
3573 {
3574 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3575 .platform_data = &cyttsp_pdata,
3576#ifndef CY_USE_TIMER
3577 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3578#endif /* CY_USE_TIMER */
3579 },
3580};
3581
Mohan Pallaka50837382011-09-07 11:00:57 +05303582/* configuration data */
3583static const u8 mxt_config_data[] = {
3584 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003585 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303586 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003587 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07003588 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, 0, 0, 0, 0, 0, 0,
3593 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303594 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003595 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303596 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003597 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05303598 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003599 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
3600 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
3601 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
3602 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303603 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003604 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3605 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303606 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003607 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3608 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303609 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003610 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3611 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303612 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003613 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3614 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303615 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003616 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303617 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08003618 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303619 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003620 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303621 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003622 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303623 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003624 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303625};
3626
3627#define MXT_TS_GPIO_IRQ 11
3628#define MXT_TS_LDO_EN_GPIO 50
3629#define MXT_TS_RESET_GPIO 52
3630
3631static void mxt_init_hw_liquid(void)
3632{
3633 int rc;
3634
3635 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3636 if (rc) {
3637 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3638 __func__, MXT_TS_GPIO_IRQ);
3639 return;
3640 }
3641
3642 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3643 if (rc) {
3644 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3645 __func__, MXT_TS_GPIO_IRQ);
3646 goto err_irq_gpio_req;
3647 }
3648
3649 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3650 if (rc) {
3651 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3652 __func__, MXT_TS_LDO_EN_GPIO);
3653 goto err_irq_gpio_req;
3654 }
3655
3656 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3657 if (rc) {
3658 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3659 __func__, MXT_TS_LDO_EN_GPIO);
3660 goto err_ldo_gpio_req;
3661 }
3662
3663 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3664 if (rc) {
3665 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3666 __func__, MXT_TS_RESET_GPIO);
3667 goto err_ldo_gpio_set_dir;
3668 }
3669
3670 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3671 if (rc) {
3672 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3673 __func__, MXT_TS_RESET_GPIO);
3674 goto err_reset_gpio_req;
3675 }
3676
3677 return;
3678
3679err_reset_gpio_req:
3680 gpio_free(MXT_TS_RESET_GPIO);
3681err_ldo_gpio_set_dir:
3682 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3683err_ldo_gpio_req:
3684 gpio_free(MXT_TS_LDO_EN_GPIO);
3685err_irq_gpio_req:
3686 gpio_free(MXT_TS_GPIO_IRQ);
3687}
3688
3689static struct mxt_platform_data mxt_platform_data = {
3690 .config = mxt_config_data,
3691 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003692 .x_size = 1365,
3693 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303694 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003695 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303696};
3697
3698static struct i2c_board_info mxt_device_info[] __initdata = {
3699 {
3700 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3701 .platform_data = &mxt_platform_data,
3702 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3703 },
3704};
3705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003706static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3707{
3708}
3709
3710static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3711 .clk_freq = 100000,
3712 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003713 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3714};
3715
3716static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3717 .clk_freq = 100000,
3718 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003719 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3720};
3721
3722static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3723 .clk_freq = 100000,
3724 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003725 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3726};
3727
3728static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3729 .clk_freq = 100000,
3730 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003731 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3732};
3733
3734static struct msm_rpm_platform_data msm_rpm_data = {
3735 .reg_base_addrs = {
3736 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3737 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3738 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3739 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3740 },
3741
3742 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3743 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3744 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3745 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3746 .msm_apps_ipc_rpm_val = 4,
3747};
3748
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003749static struct ks8851_pdata spi_eth_pdata = {
3750 .irq_gpio = KS8851_IRQ_GPIO,
3751 .rst_gpio = KS8851_RST_GPIO,
3752};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003753
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003754static struct spi_board_info spi_board_info[] __initdata = {
3755 {
3756 .modalias = "ks8851",
3757 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3758 .max_speed_hz = 19200000,
3759 .bus_num = 0,
3760 .chip_select = 0,
3761 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003762 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003763 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003764 {
3765 .modalias = "dsi_novatek_3d_panel_spi",
3766 .max_speed_hz = 10800000,
3767 .bus_num = 0,
3768 .chip_select = 1,
3769 .mode = SPI_MODE_0,
3770 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003771};
3772
3773static struct platform_device msm_device_saw_core0 = {
3774 .name = "saw-regulator",
3775 .id = 0,
3776 .dev = {
3777 .platform_data = &msm_saw_regulator_pdata_s5,
3778 },
3779};
3780
3781static struct platform_device msm_device_saw_core1 = {
3782 .name = "saw-regulator",
3783 .id = 1,
3784 .dev = {
3785 .platform_data = &msm_saw_regulator_pdata_s6,
3786 },
3787};
3788
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003789#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3790static struct platform_device wfd_device = {
3791 .name = "msm_wfd",
3792 .id = -1,
3793};
3794#endif
3795
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003796static struct tsens_platform_data msm_tsens_pdata = {
3797 .slope = 910,
3798 .tsens_factor = 1000,
3799 .hw_type = MSM_8960,
3800 .tsens_num_sensor = 5,
3801};
3802
3803static struct platform_device msm_tsens_device = {
3804 .name = "tsens8960-tm",
3805 .id = -1,
3806 .dev = {
3807 .platform_data = &msm_tsens_pdata,
3808 },
3809};
3810
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003811#ifdef CONFIG_MSM_FAKE_BATTERY
3812static struct platform_device fish_battery_device = {
3813 .name = "fish_battery",
3814};
3815#endif
3816
David Collins26f05562011-06-20 09:56:28 -07003817static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003818 .name = GPIO_REGULATOR_DEV_NAME,
3819 .id = PM8921_MPP_PM_TO_SYS(7),
3820 .dev = {
3821 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3822 },
3823};
3824
David Collins26f05562011-06-20 09:56:28 -07003825static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003826 .name = GPIO_REGULATOR_DEV_NAME,
3827 .id = 91,
3828 .dev = {
3829 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3830 },
3831};
3832
David Collinsb10be1d2011-09-02 10:29:31 -07003833static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3834 .name = GPIO_REGULATOR_DEV_NAME,
3835 .id = PM8921_GPIO_PM_TO_SYS(17),
3836 .dev = {
3837 .platform_data =
3838 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3839 },
3840};
3841
David Collins26f05562011-06-20 09:56:28 -07003842static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3843 .name = "rpm-regulator",
3844 .id = -1,
3845 .dev = {
3846 .platform_data = &msm_rpm_regulator_pdata,
3847 },
3848};
3849
David Collins4c31a872011-08-31 10:07:10 -07003850static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3851 .phys_addr_base = 0x0010C000,
3852 .reg_offsets = {
3853 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3854 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3855 },
3856 .phys_size = SZ_8K,
3857 .log_len = 4096, /* log's buffer length in bytes */
3858 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3859};
3860
3861static struct platform_device msm_rpm_log_device = {
3862 .name = "msm_rpm_log",
3863 .id = -1,
3864 .dev = {
3865 .platform_data = &msm_rpm_log_pdata,
3866 },
3867};
3868
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003869static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003870 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003871 &msm_device_smd,
3872 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303873 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003874 &msm_device_saw_core0,
3875 &msm_device_saw_core1,
3876 &msm8960_device_ext_5v_vreg,
3877 &msm8960_device_ext_l2_vreg,
3878 &msm8960_device_ssbi_pm8921,
3879 &msm8960_device_qup_spi_gsbi1,
3880 &msm8960_device_qup_i2c_gsbi3,
3881 &msm8960_device_qup_i2c_gsbi4,
3882 &msm8960_device_qup_i2c_gsbi10,
3883#ifndef CONFIG_MSM_DSPS
3884 &msm8960_device_qup_i2c_gsbi12,
3885#endif
3886 &msm_slim_ctrl,
3887 &msm_device_wcnss_wlan,
3888#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3889 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3890 &qcrypto_device,
3891#endif
3892
3893#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3894 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3895 &qcedev_device,
3896#endif
3897#ifdef CONFIG_MSM_ROTATOR
3898 &msm_rotator_device,
3899#endif
3900 &msm_device_sps,
3901#ifdef CONFIG_MSM_FAKE_BATTERY
3902 &fish_battery_device,
3903#endif
3904#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003905#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003906 &android_pmem_device,
3907 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003908#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003909 &android_pmem_audio_device,
3910#endif
3911 &msm_fb_device,
3912 &msm_device_vidc,
3913 &msm_device_bam_dmux,
3914 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003915
3916#ifdef CONFIG_HW_RANDOM_MSM
3917 &msm_device_rng,
3918#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003919 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003920#ifdef CONFIG_ION_MSM
3921 &ion_dev,
3922#endif
David Collins4c31a872011-08-31 10:07:10 -07003923 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003924 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003925#ifdef CONFIG_MSM_QDSS
3926 &msm_etb_device,
3927 &msm_tpiu_device,
3928 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003929 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003930 &msm_ptm_device,
3931#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003932 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003933 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003934#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3935 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003936 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003937#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003938};
3939
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003940static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003941 &msm8960_device_otg,
3942 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003943 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303944 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003945 &android_usb_device,
3946 &msm_device_vidc,
3947 &mipi_dsi_simulator_panel_device,
3948 &msm_bus_apps_fabric,
3949 &msm_bus_sys_fabric,
3950 &msm_bus_mm_fabric,
3951 &msm_bus_sys_fpb,
3952 &msm_bus_cpss_fpb,
3953 &msm_pcm,
3954 &msm_pcm_routing,
3955 &msm_cpudai0,
3956 &msm_cpudai1,
3957 &msm_cpudai_hdmi_rx,
3958 &msm_cpudai_bt_rx,
3959 &msm_cpudai_bt_tx,
3960 &msm_cpudai_fm_rx,
3961 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003962 &msm_cpudai_auxpcm_rx,
3963 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003964 &msm_cpu_fe,
3965 &msm_stub_codec,
3966 &msm_voice,
3967 &msm_voip,
3968 &msm_lpa_pcm,
3969
3970#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3971 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3972 &qcrypto_device,
3973#endif
3974
3975#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3976 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3977 &qcedev_device,
3978#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003979};
3980
3981static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003982 &msm_kgsl_3d0,
3983 &msm_kgsl_2d0,
3984 &msm_kgsl_2d1,
3985 &mipi_dsi_renesas_panel_device,
3986#ifdef CONFIG_MSM_GEMINI
3987 &msm8960_gemini_device,
3988#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003989};
3990
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003991static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003992 &msm8960_device_otg,
3993 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003994 &msm_device_hsusb_host,
3995 &android_usb_device,
3996 &msm_pcm,
3997 &msm_pcm_routing,
3998 &msm_cpudai0,
3999 &msm_cpudai1,
4000 &msm_cpudai_hdmi_rx,
4001 &msm_cpudai_bt_rx,
4002 &msm_cpudai_bt_tx,
4003 &msm_cpudai_fm_rx,
4004 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004005 &msm_cpudai_auxpcm_rx,
4006 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004007 &msm_cpu_fe,
4008 &msm_stub_codec,
4009 &msm_kgsl_3d0,
4010#ifdef CONFIG_MSM_KGSL_2D
4011 &msm_kgsl_2d0,
4012 &msm_kgsl_2d1,
4013#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004014 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004015#ifdef CONFIG_MSM_GEMINI
4016 &msm8960_gemini_device,
4017#endif
4018 &msm_voice,
4019 &msm_voip,
4020 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304021 &msm_cpudai_afe_01_rx,
4022 &msm_cpudai_afe_01_tx,
4023 &msm_cpudai_afe_02_rx,
4024 &msm_cpudai_afe_02_tx,
4025 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004026#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4027 &hdmi_msm_device,
4028#endif
4029 &msm_pcm_hostless,
4030 &msm_bus_apps_fabric,
4031 &msm_bus_sys_fabric,
4032 &msm_bus_mm_fabric,
4033 &msm_bus_sys_fpb,
4034 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004035 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004036};
4037
4038static void __init msm8960_i2c_init(void)
4039{
4040 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4041 &msm8960_i2c_qup_gsbi4_pdata;
4042
4043 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4044 &msm8960_i2c_qup_gsbi3_pdata;
4045
4046 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4047 &msm8960_i2c_qup_gsbi10_pdata;
4048
4049 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4050 &msm8960_i2c_qup_gsbi12_pdata;
4051}
4052
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004053static void __init msm8960_gfx_init(void)
4054{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004055 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004056 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4057 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4058 msm_kgsl_3d0.dev.platform_data;
4059 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
4060 320000000;
4061 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
4062 266667000;
4063 }
4064}
4065
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004066static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4067 .irq_base = PM8921_IRQ_BASE,
4068 .devirq = MSM_GPIO_TO_INT(104),
4069 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4070};
4071
4072static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4073 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4074};
4075
4076static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4077 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4078};
4079
4080static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4081 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304082 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004083};
4084
4085static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4086 .pull_up = 1,
4087 .kpd_trigger_delay_us = 970,
4088 .wakeup = 1,
4089};
4090
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304091/* Rotate lock key is not available so use F1 */
4092#define KEY_ROTATE_LOCK KEY_F1
4093
4094static const unsigned int keymap_liquid[] = {
4095 KEY(0, 0, KEY_VOLUMEUP),
4096 KEY(0, 1, KEY_VOLUMEDOWN),
4097 KEY(1, 3, KEY_ROTATE_LOCK),
4098 KEY(1, 4, KEY_HOME),
4099};
4100
4101static struct matrix_keymap_data keymap_data_liquid = {
4102 .keymap_size = ARRAY_SIZE(keymap_liquid),
4103 .keymap = keymap_liquid,
4104};
4105
4106static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4107 .input_name = "keypad_8960_liquid",
4108 .input_phys_device = "keypad_8960/input0",
4109 .num_rows = 2,
4110 .num_cols = 5,
4111 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4112 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4113 .debounce_ms = 15,
4114 .scan_delay_ms = 32,
4115 .row_hold_ns = 91500,
4116 .wakeup = 1,
4117 .keymap_data = &keymap_data_liquid,
4118};
4119
4120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004121static const unsigned int keymap[] = {
4122 KEY(0, 0, KEY_VOLUMEUP),
4123 KEY(0, 1, KEY_VOLUMEDOWN),
4124 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4125 KEY(0, 3, KEY_CAMERA_FOCUS),
4126};
4127
4128static struct matrix_keymap_data keymap_data = {
4129 .keymap_size = ARRAY_SIZE(keymap),
4130 .keymap = keymap,
4131};
4132
4133static struct pm8xxx_keypad_platform_data keypad_data = {
4134 .input_name = "keypad_8960",
4135 .input_phys_device = "keypad_8960/input0",
4136 .num_rows = 1,
4137 .num_cols = 5,
4138 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4139 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4140 .debounce_ms = 15,
4141 .scan_delay_ms = 32,
4142 .row_hold_ns = 91500,
4143 .wakeup = 1,
4144 .keymap_data = &keymap_data,
4145};
4146
4147static const unsigned int keymap_sim[] = {
4148 KEY(0, 0, KEY_7),
4149 KEY(0, 1, KEY_DOWN),
4150 KEY(0, 2, KEY_UP),
4151 KEY(0, 3, KEY_RIGHT),
4152 KEY(0, 4, KEY_ENTER),
4153 KEY(0, 5, KEY_L),
4154 KEY(0, 6, KEY_BACK),
4155 KEY(0, 7, KEY_M),
4156
4157 KEY(1, 0, KEY_LEFT),
4158 KEY(1, 1, KEY_SEND),
4159 KEY(1, 2, KEY_1),
4160 KEY(1, 3, KEY_4),
4161 KEY(1, 4, KEY_CLEAR),
4162 KEY(1, 5, KEY_MSDOS),
4163 KEY(1, 6, KEY_SPACE),
4164 KEY(1, 7, KEY_COMMA),
4165
4166 KEY(2, 0, KEY_6),
4167 KEY(2, 1, KEY_5),
4168 KEY(2, 2, KEY_8),
4169 KEY(2, 3, KEY_3),
4170 KEY(2, 4, KEY_NUMERIC_STAR),
4171 KEY(2, 5, KEY_UP),
4172 KEY(2, 6, KEY_DOWN),
4173 KEY(2, 7, KEY_LEFTSHIFT),
4174
4175 KEY(3, 0, KEY_9),
4176 KEY(3, 1, KEY_NUMERIC_POUND),
4177 KEY(3, 2, KEY_0),
4178 KEY(3, 3, KEY_2),
4179 KEY(3, 4, KEY_SLEEP),
4180 KEY(3, 5, KEY_F1),
4181 KEY(3, 6, KEY_F2),
4182 KEY(3, 7, KEY_F3),
4183
4184 KEY(4, 0, KEY_BACK),
4185 KEY(4, 1, KEY_HOME),
4186 KEY(4, 2, KEY_MENU),
4187 KEY(4, 3, KEY_VOLUMEUP),
4188 KEY(4, 4, KEY_VOLUMEDOWN),
4189 KEY(4, 5, KEY_F4),
4190 KEY(4, 6, KEY_F5),
4191 KEY(4, 7, KEY_F6),
4192
4193 KEY(5, 0, KEY_R),
4194 KEY(5, 1, KEY_T),
4195 KEY(5, 2, KEY_Y),
4196 KEY(5, 3, KEY_LEFTALT),
4197 KEY(5, 4, KEY_KPENTER),
4198 KEY(5, 5, KEY_Q),
4199 KEY(5, 6, KEY_W),
4200 KEY(5, 7, KEY_E),
4201
4202 KEY(6, 0, KEY_F),
4203 KEY(6, 1, KEY_G),
4204 KEY(6, 2, KEY_H),
4205 KEY(6, 3, KEY_CAPSLOCK),
4206 KEY(6, 4, KEY_PAGEUP),
4207 KEY(6, 5, KEY_A),
4208 KEY(6, 6, KEY_S),
4209 KEY(6, 7, KEY_D),
4210
4211 KEY(7, 0, KEY_V),
4212 KEY(7, 1, KEY_B),
4213 KEY(7, 2, KEY_N),
4214 KEY(7, 3, KEY_MENU),
4215 KEY(7, 4, KEY_PAGEDOWN),
4216 KEY(7, 5, KEY_Z),
4217 KEY(7, 6, KEY_X),
4218 KEY(7, 7, KEY_C),
4219
4220 KEY(8, 0, KEY_P),
4221 KEY(8, 1, KEY_J),
4222 KEY(8, 2, KEY_K),
4223 KEY(8, 3, KEY_INSERT),
4224 KEY(8, 4, KEY_LINEFEED),
4225 KEY(8, 5, KEY_U),
4226 KEY(8, 6, KEY_I),
4227 KEY(8, 7, KEY_O),
4228
4229 KEY(9, 0, KEY_4),
4230 KEY(9, 1, KEY_5),
4231 KEY(9, 2, KEY_6),
4232 KEY(9, 3, KEY_7),
4233 KEY(9, 4, KEY_8),
4234 KEY(9, 5, KEY_1),
4235 KEY(9, 6, KEY_2),
4236 KEY(9, 7, KEY_3),
4237
4238 KEY(10, 0, KEY_F7),
4239 KEY(10, 1, KEY_F8),
4240 KEY(10, 2, KEY_F9),
4241 KEY(10, 3, KEY_F10),
4242 KEY(10, 4, KEY_FN),
4243 KEY(10, 5, KEY_9),
4244 KEY(10, 6, KEY_0),
4245 KEY(10, 7, KEY_DOT),
4246
4247 KEY(11, 0, KEY_LEFTCTRL),
4248 KEY(11, 1, KEY_F11),
4249 KEY(11, 2, KEY_ENTER),
4250 KEY(11, 3, KEY_SEARCH),
4251 KEY(11, 4, KEY_DELETE),
4252 KEY(11, 5, KEY_RIGHT),
4253 KEY(11, 6, KEY_LEFT),
4254 KEY(11, 7, KEY_RIGHTSHIFT),
4255 KEY(0, 0, KEY_VOLUMEUP),
4256 KEY(0, 1, KEY_VOLUMEDOWN),
4257 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4258 KEY(0, 3, KEY_CAMERA_FOCUS),
4259};
4260
4261static struct matrix_keymap_data keymap_data_sim = {
4262 .keymap_size = ARRAY_SIZE(keymap_sim),
4263 .keymap = keymap_sim,
4264};
4265
4266static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4267 .input_name = "keypad_8960",
4268 .input_phys_device = "keypad_8960/input0",
4269 .num_rows = 12,
4270 .num_cols = 8,
4271 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4272 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4273 .debounce_ms = 15,
4274 .scan_delay_ms = 32,
4275 .row_hold_ns = 91500,
4276 .wakeup = 1,
4277 .keymap_data = &keymap_data_sim,
4278};
4279
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004280static int pm8921_therm_mitigation[] = {
4281 1100,
4282 700,
4283 600,
4284 325,
4285};
4286
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004287static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004288 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004289 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004290 .max_voltage = 4200,
4291 .min_voltage = 3200,
Abhijeet Dharmapurikard55878e2011-10-27 10:22:24 -07004292 .resume_voltage_delta = 100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004293 .term_current = 100,
4294 .cool_temp = 10,
4295 .warm_temp = 40,
4296 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004297 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004298 .cool_bat_chg_current = 350,
4299 .warm_bat_chg_current = 350,
4300 .cool_bat_voltage = 4100,
4301 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004302 .thermal_mitigation = pm8921_therm_mitigation,
4303 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004304};
4305
4306static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4307 .priority = 0,
4308};
4309
4310static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4311 .r_sense = 10,
4312 .i_test = 2500,
4313 .v_failure = 3000,
4314 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004315};
4316
Jay Chokshide4cefb2011-08-04 18:10:44 -07004317#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004318#define PM8XXX_LED_PWM_PERIOD 1000
4319#define PM8XXX_LED_PWM_DUTY_MS 20
4320/**
4321 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4322 * driven using PWM feature.
4323 */
4324#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004326static struct led_info pm8921_led_info[] = {
4327 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004328 .name = "led:battery_charging",
4329 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004330 },
4331 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004332 .name = "led:battery_full",
4333 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004334 },
4335};
4336
Jay Chokshi8994e392011-09-14 18:20:39 -07004337static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004338 .num_leds = ARRAY_SIZE(pm8921_led_info),
4339 .leds = pm8921_led_info,
4340};
4341
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004342static int pm8921_led0_pwm_duty_pcts[56] = {
4343 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4344 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4345 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4346 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4347 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4348 14, 10, 6, 4, 1
4349};
4350
4351static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4352 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4353 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4354 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4355 .start_idx = 0,
4356};
4357
Jay Chokshi8994e392011-09-14 18:20:39 -07004358static struct pm8xxx_led_config pm8921_led_configs[] = {
4359 [0] = {
4360 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004361 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004362 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004363 .pwm_channel = 5,
4364 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4365 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004366 },
4367 [1] = {
4368 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004369 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004370 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004371 .pwm_channel = 4,
4372 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004373 },
4374};
4375
4376static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4377 .led_core = &pm8921_led_core_pdata,
4378 .configs = pm8921_led_configs,
4379 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4380};
4381
Abhijeet Dharmapurikar82d93982011-11-09 15:52:25 -08004382static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
4383 .r_sense = 10,
4384};
4385
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004386static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4387 .irq_pdata = &pm8xxx_irq_pdata,
4388 .gpio_pdata = &pm8xxx_gpio_pdata,
4389 .mpp_pdata = &pm8xxx_mpp_pdata,
4390 .rtc_pdata = &pm8xxx_rtc_pdata,
4391 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4392 .keypad_pdata = &keypad_data,
4393 .misc_pdata = &pm8xxx_misc_pdata,
4394 .regulator_pdatas = msm_pm8921_regulator_pdata,
4395 .charger_pdata = &pm8921_chg_pdata,
4396 .bms_pdata = &pm8921_bms_pdata,
4397 .adc_pdata = &pm8921_adc_pdata,
4398 .leds_pdata = &pm8xxx_leds_pdata,
Abhijeet Dharmapurikar82d93982011-11-09 15:52:25 -08004399 .ccadc_pdata = &pm8xxx_ccadc_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004400};
4401
4402static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4403 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4404 .slave = {
4405 .name = "pm8921-core",
4406 .platform_data = &pm8921_platform_data,
4407 },
4408};
4409
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004410static struct msm_cpuidle_state msm_cstates[] __initdata = {
4411 {0, 0, "C0", "WFI",
4412 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4413
4414 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4415 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4416
4417 {0, 2, "C2", "POWER_COLLAPSE",
4418 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4419
4420 {1, 0, "C0", "WFI",
4421 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4422
4423 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4424 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4425};
4426
4427static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4428 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4429 .idle_supported = 1,
4430 .suspend_supported = 1,
4431 .idle_enabled = 0,
4432 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004433 },
4434
4435 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4436 .idle_supported = 1,
4437 .suspend_supported = 1,
4438 .idle_enabled = 0,
4439 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004440 },
4441
4442 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4443 .idle_supported = 1,
4444 .suspend_supported = 1,
4445 .idle_enabled = 1,
4446 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004447 },
4448
4449 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4450 .idle_supported = 0,
4451 .suspend_supported = 1,
4452 .idle_enabled = 0,
4453 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004454 },
4455
4456 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4457 .idle_supported = 1,
4458 .suspend_supported = 1,
4459 .idle_enabled = 0,
4460 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004461 },
4462
4463 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4464 .idle_supported = 1,
4465 .suspend_supported = 0,
4466 .idle_enabled = 1,
4467 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004468 },
4469};
4470
4471static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4472 {
4473 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4474 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4475 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004476 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004477 },
4478
4479 {
4480 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4481 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4482 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004483 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004484 },
4485
4486 {
4487 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4488 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4489 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004490 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004491 },
4492
4493 {
4494 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4495 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4496 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004497 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004498 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004499 {
4500 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4501 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4502 false,
4503 7000, 3500, 66600000, 5150,
4504 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004505
4506 {
4507 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4508 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4509 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004510 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004511 },
4512
4513 {
4514 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4515 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4516 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004517 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004518 },
4519
4520 {
4521 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4522 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4523 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004524 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004525 },
4526
4527 {
4528 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4529 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4530 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004531 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004532 },
4533};
4534
4535#ifdef CONFIG_I2C
4536#define I2C_SURF 1
4537#define I2C_FFA (1 << 1)
4538#define I2C_RUMI (1 << 2)
4539#define I2C_SIM (1 << 3)
4540#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004541#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004542
4543struct i2c_registry {
4544 u8 machs;
4545 int bus;
4546 struct i2c_board_info *info;
4547 int len;
4548};
4549
4550#ifdef CONFIG_MSM_CAMERA
4551static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4552#ifdef CONFIG_IMX074
4553 {
4554 I2C_BOARD_INFO("imx074", 0x1A),
4555 },
4556#endif
4557#ifdef CONFIG_OV2720
4558 {
4559 I2C_BOARD_INFO("ov2720", 0x6C),
4560 },
4561#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05304562#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4563 {
4564 I2C_BOARD_INFO("sc628a", 0x6E),
4565 },
4566#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004567};
4568#endif
4569
4570/* Sensors DSPS platform data */
4571#ifdef CONFIG_MSM_DSPS
4572#define DSPS_PIL_GENERIC_NAME "dsps"
4573#endif /* CONFIG_MSM_DSPS */
4574
4575static void __init msm8960_init_dsps(void)
4576{
4577#ifdef CONFIG_MSM_DSPS
4578 struct msm_dsps_platform_data *pdata =
4579 msm_dsps_device.dev.platform_data;
4580 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4581 pdata->gpios = NULL;
4582 pdata->gpios_num = 0;
4583
4584 platform_device_register(&msm_dsps_device);
4585#endif /* CONFIG_MSM_DSPS */
4586}
4587
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004588static void __init msm8960_init_hsic(void)
4589{
4590#ifdef CONFIG_USB_EHCI_MSM_HSIC
4591 uint32_t version = socinfo_get_version();
4592
4593 pr_info("%s: version:%d mtp:%d\n", __func__,
4594 SOCINFO_VERSION_MAJOR(version),
4595 machine_is_msm8960_mtp());
4596
4597 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4598 machine_is_msm8960_mtp() ||
4599 machine_is_msm8960_fluid())
4600 return;
4601
4602 msm_gpiomux_install(msm8960_hsic_configs,
4603 ARRAY_SIZE(msm8960_hsic_configs));
4604
4605 platform_device_register(&msm_device_hsic_host);
4606#endif
4607}
4608
4609
Amir Samuelov5137e392011-09-21 17:31:25 +03004610#ifdef CONFIG_ISL9519_CHARGER
4611static struct isl_platform_data isl_data __initdata = {
4612 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4613 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4614 .max_system_voltage = 4200,
4615 .min_system_voltage = 3200,
4616 .chgcurrent = 1000, /* 1900, */
4617 .term_current = 400, /* Need fine tuning */
4618 .input_current = 2048,
4619};
4620
4621static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4622 {
4623 I2C_BOARD_INFO("isl9519q", 0x9),
4624 .irq = 0, /* Not required when notify-by-pmic */
4625 .platform_data = &isl_data,
4626 },
4627};
4628#endif /* CONFIG_ISL9519_CHARGER */
4629
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004630static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4631#ifdef CONFIG_MSM_CAMERA
4632 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004633 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004634 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4635 msm_camera_boardinfo,
4636 ARRAY_SIZE(msm_camera_boardinfo),
4637 },
4638#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004639#ifdef CONFIG_ISL9519_CHARGER
4640 {
4641 I2C_LIQUID,
4642 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4643 isl_charger_i2c_info,
4644 ARRAY_SIZE(isl_charger_i2c_info),
4645 },
4646#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004647 {
4648 I2C_SURF | I2C_FFA | I2C_FLUID,
4649 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4650 cyttsp_info,
4651 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004652 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304653 {
4654 I2C_LIQUID,
4655 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4656 mxt_device_info,
4657 ARRAY_SIZE(mxt_device_info),
4658 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304659 {
4660 I2C_LIQUID,
4661 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4662 msm_isa1200_board_info,
4663 ARRAY_SIZE(msm_isa1200_board_info),
4664 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004665};
4666#endif /* CONFIG_I2C */
4667
4668static void __init register_i2c_devices(void)
4669{
4670#ifdef CONFIG_I2C
4671 u8 mach_mask = 0;
4672 int i;
4673
4674 /* Build the matching 'supported_machs' bitmask */
4675 if (machine_is_msm8960_cdp())
4676 mach_mask = I2C_SURF;
4677 else if (machine_is_msm8960_rumi3())
4678 mach_mask = I2C_RUMI;
4679 else if (machine_is_msm8960_sim())
4680 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004681 else if (machine_is_msm8960_fluid())
4682 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004683 else if (machine_is_msm8960_liquid())
4684 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004685 else if (machine_is_msm8960_mtp())
4686 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004687 else
4688 pr_err("unmatched machine ID in register_i2c_devices\n");
4689
4690 /* Run the array and install devices as appropriate */
4691 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4692 if (msm8960_i2c_devices[i].machs & mach_mask)
4693 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4694 msm8960_i2c_devices[i].info,
4695 msm8960_i2c_devices[i].len);
4696 }
4697#endif
4698}
4699
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004700static void __init msm8960_sim_init(void)
4701{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004702 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4703 &msm8960_device_watchdog.dev.platform_data;
4704
4705 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004706 BUG_ON(msm_rpm_init(&msm_rpm_data));
4707 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4708 ARRAY_SIZE(msm_rpmrs_levels)));
4709 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004710 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004711 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004712 msm8960_device_ssbi_pm8921.dev.platform_data =
4713 &msm8960_ssbi_pm8921_pdata;
4714 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004715
4716 /* Simulator supports a QWERTY keypad */
4717 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4718
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004719 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004720 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004721 msm8960_i2c_init();
4722 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4723 msm_spm_l2_init(msm_spm_l2_data);
4724 msm8960_init_buses();
4725 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4726 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004727 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004728 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004729
4730 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4731 &msm8960_qup_spi_gsbi1_pdata;
4732 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4733
4734 msm8960_init_mmc();
4735 msm_fb_add_devices();
4736 slim_register_board_info(msm_slim_devices,
4737 ARRAY_SIZE(msm_slim_devices));
4738 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4739 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4740 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4741 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004742 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004743}
4744
4745static void __init msm8960_rumi3_init(void)
4746{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004747 BUG_ON(msm_rpm_init(&msm_rpm_data));
4748 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4749 ARRAY_SIZE(msm_rpmrs_levels)));
4750 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004751 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004752 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004753 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004754 msm8960_device_ssbi_pm8921.dev.platform_data =
4755 &msm8960_ssbi_pm8921_pdata;
4756 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4757 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4758 &msm8960_qup_spi_gsbi1_pdata;
4759 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4760 msm8960_i2c_init();
4761 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4762 msm_spm_l2_init(msm_spm_l2_data);
4763 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4764 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004765 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004766 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004767 register_i2c_devices();
4768 msm_fb_add_devices();
4769 slim_register_board_info(msm_slim_devices,
4770 ARRAY_SIZE(msm_slim_devices));
4771 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4772 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4773 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4774 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004775 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004776}
4777
4778static void __init msm8960_cdp_init(void)
4779{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004780 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4781 pr_err("meminfo_init() failed!\n");
4782
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004783 BUG_ON(msm_rpm_init(&msm_rpm_data));
4784 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4785 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004786
4787 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004788 regulator_suppress_info_printing();
4789 if (msm_xo_init())
4790 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004791 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004792 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304793 if (machine_is_msm8960_liquid())
4794 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004795 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304796#ifdef CONFIG_USB_EHCI_MSM_HSIC
4797 if (machine_is_msm8960_liquid()) {
4798 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4799 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4800 }
4801#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304802 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004803 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304804 if (machine_is_msm8960_liquid())
4805 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004806 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4807 &msm8960_qup_spi_gsbi1_pdata;
4808 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4809 msm8960_device_ssbi_pm8921.dev.platform_data =
4810 &msm8960_ssbi_pm8921_pdata;
4811 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4812 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004813 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004814 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4815 msm_spm_l2_init(msm_spm_l2_data);
4816 msm8960_init_buses();
4817 platform_add_devices(msm_footswitch_devices,
4818 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004819 if (machine_is_msm8960_liquid())
4820 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004821 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4822 pm8921_gpio_mpp_init();
4823 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004824 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004825 msm8960_init_cam();
4826 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004827 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304828 if (machine_is_msm8960_liquid())
4829 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004830 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004831 msm_fb_add_devices();
4832 slim_register_board_info(msm_slim_devices,
4833 ARRAY_SIZE(msm_slim_devices));
4834 msm8960_init_dsps();
4835 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4836 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4837 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4838 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004839 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004840 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004841}
4842
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004843MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4844 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004845 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004846 .init_irq = msm8960_init_irq,
4847 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004848 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004849 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004850 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004851MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004852
4853MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4854 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004855 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004856 .init_irq = msm8960_init_irq,
4857 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004858 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004859 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004860 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004861MACHINE_END
4862
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004863MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4864 .map_io = msm8960_map_io,
4865 .reserve = msm8960_reserve,
4866 .init_irq = msm8960_init_irq,
4867 .timer = &msm_timer,
4868 .init_machine = msm8960_cdp_init,
4869 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004870 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004871MACHINE_END
4872
4873MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4874 .map_io = msm8960_map_io,
4875 .reserve = msm8960_reserve,
4876 .init_irq = msm8960_init_irq,
4877 .timer = &msm_timer,
4878 .init_machine = msm8960_cdp_init,
4879 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004880 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004881MACHINE_END
4882
4883MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4884 .map_io = msm8960_map_io,
4885 .reserve = msm8960_reserve,
4886 .init_irq = msm8960_init_irq,
4887 .timer = &msm_timer,
4888 .init_machine = msm8960_cdp_init,
4889 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004890 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004891MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004892
4893MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4894 .map_io = msm8960_map_io,
4895 .reserve = msm8960_reserve,
4896 .init_irq = msm8960_init_irq,
4897 .timer = &msm_timer,
4898 .init_machine = msm8960_cdp_init,
4899 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004900 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004901MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004902
4903#ifdef CONFIG_ARCH_MSM8930
4904MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4905 .map_io = msm8930_map_io,
4906 .reserve = msm8960_reserve,
4907 .init_irq = msm8960_init_irq,
4908 .timer = &msm_timer,
4909 .init_machine = msm8960_cdp_init,
4910 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004911 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004912MACHINE_END
4913
4914MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4915 .map_io = msm8930_map_io,
4916 .reserve = msm8960_reserve,
4917 .init_irq = msm8960_init_irq,
4918 .timer = &msm_timer,
4919 .init_machine = msm8960_cdp_init,
4920 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004921 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004922MACHINE_END
4923
4924MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4925 .map_io = msm8930_map_io,
4926 .reserve = msm8960_reserve,
4927 .init_irq = msm8960_init_irq,
4928 .timer = &msm_timer,
4929 .init_machine = msm8960_cdp_init,
4930 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004931 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004932MACHINE_END
4933#endif