diff mbox series

[v15,07/11] drm/mediatek: Add retry to prevent misjudgment for sink devices

Message ID 20220727045035.32225-8-rex-bc.chen@mediatek.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Add MT8195 DisplayPort driver | expand

Commit Message

Rex-BC Chen (陳柏辰) July 27, 2022, 4:50 a.m. UTC
For some DP dungles, we need to train more than onece to confirm that we
don't misjudge the status of sink device.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_dp.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Comments

AngeloGioacchino Del Regno July 27, 2022, 9:40 a.m. UTC | #1
Il 27/07/22 06:50, Bo-Chen Chen ha scritto:
> For some DP dungles, we need to train more than onece to confirm that we
> don't misjudge the status of sink device.

Please fix the typos in your commit title and description.
title: misjudgment -> misjudgement
desc: dungles->dongles; onece->once

> 
> Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
> ---
>   drivers/gpu/drm/mediatek/mtk_dp.c | 21 ++++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> index ce817cb59445..80d7d6488105 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -42,6 +42,7 @@
>   #define MTK_DP_CHECK_SINK_CAP_TIMEOUT_COUNT 3
>   #define MTK_DP_TBC_BUF_READ_START_ADDR 0x08
>   #define MTK_DP_TRAIN_DOWNSCALE_RETRY 8
> +#define MTK_DP_TRAIN_CLEAR_RETRY 50
>   
>   struct mtk_dp_train_info {
>   	bool tps3;
> @@ -1431,11 +1432,25 @@ static int mtk_dp_video_config(struct mtk_dp *mtk_dp)
>   
>   static int mtk_dp_training(struct mtk_dp *mtk_dp)
>   {
> +	short max_retry = MTK_DP_TRAIN_CLEAR_RETRY;
>   	int ret;
>   
> -	ret = mtk_dp_train_start(mtk_dp);
> -	if (ret)
> -		return ret;
> +	/*
> +	 * We do retry to confirm that we don't misjudge the sink status.
> +	 * If it is still failed, we can confirm there are some issues for the
> +	 * sink device.
> +	 */
> +	do {
> +		ret = mtk_dp_train_start(mtk_dp);
> +		if (!ret)
> +			break;
> +	} while (--max_retry);
> +
> +	dev_info(mtk_dp->dev, "dp training clear retry times: %d\n",
> +		 MTK_DP_TRAIN_CLEAR_RETRY - max_retry);

dev_dbg() here.

...after which,

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> +
> +	if (!max_retry)
> +		return -ETIMEDOUT;
>   
>   	ret = mtk_dp_video_config(mtk_dp);
>   	if (ret)
Rex-BC Chen (陳柏辰) July 28, 2022, 9:40 a.m. UTC | #2
On Wed, 2022-07-27 at 11:40 +0200, AngeloGioacchino Del Regno wrote:
> Il 27/07/22 06:50, Bo-Chen Chen ha scritto:
> > For some DP dungles, we need to train more than onece to confirm
> > that we
> > don't misjudge the status of sink device.
> 
> Please fix the typos in your commit title and description.
> title: misjudgment -> misjudgement
> desc: dungles->dongles; onece->once
> 
> > 
> > Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
> > ---
> >   drivers/gpu/drm/mediatek/mtk_dp.c | 21 ++++++++++++++++++---
> >   1 file changed, 18 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> > b/drivers/gpu/drm/mediatek/mtk_dp.c
> > index ce817cb59445..80d7d6488105 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> > @@ -42,6 +42,7 @@
> >   #define MTK_DP_CHECK_SINK_CAP_TIMEOUT_COUNT 3
> >   #define MTK_DP_TBC_BUF_READ_START_ADDR 0x08
> >   #define MTK_DP_TRAIN_DOWNSCALE_RETRY 8
> > +#define MTK_DP_TRAIN_CLEAR_RETRY 50
> >   
> >   struct mtk_dp_train_info {
> >   	bool tps3;
> > @@ -1431,11 +1432,25 @@ static int mtk_dp_video_config(struct
> > mtk_dp *mtk_dp)
> >   
> >   static int mtk_dp_training(struct mtk_dp *mtk_dp)
> >   {
> > +	short max_retry = MTK_DP_TRAIN_CLEAR_RETRY;
> >   	int ret;
> >   
> > -	ret = mtk_dp_train_start(mtk_dp);
> > -	if (ret)
> > -		return ret;
> > +	/*
> > +	 * We do retry to confirm that we don't misjudge the sink
> > status.
> > +	 * If it is still failed, we can confirm there are some issues
> > for the
> > +	 * sink device.
> > +	 */
> > +	do {
> > +		ret = mtk_dp_train_start(mtk_dp);
> > +		if (!ret)
> > +			break;
> > +	} while (--max_retry);
> > +
> > +	dev_info(mtk_dp->dev, "dp training clear retry times: %d\n",
> > +		 MTK_DP_TRAIN_CLEAR_RETRY - max_retry);
> 
> dev_dbg() here.
> 
> ...after which,
> 
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> 

Hello Angelo,

Thanks for your review.
I will modify these in next version.

BRs,
Bo-Chen

> > +
> > +	if (!max_retry)
> > +		return -ETIMEDOUT;
> >   
> >   	ret = mtk_dp_video_config(mtk_dp);
> >   	if (ret)
> 
>
Rex-BC Chen (陳柏辰) Aug. 5, 2022, 7:10 a.m. UTC | #3
Hello all,

I will drop this modification becaus after we testing current drivers,
the issue described in commit message does not occur.

BRs,
Bo-Chen

On Thu, 2022-07-28 at 17:40 +0800, Rex-BC Chen wrote:
> On Wed, 2022-07-27 at 11:40 +0200, AngeloGioacchino Del Regno wrote:
> > Il 27/07/22 06:50, Bo-Chen Chen ha scritto:
> > > For some DP dungles, we need to train more than onece to confirm
> > > that we
> > > don't misjudge the status of sink device.
> > 
> > Please fix the typos in your commit title and description.
> > title: misjudgment -> misjudgement
> > desc: dungles->dongles; onece->once
> > 
> > > 
> > > Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
> > > ---
> > >   drivers/gpu/drm/mediatek/mtk_dp.c | 21 ++++++++++++++++++---
> > >   1 file changed, 18 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> > > b/drivers/gpu/drm/mediatek/mtk_dp.c
> > > index ce817cb59445..80d7d6488105 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> > > @@ -42,6 +42,7 @@
> > >   #define MTK_DP_CHECK_SINK_CAP_TIMEOUT_COUNT 3
> > >   #define MTK_DP_TBC_BUF_READ_START_ADDR 0x08
> > >   #define MTK_DP_TRAIN_DOWNSCALE_RETRY 8
> > > +#define MTK_DP_TRAIN_CLEAR_RETRY 50
> > >   
> > >   struct mtk_dp_train_info {
> > >   	bool tps3;
> > > @@ -1431,11 +1432,25 @@ static int mtk_dp_video_config(struct
> > > mtk_dp *mtk_dp)
> > >   
> > >   static int mtk_dp_training(struct mtk_dp *mtk_dp)
> > >   {
> > > +	short max_retry = MTK_DP_TRAIN_CLEAR_RETRY;
> > >   	int ret;
> > >   
> > > -	ret = mtk_dp_train_start(mtk_dp);
> > > -	if (ret)
> > > -		return ret;
> > > +	/*
> > > +	 * We do retry to confirm that we don't misjudge the sink
> > > status.
> > > +	 * If it is still failed, we can confirm there are some issues
> > > for the
> > > +	 * sink device.
> > > +	 */
> > > +	do {
> > > +		ret = mtk_dp_train_start(mtk_dp);
> > > +		if (!ret)
> > > +			break;
> > > +	} while (--max_retry);
> > > +
> > > +	dev_info(mtk_dp->dev, "dp training clear retry times: %d\n",
> > > +		 MTK_DP_TRAIN_CLEAR_RETRY - max_retry);
> > 
> > dev_dbg() here.
> > 
> > ...after which,
> > 
> > Reviewed-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> > 
> 
> Hello Angelo,
> 
> Thanks for your review.
> I will modify these in next version.
> 
> BRs,
> Bo-Chen
> 
> > > +
> > > +	if (!max_retry)
> > > +		return -ETIMEDOUT;
> > >   
> > >   	ret = mtk_dp_video_config(mtk_dp);
> > >   	if (ret)
> > 
> > 
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index ce817cb59445..80d7d6488105 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -42,6 +42,7 @@ 
 #define MTK_DP_CHECK_SINK_CAP_TIMEOUT_COUNT 3
 #define MTK_DP_TBC_BUF_READ_START_ADDR 0x08
 #define MTK_DP_TRAIN_DOWNSCALE_RETRY 8
+#define MTK_DP_TRAIN_CLEAR_RETRY 50
 
 struct mtk_dp_train_info {
 	bool tps3;
@@ -1431,11 +1432,25 @@  static int mtk_dp_video_config(struct mtk_dp *mtk_dp)
 
 static int mtk_dp_training(struct mtk_dp *mtk_dp)
 {
+	short max_retry = MTK_DP_TRAIN_CLEAR_RETRY;
 	int ret;
 
-	ret = mtk_dp_train_start(mtk_dp);
-	if (ret)
-		return ret;
+	/*
+	 * We do retry to confirm that we don't misjudge the sink status.
+	 * If it is still failed, we can confirm there are some issues for the
+	 * sink device.
+	 */
+	do {
+		ret = mtk_dp_train_start(mtk_dp);
+		if (!ret)
+			break;
+	} while (--max_retry);
+
+	dev_info(mtk_dp->dev, "dp training clear retry times: %d\n",
+		 MTK_DP_TRAIN_CLEAR_RETRY - max_retry);
+
+	if (!max_retry)
+		return -ETIMEDOUT;
 
 	ret = mtk_dp_video_config(mtk_dp);
 	if (ret)