linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dp: promote irq_hpd handle to handle link trainign correctly
@ 2020-10-30 23:23 Kuogee Hsieh
  2020-11-02 19:29 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Kuogee Hsieh @ 2020-10-30 23:23 UTC (permalink / raw)
  To: robdclark, sean, swboyd
  Cc: tanmay, abhinavk, aravindh, khsieh, rnayak, airlied, daniel,
	linux-arm-msm, dri-devel, freedreno, linux-kernel

Some dongles, such as Apple, required link training done at irq_hpd
request instead of plugin request. This patch promote irq_hpd hanlder
to handle link training and setup hpd_state correctly.

Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
---
 drivers/gpu/drm/msm/dp/dp_display.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 13b66266cd69..55627530957c 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -469,7 +469,9 @@ static int dp_display_handle_irq_hpd(struct dp_display_private *dp)
 static int dp_display_usbpd_attention_cb(struct device *dev)
 {
 	int rc = 0;
+	u32 sink_request;
 	struct dp_display_private *dp;
+	struct dp_usbpd *hpd;
 
 	if (!dev) {
 		DRM_ERROR("invalid dev\n");
@@ -483,10 +485,24 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
 		return -ENODEV;
 	}
 
+	hpd = dp->usbpd;
+
 	/* check for any test request issued by sink */
 	rc = dp_link_process_request(dp->link);
-	if (!rc)
-		dp_display_handle_irq_hpd(dp);
+	if (!rc) {
+		sink_request = dp->link->sink_request;
+		if (sink_request & DS_PORT_STATUS_CHANGED) {
+			dp->hpd_state = ST_CONNECT_PENDING;
+			hpd->hpd_high = 1;
+		}
+
+		rc = dp_display_handle_irq_hpd(dp);
+
+		if (rc && sink_request & DS_PORT_STATUS_CHANGED) {
+			hpd->hpd_high = 0;
+			dp->hpd_state = ST_DISCONNECTED;
+		}
+	}
 
 	return rc;
 }

base-commit: 0e162b10644605428cd2596c12f8ed410cf9d2d9
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH] drm/msm/dp: promote irq_hpd handle to handle link trainign correctly
  2020-10-30 23:23 [PATCH] drm/msm/dp: promote irq_hpd handle to handle link trainign correctly Kuogee Hsieh
@ 2020-11-02 19:29 ` Stephen Boyd
  2020-11-02 23:16   ` Rob Clark
  2020-11-03 17:02   ` khsieh
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-11-02 19:29 UTC (permalink / raw)
  To: Kuogee Hsieh, robdclark, sean
  Cc: tanmay, abhinavk, aravindh, khsieh, rnayak, airlied, daniel,
	linux-arm-msm, dri-devel, freedreno, linux-kernel

Subject has a typo in "training".

Quoting Kuogee Hsieh (2020-10-30 16:23:24)
> Some dongles, such as Apple, required link training done at irq_hpd

s/required/require/

> request instead of plugin request. This patch promote irq_hpd hanlder

s/hanlder/handler/

> to handle link training and setup hpd_state correctly.
> 
> Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
> ---

Any Fixes tag?

>  drivers/gpu/drm/msm/dp/dp_display.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 13b66266cd69..55627530957c 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -483,10 +485,24 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
>                 return -ENODEV;
>         }
>  
> +       hpd = dp->usbpd;
> +
>         /* check for any test request issued by sink */
>         rc = dp_link_process_request(dp->link);
> -       if (!rc)
> -               dp_display_handle_irq_hpd(dp);
> +       if (!rc) {
> +               sink_request = dp->link->sink_request;
> +               if (sink_request & DS_PORT_STATUS_CHANGED) {
> +                       dp->hpd_state = ST_CONNECT_PENDING;
> +                       hpd->hpd_high = 1;
> +               }
> +
> +               rc = dp_display_handle_irq_hpd(dp);
> +
> +               if (rc && sink_request & DS_PORT_STATUS_CHANGED) {

Can you add parenthesis around this?

		if (rc && (sink_request & DS_PORT_STATUS_CHANGED)) {


I honestly don't know what's going on in this patch. It talks about
making link training happen during irq hpd handler but this is the
attention handler and we're checking port status changed? This is
related? The code is really not clear.

> +                       hpd->hpd_high = 0;
> +                       dp->hpd_state = ST_DISCONNECTED;
> +               }
> +       }
>  
>         return rc;
>  }
> 
> base-commit: 0e162b10644605428cd2596c12f8ed410cf9d2d9

What commit is this?

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

* Re: [PATCH] drm/msm/dp: promote irq_hpd handle to handle link trainign correctly
  2020-11-02 19:29 ` Stephen Boyd
@ 2020-11-02 23:16   ` Rob Clark
  2020-11-03 17:02   ` khsieh
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Clark @ 2020-11-02 23:16 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Kuogee Hsieh, Sean Paul, Tanmay Shah, Abhinav Kumar, aravindh,
	Rajendra Nayak, David Airlie, Daniel Vetter, linux-arm-msm,
	dri-devel, freedreno, Linux Kernel Mailing List

