blob: 8c03d17b3618a6dfdb362709316eede8e7ee238b [file] [log] [blame]
Chintan Pandya250c2e52012-01-19 17:15:49 +05301/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/init.h>
14#include <linux/ioport.h>
15#include <linux/platform_device.h>
16#include <linux/bootmem.h>
17#include <linux/regulator/consumer.h>
18#include <asm/mach-types.h>
19#include <asm/io.h>
20#include <mach/msm_bus_board.h>
21#include <mach/msm_memtypes.h>
22#include <mach/board.h>
23#include <mach/gpio.h>
24#include <mach/gpiomux.h>
25#include <mach/socinfo.h>
26#include <mach/rpc_pmapp.h>
27#include "devices.h"
28#include "board-msm7627a.h"
29
30#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
31#define MSM_FB_SIZE 0x260000
32#define MSM7x25A_MSM_FB_SIZE 0xE1000
33#else
34#define MSM_FB_SIZE 0x195000
35#define MSM7x25A_MSM_FB_SIZE 0x96000
36#endif
37
38static unsigned fb_size = MSM_FB_SIZE;
39static int __init fb_size_setup(char *p)
40{
41 fb_size = memparse(p, NULL);
42 return 0;
43}
44
45early_param("fb_size", fb_size_setup);
46
47static struct regulator_bulk_data regs_lcdc[] = {
48 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
49 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
50};
51static uint32_t lcdc_gpio_initialized;
52
53static void lcdc_toshiba_gpio_init(void)
54{
55 int rc = 0;
56 if (!lcdc_gpio_initialized) {
57 if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
58 pr_err("failed to request gpio spi_clk\n");
59 return;
60 }
61 if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
62 pr_err("failed to request gpio spi_cs0_N\n");
63 goto fail_gpio6;
64 }
65 if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
66 pr_err("failed to request gpio spi_mosi\n");
67 goto fail_gpio5;
68 }
69 if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
70 pr_err("failed to request gpio spi_miso\n");
71 goto fail_gpio4;
72 }
73 if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
74 pr_err("failed to request gpio_disp_pwr\n");
75 goto fail_gpio3;
76 }
77 if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
78 pr_err("failed to request gpio_bkl_en\n");
79 goto fail_gpio2;
80 }
81 pmapp_disp_backlight_init();
82
83 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc),
84 regs_lcdc);
85 if (rc) {
86 pr_err("%s: could not get regulators: %d\n",
87 __func__, rc);
88 goto fail_gpio1;
89 }
90
91 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
92 regs_lcdc);
93 if (rc) {
94 pr_err("%s: could not set voltages: %d\n",
95 __func__, rc);
96 goto fail_vreg;
97 }
98 lcdc_gpio_initialized = 1;
99 }
100 return;
101fail_vreg:
102 regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
103fail_gpio1:
104 gpio_free(GPIO_BACKLIGHT_EN);
105fail_gpio2:
106 gpio_free(GPIO_DISPLAY_PWR_EN);
107fail_gpio3:
108 gpio_free(GPIO_SPI_MISO);
109fail_gpio4:
110 gpio_free(GPIO_SPI_MOSI);
111fail_gpio5:
112 gpio_free(GPIO_SPI_CS0_N);
113fail_gpio6:
114 gpio_free(GPIO_SPI_CLK);
115 lcdc_gpio_initialized = 0;
116}
117
118static uint32_t lcdc_gpio_table[] = {
119 GPIO_SPI_CLK,
120 GPIO_SPI_CS0_N,
121 GPIO_SPI_MOSI,
122 GPIO_DISPLAY_PWR_EN,
123 GPIO_BACKLIGHT_EN,
124 GPIO_SPI_MISO,
125};
126
127static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable)
128{
129 int n;
130
131 if (lcdc_gpio_initialized) {
132 /* All are IO Expander GPIOs */
133 for (n = 0; n < (len - 1); n++)
134 gpio_direction_output(table[n], 1);
135 }
136}
137
138static void lcdc_toshiba_config_gpios(int enable)
139{
140 config_lcdc_gpio_table(lcdc_gpio_table,
141 ARRAY_SIZE(lcdc_gpio_table), enable);
142}
143
144static int msm_fb_lcdc_power_save(int on)
145{
146 int rc = 0;
147 /* Doing the init of the LCDC GPIOs very late as they are from
148 an I2C-controlled IO Expander */
149 lcdc_toshiba_gpio_init();
150
151 if (lcdc_gpio_initialized) {
152 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
153 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
154
155 rc = on ? regulator_bulk_enable(
156 ARRAY_SIZE(regs_lcdc), regs_lcdc) :
157 regulator_bulk_disable(
158 ARRAY_SIZE(regs_lcdc), regs_lcdc);
159
160 if (rc)
161 pr_err("%s: could not %sable regulators: %d\n",
162 __func__, on ? "en" : "dis", rc);
163 }
164
165 return rc;
166}
167
168static int lcdc_toshiba_set_bl(int level)
169{
170 int ret;
171
172 ret = pmapp_disp_backlight_set_brightness(level);
173 if (ret)
174 pr_err("%s: can't set lcd backlight!\n", __func__);
175
176 return ret;
177}
178
179static struct lcdc_platform_data lcdc_pdata = {
180 .lcdc_gpio_config = NULL,
181 .lcdc_power_save = msm_fb_lcdc_power_save,
182};
183
184static int lcd_panel_spi_gpio_num[] = {
185 GPIO_SPI_MOSI, /* spi_sdi */
186 GPIO_SPI_MISO, /* spi_sdoi */
187 GPIO_SPI_CLK, /* spi_clk */
188 GPIO_SPI_CS0_N, /* spi_cs */
189};
190
191static struct msm_panel_common_pdata lcdc_toshiba_panel_data = {
192 .panel_config_gpio = lcdc_toshiba_config_gpios,
193 .pmic_backlight = lcdc_toshiba_set_bl,
194 .gpio_num = lcd_panel_spi_gpio_num,
195};
196
197static struct platform_device lcdc_toshiba_panel_device = {
198 .name = "lcdc_toshiba_fwvga_pt",
199 .id = 0,
200 .dev = {
201 .platform_data = &lcdc_toshiba_panel_data,
202 }
203};
204
205static struct resource msm_fb_resources[] = {
206 {
207 .flags = IORESOURCE_DMA,
208 }
209};
210
211#define PANEL_NAME_MAX_LEN 30
212#define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt"
213#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
214
215static int msm_fb_detect_panel(const char *name)
216{
217 int ret = -ENODEV;
218
219 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
220 if (!strncmp(name, "lcdc_toshiba_fwvga_pt", 21) ||
221 !strncmp(name, "mipi_cmd_renesas_fwvga", 22))
222 ret = 0;
223 } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) {
224 if (!strncmp(name, "mipi_cmd_renesas_fwvga", 22))
225 ret = 0;
226 } else if (machine_is_msm7627a_qrd1()) {
227 if (!strncmp(name, "mipi_video_truly_wvga", 21))
228 ret = 0;
229 }
230
231#if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \
232 !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \
233 !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT)
234 if (machine_is_msm7x27a_surf() ||
235 machine_is_msm7625a_surf()) {
236 if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME,
237 strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME,
238 PANEL_NAME_MAX_LEN)))
239 return 0;
240 }
241#endif
242
243 return ret;
244}
245
246static int mipi_truly_set_bl(int on)
247{
248 gpio_set_value_cansleep(QRD_GPIO_BACKLIGHT_EN, !!on);
249
250 return 1;
251}
252
253static struct msm_fb_platform_data msm_fb_pdata = {
254 .detect_client = msm_fb_detect_panel,
255};
256
257static struct platform_device msm_fb_device = {
258 .name = "msm_fb",
259 .id = 0,
260 .num_resources = ARRAY_SIZE(msm_fb_resources),
261 .resource = msm_fb_resources,
262 .dev = {
263 .platform_data = &msm_fb_pdata,
264 }
265};
266
267#ifdef CONFIG_FB_MSM_MIPI_DSI
268static int mipi_renesas_set_bl(int level)
269{
270 int ret;
271
272 ret = pmapp_disp_backlight_set_brightness(level);
273
274 if (ret)
275 pr_err("%s: can't set lcd backlight!\n", __func__);
276
277 return ret;
278}
279
280static struct msm_panel_common_pdata mipi_renesas_pdata = {
281 .pmic_backlight = mipi_renesas_set_bl,
282};
283
284
285static struct platform_device mipi_dsi_renesas_panel_device = {
286 .name = "mipi_renesas",
287 .id = 0,
288 .dev = {
289 .platform_data = &mipi_renesas_pdata,
290 }
291};
292#endif
293
294static struct msm_panel_common_pdata mipi_truly_pdata = {
295 .pmic_backlight = mipi_truly_set_bl,
296};
297
298static struct platform_device mipi_dsi_truly_panel_device = {
299 .name = "mipi_truly",
300 .id = 0,
301 .dev = {
302 .platform_data = &mipi_truly_pdata,
303 }
304};
305
306static struct platform_device *msm_fb_devices[] __initdata = {
307 &msm_fb_device,
308 &lcdc_toshiba_panel_device,
309#ifdef CONFIG_FB_MSM_MIPI_DSI
310 &mipi_dsi_renesas_panel_device,
311#endif
312};
313
314static struct platform_device *qrd_fb_devices[] __initdata = {
315 &msm_fb_device,
316 &mipi_dsi_truly_panel_device,
317};
318
Taniya Dasc868a2e2012-01-03 10:18:47 +0530319static struct platform_device *evb_fb_devices[] __initdata = {
320
321};
322
Chintan Pandya250c2e52012-01-19 17:15:49 +0530323void __init msm_msm7627a_allocate_memory_regions(void)
324{
325 void *addr;
326 unsigned long fb_size;
327
328 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa())
329 fb_size = MSM7x25A_MSM_FB_SIZE;
330 else
331 fb_size = MSM_FB_SIZE;
332 addr = alloc_bootmem_align(fb_size, 0x1000);
333 msm_fb_resources[0].start = __pa(addr);
334 msm_fb_resources[0].end = msm_fb_resources[0].start + fb_size - 1;
335 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", fb_size,
336 addr, __pa(addr));
337}
338
339static struct msm_panel_common_pdata mdp_pdata = {
340 .gpio = 97,
341 .mdp_rev = MDP_REV_303,
342};
343
344#define GPIO_LCDC_BRDG_PD 128
345#define GPIO_LCDC_BRDG_RESET_N 129
346#define GPIO_LCD_DSI_SEL 125
347#define LCDC_RESET_PHYS 0x90008014
348
349static void __iomem *lcdc_reset_ptr;
350
351static unsigned mipi_dsi_gpio[] = {
352 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT,
353 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
354 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT,
355 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_PD */
356};
357
358static unsigned lcd_dsi_sel_gpio[] = {
359 GPIO_CFG(GPIO_LCD_DSI_SEL, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
360 GPIO_CFG_2MA),
361};
362
363enum {
364 DSI_SINGLE_LANE = 1,
365 DSI_TWO_LANES,
366};
367
368static int msm_fb_get_lane_config(void)
369{
370 /* For MSM7627A SURF/FFA and QRD */
371 int rc = DSI_TWO_LANES;
372 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
373 rc = DSI_SINGLE_LANE;
374 pr_info("DSI_SINGLE_LANES\n");
375 } else {
376 pr_info("DSI_TWO_LANES\n");
377 }
378 return rc;
379}
380
381static int msm_fb_dsi_client_msm_reset(void)
382{
383 int rc = 0;
384
385 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
386 if (rc < 0) {
387 pr_err("failed to request lcd brdg reset_n\n");
388 return rc;
389 }
390
391 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
392 if (rc < 0) {
393 pr_err("failed to request lcd brdg pd\n");
394 return rc;
395 }
396
397 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
398 if (rc) {
399 pr_err("Failed to enable LCDC Bridge reset enable\n");
400 goto gpio_error;
401 }
402
403 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
404 if (rc) {
405 pr_err("Failed to enable LCDC Bridge pd enable\n");
406 goto gpio_error2;
407 }
408
409 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
410 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
411 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
412
413 if (!rc) {
414 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
415 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
416 sizeof(uint32_t));
417
418 if (!lcdc_reset_ptr)
419 return 0;
420 }
421 return rc;
422 } else {
423 goto gpio_error;
424 }
425
426gpio_error2:
427 pr_err("Failed GPIO bridge pd\n");
428 gpio_free(GPIO_LCDC_BRDG_PD);
429
430gpio_error:
431 pr_err("Failed GPIO bridge reset\n");
432 gpio_free(GPIO_LCDC_BRDG_RESET_N);
433 return rc;
434}
435
436static int mipi_truly_sel_mode(int video_mode)
437{
438 int rc = 0;
439
440 rc = gpio_request(GPIO_LCD_DSI_SEL, "lcd_dsi_sel");
441 if (rc < 0)
442 goto gpio_error;
443
444 rc = gpio_tlmm_config(lcd_dsi_sel_gpio[0], GPIO_CFG_ENABLE);
445 if (rc)
446 goto gpio_error;
447
448 rc = gpio_direction_output(GPIO_LCD_DSI_SEL, 1);
449 if (!rc) {
450 gpio_set_value_cansleep(GPIO_LCD_DSI_SEL, video_mode);
451 return rc;
452 } else {
453 goto gpio_error;
454 }
455
456gpio_error:
457 pr_err("mipi_truly_sel_mode failed\n");
458 gpio_free(GPIO_LCD_DSI_SEL);
459 return rc;
460}
461
462static int msm_fb_dsi_client_qrd1_reset(void)
463{
464 int rc = 0;
465
466 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
467 if (rc < 0) {
468 pr_err("failed to request lcd brdg reset_n\n");
469 return rc;
470 }
471
472 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
473 if (rc < 0) {
474 pr_err("Failed to enable LCDC Bridge reset enable\n");
475 return rc;
476 }
477
478 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
479 if (rc < 0) {
480 pr_err("Failed GPIO bridge pd\n");
481 gpio_free(GPIO_LCDC_BRDG_RESET_N);
482 return rc;
483 }
484
485 mipi_truly_sel_mode(1);
486
487 return rc;
488}
489
490static int msm_fb_dsi_client_reset(void)
491{
492 int rc = 0;
493
494 if (machine_is_msm7627a_qrd1())
495 rc = msm_fb_dsi_client_qrd1_reset();
496 else
497 rc = msm_fb_dsi_client_msm_reset();
498
499 return rc;
500
501}
502
503static struct regulator_bulk_data regs_dsi[] = {
504 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
505 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
506};
507
508static int dsi_gpio_initialized;
509
510static int mipi_dsi_panel_msm_power(int on)
511{
512 int rc = 0;
513 uint32_t lcdc_reset_cfg;
514
515 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
516 if (unlikely(!dsi_gpio_initialized)) {
517 pmapp_disp_backlight_init();
518
519 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
520 if (rc < 0) {
521 pr_err("failed to request gpio_disp_pwr\n");
522 return rc;
523 }
524
525 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
526 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
527 if (rc < 0) {
528 pr_err("failed to enable display pwr\n");
529 goto fail_gpio1;
530 }
531
532 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
533 if (rc < 0) {
534 pr_err("failed to request gpio_bkl_en\n");
535 goto fail_gpio1;
536 }
537
538 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
539 if (rc < 0) {
540 pr_err("failed to enable backlight\n");
541 goto fail_gpio2;
542 }
543 }
544
545 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
546 if (rc) {
547 pr_err("%s: could not get regulators: %d\n",
548 __func__, rc);
549 goto fail_gpio2;
550 }
551
552 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi),
553 regs_dsi);
554 if (rc) {
555 pr_err("%s: could not set voltages: %d\n",
556 __func__, rc);
557 goto fail_vreg;
558 }
559 if (pmapp_disp_backlight_set_brightness(100))
560 pr_err("backlight set brightness failed\n");
561
562 dsi_gpio_initialized = 1;
563 }
564 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
565 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
566 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
567 } else if (machine_is_msm7x27a_ffa() ||
568 machine_is_msm7625a_ffa()) {
569 if (on) {
570 /* This line drives an active low pin on FFA */
571 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
572 if (rc < 0)
573 pr_err("failed to set direction for "
574 "display pwr\n");
575 } else {
576 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
577 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
578 if (rc < 0)
579 pr_err("failed to set direction for "
580 "display pwr\n");
581 }
582 }
583
584 if (on) {
585 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
586
587 if (machine_is_msm7x27a_surf() ||
588 machine_is_msm7625a_surf()) {
589 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
590 rmb();
591 lcdc_reset_cfg &= ~1;
592
593 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
594 msleep(20);
595 wmb();
596 lcdc_reset_cfg |= 1;
597 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
598 } else {
599 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
600 msleep(20);
601 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
602 }
603 } else {
604 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
605
606 if (pmapp_disp_backlight_set_brightness(0))
607 pr_err("backlight set brightness failed\n");
608 }
609
610 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
611 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
612
613 if (rc)
614 pr_err("%s: could not %sable regulators: %d\n",
615 __func__, on ? "en" : "dis", rc);
616
617 return rc;
618fail_vreg:
619 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
620fail_gpio2:
621 gpio_free(GPIO_BACKLIGHT_EN);
622fail_gpio1:
623 gpio_free(GPIO_DISPLAY_PWR_EN);
624 dsi_gpio_initialized = 0;
625 return rc;
626}
627
628static int mipi_dsi_panel_qrd1_power(int on)
629{
630 int rc = 0;
631
632 if (!dsi_gpio_initialized) {
633 rc = gpio_request(QRD_GPIO_BACKLIGHT_EN, "gpio_bkl_en");
634 if (rc < 0)
635 return rc;
636
637 rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_BACKLIGHT_EN, 0,
638 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
639 GPIO_CFG_ENABLE);
640 if (rc < 0) {
641 pr_err("failed GPIO_BACKLIGHT_EN tlmm config\n");
642 return rc;
643 }
644
645 rc = gpio_direction_output(QRD_GPIO_BACKLIGHT_EN, 1);
646 if (rc < 0) {
647 pr_err("failed to enable backlight\n");
648 gpio_free(QRD_GPIO_BACKLIGHT_EN);
649 return rc;
650 }
651 dsi_gpio_initialized = 1;
652 }
653
654 gpio_set_value_cansleep(QRD_GPIO_BACKLIGHT_EN, !!on);
655
656 if (!on) {
657 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
658 msleep(20);
659 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
660 msleep(20);
661 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
662
663 }
664
665 return rc;
666}
667
668static int mipi_dsi_panel_power(int on)
669{
670 int rc = 0;
671
672 if (machine_is_msm7627a_qrd1())
673 rc = mipi_dsi_panel_qrd1_power(on);
674 else
675 rc = mipi_dsi_panel_msm_power(on);
676 return rc;
677}
678
679#define MDP_303_VSYNC_GPIO 97
680
681#ifdef CONFIG_FB_MSM_MDP303
682static struct mipi_dsi_platform_data mipi_dsi_pdata = {
683 .vsync_gpio = MDP_303_VSYNC_GPIO,
684 .dsi_power_save = mipi_dsi_panel_power,
685 .dsi_client_reset = msm_fb_dsi_client_reset,
686 .get_lane_config = msm_fb_get_lane_config,
687};
688#endif
689
690void __init msm_fb_add_devices(void)
691{
692 if (machine_is_msm7627a_qrd1())
693 platform_add_devices(qrd_fb_devices,
694 ARRAY_SIZE(qrd_fb_devices));
Taniya Dasc868a2e2012-01-03 10:18:47 +0530695 else if (machine_is_msm7627a_evb())
696 platform_add_devices(evb_fb_devices,
697 ARRAY_SIZE(evb_fb_devices));
Chintan Pandya250c2e52012-01-19 17:15:49 +0530698 else
699 platform_add_devices(msm_fb_devices,
700 ARRAY_SIZE(msm_fb_devices));
701
702 msm_fb_register_device("mdp", &mdp_pdata);
703 if (machine_is_msm7625a_surf() || machine_is_msm7x27a_surf())
704 msm_fb_register_device("lcdc", &lcdc_pdata);
705#ifdef CONFIG_FB_MSM_MDP303
706 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
707#endif
708}