linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training
@ 2023-08-08 22:19 Kuogee Hsieh
  2023-08-25 20:44 ` Abhinav Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Kuogee Hsieh @ 2023-08-08 22:19 UTC (permalink / raw)
  To: robdclark, sean, swboyd, dianders, vkoul, daniel, airlied,
	agross, dmitry.baryshkov, andersson, marijn.suijten
  Cc: quic_abhinavk, quic_khsieh, quic_jesszhan, quic_sbillaka,
	freedreno, dri-devel, linux-arm-msm, linux-kernel

DP PHY re-initialization done using dp_ctrl_reinitialize_mainlink() will
cause PLL unlocked initially and then PLL gets locked at the end of
initialization. PLL_UNLOCKED interrupt will fire during this time if the
interrupt mask is enabled.
However currently DP driver link training implementation incorrectly
re-initializes PHY unconditionally during link training as the PHY was
already configured in dp_ctrl_enable_mainlink_clocks().

Fix this by re-initializing the PHY only if the previous link training
failed.

[drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy

Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/30
Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
---
 drivers/gpu/drm/msm/dp/dp_ctrl.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
index a7a5c7e..77a8d93 100644
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
@@ -1774,13 +1774,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
 		return rc;
 
 	while (--link_train_max_retries) {
-		rc = dp_ctrl_reinitialize_mainlink(ctrl);
-		if (rc) {
-			DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n",
-					rc);
-			break;
-		}
-
 		training_step = DP_TRAINING_NONE;
 		rc = dp_ctrl_setup_main_link(ctrl, &training_step);
 		if (rc == 0) {
@@ -1832,6 +1825,12 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
 			/* stop link training before start re training  */
 			dp_ctrl_clear_training_pattern(ctrl);
 		}
+
+		rc = dp_ctrl_reinitialize_mainlink(ctrl);
+		if (rc) {
+			DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n", rc);
+			break;
+		}
 	}
 
 	if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)
-- 
2.7.4


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

* Re: [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training
  2023-08-08 22:19 [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training Kuogee Hsieh
@ 2023-08-25 20:44 ` Abhinav Kumar
  2023-08-25 22:15 ` Stephen Boyd
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2023-08-25 20:44 UTC (permalink / raw)
  To: Kuogee Hsieh, robdclark, sean, swboyd, dianders, vkoul, daniel,
	airlied, agross, dmitry.baryshkov, andersson, marijn.suijten
  Cc: quic_jesszhan, quic_sbillaka, freedreno, dri-devel,
	linux-arm-msm, linux-kernel



On 8/8/2023 3:19 PM, Kuogee Hsieh wrote:
> DP PHY re-initialization done using dp_ctrl_reinitialize_mainlink() will
> cause PLL unlocked initially and then PLL gets locked at the end of
> initialization. PLL_UNLOCKED interrupt will fire during this time if the
> interrupt mask is enabled.

There should be a line break here.

> However currently DP driver link training implementation incorrectly
> re-initializes PHY unconditionally during link training as the PHY was
> already configured in dp_ctrl_enable_mainlink_clocks().
> 
> Fix this by re-initializing the PHY only if the previous link training
> failed.
> 
> [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
> 
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/30
> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>

I tested and confirm that without this patch, I see this spam atleast 
once per reboot but after this patch, I have not seen this for 5 
consecutive reboots.

Hence,

Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280

Looking at the code flow, the dp_ctrl_reinitialize_mainlink() certainly 
looks redundant where it is, considering that the clks were enabled just 
a couple of lines above in dp_ctrl_enable_mainlink_clocks().

Hence with the minor fix in the commit,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

> ---
>   drivers/gpu/drm/msm/dp/dp_ctrl.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> index a7a5c7e..77a8d93 100644
> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> @@ -1774,13 +1774,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
>   		return rc;
>   
>   	while (--link_train_max_retries) {
> -		rc = dp_ctrl_reinitialize_mainlink(ctrl);
> -		if (rc) {
> -			DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n",
> -					rc);
> -			break;
> -		}
> -
>   		training_step = DP_TRAINING_NONE;
>   		rc = dp_ctrl_setup_main_link(ctrl, &training_step);
>   		if (rc == 0) {
> @@ -1832,6 +1825,12 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
>   			/* stop link training before start re training  */
>   			dp_ctrl_clear_training_pattern(ctrl);
>   		}
> +
> +		rc = dp_ctrl_reinitialize_mainlink(ctrl);
> +		if (rc) {
> +			DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n", rc);
> +			break;
> +		}
>   	}
>   
>   	if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)

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

* Re: [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training
  2023-08-08 22:19 [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training Kuogee Hsieh
  2023-08-25 20:44 ` Abhinav Kumar
