All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Don't try to set the DP sink power state on disconnected monitors
@ 2013-12-12 15:34 Damien Lespiau
  2013-12-12 16:50 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Lespiau @ 2013-12-12 15:34 UTC (permalink / raw)
  To: intel-gfx

While looking at some debug traces, I noticed that we were always trying
to set the sink power, even when we previously identified that the
connector was in the disconnected state.

In that case, we don't a big chance for the write to succeed, so don't
try.

[drm:drm_helper_probe_single_connector_modes], [CONNECTOR:30:DP-3]
[drm:intel_dp_detect], [CONNECTOR:30:DP-3]
[drm:drm_helper_probe_single_connector_modes], [CONNECTOR:30:DP-3] disconnected
[drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x7015003f
[drm:intel_dp_sink_dpms], failed to write sink power state

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 9b40113..006bca5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1361,18 +1361,21 @@ static void ironlake_edp_pll_off(struct intel_dp *intel_dp)
 /* If the sink supports it, try to set the power state appropriately */
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode)
 {
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 	int ret, i;
 
 	/* Should have a valid DPCD by this point */
 	if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
 		return;
 
-	if (mode != DRM_MODE_DPMS_ON) {
+	if (mode != DRM_MODE_DPMS_ON &&
+	    connector->status != connector_status_disconnected) {
 		ret = intel_dp_aux_native_write_1(intel_dp, DP_SET_POWER,
 						  DP_SET_POWER_D3);
 		if (ret != 1)
 			DRM_DEBUG_DRIVER("failed to write sink power state\n");
-	} else {
+	} else if (mode == DRM_MODE_DPMS_ON) {
 		/*
 		 * When turning on, we need to retry for 1ms to give the sink
 		 * time to wake up.
-- 
1.8.3.1

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

* Re: [PATCH] drm/i915: Don't try to set the DP sink power state on disconnected monitors
  2013-12-12 15:34 [PATCH] drm/i915: Don't try to set the DP sink power state on disconnected monitors Damien Lespiau
@ 2013-12-12 16:50 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2013-12-12 16:50 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx

On Thu, Dec 12, 2013 at 03:34:24PM +0000, Damien Lespiau wrote:
> While looking at some debug traces, I noticed that we were always trying
> to set the sink power, even when we previously identified that the
> connector was in the disconnected state.
> 
> In that case, we don't a big chance for the write to succeed, so don't
> try.
> 
> [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:30:DP-3]
> [drm:intel_dp_detect], [CONNECTOR:30:DP-3]
> [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:30:DP-3] disconnected
> [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x7015003f
> [drm:intel_dp_sink_dpms], failed to write sink power state
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

How wide-spread is this issue? Is this the only place where we routinely
do this (e.g. after the user yanked the connector and we switch things
off) or are there other place?

Link training comes to mind, but doing the right thing (i.e. just
switching to normal mode so that the pipe runs) is a bit more involved. So
that one's out of scope for this patch. But I wonder what other places
there are ...
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 9b40113..006bca5 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1361,18 +1361,21 @@ static void ironlake_edp_pll_off(struct intel_dp *intel_dp)
>  /* If the sink supports it, try to set the power state appropriately */
>  void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode)
>  {
> +	struct intel_connector *intel_connector = intel_dp->attached_connector;
> +	struct drm_connector *connector = &intel_connector->base;
>  	int ret, i;
>  
>  	/* Should have a valid DPCD by this point */
>  	if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
>  		return;
>  
> -	if (mode != DRM_MODE_DPMS_ON) {
> +	if (mode != DRM_MODE_DPMS_ON &&
> +	    connector->status != connector_status_disconnected) {
>  		ret = intel_dp_aux_native_write_1(intel_dp, DP_SET_POWER,
>  						  DP_SET_POWER_D3);
>  		if (ret != 1)
>  			DRM_DEBUG_DRIVER("failed to write sink power state\n");
> -	} else {
> +	} else if (mode == DRM_MODE_DPMS_ON) {
>  		/*
>  		 * When turning on, we need to retry for 1ms to give the sink
>  		 * time to wake up.
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2013-12-12 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-12 15:34 [PATCH] drm/i915: Don't try to set the DP sink power state on disconnected monitors Damien Lespiau
2013-12-12 16:50 ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.