blob: 35a4804ea9b557eadfb42f945bf88b1e662cc547 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070046#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049
50#include <mach/board.h>
51#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <mach/msm_spi.h>
53#ifdef CONFIG_USB_MSM_OTG_72K
54#include <mach/msm_hsusb.h>
55#else
56#include <linux/usb/msm_hsusb.h>
57#endif
58#include <linux/usb/android.h>
59#include <mach/usbdiag.h>
60#include <mach/socinfo.h>
61#include <mach/rpm.h>
62#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070063#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#include <mach/msm_bus_board.h>
65#include <mach/msm_memtypes.h>
66#include <mach/dma.h>
67#include <mach/msm_dsps.h>
68#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070069#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080070
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
Laura Abbottd6183792011-08-19 13:42:24 -070077#include <linux/ion.h>
78#include <mach/ion.h>
79
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080081#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#include "spm.h"
84#include "board-msm8960.h"
85#include "pm.h"
86#include "cpuidle.h"
87#include "rpm_resources.h"
88#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070089#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070090#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070091#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060092#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070093#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094
95static struct platform_device msm_fm_platform_init = {
96 .name = "iris_fm",
97 .id = -1,
98};
99
100struct pm8xxx_gpio_init {
101 unsigned gpio;
102 struct pm_gpio config;
103};
104
105struct pm8xxx_mpp_init {
106 unsigned mpp;
107 struct pm8xxx_mpp_config_data config;
108};
109
110#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
111 _func, _inv, _disable) \
112{ \
113 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
114 .config = { \
115 .direction = _dir, \
116 .output_buffer = _buf, \
117 .output_value = _val, \
118 .pull = _pull, \
119 .vin_sel = _vin, \
120 .out_strength = _out_strength, \
121 .function = _func, \
122 .inv_int_pol = _inv, \
123 .disable_pin = _disable, \
124 } \
125}
126
127#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
128{ \
129 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
130 .config = { \
131 .type = PM8XXX_MPP_TYPE_##_type, \
132 .level = _level, \
133 .control = PM8XXX_MPP_##_control, \
134 } \
135}
136
137#define PM8XXX_GPIO_DISABLE(_gpio) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
139 0, 0, 0, 1)
140
141#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
142 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
143 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
144 PM_GPIO_STRENGTH_HIGH, \
145 PM_GPIO_FUNC_NORMAL, 0, 0)
146
147#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
148 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
149 _pull, PM_GPIO_VIN_S4, \
150 PM_GPIO_STRENGTH_NO, \
151 PM_GPIO_FUNC_NORMAL, 0, 0)
152
153#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
154 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
155 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
156 PM_GPIO_STRENGTH_HIGH, \
157 _func, 0, 0)
158
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200159#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
160 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
161 PM_GPIO_PULL_NO, _vin, \
162 PM_GPIO_STRENGTH_HIGH, \
163 PM_GPIO_FUNC_NORMAL, 0, 0)
164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165/* Initial PM8921 GPIO configurations */
166static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
167 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
168 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
169 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300170 /* External regulator shared by display and touchscreen on LiQUID */
171 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200172 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700174 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700176 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530177 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178};
179
180/* Initial PM8921 MPP configurations */
181static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
182 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
183 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
185 DOUT_CTRL_LOW),
186};
187
188static void __init pm8921_gpio_mpp_init(void)
189{
190 int i, rc;
191
192 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
193 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
194 &pm8921_gpios[i].config);
195 if (rc) {
196 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
197 break;
198 }
199 }
200
201 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
202 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
203 &pm8921_mpps[i].config);
204 if (rc) {
205 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
206 break;
207 }
208 }
209}
210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211#define KS8851_RST_GPIO 89
212#define KS8851_IRQ_GPIO 90
213
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700214#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
215enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700216 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700217 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
218 /* CAM Expander */
219 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
220 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
221 GPIO_CAM_GP_AFBUSY,
222 GPIO_CAM_GP_STROBE_CE,
223 GPIO_CAM_GP_CAM1MP_XCLR,
224 GPIO_CAM_GP_CAMIF_RESET_N,
225 GPIO_CAM_GP_XMT_FLASH_INT,
226 GPIO_CAM_GP_LED_EN1,
227 GPIO_CAM_GP_LED_EN2,
228
229};
230#endif
231
Harini Jayaraman608d0462011-08-09 19:10:03 -0600232/* The SPI configurations apply to GSBI 1*/
233static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700235 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 .pull = GPIOMUX_PULL_NONE,
237};
238
Harini Jayaraman608d0462011-08-09 19:10:03 -0600239static struct gpiomux_setting spi_suspended_config = {
240 .func = GPIOMUX_FUNC_GPIO,
241 .drv = GPIOMUX_DRV_2MA,
242 .pull = GPIOMUX_PULL_DOWN,
243};
244
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700245static struct gpiomux_setting spi_active_config2 = {
246 .func = GPIOMUX_FUNC_2,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_NONE,
249};
250
251static struct gpiomux_setting spi_suspended_config2 = {
252 .func = GPIOMUX_FUNC_GPIO,
253 .drv = GPIOMUX_DRV_2MA,
254 .pull = GPIOMUX_PULL_UP,
255};
256
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530257static struct gpiomux_setting gsbi3_suspended_cfg = {
258 .func = GPIOMUX_FUNC_1,
259 .drv = GPIOMUX_DRV_2MA,
260 .pull = GPIOMUX_PULL_KEEPER,
261};
262
263static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264 .func = GPIOMUX_FUNC_1,
265 .drv = GPIOMUX_DRV_8MA,
266 .pull = GPIOMUX_PULL_NONE,
267};
268
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700269static struct gpiomux_setting gsbi5 = {
270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_8MA,
272 .pull = GPIOMUX_PULL_NONE,
273};
274
275static struct gpiomux_setting gsbi10 = {
276 .func = GPIOMUX_FUNC_2,
277 .drv = GPIOMUX_DRV_8MA,
278 .pull = GPIOMUX_PULL_NONE,
279};
280
281static struct gpiomux_setting gsbi12 = {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_8MA,
284 .pull = GPIOMUX_PULL_NONE,
285};
286
287static struct gpiomux_setting cdc_mclk = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_8MA,
290 .pull = GPIOMUX_PULL_NONE,
291};
292
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700293static struct gpiomux_setting audio_auxpcm[] = {
294 /* Suspended state */
295 {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_NONE,
299 },
300 /* Active state */
301 {
302 .func = GPIOMUX_FUNC_1,
303 .drv = GPIOMUX_DRV_2MA,
304 .pull = GPIOMUX_PULL_NONE,
305 },
306};
307
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700308#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309static struct gpiomux_setting gpio_eth_config = {
310 .pull = GPIOMUX_PULL_NONE,
311 .drv = GPIOMUX_DRV_8MA,
312 .func = GPIOMUX_FUNC_GPIO,
313};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700314#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315
316static struct gpiomux_setting slimbus = {
317 .func = GPIOMUX_FUNC_1,
318 .drv = GPIOMUX_DRV_8MA,
319 .pull = GPIOMUX_PULL_KEEPER,
320};
321
322struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700323#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 {
325 .gpio = KS8851_IRQ_GPIO,
326 .settings = {
327 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
328 }
329 },
330 {
331 .gpio = KS8851_RST_GPIO,
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
334 }
335 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700336#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337};
338
339static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
340 {
341 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
349 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600350 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
351 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352 },
353 },
354 {
355 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
356 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600357 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
358 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 },
360 },
361 {
362 .gpio = 9, /* GSBI1 QUP SPI_CLK */
363 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600364 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
365 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 },
367 },
368 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700369 .gpio = 14, /* GSBI1 SPI_CS_1 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
372 [GPIOMUX_ACTIVE] = &spi_active_config2,
373 },
374 },
375 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700376 .gpio = 16, /* GSBI3 I2C QUP SDA */
377 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530378 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
379 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 },
381 },
382 {
383 .gpio = 17, /* GSBI3 I2C QUP SCL */
384 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530385 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
386 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387 },
388 },
389 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700390 .gpio = 22, /* GSBI5 UART2 */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi5,
393 },
394 },
395 {
396 .gpio = 23, /* GSBI5 UART2 */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi5,
399 },
400 },
401 {
402 .gpio = 24, /* GSBI5 UART2 */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi5,
405 },
406 },
407 {
408 .gpio = 25, /* GSBI5 UART2 */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi5,
411 },
412 },
413 {
414 .gpio = 44, /* GSBI12 I2C QUP SDA */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi12,
417 },
418 },
419 {
420 .gpio = 45, /* GSBI12 I2C QUP SCL */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi12,
423 },
424 },
425 {
426 .gpio = 73, /* GSBI10 I2C QUP SDA */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &gsbi10,
429 },
430 },
431 {
432 .gpio = 74, /* GSBI10 I2C QUP SCL */
433 .settings = {
434 [GPIOMUX_SUSPENDED] = &gsbi10,
435 },
436 },
437};
438
439static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
440 {
441 .gpio = 60, /* slimbus data */
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &slimbus,
444 },
445 },
446 {
447 .gpio = 61, /* slimbus clk */
448 .settings = {
449 [GPIOMUX_SUSPENDED] = &slimbus,
450 },
451 },
452};
453
454static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
455 {
456 .gpio = 59,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &cdc_mclk,
459 },
460 },
461};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700462
463static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
464 {
465 .gpio = 63,
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
468 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
469 },
470 },
471 {
472 .gpio = 64,
473 .settings = {
474 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
475 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
476 },
477 },
478 {
479 .gpio = 65,
480 .settings = {
481 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
482 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
483 },
484 },
485 {
486 .gpio = 66,
487 .settings = {
488 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
489 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
490 },
491 },
492};
493
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700494static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
495 .func = GPIOMUX_FUNC_GPIO,
496 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700497 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498};
499
500static struct gpiomux_setting wcnss_5wire_active_cfg = {
501 .func = GPIOMUX_FUNC_1,
502 .drv = GPIOMUX_DRV_6MA,
503 .pull = GPIOMUX_PULL_DOWN,
504};
505
506static struct msm_gpiomux_config wcnss_5wire_interface[] = {
507 {
508 .gpio = 84,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
511 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
512 },
513 },
514 {
515 .gpio = 85,
516 .settings = {
517 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
518 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
519 },
520 },
521 {
522 .gpio = 86,
523 .settings = {
524 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
525 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
526 },
527 },
528 {
529 .gpio = 87,
530 .settings = {
531 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
532 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
533 },
534 },
535 {
536 .gpio = 88,
537 .settings = {
538 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
539 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
540 },
541 },
542};
Nishant Pandit24153d82011-08-27 16:05:13 +0530543static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530544 {
545 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
546 .drv = GPIOMUX_DRV_2MA,
547 .pull = GPIOMUX_PULL_DOWN,
548 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549
Nishant Pandit474f2252011-07-23 23:17:56 +0530550 {
551 .func = GPIOMUX_FUNC_1, /*active 1*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_NONE,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
558 .drv = GPIOMUX_DRV_2MA,
559 .pull = GPIOMUX_PULL_NONE,
560 },
561
562 {
563 .func = GPIOMUX_FUNC_1, /*active 3*/
564 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700565 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530566 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530567
568 {
569 .func = GPIOMUX_FUNC_5, /*active 4*/
570 .drv = GPIOMUX_DRV_8MA,
571 .pull = GPIOMUX_PULL_UP,
572 },
573
574 {
575 .func = GPIOMUX_FUNC_6, /*active 5*/
576 .drv = GPIOMUX_DRV_8MA,
577 .pull = GPIOMUX_PULL_UP,
578 },
579
580 {
581 .func = GPIOMUX_FUNC_2, /*active 6*/
582 .drv = GPIOMUX_DRV_2MA,
583 .pull = GPIOMUX_PULL_UP,
584 },
585
586 {
587 .func = GPIOMUX_FUNC_3, /*active 7*/
588 .drv = GPIOMUX_DRV_8MA,
589 .pull = GPIOMUX_PULL_UP,
590 },
591
Kevin Chan4c58d292011-09-13 11:03:25 -0700592 {
593 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
594 .drv = GPIOMUX_DRV_2MA,
595 .pull = GPIOMUX_PULL_KEEPER,
596 },
597
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598};
599
Nishant Pandit24153d82011-08-27 16:05:13 +0530600static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700601 {
602 .gpio = 2,
603 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530604 [GPIOMUX_ACTIVE] = &cam_settings[2],
605 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 },
608 {
609 .gpio = 3,
610 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530611 [GPIOMUX_ACTIVE] = &cam_settings[1],
612 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613 },
614 },
615 {
616 .gpio = 4,
617 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530618 [GPIOMUX_ACTIVE] = &cam_settings[1],
619 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 },
621 },
622 {
623 .gpio = 5,
624 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530625 [GPIOMUX_ACTIVE] = &cam_settings[1],
626 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627 },
628 },
629 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530630 .gpio = 76,
631 .settings = {
632 [GPIOMUX_ACTIVE] = &cam_settings[2],
633 [GPIOMUX_SUSPENDED] = &cam_settings[0],
634 },
635 },
636 {
637 .gpio = 107,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &cam_settings[2],
640 [GPIOMUX_SUSPENDED] = &cam_settings[0],
641 },
642 },
643};
644
645static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
646 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700647 .gpio = 18,
648 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530649 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700650 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651 },
652 },
653 {
654 .gpio = 19,
655 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530656 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700657 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658 },
659 },
660 {
661 .gpio = 20,
662 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530663 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700664 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700665 },
666 },
667 {
668 .gpio = 21,
669 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530670 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700671 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672 },
673 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700674};
675
676static struct gpiomux_setting cyts_resout_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_6MA,
679 .pull = GPIOMUX_PULL_UP,
680};
681
682static struct gpiomux_setting cyts_resout_act_cfg = {
683 .func = GPIOMUX_FUNC_GPIO,
684 .drv = GPIOMUX_DRV_6MA,
685 .pull = GPIOMUX_PULL_UP,
686};
687
688static struct gpiomux_setting cyts_sleep_sus_cfg = {
689 .func = GPIOMUX_FUNC_GPIO,
690 .drv = GPIOMUX_DRV_6MA,
691 .pull = GPIOMUX_PULL_DOWN,
692};
693
694static struct gpiomux_setting cyts_sleep_act_cfg = {
695 .func = GPIOMUX_FUNC_GPIO,
696 .drv = GPIOMUX_DRV_6MA,
697 .pull = GPIOMUX_PULL_DOWN,
698};
699
700static struct gpiomux_setting cyts_int_act_cfg = {
701 .func = GPIOMUX_FUNC_GPIO,
702 .drv = GPIOMUX_DRV_8MA,
703 .pull = GPIOMUX_PULL_UP,
704};
705
706static struct gpiomux_setting cyts_int_sus_cfg = {
707 .func = GPIOMUX_FUNC_GPIO,
708 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530709 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700710};
711
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
713 { /* TS INTERRUPT */
714 .gpio = 11,
715 .settings = {
716 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
717 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
718 },
719 },
720 { /* TS SLEEP */
721 .gpio = 50,
722 .settings = {
723 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
724 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
725 },
726 },
727 { /* TS RESOUT */
728 .gpio = 52,
729 .settings = {
730 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
731 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
732 },
733 },
734};
735
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530736#ifdef CONFIG_USB_EHCI_MSM_HSIC
737static struct gpiomux_setting hsic_act_cfg = {
738 .func = GPIOMUX_FUNC_1,
739 .drv = GPIOMUX_DRV_12MA,
740 .pull = GPIOMUX_PULL_NONE,
741};
742
743static struct gpiomux_setting hsic_sus_cfg = {
744 .func = GPIOMUX_FUNC_GPIO,
745 .drv = GPIOMUX_DRV_2MA,
746 .pull = GPIOMUX_PULL_DOWN,
747};
748
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530749static struct gpiomux_setting hsic_hub_act_cfg = {
750 .func = GPIOMUX_FUNC_GPIO,
751 .drv = GPIOMUX_DRV_2MA,
752 .pull = GPIOMUX_PULL_NONE,
753};
754
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530755static struct msm_gpiomux_config msm8960_hsic_configs[] = {
756 {
757 .gpio = 150, /*HSIC_STROBE */
758 .settings = {
759 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
760 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
761 },
762 },
763 {
764 .gpio = 151, /* HSIC_DATA */
765 .settings = {
766 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
767 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
768 },
769 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530770 {
771 .gpio = 91, /* HSIC_HUB_RESET */
772 .settings = {
773 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
774 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
775 },
776 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530777};
778#endif
779
Mohan Pallaka5e490392011-09-09 15:18:41 +0530780#define HAP_SHIFT_LVL_OE_GPIO 47
781
782static struct gpiomux_setting hap_lvl_shft_suspended_config = {
783 .func = GPIOMUX_FUNC_GPIO,
784 .drv = GPIOMUX_DRV_2MA,
785 .pull = GPIOMUX_PULL_DOWN,
786};
787
788static struct gpiomux_setting hap_lvl_shft_active_config = {
789 .func = GPIOMUX_FUNC_GPIO,
790 .drv = GPIOMUX_DRV_8MA,
791 .pull = GPIOMUX_PULL_UP,
792};
793
794static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
795 {
796 .gpio = HAP_SHIFT_LVL_OE_GPIO,
797 .settings = {
798 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
799 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
800 },
801 },
802};
803
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700804#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
805enum {
806 SX150X_CAM,
807};
808
Nishant Pandit474f2252011-07-23 23:17:56 +0530809static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700810 [SX150X_CAM] = {
811 .gpio_base = GPIO_CAM_EXPANDER_BASE,
812 .oscio_is_gpo = false,
813 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530814 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700815 .io_open_drain_ena = 0x0,
816 .irq_summary = -1,
817 },
818};
Nishant Pandit474f2252011-07-23 23:17:56 +0530819
820#endif
821
822#ifdef CONFIG_I2C
823
824#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
825#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300826#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530827
828#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
829
830static struct i2c_board_info cam_expander_i2c_info[] = {
831 {
832 I2C_BOARD_INFO("sx1508q", 0x22),
833 .platform_data = &sx150x_data[SX150X_CAM]
834 },
835};
836
837static struct msm_cam_expander_info cam_expander_info[] = {
838 {
839 cam_expander_i2c_info,
840 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
841 },
842};
843#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700844#endif
845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700847#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700848#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
849#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
850#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700852#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700853
854
855#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700856#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
857#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700858#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
859#define MSM_ION_HEAP_NUM 4
860#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700861#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700862#define MSM_ION_HEAP_NUM 2
863#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700864
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
866static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
867static int __init pmem_kernel_ebi1_size_setup(char *p)
868{
869 pmem_kernel_ebi1_size = memparse(p, NULL);
870 return 0;
871}
872early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
873#endif
874
875#ifdef CONFIG_ANDROID_PMEM
876static unsigned pmem_size = MSM_PMEM_SIZE;
877static int __init pmem_size_setup(char *p)
878{
879 pmem_size = memparse(p, NULL);
880 return 0;
881}
882early_param("pmem_size", pmem_size_setup);
883
884static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
885
886static int __init pmem_adsp_size_setup(char *p)
887{
888 pmem_adsp_size = memparse(p, NULL);
889 return 0;
890}
891early_param("pmem_adsp_size", pmem_adsp_size_setup);
892
893static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
894
895static int __init pmem_audio_size_setup(char *p)
896{
897 pmem_audio_size = memparse(p, NULL);
898 return 0;
899}
900early_param("pmem_audio_size", pmem_audio_size_setup);
901#endif
902
903#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700904#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905static struct android_pmem_platform_data android_pmem_pdata = {
906 .name = "pmem",
907 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
908 .cached = 1,
909 .memory_type = MEMTYPE_EBI1,
910};
911
912static struct platform_device android_pmem_device = {
913 .name = "android_pmem",
914 .id = 0,
915 .dev = {.platform_data = &android_pmem_pdata},
916};
917
918static struct android_pmem_platform_data android_pmem_adsp_pdata = {
919 .name = "pmem_adsp",
920 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
921 .cached = 0,
922 .memory_type = MEMTYPE_EBI1,
923};
924static struct platform_device android_pmem_adsp_device = {
925 .name = "android_pmem",
926 .id = 2,
927 .dev = { .platform_data = &android_pmem_adsp_pdata },
928};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700929#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930
931static struct android_pmem_platform_data android_pmem_audio_pdata = {
932 .name = "pmem_audio",
933 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
934 .cached = 0,
935 .memory_type = MEMTYPE_EBI1,
936};
937
938static struct platform_device android_pmem_audio_device = {
939 .name = "android_pmem",
940 .id = 4,
941 .dev = { .platform_data = &android_pmem_audio_pdata },
942};
943#endif
944
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700945#define DSP_RAM_BASE_8960 0x8da00000
946#define DSP_RAM_SIZE_8960 0x1800000
947static int dspcrashd_pdata_8960 = 0xDEADDEAD;
948
949static struct resource resources_dspcrashd_8960[] = {
950 {
951 .name = "msm_dspcrashd",
952 .start = DSP_RAM_BASE_8960,
953 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
954 .flags = IORESOURCE_DMA,
955 },
956};
957
958struct platform_device msm_device_dspcrashd_8960 = {
959 .name = "msm_dspcrashd",
960 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
961 .resource = resources_dspcrashd_8960,
962 .dev = { .platform_data = &dspcrashd_pdata_8960 },
963};
964
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965static struct memtype_reserve msm8960_reserve_table[] __initdata = {
966 [MEMTYPE_SMI] = {
967 },
968 [MEMTYPE_EBI0] = {
969 .flags = MEMTYPE_FLAGS_1M_ALIGN,
970 },
971 [MEMTYPE_EBI1] = {
972 .flags = MEMTYPE_FLAGS_1M_ALIGN,
973 },
974};
975
976static void __init size_pmem_devices(void)
977{
978#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700979#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980 android_pmem_adsp_pdata.size = pmem_adsp_size;
981 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700982#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
984#endif
985}
986
987static void __init reserve_memory_for(struct android_pmem_platform_data *p)
988{
989 msm8960_reserve_table[p->memory_type].size += p->size;
990}
991
992static void __init reserve_pmem_memory(void)
993{
994#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700995#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700996 reserve_memory_for(&android_pmem_adsp_pdata);
997 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700998#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 reserve_memory_for(&android_pmem_audio_pdata);
1000 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1001#endif
1002}
1003
Larry Basselb4126da2011-07-18 14:31:33 -07001004static int msm8960_paddr_to_memtype(unsigned int paddr)
1005{
1006 return MEMTYPE_EBI1;
1007}
1008
Laura Abbottd6183792011-08-19 13:42:24 -07001009#ifdef CONFIG_ION_MSM
1010struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001011 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001012 .heaps = {
1013 {
1014 .id = ION_HEAP_SYSTEM_ID,
1015 .type = ION_HEAP_TYPE_SYSTEM,
1016 .name = ION_KMALLOC_HEAP_NAME,
1017 },
1018 {
1019 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1020 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1021 .name = ION_VMALLOC_HEAP_NAME,
1022 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001023#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001024 {
1025 .id = ION_HEAP_EBI_ID,
1026 .type = ION_HEAP_TYPE_CARVEOUT,
1027 .name = ION_EBI1_HEAP_NAME,
1028 .size = MSM_ION_EBI_SIZE,
1029 .memory_type = ION_EBI_TYPE,
1030 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001031 {
1032 .id = ION_HEAP_ADSP_ID,
1033 .type = ION_HEAP_TYPE_CARVEOUT,
1034 .name = ION_ADSP_HEAP_NAME,
1035 .size = MSM_ION_ADSP_SIZE,
1036 .memory_type = ION_EBI_TYPE,
1037 },
1038#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001039 }
1040};
1041
1042struct platform_device ion_dev = {
1043 .name = "ion-msm",
1044 .id = 1,
1045 .dev = { .platform_data = &ion_pdata },
1046};
1047#endif
1048
1049static void reserve_ion_memory(void)
1050{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001051#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001052 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001053 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001054#endif
1055}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001056static void __init msm8960_calculate_reserve_sizes(void)
1057{
1058 size_pmem_devices();
1059 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001060 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001061}
1062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063static struct reserve_info msm8960_reserve_info __initdata = {
1064 .memtype_reserve_table = msm8960_reserve_table,
1065 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1066 .paddr_to_memtype = msm8960_paddr_to_memtype,
1067};
1068
Larry Basselb4126da2011-07-18 14:31:33 -07001069static int msm8960_memory_bank_size(void)
1070{
1071 return 1<<29;
1072}
1073
1074static void __init locate_unstable_memory(void)
1075{
1076 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1077 unsigned long bank_size;
1078 unsigned long low, high;
1079
1080 bank_size = msm8960_memory_bank_size();
1081 low = meminfo.bank[0].start;
1082 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -07001083
1084 /* Check if 32 bit overflow occured */
1085 if (high < mb->start)
1086 high = ~0UL;
1087
Larry Basselb4126da2011-07-18 14:31:33 -07001088 low &= ~(bank_size - 1);
1089
1090 if (high - low <= bank_size)
1091 return;
1092 msm8960_reserve_info.low_unstable_address = low + bank_size;
Olav Haugan62052e42011-10-28 14:28:32 -07001093 /* To avoid overflow of u32 compute max_unstable_size
1094 * by first subtracting low from mb->start)
1095 * */
1096 msm8960_reserve_info.max_unstable_size = (mb->start - low) +
1097 mb->size - bank_size;
1098
Larry Basselb4126da2011-07-18 14:31:33 -07001099 msm8960_reserve_info.bank_size = bank_size;
1100 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1101 msm8960_reserve_info.low_unstable_address,
1102 msm8960_reserve_info.max_unstable_size,
1103 msm8960_reserve_info.bank_size);
1104}
1105
Larry Basselb830e182011-10-14 10:46:55 -07001106static void __init place_movable_zone(void)
1107{
1108 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1109 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1110 pr_info("movable zone start %lx size %lx\n",
1111 movable_reserved_start, movable_reserved_size);
1112}
1113
1114static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001115{
1116 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001117 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001118 place_movable_zone();
1119}
1120
1121static void __init msm8960_reserve(void)
1122{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001123 msm_reserve();
1124}
1125
Larry Bassela4414b12011-08-04 11:11:02 -07001126static int msm8960_change_memory_power(u64 start, u64 size,
1127 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001128{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001129 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001130}
1131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001132#ifdef CONFIG_MSM_CAMERA
1133
Nishant Pandit24153d82011-08-27 16:05:13 +05301134static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001135 5, /*CAMIF_MCLK*/
1136 20, /*CAMIF_I2C_DATA*/
1137 21, /*CAMIF_I2C_CLK*/
1138};
1139
Nishant Pandit24153d82011-08-27 16:05:13 +05301140static struct msm_camera_gpio_conf gpio_conf = {
1141 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1142 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1143 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1144 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1145};
1146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001147#define VFE_CAMIF_TIMER1_GPIO 2
1148#define VFE_CAMIF_TIMER2_GPIO 3
1149#define VFE_CAMIF_TIMER3_GPIO_INT 4
1150struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1151 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1152 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1153 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1154 .flash_recharge_duration = 50000,
1155 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1156};
1157
Nishant Pandit474f2252011-07-23 23:17:56 +05301158#ifdef CONFIG_MSM_CAMERA_FLASH
1159static struct msm_camera_sensor_flash_src msm_flash_src = {
1160 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1161 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1162 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1163#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1164 defined(CONFIG_GPIO_SX150X_MODULE))
1165 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1166#endif
1167};
1168#endif
1169
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001170static struct msm_bus_vectors cam_init_vectors[] = {
1171 {
1172 .src = MSM_BUS_MASTER_VFE,
1173 .dst = MSM_BUS_SLAVE_EBI_CH0,
1174 .ab = 0,
1175 .ib = 0,
1176 },
1177 {
1178 .src = MSM_BUS_MASTER_VPE,
1179 .dst = MSM_BUS_SLAVE_EBI_CH0,
1180 .ab = 0,
1181 .ib = 0,
1182 },
1183 {
1184 .src = MSM_BUS_MASTER_JPEG_ENC,
1185 .dst = MSM_BUS_SLAVE_EBI_CH0,
1186 .ab = 0,
1187 .ib = 0,
1188 },
1189};
1190
1191static struct msm_bus_vectors cam_preview_vectors[] = {
1192 {
1193 .src = MSM_BUS_MASTER_VFE,
1194 .dst = MSM_BUS_SLAVE_EBI_CH0,
1195 .ab = 27648000,
1196 .ib = 110592000,
1197 },
1198 {
1199 .src = MSM_BUS_MASTER_VPE,
1200 .dst = MSM_BUS_SLAVE_EBI_CH0,
1201 .ab = 0,
1202 .ib = 0,
1203 },
1204 {
1205 .src = MSM_BUS_MASTER_JPEG_ENC,
1206 .dst = MSM_BUS_SLAVE_EBI_CH0,
1207 .ab = 0,
1208 .ib = 0,
1209 },
1210};
1211
1212static struct msm_bus_vectors cam_video_vectors[] = {
1213 {
1214 .src = MSM_BUS_MASTER_VFE,
1215 .dst = MSM_BUS_SLAVE_EBI_CH0,
1216 .ab = 140451840,
1217 .ib = 561807360,
1218 },
1219 {
1220 .src = MSM_BUS_MASTER_VPE,
1221 .dst = MSM_BUS_SLAVE_EBI_CH0,
1222 .ab = 206807040,
1223 .ib = 488816640,
1224 },
1225 {
1226 .src = MSM_BUS_MASTER_JPEG_ENC,
1227 .dst = MSM_BUS_SLAVE_EBI_CH0,
1228 .ab = 0,
1229 .ib = 0,
1230 },
1231};
1232
1233static struct msm_bus_vectors cam_snapshot_vectors[] = {
1234 {
1235 .src = MSM_BUS_MASTER_VFE,
1236 .dst = MSM_BUS_SLAVE_EBI_CH0,
1237 .ab = 274423680,
1238 .ib = 1097694720,
1239 },
1240 {
1241 .src = MSM_BUS_MASTER_VPE,
1242 .dst = MSM_BUS_SLAVE_EBI_CH0,
1243 .ab = 0,
1244 .ib = 0,
1245 },
1246 {
1247 .src = MSM_BUS_MASTER_JPEG_ENC,
1248 .dst = MSM_BUS_SLAVE_EBI_CH0,
1249 .ab = 540000000,
1250 .ib = 1350000000,
1251 },
1252};
1253
1254static struct msm_bus_vectors cam_zsl_vectors[] = {
1255 {
1256 .src = MSM_BUS_MASTER_VFE,
1257 .dst = MSM_BUS_SLAVE_EBI_CH0,
1258 .ab = 302071680,
1259 .ib = 1208286720,
1260 },
1261 {
1262 .src = MSM_BUS_MASTER_VPE,
1263 .dst = MSM_BUS_SLAVE_EBI_CH0,
1264 .ab = 0,
1265 .ib = 0,
1266 },
1267 {
1268 .src = MSM_BUS_MASTER_JPEG_ENC,
1269 .dst = MSM_BUS_SLAVE_EBI_CH0,
1270 .ab = 540000000,
1271 .ib = 1350000000,
1272 },
1273};
1274
1275static struct msm_bus_paths cam_bus_client_config[] = {
1276 {
1277 ARRAY_SIZE(cam_init_vectors),
1278 cam_init_vectors,
1279 },
1280 {
1281 ARRAY_SIZE(cam_preview_vectors),
1282 cam_preview_vectors,
1283 },
1284 {
1285 ARRAY_SIZE(cam_video_vectors),
1286 cam_video_vectors,
1287 },
1288 {
1289 ARRAY_SIZE(cam_snapshot_vectors),
1290 cam_snapshot_vectors,
1291 },
1292 {
1293 ARRAY_SIZE(cam_zsl_vectors),
1294 cam_zsl_vectors,
1295 },
1296};
1297
1298static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1299 cam_bus_client_config,
1300 ARRAY_SIZE(cam_bus_client_config),
1301 .name = "msm_camera",
1302};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001303
Nishant Pandit24153d82011-08-27 16:05:13 +05301304struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1305 {
1306 .ioclk.mclk_clk_rate = 24000000,
1307 .ioclk.vfe_clk_rate = 228570000,
1308 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001309 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301310 },
1311 {
1312 .ioclk.mclk_clk_rate = 24000000,
1313 .ioclk.vfe_clk_rate = 228570000,
1314 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001315 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301316 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317};
1318
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001319#ifdef CONFIG_IMX074_ACT
1320static struct i2c_board_info imx074_actuator_i2c_info = {
1321 I2C_BOARD_INFO("imx074_act", 0x11),
1322};
1323
1324static struct msm_actuator_info imx074_actuator_info = {
1325 .board_info = &imx074_actuator_i2c_info,
1326 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1327 .vcm_pwd = 0,
1328 .vcm_enable = 1,
1329};
1330#endif
1331
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332#ifdef CONFIG_IMX074
1333static struct msm_camera_sensor_flash_data flash_imx074 = {
1334 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301335#ifdef CONFIG_MSM_CAMERA_FLASH
1336 .flash_src = &msm_flash_src
1337#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001338};
1339
Nishant Pandit24153d82011-08-27 16:05:13 +05301340static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1341 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001342 .sensor_reset = 107,
1343 .sensor_pwd = 85,
1344 .vcm_pwd = 0,
1345 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301346};
1347
1348static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1349 .sensor_name = "imx074",
1350 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351 .flash_data = &flash_imx074,
1352 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301353 .sensor_platform_info = &sensor_board_info_imx074,
1354 .gpio_conf = &gpio_conf,
1355 .csi_if = 1,
1356 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001357#ifdef CONFIG_IMX074_ACT
1358 .actuator_info = &imx074_actuator_info
1359#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360};
1361
1362struct platform_device msm8960_camera_sensor_imx074 = {
1363 .name = "msm_camera_imx074",
1364 .dev = {
1365 .platform_data = &msm_camera_sensor_imx074_data,
1366 },
1367};
1368#endif
1369#ifdef CONFIG_OV2720
1370static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001371 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372};
1373
Nishant Pandit24153d82011-08-27 16:05:13 +05301374static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1375 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001376 .sensor_reset = 76,
1377 .sensor_pwd = 85,
1378 .vcm_pwd = 0,
1379 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301380};
1381
1382static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1383 .sensor_name = "ov2720",
1384 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301386 .sensor_platform_info = &sensor_board_info_ov2720,
1387 .gpio_conf = &gpio_conf,
1388 .csi_if = 1,
1389 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001390};
1391
1392struct platform_device msm8960_camera_sensor_ov2720 = {
1393 .name = "msm_camera_ov2720",
1394 .dev = {
1395 .platform_data = &msm_camera_sensor_ov2720_data,
1396 },
1397};
1398#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001399
1400static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1401 .flash_type = MSM_CAMERA_FLASH_LED,
1402};
1403
Nishant Pandit24153d82011-08-27 16:05:13 +05301404static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1405 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001406 .sensor_reset = 107,
1407 .sensor_pwd = 85,
1408 .vcm_pwd = 0,
1409 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301410};
1411
1412static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1413 .sensor_name = "qs_mt9p017",
1414 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001415 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301416 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1417 .gpio_conf = &gpio_conf,
1418 .csi_if = 1,
1419 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001420};
1421
1422struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1423 .name = "msm_camera_qs_mt9p017",
1424 .dev = {
1425 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1426 },
1427};
1428
Kevin Chan8b0d2322011-09-10 21:06:31 -07001429static struct msm8960_privacy_light_cfg privacy_light_info = {
1430 .mpp = PM8921_MPP_PM_TO_SYS(12),
1431};
1432
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433static void __init msm8960_init_cam(void)
1434{
1435 int i;
1436 struct platform_device *cam_dev[] = {
1437 &msm8960_camera_sensor_imx074,
1438 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001439 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001440 };
1441
Kevin Chan8b0d2322011-09-10 21:06:31 -07001442 if (machine_is_msm8960_liquid()) {
1443 struct msm_camera_sensor_info *s_info;
1444 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1445 s_info->sensor_platform_info->mount_angle = 180;
1446 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1447 s_info->sensor_platform_info->privacy_light = 1;
1448 s_info->sensor_platform_info->privacy_light_info =
1449 &privacy_light_info;
1450 }
1451
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1453 struct msm_camera_sensor_info *s_info;
1454 s_info = cam_dev[i]->dev.platform_data;
1455 msm_get_cam_resources(s_info);
1456 platform_device_register(cam_dev[i]);
1457 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001458
1459 platform_device_register(&msm8960_device_csiphy0);
1460 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001461 platform_device_register(&msm8960_device_csid0);
1462 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001463 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001464 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001465 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001466}
1467#endif
1468
1469#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001470#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001471#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001472#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001473#endif
1474
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001475
1476#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001477#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001479#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1480#else
1481#define MSM_FB_EXT_BUF_SIZE 0
1482#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001483
kuogee hsieh3830eb92011-09-12 15:25:57 -07001484#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1485/* width x height x 3 bpp x 2 frame buffer */
1486#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1487#define MSM_FB_WRITEBACK_OFFSET \
1488 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1489#else
1490#define MSM_FB_WRITEBACK_SIZE 0
1491#define MSM_FB_WRITEBACK_OFFSET 0
1492#endif
1493
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001494#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1495/* 4 bpp x 2 page HDMI case */
1496#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1497#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001498/* Note: must be multiple of 4096 */
1499#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1500 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001501#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001502
1503static int writeback_offset(void)
1504{
1505 return MSM_FB_WRITEBACK_OFFSET;
1506}
1507
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001508
1509#define MDP_VSYNC_GPIO 0
1510
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001511#define PANEL_NAME_MAX_LEN 30
1512#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1513#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1514#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1515#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1516#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1517#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1518#define HDMI_PANEL_NAME "hdmi_msm"
1519#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001520
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521static struct resource msm_fb_resources[] = {
1522 {
1523 .flags = IORESOURCE_DMA,
1524 }
1525};
1526
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001527static int msm_fb_detect_panel(const char *name)
1528{
1529 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001530 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1531 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1532 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001533 return 0;
1534 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001535 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1536 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1537 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001538 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001539
1540#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1541 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1542 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1543 PANEL_NAME_MAX_LEN)))
1544 return 0;
1545
1546 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1547 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1548 PANEL_NAME_MAX_LEN)))
1549 return 0;
1550
1551 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1552 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1553 PANEL_NAME_MAX_LEN)))
1554 return 0;
1555
1556 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1557 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1558 PANEL_NAME_MAX_LEN)))
1559 return 0;
1560#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001561 }
1562
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001563 if (!strncmp(name, HDMI_PANEL_NAME,
1564 strnlen(HDMI_PANEL_NAME,
1565 PANEL_NAME_MAX_LEN)))
1566 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001567
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001568 if (!strncmp(name, TVOUT_PANEL_NAME,
1569 strnlen(TVOUT_PANEL_NAME,
1570 PANEL_NAME_MAX_LEN)))
1571 return 0;
1572
1573 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001574 return -ENODEV;
1575}
1576
1577static struct msm_fb_platform_data msm_fb_pdata = {
1578 .detect_client = msm_fb_detect_panel,
1579};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001580
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001581static struct platform_device msm_fb_device = {
1582 .name = "msm_fb",
1583 .id = 0,
1584 .num_resources = ARRAY_SIZE(msm_fb_resources),
1585 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001586 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001587};
1588
1589static bool dsi_power_on;
1590
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001591/**
1592 * LiQUID panel on/off
1593 *
1594 * @param on
1595 *
1596 * @return int
1597 */
1598static int mipi_dsi_liquid_panel_power(int on)
1599{
1600 static struct regulator *reg_l2, *reg_ext_3p3v;
1601 static int gpio21, gpio24, gpio43;
1602 int rc;
1603
1604 pr_info("%s: on=%d\n", __func__, on);
1605
1606 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1607 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1608 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1609
1610 if (!dsi_power_on) {
1611
1612 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1613 "dsi_vdda");
1614 if (IS_ERR(reg_l2)) {
1615 pr_err("could not get 8921_l2, rc = %ld\n",
1616 PTR_ERR(reg_l2));
1617 return -ENODEV;
1618 }
1619
1620 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1621 if (rc) {
1622 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1623 return -EINVAL;
1624 }
1625
1626 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1627 "vdd_lvds_3p3v");
1628 if (IS_ERR(reg_ext_3p3v)) {
1629 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1630 PTR_ERR(reg_ext_3p3v));
1631 return -ENODEV;
1632 }
1633
1634 rc = gpio_request(gpio21, "disp_pwr_en_n");
1635 if (rc) {
1636 pr_err("request gpio 21 failed, rc=%d\n", rc);
1637 return -ENODEV;
1638 }
1639
1640 rc = gpio_request(gpio43, "disp_rst_n");
1641 if (rc) {
1642 pr_err("request gpio 43 failed, rc=%d\n", rc);
1643 return -ENODEV;
1644 }
1645
1646 rc = gpio_request(gpio24, "disp_backlight_pwm");
1647 if (rc) {
1648 pr_err("request gpio 24 failed, rc=%d\n", rc);
1649 return -ENODEV;
1650 }
1651
1652 dsi_power_on = true;
1653 }
1654
1655 if (on) {
1656 rc = regulator_set_optimum_mode(reg_l2, 100000);
1657 if (rc < 0) {
1658 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1659 return -EINVAL;
1660 }
1661 rc = regulator_enable(reg_l2);
1662 if (rc) {
1663 pr_err("enable l2 failed, rc=%d\n", rc);
1664 return -ENODEV;
1665 }
1666
1667 rc = regulator_enable(reg_ext_3p3v);
1668 if (rc) {
1669 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1670 return -ENODEV;
1671 }
1672
1673 /* set reset pin before power enable */
1674 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1675
1676 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1677 msleep(20);
1678 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1679 msleep(20);
1680 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1681 msleep(20);
1682 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1683 msleep(20);
1684 } else {
1685 gpio_set_value_cansleep(gpio43, 0);
1686 gpio_set_value_cansleep(gpio21, 1);
1687
1688 rc = regulator_disable(reg_l2);
1689 if (rc) {
1690 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1691 return -ENODEV;
1692 }
1693 rc = regulator_disable(reg_ext_3p3v);
1694 if (rc) {
1695 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1696 return -ENODEV;
1697 }
1698 rc = regulator_set_optimum_mode(reg_l2, 100);
1699 if (rc < 0) {
1700 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1701 return -EINVAL;
1702 }
1703 }
1704
1705 return 0;
1706}
1707
1708static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709{
1710 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001711 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001712 int rc;
1713
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714 pr_info("%s: state : %d\n", __func__, on);
1715
1716 if (!dsi_power_on) {
1717
1718 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1719 "dsi_vdc");
1720 if (IS_ERR(reg_l8)) {
1721 pr_err("could not get 8921_l8, rc = %ld\n",
1722 PTR_ERR(reg_l8));
1723 return -ENODEV;
1724 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1726 "dsi_vddio");
1727 if (IS_ERR(reg_l23)) {
1728 pr_err("could not get 8921_l23, rc = %ld\n",
1729 PTR_ERR(reg_l23));
1730 return -ENODEV;
1731 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1733 "dsi_vdda");
1734 if (IS_ERR(reg_l2)) {
1735 pr_err("could not get 8921_l2, rc = %ld\n",
1736 PTR_ERR(reg_l2));
1737 return -ENODEV;
1738 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1740 if (rc) {
1741 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1742 return -EINVAL;
1743 }
1744 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1745 if (rc) {
1746 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1747 return -EINVAL;
1748 }
1749 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1750 if (rc) {
1751 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1752 return -EINVAL;
1753 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001754 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1755 rc = gpio_request(gpio43, "disp_rst_n");
1756 if (rc) {
1757 pr_err("request gpio 43 failed, rc=%d\n", rc);
1758 return -ENODEV;
1759 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001760 dsi_power_on = true;
1761 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001762 if (on) {
1763 rc = regulator_set_optimum_mode(reg_l8, 100000);
1764 if (rc < 0) {
1765 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1766 return -EINVAL;
1767 }
1768 rc = regulator_set_optimum_mode(reg_l23, 100000);
1769 if (rc < 0) {
1770 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1771 return -EINVAL;
1772 }
1773 rc = regulator_set_optimum_mode(reg_l2, 100000);
1774 if (rc < 0) {
1775 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1776 return -EINVAL;
1777 }
1778 rc = regulator_enable(reg_l8);
1779 if (rc) {
1780 pr_err("enable l8 failed, rc=%d\n", rc);
1781 return -ENODEV;
1782 }
1783 rc = regulator_enable(reg_l23);
1784 if (rc) {
1785 pr_err("enable l8 failed, rc=%d\n", rc);
1786 return -ENODEV;
1787 }
1788 rc = regulator_enable(reg_l2);
1789 if (rc) {
1790 pr_err("enable l2 failed, rc=%d\n", rc);
1791 return -ENODEV;
1792 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001793 gpio_set_value_cansleep(gpio43, 1);
1794 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001795 rc = regulator_disable(reg_l2);
1796 if (rc) {
1797 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1798 return -ENODEV;
1799 }
1800 rc = regulator_disable(reg_l8);
1801 if (rc) {
1802 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1803 return -ENODEV;
1804 }
1805 rc = regulator_disable(reg_l23);
1806 if (rc) {
1807 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1808 return -ENODEV;
1809 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001810 rc = regulator_set_optimum_mode(reg_l8, 100);
1811 if (rc < 0) {
1812 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1813 return -EINVAL;
1814 }
1815 rc = regulator_set_optimum_mode(reg_l23, 100);
1816 if (rc < 0) {
1817 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1818 return -EINVAL;
1819 }
1820 rc = regulator_set_optimum_mode(reg_l2, 100);
1821 if (rc < 0) {
1822 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1823 return -EINVAL;
1824 }
1825 gpio_set_value_cansleep(gpio43, 0);
1826 }
1827 return 0;
1828}
1829
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001830static int mipi_dsi_panel_power(int on)
1831{
1832 int ret;
1833
1834 pr_info("%s: on=%d\n", __func__, on);
1835
1836 if (machine_is_msm8960_liquid())
1837 ret = mipi_dsi_liquid_panel_power(on);
1838 else
1839 ret = mipi_dsi_cdp_panel_power(on);
1840
1841 return ret;
1842}
1843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001844static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1845 .vsync_gpio = MDP_VSYNC_GPIO,
1846 .dsi_power_save = mipi_dsi_panel_power,
1847};
1848
1849#ifdef CONFIG_MSM_BUS_SCALING
1850
1851static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001852 {
1853 .src = MSM_BUS_MASTER_MDP_PORT0,
1854 .dst = MSM_BUS_SLAVE_EBI_CH0,
1855 .ab = 0,
1856 .ib = 0,
1857 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001858};
1859
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001860#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1861static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1862 /* If HDMI is used as primary */
1863 {
1864 .src = MSM_BUS_MASTER_MDP_PORT0,
1865 .dst = MSM_BUS_SLAVE_EBI_CH0,
1866 .ab = 2000000000,
1867 .ib = 2000000000,
1868 },
1869};
1870static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1871 {
1872 ARRAY_SIZE(mdp_init_vectors),
1873 mdp_init_vectors,
1874 },
1875 {
1876 ARRAY_SIZE(hdmi_as_primary_vectors),
1877 hdmi_as_primary_vectors,
1878 },
1879 {
1880 ARRAY_SIZE(hdmi_as_primary_vectors),
1881 hdmi_as_primary_vectors,
1882 },
1883 {
1884 ARRAY_SIZE(hdmi_as_primary_vectors),
1885 hdmi_as_primary_vectors,
1886 },
1887 {
1888 ARRAY_SIZE(hdmi_as_primary_vectors),
1889 hdmi_as_primary_vectors,
1890 },
1891 {
1892 ARRAY_SIZE(hdmi_as_primary_vectors),
1893 hdmi_as_primary_vectors,
1894 },
1895};
1896#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001897static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001898 {
1899 .src = MSM_BUS_MASTER_MDP_PORT0,
1900 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001901 .ab = 216000000 * 2,
1902 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 },
1904};
1905
1906static struct msm_bus_vectors mdp_vga_vectors[] = {
1907 /* VGA and less video */
1908 {
1909 .src = MSM_BUS_MASTER_MDP_PORT0,
1910 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001911 .ab = 216000000 * 2,
1912 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913 },
1914};
1915
1916static struct msm_bus_vectors mdp_720p_vectors[] = {
1917 /* 720p and less video */
1918 {
1919 .src = MSM_BUS_MASTER_MDP_PORT0,
1920 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001921 .ab = 230400000 * 2,
1922 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001923 },
1924};
1925
1926static struct msm_bus_vectors mdp_1080p_vectors[] = {
1927 /* 1080p and less video */
1928 {
1929 .src = MSM_BUS_MASTER_MDP_PORT0,
1930 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001931 .ab = 334080000 * 2,
1932 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001933 },
1934};
1935
1936static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1937 {
1938 ARRAY_SIZE(mdp_init_vectors),
1939 mdp_init_vectors,
1940 },
1941 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001942 ARRAY_SIZE(mdp_ui_vectors),
1943 mdp_ui_vectors,
1944 },
1945 {
1946 ARRAY_SIZE(mdp_ui_vectors),
1947 mdp_ui_vectors,
1948 },
1949 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950 ARRAY_SIZE(mdp_vga_vectors),
1951 mdp_vga_vectors,
1952 },
1953 {
1954 ARRAY_SIZE(mdp_720p_vectors),
1955 mdp_720p_vectors,
1956 },
1957 {
1958 ARRAY_SIZE(mdp_1080p_vectors),
1959 mdp_1080p_vectors,
1960 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001962#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001963
1964static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1965 mdp_bus_scale_usecases,
1966 ARRAY_SIZE(mdp_bus_scale_usecases),
1967 .name = "mdp",
1968};
1969
1970#endif
1971
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001972#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1973int mdp_core_clk_rate_table[] = {
1974 200000000,
1975 200000000,
1976 200000000,
1977 200000000,
1978};
1979#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001980int mdp_core_clk_rate_table[] = {
1981 85330000,
1982 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001983 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001984 200000000,
1985};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001986#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001987
1988static struct msm_panel_common_pdata mdp_pdata = {
1989 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001990#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1991 .mdp_core_clk_rate = 200000000,
1992#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001993 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001994#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001995 .mdp_core_clk_table = mdp_core_clk_rate_table,
1996 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1997#ifdef CONFIG_MSM_BUS_SCALING
1998 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1999#endif
2000 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07002001 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002002};
2003
2004static struct platform_device mipi_dsi_renesas_panel_device = {
2005 .name = "mipi_renesas",
2006 .id = 0,
2007};
2008
2009static struct platform_device mipi_dsi_simulator_panel_device = {
2010 .name = "mipi_simulator",
2011 .id = 0,
2012};
2013
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002014#define LPM_CHANNEL0 0
2015static int toshiba_gpio[] = {LPM_CHANNEL0};
2016
2017static struct mipi_dsi_panel_platform_data toshiba_pdata = {
2018 .gpio = toshiba_gpio,
2019};
2020
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002021static struct platform_device mipi_dsi_toshiba_panel_device = {
2022 .name = "mipi_toshiba",
2023 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002024 .dev = {
2025 .platform_data = &toshiba_pdata,
2026 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002027};
2028
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002029#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002030static int dsi2lvds_gpio[2] = {
2031 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2032 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2033 };
2034
2035static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2036 .gpio_num = dsi2lvds_gpio,
2037};
2038
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002039static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2040
2041/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2042 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2043 /* timing */
2044 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2045 0x0c, 0x03, 0x04, 0xa0},
2046 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2047 {0xff, 0x00, 0x06, 0x00}, /* strength */
2048 /* pll control */
2049 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2050 0x40, 0x07, 0x03,
2051 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2052};
2053
2054static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002055 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2056 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002057 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2058};
2059
2060static struct platform_device mipi_dsi_novatek_panel_device = {
2061 .name = "mipi_novatek",
2062 .id = 0,
2063 .dev = {
2064 .platform_data = &novatek_pdata,
2065 }
2066};
2067
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002068static struct platform_device mipi_dsi2lvds_bridge_device = {
2069 .name = "mipi_tc358764",
2070 .id = 0,
2071 .dev.platform_data = &mipi_dsi2lvds_pdata,
2072};
2073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002074#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2075static struct resource hdmi_msm_resources[] = {
2076 {
2077 .name = "hdmi_msm_qfprom_addr",
2078 .start = 0x00700000,
2079 .end = 0x007060FF,
2080 .flags = IORESOURCE_MEM,
2081 },
2082 {
2083 .name = "hdmi_msm_hdmi_addr",
2084 .start = 0x04A00000,
2085 .end = 0x04A00FFF,
2086 .flags = IORESOURCE_MEM,
2087 },
2088 {
2089 .name = "hdmi_msm_irq",
2090 .start = HDMI_IRQ,
2091 .end = HDMI_IRQ,
2092 .flags = IORESOURCE_IRQ,
2093 },
2094};
2095
2096static int hdmi_enable_5v(int on);
2097static int hdmi_core_power(int on, int show);
2098static int hdmi_cec_power(int on);
2099
2100static struct msm_hdmi_platform_data hdmi_msm_data = {
2101 .irq = HDMI_IRQ,
2102 .enable_5v = hdmi_enable_5v,
2103 .core_power = hdmi_core_power,
2104 .cec_power = hdmi_cec_power,
2105};
2106
2107static struct platform_device hdmi_msm_device = {
2108 .name = "hdmi_msm",
2109 .id = 0,
2110 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2111 .resource = hdmi_msm_resources,
2112 .dev.platform_data = &hdmi_msm_data,
2113};
2114#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2115
Vinay Kalia291263e2011-11-01 17:07:05 -07002116#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2117static struct platform_device wfd_panel_device = {
2118 .name = "wfd_panel",
2119 .id = 0,
2120 .dev.platform_data = NULL,
2121};
2122#endif
2123
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002124#ifdef CONFIG_MSM_BUS_SCALING
2125static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2126 {
2127 .src = MSM_BUS_MASTER_MDP_PORT0,
2128 .dst = MSM_BUS_SLAVE_EBI_CH0,
2129 .ab = 0,
2130 .ib = 0,
2131 },
2132};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002133
2134#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2135static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2136 {
2137 .src = MSM_BUS_MASTER_MDP_PORT0,
2138 .dst = MSM_BUS_SLAVE_EBI_CH0,
2139 .ab = 2000000000,
2140 .ib = 2000000000,
2141 },
2142};
2143#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002144static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2145 {
2146 .src = MSM_BUS_MASTER_MDP_PORT0,
2147 .dst = MSM_BUS_SLAVE_EBI_CH0,
2148 .ab = 566092800 * 2,
2149 .ib = 707616000 * 2,
2150 },
2151};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002152#endif
2153
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002154static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2155 {
2156 ARRAY_SIZE(dtv_bus_init_vectors),
2157 dtv_bus_init_vectors,
2158 },
2159 {
2160 ARRAY_SIZE(dtv_bus_def_vectors),
2161 dtv_bus_def_vectors,
2162 },
2163};
2164static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2165 dtv_bus_scale_usecases,
2166 ARRAY_SIZE(dtv_bus_scale_usecases),
2167 .name = "dtv",
2168};
2169
2170static struct lcdc_platform_data dtv_pdata = {
2171 .bus_scale_table = &dtv_bus_scale_pdata,
2172};
2173#endif
2174
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175static void __init msm_fb_add_devices(void)
2176{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002177 struct platform_device *ptr = NULL;
2178
2179 if (machine_is_msm8960_liquid())
2180 ptr = &mipi_dsi2lvds_bridge_device;
2181 else
2182 ptr = &mipi_dsi_toshiba_panel_device;
2183 platform_add_devices(&ptr, 1);
2184
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002185 if (machine_is_msm8x60_rumi3()) {
2186 msm_fb_register_device("mdp", NULL);
2187 mipi_dsi_pdata.target_type = 1;
2188 } else
2189 msm_fb_register_device("mdp", &mdp_pdata);
2190 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002191#ifdef CONFIG_MSM_BUS_SCALING
2192 msm_fb_register_device("dtv", &dtv_pdata);
2193#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002194}
2195
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002196static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2197 .func = GPIOMUX_FUNC_GPIO,
2198 .drv = GPIOMUX_DRV_2MA,
2199 .pull = GPIOMUX_PULL_DOWN,
2200};
2201
2202static struct gpiomux_setting mdp_vsync_active_cfg = {
2203 .func = GPIOMUX_FUNC_1,
2204 .drv = GPIOMUX_DRV_2MA,
2205 .pull = GPIOMUX_PULL_DOWN,
2206};
2207
2208static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2209 {
2210 .gpio = MDP_VSYNC_GPIO,
2211 .settings = {
2212 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2213 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2214 },
2215 }
2216};
2217
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002218#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2219static struct gpiomux_setting hdmi_suspend_cfg = {
2220 .func = GPIOMUX_FUNC_GPIO,
2221 .drv = GPIOMUX_DRV_2MA,
2222 .pull = GPIOMUX_PULL_DOWN,
2223};
2224
2225static struct gpiomux_setting hdmi_active_1_cfg = {
2226 .func = GPIOMUX_FUNC_1,
2227 .drv = GPIOMUX_DRV_2MA,
2228 .pull = GPIOMUX_PULL_UP,
2229};
2230
2231static struct gpiomux_setting hdmi_active_2_cfg = {
2232 .func = GPIOMUX_FUNC_1,
2233 .drv = GPIOMUX_DRV_2MA,
2234 .pull = GPIOMUX_PULL_DOWN,
2235};
2236
2237static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2238 {
2239 .gpio = 99,
2240 .settings = {
2241 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2242 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2243 },
2244 },
2245 {
2246 .gpio = 100,
2247 .settings = {
2248 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2249 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2250 },
2251 },
2252 {
2253 .gpio = 101,
2254 .settings = {
2255 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2256 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2257 },
2258 },
2259 {
2260 .gpio = 102,
2261 .settings = {
2262 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2263 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2264 },
2265 },
2266};
2267
2268static int hdmi_enable_5v(int on)
2269{
2270 /* TBD: PM8921 regulator instead of 8901 */
2271 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2272 static int prev_on;
2273 int rc;
2274
2275 if (on == prev_on)
2276 return 0;
2277
2278 if (!reg_8921_hdmi_mvs)
2279 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2280 "hdmi_mvs");
2281
2282 if (on) {
2283 rc = regulator_enable(reg_8921_hdmi_mvs);
2284 if (rc) {
2285 pr_err("'%s' regulator enable failed, rc=%d\n",
2286 "8921_hdmi_mvs", rc);
2287 return rc;
2288 }
2289 pr_debug("%s(on): success\n", __func__);
2290 } else {
2291 rc = regulator_disable(reg_8921_hdmi_mvs);
2292 if (rc)
2293 pr_warning("'%s' regulator disable failed, rc=%d\n",
2294 "8921_hdmi_mvs", rc);
2295 pr_debug("%s(off): success\n", __func__);
2296 }
2297
2298 prev_on = on;
2299
2300 return 0;
2301}
2302
2303static int hdmi_core_power(int on, int show)
2304{
2305 static struct regulator *reg_8921_l23, *reg_8921_s4;
2306 static int prev_on;
2307 int rc;
2308
2309 if (on == prev_on)
2310 return 0;
2311
2312 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002313 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002315 if (IS_ERR(reg_8921_l23)) {
2316 pr_err("could not get reg_8921_l23, rc = %ld\n",
2317 PTR_ERR(reg_8921_l23));
2318 return -ENODEV;
2319 }
2320 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2321 if (rc) {
2322 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2323 return -EINVAL;
2324 }
2325 }
2326 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002327 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002328 if (IS_ERR(reg_8921_s4)) {
2329 pr_err("could not get reg_8921_s4, rc = %ld\n",
2330 PTR_ERR(reg_8921_s4));
2331 return -ENODEV;
2332 }
2333 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2334 if (rc) {
2335 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2336 return -EINVAL;
2337 }
2338 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002339
2340 if (on) {
2341 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2342 if (rc < 0) {
2343 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2344 return -EINVAL;
2345 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002346 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 if (rc) {
2348 pr_err("'%s' regulator enable failed, rc=%d\n",
2349 "hdmi_avdd", rc);
2350 return rc;
2351 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002352 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002353 if (rc) {
2354 pr_err("'%s' regulator enable failed, rc=%d\n",
2355 "hdmi_vcc", rc);
2356 return rc;
2357 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358 rc = gpio_request(100, "HDMI_DDC_CLK");
2359 if (rc) {
2360 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2361 "HDMI_DDC_CLK", 100, rc);
2362 goto error1;
2363 }
2364 rc = gpio_request(101, "HDMI_DDC_DATA");
2365 if (rc) {
2366 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2367 "HDMI_DDC_DATA", 101, rc);
2368 goto error2;
2369 }
2370 rc = gpio_request(102, "HDMI_HPD");
2371 if (rc) {
2372 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2373 "HDMI_HPD", 102, rc);
2374 goto error3;
2375 }
2376 pr_debug("%s(on): success\n", __func__);
2377 } else {
2378 gpio_free(100);
2379 gpio_free(101);
2380 gpio_free(102);
2381
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002382 rc = regulator_disable(reg_8921_l23);
2383 if (rc) {
2384 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2385 return -ENODEV;
2386 }
2387 rc = regulator_disable(reg_8921_s4);
2388 if (rc) {
2389 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2390 return -ENODEV;
2391 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002392 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2393 if (rc < 0) {
2394 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2395 return -EINVAL;
2396 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002397 pr_debug("%s(off): success\n", __func__);
2398 }
2399
2400 prev_on = on;
2401
2402 return 0;
2403
2404error3:
2405 gpio_free(101);
2406error2:
2407 gpio_free(100);
2408error1:
2409 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002410 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002411 return rc;
2412}
2413
2414static int hdmi_cec_power(int on)
2415{
2416 static int prev_on;
2417 int rc;
2418
2419 if (on == prev_on)
2420 return 0;
2421
2422 if (on) {
2423 rc = gpio_request(99, "HDMI_CEC_VAR");
2424 if (rc) {
2425 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2426 "HDMI_CEC_VAR", 99, rc);
2427 goto error;
2428 }
2429 pr_debug("%s(on): success\n", __func__);
2430 } else {
2431 gpio_free(99);
2432 pr_debug("%s(off): success\n", __func__);
2433 }
2434
2435 prev_on = on;
2436
2437 return 0;
2438error:
2439 return rc;
2440}
2441#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2442
2443static void __init msm8960_allocate_memory_regions(void)
2444{
2445 void *addr;
2446 unsigned long size;
2447
2448 size = MSM_FB_SIZE;
2449 addr = alloc_bootmem_align(size, 0x1000);
2450 msm_fb_resources[0].start = __pa(addr);
2451 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2452 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2453 size, addr, __pa(addr));
2454
2455}
2456#ifdef CONFIG_WCD9310_CODEC
2457
2458#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2459
Patrick Lai3043fba2011-08-01 14:15:57 -07002460/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2461 * 4 micbiases are used to power various analog and digital
2462 * microphones operating at 1800 mV. Technically, all micbiases
2463 * can source from single cfilter since all microphones operate
2464 * at the same voltage level. The arrangement below is to make
2465 * sure all cfilters are exercised. LDO_H regulator ouput level
2466 * does not need to be as high as 2.85V. It is choosen for
2467 * microphone sensitivity purpose.
2468 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002469static struct tabla_pdata tabla_platform_data = {
2470 .slimbus_slave_device = {
2471 .name = "tabla-slave",
2472 .e_addr = {0, 0, 0x10, 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),
Patrick Lai3043fba2011-08-01 14:15:57 -07002478 .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 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002488};
2489
2490static struct slim_device msm_slim_tabla = {
2491 .name = "tabla-slim",
2492 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2493 .dev = {
2494 .platform_data = &tabla_platform_data,
2495 },
2496};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302497
2498static struct tabla_pdata tabla20_platform_data = {
2499 .slimbus_slave_device = {
2500 .name = "tabla-slave",
2501 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2502 },
2503 .irq = MSM_GPIO_TO_INT(62),
2504 .irq_base = TABLA_INTERRUPT_BASE,
2505 .num_irqs = NR_TABLA_IRQS,
2506 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2507 .micbias = {
2508 .ldoh_v = TABLA_LDOH_2P85_V,
2509 .cfilt1_mv = 1800,
2510 .cfilt2_mv = 1800,
2511 .cfilt3_mv = 1800,
2512 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2513 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2514 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2515 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2516 }
2517};
2518
2519static struct slim_device msm_slim_tabla20 = {
2520 .name = "tabla2x-slim",
2521 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2522 .dev = {
2523 .platform_data = &tabla20_platform_data,
2524 },
2525};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002526#endif
2527
2528static struct slim_boardinfo msm_slim_devices[] = {
2529#ifdef CONFIG_WCD9310_CODEC
2530 {
2531 .bus_num = 1,
2532 .slim_slave = &msm_slim_tabla,
2533 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302534 {
2535 .bus_num = 1,
2536 .slim_slave = &msm_slim_tabla20,
2537 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002538#endif
2539 /* add more slimbus slaves as needed */
2540};
2541
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002542#define MSM_WCNSS_PHYS 0x03000000
2543#define MSM_WCNSS_SIZE 0x280000
2544
2545static struct resource resources_wcnss_wlan[] = {
2546 {
2547 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2548 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2549 .name = "wcnss_wlanrx_irq",
2550 .flags = IORESOURCE_IRQ,
2551 },
2552 {
2553 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2554 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2555 .name = "wcnss_wlantx_irq",
2556 .flags = IORESOURCE_IRQ,
2557 },
2558 {
2559 .start = MSM_WCNSS_PHYS,
2560 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2561 .name = "wcnss_mmio",
2562 .flags = IORESOURCE_MEM,
2563 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002564 {
2565 .start = 84,
2566 .end = 88,
2567 .name = "wcnss_gpios_5wire",
2568 .flags = IORESOURCE_IO,
2569 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002570};
2571
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002572static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2573 .has_48mhz_xo = 1,
2574};
2575
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002576static struct platform_device msm_device_wcnss_wlan = {
2577 .name = "wcnss_wlan",
2578 .id = 0,
2579 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2580 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002581 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002582};
2583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002584#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2585 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2586 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2587 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2588
2589#define QCE_SIZE 0x10000
2590#define QCE_0_BASE 0x18500000
2591
2592#define QCE_HW_KEY_SUPPORT 0
2593#define QCE_SHA_HMAC_SUPPORT 1
2594#define QCE_SHARE_CE_RESOURCE 1
2595#define QCE_CE_SHARED 0
2596
2597static struct resource qcrypto_resources[] = {
2598 [0] = {
2599 .start = QCE_0_BASE,
2600 .end = QCE_0_BASE + QCE_SIZE - 1,
2601 .flags = IORESOURCE_MEM,
2602 },
2603 [1] = {
2604 .name = "crypto_channels",
2605 .start = DMOV_CE_IN_CHAN,
2606 .end = DMOV_CE_OUT_CHAN,
2607 .flags = IORESOURCE_DMA,
2608 },
2609 [2] = {
2610 .name = "crypto_crci_in",
2611 .start = DMOV_CE_IN_CRCI,
2612 .end = DMOV_CE_IN_CRCI,
2613 .flags = IORESOURCE_DMA,
2614 },
2615 [3] = {
2616 .name = "crypto_crci_out",
2617 .start = DMOV_CE_OUT_CRCI,
2618 .end = DMOV_CE_OUT_CRCI,
2619 .flags = IORESOURCE_DMA,
2620 },
2621};
2622
2623static struct resource qcedev_resources[] = {
2624 [0] = {
2625 .start = QCE_0_BASE,
2626 .end = QCE_0_BASE + QCE_SIZE - 1,
2627 .flags = IORESOURCE_MEM,
2628 },
2629 [1] = {
2630 .name = "crypto_channels",
2631 .start = DMOV_CE_IN_CHAN,
2632 .end = DMOV_CE_OUT_CHAN,
2633 .flags = IORESOURCE_DMA,
2634 },
2635 [2] = {
2636 .name = "crypto_crci_in",
2637 .start = DMOV_CE_IN_CRCI,
2638 .end = DMOV_CE_IN_CRCI,
2639 .flags = IORESOURCE_DMA,
2640 },
2641 [3] = {
2642 .name = "crypto_crci_out",
2643 .start = DMOV_CE_OUT_CRCI,
2644 .end = DMOV_CE_OUT_CRCI,
2645 .flags = IORESOURCE_DMA,
2646 },
2647};
2648
2649#endif
2650
2651#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2652 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2653
2654static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2655 .ce_shared = QCE_CE_SHARED,
2656 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2657 .hw_key_support = QCE_HW_KEY_SUPPORT,
2658 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2659};
2660
2661static struct platform_device qcrypto_device = {
2662 .name = "qcrypto",
2663 .id = 0,
2664 .num_resources = ARRAY_SIZE(qcrypto_resources),
2665 .resource = qcrypto_resources,
2666 .dev = {
2667 .coherent_dma_mask = DMA_BIT_MASK(32),
2668 .platform_data = &qcrypto_ce_hw_suppport,
2669 },
2670};
2671#endif
2672
2673#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2674 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2675
2676static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2677 .ce_shared = QCE_CE_SHARED,
2678 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2679 .hw_key_support = QCE_HW_KEY_SUPPORT,
2680 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2681};
2682
2683static struct platform_device qcedev_device = {
2684 .name = "qce",
2685 .id = 0,
2686 .num_resources = ARRAY_SIZE(qcedev_resources),
2687 .resource = qcedev_resources,
2688 .dev = {
2689 .coherent_dma_mask = DMA_BIT_MASK(32),
2690 .platform_data = &qcedev_ce_hw_suppport,
2691 },
2692};
2693#endif
2694
2695
2696static int __init gpiomux_init(void)
2697{
2698 int rc;
2699
2700 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2701 if (rc) {
2702 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2703 return rc;
2704 }
2705
Nishant Pandit24153d82011-08-27 16:05:13 +05302706 msm_gpiomux_install(msm8960_cam_common_configs,
2707 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002708
2709 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002710 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711
2712 msm_gpiomux_install(msm8960_gsbi_configs,
2713 ARRAY_SIZE(msm8960_gsbi_configs));
2714
2715 msm_gpiomux_install(msm8960_cyts_configs,
2716 ARRAY_SIZE(msm8960_cyts_configs));
2717
2718 msm_gpiomux_install(msm8960_slimbus_config,
2719 ARRAY_SIZE(msm8960_slimbus_config));
2720
2721 msm_gpiomux_install(msm8960_audio_codec_configs,
2722 ARRAY_SIZE(msm8960_audio_codec_configs));
2723
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002724 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2725 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2726
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002727#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2728 msm_gpiomux_install(msm8960_hdmi_configs,
2729 ARRAY_SIZE(msm8960_hdmi_configs));
2730#endif
2731
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002732 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2733 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2734
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735 msm_gpiomux_install(wcnss_5wire_interface,
2736 ARRAY_SIZE(wcnss_5wire_interface));
2737
Mohan Pallaka5e490392011-09-09 15:18:41 +05302738 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2739 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2740 msm_gpiomux_install(hap_lvl_shft_config,
2741 ARRAY_SIZE(hap_lvl_shft_config));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742 return 0;
2743}
2744
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002745#define MSM_SHARED_RAM_PHYS 0x80000000
2746
2747static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2748 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2749 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2750 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2751 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2752 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2753 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2754 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2755 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2756 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2757 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2758 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2759 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2761 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2762 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2763 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2764 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2765 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2766 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2767 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2768 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2769 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2770 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2771 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2772 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2773 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002774 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002775 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2776 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2777 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002778 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2779 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780};
2781
2782static struct pm8921_adc_properties pm8921_adc_data = {
2783 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2784 .bitresolution = 15,
2785 .bipolar = 0,
2786};
2787
2788static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2789 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002790 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002792 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002793};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002794
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002795static void __init msm8960_map_io(void)
2796{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002797 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002798 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002799
2800 if (socinfo_init() < 0)
2801 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002802}
2803
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002804#ifdef CONFIG_ARCH_MSM8930
2805static void __init msm8930_map_io(void)
2806{
2807 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2808 msm_map_msm8930_io();
2809
2810 if (socinfo_init() < 0)
2811 pr_err("socinfo_init() failed!\n");
2812}
2813#endif
2814
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002815static void __init msm8960_init_irq(void)
2816{
2817 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818
2819 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002820 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002821 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002822
2823 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2827 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002828
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002829 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2830 * as they are configured as level, which does not play nice with
2831 * handle_percpu_irq.
2832 */
2833 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2834 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002835 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002836 }
2837}
2838
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002839/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002840enum sdcc_controllers {
2841 SDCC1,
2842 SDCC2,
2843 SDCC3,
2844 SDCC4,
2845 SDCC5,
2846 MAX_SDCC_CONTROLLER
2847};
2848
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002849/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002850static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2851 /* SDCC1 : eMMC card connected */
2852 [SDCC1] = {
2853 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302854 .high_vol_level = 2950000,
2855 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302856 .always_on = 1,
2857 .lpm_sup = 1,
2858 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002859 .hpm_uA = 200000, /* 200mA */
2860 },
2861 /* SDCC3 : External card slot connected */
2862 [SDCC3] = {
2863 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302864 .high_vol_level = 2950000,
2865 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002866 .hpm_uA = 600000, /* 600mA */
2867 }
2868};
2869
2870/* Only slots having eMMC card will require VCCQ voltage */
2871static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2872 /* SDCC1 : eMMC card connected */
2873 [SDCC1] = {
2874 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302876 .high_vol_level = 1800000,
2877 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002878 .hpm_uA = 200000, /* 200mA */
2879 }
2880};
2881
2882/* All SDCC controllers may require voting for VDD PAD voltage */
2883static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2884 /* SDCC3 : External card slot connected */
2885 [SDCC3] = {
2886 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302887 .high_vol_level = 2950000,
2888 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002889 .always_on = 1,
2890 .lpm_sup = 1,
2891 /* Max. Active current required is 16 mA */
2892 .hpm_uA = 16000,
2893 /*
2894 * Sleep current required is ~300 uA. But min. vote can be
2895 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2896 * during sleep.
2897 */
2898 .lpm_uA = 2000,
2899 }
2900};
2901
2902static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2903 /* SDCC1 : eMMC card connected */
2904 [SDCC1] = {
2905 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2906 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2907 },
2908 /* SDCC3 : External card slot connected */
2909 [SDCC3] = {
2910 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2911 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2912 }
2913};
2914
2915/* SDC1 pad data */
2916static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2917 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302918 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2919 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002920};
2921
2922static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2923 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2924 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2925 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2926};
2927
2928static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302929 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002930 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2931 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2932};
2933
2934static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302935 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002936 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2937 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2938};
2939
2940/* SDC3 pad data */
2941static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2942 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2943 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2944 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2945};
2946
2947static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2948 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2949 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2950 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2951};
2952
2953static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302954 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002955 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2956 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2957};
2958
2959static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302960 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302961 /*
2962 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2963 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2964 * which would result in false card detection interrupts.
2965 */
2966 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2967 /*
2968 * Keeping DATA lines status to PULL UP will make sure that
2969 * there is no current leak during sleep if external pull up
2970 * is connected to DATA lines.
2971 */
2972 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002973};
2974
2975struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2976 [SDCC1] = {
2977 .on = sdc1_pad_pull_on_cfg,
2978 .off = sdc1_pad_pull_off_cfg,
2979 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2980 },
2981 [SDCC3] = {
2982 .on = sdc3_pad_pull_on_cfg,
2983 .off = sdc3_pad_pull_off_cfg,
2984 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2985 },
2986};
2987
2988struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2989 [SDCC1] = {
2990 .on = sdc1_pad_drv_on_cfg,
2991 .off = sdc1_pad_drv_off_cfg,
2992 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2993 },
2994 [SDCC3] = {
2995 .on = sdc3_pad_drv_on_cfg,
2996 .off = sdc3_pad_drv_off_cfg,
2997 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2998 },
2999};
3000
3001struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
3002 [SDCC1] = {
3003 .pull = &mmc_pad_pull_data[SDCC1],
3004 .drv = &mmc_pad_drv_data[SDCC1]
3005 },
3006 [SDCC3] = {
3007 .pull = &mmc_pad_pull_data[SDCC3],
3008 .drv = &mmc_pad_drv_data[SDCC3]
3009 },
3010};
3011
3012struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
3013 [SDCC1] = {
3014 .pad_data = &mmc_pad_data[SDCC1],
3015 },
3016 [SDCC3] = {
3017 .pad_data = &mmc_pad_data[SDCC3],
3018 },
3019};
3020
3021static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303022 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003023};
3024
3025static unsigned int sdc3_sup_clk_rates[] = {
3026 400000, 24000000, 48000000, 96000000
3027};
3028
3029#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3030static struct mmc_platform_data msm8960_sdc1_data = {
3031 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3032#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3033 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3034#else
3035 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3036#endif
3037 .sup_clk_table = sdc1_sup_clk_rates,
3038 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303039 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003040 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003041 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303042 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003043};
3044#endif
3045
3046#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3047static struct mmc_platform_data msm8960_sdc3_data = {
3048 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3049 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3050 .sup_clk_table = sdc3_sup_clk_rates,
3051 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303052 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303053#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003054 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303055#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003056 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3057 .pin_data = &mmc_slot_pin_data[SDCC3],
3058#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3059 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3060 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3061 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3062#endif
3063 .xpc_cap = 1,
3064 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3065 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303066 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003067};
3068#endif
3069
3070static void __init msm8960_init_mmc(void)
3071{
3072#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3073 /* SDC1 : eMMC card connected */
3074 msm_add_sdcc(1, &msm8960_sdc1_data);
3075#endif
3076#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3077 /* SDC3: External card slot */
3078 msm_add_sdcc(3, &msm8960_sdc3_data);
3079#endif
3080}
3081
3082static void __init msm8960_init_buses(void)
3083{
3084#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003085 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003086 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3087 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3088 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3089 msm_bus_apps_fabric.dev.platform_data =
3090 &msm_bus_8960_apps_fabric_pdata;
3091 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3092 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3093 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3094 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003095#endif
3096}
3097
3098static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3099 .max_clock_speed = 15060000,
3100};
3101
3102#ifdef CONFIG_USB_MSM_OTG_72K
3103static struct msm_otg_platform_data msm_otg_pdata;
3104#else
3105#define USB_5V_EN 42
3106static void msm_hsusb_vbus_power(bool on)
3107{
3108 int rc;
3109 static bool vbus_is_on;
3110 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111
3112 if (vbus_is_on == on)
3113 return;
3114
3115 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003116 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3117 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003118 if (IS_ERR(mvs_otg_switch)) {
3119 pr_err("Unable to get mvs_otg_switch\n");
3120 return;
3121 }
3122
3123 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3124 "usb_5v_en");
3125 if (rc < 0) {
3126 pr_err("failed to request usb_5v_en gpio\n");
3127 goto put_mvs_otg;
3128 }
3129
Anji jonnala2936fd92011-11-09 15:39:22 +05303130 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3131 if (rc) {
3132 pr_err("%s: unable to set_direction for gpio [%d]\n",
3133 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134 goto free_usb_5v_en;
3135 }
3136
Anji jonnala2936fd92011-11-09 15:39:22 +05303137 if (regulator_enable(mvs_otg_switch)) {
3138 pr_err("unable to enable mvs_otg_switch\n");
3139 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003140 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303141
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003142 vbus_is_on = true;
3143 return;
3144 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303145 regulator_disable(mvs_otg_switch);
3146err_ldo_gpio_set_dir:
3147 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003148free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303149 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003150put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303151 regulator_put(mvs_otg_switch);
3152 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003153}
3154
3155static struct msm_otg_platform_data msm_otg_pdata = {
3156 .mode = USB_OTG,
3157 .otg_control = OTG_PMIC_CONTROL,
3158 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3159 .pclk_src_name = "dfab_usb_hs_clk",
3160 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3161 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303162 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003163};
3164#endif
3165
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303166#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303167#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303168static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3169 .strobe = 150,
3170 .data = 151,
3171};
3172#else
3173static struct msm_hsic_host_platform_data msm_hsic_pdata;
3174#endif
3175
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003176#define PID_MAGIC_ID 0x71432909
3177#define SERIAL_NUM_MAGIC_ID 0x61945374
3178#define SERIAL_NUMBER_LENGTH 127
3179#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3180
3181struct magic_num_struct {
3182 uint32_t pid;
3183 uint32_t serial_num;
3184};
3185
3186struct dload_struct {
3187 uint32_t reserved1;
3188 uint32_t reserved2;
3189 uint32_t reserved3;
3190 uint16_t reserved4;
3191 uint16_t pid;
3192 char serial_number[SERIAL_NUMBER_LENGTH];
3193 uint16_t reserved5;
3194 struct magic_num_struct magic_struct;
3195};
3196
3197static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3198{
3199 struct dload_struct __iomem *dload = 0;
3200
3201 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3202 if (!dload) {
3203 pr_err("%s: cannot remap I/O memory region: %08x\n",
3204 __func__, DLOAD_USB_BASE_ADD);
3205 return -ENXIO;
3206 }
3207
3208 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3209 __func__, dload, pid, snum);
3210 /* update pid */
3211 dload->magic_struct.pid = PID_MAGIC_ID;
3212 dload->pid = pid;
3213
3214 /* update serial number */
3215 dload->magic_struct.serial_num = 0;
3216 if (!snum) {
3217 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3218 goto out;
3219 }
3220
3221 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003222 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003223out:
3224 iounmap(dload);
3225 return 0;
3226}
3227
3228static struct android_usb_platform_data android_usb_pdata = {
3229 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3230};
3231
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003232static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003233 .name = "android_usb",
3234 .id = -1,
3235 .dev = {
3236 .platform_data = &android_usb_pdata,
3237 },
3238};
3239
3240static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3241 0x03, 0x0f,
3242};
3243
3244static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3245 0x00, 0x24, 0x54, 0x10,
3246 0x09, 0x03, 0x01,
3247 0x10, 0x54, 0x30, 0x0C,
3248 0x24, 0x30, 0x0f,
3249};
3250
3251static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3252 0x00, 0x24, 0x54, 0x10,
3253 0x09, 0x07, 0x01, 0x0B,
3254 0x10, 0x54, 0x30, 0x0C,
3255 0x24, 0x30, 0x0f,
3256};
3257
3258static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3259 [0] = {
3260 .mode = MSM_SPM_MODE_CLOCK_GATING,
3261 .notify_rpm = false,
3262 .cmd = spm_wfi_cmd_sequence,
3263 },
3264 [1] = {
3265 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3266 .notify_rpm = false,
3267 .cmd = spm_power_collapse_without_rpm,
3268 },
3269 [2] = {
3270 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3271 .notify_rpm = true,
3272 .cmd = spm_power_collapse_with_rpm,
3273 },
3274};
3275
3276static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3277 [0] = {
3278 .reg_base_addr = MSM_SAW0_BASE,
3279 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3280 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3281 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3282#if defined(CONFIG_MSM_AVS_HW)
3283 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3284 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3285#endif
3286 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3287 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3288 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3289 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3290 .vctl_timeout_us = 50,
3291 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3292 .modes = msm_spm_seq_list,
3293 },
3294 [1] = {
3295 .reg_base_addr = MSM_SAW1_BASE,
3296 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3297 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3298 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3299#if defined(CONFIG_MSM_AVS_HW)
3300 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3301 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3302#endif
3303 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3304 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3305 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3306 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3307 .vctl_timeout_us = 50,
3308 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3309 .modes = msm_spm_seq_list,
3310 },
3311};
3312
3313static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3314 0x00, 0x20, 0x03, 0x20,
3315 0x00, 0x0f,
3316};
3317
3318static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3319 0x00, 0x20, 0x34, 0x64,
3320 0x48, 0x07, 0x48, 0x20,
3321 0x50, 0x64, 0x04, 0x34,
3322 0x50, 0x0f,
3323};
3324static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3325 0x00, 0x10, 0x34, 0x64,
3326 0x48, 0x07, 0x48, 0x10,
3327 0x50, 0x64, 0x04, 0x34,
3328 0x50, 0x0F,
3329};
3330
3331static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3332 [0] = {
3333 .mode = MSM_SPM_L2_MODE_RETENTION,
3334 .notify_rpm = false,
3335 .cmd = l2_spm_wfi_cmd_sequence,
3336 },
3337 [1] = {
3338 .mode = MSM_SPM_L2_MODE_GDHS,
3339 .notify_rpm = true,
3340 .cmd = l2_spm_gdhs_cmd_sequence,
3341 },
3342 [2] = {
3343 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3344 .notify_rpm = true,
3345 .cmd = l2_spm_power_off_cmd_sequence,
3346 },
3347};
3348
3349
3350static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3351 [0] = {
3352 .reg_base_addr = MSM_SAW_L2_BASE,
3353 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3354 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3355 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3356 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3357 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3358 .modes = msm_spm_l2_seq_list,
3359 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3360 },
3361};
3362
Mohan Pallaka5e490392011-09-09 15:18:41 +05303363#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3364#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3365
3366static struct msm_xo_voter *xo_handle_d1;
3367
3368static int isa1200_power(int on)
3369{
3370 int rc = 0;
3371
3372 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3373
3374 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3375 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3376 if (rc < 0) {
3377 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3378 __func__, on ? "" : "de-", rc);
3379 goto err_xo_vote;
3380 }
3381
3382 return 0;
3383
3384err_xo_vote:
3385 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3386 return rc;
3387}
3388
3389static int isa1200_dev_setup(bool enable)
3390{
3391 int rc = 0;
3392
3393 struct pm_gpio hap_gpio_config = {
3394 .direction = PM_GPIO_DIR_OUT,
3395 .pull = PM_GPIO_PULL_NO,
3396 .out_strength = PM_GPIO_STRENGTH_HIGH,
3397 .function = PM_GPIO_FUNC_NORMAL,
3398 .inv_int_pol = 0,
3399 .vin_sel = 2,
3400 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3401 .output_value = 0,
3402 };
3403
3404 if (enable == true) {
3405 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3406 if (rc) {
3407 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3408 __func__, PM_HAP_EN_GPIO, rc);
3409 return rc;
3410 }
3411
3412 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3413 if (rc) {
3414 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3415 __func__, PM_HAP_LEN_GPIO, rc);
3416 return rc;
3417 }
3418
3419 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3420 if (rc) {
3421 pr_err("%s: unable to request gpio %d (%d)\n",
3422 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3423 return rc;
3424 }
3425
3426 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3427 if (rc) {
3428 pr_err("%s: Unable to set direction\n", __func__);
3429 goto free_gpio;
3430 }
3431
3432 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3433 if (IS_ERR(xo_handle_d1)) {
3434 rc = PTR_ERR(xo_handle_d1);
3435 pr_err("%s: failed to get the handle for D1(%d)\n",
3436 __func__, rc);
3437 goto gpio_set_dir;
3438 }
3439 } else {
3440 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3441
3442 msm_xo_put(xo_handle_d1);
3443 }
3444
3445 return 0;
3446
3447gpio_set_dir:
3448 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3449free_gpio:
3450 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3451 return rc;
3452}
3453
3454static struct isa1200_regulator isa1200_reg_data[] = {
3455 {
3456 .name = "vcc_i2c",
3457 .min_uV = ISA_I2C_VTG_MIN_UV,
3458 .max_uV = ISA_I2C_VTG_MAX_UV,
3459 .load_uA = ISA_I2C_CURR_UA,
3460 },
3461};
3462
3463static struct isa1200_platform_data isa1200_1_pdata = {
3464 .name = "vibrator",
3465 .dev_setup = isa1200_dev_setup,
3466 .power_on = isa1200_power,
3467 .hap_en_gpio = PM_HAP_EN_GPIO,
3468 .hap_len_gpio = PM_HAP_LEN_GPIO,
3469 .max_timeout = 15000,
3470 .mode_ctrl = PWM_GEN_MODE,
3471 .pwm_fd = {
3472 .pwm_div = 256,
3473 },
3474 .is_erm = false,
3475 .smart_en = true,
3476 .ext_clk_en = true,
3477 .chip_en = 1,
3478 .regulator_info = isa1200_reg_data,
3479 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3480};
3481
3482static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3483 {
3484 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3485 .platform_data = &isa1200_1_pdata,
3486 },
3487};
3488
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003489#define CYTTSP_TS_GPIO_IRQ 11
3490#define CYTTSP_TS_SLEEP_GPIO 50
3491#define CYTTSP_TS_RESOUT_N_GPIO 52
3492
3493/*virtual key support */
3494static ssize_t tma340_vkeys_show(struct kobject *kobj,
3495 struct kobj_attribute *attr, char *buf)
3496{
3497 return snprintf(buf, 200,
3498 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3499 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3500 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3501 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3502 "\n");
3503}
3504
3505static struct kobj_attribute tma340_vkeys_attr = {
3506 .attr = {
3507 .mode = S_IRUGO,
3508 },
3509 .show = &tma340_vkeys_show,
3510};
3511
3512static struct attribute *tma340_properties_attrs[] = {
3513 &tma340_vkeys_attr.attr,
3514 NULL
3515};
3516
3517static struct attribute_group tma340_properties_attr_group = {
3518 .attrs = tma340_properties_attrs,
3519};
3520
3521
3522static int cyttsp_platform_init(struct i2c_client *client)
3523{
3524 int rc = 0;
3525 static struct kobject *tma340_properties_kobj;
3526
3527 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3528 tma340_properties_kobj = kobject_create_and_add("board_properties",
3529 NULL);
3530 if (tma340_properties_kobj)
3531 rc = sysfs_create_group(tma340_properties_kobj,
3532 &tma340_properties_attr_group);
3533 if (!tma340_properties_kobj || rc)
3534 pr_err("%s: failed to create board_properties\n",
3535 __func__);
3536
3537 return 0;
3538}
3539
3540static struct cyttsp_regulator regulator_data[] = {
3541 {
3542 .name = "vdd",
3543 .min_uV = CY_TMA300_VTG_MIN_UV,
3544 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303545 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3546 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003547 },
3548 /* TODO: Remove after runtime PM is enabled in I2C driver */
3549 {
3550 .name = "vcc_i2c",
3551 .min_uV = CY_I2C_VTG_MIN_UV,
3552 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303553 .hpm_load_uA = CY_I2C_CURR_UA,
3554 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003555 },
3556};
3557
3558static struct cyttsp_platform_data cyttsp_pdata = {
3559 .panel_maxx = 634,
3560 .panel_maxy = 1166,
3561 .disp_maxx = 616,
3562 .disp_maxy = 1023,
3563 .disp_minx = 0,
3564 .disp_miny = 16,
3565 .flags = 0x01,
3566 .gen = CY_GEN3, /* or */
3567 .use_st = CY_USE_ST,
3568 .use_mt = CY_USE_MT,
3569 .use_hndshk = CY_SEND_HNDSHK,
3570 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303571 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003572 .use_gestures = CY_USE_GESTURES,
3573 .fw_fname = "cyttsp_8960_cdp.hex",
3574 /* activate up to 4 groups
3575 * and set active distance
3576 */
3577 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3578 CY_GEST_GRP3 | CY_GEST_GRP4 |
3579 CY_ACT_DIST,
3580 /* change act_intrvl to customize the Active power state
3581 * scanning/processing refresh interval for Operating mode
3582 */
3583 .act_intrvl = CY_ACT_INTRVL_DFLT,
3584 /* change tch_tmout to customize the touch timeout for the
3585 * Active power state for Operating mode
3586 */
3587 .tch_tmout = CY_TCH_TMOUT_DFLT,
3588 /* change lp_intrvl to customize the Low Power power state
3589 * scanning/processing refresh interval for Operating mode
3590 */
3591 .lp_intrvl = CY_LP_INTRVL_DFLT,
3592 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3593 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3594 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3595 .regulator_info = regulator_data,
3596 .num_regulators = ARRAY_SIZE(regulator_data),
3597 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303598 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003599};
3600
3601static struct i2c_board_info cyttsp_info[] __initdata = {
3602 {
3603 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3604 .platform_data = &cyttsp_pdata,
3605#ifndef CY_USE_TIMER
3606 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3607#endif /* CY_USE_TIMER */
3608 },
3609};
3610
Mohan Pallaka50837382011-09-07 11:00:57 +05303611/* configuration data */
3612static const u8 mxt_config_data[] = {
3613 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003614 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303615 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003616 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3617 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3618 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3619 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3620 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3621 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3622 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303623 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003624 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303625 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003626 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303627 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003628 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3629 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3630 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3631 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303632 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003633 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3634 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303635 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003636 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3637 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303638 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003639 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3640 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303641 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003642 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3643 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303644 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003645 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303646 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003647 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303648 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003649 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303650 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003651 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303652 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003653 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303654};
3655
3656#define MXT_TS_GPIO_IRQ 11
3657#define MXT_TS_LDO_EN_GPIO 50
3658#define MXT_TS_RESET_GPIO 52
3659
3660static void mxt_init_hw_liquid(void)
3661{
3662 int rc;
3663
3664 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3665 if (rc) {
3666 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3667 __func__, MXT_TS_GPIO_IRQ);
3668 return;
3669 }
3670
3671 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3672 if (rc) {
3673 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3674 __func__, MXT_TS_GPIO_IRQ);
3675 goto err_irq_gpio_req;
3676 }
3677
3678 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3679 if (rc) {
3680 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3681 __func__, MXT_TS_LDO_EN_GPIO);
3682 goto err_irq_gpio_req;
3683 }
3684
3685 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3686 if (rc) {
3687 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3688 __func__, MXT_TS_LDO_EN_GPIO);
3689 goto err_ldo_gpio_req;
3690 }
3691
3692 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3693 if (rc) {
3694 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3695 __func__, MXT_TS_RESET_GPIO);
3696 goto err_ldo_gpio_set_dir;
3697 }
3698
3699 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3700 if (rc) {
3701 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3702 __func__, MXT_TS_RESET_GPIO);
3703 goto err_reset_gpio_req;
3704 }
3705
3706 return;
3707
3708err_reset_gpio_req:
3709 gpio_free(MXT_TS_RESET_GPIO);
3710err_ldo_gpio_set_dir:
3711 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3712err_ldo_gpio_req:
3713 gpio_free(MXT_TS_LDO_EN_GPIO);
3714err_irq_gpio_req:
3715 gpio_free(MXT_TS_GPIO_IRQ);
3716}
3717
3718static struct mxt_platform_data mxt_platform_data = {
3719 .config = mxt_config_data,
3720 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003721 .x_size = 1365,
3722 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303723 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003724 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303725};
3726
3727static struct i2c_board_info mxt_device_info[] __initdata = {
3728 {
3729 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3730 .platform_data = &mxt_platform_data,
3731 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3732 },
3733};
3734
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003735static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3736{
3737}
3738
3739static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3740 .clk_freq = 100000,
3741 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003742 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3743};
3744
3745static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3746 .clk_freq = 100000,
3747 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003748 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3749};
3750
3751static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3752 .clk_freq = 100000,
3753 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003754 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3755};
3756
3757static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3758 .clk_freq = 100000,
3759 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003760 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3761};
3762
3763static struct msm_rpm_platform_data msm_rpm_data = {
3764 .reg_base_addrs = {
3765 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3766 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3767 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3768 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3769 },
3770
3771 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3772 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3773 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3774 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3775 .msm_apps_ipc_rpm_val = 4,
3776};
3777
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003778static struct ks8851_pdata spi_eth_pdata = {
3779 .irq_gpio = KS8851_IRQ_GPIO,
3780 .rst_gpio = KS8851_RST_GPIO,
3781};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003782
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003783static struct spi_board_info spi_board_info[] __initdata = {
3784 {
3785 .modalias = "ks8851",
3786 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3787 .max_speed_hz = 19200000,
3788 .bus_num = 0,
3789 .chip_select = 0,
3790 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003791 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003792 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003793 {
3794 .modalias = "dsi_novatek_3d_panel_spi",
3795 .max_speed_hz = 10800000,
3796 .bus_num = 0,
3797 .chip_select = 1,
3798 .mode = SPI_MODE_0,
3799 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003800};
3801
3802static struct platform_device msm_device_saw_core0 = {
3803 .name = "saw-regulator",
3804 .id = 0,
3805 .dev = {
3806 .platform_data = &msm_saw_regulator_pdata_s5,
3807 },
3808};
3809
3810static struct platform_device msm_device_saw_core1 = {
3811 .name = "saw-regulator",
3812 .id = 1,
3813 .dev = {
3814 .platform_data = &msm_saw_regulator_pdata_s6,
3815 },
3816};
3817
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003818#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3819static struct platform_device wfd_device = {
3820 .name = "msm_wfd",
3821 .id = -1,
3822};
3823#endif
3824
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003825static struct tsens_platform_data msm_tsens_pdata = {
3826 .slope = 910,
3827 .tsens_factor = 1000,
3828 .hw_type = MSM_8960,
3829 .tsens_num_sensor = 5,
3830};
3831
3832static struct platform_device msm_tsens_device = {
3833 .name = "tsens8960-tm",
3834 .id = -1,
3835 .dev = {
3836 .platform_data = &msm_tsens_pdata,
3837 },
3838};
3839
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003840#ifdef CONFIG_MSM_FAKE_BATTERY
3841static struct platform_device fish_battery_device = {
3842 .name = "fish_battery",
3843};
3844#endif
3845
David Collins26f05562011-06-20 09:56:28 -07003846static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003847 .name = GPIO_REGULATOR_DEV_NAME,
3848 .id = PM8921_MPP_PM_TO_SYS(7),
3849 .dev = {
3850 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3851 },
3852};
3853
David Collins26f05562011-06-20 09:56:28 -07003854static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003855 .name = GPIO_REGULATOR_DEV_NAME,
3856 .id = 91,
3857 .dev = {
3858 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3859 },
3860};
3861
David Collinsb10be1d2011-09-02 10:29:31 -07003862static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3863 .name = GPIO_REGULATOR_DEV_NAME,
3864 .id = PM8921_GPIO_PM_TO_SYS(17),
3865 .dev = {
3866 .platform_data =
3867 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3868 },
3869};
3870
David Collins26f05562011-06-20 09:56:28 -07003871static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3872 .name = "rpm-regulator",
3873 .id = -1,
3874 .dev = {
3875 .platform_data = &msm_rpm_regulator_pdata,
3876 },
3877};
3878
David Collins4c31a872011-08-31 10:07:10 -07003879static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3880 .phys_addr_base = 0x0010C000,
3881 .reg_offsets = {
3882 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3883 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3884 },
3885 .phys_size = SZ_8K,
3886 .log_len = 4096, /* log's buffer length in bytes */
3887 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3888};
3889
3890static struct platform_device msm_rpm_log_device = {
3891 .name = "msm_rpm_log",
3892 .id = -1,
3893 .dev = {
3894 .platform_data = &msm_rpm_log_pdata,
3895 },
3896};
3897
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003898static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003899 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003900 &msm_device_smd,
3901 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303902 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003903 &msm_device_saw_core0,
3904 &msm_device_saw_core1,
3905 &msm8960_device_ext_5v_vreg,
3906 &msm8960_device_ext_l2_vreg,
3907 &msm8960_device_ssbi_pm8921,
3908 &msm8960_device_qup_spi_gsbi1,
3909 &msm8960_device_qup_i2c_gsbi3,
3910 &msm8960_device_qup_i2c_gsbi4,
3911 &msm8960_device_qup_i2c_gsbi10,
3912#ifndef CONFIG_MSM_DSPS
3913 &msm8960_device_qup_i2c_gsbi12,
3914#endif
3915 &msm_slim_ctrl,
3916 &msm_device_wcnss_wlan,
3917#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3918 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3919 &qcrypto_device,
3920#endif
3921
3922#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3923 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3924 &qcedev_device,
3925#endif
3926#ifdef CONFIG_MSM_ROTATOR
3927 &msm_rotator_device,
3928#endif
3929 &msm_device_sps,
3930#ifdef CONFIG_MSM_FAKE_BATTERY
3931 &fish_battery_device,
3932#endif
3933#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003934#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003935 &android_pmem_device,
3936 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003937#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003938 &android_pmem_audio_device,
3939#endif
3940 &msm_fb_device,
3941 &msm_device_vidc,
3942 &msm_device_bam_dmux,
3943 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003944
3945#ifdef CONFIG_HW_RANDOM_MSM
3946 &msm_device_rng,
3947#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003948 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003949#ifdef CONFIG_ION_MSM
3950 &ion_dev,
3951#endif
David Collins4c31a872011-08-31 10:07:10 -07003952 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003953 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003954#ifdef CONFIG_MSM_QDSS
3955 &msm_etb_device,
3956 &msm_tpiu_device,
3957 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003958 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003959 &msm_ptm_device,
3960#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003961 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003962 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003963#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3964 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003965 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003966#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003967};
3968
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003969static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003970 &msm8960_device_otg,
3971 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003972 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303973 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003974 &android_usb_device,
3975 &msm_device_vidc,
3976 &mipi_dsi_simulator_panel_device,
3977 &msm_bus_apps_fabric,
3978 &msm_bus_sys_fabric,
3979 &msm_bus_mm_fabric,
3980 &msm_bus_sys_fpb,
3981 &msm_bus_cpss_fpb,
3982 &msm_pcm,
3983 &msm_pcm_routing,
3984 &msm_cpudai0,
3985 &msm_cpudai1,
3986 &msm_cpudai_hdmi_rx,
3987 &msm_cpudai_bt_rx,
3988 &msm_cpudai_bt_tx,
3989 &msm_cpudai_fm_rx,
3990 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003991 &msm_cpudai_auxpcm_rx,
3992 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003993 &msm_cpu_fe,
3994 &msm_stub_codec,
3995 &msm_voice,
3996 &msm_voip,
3997 &msm_lpa_pcm,
3998
3999#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
4000 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
4001 &qcrypto_device,
4002#endif
4003
4004#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
4005 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
4006 &qcedev_device,
4007#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004008};
4009
4010static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004011 &msm_kgsl_3d0,
4012 &msm_kgsl_2d0,
4013 &msm_kgsl_2d1,
4014 &mipi_dsi_renesas_panel_device,
4015#ifdef CONFIG_MSM_GEMINI
4016 &msm8960_gemini_device,
4017#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004018};
4019
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004020static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004021 &msm8960_device_otg,
4022 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004023 &msm_device_hsusb_host,
4024 &android_usb_device,
4025 &msm_pcm,
4026 &msm_pcm_routing,
4027 &msm_cpudai0,
4028 &msm_cpudai1,
4029 &msm_cpudai_hdmi_rx,
4030 &msm_cpudai_bt_rx,
4031 &msm_cpudai_bt_tx,
4032 &msm_cpudai_fm_rx,
4033 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004034 &msm_cpudai_auxpcm_rx,
4035 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004036 &msm_cpu_fe,
4037 &msm_stub_codec,
4038 &msm_kgsl_3d0,
4039#ifdef CONFIG_MSM_KGSL_2D
4040 &msm_kgsl_2d0,
4041 &msm_kgsl_2d1,
4042#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004043 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004044#ifdef CONFIG_MSM_GEMINI
4045 &msm8960_gemini_device,
4046#endif
4047 &msm_voice,
4048 &msm_voip,
4049 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304050 &msm_cpudai_afe_01_rx,
4051 &msm_cpudai_afe_01_tx,
4052 &msm_cpudai_afe_02_rx,
4053 &msm_cpudai_afe_02_tx,
4054 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004055#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4056 &hdmi_msm_device,
4057#endif
4058 &msm_pcm_hostless,
4059 &msm_bus_apps_fabric,
4060 &msm_bus_sys_fabric,
4061 &msm_bus_mm_fabric,
4062 &msm_bus_sys_fpb,
4063 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004064 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004065};
4066
4067static void __init msm8960_i2c_init(void)
4068{
4069 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4070 &msm8960_i2c_qup_gsbi4_pdata;
4071
4072 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4073 &msm8960_i2c_qup_gsbi3_pdata;
4074
4075 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4076 &msm8960_i2c_qup_gsbi10_pdata;
4077
4078 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4079 &msm8960_i2c_qup_gsbi12_pdata;
4080}
4081
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004082static void __init msm8960_gfx_init(void)
4083{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004084 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004085 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4086 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4087 msm_kgsl_3d0.dev.platform_data;
4088 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
4089 320000000;
4090 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
4091 266667000;
4092 }
4093}
4094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004095static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4096 .irq_base = PM8921_IRQ_BASE,
4097 .devirq = MSM_GPIO_TO_INT(104),
4098 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4099};
4100
4101static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4102 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4103};
4104
4105static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4106 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4107};
4108
4109static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4110 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304111 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004112};
4113
4114static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4115 .pull_up = 1,
4116 .kpd_trigger_delay_us = 970,
4117 .wakeup = 1,
4118};
4119
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304120/* Rotate lock key is not available so use F1 */
4121#define KEY_ROTATE_LOCK KEY_F1
4122
4123static const unsigned int keymap_liquid[] = {
4124 KEY(0, 0, KEY_VOLUMEUP),
4125 KEY(0, 1, KEY_VOLUMEDOWN),
4126 KEY(1, 3, KEY_ROTATE_LOCK),
4127 KEY(1, 4, KEY_HOME),
4128};
4129
4130static struct matrix_keymap_data keymap_data_liquid = {
4131 .keymap_size = ARRAY_SIZE(keymap_liquid),
4132 .keymap = keymap_liquid,
4133};
4134
4135static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4136 .input_name = "keypad_8960_liquid",
4137 .input_phys_device = "keypad_8960/input0",
4138 .num_rows = 2,
4139 .num_cols = 5,
4140 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4141 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4142 .debounce_ms = 15,
4143 .scan_delay_ms = 32,
4144 .row_hold_ns = 91500,
4145 .wakeup = 1,
4146 .keymap_data = &keymap_data_liquid,
4147};
4148
4149
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004150static const unsigned int keymap[] = {
4151 KEY(0, 0, KEY_VOLUMEUP),
4152 KEY(0, 1, KEY_VOLUMEDOWN),
4153 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4154 KEY(0, 3, KEY_CAMERA_FOCUS),
4155};
4156
4157static struct matrix_keymap_data keymap_data = {
4158 .keymap_size = ARRAY_SIZE(keymap),
4159 .keymap = keymap,
4160};
4161
4162static struct pm8xxx_keypad_platform_data keypad_data = {
4163 .input_name = "keypad_8960",
4164 .input_phys_device = "keypad_8960/input0",
4165 .num_rows = 1,
4166 .num_cols = 5,
4167 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4168 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4169 .debounce_ms = 15,
4170 .scan_delay_ms = 32,
4171 .row_hold_ns = 91500,
4172 .wakeup = 1,
4173 .keymap_data = &keymap_data,
4174};
4175
4176static const unsigned int keymap_sim[] = {
4177 KEY(0, 0, KEY_7),
4178 KEY(0, 1, KEY_DOWN),
4179 KEY(0, 2, KEY_UP),
4180 KEY(0, 3, KEY_RIGHT),
4181 KEY(0, 4, KEY_ENTER),
4182 KEY(0, 5, KEY_L),
4183 KEY(0, 6, KEY_BACK),
4184 KEY(0, 7, KEY_M),
4185
4186 KEY(1, 0, KEY_LEFT),
4187 KEY(1, 1, KEY_SEND),
4188 KEY(1, 2, KEY_1),
4189 KEY(1, 3, KEY_4),
4190 KEY(1, 4, KEY_CLEAR),
4191 KEY(1, 5, KEY_MSDOS),
4192 KEY(1, 6, KEY_SPACE),
4193 KEY(1, 7, KEY_COMMA),
4194
4195 KEY(2, 0, KEY_6),
4196 KEY(2, 1, KEY_5),
4197 KEY(2, 2, KEY_8),
4198 KEY(2, 3, KEY_3),
4199 KEY(2, 4, KEY_NUMERIC_STAR),
4200 KEY(2, 5, KEY_UP),
4201 KEY(2, 6, KEY_DOWN),
4202 KEY(2, 7, KEY_LEFTSHIFT),
4203
4204 KEY(3, 0, KEY_9),
4205 KEY(3, 1, KEY_NUMERIC_POUND),
4206 KEY(3, 2, KEY_0),
4207 KEY(3, 3, KEY_2),
4208 KEY(3, 4, KEY_SLEEP),
4209 KEY(3, 5, KEY_F1),
4210 KEY(3, 6, KEY_F2),
4211 KEY(3, 7, KEY_F3),
4212
4213 KEY(4, 0, KEY_BACK),
4214 KEY(4, 1, KEY_HOME),
4215 KEY(4, 2, KEY_MENU),
4216 KEY(4, 3, KEY_VOLUMEUP),
4217 KEY(4, 4, KEY_VOLUMEDOWN),
4218 KEY(4, 5, KEY_F4),
4219 KEY(4, 6, KEY_F5),
4220 KEY(4, 7, KEY_F6),
4221
4222 KEY(5, 0, KEY_R),
4223 KEY(5, 1, KEY_T),
4224 KEY(5, 2, KEY_Y),
4225 KEY(5, 3, KEY_LEFTALT),
4226 KEY(5, 4, KEY_KPENTER),
4227 KEY(5, 5, KEY_Q),
4228 KEY(5, 6, KEY_W),
4229 KEY(5, 7, KEY_E),
4230
4231 KEY(6, 0, KEY_F),
4232 KEY(6, 1, KEY_G),
4233 KEY(6, 2, KEY_H),
4234 KEY(6, 3, KEY_CAPSLOCK),
4235 KEY(6, 4, KEY_PAGEUP),
4236 KEY(6, 5, KEY_A),
4237 KEY(6, 6, KEY_S),
4238 KEY(6, 7, KEY_D),
4239
4240 KEY(7, 0, KEY_V),
4241 KEY(7, 1, KEY_B),
4242 KEY(7, 2, KEY_N),
4243 KEY(7, 3, KEY_MENU),
4244 KEY(7, 4, KEY_PAGEDOWN),
4245 KEY(7, 5, KEY_Z),
4246 KEY(7, 6, KEY_X),
4247 KEY(7, 7, KEY_C),
4248
4249 KEY(8, 0, KEY_P),
4250 KEY(8, 1, KEY_J),
4251 KEY(8, 2, KEY_K),
4252 KEY(8, 3, KEY_INSERT),
4253 KEY(8, 4, KEY_LINEFEED),
4254 KEY(8, 5, KEY_U),
4255 KEY(8, 6, KEY_I),
4256 KEY(8, 7, KEY_O),
4257
4258 KEY(9, 0, KEY_4),
4259 KEY(9, 1, KEY_5),
4260 KEY(9, 2, KEY_6),
4261 KEY(9, 3, KEY_7),
4262 KEY(9, 4, KEY_8),
4263 KEY(9, 5, KEY_1),
4264 KEY(9, 6, KEY_2),
4265 KEY(9, 7, KEY_3),
4266
4267 KEY(10, 0, KEY_F7),
4268 KEY(10, 1, KEY_F8),
4269 KEY(10, 2, KEY_F9),
4270 KEY(10, 3, KEY_F10),
4271 KEY(10, 4, KEY_FN),
4272 KEY(10, 5, KEY_9),
4273 KEY(10, 6, KEY_0),
4274 KEY(10, 7, KEY_DOT),
4275
4276 KEY(11, 0, KEY_LEFTCTRL),
4277 KEY(11, 1, KEY_F11),
4278 KEY(11, 2, KEY_ENTER),
4279 KEY(11, 3, KEY_SEARCH),
4280 KEY(11, 4, KEY_DELETE),
4281 KEY(11, 5, KEY_RIGHT),
4282 KEY(11, 6, KEY_LEFT),
4283 KEY(11, 7, KEY_RIGHTSHIFT),
4284 KEY(0, 0, KEY_VOLUMEUP),
4285 KEY(0, 1, KEY_VOLUMEDOWN),
4286 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4287 KEY(0, 3, KEY_CAMERA_FOCUS),
4288};
4289
4290static struct matrix_keymap_data keymap_data_sim = {
4291 .keymap_size = ARRAY_SIZE(keymap_sim),
4292 .keymap = keymap_sim,
4293};
4294
4295static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4296 .input_name = "keypad_8960",
4297 .input_phys_device = "keypad_8960/input0",
4298 .num_rows = 12,
4299 .num_cols = 8,
4300 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4301 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4302 .debounce_ms = 15,
4303 .scan_delay_ms = 32,
4304 .row_hold_ns = 91500,
4305 .wakeup = 1,
4306 .keymap_data = &keymap_data_sim,
4307};
4308
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004309static int pm8921_therm_mitigation[] = {
4310 1100,
4311 700,
4312 600,
4313 325,
4314};
4315
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004316static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004317 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004318 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004319 .max_voltage = 4200,
4320 .min_voltage = 3200,
4321 .resume_voltage = 4100,
4322 .term_current = 100,
4323 .cool_temp = 10,
4324 .warm_temp = 40,
4325 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004326 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004327 .cool_bat_chg_current = 350,
4328 .warm_bat_chg_current = 350,
4329 .cool_bat_voltage = 4100,
4330 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004331 .thermal_mitigation = pm8921_therm_mitigation,
4332 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004333};
4334
4335static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4336 .priority = 0,
4337};
4338
4339static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4340 .r_sense = 10,
4341 .i_test = 2500,
4342 .v_failure = 3000,
4343 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004344};
4345
Jay Chokshide4cefb2011-08-04 18:10:44 -07004346#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004347#define PM8XXX_LED_PWM_PERIOD 1000
4348#define PM8XXX_LED_PWM_DUTY_MS 20
4349/**
4350 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4351 * driven using PWM feature.
4352 */
4353#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004355static struct led_info pm8921_led_info[] = {
4356 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004357 .name = "led:battery_charging",
4358 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004359 },
4360 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004361 .name = "led:battery_full",
4362 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004363 },
4364};
4365
Jay Chokshi8994e392011-09-14 18:20:39 -07004366static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004367 .num_leds = ARRAY_SIZE(pm8921_led_info),
4368 .leds = pm8921_led_info,
4369};
4370
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004371static int pm8921_led0_pwm_duty_pcts[56] = {
4372 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4373 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4374 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4375 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4376 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4377 14, 10, 6, 4, 1
4378};
4379
4380static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4381 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4382 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4383 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4384 .start_idx = 0,
4385};
4386
Jay Chokshi8994e392011-09-14 18:20:39 -07004387static struct pm8xxx_led_config pm8921_led_configs[] = {
4388 [0] = {
4389 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004390 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004391 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004392 .pwm_channel = 5,
4393 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4394 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004395 },
4396 [1] = {
4397 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004398 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004399 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004400 .pwm_channel = 4,
4401 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004402 },
4403};
4404
4405static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4406 .led_core = &pm8921_led_core_pdata,
4407 .configs = pm8921_led_configs,
4408 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4409};
4410
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004411static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4412 .irq_pdata = &pm8xxx_irq_pdata,
4413 .gpio_pdata = &pm8xxx_gpio_pdata,
4414 .mpp_pdata = &pm8xxx_mpp_pdata,
4415 .rtc_pdata = &pm8xxx_rtc_pdata,
4416 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4417 .keypad_pdata = &keypad_data,
4418 .misc_pdata = &pm8xxx_misc_pdata,
4419 .regulator_pdatas = msm_pm8921_regulator_pdata,
4420 .charger_pdata = &pm8921_chg_pdata,
4421 .bms_pdata = &pm8921_bms_pdata,
4422 .adc_pdata = &pm8921_adc_pdata,
4423 .leds_pdata = &pm8xxx_leds_pdata,
4424};
4425
4426static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4427 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4428 .slave = {
4429 .name = "pm8921-core",
4430 .platform_data = &pm8921_platform_data,
4431 },
4432};
4433
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004434static struct msm_cpuidle_state msm_cstates[] __initdata = {
4435 {0, 0, "C0", "WFI",
4436 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4437
4438 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4439 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4440
4441 {0, 2, "C2", "POWER_COLLAPSE",
4442 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4443
4444 {1, 0, "C0", "WFI",
4445 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4446
4447 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4448 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4449};
4450
4451static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4452 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4453 .idle_supported = 1,
4454 .suspend_supported = 1,
4455 .idle_enabled = 0,
4456 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004457 },
4458
4459 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4460 .idle_supported = 1,
4461 .suspend_supported = 1,
4462 .idle_enabled = 0,
4463 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004464 },
4465
4466 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4467 .idle_supported = 1,
4468 .suspend_supported = 1,
4469 .idle_enabled = 1,
4470 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004471 },
4472
4473 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4474 .idle_supported = 0,
4475 .suspend_supported = 1,
4476 .idle_enabled = 0,
4477 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004478 },
4479
4480 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4481 .idle_supported = 1,
4482 .suspend_supported = 1,
4483 .idle_enabled = 0,
4484 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004485 },
4486
4487 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4488 .idle_supported = 1,
4489 .suspend_supported = 0,
4490 .idle_enabled = 1,
4491 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004492 },
4493};
4494
4495static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4496 {
4497 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4498 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4499 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004500 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004501 },
4502
4503 {
4504 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4505 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4506 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004507 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004508 },
4509
4510 {
4511 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4512 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4513 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004514 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004515 },
4516
4517 {
4518 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4519 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4520 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004521 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004522 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004523 {
4524 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4525 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4526 false,
4527 7000, 3500, 66600000, 5150,
4528 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004529
4530 {
4531 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4532 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4533 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004534 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004535 },
4536
4537 {
4538 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4539 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4540 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004541 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004542 },
4543
4544 {
4545 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4546 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4547 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004548 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004549 },
4550
4551 {
4552 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4553 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4554 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004555 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004556 },
4557};
4558
4559#ifdef CONFIG_I2C
4560#define I2C_SURF 1
4561#define I2C_FFA (1 << 1)
4562#define I2C_RUMI (1 << 2)
4563#define I2C_SIM (1 << 3)
4564#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004565#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566
4567struct i2c_registry {
4568 u8 machs;
4569 int bus;
4570 struct i2c_board_info *info;
4571 int len;
4572};
4573
4574#ifdef CONFIG_MSM_CAMERA
4575static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4576#ifdef CONFIG_IMX074
4577 {
4578 I2C_BOARD_INFO("imx074", 0x1A),
4579 },
4580#endif
4581#ifdef CONFIG_OV2720
4582 {
4583 I2C_BOARD_INFO("ov2720", 0x6C),
4584 },
4585#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004586 {
4587 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4588 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304589#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4590 {
4591 I2C_BOARD_INFO("sc628a", 0x6E),
4592 },
4593#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004594};
4595#endif
4596
4597/* Sensors DSPS platform data */
4598#ifdef CONFIG_MSM_DSPS
4599#define DSPS_PIL_GENERIC_NAME "dsps"
4600#endif /* CONFIG_MSM_DSPS */
4601
4602static void __init msm8960_init_dsps(void)
4603{
4604#ifdef CONFIG_MSM_DSPS
4605 struct msm_dsps_platform_data *pdata =
4606 msm_dsps_device.dev.platform_data;
4607 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4608 pdata->gpios = NULL;
4609 pdata->gpios_num = 0;
4610
4611 platform_device_register(&msm_dsps_device);
4612#endif /* CONFIG_MSM_DSPS */
4613}
4614
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004615static void __init msm8960_init_hsic(void)
4616{
4617#ifdef CONFIG_USB_EHCI_MSM_HSIC
4618 uint32_t version = socinfo_get_version();
4619
4620 pr_info("%s: version:%d mtp:%d\n", __func__,
4621 SOCINFO_VERSION_MAJOR(version),
4622 machine_is_msm8960_mtp());
4623
4624 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4625 machine_is_msm8960_mtp() ||
4626 machine_is_msm8960_fluid())
4627 return;
4628
4629 msm_gpiomux_install(msm8960_hsic_configs,
4630 ARRAY_SIZE(msm8960_hsic_configs));
4631
4632 platform_device_register(&msm_device_hsic_host);
4633#endif
4634}
4635
4636
Amir Samuelov5137e392011-09-21 17:31:25 +03004637#ifdef CONFIG_ISL9519_CHARGER
4638static struct isl_platform_data isl_data __initdata = {
4639 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4640 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4641 .max_system_voltage = 4200,
4642 .min_system_voltage = 3200,
4643 .chgcurrent = 1000, /* 1900, */
4644 .term_current = 400, /* Need fine tuning */
4645 .input_current = 2048,
4646};
4647
4648static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4649 {
4650 I2C_BOARD_INFO("isl9519q", 0x9),
4651 .irq = 0, /* Not required when notify-by-pmic */
4652 .platform_data = &isl_data,
4653 },
4654};
4655#endif /* CONFIG_ISL9519_CHARGER */
4656
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004657static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4658#ifdef CONFIG_MSM_CAMERA
4659 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004660 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004661 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4662 msm_camera_boardinfo,
4663 ARRAY_SIZE(msm_camera_boardinfo),
4664 },
4665#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004666#ifdef CONFIG_ISL9519_CHARGER
4667 {
4668 I2C_LIQUID,
4669 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4670 isl_charger_i2c_info,
4671 ARRAY_SIZE(isl_charger_i2c_info),
4672 },
4673#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004674 {
4675 I2C_SURF | I2C_FFA | I2C_FLUID,
4676 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4677 cyttsp_info,
4678 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004679 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304680 {
4681 I2C_LIQUID,
4682 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4683 mxt_device_info,
4684 ARRAY_SIZE(mxt_device_info),
4685 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304686 {
4687 I2C_LIQUID,
4688 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4689 msm_isa1200_board_info,
4690 ARRAY_SIZE(msm_isa1200_board_info),
4691 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004692};
4693#endif /* CONFIG_I2C */
4694
4695static void __init register_i2c_devices(void)
4696{
4697#ifdef CONFIG_I2C
4698 u8 mach_mask = 0;
4699 int i;
4700
4701 /* Build the matching 'supported_machs' bitmask */
4702 if (machine_is_msm8960_cdp())
4703 mach_mask = I2C_SURF;
4704 else if (machine_is_msm8960_rumi3())
4705 mach_mask = I2C_RUMI;
4706 else if (machine_is_msm8960_sim())
4707 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004708 else if (machine_is_msm8960_fluid())
4709 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004710 else if (machine_is_msm8960_liquid())
4711 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004712 else if (machine_is_msm8960_mtp())
4713 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004714 else
4715 pr_err("unmatched machine ID in register_i2c_devices\n");
4716
4717 /* Run the array and install devices as appropriate */
4718 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4719 if (msm8960_i2c_devices[i].machs & mach_mask)
4720 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4721 msm8960_i2c_devices[i].info,
4722 msm8960_i2c_devices[i].len);
4723 }
4724#endif
4725}
4726
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004727static void __init msm8960_sim_init(void)
4728{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004729 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4730 &msm8960_device_watchdog.dev.platform_data;
4731
4732 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004733 BUG_ON(msm_rpm_init(&msm_rpm_data));
4734 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4735 ARRAY_SIZE(msm_rpmrs_levels)));
4736 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004737 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004738 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004739 msm8960_device_ssbi_pm8921.dev.platform_data =
4740 &msm8960_ssbi_pm8921_pdata;
4741 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004742
4743 /* Simulator supports a QWERTY keypad */
4744 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4745
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004746 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004747 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004748 msm8960_i2c_init();
4749 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4750 msm_spm_l2_init(msm_spm_l2_data);
4751 msm8960_init_buses();
4752 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4753 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004754 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004755 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004756
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
4761 msm8960_init_mmc();
4762 msm_fb_add_devices();
4763 slim_register_board_info(msm_slim_devices,
4764 ARRAY_SIZE(msm_slim_devices));
4765 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4766 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4767 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4768 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004769 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004770}
4771
4772static void __init msm8960_rumi3_init(void)
4773{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004774 BUG_ON(msm_rpm_init(&msm_rpm_data));
4775 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4776 ARRAY_SIZE(msm_rpmrs_levels)));
4777 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004778 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004779 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004780 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004781 msm8960_device_ssbi_pm8921.dev.platform_data =
4782 &msm8960_ssbi_pm8921_pdata;
4783 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4784 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4785 &msm8960_qup_spi_gsbi1_pdata;
4786 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4787 msm8960_i2c_init();
4788 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4789 msm_spm_l2_init(msm_spm_l2_data);
4790 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4791 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004792 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004793 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004794 register_i2c_devices();
4795 msm_fb_add_devices();
4796 slim_register_board_info(msm_slim_devices,
4797 ARRAY_SIZE(msm_slim_devices));
4798 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4799 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4800 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4801 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004802 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004803}
4804
4805static void __init msm8960_cdp_init(void)
4806{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004807 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4808 pr_err("meminfo_init() failed!\n");
4809
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004810 BUG_ON(msm_rpm_init(&msm_rpm_data));
4811 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4812 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004813
4814 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004815 regulator_suppress_info_printing();
4816 if (msm_xo_init())
4817 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004818 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004819 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304820 if (machine_is_msm8960_liquid())
4821 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004822 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304823#ifdef CONFIG_USB_EHCI_MSM_HSIC
4824 if (machine_is_msm8960_liquid()) {
4825 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4826 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4827 }
4828#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304829 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004830 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304831 if (machine_is_msm8960_liquid())
4832 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004833 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4834 &msm8960_qup_spi_gsbi1_pdata;
4835 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4836 msm8960_device_ssbi_pm8921.dev.platform_data =
4837 &msm8960_ssbi_pm8921_pdata;
4838 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4839 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004840 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004841 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4842 msm_spm_l2_init(msm_spm_l2_data);
4843 msm8960_init_buses();
4844 platform_add_devices(msm_footswitch_devices,
4845 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004846 if (machine_is_msm8960_liquid())
4847 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004848 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4849 pm8921_gpio_mpp_init();
4850 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004851 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004852 msm8960_init_cam();
4853 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004854 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304855 if (machine_is_msm8960_liquid())
4856 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004857 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004858 msm_fb_add_devices();
4859 slim_register_board_info(msm_slim_devices,
4860 ARRAY_SIZE(msm_slim_devices));
4861 msm8960_init_dsps();
4862 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4863 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4864 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4865 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004866 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004867 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004868}
4869
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004870MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4871 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004872 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004873 .init_irq = msm8960_init_irq,
4874 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004875 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004876 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004877 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004878MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004879
4880MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4881 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004882 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004883 .init_irq = msm8960_init_irq,
4884 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004885 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004886 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004887 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004888MACHINE_END
4889
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004890MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4891 .map_io = msm8960_map_io,
4892 .reserve = msm8960_reserve,
4893 .init_irq = msm8960_init_irq,
4894 .timer = &msm_timer,
4895 .init_machine = msm8960_cdp_init,
4896 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004897 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004898MACHINE_END
4899
4900MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4901 .map_io = msm8960_map_io,
4902 .reserve = msm8960_reserve,
4903 .init_irq = msm8960_init_irq,
4904 .timer = &msm_timer,
4905 .init_machine = msm8960_cdp_init,
4906 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004907 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004908MACHINE_END
4909
4910MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4911 .map_io = msm8960_map_io,
4912 .reserve = msm8960_reserve,
4913 .init_irq = msm8960_init_irq,
4914 .timer = &msm_timer,
4915 .init_machine = msm8960_cdp_init,
4916 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004917 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004918MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004919
4920MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4921 .map_io = msm8960_map_io,
4922 .reserve = msm8960_reserve,
4923 .init_irq = msm8960_init_irq,
4924 .timer = &msm_timer,
4925 .init_machine = msm8960_cdp_init,
4926 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004927 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004928MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004929
4930#ifdef CONFIG_ARCH_MSM8930
4931MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4932 .map_io = msm8930_map_io,
4933 .reserve = msm8960_reserve,
4934 .init_irq = msm8960_init_irq,
4935 .timer = &msm_timer,
4936 .init_machine = msm8960_cdp_init,
4937 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004938 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004939MACHINE_END
4940
4941MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4942 .map_io = msm8930_map_io,
4943 .reserve = msm8960_reserve,
4944 .init_irq = msm8960_init_irq,
4945 .timer = &msm_timer,
4946 .init_machine = msm8960_cdp_init,
4947 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004948 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004949MACHINE_END
4950
4951MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4952 .map_io = msm8930_map_io,
4953 .reserve = msm8960_reserve,
4954 .init_irq = msm8960_init_irq,
4955 .timer = &msm_timer,
4956 .init_machine = msm8960_cdp_init,
4957 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004958 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004959MACHINE_END
4960#endif