@ 2023-08-25 22:15 ` Stephen Boyd
  2023-09-03 21:51 ` Dmitry Baryshkov
  2023-10-03  9:10 ` Johan Hovold
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2023-08-25 22:15 UTC (permalink / raw)
  To: Kuogee Hsieh, agross, airlied, andersson, daniel, dianders,
	dmitry.baryshkov, marijn.suijten, robdclark, sean, vkoul
  Cc: quic_abhinavk, quic_jesszhan, quic_sbillaka, freedreno,
	dri-devel, linux-arm-msm, linux-kernel

Quoting Kuogee Hsieh (2023-08-08 15:19:50)
> DP PHY re-initialization done using dp_ctrl_reinitialize_mainlink() will
> cause PLL unlocked initially and then PLL gets locked at the end of
> initialization. PLL_UNLOCKED interrupt will fire during this time if the
> interrupt mask is enabled.
> However currently DP driver link training implementation incorrectly
> re-initializes PHY unconditionally during link training as the PHY was
> already configured in dp_ctrl_enable_mainlink_clocks().
>
> Fix this by re-initializing the PHY only if the previous link training
> failed.
>
> [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
>
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/30
> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

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

* Re: [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training
  2023-08-08 22:19 [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training Kuogee Hsieh
  2023-08-25 20:44 ` Abhinav Kumar
  2023-08-25 22:15 ` Stephen Boyd
@ 2023-09-03 21:51 ` Dmitry Baryshkov
  2023-10-03  9:10 ` Johan Hovold
  3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2023-09-03 21:51 UTC (permalink / raw)
  To: Kuogee Hsieh, robdclark, sean, swboyd, dianders, vkoul, daniel,
	airlied, agross, andersson, marijn.suijten
  Cc: quic_abhinavk, quic_jesszhan, quic_sbillaka, freedreno,
	dri-devel, linux-arm-msm, linux-kernel

On 09/08/2023 01:19, Kuogee Hsieh wrote:
> DP PHY re-initialization done using dp_ctrl_reinitialize_mainlink() will
> cause PLL unlocked initially and then PLL gets locked at the end of
> initialization. PLL_UNLOCKED interrupt will fire during this time if the
> interrupt mask is enabled.
> However currently DP driver link training implementation incorrectly
> re-initializes PHY unconditionally during link training as the PHY was
> already configured in dp_ctrl_enable_mainlink_clocks().
> 
> Fix this by re-initializing the PHY only if the previous link training
> failed.
> 
> [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
> 
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/30
> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
>   drivers/gpu/drm/msm/dp/dp_ctrl.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry


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

* Re: [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training
  2023-08-08 22:19 [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training Kuogee Hsieh
                   ` (2 preceding siblings ...)
  2023-09-03 21:51 ` Dmitry Baryshkov
@ 2023-10-03  9:10 ` Johan Hovold
  2023-10-13 12:06   ` Johan Hovold
  3 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2023-10-03  9:10 UTC (permalink / raw)
  To: Kuogee Hsieh
  Cc: robdclark, sean, swboyd, dianders, vkoul, daniel, airlied,
	agross, dmitry.baryshkov, andersson, marijn.suijten,
	quic_abhinavk, quic_jesszhan, quic_sbillaka, freedreno,
	dri-devel, linux-arm-msm, linux-kernel

On Tue, Aug 08, 2023 at 03:19:50PM -0700, Kuogee Hsieh wrote:
> DP PHY re-initialization done using dp_ctrl_reinitialize_mainlink() will
> cause PLL unlocked initially and then PLL gets locked at the end of
> initialization. PLL_UNLOCKED interrupt will fire during this time if the
> interrupt mask is enabled.
> However currently DP driver link training implementation incorrectly
> re-initializes PHY unconditionally during link training as the PHY was
> already configured in dp_ctrl_enable_mainlink_clocks().
> 
> Fix this by re-initializing the PHY only if the previous link training
> failed.
> 
> [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
> 
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/30
> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>

This fixes the above warning and avoids the unnecessary PHY power-off
and power-on during boot of the ThinkPad X13s:

Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>

I guess this one should go to stable as well:

Cc: stable@vger.kernel.org	# 5.10

Is anyone planning on getting this fixed in 6.6-rc? I noticed that this
one still hasn't shown up linux-next.

> ---
>  drivers/gpu/drm/msm/dp/dp_ctrl.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> index a7a5c7e..77a8d93 100644
> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> @@ -1774,13 +1774,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
>  		return rc;
>  
>  	while (--link_train_max_retries) {
> -		rc = dp_ctrl_reinitialize_mainlink(ctrl);
> -		if (rc) {
> -			DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n",
> -					rc);
> -			break;
> -		}
> -
>  		training_step = DP_TRAINING_NONE;
>  		rc = dp_ctrl_setup_main_link(ctrl, &training_step);
>  		if (rc == 0) {
> @@ -1832,6 +1825,12 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
>  			/* stop link training before start re training  */
>  			dp_ctrl_clear_training_pattern(ctrl);
>  		}
> +
> +		rc = dp_ctrl_reinitialize_mainlink(ctrl);
> +		if (rc) {
> +			DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n", rc);
> +			break;
> +		}
>  	}
>  
>  	if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)

Johan

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

* Re: [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training
  2023-10-03  9:10 ` Johan Hovold
