blob: f88620fc945925fea96f8c5e41c1bfe9c45f63fd [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
Daniel Walker8d747cd2010-02-25 11:37:43 -08002 *
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 *
Daniel Walker8d747cd2010-02-25 11:37:43 -080012 */
13
14#include <linux/kernel.h>
15#include <linux/irq.h>
16#include <linux/gpio.h>
17#include <linux/platform_device.h>
18#include <linux/delay.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/bootmem.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080020#include <linux/io.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#ifdef CONFIG_SPI_QSD
22#include <linux/spi/spi.h>
23#endif
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +053024#include <linux/msm_ssbi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/mfd/pmic8058.h>
26#include <linux/mfd/marimba.h>
27#include <linux/i2c.h>
28#include <linux/input.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080029#include <linux/smsc911x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#include <linux/ofn_atlab.h>
31#include <linux/power_supply.h>
32#include <linux/input/pmic8058-keypad.h>
33#include <linux/i2c/isa1200.h>
34#include <linux/pwm.h>
35#include <linux/pmic8058-pwm.h>
36#include <linux/i2c/tsc2007.h>
37#include <linux/input/kp_flip_switch.h>
38#include <linux/leds-pmic8058.h>
39#include <linux/input/cy8c_ts.h>
40#include <linux/msm_adc.h>
41#include <linux/dma-mapping.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
45#include <asm/setup.h>
46
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <mach/mpp.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080048#include <mach/board.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <mach/camera.h>
50#include <mach/memory.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080051#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <mach/msm_hsusb.h>
53#include <mach/rpc_hsusb.h>
54#include <mach/msm_spi.h>
55#include <mach/qdsp5v2/msm_lpa.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080056#include <mach/dma.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057#include <linux/android_pmem.h>
58#include <linux/input/msm_ts.h>
59#include <mach/pmic.h>
60#include <mach/rpc_pmapp.h>
61#include <mach/qdsp5v2/aux_pcm.h>
62#include <mach/qdsp5v2/mi2s.h>
63#include <mach/qdsp5v2/audio_dev_ctl.h>
64#include <mach/msm_battery.h>
65#include <mach/rpc_server_handset.h>
66#include <mach/msm_tsif.h>
67#include <mach/socinfo.h>
68#include <mach/msm_memtypes.h>
69#include <linux/cyttsp.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080070
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#include <asm/mach/mmc.h>
72#include <asm/mach/flash.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080073#include <mach/vreg.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#include <linux/platform_data/qcom_crypto_device.h>
75
Daniel Walker8d747cd2010-02-25 11:37:43 -080076#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#include "timer.h"
78#ifdef CONFIG_USB_G_ANDROID
79#include <linux/usb/android.h>
80#include <mach/usbdiag.h>
81#endif
82#include "pm.h"
83#include "spm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070084#include "acpuclock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085#include <mach/dal_axi.h>
86#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#include <mach/qdsp5v2/mi2s.h>
88#include <mach/qdsp5v2/audio_dev_ctl.h>
89#include <mach/sdio_al.h>
90#include "smd_private.h"
91#include <linux/bma150.h>
Daniel Walker8d747cd2010-02-25 11:37:43 -080092
Justin Paupore637a25d2011-07-14 17:11:04 -070093#include "board-msm7x30-regulator.h"
94
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#define MSM_PMEM_SF_SIZE 0x1700000
96#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
97#define MSM_FB_SIZE 0x780000
98#else
99#define MSM_FB_SIZE 0x500000
100#endif
101#define MSM_PMEM_ADSP_SIZE 0x1E00000
102#define MSM_FLUID_PMEM_ADSP_SIZE 0x2800000
103#define PMEM_KERNEL_EBI0_SIZE 0x600000
104#define MSM_PMEM_AUDIO_SIZE 0x200000
Daniel Walker90e37c52010-05-12 14:24:15 -0700105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700106#define PMIC_GPIO_INT 27
107#define PMIC_VREG_WLAN_LEVEL 2900
108#define PMIC_GPIO_SD_DET 36
109#define PMIC_GPIO_SDC4_EN_N 17 /* PMIC GPIO Number 18 */
110#define PMIC_GPIO_HDMI_5V_EN_V3 32 /* PMIC GPIO for V3 H/W */
111#define PMIC_GPIO_HDMI_5V_EN_V2 39 /* PMIC GPIO for V2 H/W */
112
113#define ADV7520_I2C_ADDR 0x39
114
115#define FPGA_SDCC_STATUS 0x8E0001A8
116
117#define FPGA_OPTNAV_GPIO_ADDR 0x8E000026
118#define OPTNAV_I2C_SLAVE_ADDR (0xB0 >> 1)
119#define OPTNAV_IRQ 20
120#define OPTNAV_CHIP_SELECT 19
121
122/* Macros assume PMIC GPIOs start at 0 */
123#define PM8058_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + NR_GPIO_IRQS)
124#define PM8058_GPIO_SYS_TO_PM(sys_gpio) (sys_gpio - NR_GPIO_IRQS)
125
126#define PMIC_GPIO_FLASH_BOOST_ENABLE 15 /* PMIC GPIO Number 16 */
127#define PMIC_GPIO_HAP_ENABLE 16 /* PMIC GPIO Number 17 */
128
129#define PMIC_GPIO_WLAN_EXT_POR 22 /* PMIC GPIO NUMBER 23 */
130
131#define BMA150_GPIO_INT 1
132
133#define HAP_LVL_SHFT_MSM_GPIO 24
134
135#define PMIC_GPIO_QUICKVX_CLK 37 /* PMIC GPIO 38 */
136
137#define PM_FLIP_MPP 5 /* PMIC MPP 06 */
138static int pm8058_gpios_init(void)
139{
140 int rc;
141 int pmic_gpio_hdmi_5v_en;
142
143#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
144 struct pm8058_gpio sdcc_det = {
145 .direction = PM_GPIO_DIR_IN,
146 .pull = PM_GPIO_PULL_UP_1P5,
147 .vin_sel = 2,
148 .function = PM_GPIO_FUNC_NORMAL,
149 .inv_int_pol = 0,
150 };
151#endif
152 struct pm8058_gpio sdc4_en = {
153 .direction = PM_GPIO_DIR_OUT,
154 .pull = PM_GPIO_PULL_NO,
155 .vin_sel = PM_GPIO_VIN_L5,
156 .function = PM_GPIO_FUNC_NORMAL,
157 .inv_int_pol = 0,
158 .out_strength = PM_GPIO_STRENGTH_LOW,
159 .output_value = 0,
160 };
161
162 struct pm8058_gpio haptics_enable = {
163 .direction = PM_GPIO_DIR_OUT,
164 .pull = PM_GPIO_PULL_NO,
165 .out_strength = PM_GPIO_STRENGTH_HIGH,
166 .function = PM_GPIO_FUNC_NORMAL,
167 .inv_int_pol = 0,
168 .vin_sel = 2,
169 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
170 .output_value = 0,
171 };
172
173 struct pm8058_gpio hdmi_5V_en = {
174 .direction = PM_GPIO_DIR_OUT,
175 .pull = PM_GPIO_PULL_NO,
176 .vin_sel = PM_GPIO_VIN_VPH,
177 .function = PM_GPIO_FUNC_NORMAL,
178 .out_strength = PM_GPIO_STRENGTH_LOW,
179 .output_value = 0,
180 };
181
182 struct pm8058_gpio flash_boost_enable = {
183 .direction = PM_GPIO_DIR_OUT,
184 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
185 .output_value = 0,
186 .pull = PM_GPIO_PULL_NO,
187 .vin_sel = PM_GPIO_VIN_S3,
188 .out_strength = PM_GPIO_STRENGTH_HIGH,
189 .function = PM_GPIO_FUNC_2,
190 };
191
192 struct pm8058_gpio gpio23 = {
193 .direction = PM_GPIO_DIR_OUT,
194 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
195 .output_value = 0,
196 .pull = PM_GPIO_PULL_NO,
197 .vin_sel = 2,
198 .out_strength = PM_GPIO_STRENGTH_LOW,
199 .function = PM_GPIO_FUNC_NORMAL,
200 };
201
202
203 if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa() ||
204 machine_is_msm7x30_fluid())
205 pmic_gpio_hdmi_5v_en = PMIC_GPIO_HDMI_5V_EN_V2 ;
206 else
207 pmic_gpio_hdmi_5v_en = PMIC_GPIO_HDMI_5V_EN_V3 ;
208
209 if (machine_is_msm7x30_fluid()) {
210 rc = pm8058_gpio_config(PMIC_GPIO_HAP_ENABLE, &haptics_enable);
211 if (rc) {
212 pr_err("%s: PMIC GPIO %d write failed\n", __func__,
213 (PMIC_GPIO_HAP_ENABLE + 1));
214 return rc;
215 }
216 rc = pm8058_gpio_config(PMIC_GPIO_FLASH_BOOST_ENABLE,
217 &flash_boost_enable);
218 if (rc) {
219 pr_err("%s: PMIC GPIO %d write failed\n", __func__,
220 (PMIC_GPIO_FLASH_BOOST_ENABLE + 1));
221 return rc;
222 }
223 }
224
225#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
226 if (machine_is_msm7x30_fluid())
227 sdcc_det.inv_int_pol = 1;
228
229 rc = pm8058_gpio_config(PMIC_GPIO_SD_DET - 1, &sdcc_det);
230 if (rc) {
231 pr_err("%s PMIC_GPIO_SD_DET config failed\n", __func__);
232 return rc;
233 }
234#endif
235
236 rc = pm8058_gpio_config(pmic_gpio_hdmi_5v_en, &hdmi_5V_en);
237 if (rc) {
238 pr_err("%s PMIC_GPIO_HDMI_5V_EN config failed\n", __func__);
239 return rc;
240 }
241
242 /* Deassert GPIO#23 (source for Ext_POR on WLAN-Volans) */
243 rc = pm8058_gpio_config(PMIC_GPIO_WLAN_EXT_POR, &gpio23);
244 if (rc) {
245 pr_err("%s PMIC_GPIO_WLAN_EXT_POR config failed\n", __func__);
246 return rc;
247 }
248
249 if (machine_is_msm7x30_fluid()) {
250 rc = pm8058_gpio_config(PMIC_GPIO_SDC4_EN_N, &sdc4_en);
251 if (rc) {
252 pr_err("%s PMIC_GPIO_SDC4_EN_N config failed\n",
253 __func__);
254 return rc;
255 }
256 rc = gpio_request(PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_EN_N),
257 "sdc4_en");
258 if (rc) {
259 pr_err("%s PMIC_GPIO_SDC4_EN_N gpio_request failed\n",
260 __func__);
261 return rc;
262 }
263 gpio_set_value_cansleep(
264 PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_EN_N), 0);
265 }
266
267 return 0;
268}
269
Justin Paupore637a25d2011-07-14 17:11:04 -0700270/* Regulator API support */
271
272#ifdef CONFIG_MSM_PROC_COMM_REGULATOR
273static struct platform_device msm_proccomm_regulator_dev = {
274 .name = PROCCOMM_REGULATOR_DEV_NAME,
275 .id = -1,
276 .dev = {
277 .platform_data = &msm7x30_proccomm_regulator_data
278 }
279};
280#endif
281
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282/*virtual key support */
283static ssize_t tma300_vkeys_show(struct kobject *kobj,
284 struct kobj_attribute *attr, char *buf)
285{
286 return sprintf(buf,
287 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":50:842:80:100"
288 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":170:842:80:100"
289 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":290:842:80:100"
290 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":410:842:80:100"
291 "\n");
292}
293
294static struct kobj_attribute tma300_vkeys_attr = {
295 .attr = {
296 .mode = S_IRUGO,
297 },
298 .show = &tma300_vkeys_show,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530299};
300
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301static struct attribute *tma300_properties_attrs[] = {
302 &tma300_vkeys_attr.attr,
303 NULL
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530304};
305
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306static struct attribute_group tma300_properties_attr_group = {
307 .attrs = tma300_properties_attrs,
308};
309
310static struct kobject *properties_kobj;
311
312#define CYTTSP_TS_GPIO_IRQ 150
313static int cyttsp_platform_init(struct i2c_client *client)
314{
315 int rc = -EINVAL;
316 struct vreg *vreg_ldo8, *vreg_ldo15;
317
318 vreg_ldo8 = vreg_get(NULL, "gp7");
319
320 if (!vreg_ldo8) {
321 pr_err("%s: VREG L8 get failed\n", __func__);
322 return rc;
323 }
324
325 rc = vreg_set_level(vreg_ldo8, 1800);
326 if (rc) {
327 pr_err("%s: VREG L8 set failed\n", __func__);
328 goto l8_put;
329 }
330
331 rc = vreg_enable(vreg_ldo8);
332 if (rc) {
333 pr_err("%s: VREG L8 enable failed\n", __func__);
334 goto l8_put;
335 }
336
337 vreg_ldo15 = vreg_get(NULL, "gp6");
338
339 if (!vreg_ldo15) {
340 pr_err("%s: VREG L15 get failed\n", __func__);
341 goto l8_disable;
342 }
343
344 rc = vreg_set_level(vreg_ldo15, 3050);
345 if (rc) {
346 pr_err("%s: VREG L15 set failed\n", __func__);
347 goto l8_disable;
348 }
349
350 rc = vreg_enable(vreg_ldo15);
351 if (rc) {
352 pr_err("%s: VREG L15 enable failed\n", __func__);
353 goto l8_disable;
354 }
355
356 /* check this device active by reading first byte/register */
357 rc = i2c_smbus_read_byte_data(client, 0x01);
358 if (rc < 0) {
359 pr_err("%s: i2c sanity check failed\n", __func__);
360 goto l8_disable;
361 }
362
363 rc = gpio_tlmm_config(GPIO_CFG(CYTTSP_TS_GPIO_IRQ, 0, GPIO_CFG_INPUT,
364 GPIO_CFG_PULL_UP, GPIO_CFG_6MA), GPIO_CFG_ENABLE);
365 if (rc) {
366 pr_err("%s: Could not configure gpio %d\n",
367 __func__, CYTTSP_TS_GPIO_IRQ);
368 goto l8_disable;
369 }
370
371 /* virtual keys */
372 tma300_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
373 properties_kobj = kobject_create_and_add("board_properties",
374 NULL);
375 if (properties_kobj)
376 rc = sysfs_create_group(properties_kobj,
377 &tma300_properties_attr_group);
378 if (!properties_kobj || rc)
379 pr_err("%s: failed to create board_properties\n",
380 __func__);
381
382 return CY_OK;
383
384l8_disable:
385 vreg_disable(vreg_ldo8);
386l8_put:
387 vreg_put(vreg_ldo8);
388 return rc;
389}
390
391static int cyttsp_platform_resume(struct i2c_client *client)
392{
393 /* add any special code to strobe a wakeup pin or chip reset */
394 mdelay(10);
395
396 return CY_OK;
397}
398
399static struct cyttsp_platform_data cyttsp_data = {
400 .fw_fname = "cyttsp_7630_fluid.hex",
401 .panel_maxx = 479,
402 .panel_maxy = 799,
403 .disp_maxx = 469,
404 .disp_maxy = 799,
405 .disp_minx = 10,
406 .disp_miny = 0,
407 .flags = 0,
408 .gen = CY_GEN3, /* or */
409 .use_st = CY_USE_ST,
410 .use_mt = CY_USE_MT,
411 .use_hndshk = CY_SEND_HNDSHK,
412 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayal15187772011-06-22 17:39:41 +0530413 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414 .use_gestures = CY_USE_GESTURES,
415 /* activate up to 4 groups
416 * and set active distance
417 */
418 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
419 CY_GEST_GRP3 | CY_GEST_GRP4 |
420 CY_ACT_DIST,
421 /* change act_intrvl to customize the Active power state
422 * scanning/processing refresh interval for Operating mode
423 */
424 .act_intrvl = CY_ACT_INTRVL_DFLT,
425 /* change tch_tmout to customize the touch timeout for the
426 * Active power state for Operating mode
427 */
428 .tch_tmout = CY_TCH_TMOUT_DFLT,
429 /* change lp_intrvl to customize the Low Power power state
430 * scanning/processing refresh interval for Operating mode
431 */
432 .lp_intrvl = CY_LP_INTRVL_DFLT,
433 .resume = cyttsp_platform_resume,
434 .init = cyttsp_platform_init,
435 .sleep_gpio = -1,
436 .resout_gpio = -1,
437 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
Mohan Pallaka49c37d62011-08-01 11:52:00 +0530438 .correct_fw_ver = 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700439};
440
441static int pm8058_pwm_config(struct pwm_device *pwm, int ch, int on)
442{
443 struct pm8058_gpio pwm_gpio_config = {
444 .direction = PM_GPIO_DIR_OUT,
445 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
446 .output_value = 0,
447 .pull = PM_GPIO_PULL_NO,
448 .vin_sel = PM_GPIO_VIN_S3,
449 .out_strength = PM_GPIO_STRENGTH_HIGH,
450 .function = PM_GPIO_FUNC_2,
451 };
452 int rc = -EINVAL;
453 int id, mode, max_mA;
454
455 id = mode = max_mA = 0;
456 switch (ch) {
457 case 0:
458 case 1:
459 case 2:
460 if (on) {
461 id = 24 + ch;
462 rc = pm8058_gpio_config(id - 1, &pwm_gpio_config);
463 if (rc)
464 pr_err("%s: pm8058_gpio_config(%d): rc=%d\n",
465 __func__, id, rc);
466 }
467 break;
468
469 case 3:
470 id = PM_PWM_LED_KPD;
471 mode = PM_PWM_CONF_DTEST3;
472 max_mA = 200;
473 break;
474
475 case 4:
476 id = PM_PWM_LED_0;
477 mode = PM_PWM_CONF_PWM1;
478 max_mA = 40;
479 break;
480
481 case 5:
482 id = PM_PWM_LED_2;
483 mode = PM_PWM_CONF_PWM2;
484 max_mA = 40;
485 break;
486
487 case 6:
488 id = PM_PWM_LED_FLASH;
489 mode = PM_PWM_CONF_DTEST3;
490 max_mA = 200;
491 break;
492
493 default:
494 break;
495 }
496
497 if (ch >= 3 && ch <= 6) {
498 if (!on) {
499 mode = PM_PWM_CONF_NONE;
500 max_mA = 0;
501 }
502 rc = pm8058_pwm_config_led(pwm, id, mode, max_mA);
503 if (rc)
504 pr_err("%s: pm8058_pwm_config_led(ch=%d): rc=%d\n",
505 __func__, ch, rc);
506 }
507
508 return rc;
509}
510
511static int pm8058_pwm_enable(struct pwm_device *pwm, int ch, int on)
512{
513 int rc;
514
515 switch (ch) {
516 case 7:
517 rc = pm8058_pwm_set_dtest(pwm, on);
518 if (rc)
519 pr_err("%s: pwm_set_dtest(%d): rc=%d\n",
520 __func__, on, rc);
521 break;
522 default:
523 rc = -EINVAL;
524 break;
525 }
526 return rc;
527}
528
529static const unsigned int fluid_keymap[] = {
530 KEY(0, 0, KEY_7),
531 KEY(0, 1, KEY_ENTER),
532 KEY(0, 2, KEY_UP),
533 /* drop (0,3) as it always shows up in pair with(0,2) */
534 KEY(0, 4, KEY_DOWN),
535
536 KEY(1, 0, KEY_CAMERA_SNAPSHOT),
537 KEY(1, 1, KEY_SELECT),
538 KEY(1, 2, KEY_1),
539 KEY(1, 3, KEY_VOLUMEUP),
540 KEY(1, 4, KEY_VOLUMEDOWN),
541};
542
543static const unsigned int surf_keymap[] = {
544 KEY(0, 0, KEY_7),
545 KEY(0, 1, KEY_DOWN),
546 KEY(0, 2, KEY_UP),
547 KEY(0, 3, KEY_RIGHT),
548 KEY(0, 4, KEY_ENTER),
549 KEY(0, 5, KEY_L),
550 KEY(0, 6, KEY_BACK),
551 KEY(0, 7, KEY_M),
552
553 KEY(1, 0, KEY_LEFT),
554 KEY(1, 1, KEY_SEND),
555 KEY(1, 2, KEY_1),
556 KEY(1, 3, KEY_4),
557 KEY(1, 4, KEY_CLEAR),
558 KEY(1, 5, KEY_MSDOS),
559 KEY(1, 6, KEY_SPACE),
560 KEY(1, 7, KEY_COMMA),
561
562 KEY(2, 0, KEY_6),
563 KEY(2, 1, KEY_5),
564 KEY(2, 2, KEY_8),
565 KEY(2, 3, KEY_3),
566 KEY(2, 4, KEY_NUMERIC_STAR),
567 KEY(2, 5, KEY_UP),
568 KEY(2, 6, KEY_DOWN), /* SYN */
569 KEY(2, 7, KEY_LEFTSHIFT),
570
571 KEY(3, 0, KEY_9),
572 KEY(3, 1, KEY_NUMERIC_POUND),
573 KEY(3, 2, KEY_0),
574 KEY(3, 3, KEY_2),
575 KEY(3, 4, KEY_SLEEP),
576 KEY(3, 5, KEY_F1),
577 KEY(3, 6, KEY_F2),
578 KEY(3, 7, KEY_F3),
579
580 KEY(4, 0, KEY_BACK),
581 KEY(4, 1, KEY_HOME),
582 KEY(4, 2, KEY_MENU),
583 KEY(4, 3, KEY_VOLUMEUP),
584 KEY(4, 4, KEY_VOLUMEDOWN),
585 KEY(4, 5, KEY_F4),
586 KEY(4, 6, KEY_F5),
587 KEY(4, 7, KEY_F6),
588
589 KEY(5, 0, KEY_R),
590 KEY(5, 1, KEY_T),
591 KEY(5, 2, KEY_Y),
592 KEY(5, 3, KEY_LEFTALT),
593 KEY(5, 4, KEY_KPENTER),
594 KEY(5, 5, KEY_Q),
595 KEY(5, 6, KEY_W),
596 KEY(5, 7, KEY_E),
597
598 KEY(6, 0, KEY_F),
599 KEY(6, 1, KEY_G),
600 KEY(6, 2, KEY_H),
601 KEY(6, 3, KEY_CAPSLOCK),
602 KEY(6, 4, KEY_PAGEUP),
603 KEY(6, 5, KEY_A),
604 KEY(6, 6, KEY_S),
605 KEY(6, 7, KEY_D),
606
607 KEY(7, 0, KEY_V),
608 KEY(7, 1, KEY_B),
609 KEY(7, 2, KEY_N),
610 KEY(7, 3, KEY_MENU), /* REVISIT - SYM */
611 KEY(7, 4, KEY_PAGEDOWN),
612 KEY(7, 5, KEY_Z),
613 KEY(7, 6, KEY_X),
614 KEY(7, 7, KEY_C),
615
616 KEY(8, 0, KEY_P),
617 KEY(8, 1, KEY_J),
618 KEY(8, 2, KEY_K),
619 KEY(8, 3, KEY_INSERT),
620 KEY(8, 4, KEY_LINEFEED),
621 KEY(8, 5, KEY_U),
622 KEY(8, 6, KEY_I),
623 KEY(8, 7, KEY_O),
624
625 KEY(9, 0, KEY_4),
626 KEY(9, 1, KEY_5),
627 KEY(9, 2, KEY_6),
628 KEY(9, 3, KEY_7),
629 KEY(9, 4, KEY_8),
630 KEY(9, 5, KEY_1),
631 KEY(9, 6, KEY_2),
632 KEY(9, 7, KEY_3),
633
634 KEY(10, 0, KEY_F7),
635 KEY(10, 1, KEY_F8),
636 KEY(10, 2, KEY_F9),
637 KEY(10, 3, KEY_F10),
638 KEY(10, 4, KEY_FN),
639 KEY(10, 5, KEY_9),
640 KEY(10, 6, KEY_0),
641 KEY(10, 7, KEY_DOT),
642
643 KEY(11, 0, KEY_LEFTCTRL),
644 KEY(11, 1, KEY_F11), /* START */
645 KEY(11, 2, KEY_ENTER),
646 KEY(11, 3, KEY_SEARCH),
647 KEY(11, 4, KEY_DELETE),
648 KEY(11, 5, KEY_RIGHT),
649 KEY(11, 6, KEY_LEFT),
650 KEY(11, 7, KEY_RIGHTSHIFT),
651};
652
653static struct resource resources_keypad[] = {
654 {
655 .start = PM8058_KEYPAD_IRQ(PMIC8058_IRQ_BASE),
656 .end = PM8058_KEYPAD_IRQ(PMIC8058_IRQ_BASE),
657 .flags = IORESOURCE_IRQ,
Dima Zavinba5499e2011-01-10 11:00:30 -0800658 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700659 {
660 .start = PM8058_KEYSTUCK_IRQ(PMIC8058_IRQ_BASE),
661 .end = PM8058_KEYSTUCK_IRQ(PMIC8058_IRQ_BASE),
662 .flags = IORESOURCE_IRQ,
Dima Zavinba5499e2011-01-10 11:00:30 -0800663 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700664};
665
666static struct matrix_keymap_data surf_keymap_data = {
667 .keymap_size = ARRAY_SIZE(surf_keymap),
668 .keymap = surf_keymap,
669};
670
671
672static struct pmic8058_keypad_data surf_keypad_data = {
673 .input_name = "surf_keypad",
674 .input_phys_device = "surf_keypad/input0",
675 .num_rows = 12,
676 .num_cols = 8,
677 .rows_gpio_start = 8,
678 .cols_gpio_start = 0,
679 .debounce_ms = {8, 10},
680 .scan_delay_ms = 32,
681 .row_hold_ns = 91500,
682 .wakeup = 1,
683 .keymap_data = &surf_keymap_data,
684};
685
686static struct matrix_keymap_data fluid_keymap_data = {
687 .keymap_size = ARRAY_SIZE(fluid_keymap),
688 .keymap = fluid_keymap,
689};
690
691
692
693static struct pmic8058_keypad_data fluid_keypad_data = {
694 .input_name = "fluid-keypad",
695 .input_phys_device = "fluid-keypad/input0",
696 .num_rows = 5,
697 .num_cols = 5,
698 .rows_gpio_start = 8,
699 .cols_gpio_start = 0,
700 .debounce_ms = {8, 10},
701 .scan_delay_ms = 32,
702 .row_hold_ns = 91500,
703 .wakeup = 1,
704 .keymap_data = &fluid_keymap_data,
705};
706
707static struct pm8058_pwm_pdata pm8058_pwm_data = {
708 .config = pm8058_pwm_config,
709 .enable = pm8058_pwm_enable,
710};
711
712/* Put sub devices with fixed location first in sub_devices array */
713#define PM8058_SUBDEV_KPD 0
714#define PM8058_SUBDEV_LED 1
715
716static struct pm8058_gpio_platform_data pm8058_gpio_data = {
717 .gpio_base = PM8058_GPIO_PM_TO_SYS(0),
718 .irq_base = PM8058_GPIO_IRQ(PMIC8058_IRQ_BASE, 0),
719 .init = pm8058_gpios_init,
720};
721
722static struct pm8058_gpio_platform_data pm8058_mpp_data = {
723 .gpio_base = PM8058_GPIO_PM_TO_SYS(PM8058_GPIOS),
724 .irq_base = PM8058_MPP_IRQ(PMIC8058_IRQ_BASE, 0),
725};
726
727static struct pmic8058_led pmic8058_ffa_leds[] = {
728 [0] = {
729 .name = "keyboard-backlight",
730 .max_brightness = 15,
731 .id = PMIC8058_ID_LED_KB_LIGHT,
Dima Zavinba5499e2011-01-10 11:00:30 -0800732 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700733};
734
735static struct pmic8058_leds_platform_data pm8058_ffa_leds_data = {
736 .num_leds = ARRAY_SIZE(pmic8058_ffa_leds),
737 .leds = pmic8058_ffa_leds,
738};
739
740static struct pmic8058_led pmic8058_surf_leds[] = {
741 [0] = {
742 .name = "keyboard-backlight",
743 .max_brightness = 15,
744 .id = PMIC8058_ID_LED_KB_LIGHT,
745 },
746 [1] = {
747 .name = "voice:red",
748 .max_brightness = 20,
749 .id = PMIC8058_ID_LED_0,
750 },
751 [2] = {
752 .name = "wlan:green",
753 .max_brightness = 20,
754 .id = PMIC8058_ID_LED_2,
755 },
756};
757
758static struct mfd_cell pm8058_subdevs[] = {
759 { .name = "pm8058-keypad",
760 .id = -1,
761 .num_resources = ARRAY_SIZE(resources_keypad),
762 .resources = resources_keypad,
763 },
764 { .name = "pm8058-led",
765 .id = -1,
766 },
767 { .name = "pm8058-gpio",
768 .id = -1,
769 .platform_data = &pm8058_gpio_data,
770 .pdata_size = sizeof(pm8058_gpio_data),
771 },
772 { .name = "pm8058-mpp",
773 .id = -1,
774 .platform_data = &pm8058_mpp_data,
775 .pdata_size = sizeof(pm8058_mpp_data),
776 },
777 { .name = "pm8058-pwm",
778 .id = -1,
779 .platform_data = &pm8058_pwm_data,
780 .pdata_size = sizeof(pm8058_pwm_data),
781 },
782 { .name = "pm8058-nfc",
783 .id = -1,
784 },
785 { .name = "pm8058-upl",
786 .id = -1,
787 },
788};
789
790static struct pmic8058_leds_platform_data pm8058_surf_leds_data = {
791 .num_leds = ARRAY_SIZE(pmic8058_surf_leds),
792 .leds = pmic8058_surf_leds,
793};
794
795static struct pmic8058_led pmic8058_fluid_leds[] = {
796 [0] = {
797 .name = "keyboard-backlight",
798 .max_brightness = 15,
799 .id = PMIC8058_ID_LED_KB_LIGHT,
800 },
801 [1] = {
802 .name = "flash:led_0",
803 .max_brightness = 15,
804 .id = PMIC8058_ID_FLASH_LED_0,
805 },
806 [2] = {
807 .name = "flash:led_1",
808 .max_brightness = 15,
809 .id = PMIC8058_ID_FLASH_LED_1,
810 },
811};
812
813static struct pmic8058_leds_platform_data pm8058_fluid_leds_data = {
814 .num_leds = ARRAY_SIZE(pmic8058_fluid_leds),
815 .leds = pmic8058_fluid_leds,
816};
817
818static struct pm8058_platform_data pm8058_7x30_data = {
819 .irq_base = PMIC8058_IRQ_BASE,
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +0530820 .irq = MSM_GPIO_TO_INT(PMIC_GPIO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821
822 .num_subdevs = ARRAY_SIZE(pm8058_subdevs),
823 .sub_devices = pm8058_subdevs,
824 .irq_trigger_flags = IRQF_TRIGGER_LOW,
825};
826
827static struct i2c_board_info pm8058_boardinfo[] __initdata = {
828 {
829 I2C_BOARD_INFO("pm8058-core", 0x55),
830 .irq = MSM_GPIO_TO_INT(PMIC_GPIO_INT),
831 .platform_data = &pm8058_7x30_data,
832 },
833};
834
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +0530835#ifdef CONFIG_MSM_SSBI
836static struct msm_ssbi_platform_data msm7x30_ssbi_pm8058_pdata = {
837 .controller_type = MSM_SBI_CTRL_SSBI2,
838 .slave = {
839 .name = "pm8058-core",
840 .platform_data = &pm8058_7x30_data,
841 },
842};
843#endif
844
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845static struct i2c_board_info cy8info[] __initdata = {
846 {
847 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
848 .platform_data = &cyttsp_data,
849#ifndef CY_USE_TIMER
850 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
851#endif /* CY_USE_TIMER */
852 },
853};
854
855static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
856#ifdef CONFIG_MT9D112
857 {
858 I2C_BOARD_INFO("mt9d112", 0x78 >> 1),
Dima Zavinba5499e2011-01-10 11:00:30 -0800859 },
860#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861#ifdef CONFIG_WEBCAM_OV9726
862 {
863 I2C_BOARD_INFO("ov9726", 0x10),
864 },
865#endif
866#ifdef CONFIG_S5K3E2FX
867 {
868 I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1),
869 },
870#endif
871#ifdef CONFIG_MT9P012
872 {
873 I2C_BOARD_INFO("mt9p012", 0x6C >> 1),
874 },
875#endif
876#ifdef CONFIG_VX6953
877 {
878 I2C_BOARD_INFO("vx6953", 0x20),
879 },
880#endif
881#ifdef CONFIG_MT9E013
882 {
883 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
884 },
885#endif
886#ifdef CONFIG_SN12M0PZ
887 {
888 I2C_BOARD_INFO("sn12m0pz", 0x34 >> 1),
889 },
890#endif
891#if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013)
892 {
893 I2C_BOARD_INFO("mt9t013", 0x6C),
894 },
895#endif
896
Dima Zavinba5499e2011-01-10 11:00:30 -0800897};
898
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899#ifdef CONFIG_MSM_CAMERA
900#define CAM_STNDBY 143
901static uint32_t camera_off_vcm_gpio_table[] = {
902GPIO_CFG(1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VCM */
903};
904
905static uint32_t camera_off_gpio_table[] = {
906 /* parallel CAMERA interfaces */
907 GPIO_CFG(0, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* RST */
908 GPIO_CFG(2, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT2 */
909 GPIO_CFG(3, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT3 */
910 GPIO_CFG(4, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT4 */
911 GPIO_CFG(5, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT5 */
912 GPIO_CFG(6, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT6 */
913 GPIO_CFG(7, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT7 */
914 GPIO_CFG(8, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT8 */
915 GPIO_CFG(9, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT9 */
916 GPIO_CFG(10, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT10 */
917 GPIO_CFG(11, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT11 */
918 GPIO_CFG(12, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* PCLK */
919 GPIO_CFG(13, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* HSYNC_IN */
920 GPIO_CFG(14, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VSYNC_IN */
921 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* MCLK */
922};
923
924static uint32_t camera_on_vcm_gpio_table[] = {
925GPIO_CFG(1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), /* VCM */
926};
927
928static uint32_t camera_on_gpio_table[] = {
929 /* parallel CAMERA interfaces */
930 GPIO_CFG(0, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* RST */
931 GPIO_CFG(2, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT2 */
932 GPIO_CFG(3, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT3 */
933 GPIO_CFG(4, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT4 */
934 GPIO_CFG(5, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT5 */
935 GPIO_CFG(6, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT6 */
936 GPIO_CFG(7, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT7 */
937 GPIO_CFG(8, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT8 */
938 GPIO_CFG(9, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT9 */
939 GPIO_CFG(10, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT10 */
940 GPIO_CFG(11, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* DAT11 */
941 GPIO_CFG(12, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* PCLK */
942 GPIO_CFG(13, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* HSYNC_IN */
943 GPIO_CFG(14, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), /* VSYNC_IN */
944 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* MCLK */
945};
946
947static uint32_t camera_off_gpio_fluid_table[] = {
948 /* FLUID: CAM_VGA_RST_N */
949 GPIO_CFG(31, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
950 /* FLUID: CAMIF_STANDBY */
951 GPIO_CFG(CAM_STNDBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA)
952};
953
954static uint32_t camera_on_gpio_fluid_table[] = {
955 /* FLUID: CAM_VGA_RST_N */
956 GPIO_CFG(31, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
957 /* FLUID: CAMIF_STANDBY */
958 GPIO_CFG(CAM_STNDBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA)
959};
960
961static void config_gpio_table(uint32_t *table, int len)
962{
963 int n, rc;
964 for (n = 0; n < len; n++) {
965 rc = gpio_tlmm_config(table[n], GPIO_CFG_ENABLE);
966 if (rc) {
967 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
968 __func__, table[n], rc);
969 break;
970 }
971 }
972}
973static int config_camera_on_gpios(void)
974{
975 config_gpio_table(camera_on_gpio_table,
976 ARRAY_SIZE(camera_on_gpio_table));
977
978 if (adie_get_detected_codec_type() != TIMPANI_ID)
979 /* GPIO1 is shared also used in Timpani RF card so
980 only configure it for non-Timpani RF card */
981 config_gpio_table(camera_on_vcm_gpio_table,
982 ARRAY_SIZE(camera_on_vcm_gpio_table));
983
984 if (machine_is_msm7x30_fluid()) {
985 config_gpio_table(camera_on_gpio_fluid_table,
986 ARRAY_SIZE(camera_on_gpio_fluid_table));
987 /* FLUID: turn on 5V booster */
988 gpio_set_value(
989 PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_FLASH_BOOST_ENABLE), 1);
990 /* FLUID: drive high to put secondary sensor to STANDBY */
991 gpio_set_value(CAM_STNDBY, 1);
992 }
993 return 0;
994}
995
996static void config_camera_off_gpios(void)
997{
998 config_gpio_table(camera_off_gpio_table,
999 ARRAY_SIZE(camera_off_gpio_table));
1000
1001 if (adie_get_detected_codec_type() != TIMPANI_ID)
1002 /* GPIO1 is shared also used in Timpani RF card so
1003 only configure it for non-Timpani RF card */
1004 config_gpio_table(camera_off_vcm_gpio_table,
1005 ARRAY_SIZE(camera_off_vcm_gpio_table));
1006
1007 if (machine_is_msm7x30_fluid()) {
1008 config_gpio_table(camera_off_gpio_fluid_table,
1009 ARRAY_SIZE(camera_off_gpio_fluid_table));
1010 /* FLUID: turn off 5V booster */
1011 gpio_set_value(
1012 PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_FLASH_BOOST_ENABLE), 0);
1013 }
1014}
1015
1016struct resource msm_camera_resources[] = {
1017 {
1018 .start = 0xA6000000,
1019 .end = 0xA6000000 + SZ_1M - 1,
1020 .flags = IORESOURCE_MEM,
1021 },
1022 {
1023 .start = INT_VFE,
1024 .end = INT_VFE,
1025 .flags = IORESOURCE_IRQ,
1026 },
1027 {
1028 .flags = IORESOURCE_DMA,
1029 }
1030};
1031
1032struct msm_camera_device_platform_data msm_camera_device_data = {
1033 .camera_gpio_on = config_camera_on_gpios,
1034 .camera_gpio_off = config_camera_off_gpios,
1035 .ioext.camifpadphy = 0xAB000000,
1036 .ioext.camifpadsz = 0x00000400,
1037 .ioext.csiphy = 0xA6100000,
1038 .ioext.csisz = 0x00000400,
1039 .ioext.csiirq = INT_CSI,
1040 .ioclk.mclk_clk_rate = 24000000,
1041 .ioclk.vfe_clk_rate = 147456000,
1042};
1043
1044static struct msm_camera_sensor_flash_src msm_flash_src_pwm = {
1045 .flash_sr_type = MSM_CAMERA_FLASH_SRC_PWM,
1046 ._fsrc.pwm_src.freq = 1000,
1047 ._fsrc.pwm_src.max_load = 300,
1048 ._fsrc.pwm_src.low_load = 30,
1049 ._fsrc.pwm_src.high_load = 100,
1050 ._fsrc.pwm_src.channel = 7,
1051};
1052
1053#ifdef CONFIG_MT9D112
1054static struct msm_camera_sensor_flash_data flash_mt9d112 = {
1055 .flash_type = MSM_CAMERA_FLASH_LED,
1056 .flash_src = &msm_flash_src_pwm
1057};
1058
1059static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = {
1060 .sensor_name = "mt9d112",
1061 .sensor_reset = 0,
1062 .sensor_pwd = 85,
1063 .vcm_pwd = 1,
1064 .vcm_enable = 0,
1065 .pdata = &msm_camera_device_data,
1066 .resource = msm_camera_resources,
1067 .num_resources = ARRAY_SIZE(msm_camera_resources),
1068 .flash_data = &flash_mt9d112,
1069 .csi_if = 0
1070};
1071
1072static struct platform_device msm_camera_sensor_mt9d112 = {
1073 .name = "msm_camera_mt9d112",
1074 .dev = {
1075 .platform_data = &msm_camera_sensor_mt9d112_data,
1076 },
1077};
1078#endif
1079
1080#ifdef CONFIG_WEBCAM_OV9726
1081
1082static struct msm_camera_sensor_platform_info ov9726_sensor_7630_info = {
1083 .mount_angle = 90
1084};
1085
1086static struct msm_camera_sensor_flash_data flash_ov9726 = {
1087 .flash_type = MSM_CAMERA_FLASH_LED,
1088 .flash_src = &msm_flash_src_pwm
1089};
1090static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
1091 .sensor_name = "ov9726",
1092 .sensor_reset = 0,
1093 .sensor_pwd = 85,
1094 .vcm_pwd = 1,
1095 .vcm_enable = 0,
1096 .pdata = &msm_camera_device_data,
1097 .resource = msm_camera_resources,
1098 .num_resources = ARRAY_SIZE(msm_camera_resources),
1099 .flash_data = &flash_ov9726,
1100 .sensor_platform_info = &ov9726_sensor_7630_info,
1101 .csi_if = 1
1102};
1103struct platform_device msm_camera_sensor_ov9726 = {
1104 .name = "msm_camera_ov9726",
1105 .dev = {
1106 .platform_data = &msm_camera_sensor_ov9726_data,
1107 },
1108};
1109#endif
1110
1111#ifdef CONFIG_S5K3E2FX
1112static struct msm_camera_sensor_flash_data flash_s5k3e2fx = {
1113 .flash_type = MSM_CAMERA_FLASH_LED,
1114 .flash_src = &msm_flash_src_pwm,
1115};
1116
1117static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = {
1118 .sensor_name = "s5k3e2fx",
1119 .sensor_reset = 0,
1120 .sensor_pwd = 85,
1121 .vcm_pwd = 1,
1122 .vcm_enable = 0,
1123 .pdata = &msm_camera_device_data,
1124 .resource = msm_camera_resources,
1125 .num_resources = ARRAY_SIZE(msm_camera_resources),
1126 .flash_data = &flash_s5k3e2fx,
1127 .csi_if = 0
1128};
1129
1130static struct platform_device msm_camera_sensor_s5k3e2fx = {
1131 .name = "msm_camera_s5k3e2fx",
1132 .dev = {
1133 .platform_data = &msm_camera_sensor_s5k3e2fx_data,
1134 },
1135};
1136#endif
1137
1138#ifdef CONFIG_MT9P012
1139static struct msm_camera_sensor_flash_data flash_mt9p012 = {
1140 .flash_type = MSM_CAMERA_FLASH_LED,
1141 .flash_src = &msm_flash_src_pwm
1142};
1143
1144static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = {
1145 .sensor_name = "mt9p012",
1146 .sensor_reset = 0,
1147 .sensor_pwd = 85,
1148 .vcm_pwd = 1,
1149 .vcm_enable = 1,
1150 .pdata = &msm_camera_device_data,
1151 .resource = msm_camera_resources,
1152 .num_resources = ARRAY_SIZE(msm_camera_resources),
1153 .flash_data = &flash_mt9p012,
1154 .csi_if = 0
1155};
1156
1157static struct platform_device msm_camera_sensor_mt9p012 = {
1158 .name = "msm_camera_mt9p012",
1159 .dev = {
1160 .platform_data = &msm_camera_sensor_mt9p012_data,
1161 },
1162};
1163#endif
1164
1165#ifdef CONFIG_MT9E013
1166static struct msm_camera_sensor_platform_info mt9e013_sensor_7630_info = {
1167 .mount_angle = 0
1168};
1169
1170static struct msm_camera_sensor_flash_data flash_mt9e013 = {
1171 .flash_type = MSM_CAMERA_FLASH_LED,
1172 .flash_src = &msm_flash_src_pwm
1173};
1174
1175static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
1176 .sensor_name = "mt9e013",
1177 .sensor_reset = 0,
1178 .sensor_pwd = 85,
1179 .vcm_pwd = 1,
1180 .vcm_enable = 1,
1181 .pdata = &msm_camera_device_data,
1182 .resource = msm_camera_resources,
1183 .num_resources = ARRAY_SIZE(msm_camera_resources),
1184 .flash_data = &flash_mt9e013,
1185 .sensor_platform_info = &mt9e013_sensor_7630_info,
1186 .csi_if = 1
1187};
1188
1189static struct platform_device msm_camera_sensor_mt9e013 = {
1190 .name = "msm_camera_mt9e013",
1191 .dev = {
1192 .platform_data = &msm_camera_sensor_mt9e013_data,
1193 },
1194};
1195#endif
1196
1197#ifdef CONFIG_VX6953
Jilai Wang971f97f2011-07-13 14:25:25 -04001198static struct msm_camera_sensor_platform_info vx6953_sensor_7630_info = {
1199 .mount_angle = 0
1200};
1201
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001202static struct msm_camera_sensor_flash_data flash_vx6953 = {
1203 .flash_type = MSM_CAMERA_FLASH_LED,
1204 .flash_src = &msm_flash_src_pwm
1205};
1206static struct msm_camera_sensor_info msm_camera_sensor_vx6953_data = {
1207 .sensor_name = "vx6953",
1208 .sensor_reset = 0,
1209 .sensor_pwd = 85,
1210 .vcm_pwd = 1,
1211 .vcm_enable = 0,
1212 .pdata = &msm_camera_device_data,
1213 .resource = msm_camera_resources,
1214 .num_resources = ARRAY_SIZE(msm_camera_resources),
Jilai Wang971f97f2011-07-13 14:25:25 -04001215 .sensor_platform_info = &vx6953_sensor_7630_info,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001216 .flash_data = &flash_vx6953,
1217 .csi_if = 1
1218};
1219static struct platform_device msm_camera_sensor_vx6953 = {
1220 .name = "msm_camera_vx6953",
1221 .dev = {
1222 .platform_data = &msm_camera_sensor_vx6953_data,
1223 },
1224};
1225#endif
1226
1227#ifdef CONFIG_SN12M0PZ
1228static struct msm_camera_sensor_flash_src msm_flash_src_current_driver = {
1229 .flash_sr_type = MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER,
1230 ._fsrc.current_driver_src.low_current = 210,
1231 ._fsrc.current_driver_src.high_current = 700,
1232 ._fsrc.current_driver_src.driver_channel = &pm8058_fluid_leds_data,
1233};
1234
1235static struct msm_camera_sensor_flash_data flash_sn12m0pz = {
1236 .flash_type = MSM_CAMERA_FLASH_LED,
1237 .flash_src = &msm_flash_src_current_driver
1238};
1239static struct msm_camera_sensor_info msm_camera_sensor_sn12m0pz_data = {
1240 .sensor_name = "sn12m0pz",
1241 .sensor_reset = 0,
1242 .sensor_pwd = 85,
1243 .vcm_pwd = 1,
1244 .vcm_enable = 1,
1245 .pdata = &msm_camera_device_data,
1246 .flash_data = &flash_sn12m0pz,
1247 .resource = msm_camera_resources,
1248 .num_resources = ARRAY_SIZE(msm_camera_resources),
1249 .csi_if = 0
1250};
1251
1252static struct platform_device msm_camera_sensor_sn12m0pz = {
1253 .name = "msm_camera_sn12m0pz",
1254 .dev = {
1255 .platform_data = &msm_camera_sensor_sn12m0pz_data,
1256 },
1257};
1258#endif
1259
1260#ifdef CONFIG_MT9T013
1261static struct msm_camera_sensor_flash_data flash_mt9t013 = {
1262 .flash_type = MSM_CAMERA_FLASH_LED,
1263 .flash_src = &msm_flash_src_pwm
1264};
1265
1266static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = {
1267 .sensor_name = "mt9t013",
1268 .sensor_reset = 0,
1269 .sensor_pwd = 85,
1270 .vcm_pwd = 1,
1271 .vcm_enable = 0,
1272 .pdata = &msm_camera_device_data,
1273 .resource = msm_camera_resources,
1274 .num_resources = ARRAY_SIZE(msm_camera_resources),
1275 .flash_data = &flash_mt9t013,
1276 .csi_if = 1
1277};
1278
1279static struct platform_device msm_camera_sensor_mt9t013 = {
1280 .name = "msm_camera_mt9t013",
1281 .dev = {
1282 .platform_data = &msm_camera_sensor_mt9t013_data,
1283 },
1284};
1285#endif
1286
1287#ifdef CONFIG_MSM_GEMINI
1288static struct resource msm_gemini_resources[] = {
1289 {
1290 .start = 0xA3A00000,
1291 .end = 0xA3A00000 + 0x0150 - 1,
1292 .flags = IORESOURCE_MEM,
1293 },
1294 {
1295 .start = INT_JPEG,
1296 .end = INT_JPEG,
1297 .flags = IORESOURCE_IRQ,
1298 },
1299};
1300
1301static struct platform_device msm_gemini_device = {
1302 .name = "msm_gemini",
1303 .resource = msm_gemini_resources,
1304 .num_resources = ARRAY_SIZE(msm_gemini_resources),
1305};
1306#endif
1307
1308#ifdef CONFIG_MSM_VPE
1309static struct resource msm_vpe_resources[] = {
1310 {
1311 .start = 0xAD200000,
1312 .end = 0xAD200000 + SZ_1M - 1,
1313 .flags = IORESOURCE_MEM,
1314 },
1315 {
1316 .start = INT_VPE,
1317 .end = INT_VPE,
1318 .flags = IORESOURCE_IRQ,
1319 },
1320};
1321
1322static struct platform_device msm_vpe_device = {
1323 .name = "msm_vpe",
1324 .id = 0,
1325 .num_resources = ARRAY_SIZE(msm_vpe_resources),
1326 .resource = msm_vpe_resources,
1327};
1328#endif
1329
1330#endif /*CONFIG_MSM_CAMERA*/
1331
1332#ifdef CONFIG_MSM7KV2_AUDIO
1333static uint32_t audio_pamp_gpio_config =
1334 GPIO_CFG(82, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA);
1335
1336static uint32_t audio_fluid_icodec_tx_config =
1337 GPIO_CFG(85, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA);
1338
1339static int __init snddev_poweramp_gpio_init(void)
1340{
1341 int rc;
1342
1343 pr_info("snddev_poweramp_gpio_init \n");
1344 rc = gpio_tlmm_config(audio_pamp_gpio_config, GPIO_CFG_ENABLE);
1345 if (rc) {
1346 printk(KERN_ERR
1347 "%s: gpio_tlmm_config(%#x)=%d\n",
1348 __func__, audio_pamp_gpio_config, rc);
1349 }
1350 return rc;
1351}
1352
1353void msm_snddev_tx_route_config(void)
1354{
1355 int rc;
1356
1357 pr_debug("%s()\n", __func__);
1358
1359 if (machine_is_msm7x30_fluid()) {
1360 rc = gpio_tlmm_config(audio_fluid_icodec_tx_config,
1361 GPIO_CFG_ENABLE);
1362 if (rc) {
1363 printk(KERN_ERR
1364 "%s: gpio_tlmm_config(%#x)=%d\n",
1365 __func__, audio_fluid_icodec_tx_config, rc);
1366 } else
1367 gpio_set_value(85, 0);
1368 }
1369}
1370
1371void msm_snddev_tx_route_deconfig(void)
1372{
1373 int rc;
1374
1375 pr_debug("%s()\n", __func__);
1376
1377 if (machine_is_msm7x30_fluid()) {
1378 rc = gpio_tlmm_config(audio_fluid_icodec_tx_config,
1379 GPIO_CFG_DISABLE);
1380 if (rc) {
1381 printk(KERN_ERR
1382 "%s: gpio_tlmm_config(%#x)=%d\n",
1383 __func__, audio_fluid_icodec_tx_config, rc);
1384 }
1385 }
1386}
1387
1388void msm_snddev_poweramp_on(void)
1389{
1390 gpio_set_value(82, 1); /* enable spkr poweramp */
1391 pr_info("%s: power on amplifier\n", __func__);
1392}
1393
1394void msm_snddev_poweramp_off(void)
1395{
1396 gpio_set_value(82, 0); /* disable spkr poweramp */
1397 pr_info("%s: power off amplifier\n", __func__);
1398}
1399
1400static struct vreg *snddev_vreg_ncp, *snddev_vreg_gp4;
1401
1402void msm_snddev_hsed_voltage_on(void)
1403{
1404 int rc;
1405
1406 snddev_vreg_gp4 = vreg_get(NULL, "gp4");
1407 if (IS_ERR(snddev_vreg_gp4)) {
1408 pr_err("%s: vreg_get(%s) failed (%ld)\n",
1409 __func__, "gp4", PTR_ERR(snddev_vreg_gp4));
1410 return;
1411 }
1412 rc = vreg_enable(snddev_vreg_gp4);
1413 if (rc)
1414 pr_err("%s: vreg_enable(gp4) failed (%d)\n", __func__, rc);
1415
1416 snddev_vreg_ncp = vreg_get(NULL, "ncp");
1417 if (IS_ERR(snddev_vreg_ncp)) {
1418 pr_err("%s: vreg_get(%s) failed (%ld)\n",
1419 __func__, "ncp", PTR_ERR(snddev_vreg_ncp));
1420 return;
1421 }
1422 rc = vreg_enable(snddev_vreg_ncp);
1423 if (rc)
1424 pr_err("%s: vreg_enable(ncp) failed (%d)\n", __func__, rc);
1425}
1426
1427void msm_snddev_hsed_voltage_off(void)
1428{
1429 int rc;
1430
1431 if (IS_ERR(snddev_vreg_ncp)) {
1432 pr_err("%s: vreg_get(%s) failed (%ld)\n",
1433 __func__, "ncp", PTR_ERR(snddev_vreg_ncp));
1434 return;
1435 }
1436 rc = vreg_disable(snddev_vreg_ncp);
1437 if (rc)
1438 pr_err("%s: vreg_disable(ncp) failed (%d)\n", __func__, rc);
1439 vreg_put(snddev_vreg_ncp);
1440
1441 if (IS_ERR(snddev_vreg_gp4)) {
1442 pr_err("%s: vreg_get(%s) failed (%ld)\n",
1443 __func__, "gp4", PTR_ERR(snddev_vreg_gp4));
1444 return;
1445 }
1446 rc = vreg_disable(snddev_vreg_gp4);
1447 if (rc)
1448 pr_err("%s: vreg_disable(gp4) failed (%d)\n", __func__, rc);
1449
1450 vreg_put(snddev_vreg_gp4);
1451
1452}
1453
1454static unsigned aux_pcm_gpio_on[] = {
1455 GPIO_CFG(138, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_DOUT */
1456 GPIO_CFG(139, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_DIN */
1457 GPIO_CFG(140, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_SYNC */
1458 GPIO_CFG(141, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* PCM_CLK */
1459};
1460
1461static int __init aux_pcm_gpio_init(void)
1462{
1463 int pin, rc;
1464
1465 pr_info("aux_pcm_gpio_init \n");
1466 for (pin = 0; pin < ARRAY_SIZE(aux_pcm_gpio_on); pin++) {
1467 rc = gpio_tlmm_config(aux_pcm_gpio_on[pin],
1468 GPIO_CFG_ENABLE);
1469 if (rc) {
1470 printk(KERN_ERR
1471 "%s: gpio_tlmm_config(%#x)=%d\n",
1472 __func__, aux_pcm_gpio_on[pin], rc);
1473 }
1474 }
1475 return rc;
1476}
1477
1478static struct msm_gpio mi2s_clk_gpios[] = {
1479 { GPIO_CFG(145, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1480 "MI2S_SCLK"},
1481 { GPIO_CFG(144, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1482 "MI2S_WS"},
1483 { GPIO_CFG(120, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1484 "MI2S_MCLK_A"},
1485};
1486
1487static struct msm_gpio mi2s_rx_data_lines_gpios[] = {
1488 { GPIO_CFG(121, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1489 "MI2S_DATA_SD0_A"},
1490 { GPIO_CFG(122, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1491 "MI2S_DATA_SD1_A"},
1492 { GPIO_CFG(123, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1493 "MI2S_DATA_SD2_A"},
1494 { GPIO_CFG(146, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1495 "MI2S_DATA_SD3"},
1496};
1497
1498static struct msm_gpio mi2s_tx_data_lines_gpios[] = {
1499 { GPIO_CFG(146, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1500 "MI2S_DATA_SD3"},
1501};
1502
1503int mi2s_config_clk_gpio(void)
1504{
1505 int rc = 0;
1506
1507 rc = msm_gpios_request_enable(mi2s_clk_gpios,
1508 ARRAY_SIZE(mi2s_clk_gpios));
1509 if (rc) {
1510 pr_err("%s: enable mi2s clk gpios failed\n",
1511 __func__);
1512 return rc;
1513 }
1514 return 0;
1515}
1516
1517int mi2s_unconfig_data_gpio(u32 direction, u8 sd_line_mask)
1518{
1519 int i, rc = 0;
1520 sd_line_mask &= MI2S_SD_LINE_MASK;
1521
1522 switch (direction) {
1523 case DIR_TX:
1524 msm_gpios_disable_free(mi2s_tx_data_lines_gpios, 1);
1525 break;
1526 case DIR_RX:
1527 i = 0;
1528 while (sd_line_mask) {
1529 if (sd_line_mask & 0x1)
1530 msm_gpios_disable_free(
1531 mi2s_rx_data_lines_gpios + i , 1);
1532 sd_line_mask = sd_line_mask >> 1;
1533 i++;
1534 }
1535 break;
1536 default:
1537 pr_err("%s: Invaild direction direction = %u\n",
1538 __func__, direction);
1539 rc = -EINVAL;
1540 break;
1541 }
1542 return rc;
1543}
1544
1545int mi2s_config_data_gpio(u32 direction, u8 sd_line_mask)
1546{
1547 int i , rc = 0;
1548 u8 sd_config_done_mask = 0;
1549
1550 sd_line_mask &= MI2S_SD_LINE_MASK;
1551
1552 switch (direction) {
1553 case DIR_TX:
1554 if ((sd_line_mask & MI2S_SD_0) || (sd_line_mask & MI2S_SD_1) ||
1555 (sd_line_mask & MI2S_SD_2) || !(sd_line_mask & MI2S_SD_3)) {
1556 pr_err("%s: can not use SD0 or SD1 or SD2 for TX"
1557 ".only can use SD3. sd_line_mask = 0x%x\n",
1558 __func__ , sd_line_mask);
1559 rc = -EINVAL;
1560 } else {
1561 rc = msm_gpios_request_enable(mi2s_tx_data_lines_gpios,
1562 1);
1563 if (rc)
1564 pr_err("%s: enable mi2s gpios for TX failed\n",
1565 __func__);
1566 }
1567 break;
1568 case DIR_RX:
1569 i = 0;
1570 while (sd_line_mask && (rc == 0)) {
1571 if (sd_line_mask & 0x1) {
1572 rc = msm_gpios_request_enable(
1573 mi2s_rx_data_lines_gpios + i , 1);
1574 if (rc) {
1575 pr_err("%s: enable mi2s gpios for"
1576 "RX failed. SD line = %s\n",
1577 __func__,
1578 (mi2s_rx_data_lines_gpios + i)->label);
1579 mi2s_unconfig_data_gpio(DIR_RX,
1580 sd_config_done_mask);
1581 } else
1582 sd_config_done_mask |= (1 << i);
1583 }
1584 sd_line_mask = sd_line_mask >> 1;
1585 i++;
1586 }
1587 break;
1588 default:
1589 pr_err("%s: Invaild direction direction = %u\n",
1590 __func__, direction);
1591 rc = -EINVAL;
1592 break;
1593 }
1594 return rc;
1595}
1596
1597int mi2s_unconfig_clk_gpio(void)
1598{
1599 msm_gpios_disable_free(mi2s_clk_gpios, ARRAY_SIZE(mi2s_clk_gpios));
1600 return 0;
1601}
1602
1603#endif /* CONFIG_MSM7KV2_AUDIO */
1604
1605static int __init buses_init(void)
1606{
1607 if (gpio_tlmm_config(GPIO_CFG(PMIC_GPIO_INT, 1, GPIO_CFG_INPUT,
1608 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE))
1609 pr_err("%s: gpio_tlmm_config (gpio=%d) failed\n",
1610 __func__, PMIC_GPIO_INT);
1611
1612 if (machine_is_msm7x30_fluid()) {
1613 pm8058_7x30_data.sub_devices[PM8058_SUBDEV_KPD].platform_data
1614 = &fluid_keypad_data;
1615 } else {
1616 pm8058_7x30_data.sub_devices[PM8058_SUBDEV_KPD].platform_data
1617 = &surf_keypad_data;
1618 pm8058_7x30_data.sub_devices[PM8058_SUBDEV_KPD].pdata_size
1619 = sizeof(surf_keypad_data);
1620 }
1621
1622 i2c_register_board_info(6 /* I2C_SSBI ID */, pm8058_boardinfo,
1623 ARRAY_SIZE(pm8058_boardinfo));
1624
1625 return 0;
1626}
1627
1628#define TIMPANI_RESET_GPIO 1
1629
1630struct bahama_config_register{
1631 u8 reg;
1632 u8 value;
1633 u8 mask;
1634};
1635
1636enum version{
1637 VER_1_0,
1638 VER_2_0,
1639 VER_UNSUPPORTED = 0xFF
1640};
1641
1642
1643static struct vreg *vreg_marimba_1;
1644static struct vreg *vreg_marimba_2;
1645static struct vreg *vreg_marimba_3;
1646
1647static struct msm_gpio timpani_reset_gpio_cfg[] = {
1648{ GPIO_CFG(TIMPANI_RESET_GPIO, 0, GPIO_CFG_OUTPUT,
1649 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "timpani_reset"} };
1650
1651static u8 read_bahama_ver(void)
1652{
1653 int rc;
1654 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA };
1655 u8 bahama_version;
1656
1657 rc = marimba_read_bit_mask(&config, 0x00, &bahama_version, 1, 0x1F);
1658 if (rc < 0) {
1659 printk(KERN_ERR
1660 "%s: version read failed: %d\n",
1661 __func__, rc);
1662 return rc;
1663 } else {
1664 printk(KERN_INFO
1665 "%s: version read got: 0x%x\n",
1666 __func__, bahama_version);
1667 }
1668
1669 switch (bahama_version) {
1670 case 0x08: /* varient of bahama v1 */
1671 case 0x10:
1672 case 0x00:
1673 return VER_1_0;
1674 case 0x09: /* variant of bahama v2 */
1675 return VER_2_0;
1676 default:
1677 return VER_UNSUPPORTED;
1678 }
1679}
1680
1681static int config_timpani_reset(void)
1682{
1683 int rc;
1684
1685 rc = msm_gpios_request_enable(timpani_reset_gpio_cfg,
1686 ARRAY_SIZE(timpani_reset_gpio_cfg));
1687 if (rc < 0) {
1688 printk(KERN_ERR
1689 "%s: msm_gpios_request_enable failed (%d)\n",
1690 __func__, rc);
1691 }
1692 return rc;
1693}
1694
1695static unsigned int msm_timpani_setup_power(void)
1696{
1697 int rc;
1698
1699 rc = config_timpani_reset();
1700 if (rc < 0)
1701 goto out;
1702
1703 rc = vreg_enable(vreg_marimba_1);
1704 if (rc) {
1705 printk(KERN_ERR "%s: vreg_enable() = %d\n",
1706 __func__, rc);
1707 goto out;
1708 }
1709 rc = vreg_enable(vreg_marimba_2);
1710 if (rc) {
1711 printk(KERN_ERR "%s: vreg_enable() = %d\n",
1712 __func__, rc);
1713 goto fail_disable_vreg_marimba_1;
1714 }
1715
1716 rc = gpio_direction_output(TIMPANI_RESET_GPIO, 1);
1717 if (rc < 0) {
1718 printk(KERN_ERR
1719 "%s: gpio_direction_output failed (%d)\n",
1720 __func__, rc);
1721 msm_gpios_free(timpani_reset_gpio_cfg,
1722 ARRAY_SIZE(timpani_reset_gpio_cfg));
1723 vreg_disable(vreg_marimba_2);
1724 } else
1725 goto out;
1726
1727
1728fail_disable_vreg_marimba_1:
1729 vreg_disable(vreg_marimba_1);
1730
1731out:
1732 return rc;
1733};
1734
1735static void msm_timpani_shutdown_power(void)
1736{
1737 int rc;
1738
1739 rc = vreg_disable(vreg_marimba_1);
1740 if (rc) {
1741 printk(KERN_ERR "%s: return val: %d\n",
1742 __func__, rc);
1743 }
1744 rc = vreg_disable(vreg_marimba_2);
1745 if (rc) {
1746 printk(KERN_ERR "%s: return val: %d\n",
1747 __func__, rc);
1748 }
1749
1750 rc = gpio_direction_output(TIMPANI_RESET_GPIO, 0);
1751 if (rc < 0) {
1752 printk(KERN_ERR
1753 "%s: gpio_direction_output failed (%d)\n",
1754 __func__, rc);
1755 }
1756
1757 msm_gpios_free(timpani_reset_gpio_cfg,
1758 ARRAY_SIZE(timpani_reset_gpio_cfg));
1759};
1760
1761static unsigned int msm_bahama_core_config(int type)
1762{
1763 int rc = 0;
1764
1765 if (type == BAHAMA_ID) {
1766
1767 int i;
1768 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA };
1769
1770 const struct bahama_config_register v20_init[] = {
1771 /* reg, value, mask */
1772 { 0xF4, 0x84, 0xFF }, /* AREG */
1773 { 0xF0, 0x04, 0xFF } /* DREG */
1774 };
1775
1776 if (read_bahama_ver() == VER_2_0) {
1777 for (i = 0; i < ARRAY_SIZE(v20_init); i++) {
1778 u8 value = v20_init[i].value;
1779 rc = marimba_write_bit_mask(&config,
1780 v20_init[i].reg,
1781 &value,
1782 sizeof(v20_init[i].value),
1783 v20_init[i].mask);
1784 if (rc < 0) {
1785 printk(KERN_ERR
1786 "%s: reg %d write failed: %d\n",
1787 __func__, v20_init[i].reg, rc);
1788 return rc;
1789 }
1790 printk(KERN_INFO "%s: reg 0x%02x value 0x%02x"
1791 " mask 0x%02x\n",
1792 __func__, v20_init[i].reg,
1793 v20_init[i].value, v20_init[i].mask);
1794 }
1795 }
1796 }
1797 printk(KERN_INFO "core type: %d\n", type);
1798
1799 return rc;
1800}
1801
1802static unsigned int msm_bahama_setup_power(void)
1803{
1804 int rc;
1805
1806 rc = vreg_enable(vreg_marimba_3);
1807 if (rc) {
1808 printk(KERN_ERR "%s: vreg_enable() = %d\n",
1809 __func__, rc);
1810 }
1811
1812 return rc;
1813};
1814
1815static unsigned int msm_bahama_shutdown_power(int value)
1816{
1817 int rc = 0;
1818
1819 if (value != BAHAMA_ID) {
1820 rc = vreg_disable(vreg_marimba_3);
1821 if (rc) {
1822 printk(KERN_ERR "%s: return val: %d\n",
1823 __func__, rc);
1824 }
1825 }
1826
1827 return rc;
1828};
1829
1830static struct msm_gpio marimba_svlte_config_clock[] = {
1831 { GPIO_CFG(34, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1832 "MARIMBA_SVLTE_CLOCK_ENABLE" },
1833};
1834
1835static unsigned int msm_marimba_gpio_config_svlte(int gpio_cfg_marimba)
1836{
1837 if (machine_is_msm8x55_svlte_surf() ||
1838 machine_is_msm8x55_svlte_ffa()) {
1839 if (gpio_cfg_marimba)
1840 gpio_set_value(GPIO_PIN
1841 (marimba_svlte_config_clock->gpio_cfg), 1);
1842 else
1843 gpio_set_value(GPIO_PIN
1844 (marimba_svlte_config_clock->gpio_cfg), 0);
1845 }
1846
1847 return 0;
1848};
1849
1850static unsigned int msm_marimba_setup_power(void)
1851{
1852 int rc;
1853
1854 rc = vreg_enable(vreg_marimba_1);
1855 if (rc) {
1856 printk(KERN_ERR "%s: vreg_enable() = %d \n",
1857 __func__, rc);
1858 goto out;
1859 }
1860 rc = vreg_enable(vreg_marimba_2);
1861 if (rc) {
1862 printk(KERN_ERR "%s: vreg_enable() = %d \n",
1863 __func__, rc);
1864 goto out;
1865 }
1866
1867 if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) {
1868 rc = msm_gpios_request_enable(marimba_svlte_config_clock,
1869 ARRAY_SIZE(marimba_svlte_config_clock));
1870 if (rc < 0) {
1871 printk(KERN_ERR
1872 "%s: msm_gpios_request_enable failed (%d)\n",
1873 __func__, rc);
1874 return rc;
1875 }
1876
1877 rc = gpio_direction_output(GPIO_PIN
1878 (marimba_svlte_config_clock->gpio_cfg), 0);
1879 if (rc < 0) {
1880 printk(KERN_ERR
1881 "%s: gpio_direction_output failed (%d)\n",
1882 __func__, rc);
1883 return rc;
1884 }
1885 }
1886
1887out:
1888 return rc;
1889};
1890
1891static void msm_marimba_shutdown_power(void)
1892{
1893 int rc;
1894
1895 rc = vreg_disable(vreg_marimba_1);
1896 if (rc) {
1897 printk(KERN_ERR "%s: return val: %d\n",
1898 __func__, rc);
1899 }
1900 rc = vreg_disable(vreg_marimba_2);
1901 if (rc) {
1902 printk(KERN_ERR "%s: return val: %d \n",
1903 __func__, rc);
1904 }
1905};
1906
1907static int bahama_present(void)
1908{
1909 int id;
1910 switch (id = adie_get_detected_connectivity_type()) {
1911 case BAHAMA_ID:
1912 return 1;
1913
1914 case MARIMBA_ID:
1915 return 0;
1916
1917 case TIMPANI_ID:
1918 default:
1919 printk(KERN_ERR "%s: unexpected adie connectivity type: %d\n",
1920 __func__, id);
1921 return -ENODEV;
1922 }
1923}
1924
1925struct vreg *fm_regulator;
1926static int fm_radio_setup(struct marimba_fm_platform_data *pdata)
1927{
1928 int rc;
1929 uint32_t irqcfg;
1930 const char *id = "FMPW";
1931
1932 int bahama_not_marimba = bahama_present();
1933
1934 if (bahama_not_marimba == -1) {
1935 printk(KERN_WARNING "%s: bahama_present: %d\n",
1936 __func__, bahama_not_marimba);
1937 return -ENODEV;
1938 }
1939 if (bahama_not_marimba)
1940 fm_regulator = vreg_get(NULL, "s3");
1941 else
1942 fm_regulator = vreg_get(NULL, "s2");
1943
1944 if (IS_ERR(fm_regulator)) {
1945 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
1946 __func__, PTR_ERR(fm_regulator));
1947 return -1;
1948 }
1949 if (!bahama_not_marimba) {
1950
1951 rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 1300);
1952
1953 if (rc < 0) {
1954 printk(KERN_ERR "%s: voltage level vote failed (%d)\n",
1955 __func__, rc);
1956 return rc;
1957 }
1958 }
1959 rc = vreg_enable(fm_regulator);
1960 if (rc) {
1961 printk(KERN_ERR "%s: vreg_enable() = %d\n",
1962 __func__, rc);
1963 return rc;
1964 }
1965
1966 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO,
1967 PMAPP_CLOCK_VOTE_ON);
1968 if (rc < 0) {
1969 printk(KERN_ERR "%s: clock vote failed (%d)\n",
1970 __func__, rc);
1971 goto fm_clock_vote_fail;
1972 }
1973 /*Request the Clock Using GPIO34/AP2MDM_MRMBCK_EN in case
1974 of svlte*/
1975 if (machine_is_msm8x55_svlte_surf() ||
1976 machine_is_msm8x55_svlte_ffa()) {
1977 rc = marimba_gpio_config(1);
1978 if (rc < 0)
1979 printk(KERN_ERR "%s: clock enable for svlte : %d\n",
1980 __func__, rc);
1981 }
1982 irqcfg = GPIO_CFG(147, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
1983 GPIO_CFG_2MA);
1984 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
1985 if (rc) {
1986 printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n",
1987 __func__, irqcfg, rc);
1988 rc = -EIO;
1989 goto fm_gpio_config_fail;
1990
1991 }
1992 return 0;
1993fm_gpio_config_fail:
1994 pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO,
1995 PMAPP_CLOCK_VOTE_OFF);
1996fm_clock_vote_fail:
1997 vreg_disable(fm_regulator);
1998 return rc;
1999
2000};
2001
2002static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata)
2003{
2004 int rc;
2005 const char *id = "FMPW";
2006 uint32_t irqcfg = GPIO_CFG(147, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
2007 GPIO_CFG_2MA);
2008
2009 int bahama_not_marimba = bahama_present();
2010 if (bahama_not_marimba == -1) {
2011 printk(KERN_WARNING "%s: bahama_present: %d\n",
2012 __func__, bahama_not_marimba);
2013 return;
2014 }
2015
2016 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
2017 if (rc) {
2018 printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n",
2019 __func__, irqcfg, rc);
2020 }
2021 if (fm_regulator != NULL) {
2022 rc = vreg_disable(fm_regulator);
2023
2024 if (rc) {
2025 printk(KERN_ERR "%s: return val: %d\n",
2026 __func__, rc);
2027 }
2028 fm_regulator = NULL;
2029 }
2030 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO,
2031 PMAPP_CLOCK_VOTE_OFF);
2032 if (rc < 0)
2033 printk(KERN_ERR "%s: clock_vote return val: %d\n",
2034 __func__, rc);
2035
2036 /*Disable the Clock Using GPIO34/AP2MDM_MRMBCK_EN in case
2037 of svlte*/
2038 if (machine_is_msm8x55_svlte_surf() ||
2039 machine_is_msm8x55_svlte_ffa()) {
2040 rc = marimba_gpio_config(0);
2041 if (rc < 0)
2042 printk(KERN_ERR "%s: clock disable for svlte : %d\n",
2043 __func__, rc);
2044 }
2045
2046
2047 if (!bahama_not_marimba) {
2048 rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 0);
2049
2050 if (rc < 0)
2051 printk(KERN_ERR "%s: vreg level vote return val: %d\n",
2052 __func__, rc);
2053 }
2054}
2055
2056static struct marimba_fm_platform_data marimba_fm_pdata = {
2057 .fm_setup = fm_radio_setup,
2058 .fm_shutdown = fm_radio_shutdown,
2059 .irq = MSM_GPIO_TO_INT(147),
2060 .vreg_s2 = NULL,
2061 .vreg_xo_out = NULL,
2062 .is_fm_soc_i2s_master = false,
2063 .config_i2s_gpio = NULL,
2064};
2065
2066
2067/* Slave id address for FM/CDC/QMEMBIST
2068 * Values can be programmed using Marimba slave id 0
2069 * should there be a conflict with other I2C devices
2070 * */
2071#define MARIMBA_SLAVE_ID_FM_ADDR 0x2A
2072#define MARIMBA_SLAVE_ID_CDC_ADDR 0x77
2073#define MARIMBA_SLAVE_ID_QMEMBIST_ADDR 0X66
2074
2075#define BAHAMA_SLAVE_ID_FM_ADDR 0x2A
2076#define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B
2077
2078static const char *tsadc_id = "MADC";
2079static const char *vregs_tsadc_name[] = {
2080 "gp12",
2081 "s2",
2082};
2083static struct vreg *vregs_tsadc[ARRAY_SIZE(vregs_tsadc_name)];
2084
2085static const char *vregs_timpani_tsadc_name[] = {
2086 "s3",
2087 "gp12",
2088 "gp16"
2089};
2090static struct vreg *vregs_timpani_tsadc[ARRAY_SIZE(vregs_timpani_tsadc_name)];
2091
2092static int marimba_tsadc_power(int vreg_on)
2093{
2094 int i, rc = 0;
2095 int tsadc_adie_type = adie_get_detected_codec_type();
2096
2097 if (tsadc_adie_type == TIMPANI_ID) {
2098 for (i = 0; i < ARRAY_SIZE(vregs_timpani_tsadc_name); i++) {
2099 if (!vregs_timpani_tsadc[i]) {
2100 pr_err("%s: vreg_get %s failed(%d)\n",
2101 __func__, vregs_timpani_tsadc_name[i], rc);
2102 goto vreg_fail;
2103 }
2104
2105 rc = vreg_on ? vreg_enable(vregs_timpani_tsadc[i]) :
2106 vreg_disable(vregs_timpani_tsadc[i]);
2107 if (rc < 0) {
2108 pr_err("%s: vreg %s %s failed(%d)\n",
2109 __func__, vregs_timpani_tsadc_name[i],
2110 vreg_on ? "enable" : "disable", rc);
2111 goto vreg_fail;
2112 }
2113 }
2114 /* Vote for D0 and D1 buffer */
2115 rc = pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_D1,
2116 vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF);
2117 if (rc) {
2118 pr_err("%s: unable to %svote for d1 clk\n",
2119 __func__, vreg_on ? "" : "de-");
2120 goto do_vote_fail;
2121 }
2122 rc = pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_DO,
2123 vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF);
2124 if (rc) {
2125 pr_err("%s: unable to %svote for d1 clk\n",
2126 __func__, vreg_on ? "" : "de-");
2127 goto do_vote_fail;
2128 }
2129 } else if (tsadc_adie_type == MARIMBA_ID) {
2130 for (i = 0; i < ARRAY_SIZE(vregs_tsadc_name); i++) {
2131 if (!vregs_tsadc[i]) {
2132 pr_err("%s: vreg_get %s failed (%d)\n",
2133 __func__, vregs_tsadc_name[i], rc);
2134 goto vreg_fail;
2135 }
2136
2137 rc = vreg_on ? vreg_enable(vregs_tsadc[i]) :
2138 vreg_disable(vregs_tsadc[i]);
2139 if (rc < 0) {
2140 pr_err("%s: vreg %s %s failed (%d)\n",
2141 __func__, vregs_tsadc_name[i],
2142 vreg_on ? "enable" : "disable", rc);
2143 goto vreg_fail;
2144 }
2145 }
2146 /* If marimba vote for DO buffer */
2147 rc = pmapp_clock_vote(tsadc_id, PMAPP_CLOCK_ID_DO,
2148 vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF);
2149 if (rc) {
2150 pr_err("%s: unable to %svote for d0 clk\n",
2151 __func__, vreg_on ? "" : "de-");
2152 goto do_vote_fail;
2153 }
2154 } else {
2155 pr_err("%s:Adie %d not supported\n",
2156 __func__, tsadc_adie_type);
2157 return -ENODEV;
2158 }
2159
2160 msleep(5); /* ensure power is stable */
2161
2162 return 0;
2163
2164do_vote_fail:
2165vreg_fail:
2166 while (i) {
2167 if (vreg_on) {
2168 if (tsadc_adie_type == TIMPANI_ID)
2169 vreg_disable(vregs_timpani_tsadc[--i]);
2170 else if (tsadc_adie_type == MARIMBA_ID)
2171 vreg_disable(vregs_tsadc[--i]);
2172 } else {
2173 if (tsadc_adie_type == TIMPANI_ID)
2174 vreg_enable(vregs_timpani_tsadc[--i]);
2175 else if (tsadc_adie_type == MARIMBA_ID)
2176 vreg_enable(vregs_tsadc[--i]);
2177 }
2178 }
2179
2180 return rc;
2181}
2182
2183static int marimba_tsadc_vote(int vote_on)
2184{
2185 int rc = 0;
2186
2187 if (adie_get_detected_codec_type() == MARIMBA_ID) {
2188 int level = vote_on ? 1300 : 0;
2189 rc = pmapp_vreg_level_vote(tsadc_id, PMAPP_VREG_S2, level);
2190 if (rc < 0)
2191 pr_err("%s: vreg level %s failed (%d)\n",
2192 __func__, vote_on ? "on" : "off", rc);
2193 }
2194
2195 return rc;
2196}
2197
2198static int marimba_tsadc_init(void)
2199{
2200 int i, rc = 0;
2201 int tsadc_adie_type = adie_get_detected_codec_type();
2202
2203 if (tsadc_adie_type == TIMPANI_ID) {
2204 for (i = 0; i < ARRAY_SIZE(vregs_timpani_tsadc_name); i++) {
2205 vregs_timpani_tsadc[i] = vreg_get(NULL,
2206 vregs_timpani_tsadc_name[i]);
2207 if (IS_ERR(vregs_timpani_tsadc[i])) {
2208 pr_err("%s: vreg get %s failed (%ld)\n",
2209 __func__, vregs_timpani_tsadc_name[i],
2210 PTR_ERR(vregs_timpani_tsadc[i]));
2211 rc = PTR_ERR(vregs_timpani_tsadc[i]);
2212 goto vreg_get_fail;
2213 }
2214 }
2215 } else if (tsadc_adie_type == MARIMBA_ID) {
2216 for (i = 0; i < ARRAY_SIZE(vregs_tsadc_name); i++) {
2217 vregs_tsadc[i] = vreg_get(NULL, vregs_tsadc_name[i]);
2218 if (IS_ERR(vregs_tsadc[i])) {
2219 pr_err("%s: vreg get %s failed (%ld)\n",
2220 __func__, vregs_tsadc_name[i],
2221 PTR_ERR(vregs_tsadc[i]));
2222 rc = PTR_ERR(vregs_tsadc[i]);
2223 goto vreg_get_fail;
2224 }
2225 }
2226 } else {
2227 pr_err("%s:Adie %d not supported\n",
2228 __func__, tsadc_adie_type);
2229 return -ENODEV;
2230 }
2231
2232 return 0;
2233
2234vreg_get_fail:
2235 while (i) {
2236 if (tsadc_adie_type == TIMPANI_ID)
2237 vreg_put(vregs_timpani_tsadc[--i]);
2238 else if (tsadc_adie_type == MARIMBA_ID)
2239 vreg_put(vregs_tsadc[--i]);
2240 }
2241 return rc;
2242}
2243
2244static int marimba_tsadc_exit(void)
2245{
2246 int i, rc = 0;
2247 int tsadc_adie_type = adie_get_detected_codec_type();
2248
2249 if (tsadc_adie_type == TIMPANI_ID) {
2250 for (i = 0; i < ARRAY_SIZE(vregs_timpani_tsadc_name); i++) {
2251 if (vregs_tsadc[i])
2252 vreg_put(vregs_timpani_tsadc[i]);
2253 }
2254 } else if (tsadc_adie_type == MARIMBA_ID) {
2255 for (i = 0; i < ARRAY_SIZE(vregs_tsadc_name); i++) {
2256 if (vregs_tsadc[i])
2257 vreg_put(vregs_tsadc[i]);
2258 }
2259 rc = pmapp_vreg_level_vote(tsadc_id, PMAPP_VREG_S2, 0);
2260 if (rc < 0)
2261 pr_err("%s: vreg level off failed (%d)\n",
2262 __func__, rc);
2263 } else {
2264 pr_err("%s:Adie %d not supported\n",
2265 __func__, tsadc_adie_type);
2266 rc = -ENODEV;
2267 }
2268
2269 return rc;
2270}
2271
2272
2273static struct msm_ts_platform_data msm_ts_data = {
2274 .min_x = 0,
2275 .max_x = 4096,
2276 .min_y = 0,
2277 .max_y = 4096,
2278 .min_press = 0,
2279 .max_press = 255,
2280 .inv_x = 4096,
2281 .inv_y = 4096,
2282 .can_wakeup = false,
2283};
2284
2285static struct marimba_tsadc_platform_data marimba_tsadc_pdata = {
2286 .marimba_tsadc_power = marimba_tsadc_power,
2287 .init = marimba_tsadc_init,
2288 .exit = marimba_tsadc_exit,
2289 .level_vote = marimba_tsadc_vote,
2290 .tsadc_prechg_en = true,
2291 .can_wakeup = false,
2292 .setup = {
2293 .pen_irq_en = true,
2294 .tsadc_en = true,
2295 },
2296 .params2 = {
2297 .input_clk_khz = 2400,
2298 .sample_prd = TSADC_CLK_3,
2299 },
2300 .params3 = {
2301 .prechg_time_nsecs = 6400,
2302 .stable_time_nsecs = 6400,
2303 .tsadc_test_mode = 0,
2304 },
2305 .tssc_data = &msm_ts_data,
2306};
2307
2308static struct vreg *vreg_codec_s4;
2309static int msm_marimba_codec_power(int vreg_on)
2310{
2311 int rc = 0;
2312
2313 if (!vreg_codec_s4) {
2314
2315 vreg_codec_s4 = vreg_get(NULL, "s4");
2316
2317 if (IS_ERR(vreg_codec_s4)) {
2318 printk(KERN_ERR "%s: vreg_get() failed (%ld)\n",
2319 __func__, PTR_ERR(vreg_codec_s4));
2320 rc = PTR_ERR(vreg_codec_s4);
2321 goto vreg_codec_s4_fail;
2322 }
2323 }
2324
2325 if (vreg_on) {
2326 rc = vreg_enable(vreg_codec_s4);
2327 if (rc)
2328 printk(KERN_ERR "%s: vreg_enable() = %d \n",
2329 __func__, rc);
2330 goto vreg_codec_s4_fail;
2331 } else {
2332 rc = vreg_disable(vreg_codec_s4);
2333 if (rc)
2334 printk(KERN_ERR "%s: vreg_disable() = %d \n",
2335 __func__, rc);
2336 goto vreg_codec_s4_fail;
2337 }
2338
2339vreg_codec_s4_fail:
2340 return rc;
2341}
2342
2343static struct marimba_codec_platform_data mariba_codec_pdata = {
2344 .marimba_codec_power = msm_marimba_codec_power,
2345#ifdef CONFIG_MARIMBA_CODEC
2346 .snddev_profile_init = msm_snddev_init,
2347#endif
2348};
2349
2350static struct marimba_platform_data marimba_pdata = {
2351 .slave_id[MARIMBA_SLAVE_ID_FM] = MARIMBA_SLAVE_ID_FM_ADDR,
2352 .slave_id[MARIMBA_SLAVE_ID_CDC] = MARIMBA_SLAVE_ID_CDC_ADDR,
2353 .slave_id[MARIMBA_SLAVE_ID_QMEMBIST] = MARIMBA_SLAVE_ID_QMEMBIST_ADDR,
2354 .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR,
2355 .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR,
2356 .marimba_setup = msm_marimba_setup_power,
2357 .marimba_shutdown = msm_marimba_shutdown_power,
2358 .bahama_setup = msm_bahama_setup_power,
2359 .bahama_shutdown = msm_bahama_shutdown_power,
2360 .marimba_gpio_config = msm_marimba_gpio_config_svlte,
2361 .bahama_core_config = msm_bahama_core_config,
2362 .fm = &marimba_fm_pdata,
2363 .codec = &mariba_codec_pdata,
2364 .tsadc_ssbi_adap = MARIMBA_SSBI_ADAP,
2365};
2366
2367static void __init msm7x30_init_marimba(void)
2368{
2369 int rc;
2370
2371 vreg_marimba_1 = vreg_get(NULL, "s3");
2372 if (IS_ERR(vreg_marimba_1)) {
2373 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
2374 __func__, PTR_ERR(vreg_marimba_1));
2375 return;
2376 }
2377 rc = vreg_set_level(vreg_marimba_1, 1800);
2378
2379 vreg_marimba_2 = vreg_get(NULL, "gp16");
2380 if (IS_ERR(vreg_marimba_1)) {
2381 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
2382 __func__, PTR_ERR(vreg_marimba_1));
2383 return;
2384 }
2385 rc = vreg_set_level(vreg_marimba_2, 1200);
2386
2387 vreg_marimba_3 = vreg_get(NULL, "usb2");
2388 if (IS_ERR(vreg_marimba_3)) {
2389 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
2390 __func__, PTR_ERR(vreg_marimba_3));
2391 return;
2392 }
2393 rc = vreg_set_level(vreg_marimba_3, 1800);
2394}
2395
2396static struct marimba_codec_platform_data timpani_codec_pdata = {
2397 .marimba_codec_power = msm_marimba_codec_power,
2398#ifdef CONFIG_TIMPANI_CODEC
2399 .snddev_profile_init = msm_snddev_init_timpani,
2400#endif
2401};
2402
2403static struct marimba_platform_data timpani_pdata = {
2404 .slave_id[MARIMBA_SLAVE_ID_CDC] = MARIMBA_SLAVE_ID_CDC_ADDR,
2405 .slave_id[MARIMBA_SLAVE_ID_QMEMBIST] = MARIMBA_SLAVE_ID_QMEMBIST_ADDR,
2406 .marimba_setup = msm_timpani_setup_power,
2407 .marimba_shutdown = msm_timpani_shutdown_power,
2408 .codec = &timpani_codec_pdata,
2409 .tsadc = &marimba_tsadc_pdata,
2410 .tsadc_ssbi_adap = MARIMBA_SSBI_ADAP,
2411};
2412
2413#define TIMPANI_I2C_SLAVE_ADDR 0xD
2414
2415static struct i2c_board_info msm_i2c_gsbi7_timpani_info[] = {
2416 {
2417 I2C_BOARD_INFO("timpani", TIMPANI_I2C_SLAVE_ADDR),
2418 .platform_data = &timpani_pdata,
2419 },
2420};
2421
2422#ifdef CONFIG_MSM7KV2_AUDIO
2423static struct resource msm_aictl_resources[] = {
2424 {
2425 .name = "aictl",
2426 .start = 0xa5000100,
2427 .end = 0xa5000100,
2428 .flags = IORESOURCE_MEM,
2429 }
2430};
2431
2432static struct resource msm_mi2s_resources[] = {
2433 {
2434 .name = "hdmi",
2435 .start = 0xac900000,
2436 .end = 0xac900038,
2437 .flags = IORESOURCE_MEM,
2438 },
2439 {
2440 .name = "codec_rx",
2441 .start = 0xac940040,
2442 .end = 0xac940078,
2443 .flags = IORESOURCE_MEM,
2444 },
2445 {
2446 .name = "codec_tx",
2447 .start = 0xac980080,
2448 .end = 0xac9800B8,
2449 .flags = IORESOURCE_MEM,
2450 }
2451
2452};
2453
2454static struct msm_lpa_platform_data lpa_pdata = {
2455 .obuf_hlb_size = 0x2BFF8,
2456 .dsp_proc_id = 0,
2457 .app_proc_id = 2,
2458 .nosb_config = {
2459 .llb_min_addr = 0,
2460 .llb_max_addr = 0x3ff8,
2461 .sb_min_addr = 0,
2462 .sb_max_addr = 0,
2463 },
2464 .sb_config = {
2465 .llb_min_addr = 0,
2466 .llb_max_addr = 0x37f8,
2467 .sb_min_addr = 0x3800,
2468 .sb_max_addr = 0x3ff8,
2469 }
2470};
2471
2472static struct resource msm_lpa_resources[] = {
2473 {
2474 .name = "lpa",
2475 .start = 0xa5000000,
2476 .end = 0xa50000a0,
2477 .flags = IORESOURCE_MEM,
2478 }
2479};
2480
2481static struct resource msm_aux_pcm_resources[] = {
2482
2483 {
2484 .name = "aux_codec_reg_addr",
2485 .start = 0xac9c00c0,
2486 .end = 0xac9c00c8,
2487 .flags = IORESOURCE_MEM,
2488 },
2489 {
2490 .name = "aux_pcm_dout",
2491 .start = 138,
2492 .end = 138,
2493 .flags = IORESOURCE_IO,
2494 },
2495 {
2496 .name = "aux_pcm_din",
2497 .start = 139,
2498 .end = 139,
2499 .flags = IORESOURCE_IO,
2500 },
2501 {
2502 .name = "aux_pcm_syncout",
2503 .start = 140,
2504 .end = 140,
2505 .flags = IORESOURCE_IO,
2506 },
2507 {
2508 .name = "aux_pcm_clkin_a",
2509 .start = 141,
2510 .end = 141,
2511 .flags = IORESOURCE_IO,
2512 },
2513};
2514
2515static struct platform_device msm_aux_pcm_device = {
2516 .name = "msm_aux_pcm",
2517 .id = 0,
2518 .num_resources = ARRAY_SIZE(msm_aux_pcm_resources),
2519 .resource = msm_aux_pcm_resources,
2520};
2521
2522struct platform_device msm_aictl_device = {
2523 .name = "audio_interct",
2524 .id = 0,
2525 .num_resources = ARRAY_SIZE(msm_aictl_resources),
2526 .resource = msm_aictl_resources,
2527};
2528
2529struct platform_device msm_mi2s_device = {
2530 .name = "mi2s",
2531 .id = 0,
2532 .num_resources = ARRAY_SIZE(msm_mi2s_resources),
2533 .resource = msm_mi2s_resources,
2534};
2535
2536struct platform_device msm_lpa_device = {
2537 .name = "lpa",
2538 .id = 0,
2539 .num_resources = ARRAY_SIZE(msm_lpa_resources),
2540 .resource = msm_lpa_resources,
2541 .dev = {
2542 .platform_data = &lpa_pdata,
2543 },
2544};
2545#endif /* CONFIG_MSM7KV2_AUDIO */
2546
2547#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
2548 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
2549 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
2550 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
2551 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
2552 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
2553#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
2554 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
2555 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
2556 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
2557 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
2558 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
2559 #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
2560 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
2561 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
2562 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
2563 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
2564 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
2565 #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
2566 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
2567 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
2568 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
2569 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
2570 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
2571#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
2572
2573static unsigned int dec_concurrency_table[] = {
2574 /* Audio LP */
2575 0,
2576 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2577 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2578 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2579 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_MODE_LP)|
2580 (1<<MSM_ADSP_OP_DM)),
2581
2582 /* Concurrency 1 */
2583 (DEC4_FORMAT),
2584 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2585 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2586 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2587 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2588
2589 /* Concurrency 2 */
2590 (DEC4_FORMAT),
2591 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2592 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2593 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2594 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2595
2596 /* Concurrency 3 */
2597 (DEC4_FORMAT),
2598 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2599 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2600 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2601 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2602
2603 /* Concurrency 4 */
2604 (DEC4_FORMAT),
2605 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2606 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2607 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2608 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2609
2610 /* Concurrency 5 */
2611 (DEC4_FORMAT),
2612 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2613 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2614 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2615 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2616
2617 /* Concurrency 6 */
2618 (DEC4_FORMAT),
2619 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2620 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2621 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2622 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2623};
2624
2625#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
2626 .module_queueid = queueid, .module_decid = decid, \
2627 .nr_codec_support = nr_codec}
2628
2629#define DEC_INSTANCE(max_instance_same, max_instance_diff) { \
2630 .max_instances_same_dec = max_instance_same, \
2631 .max_instances_diff_dec = max_instance_diff}
2632
2633static struct msm_adspdec_info dec_info_list[] = {
2634 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
2635 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
2636 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
2637 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
2638 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
2639};
2640
2641static struct dec_instance_table dec_instance_list[][MSM_MAX_DEC_CNT] = {
2642 /* Non Turbo Mode */
2643 {
2644 DEC_INSTANCE(4, 3), /* WAV */
2645 DEC_INSTANCE(4, 3), /* ADPCM */
2646 DEC_INSTANCE(4, 2), /* MP3 */
2647 DEC_INSTANCE(0, 0), /* Real Audio */
2648 DEC_INSTANCE(4, 2), /* WMA */
2649 DEC_INSTANCE(3, 2), /* AAC */
2650 DEC_INSTANCE(0, 0), /* Reserved */
2651 DEC_INSTANCE(0, 0), /* MIDI */
2652 DEC_INSTANCE(4, 3), /* YADPCM */
2653 DEC_INSTANCE(4, 3), /* QCELP */
2654 DEC_INSTANCE(4, 3), /* AMRNB */
2655 DEC_INSTANCE(1, 1), /* AMRWB/WB+ */
2656 DEC_INSTANCE(4, 3), /* EVRC */
2657 DEC_INSTANCE(1, 1), /* WMAPRO */
2658 },
2659 /* Turbo Mode */
2660 {
2661 DEC_INSTANCE(4, 3), /* WAV */
2662 DEC_INSTANCE(4, 3), /* ADPCM */
2663 DEC_INSTANCE(4, 3), /* MP3 */
2664 DEC_INSTANCE(0, 0), /* Real Audio */
2665 DEC_INSTANCE(4, 3), /* WMA */
2666 DEC_INSTANCE(4, 3), /* AAC */
2667 DEC_INSTANCE(0, 0), /* Reserved */
2668 DEC_INSTANCE(0, 0), /* MIDI */
2669 DEC_INSTANCE(4, 3), /* YADPCM */
2670 DEC_INSTANCE(4, 3), /* QCELP */
2671 DEC_INSTANCE(4, 3), /* AMRNB */
2672 DEC_INSTANCE(2, 3), /* AMRWB/WB+ */
2673 DEC_INSTANCE(4, 3), /* EVRC */
2674 DEC_INSTANCE(1, 2), /* WMAPRO */
2675 },
2676};
2677
2678static struct msm_adspdec_database msm_device_adspdec_database = {
2679 .num_dec = ARRAY_SIZE(dec_info_list),
2680 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
2681 ARRAY_SIZE(dec_info_list)),
2682 .dec_concurrency_table = dec_concurrency_table,
2683 .dec_info_list = dec_info_list,
2684 .dec_instance_list = &dec_instance_list[0][0],
2685};
2686
2687static struct platform_device msm_device_adspdec = {
2688 .name = "msm_adspdec",
2689 .id = -1,
2690 .dev = {
2691 .platform_data = &msm_device_adspdec_database
2692 },
2693};
2694
2695static struct resource smc91x_resources[] = {
2696 [0] = {
2697 .start = 0x8A000300,
2698 .end = 0x8A0003ff,
2699 .flags = IORESOURCE_MEM,
2700 },
2701 [1] = {
2702 .start = MSM_GPIO_TO_INT(156),
2703 .end = MSM_GPIO_TO_INT(156),
2704 .flags = IORESOURCE_IRQ,
2705 },
2706};
2707
2708static struct platform_device smc91x_device = {
2709 .name = "smc91x",
2710 .id = 0,
2711 .num_resources = ARRAY_SIZE(smc91x_resources),
2712 .resource = smc91x_resources,
2713};
2714
2715static struct smsc911x_platform_config smsc911x_config = {
2716 .phy_interface = PHY_INTERFACE_MODE_MII,
2717 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
2718 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
2719 .flags = SMSC911X_USE_32BIT,
2720};
2721
2722static struct resource smsc911x_resources[] = {
2723 [0] = {
2724 .start = 0x8D000000,
2725 .end = 0x8D000100,
2726 .flags = IORESOURCE_MEM,
2727 },
2728 [1] = {
2729 .start = MSM_GPIO_TO_INT(88),
2730 .end = MSM_GPIO_TO_INT(88),
2731 .flags = IORESOURCE_IRQ,
2732 },
2733};
2734
2735static struct platform_device smsc911x_device = {
2736 .name = "smsc911x",
2737 .id = -1,
2738 .num_resources = ARRAY_SIZE(smsc911x_resources),
2739 .resource = smsc911x_resources,
2740 .dev = {
2741 .platform_data = &smsc911x_config,
2742 },
2743};
2744
2745static struct msm_gpio smsc911x_gpios[] = {
2746 { GPIO_CFG(172, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr6" },
2747 { GPIO_CFG(173, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr5" },
2748 { GPIO_CFG(174, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr4" },
2749 { GPIO_CFG(175, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr3" },
2750 { GPIO_CFG(176, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr2" },
2751 { GPIO_CFG(177, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr1" },
2752 { GPIO_CFG(178, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "ebi2_addr0" },
2753 { GPIO_CFG(88, 2, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), "smsc911x_irq" },
2754};
2755
2756static void msm7x30_cfg_smsc911x(void)
2757{
2758 int rc;
2759
2760 rc = msm_gpios_request_enable(smsc911x_gpios,
2761 ARRAY_SIZE(smsc911x_gpios));
2762 if (rc)
2763 pr_err("%s: unable to enable gpios\n", __func__);
2764}
2765
2766#ifdef CONFIG_USB_G_ANDROID
2767static struct android_usb_platform_data android_usb_pdata = {
2768 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2769};
2770
2771static struct platform_device android_usb_device = {
2772 .name = "android_usb",
2773 .id = -1,
2774 .dev = {
2775 .platform_data = &android_usb_pdata,
2776 },
2777};
2778#endif
2779
2780static struct msm_gpio optnav_config_data[] = {
2781 { GPIO_CFG(OPTNAV_CHIP_SELECT, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA),
2782 "optnav_chip_select" },
2783};
2784
2785static void __iomem *virtual_optnav;
2786
2787static int optnav_gpio_setup(void)
2788{
2789 int rc = -ENODEV;
2790 rc = msm_gpios_request_enable(optnav_config_data,
2791 ARRAY_SIZE(optnav_config_data));
2792
2793 /* Configure the FPGA for GPIOs */
2794 virtual_optnav = ioremap(FPGA_OPTNAV_GPIO_ADDR, 0x4);
2795 if (!virtual_optnav) {
2796 pr_err("%s:Could not ioremap region\n", __func__);
2797 return -ENOMEM;
2798 }
2799 /*
2800 * Configure the FPGA to set GPIO 19 as
2801 * normal, active(enabled), output(MSM to SURF)
2802 */
2803 writew(0x311E, virtual_optnav);
2804 return rc;
2805}
2806
2807static void optnav_gpio_release(void)
2808{
2809 msm_gpios_disable_free(optnav_config_data,
2810 ARRAY_SIZE(optnav_config_data));
2811 iounmap(virtual_optnav);
2812}
2813
2814static struct vreg *vreg_gp7;
2815static struct vreg *vreg_gp4;
2816static struct vreg *vreg_gp9;
2817static struct vreg *vreg_usb3_3;
2818
2819static int optnav_enable(void)
2820{
2821 int rc;
2822 /*
2823 * Enable the VREGs L8(gp7), L10(gp4), L12(gp9), L6(usb)
2824 * for I2C communication with keyboard.
2825 */
2826 vreg_gp7 = vreg_get(NULL, "gp7");
2827 rc = vreg_set_level(vreg_gp7, 1800);
2828 if (rc) {
2829 pr_err("%s: vreg_set_level failed \n", __func__);
2830 goto fail_vreg_gp7;
2831 }
2832
2833 rc = vreg_enable(vreg_gp7);
2834 if (rc) {
2835 pr_err("%s: vreg_enable failed \n", __func__);
2836 goto fail_vreg_gp7;
2837 }
2838
2839 vreg_gp4 = vreg_get(NULL, "gp4");
2840 rc = vreg_set_level(vreg_gp4, 2600);
2841 if (rc) {
2842 pr_err("%s: vreg_set_level failed \n", __func__);
2843 goto fail_vreg_gp4;
2844 }
2845
2846 rc = vreg_enable(vreg_gp4);
2847 if (rc) {
2848 pr_err("%s: vreg_enable failed \n", __func__);
2849 goto fail_vreg_gp4;
2850 }
2851
2852 vreg_gp9 = vreg_get(NULL, "gp9");
2853 rc = vreg_set_level(vreg_gp9, 1800);
2854 if (rc) {
2855 pr_err("%s: vreg_set_level failed \n", __func__);
2856 goto fail_vreg_gp9;
2857 }
2858
2859 rc = vreg_enable(vreg_gp9);
2860 if (rc) {
2861 pr_err("%s: vreg_enable failed \n", __func__);
2862 goto fail_vreg_gp9;
2863 }
2864
2865 vreg_usb3_3 = vreg_get(NULL, "usb");
2866 rc = vreg_set_level(vreg_usb3_3, 3300);
2867 if (rc) {
2868 pr_err("%s: vreg_set_level failed \n", __func__);
2869 goto fail_vreg_3_3;
2870 }
2871
2872 rc = vreg_enable(vreg_usb3_3);
2873 if (rc) {
2874 pr_err("%s: vreg_enable failed \n", __func__);
2875 goto fail_vreg_3_3;
2876 }
2877
2878 /* Enable the chip select GPIO */
2879 gpio_set_value(OPTNAV_CHIP_SELECT, 1);
2880 gpio_set_value(OPTNAV_CHIP_SELECT, 0);
2881
2882 return 0;
2883
2884fail_vreg_3_3:
2885 vreg_disable(vreg_gp9);
2886fail_vreg_gp9:
2887 vreg_disable(vreg_gp4);
2888fail_vreg_gp4:
2889 vreg_disable(vreg_gp7);
2890fail_vreg_gp7:
2891 return rc;
2892}
2893
2894static void optnav_disable(void)
2895{
2896 vreg_disable(vreg_usb3_3);
2897 vreg_disable(vreg_gp9);
2898 vreg_disable(vreg_gp4);
2899 vreg_disable(vreg_gp7);
2900
2901 gpio_set_value(OPTNAV_CHIP_SELECT, 1);
2902}
2903
2904static struct ofn_atlab_platform_data optnav_data = {
2905 .gpio_setup = optnav_gpio_setup,
2906 .gpio_release = optnav_gpio_release,
2907 .optnav_on = optnav_enable,
2908 .optnav_off = optnav_disable,
2909 .rotate_xy = 0,
2910 .function1 = {
2911 .no_motion1_en = true,
2912 .touch_sensor_en = true,
2913 .ofn_en = true,
2914 .clock_select_khz = 1500,
2915 .cpi_selection = 1200,
2916 },
2917 .function2 = {
2918 .invert_y = false,
2919 .invert_x = true,
2920 .swap_x_y = false,
2921 .hold_a_b_en = true,
2922 .motion_filter_en = true,
2923 },
2924};
2925
2926static int hdmi_comm_power(int on, int show);
2927static int hdmi_init_irq(void);
2928static int hdmi_enable_5v(int on);
2929static int hdmi_core_power(int on, int show);
2930static int hdmi_cec_power(int on);
2931static bool hdmi_check_hdcp_hw_support(void);
2932
2933static struct msm_hdmi_platform_data adv7520_hdmi_data = {
2934 .irq = MSM_GPIO_TO_INT(18),
2935 .comm_power = hdmi_comm_power,
2936 .init_irq = hdmi_init_irq,
2937 .enable_5v = hdmi_enable_5v,
2938 .core_power = hdmi_core_power,
2939 .cec_power = hdmi_cec_power,
2940 .check_hdcp_hw_support = hdmi_check_hdcp_hw_support,
2941};
2942
2943#ifdef CONFIG_BOSCH_BMA150
2944static struct vreg *vreg_gp6;
2945static int sensors_ldo_enable(void)
2946{
2947 int rc;
2948
2949 /*
2950 * Enable the VREGs L8(gp7), L15(gp6)
2951 * for I2C communication with sensors.
2952 */
2953 pr_info("sensors_ldo_enable called!!\n");
2954 vreg_gp7 = vreg_get(NULL, "gp7");
2955 if (IS_ERR(vreg_gp7)) {
2956 pr_err("%s: vreg_get gp7 failed\n", __func__);
2957 rc = PTR_ERR(vreg_gp7);
2958 goto fail_gp7_get;
2959 }
2960
2961 rc = vreg_set_level(vreg_gp7, 1800);
2962 if (rc) {
2963 pr_err("%s: vreg_set_level gp7 failed\n", __func__);
2964 goto fail_gp7_level;
2965 }
2966
2967 rc = vreg_enable(vreg_gp7);
2968 if (rc) {
2969 pr_err("%s: vreg_enable gp7 failed\n", __func__);
2970 goto fail_gp7_level;
2971 }
2972
2973 vreg_gp6 = vreg_get(NULL, "gp6");
2974 if (IS_ERR(vreg_gp6)) {
2975 pr_err("%s: vreg_get gp6 failed\n", __func__);
2976 rc = PTR_ERR(vreg_gp6);
2977 goto fail_gp6_get;
2978 }
2979
2980 rc = vreg_set_level(vreg_gp6, 3050);
2981 if (rc) {
2982 pr_err("%s: vreg_set_level gp6 failed\n", __func__);
2983 goto fail_gp6_level;
2984 }
2985
2986 rc = vreg_enable(vreg_gp6);
2987 if (rc) {
2988 pr_err("%s: vreg_enable gp6 failed\n", __func__);
2989 goto fail_gp6_level;
2990 }
2991
2992 return 0;
2993
2994fail_gp6_level:
2995 vreg_put(vreg_gp6);
2996fail_gp6_get:
2997 vreg_disable(vreg_gp7);
2998fail_gp7_level:
2999 vreg_put(vreg_gp7);
3000fail_gp7_get:
3001 return rc;
3002}
3003
3004static void sensors_ldo_disable(void)
3005{
3006 pr_info("sensors_ldo_disable called!!\n");
3007 vreg_disable(vreg_gp6);
3008 vreg_put(vreg_gp6);
3009 vreg_disable(vreg_gp7);
3010 vreg_put(vreg_gp7);
3011}
3012static struct bma150_platform_data bma150_data = {
3013 .power_on = sensors_ldo_enable,
3014 .power_off = sensors_ldo_disable,
3015};
3016
3017static struct i2c_board_info bma150_board_info[] __initdata = {
3018 {
3019 I2C_BOARD_INFO("bma150", 0x38),
3020 .flags = I2C_CLIENT_WAKE,
3021 .irq = MSM_GPIO_TO_INT(BMA150_GPIO_INT),
3022 .platform_data = &bma150_data,
3023 },
3024};
3025#endif
3026
3027static struct i2c_board_info msm_i2c_board_info[] = {
3028 {
3029 I2C_BOARD_INFO("m33c01", OPTNAV_I2C_SLAVE_ADDR),
3030 .irq = MSM_GPIO_TO_INT(OPTNAV_IRQ),
3031 .platform_data = &optnav_data,
3032 },
3033 {
3034 I2C_BOARD_INFO("adv7520", ADV7520_I2C_ADDR),
3035 .platform_data = &adv7520_hdmi_data,
3036 },
3037};
3038
3039static struct i2c_board_info msm_marimba_board_info[] = {
3040 {
3041 I2C_BOARD_INFO("marimba", 0xc),
3042 .platform_data = &marimba_pdata,
3043 }
3044};
3045
3046
3047static struct msm_handset_platform_data hs_platform_data = {
3048 .hs_name = "7k_handset",
3049 .pwr_key_delay_ms = 500, /* 0 will disable end key */
3050};
3051
3052static struct platform_device hs_device = {
3053 .name = "msm-handset",
3054 .id = -1,
3055 .dev = {
3056 .platform_data = &hs_platform_data,
3057 },
3058};
3059
3060static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = {
3061 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
3062 .idle_supported = 1,
3063 .suspend_supported = 1,
3064 .idle_enabled = 1,
3065 .suspend_enabled = 1,
3066 .latency = 8594,
3067 .residency = 23740,
3068 },
3069 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
3070 .idle_supported = 1,
3071 .suspend_supported = 1,
3072 .idle_enabled = 1,
3073 .suspend_enabled = 1,
3074 .latency = 4594,
3075 .residency = 23740,
3076 },
3077 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE] = {
3078#ifdef CONFIG_MSM_STANDALONE_POWER_COLLAPSE
3079 .idle_supported = 1,
3080 .suspend_supported = 1,
3081 .idle_enabled = 1,
3082 .suspend_enabled = 0,
3083#else /*CONFIG_MSM_STANDALONE_POWER_COLLAPSE*/
3084 .idle_supported = 0,
3085 .suspend_supported = 0,
3086 .idle_enabled = 0,
3087 .suspend_enabled = 0,
3088#endif /*CONFIG_MSM_STANDALONE_POWER_COLLAPSE*/
3089 .latency = 500,
3090 .residency = 6000,
3091 },
3092 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
3093 .idle_supported = 1,
3094 .suspend_supported = 1,
3095 .idle_enabled = 0,
3096 .suspend_enabled = 1,
3097 .latency = 443,
3098 .residency = 1098,
3099 },
3100 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
3101 .idle_supported = 1,
3102 .suspend_supported = 1,
3103 .idle_enabled = 1,
3104 .suspend_enabled = 1,
3105 .latency = 2,
3106 .residency = 0,
3107 },
3108};
3109
3110static struct resource qsd_spi_resources[] = {
3111 {
3112 .name = "spi_irq_in",
3113 .start = INT_SPI_INPUT,
3114 .end = INT_SPI_INPUT,
3115 .flags = IORESOURCE_IRQ,
3116 },
3117 {
3118 .name = "spi_irq_out",
3119 .start = INT_SPI_OUTPUT,
3120 .end = INT_SPI_OUTPUT,
3121 .flags = IORESOURCE_IRQ,
3122 },
3123 {
3124 .name = "spi_irq_err",
3125 .start = INT_SPI_ERROR,
3126 .end = INT_SPI_ERROR,
3127 .flags = IORESOURCE_IRQ,
3128 },
3129 {
3130 .name = "spi_base",
3131 .start = 0xA8000000,
3132 .end = 0xA8000000 + SZ_4K - 1,
3133 .flags = IORESOURCE_MEM,
3134 },
3135 {
3136 .name = "spidm_channels",
3137 .flags = IORESOURCE_DMA,
3138 },
3139 {
3140 .name = "spidm_crci",
3141 .flags = IORESOURCE_DMA,
3142 },
3143};
3144
3145#define AMDH0_BASE_PHYS 0xAC200000
3146#define ADMH0_GP_CTL (ct_adm_base + 0x3D8)
3147static int msm_qsd_spi_dma_config(void)
3148{
3149 void __iomem *ct_adm_base = 0;
3150 u32 spi_mux = 0;
3151 int ret = 0;
3152
3153 ct_adm_base = ioremap(AMDH0_BASE_PHYS, PAGE_SIZE);
3154 if (!ct_adm_base) {
3155 pr_err("%s: Could not remap %x\n", __func__, AMDH0_BASE_PHYS);
3156 return -ENOMEM;
3157 }
3158
3159 spi_mux = (ioread32(ADMH0_GP_CTL) & (0x3 << 12)) >> 12;
3160
3161 qsd_spi_resources[4].start = DMOV_USB_CHAN;
3162 qsd_spi_resources[4].end = DMOV_TSIF_CHAN;
3163
3164 switch (spi_mux) {
3165 case (1):
3166 qsd_spi_resources[5].start = DMOV_HSUART1_RX_CRCI;
3167 qsd_spi_resources[5].end = DMOV_HSUART1_TX_CRCI;
3168 break;
3169 case (2):
3170 qsd_spi_resources[5].start = DMOV_HSUART2_RX_CRCI;
3171 qsd_spi_resources[5].end = DMOV_HSUART2_TX_CRCI;
3172 break;
3173 case (3):
3174 qsd_spi_resources[5].start = DMOV_CE_OUT_CRCI;
3175 qsd_spi_resources[5].end = DMOV_CE_IN_CRCI;
3176 break;
3177 default:
3178 ret = -ENOENT;
3179 }
3180
3181 iounmap(ct_adm_base);
3182
3183 return ret;
3184}
3185
3186static struct platform_device qsd_device_spi = {
3187 .name = "spi_qsd",
3188 .id = 0,
3189 .num_resources = ARRAY_SIZE(qsd_spi_resources),
3190 .resource = qsd_spi_resources,
3191};
3192
3193#ifdef CONFIG_SPI_QSD
3194static struct spi_board_info lcdc_sharp_spi_board_info[] __initdata = {
3195 {
3196 .modalias = "lcdc_sharp_ls038y7dx01",
3197 .mode = SPI_MODE_1,
3198 .bus_num = 0,
3199 .chip_select = 0,
3200 .max_speed_hz = 26331429,
3201 }
3202};
3203static struct spi_board_info lcdc_toshiba_spi_board_info[] __initdata = {
3204 {
3205 .modalias = "lcdc_toshiba_ltm030dd40",
3206 .mode = SPI_MODE_3|SPI_CS_HIGH,
3207 .bus_num = 0,
3208 .chip_select = 0,
3209 .max_speed_hz = 9963243,
3210 }
3211};
3212#endif
3213
3214static struct msm_gpio qsd_spi_gpio_config_data[] = {
3215 { GPIO_CFG(45, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_clk" },
3216 { GPIO_CFG(46, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_cs0" },
3217 { GPIO_CFG(47, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "spi_mosi" },
3218 { GPIO_CFG(48, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_miso" },
3219};
3220
3221static int msm_qsd_spi_gpio_config(void)
3222{
3223 return msm_gpios_request_enable(qsd_spi_gpio_config_data,
3224 ARRAY_SIZE(qsd_spi_gpio_config_data));
3225}
3226
3227static void msm_qsd_spi_gpio_release(void)
3228{
3229 msm_gpios_disable_free(qsd_spi_gpio_config_data,
3230 ARRAY_SIZE(qsd_spi_gpio_config_data));
3231}
3232
3233static struct msm_spi_platform_data qsd_spi_pdata = {
3234 .max_clock_speed = 26331429,
3235 .gpio_config = msm_qsd_spi_gpio_config,
3236 .gpio_release = msm_qsd_spi_gpio_release,
3237 .dma_config = msm_qsd_spi_dma_config,
3238};
3239
3240static void __init msm_qsd_spi_init(void)
3241{
3242 qsd_device_spi.dev.platform_data = &qsd_spi_pdata;
3243}
3244
3245#ifdef CONFIG_USB_EHCI_MSM_72K
3246static void msm_hsusb_vbus_power(unsigned phy_info, int on)
3247{
3248 int rc;
3249 static int vbus_is_on;
3250 struct pm8058_gpio usb_vbus = {
3251 .direction = PM_GPIO_DIR_OUT,
3252 .pull = PM_GPIO_PULL_NO,
3253 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3254 .output_value = 1,
3255 .vin_sel = 2,
3256 .out_strength = PM_GPIO_STRENGTH_MED,
3257 .function = PM_GPIO_FUNC_NORMAL,
3258 .inv_int_pol = 0,
3259 };
3260
3261 /* If VBUS is already on (or off), do nothing. */
3262 if (unlikely(on == vbus_is_on))
3263 return;
3264
3265 if (on) {
3266 rc = pm8058_gpio_config(36, &usb_vbus);
3267 if (rc) {
3268 pr_err("%s PMIC GPIO 36 write failed\n", __func__);
3269 return;
3270 }
3271 } else {
3272 gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS(36), 0);
3273 }
3274
3275 vbus_is_on = on;
3276}
3277
3278static struct msm_usb_host_platform_data msm_usb_host_pdata = {
3279 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
3280 .vbus_power = msm_hsusb_vbus_power,
3281 .power_budget = 180,
3282};
3283#endif
3284
3285#ifdef CONFIG_USB_MSM_OTG_72K
3286static int hsusb_rpc_connect(int connect)
3287{
3288 if (connect)
3289 return msm_hsusb_rpc_connect();
3290 else
3291 return msm_hsusb_rpc_close();
3292}
3293#endif
3294
3295#ifdef CONFIG_USB_MSM_OTG_72K
3296static struct vreg *vreg_3p3;
3297static int msm_hsusb_ldo_init(int init)
3298{
3299 uint32_t version = 0;
3300 int def_vol = 3400;
3301
3302 version = socinfo_get_version();
3303
3304 if (SOCINFO_VERSION_MAJOR(version) >= 2 &&
3305 SOCINFO_VERSION_MINOR(version) >= 1) {
3306 def_vol = 3075;
3307 pr_debug("%s: default voltage:%d\n", __func__, def_vol);
3308 }
3309
3310 if (init) {
3311 vreg_3p3 = vreg_get(NULL, "usb");
3312 if (IS_ERR(vreg_3p3))
3313 return PTR_ERR(vreg_3p3);
3314 vreg_set_level(vreg_3p3, def_vol);
3315 } else
3316 vreg_put(vreg_3p3);
3317
3318 return 0;
3319}
3320
3321static int msm_hsusb_ldo_enable(int enable)
3322{
3323 static int ldo_status;
3324
3325 if (!vreg_3p3 || IS_ERR(vreg_3p3))
3326 return -ENODEV;
3327
3328 if (ldo_status == enable)
3329 return 0;
3330
3331 ldo_status = enable;
3332
3333 if (enable)
3334 return vreg_enable(vreg_3p3);
3335
3336 return vreg_disable(vreg_3p3);
3337}
3338
3339static int msm_hsusb_ldo_set_voltage(int mV)
3340{
3341 static int cur_voltage = 3400;
3342
3343 if (!vreg_3p3 || IS_ERR(vreg_3p3))
3344 return -ENODEV;
3345
3346 if (cur_voltage == mV)
3347 return 0;
3348
3349 cur_voltage = mV;
3350
3351 pr_debug("%s: (%d)\n", __func__, mV);
3352
3353 return vreg_set_level(vreg_3p3, mV);
3354}
3355#endif
3356
3357#ifndef CONFIG_USB_EHCI_MSM_72K
3358static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init);
3359#endif
3360static struct msm_otg_platform_data msm_otg_pdata = {
3361 .rpc_connect = hsusb_rpc_connect,
3362
3363#ifndef CONFIG_USB_EHCI_MSM_72K
3364 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
3365#else
3366 .vbus_power = msm_hsusb_vbus_power,
3367#endif
3368 .core_clk = 1,
3369 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
3370 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
3371 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
3372 .se1_gating = SE1_GATING_DISABLE,
3373 .chg_vbus_draw = hsusb_chg_vbus_draw,
3374 .chg_connected = hsusb_chg_connected,
3375 .chg_init = hsusb_chg_init,
3376 .ldo_enable = msm_hsusb_ldo_enable,
3377 .ldo_init = msm_hsusb_ldo_init,
3378 .ldo_set_voltage = msm_hsusb_ldo_set_voltage,
3379};
3380
3381#ifdef CONFIG_USB_GADGET
3382static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
3383 .is_phy_status_timer_on = 1,
3384};
3385#endif
3386#ifndef CONFIG_USB_EHCI_MSM_72K
3387typedef void (*notify_vbus_state) (int);
3388notify_vbus_state notify_vbus_state_func_ptr;
3389int vbus_on_irq;
3390static irqreturn_t pmic_vbus_on_irq(int irq, void *data)
3391{
3392 pr_info("%s: vbus notification from pmic\n", __func__);
3393
3394 (*notify_vbus_state_func_ptr) (1);
3395
3396 return IRQ_HANDLED;
3397}
3398static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
3399{
3400 int ret;
3401
3402 if (init) {
3403 if (!callback)
3404 return -ENODEV;
3405
3406 notify_vbus_state_func_ptr = callback;
3407 vbus_on_irq = platform_get_irq_byname(&msm_device_otg,
3408 "vbus_on");
3409 if (vbus_on_irq <= 0) {
3410 pr_err("%s: unable to get vbus on irq\n", __func__);
3411 return -ENODEV;
3412 }
3413
3414 ret = request_any_context_irq(vbus_on_irq, pmic_vbus_on_irq,
3415 IRQF_TRIGGER_RISING, "msm_otg_vbus_on", NULL);
3416 if (ret < 0) {
3417 pr_info("%s: request_irq for vbus_on"
3418 "interrupt failed\n", __func__);
3419 return ret;
3420 }
3421 msm_otg_pdata.pmic_vbus_irq = vbus_on_irq;
3422 return 0;
3423 } else {
3424 free_irq(vbus_on_irq, 0);
3425 notify_vbus_state_func_ptr = NULL;
3426 return 0;
3427 }
3428}
3429#endif
3430
3431static struct android_pmem_platform_data android_pmem_pdata = {
3432 .name = "pmem",
3433 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
3434 .cached = 1,
3435 .memory_type = MEMTYPE_EBI0,
3436};
3437
3438static struct platform_device android_pmem_device = {
3439 .name = "android_pmem",
3440 .id = 0,
3441 .dev = { .platform_data = &android_pmem_pdata },
3442};
3443
3444#ifndef CONFIG_SPI_QSD
3445static int lcdc_gpio_array_num[] = {
3446 45, /* spi_clk */
3447 46, /* spi_cs */
3448 47, /* spi_mosi */
3449 48, /* spi_miso */
3450 };
3451
3452static struct msm_gpio lcdc_gpio_config_data[] = {
3453 { GPIO_CFG(45, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_clk" },
3454 { GPIO_CFG(46, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_cs0" },
3455 { GPIO_CFG(47, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_mosi" },
3456 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_miso" },
3457};
3458
3459static void lcdc_config_gpios(int enable)
3460{
3461 if (enable) {
3462 msm_gpios_request_enable(lcdc_gpio_config_data,
3463 ARRAY_SIZE(
3464 lcdc_gpio_config_data));
3465 } else
3466 msm_gpios_disable_free(lcdc_gpio_config_data,
3467 ARRAY_SIZE(
3468 lcdc_gpio_config_data));
3469}
3470#endif
3471
3472static struct msm_panel_common_pdata lcdc_sharp_panel_data = {
3473#ifndef CONFIG_SPI_QSD
3474 .panel_config_gpio = lcdc_config_gpios,
3475 .gpio_num = lcdc_gpio_array_num,
3476#endif
3477 .gpio = 2, /* LPG PMIC_GPIO26 channel number */
3478};
3479
3480static struct platform_device lcdc_sharp_panel_device = {
3481 .name = "lcdc_sharp_wvga",
3482 .id = 0,
3483 .dev = {
3484 .platform_data = &lcdc_sharp_panel_data,
3485 }
3486};
3487
3488static struct msm_gpio dtv_panel_irq_gpios[] = {
3489 { GPIO_CFG(18, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA),
3490 "hdmi_int" },
3491};
3492
3493static struct msm_gpio dtv_panel_gpios[] = {
3494 { GPIO_CFG(120, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_mclk" },
3495 { GPIO_CFG(121, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_sd0" },
3496 { GPIO_CFG(122, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_sd1" },
3497 { GPIO_CFG(123, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "wca_sd2" },
3498 { GPIO_CFG(124, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), "dtv_pclk" },
3499 { GPIO_CFG(125, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_en" },
3500 { GPIO_CFG(126, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_vsync" },
3501 { GPIO_CFG(127, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_hsync" },
3502 { GPIO_CFG(128, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data0" },
3503 { GPIO_CFG(129, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data1" },
3504 { GPIO_CFG(130, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data2" },
3505 { GPIO_CFG(131, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data3" },
3506 { GPIO_CFG(132, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data4" },
3507 { GPIO_CFG(160, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data5" },
3508 { GPIO_CFG(161, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data6" },
3509 { GPIO_CFG(162, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data7" },
3510 { GPIO_CFG(163, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data8" },
3511 { GPIO_CFG(164, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_data9" },
3512 { GPIO_CFG(165, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat10" },
3513 { GPIO_CFG(166, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat11" },
3514 { GPIO_CFG(167, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat12" },
3515 { GPIO_CFG(168, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat13" },
3516 { GPIO_CFG(169, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat14" },
3517 { GPIO_CFG(170, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat15" },
3518 { GPIO_CFG(171, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat16" },
3519 { GPIO_CFG(172, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat17" },
3520 { GPIO_CFG(173, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat18" },
3521 { GPIO_CFG(174, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat19" },
3522 { GPIO_CFG(175, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat20" },
3523 { GPIO_CFG(176, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat21" },
3524 { GPIO_CFG(177, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat22" },
3525 { GPIO_CFG(178, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA), "dtv_dat23" },
3526};
3527
3528
3529#ifdef HDMI_RESET
3530static unsigned dtv_reset_gpio =
3531 GPIO_CFG(37, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA);
3532#endif
3533
3534static int gpio_set(const char *label, const char *name, int level, int on)
3535{
3536 struct vreg *vreg = vreg_get(NULL, label);
3537 int rc;
3538
3539 if (IS_ERR(vreg)) {
3540 rc = PTR_ERR(vreg);
3541 pr_err("%s: vreg %s get failed (%d)\n",
3542 __func__, name, rc);
3543 return rc;
3544 }
3545
3546 rc = vreg_set_level(vreg, level);
3547 if (rc) {
3548 pr_err("%s: vreg %s set level failed (%d)\n",
3549 __func__, name, rc);
3550 return rc;
3551 }
3552
3553 if (on)
3554 rc = vreg_enable(vreg);
3555 else
3556 rc = vreg_disable(vreg);
3557 if (rc)
3558 pr_err("%s: vreg %s enable failed (%d)\n",
3559 __func__, name, rc);
3560 return rc;
3561}
3562
3563#if defined(CONFIG_FB_MSM_HDMI_ADV7520_PANEL) || defined(CONFIG_BOSCH_BMA150)
3564/* there is an i2c address conflict between adv7520 and bma150 sensor after
3565 * power up on fluid. As a solution, the default address of adv7520's packet
3566 * memory is changed as soon as possible
3567 */
3568static int __init fluid_i2c_address_fixup(void)
3569{
3570 unsigned char wBuff[16];
3571 unsigned char rBuff[16];
3572 struct i2c_msg msgs[3];
3573 int res;
3574 int rc = -EINVAL;
3575 struct vreg *vreg_ldo8;
3576 struct i2c_adapter *adapter;
3577
3578 if (machine_is_msm7x30_fluid()) {
3579 adapter = i2c_get_adapter(0);
3580 if (!adapter) {
3581 pr_err("%s: invalid i2c adapter\n", __func__);
3582 return PTR_ERR(adapter);
3583 }
3584
3585 /* turn on LDO8 */
3586 vreg_ldo8 = vreg_get(NULL, "gp7");
3587 if (!vreg_ldo8) {
3588 pr_err("%s: VREG L8 get failed\n", __func__);
3589 goto adapter_put;
3590 }
3591
3592 rc = vreg_set_level(vreg_ldo8, 1800);
3593 if (rc) {
3594 pr_err("%s: VREG L8 set failed\n", __func__);
3595 goto ldo8_put;
3596 }
3597
3598 rc = vreg_enable(vreg_ldo8);
3599 if (rc) {
3600 pr_err("%s: VREG L8 enable failed\n", __func__);
3601 goto ldo8_put;
3602 }
3603
3604 /* change packet memory address to 0x74 */
3605 wBuff[0] = 0x45;
3606 wBuff[1] = 0x74;
3607
3608 msgs[0].addr = ADV7520_I2C_ADDR;
3609 msgs[0].flags = 0;
3610 msgs[0].buf = (unsigned char *) wBuff;
3611 msgs[0].len = 2;
3612
3613 res = i2c_transfer(adapter, msgs, 1);
3614 if (res != 1) {
3615 pr_err("%s: error writing adv7520\n", __func__);
3616 goto ldo8_disable;
3617 }
3618
3619 /* powerdown adv7520 using bit 6 */
3620 /* i2c read first */
3621 wBuff[0] = 0x41;
3622
3623 msgs[0].addr = ADV7520_I2C_ADDR;
3624 msgs[0].flags = 0;
3625 msgs[0].buf = (unsigned char *) wBuff;
3626 msgs[0].len = 1;
3627
3628 msgs[1].addr = ADV7520_I2C_ADDR;
3629 msgs[1].flags = I2C_M_RD;
3630 msgs[1].buf = rBuff;
3631 msgs[1].len = 1;
3632 res = i2c_transfer(adapter, msgs, 2);
3633 if (res != 2) {
3634 pr_err("%s: error reading adv7520\n", __func__);
3635 goto ldo8_disable;
3636 }
3637
3638 /* i2c write back */
3639 wBuff[0] = 0x41;
3640 wBuff[1] = rBuff[0] | 0x40;
3641
3642 msgs[0].addr = ADV7520_I2C_ADDR;
3643 msgs[0].flags = 0;
3644 msgs[0].buf = (unsigned char *) wBuff;
3645 msgs[0].len = 2;
3646
3647 res = i2c_transfer(adapter, msgs, 1);
3648 if (res != 1) {
3649 pr_err("%s: error writing adv7520\n", __func__);
3650 goto ldo8_disable;
3651 }
3652
3653 /* for successful fixup, we release the i2c adapter */
3654 /* but leave ldo8 on so that the adv7520 is not repowered */
3655 i2c_put_adapter(adapter);
3656 pr_info("%s: fluid i2c address conflict resolved\n", __func__);
3657 }
3658 return 0;
3659
3660ldo8_disable:
3661 vreg_disable(vreg_ldo8);
3662ldo8_put:
3663 vreg_put(vreg_ldo8);
3664adapter_put:
3665 i2c_put_adapter(adapter);
3666 return rc;
3667}
3668fs_initcall_sync(fluid_i2c_address_fixup);
3669#endif
3670
3671static int hdmi_comm_power(int on, int show)
3672{
3673 int rc = gpio_set("gp7", "LDO8", 1800, on);
3674 if (rc) {
3675 pr_warning("hdmi_comm_power: LDO8 gpio failed: rc=%d\n", rc);
3676 return rc;
3677 }
3678 rc = gpio_set("gp4", "LDO10", 2600, on);
3679 if (rc)
3680 pr_warning("hdmi_comm_power: LDO10 gpio failed: rc=%d\n", rc);
3681 if (show)
3682 pr_info("%s: i2c comm: %d <LDO8+LDO10>\n", __func__, on);
3683 return rc;
3684}
3685
3686static int hdmi_init_irq(void)
3687{
3688 int rc = msm_gpios_enable(dtv_panel_irq_gpios,
3689 ARRAY_SIZE(dtv_panel_irq_gpios));
3690 if (rc < 0) {
3691 pr_err("%s: gpio enable failed: %d\n", __func__, rc);
3692 return rc;
3693 }
3694 pr_info("%s\n", __func__);
3695
3696 return 0;
3697}
3698
3699static int hdmi_enable_5v(int on)
3700{
3701 int pmic_gpio_hdmi_5v_en ;
3702
3703 if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa() ||
3704 machine_is_msm7x30_fluid())
3705 pmic_gpio_hdmi_5v_en = PMIC_GPIO_HDMI_5V_EN_V2 ;
3706 else
3707 pmic_gpio_hdmi_5v_en = PMIC_GPIO_HDMI_5V_EN_V3 ;
3708
3709 pr_info("%s: %d\n", __func__, on);
3710 if (on) {
3711 int rc;
3712 rc = gpio_request(PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en),
3713 "hdmi_5V_en");
3714 if (rc) {
3715 pr_err("%s PMIC_GPIO_HDMI_5V_EN gpio_request failed\n",
3716 __func__);
3717 return rc;
3718 }
3719 gpio_set_value_cansleep(
3720 PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en), 1);
3721 } else {
3722 gpio_set_value_cansleep(
3723 PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en), 0);
3724 gpio_free(PM8058_GPIO_PM_TO_SYS(pmic_gpio_hdmi_5v_en));
3725 }
3726 return 0;
3727}
3728
3729static int hdmi_core_power(int on, int show)
3730{
3731 if (show)
3732 pr_info("%s: %d <LDO8>\n", __func__, on);
3733 return gpio_set("gp7", "LDO8", 1800, on);
3734}
3735
3736static int hdmi_cec_power(int on)
3737{
3738 pr_info("%s: %d <LDO17>\n", __func__, on);
3739 return gpio_set("gp11", "LDO17", 2600, on);
3740}
3741
3742static bool hdmi_check_hdcp_hw_support(void)
3743{
3744 if (machine_is_msm7x30_fluid())
3745 return false;
3746 else
3747 return true;
3748}
3749
3750static int dtv_panel_power(int on)
3751{
3752 int flag_on = !!on;
3753 static int dtv_power_save_on;
3754 int rc;
3755
3756 if (dtv_power_save_on == flag_on)
3757 return 0;
3758
3759 dtv_power_save_on = flag_on;
3760 pr_info("%s: %d\n", __func__, on);
3761
3762#ifdef HDMI_RESET
3763 if (on) {
3764 /* reset Toshiba WeGA chip -- toggle reset pin -- gpio_180 */
3765 rc = gpio_tlmm_config(dtv_reset_gpio, GPIO_CFG_ENABLE);
3766 if (rc) {
3767 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
3768 __func__, dtv_reset_gpio, rc);
3769 return rc;
3770 }
3771
3772 /* bring reset line low to hold reset*/
3773 gpio_set_value(37, 0);
3774 }
3775#endif
3776
3777 if (on) {
3778 rc = msm_gpios_enable(dtv_panel_gpios,
3779 ARRAY_SIZE(dtv_panel_gpios));
3780 if (rc < 0) {
3781 printk(KERN_ERR "%s: gpio enable failed: %d\n",
3782 __func__, rc);
3783 return rc;
3784 }
3785 } else {
3786 rc = msm_gpios_disable(dtv_panel_gpios,
3787 ARRAY_SIZE(dtv_panel_gpios));
3788 if (rc < 0) {
3789 printk(KERN_ERR "%s: gpio disable failed: %d\n",
3790 __func__, rc);
3791 return rc;
3792 }
3793 }
3794
3795 mdelay(5); /* ensure power is stable */
3796
3797#ifdef HDMI_RESET
3798 if (on) {
3799 gpio_set_value(37, 1); /* bring reset line high */
3800 mdelay(10); /* 10 msec before IO can be accessed */
3801 }
3802#endif
3803
3804 return rc;
3805}
3806
3807static struct lcdc_platform_data dtv_pdata = {
3808 .lcdc_power_save = dtv_panel_power,
3809};
3810
3811static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
3812 .inject_rx_on_wakeup = 1,
3813 .rx_to_inject = 0xFD,
3814};
3815
3816static struct resource msm_fb_resources[] = {
3817 {
3818 .flags = IORESOURCE_DMA,
3819 }
3820};
3821
3822static int msm_fb_detect_panel(const char *name)
3823{
3824 if (machine_is_msm7x30_fluid()) {
3825 if (!strcmp(name, "lcdc_sharp_wvga_pt"))
3826 return 0;
3827 } else {
3828 if (!strncmp(name, "mddi_toshiba_wvga_pt", 20))
3829 return -EPERM;
3830 else if (!strncmp(name, "lcdc_toshiba_wvga_pt", 20))
3831 return 0;
3832 else if (!strcmp(name, "mddi_orise"))
3833 return -EPERM;
3834 else if (!strcmp(name, "mddi_quickvx"))
3835 return -EPERM;
3836 }
3837 return -ENODEV;
3838}
3839
3840static struct msm_fb_platform_data msm_fb_pdata = {
3841 .detect_client = msm_fb_detect_panel,
3842 .mddi_prescan = 1,
3843};
3844
3845static struct platform_device msm_fb_device = {
3846 .name = "msm_fb",
3847 .id = 0,
3848 .num_resources = ARRAY_SIZE(msm_fb_resources),
3849 .resource = msm_fb_resources,
3850 .dev = {
3851 .platform_data = &msm_fb_pdata,
3852 }
3853};
3854
3855static struct platform_device msm_migrate_pages_device = {
3856 .name = "msm_migrate_pages",
3857 .id = -1,
3858};
3859
3860static struct android_pmem_platform_data android_pmem_adsp_pdata = {
3861 .name = "pmem_adsp",
3862 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
3863 .cached = 0,
3864 .memory_type = MEMTYPE_EBI0,
3865};
3866
3867static struct android_pmem_platform_data android_pmem_audio_pdata = {
3868 .name = "pmem_audio",
3869 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
3870 .cached = 0,
3871 .memory_type = MEMTYPE_EBI0,
3872};
3873
3874static struct platform_device android_pmem_adsp_device = {
3875 .name = "android_pmem",
3876 .id = 2,
3877 .dev = { .platform_data = &android_pmem_adsp_pdata },
3878};
3879
3880static struct platform_device android_pmem_audio_device = {
3881 .name = "android_pmem",
3882 .id = 4,
3883 .dev = { .platform_data = &android_pmem_audio_pdata },
3884};
3885
3886#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3887 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
3888 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3889 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3890
3891#define QCE_SIZE 0x10000
3892#define QCE_0_BASE 0xA8400000
3893
3894#define QCE_HW_KEY_SUPPORT 1
3895#define QCE_SHA_HMAC_SUPPORT 0
3896#define QCE_SHARE_CE_RESOURCE 0
3897#define QCE_CE_SHARED 0
3898
3899static struct resource qcrypto_resources[] = {
3900 [0] = {
3901 .start = QCE_0_BASE,
3902 .end = QCE_0_BASE + QCE_SIZE - 1,
3903 .flags = IORESOURCE_MEM,
3904 },
3905 [1] = {
3906 .name = "crypto_channels",
3907 .start = DMOV_CE_IN_CHAN,
3908 .end = DMOV_CE_OUT_CHAN,
3909 .flags = IORESOURCE_DMA,
3910 },
3911 [2] = {
3912 .name = "crypto_crci_in",
3913 .start = DMOV_CE_IN_CRCI,
3914 .end = DMOV_CE_IN_CRCI,
3915 .flags = IORESOURCE_DMA,
3916 },
3917 [3] = {
3918 .name = "crypto_crci_out",
3919 .start = DMOV_CE_OUT_CRCI,
3920 .end = DMOV_CE_OUT_CRCI,
3921 .flags = IORESOURCE_DMA,
3922 },
3923 [4] = {
3924 .name = "crypto_crci_hash",
3925 .start = DMOV_CE_HASH_CRCI,
3926 .end = DMOV_CE_HASH_CRCI,
3927 .flags = IORESOURCE_DMA,
3928 },
3929};
3930
3931static struct resource qcedev_resources[] = {
3932 [0] = {
3933 .start = QCE_0_BASE,
3934 .end = QCE_0_BASE + QCE_SIZE - 1,
3935 .flags = IORESOURCE_MEM,
3936 },
3937 [1] = {
3938 .name = "crypto_channels",
3939 .start = DMOV_CE_IN_CHAN,
3940 .end = DMOV_CE_OUT_CHAN,
3941 .flags = IORESOURCE_DMA,
3942 },
3943 [2] = {
3944 .name = "crypto_crci_in",
3945 .start = DMOV_CE_IN_CRCI,
3946 .end = DMOV_CE_IN_CRCI,
3947 .flags = IORESOURCE_DMA,
3948 },
3949 [3] = {
3950 .name = "crypto_crci_out",
3951 .start = DMOV_CE_OUT_CRCI,
3952 .end = DMOV_CE_OUT_CRCI,
3953 .flags = IORESOURCE_DMA,
3954 },
3955 [4] = {
3956 .name = "crypto_crci_hash",
3957 .start = DMOV_CE_HASH_CRCI,
3958 .end = DMOV_CE_HASH_CRCI,
3959 .flags = IORESOURCE_DMA,
3960 },
3961};
3962
3963#endif
3964
3965#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3966 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3967
3968static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
3969 .ce_shared = QCE_CE_SHARED,
3970 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
3971 .hw_key_support = QCE_HW_KEY_SUPPORT,
3972 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
3973};
3974
3975static struct platform_device qcrypto_device = {
3976 .name = "qcrypto",
3977 .id = 0,
3978 .num_resources = ARRAY_SIZE(qcrypto_resources),
3979 .resource = qcrypto_resources,
3980 .dev = {
3981 .coherent_dma_mask = DMA_BIT_MASK(32),
3982 .platform_data = &qcrypto_ce_hw_suppport,
3983 },
3984};
3985#endif
3986
3987#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3988 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3989
3990static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
3991 .ce_shared = QCE_CE_SHARED,
3992 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
3993 .hw_key_support = QCE_HW_KEY_SUPPORT,
3994 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
3995};
3996static struct platform_device qcedev_device = {
3997 .name = "qce",
3998 .id = 0,
3999 .num_resources = ARRAY_SIZE(qcedev_resources),
4000 .resource = qcedev_resources,
4001 .dev = {
4002 .coherent_dma_mask = DMA_BIT_MASK(32),
4003 .platform_data = &qcedev_ce_hw_suppport,
4004 },
4005};
4006#endif
4007
4008static int mddi_toshiba_pmic_bl(int level)
4009{
4010 int ret = -EPERM;
4011
4012 ret = pmic_set_led_intensity(LED_LCD, level);
4013
4014 if (ret)
4015 printk(KERN_WARNING "%s: can't set lcd backlight!\n",
4016 __func__);
4017 return ret;
4018}
4019
4020static struct msm_panel_common_pdata mddi_toshiba_pdata = {
4021 .pmic_backlight = mddi_toshiba_pmic_bl,
4022};
4023
4024static struct platform_device mddi_toshiba_device = {
4025 .name = "mddi_toshiba",
4026 .id = 0,
4027 .dev = {
4028 .platform_data = &mddi_toshiba_pdata,
4029 }
4030};
4031
4032static unsigned wega_reset_gpio =
4033 GPIO_CFG(180, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA);
4034
4035static struct msm_gpio fluid_vee_reset_gpio[] = {
4036 { GPIO_CFG(20, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "vee_reset" },
4037};
4038
4039static unsigned char quickvx_mddi_client = 1, other_mddi_client = 1;
4040static unsigned char quickvx_ldo_enabled;
4041
4042static unsigned quickvx_vlp_gpio =
4043 GPIO_CFG(97, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA);
4044
4045static struct pm8058_gpio pmic_quickvx_clk_gpio = {
4046 .direction = PM_GPIO_DIR_OUT,
4047 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
4048 .output_value = 1,
4049 .pull = PM_GPIO_PULL_NO,
4050 .vin_sel = PM_GPIO_VIN_S3,
4051 .out_strength = PM_GPIO_STRENGTH_HIGH,
4052 .function = PM_GPIO_FUNC_2,
4053};
4054
4055static int display_common_power(int on)
4056{
4057 int rc = 0, flag_on = !!on;
4058 static int display_common_power_save_on;
4059 struct vreg *vreg_ldo12, *vreg_ldo15 = NULL, *vreg_ldo6;
4060 struct vreg *vreg_ldo20, *vreg_ldo16, *vreg_ldo8 = NULL;
4061
4062 if (display_common_power_save_on == flag_on)
4063 return 0;
4064
4065 display_common_power_save_on = flag_on;
4066
4067 if (on) {
4068 /* reset Toshiba WeGA chip -- toggle reset pin -- gpio_180 */
4069 rc = gpio_tlmm_config(wega_reset_gpio, GPIO_CFG_ENABLE);
4070 if (rc) {
4071 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
4072 __func__, wega_reset_gpio, rc);
4073 return rc;
4074 }
4075
4076 /* bring reset line low to hold reset*/
4077 gpio_set_value(180, 0);
4078
4079 if (quickvx_mddi_client) {
4080 /* QuickVX chip -- VLP pin -- gpio 97 */
4081 rc = gpio_tlmm_config(quickvx_vlp_gpio,
4082 GPIO_CFG_ENABLE);
4083 if (rc) {
4084 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
4085 __func__, quickvx_vlp_gpio, rc);
4086 return rc;
4087 }
4088
4089 /* bring QuickVX VLP line low */
4090 gpio_set_value(97, 0);
4091
4092 rc = pm8058_gpio_config(PMIC_GPIO_QUICKVX_CLK,
4093 &pmic_quickvx_clk_gpio);
4094 if (rc) {
4095 pr_err("%s: pm8058_gpio_config(%#x)=%d\n",
4096 __func__, PMIC_GPIO_QUICKVX_CLK + 1,
4097 rc);
4098 return rc;
4099 }
4100
4101 gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS(
4102 PMIC_GPIO_QUICKVX_CLK), 0);
4103 }
4104 }
4105
4106 /* Toshiba WeGA power -- has 3 power source */
4107 /* 1.5V -- LDO20*/
4108 vreg_ldo20 = vreg_get(NULL, "gp13");
4109
4110 if (IS_ERR(vreg_ldo20)) {
4111 rc = PTR_ERR(vreg_ldo20);
4112 pr_err("%s: gp13 vreg get failed (%d)\n",
4113 __func__, rc);
4114 return rc;
4115 }
4116
4117 /* 1.8V -- LDO12 */
4118 vreg_ldo12 = vreg_get(NULL, "gp9");
4119
4120 if (IS_ERR(vreg_ldo12)) {
4121 rc = PTR_ERR(vreg_ldo12);
4122 pr_err("%s: gp9 vreg get failed (%d)\n",
4123 __func__, rc);
4124 return rc;
4125 }
4126
4127 /* 2.6V -- LDO16 */
4128 vreg_ldo16 = vreg_get(NULL, "gp10");
4129
4130 if (IS_ERR(vreg_ldo16)) {
4131 rc = PTR_ERR(vreg_ldo16);
4132 pr_err("%s: gp10 vreg get failed (%d)\n",
4133 __func__, rc);
4134 return rc;
4135 }
4136
4137 /* 3.075V -- LDO6 */
4138 vreg_ldo6 = vreg_get(NULL, "usb");
4139
4140 if (IS_ERR(vreg_ldo6)) {
4141 rc = PTR_ERR(vreg_ldo6);
4142 pr_err("%s: usb vreg get failed (%d)\n",
4143 __func__, rc);
4144 return rc;
4145 }
4146
4147 if (machine_is_msm7x30_fluid()) {
4148 /* 1.8V -- LDO8 */
4149 vreg_ldo8 = vreg_get(NULL, "gp7");
4150
4151 if (IS_ERR(vreg_ldo8)) {
4152 rc = PTR_ERR(vreg_ldo8);
4153 pr_err("%s: gp7 vreg get failed (%d)\n",
4154 __func__, rc);
4155 return rc;
4156 }
4157 } else {
4158 /* lcd panel power */
4159 /* 3.1V -- LDO15 */
4160 vreg_ldo15 = vreg_get(NULL, "gp6");
4161
4162 if (IS_ERR(vreg_ldo15)) {
4163 rc = PTR_ERR(vreg_ldo15);
4164 pr_err("%s: gp6 vreg get failed (%d)\n",
4165 __func__, rc);
4166 return rc;
4167 }
4168 }
4169
4170 /* For QuickLogic chip, LDO20 requires 1.8V */
4171 /* Toshiba chip requires 1.5V, but can tolerate 1.8V since max is 3V */
4172 if (quickvx_mddi_client)
4173 rc = vreg_set_level(vreg_ldo20, 1800);
4174 else
4175 rc = vreg_set_level(vreg_ldo20, 1500);
4176 if (rc) {
4177 pr_err("%s: vreg LDO20 set level failed (%d)\n",
4178 __func__, rc);
4179 return rc;
4180 }
4181
4182 rc = vreg_set_level(vreg_ldo12, 1800);
4183 if (rc) {
4184 pr_err("%s: vreg LDO12 set level failed (%d)\n",
4185 __func__, rc);
4186 return rc;
4187 }
4188
4189 if (other_mddi_client) {
4190 rc = vreg_set_level(vreg_ldo16, 2600);
4191 if (rc) {
4192 pr_err("%s: vreg LDO16 set level failed (%d)\n",
4193 __func__, rc);
4194 return rc;
4195 }
4196 }
4197
4198 if (quickvx_mddi_client) {
4199 rc = vreg_set_level(vreg_ldo6, 3075);
4200 if (rc) {
4201 pr_err("%s: vreg LDO6 set level failed (%d)\n",
4202 __func__, rc);
4203 return rc;
4204 }
4205 }
4206
4207 if (machine_is_msm7x30_fluid()) {
4208 rc = vreg_set_level(vreg_ldo8, 1800);
4209 if (rc) {
4210 pr_err("%s: vreg LDO8 set level failed (%d)\n",
4211 __func__, rc);
4212 return rc;
4213 }
4214 } else {
4215 rc = vreg_set_level(vreg_ldo15, 3100);
4216 if (rc) {
4217 pr_err("%s: vreg LDO15 set level failed (%d)\n",
4218 __func__, rc);
4219 return rc;
4220 }
4221 }
4222
4223 if (on) {
4224 rc = vreg_enable(vreg_ldo20);
4225 if (rc) {
4226 pr_err("%s: LDO20 vreg enable failed (%d)\n",
4227 __func__, rc);
4228 return rc;
4229 }
4230
4231 rc = vreg_enable(vreg_ldo12);
4232 if (rc) {
4233 pr_err("%s: LDO12 vreg enable failed (%d)\n",
4234 __func__, rc);
4235 return rc;
4236 }
4237
4238 if (other_mddi_client) {
4239 rc = vreg_enable(vreg_ldo16);
4240 if (rc) {
4241 pr_err("%s: LDO16 vreg enable failed (%d)\n",
4242 __func__, rc);
4243 return rc;
4244 }
4245 }
4246
4247 if (quickvx_mddi_client && quickvx_ldo_enabled) {
4248 /* Disable LDO6 during display ON */
4249 rc = vreg_disable(vreg_ldo6);
4250 if (rc) {
4251 pr_err("%s: LDO6 vreg disable failed (%d)\n",
4252 __func__, rc);
4253 return rc;
4254 }
4255 quickvx_ldo_enabled = 0;
4256 }
4257
4258 if (machine_is_msm7x30_fluid()) {
4259 rc = vreg_enable(vreg_ldo8);
4260 if (rc) {
4261 pr_err("%s: LDO8 vreg enable failed (%d)\n",
4262 __func__, rc);
4263 return rc;
4264 }
4265 } else {
4266 rc = vreg_enable(vreg_ldo15);
4267 if (rc) {
4268 pr_err("%s: LDO15 vreg enable failed (%d)\n",
4269 __func__, rc);
4270 return rc;
4271 }
4272 }
4273
4274 mdelay(5); /* ensure power is stable */
4275
4276 if (machine_is_msm7x30_fluid()) {
4277 rc = msm_gpios_request_enable(fluid_vee_reset_gpio,
4278 ARRAY_SIZE(fluid_vee_reset_gpio));
4279 if (rc)
4280 pr_err("%s gpio_request_enable failed rc=%d\n",
4281 __func__, rc);
4282 else {
4283 /* assert vee reset_n */
4284 gpio_set_value(20, 1);
4285 gpio_set_value(20, 0);
4286 mdelay(1);
4287 gpio_set_value(20, 1);
4288 }
4289 }
4290
4291 gpio_set_value(180, 1); /* bring reset line high */
4292 mdelay(10); /* 10 msec before IO can be accessed */
4293
4294 if (quickvx_mddi_client) {
4295 gpio_set_value(97, 1);
4296 msleep(2);
4297 gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS(
4298 PMIC_GPIO_QUICKVX_CLK), 1);
4299 msleep(2);
4300 }
4301
4302 rc = pmapp_display_clock_config(1);
4303 if (rc) {
4304 pr_err("%s pmapp_display_clock_config rc=%d\n",
4305 __func__, rc);
4306 return rc;
4307 }
4308
4309 } else {
4310 rc = vreg_disable(vreg_ldo20);
4311 if (rc) {
4312 pr_err("%s: LDO20 vreg disable failed (%d)\n",
4313 __func__, rc);
4314 return rc;
4315 }
4316
4317
4318 if (other_mddi_client) {
4319 rc = vreg_disable(vreg_ldo16);
4320 if (rc) {
4321 pr_err("%s: LDO16 vreg disable failed (%d)\n",
4322 __func__, rc);
4323 return rc;
4324 }
4325 }
4326
4327 if (quickvx_mddi_client && !quickvx_ldo_enabled) {
4328 /* Enable LDO6 during display OFF for
4329 Quicklogic chip to sleep with data retention */
4330 rc = vreg_enable(vreg_ldo6);
4331 if (rc) {
4332 pr_err("%s: LDO6 vreg enable failed (%d)\n",
4333 __func__, rc);
4334 return rc;
4335 }
4336 quickvx_ldo_enabled = 1;
4337 }
4338
4339 gpio_set_value(180, 0); /* bring reset line low */
4340
4341 if (quickvx_mddi_client) {
4342 gpio_set_value(97, 0);
4343 gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS(
4344 PMIC_GPIO_QUICKVX_CLK), 0);
4345 }
4346
4347 if (machine_is_msm7x30_fluid()) {
4348 rc = vreg_disable(vreg_ldo8);
4349 if (rc) {
4350 pr_err("%s: LDO8 vreg disable failed (%d)\n",
4351 __func__, rc);
4352 return rc;
4353 }
4354 } else {
4355 rc = vreg_disable(vreg_ldo15);
4356 if (rc) {
4357 pr_err("%s: LDO15 vreg disable failed (%d)\n",
4358 __func__, rc);
4359 return rc;
4360 }
4361 }
4362
4363 mdelay(5); /* ensure power is stable */
4364
4365 rc = vreg_disable(vreg_ldo12);
4366 if (rc) {
4367 pr_err("%s: LDO12 vreg disable failed (%d)\n",
4368 __func__, rc);
4369 return rc;
4370 }
4371
4372 if (machine_is_msm7x30_fluid()) {
4373 msm_gpios_disable_free(fluid_vee_reset_gpio,
4374 ARRAY_SIZE(fluid_vee_reset_gpio));
4375 }
4376
4377 rc = pmapp_display_clock_config(0);
4378 if (rc) {
4379 pr_err("%s pmapp_display_clock_config rc=%d\n",
4380 __func__, rc);
4381 return rc;
4382 }
4383 }
4384
4385 return rc;
4386}
4387
4388static int msm_fb_mddi_sel_clk(u32 *clk_rate)
4389{
4390 *clk_rate *= 2;
4391 return 0;
4392}
4393
4394static int msm_fb_mddi_client_power(u32 client_id)
4395{
4396 struct vreg *vreg_ldo20, *vreg_ldo16;
4397 int rc;
4398
4399 printk(KERN_NOTICE "\n client_id = 0x%x", client_id);
4400 /* Check if it is Quicklogic client */
4401 if (client_id == 0xc5835800) {
4402 printk(KERN_NOTICE "\n Quicklogic MDDI client");
4403 other_mddi_client = 0;
4404 vreg_ldo16 = vreg_get(NULL, "gp10");
4405
4406 if (IS_ERR(vreg_ldo16)) {
4407 rc = PTR_ERR(vreg_ldo16);
4408 pr_err("%s: gp10 vreg get failed (%d)\n",
4409 __func__, rc);
4410 return rc;
4411 }
4412
4413 rc = vreg_disable(vreg_ldo16);
4414 if (rc) {
4415 pr_err("%s: LDO16 vreg enable failed (%d)\n",
4416 __func__, rc);
4417 return rc;
4418 }
4419 } else {
4420 printk(KERN_NOTICE "\n Non-Quicklogic MDDI client");
4421 quickvx_mddi_client = 0;
4422 gpio_set_value(97, 0);
4423 gpio_set_value_cansleep(PM8058_GPIO_PM_TO_SYS(
4424 PMIC_GPIO_QUICKVX_CLK), 0);
4425
4426 vreg_ldo20 = vreg_get(NULL, "gp13");
4427
4428 if (IS_ERR(vreg_ldo20)) {
4429 rc = PTR_ERR(vreg_ldo20);
4430 pr_err("%s: gp13 vreg get failed (%d)\n",
4431 __func__, rc);
4432 return rc;
4433 }
4434 rc = vreg_set_level(vreg_ldo20, 1500);
4435 if (rc) {
4436 pr_err("%s: vreg LDO20 set level failed (%d)\n",
4437 __func__, rc);
4438 return rc;
4439 }
4440 }
4441 return 0;
4442}
4443
4444static struct mddi_platform_data mddi_pdata = {
4445 .mddi_power_save = display_common_power,
4446 .mddi_sel_clk = msm_fb_mddi_sel_clk,
4447 .mddi_client_power = msm_fb_mddi_client_power,
4448};
4449
4450int mdp_core_clk_rate_table[] = {
4451 122880000,
4452 122880000,
Pradeep Jilagam3cc12f92011-07-26 22:25:18 +05304453 192000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004454 192000000,
4455};
4456
4457static struct msm_panel_common_pdata mdp_pdata = {
4458 .hw_revision_addr = 0xac001270,
4459 .gpio = 30,
4460 .mdp_core_clk_rate = 122880000,
4461 .mdp_core_clk_table = mdp_core_clk_rate_table,
4462 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
Ravishangar Kalyanam07ef7882011-08-09 15:50:48 -07004463 .mdp_rev = MDP_REV_40,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004464};
4465
4466static int lcd_panel_spi_gpio_num[] = {
4467 45, /* spi_clk */
4468 46, /* spi_cs */
4469 47, /* spi_mosi */
4470 48, /* spi_miso */
4471 };
4472
4473static struct msm_gpio lcd_panel_gpios[] = {
4474/* Workaround, since HDMI_INT is using the same GPIO line (18), and is used as
4475 * input. if there is a hardware revision; we should reassign this GPIO to a
4476 * new open line; and removing it will just ensure that this will be missed in
4477 * the future.
4478 { GPIO_CFG(18, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn0" },
4479 */
4480 { GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn1" },
4481 { GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu0" },
4482 { GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu1" },
4483 { GPIO_CFG(22, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu2" },
4484 { GPIO_CFG(23, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red0" },
4485 { GPIO_CFG(24, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red1" },
4486 { GPIO_CFG(25, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red2" },
4487#ifndef CONFIG_SPI_QSD
4488 { GPIO_CFG(45, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_clk" },
4489 { GPIO_CFG(46, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_cs0" },
4490 { GPIO_CFG(47, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_mosi" },
4491 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "spi_miso" },
4492#endif
4493 { GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_pclk" },
4494 { GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_en" },
4495 { GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_vsync" },
4496 { GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_hsync" },
4497 { GPIO_CFG(94, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn2" },
4498 { GPIO_CFG(95, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn3" },
4499 { GPIO_CFG(96, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn4" },
4500 { GPIO_CFG(97, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn5" },
4501 { GPIO_CFG(98, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn6" },
4502 { GPIO_CFG(99, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn7" },
4503 { GPIO_CFG(100, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu3" },
4504 { GPIO_CFG(101, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu4" },
4505 { GPIO_CFG(102, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu5" },
4506 { GPIO_CFG(103, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu6" },
4507 { GPIO_CFG(104, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu7" },
4508 { GPIO_CFG(105, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red3" },
4509 { GPIO_CFG(106, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red4" },
4510 { GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red5" },
4511 { GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red6" },
4512 { GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red7" },
4513};
4514
4515static struct msm_gpio lcd_sharp_panel_gpios[] = {
4516 { GPIO_CFG(22, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu2" },
4517 { GPIO_CFG(25, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red2" },
4518 { GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_pclk" },
4519 { GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_en" },
4520 { GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_vsync" },
4521 { GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_hsync" },
4522 { GPIO_CFG(94, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn2" },
4523 { GPIO_CFG(95, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn3" },
4524 { GPIO_CFG(96, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn4" },
4525 { GPIO_CFG(97, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn5" },
4526 { GPIO_CFG(98, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn6" },
4527 { GPIO_CFG(99, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_grn7" },
4528 { GPIO_CFG(100, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu3" },
4529 { GPIO_CFG(101, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu4" },
4530 { GPIO_CFG(102, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu5" },
4531 { GPIO_CFG(103, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu6" },
4532 { GPIO_CFG(104, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_blu7" },
4533 { GPIO_CFG(105, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red3" },
4534 { GPIO_CFG(106, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red4" },
4535 { GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red5" },
4536 { GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red6" },
4537 { GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), "lcdc_red7" },
4538};
4539
4540static int lcdc_toshiba_panel_power(int on)
4541{
4542 int rc, i;
4543 struct msm_gpio *gp;
4544
4545 rc = display_common_power(on);
4546 if (rc < 0) {
4547 printk(KERN_ERR "%s display_common_power failed: %d\n",
4548 __func__, rc);
4549 return rc;
4550 }
4551
4552 if (on) {
4553 rc = msm_gpios_enable(lcd_panel_gpios,
4554 ARRAY_SIZE(lcd_panel_gpios));
4555 if (rc < 0) {
4556 printk(KERN_ERR "%s: gpio enable failed: %d\n",
4557 __func__, rc);
4558 }
4559 } else { /* off */
4560 gp = lcd_panel_gpios;
4561 for (i = 0; i < ARRAY_SIZE(lcd_panel_gpios); i++) {
4562 /* ouput low */
4563 gpio_set_value(GPIO_PIN(gp->gpio_cfg), 0);
4564 gp++;
4565 }
4566 }
4567
4568 return rc;
4569}
4570
4571static int lcdc_sharp_panel_power(int on)
4572{
4573 int rc, i;
4574 struct msm_gpio *gp;
4575
4576 rc = display_common_power(on);
4577 if (rc < 0) {
4578 printk(KERN_ERR "%s display_common_power failed: %d\n",
4579 __func__, rc);
4580 return rc;
4581 }
4582
4583 if (on) {
4584 rc = msm_gpios_enable(lcd_sharp_panel_gpios,
4585 ARRAY_SIZE(lcd_sharp_panel_gpios));
4586 if (rc < 0) {
4587 printk(KERN_ERR "%s: gpio enable failed: %d\n",
4588 __func__, rc);
4589 }
4590 } else { /* off */
4591 gp = lcd_sharp_panel_gpios;
4592 for (i = 0; i < ARRAY_SIZE(lcd_sharp_panel_gpios); i++) {
4593 /* ouput low */
4594 gpio_set_value(GPIO_PIN(gp->gpio_cfg), 0);
4595 gp++;
4596 }
4597 }
4598
4599 return rc;
4600}
4601
4602static int lcdc_panel_power(int on)
4603{
4604 int flag_on = !!on;
4605 static int lcdc_power_save_on;
4606
4607 if (lcdc_power_save_on == flag_on)
4608 return 0;
4609
4610 lcdc_power_save_on = flag_on;
4611 quickvx_mddi_client = 0;
4612
4613 if (machine_is_msm7x30_fluid())
4614 return lcdc_sharp_panel_power(on);
4615 else
4616 return lcdc_toshiba_panel_power(on);
4617}
4618
4619static struct lcdc_platform_data lcdc_pdata = {
4620 .lcdc_power_save = lcdc_panel_power,
4621};
4622
4623static int atv_dac_power(int on)
4624{
4625 int rc = 0;
4626 struct vreg *vreg_s4, *vreg_ldo9;
4627
4628 vreg_s4 = vreg_get(NULL, "s4");
4629 if (IS_ERR(vreg_s4)) {
4630 rc = PTR_ERR(vreg_s4);
4631 pr_err("%s: s4 vreg get failed (%d)\n",
4632 __func__, rc);
4633 return -1;
4634 }
4635 vreg_ldo9 = vreg_get(NULL, "gp1");
4636 if (IS_ERR(vreg_ldo9)) {
4637 rc = PTR_ERR(vreg_ldo9);
4638 pr_err("%s: ldo9 vreg get failed (%d)\n",
4639 __func__, rc);
4640 return rc;
4641 }
4642
4643 if (on) {
4644 rc = vreg_enable(vreg_s4);
4645 if (rc) {
4646 pr_err("%s: s4 vreg enable failed (%d)\n",
4647 __func__, rc);
4648 return rc;
4649 }
4650 rc = vreg_enable(vreg_ldo9);
4651 if (rc) {
4652 pr_err("%s: ldo9 vreg enable failed (%d)\n",
4653 __func__, rc);
4654 return rc;
4655 }
4656 } else {
4657 rc = vreg_disable(vreg_ldo9);
4658 if (rc) {
4659 pr_err("%s: ldo9 vreg disable failed (%d)\n",
4660 __func__, rc);
4661 return rc;
4662 }
4663 rc = vreg_disable(vreg_s4);
4664 if (rc) {
4665 pr_err("%s: s4 vreg disable failed (%d)\n",
4666 __func__, rc);
4667 return rc;
4668 }
4669 }
4670 return rc;
4671}
4672
4673static struct tvenc_platform_data atv_pdata = {
4674 .poll = 1,
4675 .pm_vid_en = atv_dac_power,
4676};
4677
4678static void __init msm_fb_add_devices(void)
4679{
4680 msm_fb_register_device("mdp", &mdp_pdata);
4681 msm_fb_register_device("pmdh", &mddi_pdata);
4682 msm_fb_register_device("lcdc", &lcdc_pdata);
4683 msm_fb_register_device("dtv", &dtv_pdata);
4684 msm_fb_register_device("tvenc", &atv_pdata);
4685#ifdef CONFIG_FB_MSM_TVOUT
4686 msm_fb_register_device("tvout_device", NULL);
4687#endif
4688}
4689
4690static struct msm_panel_common_pdata lcdc_toshiba_panel_data = {
4691 .gpio_num = lcd_panel_spi_gpio_num,
4692};
4693
4694static struct platform_device lcdc_toshiba_panel_device = {
4695 .name = "lcdc_toshiba_wvga",
4696 .id = 0,
4697 .dev = {
4698 .platform_data = &lcdc_toshiba_panel_data,
4699 }
4700};
4701
4702#if defined(CONFIG_MARIMBA_CORE) && \
4703 (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE))
4704static struct platform_device msm_bt_power_device = {
4705 .name = "bt_power",
4706 .id = -1
4707};
4708
4709enum {
4710 BT_RFR,
4711 BT_CTS,
4712 BT_RX,
4713 BT_TX,
4714};
4715
4716static struct msm_gpio bt_config_power_on[] = {
4717 { GPIO_CFG(134, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
4718 "UART1DM_RFR" },
4719 { GPIO_CFG(135, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
4720 "UART1DM_CTS" },
4721 { GPIO_CFG(136, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
4722 "UART1DM_Rx" },
4723 { GPIO_CFG(137, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
4724 "UART1DM_Tx" }
4725};
4726
4727static struct msm_gpio bt_config_power_off[] = {
4728 { GPIO_CFG(134, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
4729 "UART1DM_RFR" },
4730 { GPIO_CFG(135, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
4731 "UART1DM_CTS" },
4732 { GPIO_CFG(136, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
4733 "UART1DM_Rx" },
4734 { GPIO_CFG(137, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
4735 "UART1DM_Tx" }
4736};
4737
4738static const char *vregs_bt_marimba_name[] = {
4739 "s3",
4740 "s2",
4741 "gp16",
4742 "wlan"
4743};
4744static struct vreg *vregs_bt_marimba[ARRAY_SIZE(vregs_bt_marimba_name)];
4745
4746static const char *vregs_bt_bahama_name[] = {
4747 "s3",
4748 "usb2",
4749 "s2",
4750 "wlan"
4751};
4752static struct vreg *vregs_bt_bahama[ARRAY_SIZE(vregs_bt_bahama_name)];
4753
4754static u8 bahama_version;
4755
4756static int marimba_bt(int on)
4757{
4758 int rc;
4759 int i;
4760 struct marimba config = { .mod_id = MARIMBA_SLAVE_ID_MARIMBA };
4761
4762 struct marimba_config_register {
4763 u8 reg;
4764 u8 value;
4765 u8 mask;
4766 };
4767
4768 struct marimba_variant_register {
4769 const size_t size;
4770 const struct marimba_config_register *set;
4771 };
4772
4773 const struct marimba_config_register *p;
4774
4775 u8 version;
4776
4777 const struct marimba_config_register v10_bt_on[] = {
4778 { 0xE5, 0x0B, 0x0F },
4779 { 0x05, 0x02, 0x07 },
4780 { 0x06, 0x88, 0xFF },
4781 { 0xE7, 0x21, 0x21 },
4782 { 0xE3, 0x38, 0xFF },
4783 { 0xE4, 0x06, 0xFF },
4784 };
4785
4786 const struct marimba_config_register v10_bt_off[] = {
4787 { 0xE5, 0x0B, 0x0F },
4788 { 0x05, 0x08, 0x0F },
4789 { 0x06, 0x88, 0xFF },
4790 { 0xE7, 0x00, 0x21 },
4791 { 0xE3, 0x00, 0xFF },
4792 { 0xE4, 0x00, 0xFF },
4793 };
4794
4795 const struct marimba_config_register v201_bt_on[] = {
4796 { 0x05, 0x08, 0x07 },
4797 { 0x06, 0x88, 0xFF },
4798 { 0xE7, 0x21, 0x21 },
4799 { 0xE3, 0x38, 0xFF },
4800 { 0xE4, 0x06, 0xFF },
4801 };
4802
4803 const struct marimba_config_register v201_bt_off[] = {
4804 { 0x05, 0x08, 0x07 },
4805 { 0x06, 0x88, 0xFF },
4806 { 0xE7, 0x00, 0x21 },
4807 { 0xE3, 0x00, 0xFF },
4808 { 0xE4, 0x00, 0xFF },
4809 };
4810
4811 const struct marimba_config_register v210_bt_on[] = {
4812 { 0xE9, 0x01, 0x01 },
4813 { 0x06, 0x88, 0xFF },
4814 { 0xE7, 0x21, 0x21 },
4815 { 0xE3, 0x38, 0xFF },
4816 { 0xE4, 0x06, 0xFF },
4817 };
4818
4819 const struct marimba_config_register v210_bt_off[] = {
4820 { 0x06, 0x88, 0xFF },
4821 { 0xE7, 0x00, 0x21 },
4822 { 0xE9, 0x00, 0x01 },
4823 { 0xE3, 0x00, 0xFF },
4824 { 0xE4, 0x00, 0xFF },
4825 };
4826
4827 const struct marimba_variant_register bt_marimba[2][4] = {
4828 {
4829 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
4830 { 0, NULL },
4831 { ARRAY_SIZE(v201_bt_off), v201_bt_off },
4832 { ARRAY_SIZE(v210_bt_off), v210_bt_off }
4833 },
4834 {
4835 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
4836 { 0, NULL },
4837 { ARRAY_SIZE(v201_bt_on), v201_bt_on },
4838 { ARRAY_SIZE(v210_bt_on), v210_bt_on }
4839 }
4840 };
4841
4842 on = on ? 1 : 0;
4843
4844 rc = marimba_read_bit_mask(&config, 0x11, &version, 1, 0x1F);
4845 if (rc < 0) {
4846 printk(KERN_ERR
4847 "%s: version read failed: %d\n",
4848 __func__, rc);
4849 return rc;
4850 }
4851
4852 if ((version >= ARRAY_SIZE(bt_marimba[on])) ||
4853 (bt_marimba[on][version].size == 0)) {
4854 printk(KERN_ERR
4855 "%s: unsupported version\n",
4856 __func__);
4857 return -EIO;
4858 }
4859
4860 p = bt_marimba[on][version].set;
4861
4862 printk(KERN_INFO "%s: found version %d\n", __func__, version);
4863
4864 for (i = 0; i < bt_marimba[on][version].size; i++) {
4865 u8 value = (p+i)->value;
4866 rc = marimba_write_bit_mask(&config,
4867 (p+i)->reg,
4868 &value,
4869 sizeof((p+i)->value),
4870 (p+i)->mask);
4871 if (rc < 0) {
4872 printk(KERN_ERR
4873 "%s: reg %d write failed: %d\n",
4874 __func__, (p+i)->reg, rc);
4875 return rc;
4876 }
4877 printk(KERN_INFO "%s: reg 0x%02x value 0x%02x mask 0x%02x\n",
4878 __func__, (p+i)->reg,
4879 value, (p+i)->mask);
4880 }
4881 return 0;
4882}
4883
4884static int bahama_bt(int on)
4885{
4886 int rc;
4887 int i;
4888 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA };
4889
4890 struct bahama_variant_register {
4891 const size_t size;
4892 const struct bahama_config_register *set;
4893 };
4894
4895 const struct bahama_config_register *p;
4896
4897
4898 const struct bahama_config_register v10_bt_on[] = {
4899 { 0xE9, 0x00, 0xFF },
4900 { 0xF4, 0x80, 0xFF },
4901 { 0xF0, 0x06, 0xFF },
4902 { 0xE4, 0x00, 0xFF },
4903 { 0xE5, 0x00, 0x0F },
4904#ifdef CONFIG_WLAN
4905 { 0xE6, 0x38, 0x7F },
4906 { 0xE7, 0x06, 0xFF },
4907#endif
4908 { 0x11, 0x13, 0xFF },
4909 { 0xE9, 0x21, 0xFF },
4910 { 0x01, 0x0C, 0x1F },
4911 { 0x01, 0x08, 0x1F },
4912 };
4913
4914 const struct bahama_config_register v20_bt_on_fm_off[] = {
4915 { 0x11, 0x0C, 0xFF },
4916 { 0x13, 0x01, 0xFF },
4917 { 0xF4, 0x80, 0xFF },
4918 { 0xF0, 0x00, 0xFF },
4919 { 0xE9, 0x00, 0xFF },
4920#ifdef CONFIG_WLAN
4921 { 0x81, 0x00, 0xFF },
4922 { 0x82, 0x00, 0xFF },
4923 { 0xE6, 0x38, 0x7F },
4924 { 0xE7, 0x06, 0xFF },
4925#endif
4926 { 0xE9, 0x21, 0xFF }
4927 };
4928
4929 const struct bahama_config_register v20_bt_on_fm_on[] = {
4930 { 0x11, 0x0C, 0xFF },
4931 { 0x13, 0x01, 0xFF },
4932 { 0xF4, 0x86, 0xFF },
4933 { 0xF0, 0x06, 0xFF },
4934 { 0xE9, 0x00, 0xFF },
4935#ifdef CONFIG_WLAN
4936 { 0x81, 0x00, 0xFF },
4937 { 0x82, 0x00, 0xFF },
4938 { 0xE6, 0x38, 0x7F },
4939 { 0xE7, 0x06, 0xFF },
4940#endif
4941 { 0xE9, 0x21, 0xFF }
4942 };
4943
4944 const struct bahama_config_register v10_bt_off[] = {
4945 { 0xE9, 0x00, 0xFF },
4946 };
4947
4948 const struct bahama_config_register v20_bt_off_fm_off[] = {
4949 { 0xF4, 0x84, 0xFF },
4950 { 0xF0, 0x04, 0xFF },
4951 { 0xE9, 0x00, 0xFF }
4952 };
4953
4954 const struct bahama_config_register v20_bt_off_fm_on[] = {
4955 { 0xF4, 0x86, 0xFF },
4956 { 0xF0, 0x06, 0xFF },
4957 { 0xE9, 0x00, 0xFF }
4958 };
4959
4960 const struct bahama_variant_register bt_bahama[2][3] = {
4961 {
4962 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
4963 { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off },
4964 { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on }
4965 },
4966 {
4967 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
4968 { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off },
4969 { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on }
4970 }
4971 };
4972
4973 u8 offset = 0; /* index into bahama configs */
4974
4975 on = on ? 1 : 0;
4976
4977 bahama_version = read_bahama_ver();
4978
4979 if (((int)bahama_version) < 0 ||
4980 bahama_version == VER_UNSUPPORTED) {
4981 dev_err(&msm_bt_power_device.dev,
4982 "%s: i2c failure or unsupported version: %d\n",
4983 __func__, bahama_version);
4984 return -EIO;
4985 }
4986
4987 if (bahama_version == VER_2_0) {
4988 if (marimba_get_fm_status(&config))
4989 offset = 0x01;
4990 }
4991
4992 p = bt_bahama[on][bahama_version + offset].set;
4993
4994 dev_info(&msm_bt_power_device.dev,
4995 "%s: found version %d\n", __func__, bahama_version);
4996
4997 for (i = 0; i < bt_bahama[on][bahama_version + offset].size; i++) {
4998 u8 value = (p+i)->value;
4999 rc = marimba_write_bit_mask(&config,
5000 (p+i)->reg,
5001 &value,
5002 sizeof((p+i)->value),
5003 (p+i)->mask);
5004 if (rc < 0) {
5005 dev_err(&msm_bt_power_device.dev,
5006 "%s: reg %d write failed: %d\n",
5007 __func__, (p+i)->reg, rc);
5008 return rc;
5009 }
5010 dev_info(&msm_bt_power_device.dev,
5011 "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n",
5012 __func__, (p+i)->reg,
5013 value, (p+i)->mask);
5014 }
5015 /* Update BT status */
5016 if (on)
5017 marimba_set_bt_status(&config, true);
5018 else
5019 marimba_set_bt_status(&config, false);
5020
5021 if (bahama_version == VER_2_0 && on) { /* variant of bahama v2 */
5022 /* Disable s2 as bahama v2 uses internal LDO regulator */
5023 for (i = 0; i < ARRAY_SIZE(vregs_bt_bahama_name); i++) {
5024 if (!strcmp(vregs_bt_bahama_name[i], "s2")) {
5025 rc = vreg_disable(vregs_bt_bahama[i]);
5026 if (rc < 0) {
5027 printk(KERN_ERR
5028 "%s: vreg %s disable "
5029 "failed (%d)\n",
5030 __func__,
5031 vregs_bt_bahama_name[i], rc);
5032 return -EIO;
5033 }
5034 rc = pmapp_vreg_level_vote("BTPW",
5035 PMAPP_VREG_S2,
5036 0);
5037 if (rc < 0) {
5038 printk(KERN_ERR "%s: vreg "
5039 "level off failed (%d)\n",
5040 __func__, rc);
5041 return -EIO;
5042 }
5043 printk(KERN_INFO "%s: vreg disable & "
5044 "level off successful (%d)\n",
5045 __func__, rc);
5046 }
5047 }
5048 }
5049
5050 return 0;
5051}
5052
5053static int bluetooth_power_regulators(int on, int bahama_not_marimba)
5054{
5055 int i, rc;
5056 const char **vregs_name;
5057 struct vreg **vregs;
5058 int vregs_size;
5059
5060 if (bahama_not_marimba) {
5061 vregs_name = vregs_bt_bahama_name;
5062 vregs = vregs_bt_bahama;
5063 vregs_size = ARRAY_SIZE(vregs_bt_bahama_name);
5064 } else {
5065 vregs_name = vregs_bt_marimba_name;
5066 vregs = vregs_bt_marimba;
5067 vregs_size = ARRAY_SIZE(vregs_bt_marimba_name);
5068 }
5069
5070 for (i = 0; i < vregs_size; i++) {
5071 if (bahama_not_marimba && (bahama_version == VER_2_0) &&
5072 !on && !strcmp(vregs_bt_bahama_name[i], "s2"))
5073 continue;
5074 rc = on ? vreg_enable(vregs[i]) :
5075 vreg_disable(vregs[i]);
5076 if (rc < 0) {
5077 printk(KERN_ERR "%s: vreg %s %s failed (%d)\n",
5078 __func__, vregs_name[i],
5079 on ? "enable" : "disable", rc);
5080 return -EIO;
5081 }
5082 }
5083 return 0;
5084}
5085
5086static int bluetooth_power(int on)
5087{
5088 int rc;
5089 const char *id = "BTPW";
5090
5091 int bahama_not_marimba = bahama_present();
5092
5093 if (bahama_not_marimba == -1) {
5094 printk(KERN_WARNING "%s: bahama_present: %d\n",
5095 __func__, bahama_not_marimba);
5096 return -ENODEV;
5097 }
5098
5099 if (on) {
5100 rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 1300);
5101 if (rc < 0) {
5102 printk(KERN_ERR "%s: vreg level on failed (%d)\n",
5103 __func__, rc);
5104 return rc;
5105 }
5106
5107 rc = bluetooth_power_regulators(on, bahama_not_marimba);
5108 if (rc < 0)
5109 return -EIO;
5110
5111 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO,
5112 PMAPP_CLOCK_VOTE_ON);
5113 if (rc < 0)
5114 return -EIO;
5115
5116 if (machine_is_msm8x55_svlte_surf() ||
5117 machine_is_msm8x55_svlte_ffa()) {
5118 rc = marimba_gpio_config(1);
5119 if (rc < 0)
5120 return -EIO;
5121 }
5122
5123 rc = (bahama_not_marimba ? bahama_bt(on) : marimba_bt(on));
5124 if (rc < 0)
5125 return -EIO;
5126
5127 msleep(10);
5128
5129 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO,
5130 PMAPP_CLOCK_VOTE_PIN_CTRL);
5131 if (rc < 0)
5132 return -EIO;
5133
5134 if (machine_is_msm8x55_svlte_surf() ||
5135 machine_is_msm8x55_svlte_ffa()) {
5136 rc = marimba_gpio_config(0);
5137 if (rc < 0)
5138 return -EIO;
5139 }
5140
5141 rc = msm_gpios_enable(bt_config_power_on,
5142 ARRAY_SIZE(bt_config_power_on));
5143
5144 if (rc < 0)
5145 return rc;
5146
5147 } else {
5148 rc = msm_gpios_enable(bt_config_power_off,
5149 ARRAY_SIZE(bt_config_power_off));
5150 if (rc < 0)
5151 return rc;
5152
5153 /* check for initial RFKILL block (power off) */
5154 if (platform_get_drvdata(&msm_bt_power_device) == NULL)
5155 goto out;
5156
5157 rc = (bahama_not_marimba ? bahama_bt(on) : marimba_bt(on));
5158 if (rc < 0)
5159 return -EIO;
5160
5161 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_DO,
5162 PMAPP_CLOCK_VOTE_OFF);
5163 if (rc < 0)
5164 return -EIO;
5165
5166 rc = bluetooth_power_regulators(on, bahama_not_marimba);
5167 if (rc < 0)
5168 return -EIO;
5169
5170 if (bahama_version == VER_1_0) {
5171 rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 0);
5172 if (rc < 0) {
5173 printk(KERN_ERR "%s: vreg level off failed "
5174 "(%d)\n", __func__, rc);
5175 return -EIO;
5176 }
5177 }
5178 }
5179
5180out:
5181 printk(KERN_DEBUG "Bluetooth power switch: %d\n", on);
5182
5183 return 0;
5184}
5185
5186static void __init bt_power_init(void)
5187{
5188 int i;
5189
5190 for (i = 0; i < ARRAY_SIZE(vregs_bt_marimba_name); i++) {
5191 vregs_bt_marimba[i] = vreg_get(NULL, vregs_bt_marimba_name[i]);
5192 if (IS_ERR(vregs_bt_marimba[i])) {
5193 printk(KERN_ERR "%s: vreg get %s failed (%ld)\n",
5194 __func__, vregs_bt_marimba_name[i],
5195 PTR_ERR(vregs_bt_marimba[i]));
5196 return;
5197 }
5198 }
5199
5200 for (i = 0; i < ARRAY_SIZE(vregs_bt_bahama_name); i++) {
5201 vregs_bt_bahama[i] = vreg_get(NULL, vregs_bt_bahama_name[i]);
5202 if (IS_ERR(vregs_bt_bahama[i])) {
5203 printk(KERN_ERR "%s: vreg get %s failed (%ld)\n",
5204 __func__, vregs_bt_bahama_name[i],
5205 PTR_ERR(vregs_bt_bahama[i]));
5206 return;
5207 }
5208 }
5209
5210 msm_bt_power_device.dev.platform_data = &bluetooth_power;
5211}
5212#else
5213#define bt_power_init(x) do {} while (0)
5214#endif
5215
5216static struct msm_psy_batt_pdata msm_psy_batt_data = {
5217 .voltage_min_design = 2800,
5218 .voltage_max_design = 4300,
5219 .avail_chg_sources = AC_CHG | USB_CHG ,
5220 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
5221};
5222
5223static struct platform_device msm_batt_device = {
5224 .name = "msm-battery",
5225 .id = -1,
5226 .dev.platform_data = &msm_psy_batt_data,
5227};
5228
5229static char *msm_adc_fluid_device_names[] = {
5230 "LTC_ADC1",
5231 "LTC_ADC2",
5232 "LTC_ADC3",
5233};
5234
5235static char *msm_adc_surf_device_names[] = {
5236 "XO_ADC",
5237};
5238
5239static struct msm_adc_platform_data msm_adc_pdata;
5240
5241static struct platform_device msm_adc_device = {
5242 .name = "msm_adc",
5243 .id = -1,
5244 .dev = {
5245 .platform_data = &msm_adc_pdata,
5246 },
5247};
5248
5249#ifdef CONFIG_MSM_SDIO_AL
5250static struct msm_gpio mdm2ap_status = {
5251 GPIO_CFG(77, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5252 "mdm2ap_status"
5253};
5254
5255
5256static int configure_mdm2ap_status(int on)
5257{
5258 if (on)
5259 return msm_gpios_request_enable(&mdm2ap_status, 1);
5260 else {
5261 msm_gpios_disable_free(&mdm2ap_status, 1);
5262 return 0;
5263 }
5264}
5265
5266static int get_mdm2ap_status(void)
5267{
5268 return gpio_get_value(GPIO_PIN(mdm2ap_status.gpio_cfg));
5269}
5270
5271static struct sdio_al_platform_data sdio_al_pdata = {
5272 .config_mdm2ap_status = configure_mdm2ap_status,
5273 .get_mdm2ap_status = get_mdm2ap_status,
5274 .allow_sdioc_version_major_2 = 1,
5275 .peer_sdioc_version_minor = 0x0001,
5276 .peer_sdioc_version_major = 0x0003,
5277 .peer_sdioc_boot_version_minor = 0x0001,
5278 .peer_sdioc_boot_version_major = 0x0003,
5279};
5280
5281struct platform_device msm_device_sdio_al = {
5282 .name = "msm_sdio_al",
5283 .id = -1,
5284 .dev = {
5285 .platform_data = &sdio_al_pdata,
5286 },
5287};
5288
5289#endif /* CONFIG_MSM_SDIO_AL */
5290
Daniel Walker8d747cd2010-02-25 11:37:43 -08005291static struct platform_device *devices[] __initdata = {
Daniel Walker90e37c52010-05-12 14:24:15 -07005292#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005293 &msm_device_uart2,
5294#endif
Justin Paupore637a25d2011-07-14 17:11:04 -07005295#ifdef CONFIG_MSM_PROC_COMM_REGULATOR
5296 &msm_proccomm_regulator_dev,
5297#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005298 &asoc_msm_pcm,
5299 &asoc_msm_dai0,
5300 &asoc_msm_dai1,
5301#if defined (CONFIG_SND_MSM_MVS_DAI_SOC)
5302 &asoc_msm_mvs,
5303 &asoc_mvs_dai0,
5304 &asoc_mvs_dai1,
Daniel Walker90e37c52010-05-12 14:24:15 -07005305#endif
Niranjana Vishwanathapuraa8855e92010-10-06 13:52:10 -07005306 &msm_device_smd,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005307 &msm_device_dmov,
5308 &smc91x_device,
5309 &smsc911x_device,
5310 &msm_device_nand,
5311#ifdef CONFIG_USB_MSM_OTG_72K
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +05305312 &msm_device_otg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005313#ifdef CONFIG_USB_GADGET
5314 &msm_device_gadget_peripheral,
5315#endif
5316#endif
5317#ifdef CONFIG_USB_G_ANDROID
5318 &android_usb_device,
5319#endif
5320 &qsd_device_spi,
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +05305321
5322#ifdef CONFIG_MSM_SSBI
5323 &msm_device_ssbi_pmic1,
5324#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005325#ifdef CONFIG_I2C_SSBI
5326 &msm_device_ssbi6,
5327 &msm_device_ssbi7,
5328#endif
5329 &android_pmem_device,
5330 &msm_fb_device,
5331 &msm_migrate_pages_device,
5332 &mddi_toshiba_device,
5333 &lcdc_toshiba_panel_device,
5334#ifdef CONFIG_MSM_ROTATOR
5335 &msm_rotator_device,
5336#endif
5337 &lcdc_sharp_panel_device,
5338 &android_pmem_adsp_device,
5339 &android_pmem_audio_device,
5340 &msm_device_i2c,
5341 &msm_device_i2c_2,
5342 &msm_device_uart_dm1,
5343 &hs_device,
5344#ifdef CONFIG_MSM7KV2_AUDIO
5345 &msm_aictl_device,
5346 &msm_mi2s_device,
5347 &msm_lpa_device,
5348 &msm_aux_pcm_device,
5349#endif
5350 &msm_device_adspdec,
5351 &qup_device_i2c,
5352#if defined(CONFIG_MARIMBA_CORE) && \
5353 (defined(CONFIG_MSM_BT_POWER) || defined(CONFIG_MSM_BT_POWER_MODULE))
5354 &msm_bt_power_device,
5355#endif
5356 &msm_kgsl_3d0,
5357 &msm_kgsl_2d0,
5358#ifdef CONFIG_MT9T013
5359 &msm_camera_sensor_mt9t013,
5360#endif
5361#ifdef CONFIG_MT9D112
5362 &msm_camera_sensor_mt9d112,
5363#endif
5364#ifdef CONFIG_WEBCAM_OV9726
5365 &msm_camera_sensor_ov9726,
5366#endif
5367#ifdef CONFIG_S5K3E2FX
5368 &msm_camera_sensor_s5k3e2fx,
5369#endif
5370#ifdef CONFIG_MT9P012
5371 &msm_camera_sensor_mt9p012,
5372#endif
5373#ifdef CONFIG_MT9E013
5374 &msm_camera_sensor_mt9e013,
5375#endif
5376#ifdef CONFIG_VX6953
5377 &msm_camera_sensor_vx6953,
5378#endif
5379#ifdef CONFIG_SN12M0PZ
5380 &msm_camera_sensor_sn12m0pz,
5381#endif
5382 &msm_device_vidc_720p,
5383#ifdef CONFIG_MSM_GEMINI
5384 &msm_gemini_device,
5385#endif
5386#ifdef CONFIG_MSM_VPE
5387 &msm_vpe_device,
5388#endif
5389#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
5390 &msm_device_tsif,
5391#endif
5392#ifdef CONFIG_MSM_SDIO_AL
5393 &msm_device_sdio_al,
5394#endif
5395
5396#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
5397 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
5398 &qcrypto_device,
5399#endif
5400
5401#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
5402 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
5403 &qcedev_device,
5404#endif
5405
5406 &msm_batt_device,
5407 &msm_adc_device,
5408 &msm_ebi0_thermal,
5409 &msm_ebi1_thermal
5410};
5411
5412static struct msm_gpio msm_i2c_gpios_hw[] = {
5413 { GPIO_CFG(70, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_scl" },
5414 { GPIO_CFG(71, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_sda" },
5415};
5416
5417static struct msm_gpio msm_i2c_gpios_io[] = {
5418 { GPIO_CFG(70, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_scl" },
5419 { GPIO_CFG(71, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "i2c_sda" },
5420};
5421
5422static struct msm_gpio qup_i2c_gpios_io[] = {
5423 { GPIO_CFG(16, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_scl" },
5424 { GPIO_CFG(17, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_sda" },
5425};
5426static struct msm_gpio qup_i2c_gpios_hw[] = {
5427 { GPIO_CFG(16, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_scl" },
5428 { GPIO_CFG(17, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "qup_sda" },
5429};
5430
5431static void
5432msm_i2c_gpio_config(int adap_id, int config_type)
5433{
5434 struct msm_gpio *msm_i2c_table;
5435
5436 /* Each adapter gets 2 lines from the table */
5437 if (adap_id > 0)
5438 return;
5439 if (config_type)
5440 msm_i2c_table = &msm_i2c_gpios_hw[adap_id*2];
5441 else
5442 msm_i2c_table = &msm_i2c_gpios_io[adap_id*2];
5443 msm_gpios_enable(msm_i2c_table, 2);
5444}
5445/*This needs to be enabled only for OEMS*/
5446#ifndef CONFIG_QUP_EXCLUSIVE_TO_CAMERA
5447static struct vreg *qup_vreg;
5448#endif
5449static void
5450qup_i2c_gpio_config(int adap_id, int config_type)
5451{
5452 int rc = 0;
5453 struct msm_gpio *qup_i2c_table;
5454 /* Each adapter gets 2 lines from the table */
5455 if (adap_id != 4)
5456 return;
5457 if (config_type)
5458 qup_i2c_table = qup_i2c_gpios_hw;
5459 else
5460 qup_i2c_table = qup_i2c_gpios_io;
5461 rc = msm_gpios_enable(qup_i2c_table, 2);
5462 if (rc < 0)
5463 printk(KERN_ERR "QUP GPIO enable failed: %d\n", rc);
5464 /*This needs to be enabled only for OEMS*/
5465#ifndef CONFIG_QUP_EXCLUSIVE_TO_CAMERA
5466 if (qup_vreg) {
5467 int rc = vreg_set_level(qup_vreg, 1800);
5468 if (rc) {
5469 pr_err("%s: vreg LVS1 set level failed (%d)\n",
5470 __func__, rc);
5471 }
5472 rc = vreg_enable(qup_vreg);
5473 if (rc) {
5474 pr_err("%s: vreg_enable() = %d \n",
5475 __func__, rc);
5476 }
5477 }
5478#endif
5479}
5480
5481static struct msm_i2c_platform_data msm_i2c_pdata = {
5482 .clk_freq = 100000,
5483 .pri_clk = 70,
5484 .pri_dat = 71,
5485 .rmutex = 1,
5486 .rsl_id = "D:I2C02000021",
5487 .msm_i2c_config_gpio = msm_i2c_gpio_config,
5488};
5489
5490static void __init msm_device_i2c_init(void)
5491{
5492 if (msm_gpios_request(msm_i2c_gpios_hw, ARRAY_SIZE(msm_i2c_gpios_hw)))
5493 pr_err("failed to request I2C gpios\n");
5494
5495 msm_device_i2c.dev.platform_data = &msm_i2c_pdata;
5496}
5497
5498static struct msm_i2c_platform_data msm_i2c_2_pdata = {
5499 .clk_freq = 100000,
5500 .rmutex = 1,
5501 .rsl_id = "D:I2C02000022",
5502 .msm_i2c_config_gpio = msm_i2c_gpio_config,
5503};
5504
5505static void __init msm_device_i2c_2_init(void)
5506{
5507 msm_device_i2c_2.dev.platform_data = &msm_i2c_2_pdata;
5508}
5509
5510static struct msm_i2c_platform_data qup_i2c_pdata = {
5511 .clk_freq = 384000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005512 .msm_i2c_config_gpio = qup_i2c_gpio_config,
5513};
5514
5515static void __init qup_device_i2c_init(void)
5516{
5517 if (msm_gpios_request(qup_i2c_gpios_hw, ARRAY_SIZE(qup_i2c_gpios_hw)))
5518 pr_err("failed to request I2C gpios\n");
5519
5520 qup_device_i2c.dev.platform_data = &qup_i2c_pdata;
5521 /*This needs to be enabled only for OEMS*/
5522#ifndef CONFIG_QUP_EXCLUSIVE_TO_CAMERA
5523 qup_vreg = vreg_get(NULL, "lvsw1");
5524 if (IS_ERR(qup_vreg)) {
5525 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
5526 __func__, PTR_ERR(qup_vreg));
5527 }
5528#endif
5529}
5530
5531#ifdef CONFIG_I2C_SSBI
5532static struct msm_i2c_ssbi_platform_data msm_i2c_ssbi6_pdata = {
5533 .rsl_id = "D:PMIC_SSBI",
5534 .controller_type = MSM_SBI_CTRL_SSBI2,
5535};
5536
5537static struct msm_i2c_ssbi_platform_data msm_i2c_ssbi7_pdata = {
5538 .rsl_id = "D:CODEC_SSBI",
5539 .controller_type = MSM_SBI_CTRL_SSBI,
5540};
5541#endif
5542
Daniel Walker8d747cd2010-02-25 11:37:43 -08005543static void __init msm7x30_init_irq(void)
5544{
5545 msm_init_irq();
5546}
5547
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005548static struct msm_gpio msm_nand_ebi2_cfg_data[] = {
5549 {GPIO_CFG(86, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "ebi2_cs1"},
5550 {GPIO_CFG(115, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "ebi2_busy1"},
5551};
5552
5553struct vreg *vreg_s3;
5554struct vreg *vreg_mmc;
5555
5556#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
5557 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
5558 || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
5559 || defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
5560
5561struct sdcc_gpio {
5562 struct msm_gpio *cfg_data;
5563 uint32_t size;
5564 struct msm_gpio *sleep_cfg_data;
5565};
5566#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT)
5567static struct msm_gpio sdc1_lvlshft_cfg_data[] = {
5568 {GPIO_CFG(35, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_16MA), "sdc1_lvlshft"},
5569};
5570#endif
5571static struct msm_gpio sdc1_cfg_data[] = {
5572 {GPIO_CFG(38, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc1_clk"},
5573 {GPIO_CFG(39, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_cmd"},
5574 {GPIO_CFG(40, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_3"},
5575 {GPIO_CFG(41, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_2"},
5576 {GPIO_CFG(42, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_1"},
5577 {GPIO_CFG(43, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc1_dat_0"},
5578};
5579
5580static struct msm_gpio sdc2_cfg_data[] = {
5581 {GPIO_CFG(64, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc2_clk"},
5582 {GPIO_CFG(65, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_cmd"},
5583 {GPIO_CFG(66, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_3"},
5584 {GPIO_CFG(67, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_2"},
5585 {GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_1"},
5586 {GPIO_CFG(69, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_0"},
5587
5588#ifdef CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT
5589 {GPIO_CFG(115, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_4"},
5590 {GPIO_CFG(114, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_5"},
5591 {GPIO_CFG(113, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_6"},
5592 {GPIO_CFG(112, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc2_dat_7"},
5593#endif
5594};
5595
5596static struct msm_gpio sdc3_cfg_data[] = {
5597 {GPIO_CFG(110, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc3_clk"},
5598 {GPIO_CFG(111, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_cmd"},
5599 {GPIO_CFG(116, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_3"},
5600 {GPIO_CFG(117, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_2"},
5601 {GPIO_CFG(118, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_1"},
5602 {GPIO_CFG(119, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc3_dat_0"},
5603};
5604
5605static struct msm_gpio sdc3_sleep_cfg_data[] = {
5606 {GPIO_CFG(110, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5607 "sdc3_clk"},
5608 {GPIO_CFG(111, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5609 "sdc3_cmd"},
5610 {GPIO_CFG(116, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5611 "sdc3_dat_3"},
5612 {GPIO_CFG(117, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5613 "sdc3_dat_2"},
5614 {GPIO_CFG(118, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5615 "sdc3_dat_1"},
5616 {GPIO_CFG(119, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
5617 "sdc3_dat_0"},
5618};
5619
5620static struct msm_gpio sdc4_cfg_data[] = {
5621 {GPIO_CFG(58, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), "sdc4_clk"},
5622 {GPIO_CFG(59, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_cmd"},
5623 {GPIO_CFG(60, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_3"},
5624 {GPIO_CFG(61, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_2"},
5625 {GPIO_CFG(62, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_1"},
5626 {GPIO_CFG(63, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA), "sdc4_dat_0"},
5627};
5628
5629static struct sdcc_gpio sdcc_cfg_data[] = {
5630 {
5631 .cfg_data = sdc1_cfg_data,
5632 .size = ARRAY_SIZE(sdc1_cfg_data),
5633 .sleep_cfg_data = NULL,
5634 },
5635 {
5636 .cfg_data = sdc2_cfg_data,
5637 .size = ARRAY_SIZE(sdc2_cfg_data),
5638 .sleep_cfg_data = NULL,
5639 },
5640 {
5641 .cfg_data = sdc3_cfg_data,
5642 .size = ARRAY_SIZE(sdc3_cfg_data),
5643 .sleep_cfg_data = sdc3_sleep_cfg_data,
5644 },
5645 {
5646 .cfg_data = sdc4_cfg_data,
5647 .size = ARRAY_SIZE(sdc4_cfg_data),
5648 .sleep_cfg_data = NULL,
5649 },
5650};
5651
5652struct sdcc_vreg {
5653 struct vreg *vreg_data;
5654 unsigned level;
5655};
5656
5657static struct sdcc_vreg sdcc_vreg_data[4];
5658
5659static unsigned long vreg_sts, gpio_sts;
5660
5661static uint32_t msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
5662{
5663 int rc = 0;
5664 struct sdcc_gpio *curr;
5665
5666 curr = &sdcc_cfg_data[dev_id - 1];
5667
5668 if (!(test_bit(dev_id, &gpio_sts)^enable))
5669 return rc;
5670
5671 if (enable) {
5672 set_bit(dev_id, &gpio_sts);
5673 rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
5674 if (rc)
5675 printk(KERN_ERR "%s: Failed to turn on GPIOs for slot %d\n",
5676 __func__, dev_id);
5677 } else {
5678 clear_bit(dev_id, &gpio_sts);
5679 if (curr->sleep_cfg_data) {
5680 msm_gpios_enable(curr->sleep_cfg_data, curr->size);
5681 msm_gpios_free(curr->sleep_cfg_data, curr->size);
5682 } else {
5683 msm_gpios_disable_free(curr->cfg_data, curr->size);
5684 }
5685 }
5686
5687 return rc;
5688}
5689
5690static uint32_t msm_sdcc_setup_vreg(int dev_id, unsigned int enable)
5691{
5692 int rc = 0;
5693 struct sdcc_vreg *curr;
5694 static int enabled_once[] = {0, 0, 0, 0};
5695
5696 curr = &sdcc_vreg_data[dev_id - 1];
5697
5698 if (!(test_bit(dev_id, &vreg_sts)^enable))
5699 return rc;
5700
5701 if (!enable || enabled_once[dev_id - 1])
5702 return 0;
5703
5704 if (enable) {
5705 set_bit(dev_id, &vreg_sts);
5706 rc = vreg_set_level(curr->vreg_data, curr->level);
5707 if (rc) {
5708 printk(KERN_ERR "%s: vreg_set_level() = %d \n",
5709 __func__, rc);
5710 }
5711 rc = vreg_enable(curr->vreg_data);
5712 if (rc) {
5713 printk(KERN_ERR "%s: vreg_enable() = %d \n",
5714 __func__, rc);
5715 }
5716 enabled_once[dev_id - 1] = 1;
5717 } else {
5718 clear_bit(dev_id, &vreg_sts);
5719 rc = vreg_disable(curr->vreg_data);
5720 if (rc) {
5721 printk(KERN_ERR "%s: vreg_disable() = %d \n",
5722 __func__, rc);
5723 }
5724 }
5725 return rc;
5726}
5727
5728static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
5729{
5730 int rc = 0;
5731 struct platform_device *pdev;
5732
5733 pdev = container_of(dv, struct platform_device, dev);
5734 rc = msm_sdcc_setup_gpio(pdev->id, (vdd ? 1 : 0));
5735 if (rc)
5736 goto out;
5737
5738 if (pdev->id == 4) /* S3 is always ON and cannot be disabled */
5739 rc = msm_sdcc_setup_vreg(pdev->id, (vdd ? 1 : 0));
5740out:
5741 return rc;
5742}
5743
5744#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) && \
5745 defined(CONFIG_CSDIO_VENDOR_ID) && \
5746 defined(CONFIG_CSDIO_DEVICE_ID) && \
5747 (CONFIG_CSDIO_VENDOR_ID == 0x70 && CONFIG_CSDIO_DEVICE_ID == 0x1117)
5748
5749#define MBP_ON 1
5750#define MBP_OFF 0
5751
5752#define MBP_RESET_N \
5753 GPIO_CFG(44, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA)
5754#define MBP_INT0 \
5755 GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA)
5756
5757#define MBP_MODE_CTRL_0 \
5758 GPIO_CFG(35, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA)
5759#define MBP_MODE_CTRL_1 \
5760 GPIO_CFG(36, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA)
5761#define MBP_MODE_CTRL_2 \
5762 GPIO_CFG(34, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA)
5763#define TSIF_EN \
5764 GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
5765#define TSIF_DATA \
5766 GPIO_CFG(36, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
5767#define TSIF_CLK \
5768 GPIO_CFG(34, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
5769
5770static struct msm_gpio mbp_cfg_data[] = {
5771 {GPIO_CFG(44, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
5772 "mbp_reset"},
5773 {GPIO_CFG(85, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
5774 "mbp_io_voltage"},
5775};
5776
5777static int mbp_config_gpios_pre_init(int enable)
5778{
5779 int rc = 0;
5780
5781 if (enable) {
5782 rc = msm_gpios_request_enable(mbp_cfg_data,
5783 ARRAY_SIZE(mbp_cfg_data));
5784 if (rc) {
5785 printk(KERN_ERR
5786 "%s: Failed to turnon GPIOs for mbp chip(%d)\n",
5787 __func__, rc);
5788 }
5789 } else
5790 msm_gpios_disable_free(mbp_cfg_data, ARRAY_SIZE(mbp_cfg_data));
5791 return rc;
5792}
5793
5794static int mbp_setup_rf_vregs(int state)
5795{
5796 struct vreg *vreg_rf = NULL;
5797 struct vreg *vreg_rf_switch = NULL;
5798 int rc;
5799
5800 vreg_rf = vreg_get(NULL, "s2");
5801 if (IS_ERR(vreg_rf)) {
5802 pr_err("%s: s2 vreg get failed (%ld)",
5803 __func__, PTR_ERR(vreg_rf));
5804 return -EFAULT;
5805 }
5806 vreg_rf_switch = vreg_get(NULL, "rf");
5807 if (IS_ERR(vreg_rf_switch)) {
5808 pr_err("%s: rf vreg get failed (%ld)",
5809 __func__, PTR_ERR(vreg_rf_switch));
5810 return -EFAULT;
5811 }
5812
5813 if (state) {
5814 rc = vreg_set_level(vreg_rf, 1300);
5815 if (rc) {
5816 pr_err("%s: vreg s2 set level failed (%d)\n",
5817 __func__, rc);
5818 return rc;
5819 }
5820
5821 rc = vreg_enable(vreg_rf);
5822 if (rc) {
5823 printk(KERN_ERR "%s: vreg_enable(s2) = %d\n",
5824 __func__, rc);
5825 }
5826
5827 rc = vreg_set_level(vreg_rf_switch, 2600);
5828 if (rc) {
5829 pr_err("%s: vreg rf switch set level failed (%d)\n",
5830 __func__, rc);
5831 return rc;
5832 }
5833 rc = vreg_enable(vreg_rf_switch);
5834 if (rc) {
5835 printk(KERN_ERR "%s: vreg_enable(rf) = %d\n",
5836 __func__, rc);
5837 }
5838 } else {
5839 (void) vreg_disable(vreg_rf);
5840 (void) vreg_disable(vreg_rf_switch);
5841 }
5842 return 0;
5843}
5844
5845static int mbp_setup_vregs(int state)
5846{
5847 struct vreg *vreg_analog = NULL;
5848 struct vreg *vreg_io = NULL;
5849 int rc;
5850
5851 vreg_analog = vreg_get(NULL, "gp4");
5852 if (IS_ERR(vreg_analog)) {
5853 pr_err("%s: gp4 vreg get failed (%ld)",
5854 __func__, PTR_ERR(vreg_analog));
5855 return -EFAULT;
5856 }
5857 vreg_io = vreg_get(NULL, "s3");
5858 if (IS_ERR(vreg_io)) {
5859 pr_err("%s: s3 vreg get failed (%ld)",
5860 __func__, PTR_ERR(vreg_io));
5861 return -EFAULT;
5862 }
5863 if (state) {
5864 rc = vreg_set_level(vreg_analog, 2600);
5865 if (rc) {
5866 pr_err("%s: vreg_set_level failed (%d)",
5867 __func__, rc);
5868 }
5869 rc = vreg_enable(vreg_analog);
5870 if (rc) {
5871 pr_err("%s: analog vreg enable failed (%d)",
5872 __func__, rc);
5873 }
5874 rc = vreg_set_level(vreg_io, 1800);
5875 if (rc) {
5876 pr_err("%s: vreg_set_level failed (%d)",
5877 __func__, rc);
5878 }
5879 rc = vreg_enable(vreg_io);
5880 if (rc) {
5881 pr_err("%s: io vreg enable failed (%d)",
5882 __func__, rc);
5883 }
5884 } else {
5885 rc = vreg_disable(vreg_analog);
5886 if (rc) {
5887 pr_err("%s: analog vreg disable failed (%d)",
5888 __func__, rc);
5889 }
5890 rc = vreg_disable(vreg_io);
5891 if (rc) {
5892 pr_err("%s: io vreg disable failed (%d)",
5893 __func__, rc);
5894 }
5895 }
5896 return rc;
5897}
5898
5899static int mbp_set_tcxo_en(int enable)
5900{
5901 int rc;
5902 const char *id = "UBMC";
5903 struct vreg *vreg_analog = NULL;
5904
5905 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_A1,
5906 enable ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF);
5907 if (rc < 0) {
5908 printk(KERN_ERR "%s: unable to %svote for a1 clk\n",
5909 __func__, enable ? "" : "de-");
5910 return -EIO;
5911 }
5912 if (!enable) {
5913 vreg_analog = vreg_get(NULL, "gp4");
5914 if (IS_ERR(vreg_analog)) {
5915 pr_err("%s: gp4 vreg get failed (%ld)",
5916 __func__, PTR_ERR(vreg_analog));
5917 return -EFAULT;
5918 }
5919
5920 (void) vreg_disable(vreg_analog);
5921 }
5922 return rc;
5923}
5924
5925static void mbp_set_freeze_io(int state)
5926{
5927 if (state)
5928 gpio_set_value(85, 0);
5929 else
5930 gpio_set_value(85, 1);
5931}
5932
5933static int mbp_set_core_voltage_en(int enable)
5934{
5935 int rc;
5936 struct vreg *vreg_core1p2 = NULL;
5937
5938 vreg_core1p2 = vreg_get(NULL, "gp16");
5939 if (IS_ERR(vreg_core1p2)) {
5940 pr_err("%s: gp16 vreg get failed (%ld)",
5941 __func__, PTR_ERR(vreg_core1p2));
5942 return -EFAULT;
5943 }
5944 if (enable) {
5945 rc = vreg_set_level(vreg_core1p2, 1200);
5946 if (rc) {
5947 pr_err("%s: vreg_set_level failed (%d)",
5948 __func__, rc);
5949 }
5950 (void) vreg_enable(vreg_core1p2);
5951
5952 return 80;
5953 } else {
5954 gpio_set_value(85, 1);
5955 return 0;
5956 }
5957 return rc;
5958}
5959
5960static void mbp_set_reset(int state)
5961{
5962 if (state)
5963 gpio_set_value(GPIO_PIN(MBP_RESET_N), 0);
5964 else
5965 gpio_set_value(GPIO_PIN(MBP_RESET_N), 1);
5966}
5967
5968static int mbp_config_interface_mode(int state)
5969{
5970 if (state) {
5971 gpio_tlmm_config(MBP_MODE_CTRL_0, GPIO_CFG_ENABLE);
5972 gpio_tlmm_config(MBP_MODE_CTRL_1, GPIO_CFG_ENABLE);
5973 gpio_tlmm_config(MBP_MODE_CTRL_2, GPIO_CFG_ENABLE);
5974 gpio_set_value(GPIO_PIN(MBP_MODE_CTRL_0), 0);
5975 gpio_set_value(GPIO_PIN(MBP_MODE_CTRL_1), 1);
5976 gpio_set_value(GPIO_PIN(MBP_MODE_CTRL_2), 0);
5977 } else {
5978 gpio_tlmm_config(MBP_MODE_CTRL_0, GPIO_CFG_DISABLE);
5979 gpio_tlmm_config(MBP_MODE_CTRL_1, GPIO_CFG_DISABLE);
5980 gpio_tlmm_config(MBP_MODE_CTRL_2, GPIO_CFG_DISABLE);
5981 }
5982 return 0;
5983}
5984
5985static int mbp_setup_adc_vregs(int state)
5986{
5987 struct vreg *vreg_adc = NULL;
5988 int rc;
5989
5990 vreg_adc = vreg_get(NULL, "s4");
5991 if (IS_ERR(vreg_adc)) {
5992 pr_err("%s: s4 vreg get failed (%ld)",
5993 __func__, PTR_ERR(vreg_adc));
5994 return -EFAULT;
5995 }
5996 if (state) {
5997 rc = vreg_set_level(vreg_adc, 2200);
5998 if (rc) {
5999 pr_err("%s: vreg_set_level failed (%d)",
6000 __func__, rc);
6001 }
6002 rc = vreg_enable(vreg_adc);
6003 if (rc) {
6004 pr_err("%s: enable vreg adc failed (%d)",
6005 __func__, rc);
6006 }
6007 } else {
6008 rc = vreg_disable(vreg_adc);
6009 if (rc) {
6010 pr_err("%s: disable vreg adc failed (%d)",
6011 __func__, rc);
6012 }
6013 }
6014 return rc;
6015}
6016
6017static int mbp_power_up(void)
6018{
6019 int rc;
6020
6021 rc = mbp_config_gpios_pre_init(MBP_ON);
6022 if (rc)
6023 goto exit;
6024 pr_debug("%s: mbp_config_gpios_pre_init() done\n", __func__);
6025
6026 rc = mbp_setup_vregs(MBP_ON);
6027 if (rc)
6028 goto exit;
6029 pr_debug("%s: gp4 (2.6) and s3 (1.8) done\n", __func__);
6030
6031 rc = mbp_set_tcxo_en(MBP_ON);
6032 if (rc)
6033 goto exit;
6034 pr_debug("%s: tcxo clock done\n", __func__);
6035
6036 mbp_set_freeze_io(MBP_OFF);
6037 pr_debug("%s: set gpio 85 to 1 done\n", __func__);
6038
6039 udelay(100);
6040 mbp_set_reset(MBP_ON);
6041
6042 udelay(300);
6043 rc = mbp_config_interface_mode(MBP_ON);
6044 if (rc)
6045 goto exit;
6046 pr_debug("%s: mbp_config_interface_mode() done\n", __func__);
6047
6048 udelay(100 + mbp_set_core_voltage_en(MBP_ON));
6049 pr_debug("%s: power gp16 1.2V done\n", __func__);
6050
6051 mbp_set_freeze_io(MBP_ON);
6052 pr_debug("%s: set gpio 85 to 0 done\n", __func__);
6053
6054 udelay(100);
6055
6056 rc = mbp_setup_rf_vregs(MBP_ON);
6057 if (rc)
6058 goto exit;
6059 pr_debug("%s: s2 1.3V and rf 2.6V done\n", __func__);
6060
6061 rc = mbp_setup_adc_vregs(MBP_ON);
6062 if (rc)
6063 goto exit;
6064 pr_debug("%s: s4 2.2V done\n", __func__);
6065
6066 udelay(200);
6067
6068 mbp_set_reset(MBP_OFF);
6069 pr_debug("%s: close gpio 44 done\n", __func__);
6070
6071 msleep(20);
6072exit:
6073 return rc;
6074}
6075
6076static int mbp_power_down(void)
6077{
6078 int rc;
6079 struct vreg *vreg_adc = NULL;
6080
6081 vreg_adc = vreg_get(NULL, "s4");
6082 if (IS_ERR(vreg_adc)) {
6083 pr_err("%s: s4 vreg get failed (%ld)",
6084 __func__, PTR_ERR(vreg_adc));
6085 return -EFAULT;
6086 }
6087
6088 mbp_set_reset(MBP_ON);
6089 pr_debug("%s: mbp_set_reset(MBP_ON) done\n", __func__);
6090
6091 udelay(100);
6092
6093 rc = mbp_setup_adc_vregs(MBP_OFF);
6094 if (rc)
6095 goto exit;
6096 pr_debug("%s: vreg_disable(vreg_adc) done\n", __func__);
6097
6098 udelay(5);
6099
6100 rc = mbp_setup_rf_vregs(MBP_OFF);
6101 if (rc)
6102 goto exit;
6103 pr_debug("%s: mbp_setup_rf_vregs(MBP_OFF) done\n", __func__);
6104
6105 udelay(5);
6106
6107 mbp_set_freeze_io(MBP_OFF);
6108 pr_debug("%s: mbp_set_freeze_io(MBP_OFF) done\n", __func__);
6109
6110 udelay(100);
6111 rc = mbp_set_core_voltage_en(MBP_OFF);
6112 if (rc)
6113 goto exit;
6114 pr_debug("%s: mbp_set_core_voltage_en(MBP_OFF) done\n", __func__);
6115
6116 gpio_set_value(85, 1);
6117
6118 rc = mbp_set_tcxo_en(MBP_OFF);
6119 if (rc)
6120 goto exit;
6121 pr_debug("%s: mbp_set_tcxo_en(MBP_OFF) done\n", __func__);
6122
6123 rc = mbp_config_gpios_pre_init(MBP_OFF);
6124 if (rc)
6125 goto exit;
6126exit:
6127 return rc;
6128}
6129
6130static void (*mbp_status_notify_cb)(int card_present, void *dev_id);
6131static void *mbp_status_notify_cb_devid;
6132static int mbp_power_status;
6133static int mbp_power_init_done;
6134
6135static uint32_t mbp_setup_power(struct device *dv,
6136 unsigned int power_status)
6137{
6138 int rc = 0;
6139 struct platform_device *pdev;
6140
6141 pdev = container_of(dv, struct platform_device, dev);
6142
6143 if (power_status == mbp_power_status)
6144 goto exit;
6145 if (power_status) {
6146 pr_debug("turn on power of mbp slot");
6147 rc = mbp_power_up();
6148 mbp_power_status = 1;
6149 } else {
6150 pr_debug("turn off power of mbp slot");
6151 rc = mbp_power_down();
6152 mbp_power_status = 0;
6153 }
6154exit:
6155 return rc;
6156};
6157
6158int mbp_register_status_notify(void (*callback)(int, void *),
6159 void *dev_id)
6160{
6161 mbp_status_notify_cb = callback;
6162 mbp_status_notify_cb_devid = dev_id;
6163 return 0;
6164}
6165
6166static unsigned int mbp_status(struct device *dev)
6167{
6168 return mbp_power_status;
6169}
6170
6171static uint32_t msm_sdcc_setup_power_mbp(struct device *dv, unsigned int vdd)
6172{
6173 struct platform_device *pdev;
6174 uint32_t rc = 0;
6175
6176 pdev = container_of(dv, struct platform_device, dev);
6177 rc = msm_sdcc_setup_power(dv, vdd);
6178 if (rc) {
6179 pr_err("%s: Failed to setup power (%d)\n",
6180 __func__, rc);
6181 goto out;
6182 }
6183 if (!mbp_power_init_done) {
6184 mbp_setup_power(dv, 1);
6185 mbp_setup_power(dv, 0);
6186 mbp_power_init_done = 1;
6187 }
6188 if (vdd >= 0x8000) {
6189 rc = mbp_setup_power(dv, (0x8000 == vdd) ? 0 : 1);
6190 if (rc) {
6191 pr_err("%s: Failed to config mbp chip power (%d)\n",
6192 __func__, rc);
6193 goto out;
6194 }
6195 if (mbp_status_notify_cb) {
6196 mbp_status_notify_cb(mbp_power_status,
6197 mbp_status_notify_cb_devid);
6198 }
6199 }
6200out:
6201 /* should return 0 only */
6202 return 0;
6203}
6204
6205#endif
6206
6207#endif
6208
6209#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
6210#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
6211static unsigned int msm7x30_sdcc_slot_status(struct device *dev)
6212{
6213 return (unsigned int)
6214 gpio_get_value_cansleep(
6215 PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SD_DET - 1));
6216}
6217#endif
6218
6219static int msm_sdcc_get_wpswitch(struct device *dv)
6220{
6221 void __iomem *wp_addr = 0;
6222 uint32_t ret = 0;
6223 struct platform_device *pdev;
6224
6225 if (!(machine_is_msm7x30_surf()))
6226 return -1;
6227 pdev = container_of(dv, struct platform_device, dev);
6228
6229 wp_addr = ioremap(FPGA_SDCC_STATUS, 4);
6230 if (!wp_addr) {
6231 pr_err("%s: Could not remap %x\n", __func__, FPGA_SDCC_STATUS);
6232 return -ENOMEM;
6233 }
6234
6235 ret = (((readl(wp_addr) >> 4) >> (pdev->id-1)) & 0x01);
6236 pr_info("%s: WP Status for Slot %d = 0x%x \n", __func__,
6237 pdev->id, ret);
6238 iounmap(wp_addr);
6239
6240 return ret;
6241}
6242#endif
6243
6244#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT)
6245#if defined(CONFIG_CSDIO_VENDOR_ID) && \
6246 defined(CONFIG_CSDIO_DEVICE_ID) && \
6247 (CONFIG_CSDIO_VENDOR_ID == 0x70 && CONFIG_CSDIO_DEVICE_ID == 0x1117)
6248static struct mmc_platform_data msm7x30_sdc1_data = {
6249 .ocr_mask = MMC_VDD_165_195 | MMC_VDD_27_28 | MMC_VDD_28_29,
6250 .translate_vdd = msm_sdcc_setup_power_mbp,
6251 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
6252 .status = mbp_status,
6253 .register_status_notify = mbp_register_status_notify,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006254 .msmsdcc_fmin = 144000,
6255 .msmsdcc_fmid = 24576000,
6256 .msmsdcc_fmax = 24576000,
6257 .nonremovable = 0,
6258};
6259#else
6260static struct mmc_platform_data msm7x30_sdc1_data = {
6261 .ocr_mask = MMC_VDD_165_195,
6262 .translate_vdd = msm_sdcc_setup_power,
6263 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006264 .msmsdcc_fmin = 144000,
6265 .msmsdcc_fmid = 24576000,
6266 .msmsdcc_fmax = 49152000,
6267 .nonremovable = 0,
6268};
6269#endif
6270#endif
6271
6272#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
6273static struct mmc_platform_data msm7x30_sdc2_data = {
6274 .ocr_mask = MMC_VDD_165_195 | MMC_VDD_27_28,
6275 .translate_vdd = msm_sdcc_setup_power,
6276#ifdef CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT
6277 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
6278#else
6279 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
6280#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006281 .msmsdcc_fmin = 144000,
6282 .msmsdcc_fmid = 24576000,
6283 .msmsdcc_fmax = 49152000,
6284 .nonremovable = 1,
6285};
6286#endif
6287
6288#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
6289static struct mmc_platform_data msm7x30_sdc3_data = {
6290 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
6291 .translate_vdd = msm_sdcc_setup_power,
6292 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
6293#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
6294 .sdiowakeup_irq = MSM_GPIO_TO_INT(118),
6295#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006296 .msmsdcc_fmin = 144000,
6297 .msmsdcc_fmid = 24576000,
6298 .msmsdcc_fmax = 49152000,
6299 .nonremovable = 0,
6300};
6301#endif
6302
6303#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
6304static struct mmc_platform_data msm7x30_sdc4_data = {
6305 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
6306 .translate_vdd = msm_sdcc_setup_power,
6307 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
6308#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
6309 .status = msm7x30_sdcc_slot_status,
6310 .status_irq = PM8058_GPIO_IRQ(PMIC8058_IRQ_BASE, PMIC_GPIO_SD_DET - 1),
6311 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
6312#endif
6313 .wpswitch = msm_sdcc_get_wpswitch,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006314 .msmsdcc_fmin = 144000,
6315 .msmsdcc_fmid = 24576000,
6316 .msmsdcc_fmax = 49152000,
6317 .nonremovable = 0,
6318};
6319#endif
6320
6321#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
6322static void msm_sdc1_lvlshft_enable(void)
6323{
6324 int rc;
6325
6326 /* Enable LDO5, an input to the FET that powers slot 1 */
6327 rc = vreg_set_level(vreg_mmc, 2850);
6328 if (rc)
6329 printk(KERN_ERR "%s: vreg_set_level() = %d \n", __func__, rc);
6330
6331 rc = vreg_enable(vreg_mmc);
6332 if (rc)
6333 printk(KERN_ERR "%s: vreg_enable() = %d \n", __func__, rc);
6334
6335 /* Enable GPIO 35, to turn on the FET that powers slot 1 */
6336 rc = msm_gpios_request_enable(sdc1_lvlshft_cfg_data,
6337 ARRAY_SIZE(sdc1_lvlshft_cfg_data));
6338 if (rc)
6339 printk(KERN_ERR "%s: Failed to enable GPIO 35\n", __func__);
6340
6341 rc = gpio_direction_output(GPIO_PIN(sdc1_lvlshft_cfg_data[0].gpio_cfg),
6342 1);
6343 if (rc)
6344 printk(KERN_ERR "%s: Failed to turn on GPIO 35\n", __func__);
6345}
6346#endif
6347
6348static void __init msm7x30_init_mmc(void)
6349{
6350 vreg_s3 = vreg_get(NULL, "s3");
6351 if (IS_ERR(vreg_s3)) {
6352 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
6353 __func__, PTR_ERR(vreg_s3));
6354 return;
6355 }
6356
6357 vreg_mmc = vreg_get(NULL, "mmc");
6358 if (IS_ERR(vreg_mmc)) {
6359 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
6360 __func__, PTR_ERR(vreg_mmc));
6361 return;
6362 }
6363
6364#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
6365 if (machine_is_msm7x30_fluid()) {
6366 msm7x30_sdc1_data.ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29;
6367 msm_sdc1_lvlshft_enable();
6368 }
6369 sdcc_vreg_data[0].vreg_data = vreg_s3;
6370 sdcc_vreg_data[0].level = 1800;
6371 msm_add_sdcc(1, &msm7x30_sdc1_data);
6372#endif
6373#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
6374 if (machine_is_msm8x55_svlte_surf())
6375 msm7x30_sdc2_data.msmsdcc_fmax = 24576000;
6376 sdcc_vreg_data[1].vreg_data = vreg_s3;
6377 sdcc_vreg_data[1].level = 1800;
6378 msm_add_sdcc(2, &msm7x30_sdc2_data);
6379#endif
6380#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
6381 sdcc_vreg_data[2].vreg_data = vreg_s3;
6382 sdcc_vreg_data[2].level = 1800;
6383 msm_sdcc_setup_gpio(3, 1);
6384 msm_add_sdcc(3, &msm7x30_sdc3_data);
6385#endif
6386#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
6387 sdcc_vreg_data[3].vreg_data = vreg_mmc;
6388 sdcc_vreg_data[3].level = 2850;
6389 msm_add_sdcc(4, &msm7x30_sdc4_data);
6390#endif
6391
6392}
6393
6394static void __init msm7x30_init_nand(void)
6395{
6396 char *build_id;
6397 struct flash_platform_data *plat_data;
6398
6399 build_id = socinfo_get_build_id();
6400 if (build_id == NULL) {
6401 pr_err("%s: Build ID not available from socinfo\n", __func__);
6402 return;
6403 }
6404
6405 if (build_id[8] == 'C' &&
6406 !msm_gpios_request_enable(msm_nand_ebi2_cfg_data,
6407 ARRAY_SIZE(msm_nand_ebi2_cfg_data))) {
6408 plat_data = msm_device_nand.dev.platform_data;
6409 plat_data->interleave = 1;
6410 printk(KERN_INFO "%s: Interleave mode Build ID found\n",
6411 __func__);
6412 }
6413}
6414
6415#ifdef CONFIG_SERIAL_MSM_CONSOLE
6416static struct msm_gpio uart2_config_data[] = {
6417 { GPIO_CFG(49, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_RFR"},
6418 { GPIO_CFG(50, 2, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_CTS"},
6419 { GPIO_CFG(51, 2, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_Rx"},
6420 { GPIO_CFG(52, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), "UART2_Tx"},
6421};
6422
6423static void msm7x30_init_uart2(void)
6424{
6425 msm_gpios_request_enable(uart2_config_data,
6426 ARRAY_SIZE(uart2_config_data));
6427
6428}
6429#endif
6430
6431/* TSIF begin */
6432#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
6433
6434#define TSIF_B_SYNC GPIO_CFG(37, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
6435#define TSIF_B_DATA GPIO_CFG(36, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
6436#define TSIF_B_EN GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
6437#define TSIF_B_CLK GPIO_CFG(34, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
6438
6439static const struct msm_gpio tsif_gpios[] = {
6440 { .gpio_cfg = TSIF_B_CLK, .label = "tsif_clk", },
6441 { .gpio_cfg = TSIF_B_EN, .label = "tsif_en", },
6442 { .gpio_cfg = TSIF_B_DATA, .label = "tsif_data", },
6443 { .gpio_cfg = TSIF_B_SYNC, .label = "tsif_sync", },
6444};
6445
6446static struct msm_tsif_platform_data tsif_platform_data = {
6447 .num_gpios = ARRAY_SIZE(tsif_gpios),
6448 .gpios = tsif_gpios,
Matt Wagantall640e5fd2011-08-17 16:08:53 -07006449 .tsif_pclk = "iface_clk",
6450 .tsif_ref_clk = "ref_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006451};
6452#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
6453/* TSIF end */
6454
6455static void __init pmic8058_leds_init(void)
6456{
6457 if (machine_is_msm7x30_surf()) {
6458 pm8058_7x30_data.sub_devices[PM8058_SUBDEV_LED].platform_data
6459 = &pm8058_surf_leds_data;
6460 } else if (!machine_is_msm7x30_fluid()) {
6461 pm8058_7x30_data.sub_devices[PM8058_SUBDEV_LED].platform_data
6462 = &pm8058_ffa_leds_data;
6463 } else if (machine_is_msm7x30_fluid()) {
6464 pm8058_7x30_data.sub_devices[PM8058_SUBDEV_LED].platform_data
6465 = &pm8058_fluid_leds_data;
6466 }
6467}
6468
6469static struct msm_spm_platform_data msm_spm_data __initdata = {
6470 .reg_base_addr = MSM_SAW_BASE,
6471
6472 .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x05,
6473 .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x18,
6474 .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0x00006666,
6475 .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0xFF000666,
6476
6477 .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x01,
6478 .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x03,
6479 .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00,
6480
6481 .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01,
6482 .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00,
6483 .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00,
6484
6485 .awake_vlevel = 0xF2,
6486 .retention_vlevel = 0xE0,
6487 .collapse_vlevel = 0x72,
6488 .retention_mid_vlevel = 0xE0,
6489 .collapse_mid_vlevel = 0xE0,
6490
6491 .vctl_timeout_us = 50,
6492};
6493
6494#if defined(CONFIG_TOUCHSCREEN_TSC2007) || \
6495 defined(CONFIG_TOUCHSCREEN_TSC2007_MODULE)
6496
6497#define TSC2007_TS_PEN_INT 20
6498
6499static struct msm_gpio tsc2007_config_data[] = {
6500 { GPIO_CFG(TSC2007_TS_PEN_INT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
6501 "tsc2007_irq" },
6502};
6503
6504static struct vreg *vreg_tsc_s3;
6505static struct vreg *vreg_tsc_s2;
6506
6507static int tsc2007_init(void)
6508{
6509 int rc;
6510
6511 vreg_tsc_s3 = vreg_get(NULL, "s3");
6512 if (IS_ERR(vreg_tsc_s3)) {
6513 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
6514 __func__, PTR_ERR(vreg_tsc_s3));
6515 return -ENODEV;
6516 }
6517
6518 rc = vreg_set_level(vreg_tsc_s3, 1800);
6519 if (rc) {
6520 pr_err("%s: vreg_set_level failed \n", __func__);
6521 goto fail_vreg_set_level;
6522 }
6523
6524 rc = vreg_enable(vreg_tsc_s3);
6525 if (rc) {
6526 pr_err("%s: vreg_enable failed \n", __func__);
6527 goto fail_vreg_set_level;
6528 }
6529
6530 vreg_tsc_s2 = vreg_get(NULL, "s2");
6531 if (IS_ERR(vreg_tsc_s2)) {
6532 printk(KERN_ERR "%s: vreg get failed (%ld)\n",
6533 __func__, PTR_ERR(vreg_tsc_s2));
6534 goto fail_vreg_get;
6535 }
6536
6537 rc = vreg_set_level(vreg_tsc_s2, 1300);
6538 if (rc) {
6539 pr_err("%s: vreg_set_level failed \n", __func__);
6540 goto fail_vreg_s2_level;
6541 }
6542
6543 rc = vreg_enable(vreg_tsc_s2);
6544 if (rc) {
6545 pr_err("%s: vreg_enable failed \n", __func__);
6546 goto fail_vreg_s2_level;
6547 }
6548
6549 rc = msm_gpios_request_enable(tsc2007_config_data,
6550 ARRAY_SIZE(tsc2007_config_data));
6551 if (rc) {
6552 pr_err("%s: Unable to request gpios\n", __func__);
6553 goto fail_gpio_req;
6554 }
6555
6556 return 0;
6557
6558fail_gpio_req:
6559 vreg_disable(vreg_tsc_s2);
6560fail_vreg_s2_level:
6561 vreg_put(vreg_tsc_s2);
6562fail_vreg_get:
6563 vreg_disable(vreg_tsc_s3);
6564fail_vreg_set_level:
6565 vreg_put(vreg_tsc_s3);
6566 return rc;
6567}
6568
6569static int tsc2007_get_pendown_state(void)
6570{
6571 int rc;
6572
6573 rc = gpio_get_value(TSC2007_TS_PEN_INT);
6574 if (rc < 0) {
6575 pr_err("%s: MSM GPIO %d read failed\n", __func__,
6576 TSC2007_TS_PEN_INT);
6577 return rc;
6578 }
6579
6580 return (rc == 0 ? 1 : 0);
6581}
6582
6583static void tsc2007_exit(void)
6584{
6585 vreg_disable(vreg_tsc_s3);
6586 vreg_put(vreg_tsc_s3);
6587 vreg_disable(vreg_tsc_s2);
6588 vreg_put(vreg_tsc_s2);
6589
6590 msm_gpios_disable_free(tsc2007_config_data,
6591 ARRAY_SIZE(tsc2007_config_data));
6592}
6593
6594static int tsc2007_power_shutdown(bool enable)
6595{
6596 int rc;
6597
6598 if (enable == false) {
6599 rc = vreg_enable(vreg_tsc_s2);
6600 if (rc) {
6601 pr_err("%s: vreg_enable failed\n", __func__);
6602 return rc;
6603 }
6604 rc = vreg_enable(vreg_tsc_s3);
6605 if (rc) {
6606 pr_err("%s: vreg_enable failed\n", __func__);
6607 vreg_disable(vreg_tsc_s2);
6608 return rc;
6609 }
6610 /* Voltage settling delay */
6611 msleep(20);
6612 } else {
6613 rc = vreg_disable(vreg_tsc_s2);
6614 if (rc) {
6615 pr_err("%s: vreg_disable failed\n", __func__);
6616 return rc;
6617 }
6618 rc = vreg_disable(vreg_tsc_s3);
6619 if (rc) {
6620 pr_err("%s: vreg_disable failed\n", __func__);
6621 vreg_enable(vreg_tsc_s2);
6622 return rc;
6623 }
6624 }
6625
6626 return rc;
6627}
6628
6629static struct tsc2007_platform_data tsc2007_ts_data = {
6630 .model = 2007,
6631 .x_plate_ohms = 300,
6632 .irq_flags = IRQF_TRIGGER_LOW,
6633 .init_platform_hw = tsc2007_init,
6634 .exit_platform_hw = tsc2007_exit,
6635 .power_shutdown = tsc2007_power_shutdown,
6636 .invert_x = true,
6637 .invert_y = true,
6638 /* REVISIT: Temporary fix for reversed pressure */
6639 .invert_z1 = true,
6640 .invert_z2 = true,
6641 .get_pendown_state = tsc2007_get_pendown_state,
6642};
6643
6644static struct i2c_board_info tsc_i2c_board_info[] = {
6645 {
6646 I2C_BOARD_INFO("tsc2007", 0x48),
6647 .irq = MSM_GPIO_TO_INT(TSC2007_TS_PEN_INT),
6648 .platform_data = &tsc2007_ts_data,
6649 },
6650};
6651#endif
6652
6653static const char *vregs_isa1200_name[] = {
6654 "gp7",
6655 "gp10",
6656};
6657
6658static const int vregs_isa1200_val[] = {
6659 1800,
6660 2600,
6661};
6662static struct vreg *vregs_isa1200[ARRAY_SIZE(vregs_isa1200_name)];
6663
6664static int isa1200_power(int vreg_on)
6665{
6666 int i, rc = 0;
6667
6668 for (i = 0; i < ARRAY_SIZE(vregs_isa1200_name); i++) {
6669 if (!vregs_isa1200[i]) {
6670 pr_err("%s: vreg_get %s failed (%d)\n",
6671 __func__, vregs_isa1200_name[i], rc);
6672 goto vreg_fail;
6673 }
6674
6675 rc = vreg_on ? vreg_enable(vregs_isa1200[i]) :
6676 vreg_disable(vregs_isa1200[i]);
6677 if (rc < 0) {
6678 pr_err("%s: vreg %s %s failed (%d)\n",
6679 __func__, vregs_isa1200_name[i],
6680 vreg_on ? "enable" : "disable", rc);
6681 goto vreg_fail;
6682 }
6683 }
6684
6685 /* vote for DO buffer */
6686 rc = pmapp_clock_vote("VIBR", PMAPP_CLOCK_ID_DO,
6687 vreg_on ? PMAPP_CLOCK_VOTE_ON : PMAPP_CLOCK_VOTE_OFF);
6688 if (rc) {
6689 pr_err("%s: unable to %svote for d0 clk\n",
6690 __func__, vreg_on ? "" : "de-");
6691 goto vreg_fail;
6692 }
6693
6694 return 0;
6695
6696vreg_fail:
6697 while (i)
6698 vreg_disable(vregs_isa1200[--i]);
6699 return rc;
6700}
6701
6702static int isa1200_dev_setup(bool enable)
6703{
6704 int i, rc;
6705
6706 if (enable == true) {
6707 for (i = 0; i < ARRAY_SIZE(vregs_isa1200_name); i++) {
6708 vregs_isa1200[i] = vreg_get(NULL,
6709 vregs_isa1200_name[i]);
6710 if (IS_ERR(vregs_isa1200[i])) {
6711 pr_err("%s: vreg get %s failed (%ld)\n",
6712 __func__, vregs_isa1200_name[i],
6713 PTR_ERR(vregs_isa1200[i]));
6714 rc = PTR_ERR(vregs_isa1200[i]);
6715 goto vreg_get_fail;
6716 }
6717 rc = vreg_set_level(vregs_isa1200[i],
6718 vregs_isa1200_val[i]);
6719 if (rc) {
6720 pr_err("%s: vreg_set_level() = %d\n",
6721 __func__, rc);
6722 goto vreg_get_fail;
6723 }
6724 }
6725
6726 rc = gpio_tlmm_config(GPIO_CFG(HAP_LVL_SHFT_MSM_GPIO, 0,
6727 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
6728 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
6729 if (rc) {
6730 pr_err("%s: Could not configure gpio %d\n",
6731 __func__, HAP_LVL_SHFT_MSM_GPIO);
6732 goto vreg_get_fail;
6733 }
6734
6735 rc = gpio_request(HAP_LVL_SHFT_MSM_GPIO, "haptics_shft_lvl_oe");
6736 if (rc) {
6737 pr_err("%s: unable to request gpio %d (%d)\n",
6738 __func__, HAP_LVL_SHFT_MSM_GPIO, rc);
6739 goto vreg_get_fail;
6740 }
6741
6742 gpio_set_value(HAP_LVL_SHFT_MSM_GPIO, 1);
6743 } else {
6744 for (i = 0; i < ARRAY_SIZE(vregs_isa1200_name); i++)
6745 vreg_put(vregs_isa1200[i]);
6746
6747 gpio_free(HAP_LVL_SHFT_MSM_GPIO);
6748 }
6749
6750 return 0;
6751vreg_get_fail:
6752 while (i)
6753 vreg_put(vregs_isa1200[--i]);
6754 return rc;
6755}
6756static struct isa1200_platform_data isa1200_1_pdata = {
6757 .name = "vibrator",
6758 .power_on = isa1200_power,
6759 .dev_setup = isa1200_dev_setup,
6760 .pwm_ch_id = 1, /*channel id*/
6761 /*gpio to enable haptic*/
6762 .hap_en_gpio = PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_ENABLE),
6763 .max_timeout = 15000,
6764 .mode_ctrl = PWM_GEN_MODE,
6765 .pwm_fd = {
6766 .pwm_div = 256,
6767 },
6768 .is_erm = false,
6769 .smart_en = true,
6770 .ext_clk_en = true,
6771 .chip_en = 1,
6772};
6773
6774static struct i2c_board_info msm_isa1200_board_info[] = {
6775 {
6776 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
6777 .platform_data = &isa1200_1_pdata,
6778 },
6779};
6780
6781
6782static int kp_flip_mpp_config(void)
6783{
6784 return pm8058_mpp_config_digital_in(PM_FLIP_MPP,
6785 PM8058_MPP_DIG_LEVEL_S3, PM_MPP_DIN_TO_INT);
6786}
6787
6788static struct flip_switch_pdata flip_switch_data = {
6789 .name = "kp_flip_switch",
6790 .flip_gpio = PM8058_GPIO_PM_TO_SYS(PM8058_GPIOS) + PM_FLIP_MPP,
6791 .left_key = KEY_OPEN,
6792 .right_key = KEY_CLOSE,
6793 .active_low = 0,
6794 .wakeup = 1,
6795 .flip_mpp_config = kp_flip_mpp_config,
6796};
6797
6798static struct platform_device flip_switch_device = {
6799 .name = "kp_flip_switch",
6800 .id = -1,
6801 .dev = {
6802 .platform_data = &flip_switch_data,
6803 }
6804};
6805
6806static const char *vregs_tma300_name[] = {
6807 "gp6",
6808 "gp7",
6809};
6810
6811static const int vregs_tma300_val[] = {
6812 3050,
6813 1800,
6814};
6815static struct vreg *vregs_tma300[ARRAY_SIZE(vregs_tma300_name)];
6816
6817static int tma300_power(int vreg_on)
6818{
6819 int i, rc = -EINVAL;
6820
6821 for (i = 0; i < ARRAY_SIZE(vregs_tma300_name); i++) {
6822 /* Never disable gp6 for fluid as lcd has a problem with it */
6823 if (!i && !vreg_on)
6824 continue;
6825 if (!vregs_tma300[i]) {
6826 printk(KERN_ERR "%s: vreg_get %s failed (%d)\n",
6827 __func__, vregs_tma300_name[i], rc);
6828 return rc;
6829 }
6830
6831 rc = vreg_on ? vreg_enable(vregs_tma300[i]) :
6832 vreg_disable(vregs_tma300[i]);
6833 if (rc < 0) {
6834 printk(KERN_ERR "%s: vreg %s %s failed (%d)\n",
6835 __func__, vregs_tma300_name[i],
6836 vreg_on ? "enable" : "disable", rc);
6837 return rc;
6838 }
6839 }
6840
6841 return 0;
6842}
6843
6844#define TS_GPIO_IRQ 150
6845
6846static int tma300_dev_setup(bool enable)
6847{
6848 int i, rc;
6849
6850 if (enable) {
6851 /* get voltage sources */
6852 for (i = 0; i < ARRAY_SIZE(vregs_tma300_name); i++) {
6853 vregs_tma300[i] = vreg_get(NULL, vregs_tma300_name[i]);
6854 if (IS_ERR(vregs_tma300[i])) {
6855 pr_err("%s: vreg get %s failed (%ld)\n",
6856 __func__, vregs_tma300_name[i],
6857 PTR_ERR(vregs_tma300[i]));
6858 rc = PTR_ERR(vregs_tma300[i]);
6859 goto vreg_get_fail;
6860 }
6861 rc = vreg_set_level(vregs_tma300[i],
6862 vregs_tma300_val[i]);
6863 if (rc) {
6864 pr_err("%s: vreg_set_level() = %d\n",
6865 __func__, rc);
6866 i++;
6867 goto vreg_get_fail;
6868 }
6869 }
6870
6871 /* enable interrupt gpio */
6872 rc = gpio_tlmm_config(GPIO_CFG(TS_GPIO_IRQ, 0, GPIO_CFG_INPUT,
6873 GPIO_CFG_PULL_UP, GPIO_CFG_6MA), GPIO_CFG_ENABLE);
6874 if (rc) {
6875 pr_err("%s: Could not configure gpio %d\n",
6876 __func__, TS_GPIO_IRQ);
6877 goto vreg_get_fail;
6878 }
6879
6880 /* virtual keys */
6881 tma300_vkeys_attr.attr.name = "virtualkeys.msm_tma300_ts";
6882 properties_kobj = kobject_create_and_add("board_properties",
6883 NULL);
6884 if (!properties_kobj) {
6885 pr_err("%s: failed to create a kobject"
6886 "for board_properites\n", __func__);
6887 rc = -ENOMEM;
6888 goto vreg_get_fail;
6889 }
6890 rc = sysfs_create_group(properties_kobj,
6891 &tma300_properties_attr_group);
6892 if (rc) {
6893 pr_err("%s: failed to create a sysfs entry %s\n",
6894 __func__, tma300_vkeys_attr.attr.name);
6895 kobject_put(properties_kobj);
6896 goto vreg_get_fail;
6897 }
6898 } else {
6899 /* put voltage sources */
6900 for (i = 0; i < ARRAY_SIZE(vregs_tma300_name); i++)
6901 vreg_put(vregs_tma300[i]);
6902 /* destroy virtual keys */
6903 if (properties_kobj) {
6904 sysfs_remove_group(properties_kobj,
6905 &tma300_properties_attr_group);
6906 kobject_put(properties_kobj);
6907 }
6908 }
6909 return 0;
6910
6911vreg_get_fail:
6912 while (i)
6913 vreg_put(vregs_tma300[--i]);
6914 return rc;
6915}
6916
6917static struct cy8c_ts_platform_data cy8ctma300_pdata = {
6918 .power_on = tma300_power,
6919 .dev_setup = tma300_dev_setup,
6920 .ts_name = "msm_tma300_ts",
6921 .dis_min_x = 0,
6922 .dis_max_x = 479,
6923 .dis_min_y = 0,
6924 .dis_max_y = 799,
6925 .res_x = 479,
6926 .res_y = 1009,
6927 .min_tid = 1,
6928 .max_tid = 255,
6929 .min_touch = 0,
6930 .max_touch = 255,
6931 .min_width = 0,
6932 .max_width = 255,
6933 .invert_y = 1,
6934 .nfingers = 4,
6935 .irq_gpio = TS_GPIO_IRQ,
6936 .resout_gpio = -1,
6937};
6938
6939static struct i2c_board_info cy8ctma300_board_info[] = {
6940 {
6941 I2C_BOARD_INFO("cy8ctma300", 0x2),
6942 .platform_data = &cy8ctma300_pdata,
6943 }
6944};
6945
Daniel Walker8d747cd2010-02-25 11:37:43 -08006946static void __init msm7x30_init(void)
6947{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006948 int rc;
6949 unsigned smem_size;
6950 uint32_t usb_hub_gpio_cfg_value = GPIO_CFG(56,
6951 0,
6952 GPIO_CFG_OUTPUT,
6953 GPIO_CFG_NO_PULL,
6954 GPIO_CFG_2MA);
6955 uint32_t soc_version = 0;
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +05306956
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006957 soc_version = socinfo_get_version();
6958
Stephen Boydbb600ae2011-08-02 20:11:40 -07006959 msm_clock_init(&msm7x30_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006960#ifdef CONFIG_SERIAL_MSM_CONSOLE
6961 msm7x30_init_uart2();
6962#endif
6963 msm_spm_init(&msm_spm_data, 1);
Matt Wagantallec57f062011-08-16 23:54:46 -07006964 acpuclk_init(&acpuclk_7x30_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006965 if (machine_is_msm7x30_surf() || machine_is_msm7x30_fluid())
6966 msm7x30_cfg_smsc911x();
6967
6968#ifdef CONFIG_USB_MSM_OTG_72K
6969 if (SOCINFO_VERSION_MAJOR(soc_version) >= 2 &&
6970 SOCINFO_VERSION_MINOR(soc_version) >= 1) {
6971 pr_debug("%s: SOC Version:2.(1 or more)\n", __func__);
6972 msm_otg_pdata.ldo_set_voltage = 0;
6973 }
6974
6975 msm_device_otg.dev.platform_data = &msm_otg_pdata;
6976#ifdef CONFIG_USB_GADGET
6977 msm_otg_pdata.swfi_latency =
6978 msm_pm_data
6979 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
6980 msm_device_gadget_peripheral.dev.platform_data = &msm_gadget_pdata;
6981#endif
6982#endif
6983 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(136);
6984 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
6985#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
6986 msm_device_tsif.dev.platform_data = &tsif_platform_data;
6987#endif
6988 if (machine_is_msm7x30_fluid()) {
6989 msm_adc_pdata.dev_names = msm_adc_fluid_device_names;
6990 msm_adc_pdata.num_adc = ARRAY_SIZE(msm_adc_fluid_device_names);
6991 } else {
6992 msm_adc_pdata.dev_names = msm_adc_surf_device_names;
6993 msm_adc_pdata.num_adc = ARRAY_SIZE(msm_adc_surf_device_names);
6994 }
6995
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +05306996#ifdef CONFIG_MSM_SSBI
6997 msm_device_ssbi_pmic1.dev.platform_data =
6998 &msm7x30_ssbi_pm8058_pdata;
6999#endif
7000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007001 platform_add_devices(msm_footswitch_devices,
7002 msm_num_footswitch_devices);
Daniel Walker8d747cd2010-02-25 11:37:43 -08007003 platform_add_devices(devices, ARRAY_SIZE(devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007004#ifdef CONFIG_USB_EHCI_MSM_72K
7005 msm_add_host(0, &msm_usb_host_pdata);
7006#endif
7007 msm7x30_init_mmc();
7008 msm7x30_init_nand();
7009 msm_qsd_spi_init();
7010
7011#ifdef CONFIG_SPI_QSD
7012 if (machine_is_msm7x30_fluid())
7013 spi_register_board_info(lcdc_sharp_spi_board_info,
7014 ARRAY_SIZE(lcdc_sharp_spi_board_info));
7015 else
7016 spi_register_board_info(lcdc_toshiba_spi_board_info,
7017 ARRAY_SIZE(lcdc_toshiba_spi_board_info));
7018#endif
7019
7020 msm_fb_add_devices();
7021 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
7022 msm_device_i2c_init();
7023 msm_device_i2c_2_init();
7024 qup_device_i2c_init();
7025 buses_init();
7026 msm7x30_init_marimba();
7027#ifdef CONFIG_MSM7KV2_AUDIO
7028 snddev_poweramp_gpio_init();
7029 aux_pcm_gpio_init();
7030#endif
7031
7032 i2c_register_board_info(0, msm_i2c_board_info,
7033 ARRAY_SIZE(msm_i2c_board_info));
7034
7035 if (!machine_is_msm8x55_svlte_ffa() && !machine_is_msm7x30_fluid())
7036 marimba_pdata.tsadc = &marimba_tsadc_pdata;
7037
7038 if (machine_is_msm7x30_fluid())
7039 i2c_register_board_info(0, cy8info,
7040 ARRAY_SIZE(cy8info));
7041#ifdef CONFIG_BOSCH_BMA150
7042 if (machine_is_msm7x30_fluid())
7043 i2c_register_board_info(0, bma150_board_info,
7044 ARRAY_SIZE(bma150_board_info));
7045#endif
7046
7047 i2c_register_board_info(2, msm_marimba_board_info,
7048 ARRAY_SIZE(msm_marimba_board_info));
7049
7050 i2c_register_board_info(2, msm_i2c_gsbi7_timpani_info,
7051 ARRAY_SIZE(msm_i2c_gsbi7_timpani_info));
7052
7053 i2c_register_board_info(4 /* QUP ID */, msm_camera_boardinfo,
7054 ARRAY_SIZE(msm_camera_boardinfo));
7055
7056 bt_power_init();
7057#ifdef CONFIG_I2C_SSBI
7058 msm_device_ssbi6.dev.platform_data = &msm_i2c_ssbi6_pdata;
7059 msm_device_ssbi7.dev.platform_data = &msm_i2c_ssbi7_pdata;
7060#endif
7061 if (machine_is_msm7x30_fluid())
7062 i2c_register_board_info(0, msm_isa1200_board_info,
7063 ARRAY_SIZE(msm_isa1200_board_info));
7064
7065#if defined(CONFIG_TOUCHSCREEN_TSC2007) || \
7066 defined(CONFIG_TOUCHSCREEN_TSC2007_MODULE)
7067 if (machine_is_msm8x55_svlte_ffa())
7068 i2c_register_board_info(2, tsc_i2c_board_info,
7069 ARRAY_SIZE(tsc_i2c_board_info));
7070#endif
7071
7072 if (machine_is_msm7x30_surf())
7073 platform_device_register(&flip_switch_device);
7074 pmic8058_leds_init();
7075
7076 if (machine_is_msm7x30_fluid()) {
7077 /* Initialize platform data for fluid v2 hardware */
7078 if (SOCINFO_VERSION_MAJOR(
7079 socinfo_get_platform_version()) == 2) {
7080 cy8ctma300_pdata.res_y = 920;
7081 cy8ctma300_pdata.invert_y = 0;
7082 }
7083 i2c_register_board_info(0, cy8ctma300_board_info,
7084 ARRAY_SIZE(cy8ctma300_board_info));
7085 }
7086
7087 if (machine_is_msm8x55_svlte_surf() || machine_is_msm8x55_svlte_ffa()) {
7088 rc = gpio_tlmm_config(usb_hub_gpio_cfg_value, GPIO_CFG_ENABLE);
7089 if (rc)
7090 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
7091 __func__, usb_hub_gpio_cfg_value, rc);
7092 }
7093
7094 boot_reason = *(unsigned int *)
7095 (smem_get_entry(SMEM_POWER_ON_STATUS_INFO, &smem_size));
7096 printk(KERN_NOTICE "Boot Reason = 0x%02x\n", boot_reason);
7097}
7098
7099static unsigned pmem_sf_size = MSM_PMEM_SF_SIZE;
7100static int __init pmem_sf_size_setup(char *p)
7101{
7102 pmem_sf_size = memparse(p, NULL);
7103 return 0;
7104}
7105early_param("pmem_sf_size", pmem_sf_size_setup);
7106
7107static unsigned fb_size = MSM_FB_SIZE;
7108static int __init fb_size_setup(char *p)
7109{
7110 fb_size = memparse(p, NULL);
7111 return 0;
7112}
7113early_param("fb_size", fb_size_setup);
7114
7115static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
7116static int __init pmem_adsp_size_setup(char *p)
7117{
7118 pmem_adsp_size = memparse(p, NULL);
7119 return 0;
7120}
7121early_param("pmem_adsp_size", pmem_adsp_size_setup);
7122
7123static unsigned fluid_pmem_adsp_size = MSM_FLUID_PMEM_ADSP_SIZE;
7124static int __init fluid_pmem_adsp_size_setup(char *p)
7125{
7126 fluid_pmem_adsp_size = memparse(p, NULL);
7127 return 0;
7128}
7129early_param("fluid_pmem_adsp_size", fluid_pmem_adsp_size_setup);
7130
7131static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
7132static int __init pmem_audio_size_setup(char *p)
7133{
7134 pmem_audio_size = memparse(p, NULL);
7135 return 0;
7136}
7137early_param("pmem_audio_size", pmem_audio_size_setup);
7138
7139static unsigned pmem_kernel_ebi0_size = PMEM_KERNEL_EBI0_SIZE;
7140static int __init pmem_kernel_ebi0_size_setup(char *p)
7141{
7142 pmem_kernel_ebi0_size = memparse(p, NULL);
7143 return 0;
7144}
7145early_param("pmem_kernel_ebi0_size", pmem_kernel_ebi0_size_setup);
7146
7147static struct memtype_reserve msm7x30_reserve_table[] __initdata = {
7148 [MEMTYPE_SMI] = {
7149 },
7150 [MEMTYPE_EBI0] = {
7151 .flags = MEMTYPE_FLAGS_1M_ALIGN,
7152 },
7153 [MEMTYPE_EBI1] = {
7154 .flags = MEMTYPE_FLAGS_1M_ALIGN,
7155 },
7156};
7157
7158static void __init size_pmem_devices(void)
7159{
7160#ifdef CONFIG_ANDROID_PMEM
7161 unsigned long size;
7162
7163 if machine_is_msm7x30_fluid()
7164 size = fluid_pmem_adsp_size;
7165 else
7166 size = pmem_adsp_size;
7167 android_pmem_adsp_pdata.size = size;
7168 android_pmem_audio_pdata.size = pmem_audio_size;
7169 android_pmem_pdata.size = pmem_sf_size;
7170#endif
7171}
7172
7173static void __init reserve_memory_for(struct android_pmem_platform_data *p)
7174{
7175 msm7x30_reserve_table[p->memory_type].size += p->size;
7176}
7177
7178static void __init reserve_pmem_memory(void)
7179{
7180#ifdef CONFIG_ANDROID_PMEM
7181 reserve_memory_for(&android_pmem_adsp_pdata);
7182 reserve_memory_for(&android_pmem_audio_pdata);
7183 reserve_memory_for(&android_pmem_pdata);
7184 msm7x30_reserve_table[MEMTYPE_EBI0].size += pmem_kernel_ebi0_size;
7185#endif
7186}
7187
7188static void __init msm7x30_calculate_reserve_sizes(void)
7189{
7190 size_pmem_devices();
7191 reserve_pmem_memory();
7192}
7193
7194static int msm7x30_paddr_to_memtype(unsigned int paddr)
7195{
7196 if (paddr < 0x40000000)
7197 return MEMTYPE_EBI0;
7198 if (paddr >= 0x40000000 && paddr < 0x80000000)
7199 return MEMTYPE_EBI1;
7200 return MEMTYPE_NONE;
7201}
7202
7203static struct reserve_info msm7x30_reserve_info __initdata = {
7204 .memtype_reserve_table = msm7x30_reserve_table,
7205 .calculate_reserve_sizes = msm7x30_calculate_reserve_sizes,
7206 .paddr_to_memtype = msm7x30_paddr_to_memtype,
7207};
7208
7209static void __init msm7x30_reserve(void)
7210{
7211 reserve_info = &msm7x30_reserve_info;
7212 msm_reserve();
7213}
7214
7215static void __init msm7x30_allocate_memory_regions(void)
7216{
7217 void *addr;
7218 unsigned long size;
7219
7220 size = fb_size ? : MSM_FB_SIZE;
7221 addr = alloc_bootmem_align(size, 0x1000);
7222 msm_fb_resources[0].start = __pa(addr);
7223 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
7224 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
7225 size, addr, __pa(addr));
Daniel Walker8d747cd2010-02-25 11:37:43 -08007226}
7227
7228static void __init msm7x30_map_io(void)
7229{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007230 msm_shared_ram_phys = 0x00100000;
Daniel Walker8d747cd2010-02-25 11:37:43 -08007231 msm_map_msm7x30_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07007232 if (socinfo_init() < 0)
7233 printk(KERN_ERR "%s: socinfo_init() failed!\n",
7234 __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007235}
7236
7237static void __init msm7x30_init_early(void)
7238{
7239 msm7x30_allocate_memory_regions();
Daniel Walker8d747cd2010-02-25 11:37:43 -08007240}
7241
7242MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
Russell Kingb75c1782011-01-04 19:03:16 +00007243 .boot_params = PLAT_PHYS_OFFSET + 0x100,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007244 .map_io = msm7x30_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007245 .reserve = msm7x30_reserve,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007246 .init_irq = msm7x30_init_irq,
7247 .init_machine = msm7x30_init,
7248 .timer = &msm_timer,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007249 .init_early = msm7x30_init_early,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007250MACHINE_END
7251
7252MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
Russell Kingb75c1782011-01-04 19:03:16 +00007253 .boot_params = PLAT_PHYS_OFFSET + 0x100,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007254 .map_io = msm7x30_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007255 .reserve = msm7x30_reserve,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007256 .init_irq = msm7x30_init_irq,
7257 .init_machine = msm7x30_init,
7258 .timer = &msm_timer,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007259 .init_early = msm7x30_init_early,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007260MACHINE_END
7261
7262MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
Russell Kingb75c1782011-01-04 19:03:16 +00007263 .boot_params = PLAT_PHYS_OFFSET + 0x100,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007264 .map_io = msm7x30_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007265 .reserve = msm7x30_reserve,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007266 .init_irq = msm7x30_init_irq,
7267 .init_machine = msm7x30_init,
7268 .timer = &msm_timer,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007269 .init_early = msm7x30_init_early,
7270MACHINE_END
7271
7272MACHINE_START(MSM8X55_SURF, "QCT MSM8X55 SURF")
7273 .boot_params = PHYS_OFFSET + 0x100,
7274 .map_io = msm7x30_map_io,
7275 .reserve = msm7x30_reserve,
7276 .init_irq = msm7x30_init_irq,
7277 .init_machine = msm7x30_init,
7278 .timer = &msm_timer,
7279 .init_early = msm7x30_init_early,
7280MACHINE_END
7281
7282MACHINE_START(MSM8X55_FFA, "QCT MSM8X55 FFA")
7283 .boot_params = PHYS_OFFSET + 0x100,
7284 .map_io = msm7x30_map_io,
7285 .reserve = msm7x30_reserve,
7286 .init_irq = msm7x30_init_irq,
7287 .init_machine = msm7x30_init,
7288 .timer = &msm_timer,
7289 .init_early = msm7x30_init_early,
7290MACHINE_END
7291MACHINE_START(MSM8X55_SVLTE_SURF, "QCT MSM8X55 SVLTE SURF")
7292 .boot_params = PHYS_OFFSET + 0x100,
7293 .map_io = msm7x30_map_io,
7294 .reserve = msm7x30_reserve,
7295 .init_irq = msm7x30_init_irq,
7296 .init_machine = msm7x30_init,
7297 .timer = &msm_timer,
7298 .init_early = msm7x30_init_early,
7299MACHINE_END
7300MACHINE_START(MSM8X55_SVLTE_FFA, "QCT MSM8X55 SVLTE FFA")
7301 .boot_params = PHYS_OFFSET + 0x100,
7302 .map_io = msm7x30_map_io,
7303 .reserve = msm7x30_reserve,
7304 .init_irq = msm7x30_init_irq,
7305 .init_machine = msm7x30_init,
7306 .timer = &msm_timer,
7307 .init_early = msm7x30_init_early,
Daniel Walker8d747cd2010-02-25 11:37:43 -08007308MACHINE_END