blob: 32d29b2e4144129f7742bd3e961fdde7745515ea [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
319void __init msm_msm7627a_allocate_memory_regions(void)
320{
321 void *addr;
322 unsigned long fb_size;
323
324 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa())
325 fb_size = MSM7x25A_MSM_FB_SIZE;
326 else
327 fb_size = MSM_FB_SIZE;
328 addr = alloc_bootmem_align(fb_size, 0x1000);
329 msm_fb_resources[0].start = __pa(addr);
330 msm_fb_resources[0].end = msm_fb_resources[0].start + fb_size - 1;
331 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", fb_size,
332 addr, __pa(addr));
333}
334
335static struct msm_panel_common_pdata mdp_pdata = {
336 .gpio = 97,
337 .mdp_rev = MDP_REV_303,
338};
339
340#define GPIO_LCDC_BRDG_PD 128
341#define GPIO_LCDC_BRDG_RESET_N 129
342#define GPIO_LCD_DSI_SEL 125
343#define LCDC_RESET_PHYS 0x90008014
344
345static void __iomem *lcdc_reset_ptr;
346
347static unsigned mipi_dsi_gpio[] = {
348 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT,
349 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
350 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT,
351 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_PD */
352};
353
354static unsigned lcd_dsi_sel_gpio[] = {
355 GPIO_CFG(GPIO_LCD_DSI_SEL, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
356 GPIO_CFG_2MA),
357};
358
359enum {
360 DSI_SINGLE_LANE = 1,
361 DSI_TWO_LANES,
362};
363
364static int msm_fb_get_lane_config(void)
365{
366 /* For MSM7627A SURF/FFA and QRD */
367 int rc = DSI_TWO_LANES;
368 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
369 rc = DSI_SINGLE_LANE;
370 pr_info("DSI_SINGLE_LANES\n");
371 } else {
372 pr_info("DSI_TWO_LANES\n");
373 }
374 return rc;
375}
376
377static int msm_fb_dsi_client_msm_reset(void)
378{
379 int rc = 0;
380
381 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
382 if (rc < 0) {
383 pr_err("failed to request lcd brdg reset_n\n");
384 return rc;
385 }
386
387 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
388 if (rc < 0) {
389 pr_err("failed to request lcd brdg pd\n");
390 return rc;
391 }
392
393 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
394 if (rc) {
395 pr_err("Failed to enable LCDC Bridge reset enable\n");
396 goto gpio_error;
397 }
398
399 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
400 if (rc) {
401 pr_err("Failed to enable LCDC Bridge pd enable\n");
402 goto gpio_error2;
403 }
404
405 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
406 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
407 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
408
409 if (!rc) {
410 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
411 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
412 sizeof(uint32_t));
413
414 if (!lcdc_reset_ptr)
415 return 0;
416 }
417 return rc;
418 } else {
419 goto gpio_error;
420 }
421
422gpio_error2:
423 pr_err("Failed GPIO bridge pd\n");
424 gpio_free(GPIO_LCDC_BRDG_PD);
425
426gpio_error:
427 pr_err("Failed GPIO bridge reset\n");
428 gpio_free(GPIO_LCDC_BRDG_RESET_N);
429 return rc;
430}
431
432static int mipi_truly_sel_mode(int video_mode)
433{
434 int rc = 0;
435
436 rc = gpio_request(GPIO_LCD_DSI_SEL, "lcd_dsi_sel");
437 if (rc < 0)
438 goto gpio_error;
439
440 rc = gpio_tlmm_config(lcd_dsi_sel_gpio[0], GPIO_CFG_ENABLE);
441 if (rc)
442 goto gpio_error;
443
444 rc = gpio_direction_output(GPIO_LCD_DSI_SEL, 1);
445 if (!rc) {
446 gpio_set_value_cansleep(GPIO_LCD_DSI_SEL, video_mode);
447 return rc;
448 } else {
449 goto gpio_error;
450 }
451
452gpio_error:
453 pr_err("mipi_truly_sel_mode failed\n");
454 gpio_free(GPIO_LCD_DSI_SEL);
455 return rc;
456}
457
458static int msm_fb_dsi_client_qrd1_reset(void)
459{
460 int rc = 0;
461
462 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
463 if (rc < 0) {
464 pr_err("failed to request lcd brdg reset_n\n");
465 return rc;
466 }
467
468 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
469 if (rc < 0) {
470 pr_err("Failed to enable LCDC Bridge reset enable\n");
471 return rc;
472 }
473
474 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
475 if (rc < 0) {
476 pr_err("Failed GPIO bridge pd\n");
477 gpio_free(GPIO_LCDC_BRDG_RESET_N);
478 return rc;
479 }
480
481 mipi_truly_sel_mode(1);
482
483 return rc;
484}
485
486static int msm_fb_dsi_client_reset(void)
487{
488 int rc = 0;
489
490 if (machine_is_msm7627a_qrd1())
491 rc = msm_fb_dsi_client_qrd1_reset();
492 else
493 rc = msm_fb_dsi_client_msm_reset();
494
495 return rc;
496
497}
498
499static struct regulator_bulk_data regs_dsi[] = {
500 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
501 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
502};
503
504static int dsi_gpio_initialized;
505
506static int mipi_dsi_panel_msm_power(int on)
507{
508 int rc = 0;
509 uint32_t lcdc_reset_cfg;
510
511 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
512 if (unlikely(!dsi_gpio_initialized)) {
513 pmapp_disp_backlight_init();
514
515 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
516 if (rc < 0) {
517 pr_err("failed to request gpio_disp_pwr\n");
518 return rc;
519 }
520
521 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
522 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
523 if (rc < 0) {
524 pr_err("failed to enable display pwr\n");
525 goto fail_gpio1;
526 }
527
528 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
529 if (rc < 0) {
530 pr_err("failed to request gpio_bkl_en\n");
531 goto fail_gpio1;
532 }
533
534 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
535 if (rc < 0) {
536 pr_err("failed to enable backlight\n");
537 goto fail_gpio2;
538 }
539 }
540
541 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
542 if (rc) {
543 pr_err("%s: could not get regulators: %d\n",
544 __func__, rc);
545 goto fail_gpio2;
546 }
547
548 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi),
549 regs_dsi);
550 if (rc) {
551 pr_err("%s: could not set voltages: %d\n",
552 __func__, rc);
553 goto fail_vreg;
554 }
555 if (pmapp_disp_backlight_set_brightness(100))
556 pr_err("backlight set brightness failed\n");
557
558 dsi_gpio_initialized = 1;
559 }
560 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
561 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
562 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
563 } else if (machine_is_msm7x27a_ffa() ||
564 machine_is_msm7625a_ffa()) {
565 if (on) {
566 /* This line drives an active low pin on FFA */
567 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
568 if (rc < 0)
569 pr_err("failed to set direction for "
570 "display pwr\n");
571 } else {
572 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
573 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
574 if (rc < 0)
575 pr_err("failed to set direction for "
576 "display pwr\n");
577 }
578 }
579
580 if (on) {
581 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
582
583 if (machine_is_msm7x27a_surf() ||
584 machine_is_msm7625a_surf()) {
585 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
586 rmb();
587 lcdc_reset_cfg &= ~1;
588
589 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
590 msleep(20);
591 wmb();
592 lcdc_reset_cfg |= 1;
593 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
594 } else {
595 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
596 msleep(20);
597 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
598 }
599 } else {
600 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
601
602 if (pmapp_disp_backlight_set_brightness(0))
603 pr_err("backlight set brightness failed\n");
604 }
605
606 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
607 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
608
609 if (rc)
610 pr_err("%s: could not %sable regulators: %d\n",
611 __func__, on ? "en" : "dis", rc);
612
613 return rc;
614fail_vreg:
615 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
616fail_gpio2:
617 gpio_free(GPIO_BACKLIGHT_EN);
618fail_gpio1:
619 gpio_free(GPIO_DISPLAY_PWR_EN);
620 dsi_gpio_initialized = 0;
621 return rc;
622}
623
624static int mipi_dsi_panel_qrd1_power(int on)
625{
626 int rc = 0;
627
628 if (!dsi_gpio_initialized) {
629 rc = gpio_request(QRD_GPIO_BACKLIGHT_EN, "gpio_bkl_en");
630 if (rc < 0)
631 return rc;
632
633 rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_BACKLIGHT_EN, 0,
634 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
635 GPIO_CFG_ENABLE);
636 if (rc < 0) {
637 pr_err("failed GPIO_BACKLIGHT_EN tlmm config\n");
638 return rc;
639 }
640
641 rc = gpio_direction_output(QRD_GPIO_BACKLIGHT_EN, 1);
642 if (rc < 0) {
643 pr_err("failed to enable backlight\n");
644 gpio_free(QRD_GPIO_BACKLIGHT_EN);
645 return rc;
646 }
647 dsi_gpio_initialized = 1;
648 }
649
650 gpio_set_value_cansleep(QRD_GPIO_BACKLIGHT_EN, !!on);
651
652 if (!on) {
653 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
654 msleep(20);
655 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
656 msleep(20);
657 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
658
659 }
660
661 return rc;
662}
663
664static int mipi_dsi_panel_power(int on)
665{
666 int rc = 0;
667
668 if (machine_is_msm7627a_qrd1())
669 rc = mipi_dsi_panel_qrd1_power(on);
670 else
671 rc = mipi_dsi_panel_msm_power(on);
672 return rc;
673}
674
675#define MDP_303_VSYNC_GPIO 97
676
677#ifdef CONFIG_FB_MSM_MDP303
678static struct mipi_dsi_platform_data mipi_dsi_pdata = {
679 .vsync_gpio = MDP_303_VSYNC_GPIO,
680 .dsi_power_save = mipi_dsi_panel_power,
681 .dsi_client_reset = msm_fb_dsi_client_reset,
682 .get_lane_config = msm_fb_get_lane_config,
683};
684#endif
685
686void __init msm_fb_add_devices(void)
687{
688 if (machine_is_msm7627a_qrd1())
689 platform_add_devices(qrd_fb_devices,
690 ARRAY_SIZE(qrd_fb_devices));
691 else
692 platform_add_devices(msm_fb_devices,
693 ARRAY_SIZE(msm_fb_devices));
694
695 msm_fb_register_device("mdp", &mdp_pdata);
696 if (machine_is_msm7625a_surf() || machine_is_msm7x27a_surf())
697 msm_fb_register_device("lcdc", &lcdc_pdata);
698#ifdef CONFIG_FB_MSM_MDP303
699 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
700#endif
701}