[PATCH 11/12] start the panel which is enabled earlier than other panel.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SM501 has two panels, one is LCD panel and the other is CRT panel. We
need to start the panel which is enabled earlier than the other panel.

Signed-off-by: yajin <yajin@xxxxxxxxxxxxx>
---
 drivers/video/sm501fb.c |   42 +++++++++++++++++++++++++++++-------------
 1 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index f2c69ca..c3b717b 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -1895,7 +1895,11 @@ static int __devinit sm501fb_probe(struct
platform_device *pdev)
 {
 	struct sm501fb_info *info;
 	struct device *dev = &pdev->dev;
+	unsigned int panel_enabled, head[2];
+	char *driver_name[2];
+	unsigned long ctrl;
 	int ret;
+	int i;

 	/* allocate our framebuffers */

@@ -1946,23 +1950,37 @@ static int __devinit sm501fb_probe(struct
platform_device *pdev)
 		goto err_probed_panel;
 	}

-	ret = sm501fb_start_one(info, HEAD_CRT, driver_name_crt);
-	if (ret) {
-		dev_err(dev, "failed to start CRT\n");
-		goto err_started;
+	ctrl = readl(info->regs + SM501_DC_PANEL_CONTROL);
+	panel_enabled = (ctrl & SM501_DC_PANEL_CONTROL_EN) ? 1 : 0;
+	if (panel_enabled) {
+		head[0] = HEAD_PANEL;
+		driver_name[0] = driver_name_pnl;
+		head[1] = HEAD_CRT;
+		driver_name[1] = driver_name_crt;
+	} else {
+		head[0] = HEAD_CRT;
+		driver_name[0] = driver_name_crt;
+		head[1] = HEAD_PANEL;
+		driver_name[1] = driver_name_pnl;
 	}

-	ret = sm501fb_start_one(info, HEAD_PANEL, driver_name_pnl);
-	if (ret) {
-		dev_err(dev, "failed to start Panel\n");
-		goto err_started_crt;
+	for (i = 0; i < ARRAY_SIZE(head); i++) {
+		ret = sm501fb_start_one(info, head[i], driver_name[i]);
+		if (ret) {
+			dev_err(dev, "failed to start %s\n", driver_name[i]);
+			if (i == 1) {
+				unregister_framebuffer(info->fb[head[0]]);
+				sm501_free_init_fb(info, head[0]);
+			}
+			goto err_start_one;
+		}
 	}

 	/* create device files */

 	ret = device_create_file(dev, &dev_attr_crt_src);
 	if (ret)
-		goto err_started_panel;
+		goto err_started;

 	ret = device_create_file(dev, &dev_attr_fbregs_pnl);
 	if (ret)
@@ -1981,15 +1999,13 @@ err_attached_pnlregs_file:
 err_attached_crtsrc_file:
 	device_remove_file(dev, &dev_attr_crt_src);

-err_started_panel:
+err_started:
 	unregister_framebuffer(info->fb[HEAD_PANEL]);
 	sm501_free_init_fb(info, HEAD_PANEL);
-
-err_started_crt:
 	unregister_framebuffer(info->fb[HEAD_CRT]);
 	sm501_free_init_fb(info, HEAD_CRT);

-err_started:
+err_start_one:
 	sm501fb_stop(info);

 err_probed_panel:
-- 
1.5.6.5


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux