* [PATCH 04/10] video: exynos_dp: Get pll lock before pattern set
@ 2012-08-08 3:54 Sean Paul
2012-08-20 9:13 ` Jingoo Han
0 siblings, 1 reply; 2+ messages in thread
From: Sean Paul @ 2012-08-08 3:54 UTC (permalink / raw)
To: linux-fbdev
According to the exynos datasheet (Figure 49-10), we should wait for PLL
lock before programming the training pattern when doing software eDP
link training.
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
---
drivers/video/exynos/exynos_dp_core.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
index 3deded2..207bd7e 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -23,6 +23,8 @@
#include "exynos_dp_core.h"
+#define PLL_MAX_TRIES 100
+
static int exynos_dp_init_dp(struct exynos_dp_device *dp)
{
exynos_dp_reset(dp);
@@ -260,7 +262,7 @@ static void exynos_dp_set_lane_lane_pre_emphasis(struct exynos_dp_device *dp,
static int exynos_dp_link_start(struct exynos_dp_device *dp)
{
- int ret, lane, lane_count;
+ int ret, lane, lane_count, pll_tries;
u8 buf[4];
lane_count = dp->link_train.lane_count;
@@ -293,6 +295,16 @@ static int exynos_dp_link_start(struct exynos_dp_device *dp)
exynos_dp_set_lane_lane_pre_emphasis(dp,
PRE_EMPHASIS_LEVEL_0, lane);
+ /* Wait for PLL lock */
+ pll_tries = 0;
+ while (exynos_dp_get_pll_lock_status(dp) = PLL_UNLOCKED) {
+ if (pll_tries = PLL_MAX_TRIES)
+ return -ETIMEDOUT;
+
+ pll_tries++;
+ udelay(100);
+ }
+
/* Set training pattern 1 */
exynos_dp_set_training_pattern(dp, TRAINING_PTN1);
--
1.7.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH 04/10] video: exynos_dp: Get pll lock before pattern set
2012-08-08 3:54 [PATCH 04/10] video: exynos_dp: Get pll lock before pattern set Sean Paul
@ 2012-08-20 9:13 ` Jingoo Han
0 siblings, 0 replies; 2+ messages in thread
From: Jingoo Han @ 2012-08-20 9:13 UTC (permalink / raw)
To: linux-fbdev
On Wednesday, August 08, 2012 12:54 PM Sean Paul wrote:
>
> According to the exynos datasheet (Figure 49-10), we should wait for PLL
> lock before programming the training pattern when doing software eDP
> link training.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
> ---
> drivers/video/exynos/exynos_dp_core.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
> index 3deded2..207bd7e 100644
> --- a/drivers/video/exynos/exynos_dp_core.c
> +++ b/drivers/video/exynos/exynos_dp_core.c
> @@ -23,6 +23,8 @@
>
> #include "exynos_dp_core.h"
>
> +#define PLL_MAX_TRIES 100
> +
> static int exynos_dp_init_dp(struct exynos_dp_device *dp)
> {
> exynos_dp_reset(dp);
> @@ -260,7 +262,7 @@ static void exynos_dp_set_lane_lane_pre_emphasis(struct exynos_dp_device *dp,
>
> static int exynos_dp_link_start(struct exynos_dp_device *dp)
> {
> - int ret, lane, lane_count;
> + int ret, lane, lane_count, pll_tries;
> u8 buf[4];
>
> lane_count = dp->link_train.lane_count;
> @@ -293,6 +295,16 @@ static int exynos_dp_link_start(struct exynos_dp_device *dp)
> exynos_dp_set_lane_lane_pre_emphasis(dp,
> PRE_EMPHASIS_LEVEL_0, lane);
>
> + /* Wait for PLL lock */
> + pll_tries = 0;
> + while (exynos_dp_get_pll_lock_status(dp) = PLL_UNLOCKED) {
> + if (pll_tries = PLL_MAX_TRIES)
> + return -ETIMEDOUT;
> +
> + pll_tries++;
> + udelay(100);
> + }
> +
You don't need to add 'PLL_MAX_TRIES', please use 'DP_TIMEOUT_LOOP_COUNT' as below:
/* Wait for PLL lock */
while (exynos_dp_get_pll_lock_status(dp) = PLL_UNLOCKED) {
timeout_loop++;
if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
dev_err(dp->dev, "failed to get pll lock status\n");
return -ETIMEDOUT;
}
udelay(100);
}
Also, could you use usleep_range() instead of udelay()?
> /* Set training pattern 1 */
> exynos_dp_set_training_pattern(dp, TRAINING_PTN1);
>
> --
> 1.7.7.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-20 9:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-08 3:54 [PATCH 04/10] video: exynos_dp: Get pll lock before pattern set Sean Paul
2012-08-20 9:13 ` 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).