diff mbox

[v2] drm/i915/dp: Do not reset detect_done flag in intel_dp_detect

Message ID 1482201738-1440-1-git-send-email-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Dec. 20, 2016, 2:42 a.m. UTC
From: "Navare, Manasi D" <manasi.d.navare@intel.com>

The detect_done flag was introduced in the 'commit 7d23e3c37bb3
("drm/i915: Cleaning up intel_dp_hpd_pulse")' in order to avoid multiple
detects on hotplug where intel_dp_long_pulse() was called from HPD handler
as well as intel_dp_detect(). Later, 'commit 1015811609c0
("drm/i915: Move long hpd handling into the hotplug work")' deferred long
hpd handling to hotplug work to avoid handling it twice. But, resetting the
flag after long hpd handling leads to the code being executed again during
mode enumeration.

So, do not reset the detect_done flag to false in intel_dp_detect. The flag
is reset in intel_dp_hpd_pulse to allow a full detect and set when the
hotplug work does a full DPCD detect. However if .detect() gets called
during enumeration we return the cached status.

v2:
Allow full detect after encoder reset. (Ville)
Set the detect_done even connector if disconnected (DK)
Commit message changes.

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jani Nikula Dec. 20, 2016, 8:08 a.m. UTC | #1
On Tue, 20 Dec 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:
> From: "Navare, Manasi D" <manasi.d.navare@intel.com>
>
> The detect_done flag was introduced in the 'commit 7d23e3c37bb3
> ("drm/i915: Cleaning up intel_dp_hpd_pulse")' in order to avoid multiple
> detects on hotplug where intel_dp_long_pulse() was called from HPD handler
> as well as intel_dp_detect(). Later, 'commit 1015811609c0
> ("drm/i915: Move long hpd handling into the hotplug work")' deferred long
> hpd handling to hotplug work to avoid handling it twice. But, resetting the
> flag after long hpd handling leads to the code being executed again during
> mode enumeration.
>
> So, do not reset the detect_done flag to false in intel_dp_detect. The flag
> is reset in intel_dp_hpd_pulse to allow a full detect and set when the
> hotplug work does a full DPCD detect. However if .detect() gets called
> during enumeration we return the cached status.
>
> v2:
> Allow full detect after encoder reset. (Ville)
> Set the detect_done even connector if disconnected (DK)
> Commit message changes.
>

Fixes: ?

> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 45ebc96..5689cf3 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4473,7 +4473,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
>  	intel_dp_set_edid(intel_dp);
>  	if (is_edp(intel_dp) || intel_connector->detect_edid)
>  		status = connector_status_connected;
> -	intel_dp->detect_done = true;
>  
>  	/* Try to read the source of the interrupt */
>  	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
> @@ -4508,10 +4507,10 @@ intel_dp_detect(struct drm_connector *connector, bool force)
>  		      connector->base.id, connector->name);
>  
>  	/* If full detect is not performed yet, do a full detect */
> -	if (!intel_dp->detect_done)
> +	if (!intel_dp->detect_done) {
> +		intel_dp->detect_done = true;
>  		status = intel_dp_long_pulse(intel_dp->attached_connector);
> -
> -	intel_dp->detect_done = false;
> +	}
>  
>  	return status;
>  }
> @@ -4803,6 +4802,8 @@ void intel_dp_encoder_reset(struct drm_encoder *encoder)
>  	if (lspcon->active)
>  		lspcon_resume(lspcon);
>  
> +	intel_dp->detect_done = false;
> +
>  	if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP)
>  		return;
Dhinakaran Pandiyan Dec. 20, 2016, 9:05 p.m. UTC | #2
On Tue, 2016-12-20 at 10:08 +0200, Jani Nikula wrote:
> On Tue, 20 Dec 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:

> > From: "Navare, Manasi D" <manasi.d.navare@intel.com>

> >

> > The detect_done flag was introduced in the 'commit 7d23e3c37bb3

