linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] video: exynos_dp: move exynos_dp_config_video to a workqueue
@ 2012-11-07 10:53 Ajay Kumar
  2012-11-08  0:58 ` Jingoo Han
  0 siblings, 1 reply; 2+ messages in thread
From: Ajay Kumar @ 2012-11-07 10:53 UTC (permalink / raw)
  To: linux-fbdev

This speeds up boot significantly, since it can take up to a second to
get the display up and going, and we want to keep on booting (through
some userspace) while that happens.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 drivers/video/exynos/exynos_dp_core.c |   30 ++++++++++++++++++------------
 drivers/video/exynos/exynos_dp_core.h |    1 +
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
index f62778c..ecae6f4 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -18,6 +18,7 @@
 #include <linux/io.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/workqueue.h>
 
 #include <video/exynos_dp.h>
 
@@ -752,19 +753,22 @@ static int exynos_dp_set_link_train(struct exynos_dp_device *dp,
 	return retval;
 }
 
-static int exynos_dp_config_video(struct exynos_dp_device *dp)
+static void exynos_dp_config_video(struct work_struct *work)
 {
+	struct exynos_dp_device *dp;
 	int retval = 0;
 	int timeout_loop = 0;
 	int done_count = 0;
 
+	dp = container_of(work, struct exynos_dp_device, config_work);
+
 	exynos_dp_config_video_slave_mode(dp);
 
 	exynos_dp_set_video_color_format(dp);
 
 	if (exynos_dp_get_pll_lock_status(dp) = PLL_UNLOCKED) {
 		dev_err(dp->dev, "PLL is not locked yet.\n");
-		return -EINVAL;
+		return;
 	}
 
 	for (;;) {
@@ -773,7 +777,7 @@ static int exynos_dp_config_video(struct exynos_dp_device *dp)
 			break;
 		if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
 			dev_err(dp->dev, "Timeout of video streamclk ok\n");
-			return -ETIMEDOUT;
+			return;
 		}
 
 		usleep_range(1, 2);
@@ -807,7 +811,7 @@ static int exynos_dp_config_video(struct exynos_dp_device *dp)
 		}
 		if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
 			dev_err(dp->dev, "Timeout of video streamclk ok\n");
-			return -ETIMEDOUT;
+			return;
 		}
 
 		usleep_range(1000, 1001);
@@ -815,8 +819,6 @@ static int exynos_dp_config_video(struct exynos_dp_device *dp)
 
 	if (retval != 0)
 		dev_err(dp->dev, "Video stream is not detected!\n");
-
-	return retval;
 }
 
 static void exynos_dp_enable_scramble(struct exynos_dp_device *dp, bool enable)
@@ -933,11 +935,9 @@ static int __devinit exynos_dp_probe(struct platform_device *pdev)
 	exynos_dp_set_link_bandwidth(dp, dp->video_info->link_rate);
 
 	exynos_dp_init_video(dp);
-	ret = exynos_dp_config_video(dp);
-	if (ret) {
-		dev_err(&pdev->dev, "unable to config video\n");
-		return ret;
-	}
+
+	INIT_WORK(&dp->config_work, exynos_dp_config_video);
+	schedule_work(&dp->config_work);
 
 	platform_set_drvdata(pdev, dp);
 
@@ -949,6 +949,9 @@ static int __devexit exynos_dp_remove(struct platform_device *pdev)
 	struct exynos_dp_platdata *pdata = pdev->dev.platform_data;
 	struct exynos_dp_device *dp = platform_get_drvdata(pdev);
 
+	if (work_pending(&dp->config_work))
+		flush_work_sync(&dp->config_work);
+
 	if (pdata && pdata->phy_exit)
 		pdata->phy_exit();
 
@@ -964,6 +967,9 @@ static int exynos_dp_suspend(struct device *dev)
 	struct exynos_dp_platdata *pdata = pdev->dev.platform_data;
 	struct exynos_dp_device *dp = platform_get_drvdata(pdev);
 
+	if (work_pending(&dp->config_work))
+		flush_work_sync(&dp->config_work);
+
 	if (pdata && pdata->phy_exit)
 		pdata->phy_exit();
 
@@ -999,7 +1005,7 @@ static int exynos_dp_resume(struct device *dev)
 	exynos_dp_set_link_bandwidth(dp, dp->video_info->link_rate);
 
 	exynos_dp_init_video(dp);
-	exynos_dp_config_video(dp);
+	schedule_work(&dp->config_work);
 
 	return 0;
 }
diff --git a/drivers/video/exynos/exynos_dp_core.h b/drivers/video/exynos/exynos_dp_core.h
index 1e646d7..303831d 100644
--- a/drivers/video/exynos/exynos_dp_core.h
+++ b/drivers/video/exynos/exynos_dp_core.h
@@ -32,6 +32,7 @@ struct exynos_dp_device {
 
 	struct video_info	*video_info;
 	struct link_train	link_train;
+	struct work_struct	config_work;
 };
 
 /* exynos_dp_reg.c */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-08  0:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-07 10:53 [PATCH 2/2] video: exynos_dp: move exynos_dp_config_video to a workqueue Ajay Kumar
2012-11-08  0:58 ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).