On Mon, Nov 2, 2020 at 11:29 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Subject has a typo in "training".
>
> Quoting Kuogee Hsieh (2020-10-30 16:23:24)
> > Some dongles, such as Apple, required link training done at irq_hpd
>
> s/required/require/
>
> > request instead of plugin request. This patch promote irq_hpd hanlder
>
> s/hanlder/handler/
>
> > to handle link training and setup hpd_state correctly.
> >
> > Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
> > ---
>
> Any Fixes tag?
>
> >  drivers/gpu/drm/msm/dp/dp_display.c | 20 ++++++++++++++++++--
> >  1 file changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> > index 13b66266cd69..55627530957c 100644
> > --- a/drivers/gpu/drm/msm/dp/dp_display.c
> > +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> > @@ -483,10 +485,24 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
> >                 return -ENODEV;
> >         }
> >
> > +       hpd = dp->usbpd;
> > +
> >         /* check for any test request issued by sink */
> >         rc = dp_link_process_request(dp->link);
> > -       if (!rc)
> > -               dp_display_handle_irq_hpd(dp);
> > +       if (!rc) {
> > +               sink_request = dp->link->sink_request;
> > +               if (sink_request & DS_PORT_STATUS_CHANGED) {
> > +                       dp->hpd_state = ST_CONNECT_PENDING;
> > +                       hpd->hpd_high = 1;
> > +               }
> > +
> > +               rc = dp_display_handle_irq_hpd(dp);
> > +
> > +               if (rc && sink_request & DS_PORT_STATUS_CHANGED) {
>
> Can you add parenthesis around this?
>
>                 if (rc && (sink_request & DS_PORT_STATUS_CHANGED)) {
>
>
> I honestly don't know what's going on in this patch. It talks about
> making link training happen during irq hpd handler but this is the
> attention handler and we're checking port status changed? This is
> related? The code is really not clear.
>
> > +                       hpd->hpd_high = 0;
> > +                       dp->hpd_state = ST_DISCONNECTED;
> > +               }
> > +       }
> >
> >         return rc;
> >  }
> >
> > base-commit: 0e162b10644605428cd2596c12f8ed410cf9d2d9
>
> What commit is this?

Note that I skipped over a few dp related patches yesterday while
starting to pull things into msm-next-staging.

Kuogee, when you send the next version can you make sure it is based
against v5.10-rc or msm-next-staging?

BR,
-R

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

* Re: [PATCH] drm/msm/dp: promote irq_hpd handle to handle link trainign correctly
  2020-11-02 19:29 ` Stephen Boyd
  2020-11-02 23:16   ` Rob Clark
@ 2020-11-03 17:02   ` khsieh
  1 sibling, 0 replies; 4+ messages in thread
From: khsieh @ 2020-11-03 17:02 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: robdclark, sean, tanmay, abhinavk, aravindh, rnayak, airlied,
	daniel, linux-arm-msm, dri-devel, freedreno, linux-kernel

On 2020-11-02 11:29, Stephen Boyd wrote:
> Subject has a typo in "training".
> 
> Quoting Kuogee Hsieh (2020-10-30 16:23:24)
>> Some dongles, such as Apple, required link training done at irq_hpd
> 
> s/required/require/
> 
>> request instead of plugin request. This patch promote irq_hpd hanlder
> 
> s/hanlder/handler/
> 
>> to handle link training and setup hpd_state correctly.
>> 
>> Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
>> ---
> 
> Any Fixes tag?
> 
>>  drivers/gpu/drm/msm/dp/dp_display.c | 20 ++++++++++++++++++--
>>  1 file changed, 18 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
>> b/drivers/gpu/drm/msm/dp/dp_display.c
>> index 13b66266cd69..55627530957c 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_display.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
>> @@ -483,10 +485,24 @@ static int dp_display_usbpd_attention_cb(struct 
>> device *dev)
>>                 return -ENODEV;
>>         }
>> 
>> +       hpd = dp->usbpd;
>> +
>>         /* check for any test request issued by sink */
>>         rc = dp_link_process_request(dp->link);
>> -       if (!rc)
>> -               dp_display_handle_irq_hpd(dp);
>> +       if (!rc) {
>> +               sink_request = dp->link->sink_request;
>> +               if (sink_request & DS_PORT_STATUS_CHANGED) {
>> +                       dp->hpd_state = ST_CONNECT_PENDING;
>> +                       hpd->hpd_high = 1;
>> +               }
>> +
>> +               rc = dp_display_handle_irq_hpd(dp);
>> +
>> +               if (rc && sink_request & DS_PORT_STATUS_CHANGED) {
> 
> Can you add parenthesis around this?
> 
> 		if (rc && (sink_request & DS_PORT_STATUS_CHANGED)) {
> 
> 
> I honestly don't know what's going on in this patch. It talks about
> making link training happen during irq hpd handler but this is the
> attention handler and we're checking port status changed? This is
> related? The code is really not clear.
irq_hpd request is generated by sinker to ask host attention that 
something has changed.
POST_STATUS_CHNAGED bit set  by sinker to indicated link had loss of 
sync. Therefore
host need to restart link retaining to fix the link loss of sync 
problem.

> 
>> +                       hpd->hpd_high = 0;
>> +                       dp->hpd_state = ST_DISCONNECTED;
>> +               }
>> +       }
>> 
>>         return rc;
>>  }
>> 
>> base-commit: 0e162b10644605428cd2596c12f8ed410cf9d2d9
> 
> What commit is this?

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

end of thread, other threads:[~2020-11-03 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 23:23 [PATCH] drm/msm/dp: promote irq_hpd handle to handle link trainign correctly Kuogee Hsieh
2020-11-02 19:29 ` Stephen Boyd
2020-11-02 23:16   ` Rob Clark
2020-11-03 17:02   ` khsieh

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