> > ("drm/i915: Cleaning up intel_dp_hpd_pulse")' in order to avoid multiple

> > detects on hotplug where intel_dp_long_pulse() was called from HPD handler

> > as well as intel_dp_detect(). Later, 'commit 1015811609c0

> > ("drm/i915: Move long hpd handling into the hotplug work")' deferred long

> > hpd handling to hotplug work to avoid handling it twice. But, resetting the

> > flag after long hpd handling leads to the code being executed again during

> > mode enumeration.

> >

> > So, do not reset the detect_done flag to false in intel_dp_detect. The flag

> > is reset in intel_dp_hpd_pulse to allow a full detect and set when the

> > hotplug work does a full DPCD detect. However if .detect() gets called

> > during enumeration we return the cached status.

> >

> > v2:

> > Allow full detect after encoder reset. (Ville)

> > Set the detect_done even connector if disconnected (DK)

> > Commit message changes.

> >

> 

> Fixes: ?

> 


There have been too many changes here, I don't know which commit to
really blame. Most likely 
Fixes: commit 7d23e3c37bb3 ("drm/i915: Cleaning up intel_dp_hpd_pulse")


-DK

> > Cc: Ville Syrjala <ville.syrjala@linux.intel.com>

> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

> > Cc: Jani Nikula <jani.nikula@linux.intel.com>

> > Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>

> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> > ---

> >  drivers/gpu/drm/i915/intel_dp.c | 9 +++++----

> >  1 file changed, 5 insertions(+), 4 deletions(-)

> >

> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c

> > index 45ebc96..5689cf3 100644

> > --- a/drivers/gpu/drm/i915/intel_dp.c

> > +++ b/drivers/gpu/drm/i915/intel_dp.c

> > @@ -4473,7 +4473,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)

> >  	intel_dp_set_edid(intel_dp);

> >  	if (is_edp(intel_dp) || intel_connector->detect_edid)

> >  		status = connector_status_connected;

> > -	intel_dp->detect_done = true;

> >  

> >  	/* Try to read the source of the interrupt */

> >  	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&

> > @@ -4508,10 +4507,10 @@ intel_dp_detect(struct drm_connector *connector, bool force)

> >  		      connector->base.id, connector->name);

> >  

> >  	/* If full detect is not performed yet, do a full detect */

> > -	if (!intel_dp->detect_done)

> > +	if (!intel_dp->detect_done) {

> > +		intel_dp->detect_done = true;

> >  		status = intel_dp_long_pulse(intel_dp->attached_connector);

> > -

> > -	intel_dp->detect_done = false;

> > +	}

> >  

> >  	return status;

> >  }

> > @@ -4803,6 +4802,8 @@ void intel_dp_encoder_reset(struct drm_encoder *encoder)

> >  	if (lspcon->active)

> >  		lspcon_resume(lspcon);

> >  

> > +	intel_dp->detect_done = false;

> > +

> >  	if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP)

> >  		return;

>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 45ebc96..5689cf3 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4473,7 +4473,6 @@  intel_dp_long_pulse(struct intel_connector *intel_connector)
 	intel_dp_set_edid(intel_dp);
 	if (is_edp(intel_dp) || intel_connector->detect_edid)
 		status = connector_status_connected;
-	intel_dp->detect_done = true;
 
 	/* Try to read the source of the interrupt */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
@@ -4508,10 +4507,10 @@  intel_dp_detect(struct drm_connector *connector, bool force)
 		      connector->base.id, connector->name);
 
 	/* If full detect is not performed yet, do a full detect */
-	if (!intel_dp->detect_done)
+	if (!intel_dp->detect_done) {
+		intel_dp->detect_done = true;
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
-
-	intel_dp->detect_done = false;
+	}
 
 	return status;
 }
@@ -4803,6 +4802,8 @@  void intel_dp_encoder_reset(struct drm_encoder *encoder)
 	if (lspcon->active)
 		lspcon_resume(lspcon);
 
+	intel_dp->detect_done = false;
+
 	if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP)
 		return;