@ 2023-10-13 12:06   ` Johan Hovold
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2023-10-13 12:06 UTC (permalink / raw)
  To: Kuogee Hsieh
  Cc: robdclark, sean, swboyd, dianders, vkoul, daniel, airlied,
	agross, dmitry.baryshkov, andersson, marijn.suijten,
	quic_abhinavk, quic_jesszhan, quic_sbillaka, freedreno,
	dri-devel, linux-arm-msm, linux-kernel

On Tue, Oct 03, 2023 at 11:10:59AM +0200, Johan Hovold wrote:
> On Tue, Aug 08, 2023 at 03:19:50PM -0700, Kuogee Hsieh wrote:
> > DP PHY re-initialization done using dp_ctrl_reinitialize_mainlink() will
> > cause PLL unlocked initially and then PLL gets locked at the end of
> > initialization. PLL_UNLOCKED interrupt will fire during this time if the
> > interrupt mask is enabled.
> > However currently DP driver link training implementation incorrectly
> > re-initializes PHY unconditionally during link training as the PHY was
> > already configured in dp_ctrl_enable_mainlink_clocks().
> > 
> > Fix this by re-initializing the PHY only if the previous link training
> > failed.
> > 
> > [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
> > 
> > Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> > Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/30
> > Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> 
> This fixes the above warning and avoids the unnecessary PHY power-off
> and power-on during boot of the ThinkPad X13s:
> 
> Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
> Tested-by: Johan Hovold <johan+linaro@kernel.org>
> 
> I guess this one should go to stable as well:
> 
> Cc: stable@vger.kernel.org	# 5.10
> 
> Is anyone planning on getting this fixed in 6.6-rc? I noticed that this
> one still hasn't shown up linux-next.

For the record, this one showed up in a PR from Rob and has now been
forwarded to Linus.

No stable tag included, but I guess we can ping the stable team unless
AUTOSEL picks this up.

Johan

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

end of thread, other threads:[~2023-10-13 12:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 22:19 [PATCH v1] drm/msm/dp: do not reinitialize phy unless retry during link training Kuogee Hsieh
2023-08-25 20:44 ` Abhinav Kumar
2023-08-25 22:15 ` Stephen Boyd
2023-09-03 21:51 ` Dmitry Baryshkov
2023-10-03  9:10 ` Johan Hovold
2023-10-13 12:06   ` Johan Hovold

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).