From: Ajay Kumar <ajaykumar.rs@samsung.com>
To: linux-fbdev@vger.kernel.org
Subject: [PATCH 2/2] video: exynos_dp: move exynos_dp_config_video to a workqueue
Date: Wed, 07 Nov 2012 10:53:32 +0000 [thread overview]
Message-ID: <1352286744-22588-2-git-send-email-ajaykumar.rs@samsung.com> (raw)
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
next reply other threads:[~2012-11-07 10:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 10:53 Ajay Kumar [this message]
2012-11-08 0:58 ` [PATCH 2/2] video: exynos_dp: move exynos_dp_config_video to a workqueue Jingoo Han
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352286744-22588-2-git-send-email-ajaykumar.rs@samsung.com \
--to=ajaykumar.rs@samsung.com \
--cc=linux-fbdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).