public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915: Restrict usage of live status check
@ 2016-03-10 13:16 Shashank Sharma
  2016-03-10 15:36 ` ✗ Fi.CI.BAT: failure for drm/i915: Restrict usage of live status check (rev2) Patchwork
  2016-03-11  8:48 ` [PATCH v2] drm/i915: Restrict usage of live status check Jani Nikula
  0 siblings, 2 replies; 7+ messages in thread
From: Shashank Sharma @ 2016-03-10 13:16 UTC (permalink / raw)
  To: intel-gfx, ville.syrjala, sonika.jindal, gary.c.wang,
	shobhit.kumar, daniel.vetter

This patch does the following:
- Restricts usage of live status check for HDMI detection.
  While testing certain (monitor + cable) combinations with
  various intel  platforms, it seems that live status register
  doesn't work reliably on some older devices. So limit the
  live_status check for HDMI detection, only for platforms
  from gen7 onwards.
- Cleans up the retry logic.
  There is an extra 'if (try)' check, which can be avoided by
  changing the logic slightly, keeping the delay as same(80ms)

V2: Ville: Skipped live_status check for IVB

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e2dab48..b1e67de 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1397,24 +1397,32 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	enum drm_connector_status status;
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	struct drm_device *dev = dev_priv->dev;
+	bool live_status = true;
+	unsigned int try = 9;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	/*
+	 * When tested with specific set of monitors + cables,
+	 * live status behavior is not very consistent for older
+	 * platforms. So add live status check from VLV
+	 * onwards.
+	 */
+	if (INTEL_INFO(dev)->gen >= 7 && !IS_IVYBRIDGE(dev)) {
+retry_ls:
 		live_status = intel_digital_port_connected(dev_priv,
 				hdmi_to_dig_port(intel_hdmi));
+		if (!live_status && --try) {
+			msleep(10);
+			goto retry_ls;
+		}
+		DRM_DEBUG_KMS("Live status %s!\n", live_status ? "up" : "down");
 	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
 	intel_hdmi_unset_edid(connector);
 
 	if (intel_hdmi_set_edid(connector, live_status)) {
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: Restrict usage of live status check
@ 2016-03-17  9:25 Jani Nikula
  2016-04-20 12:12 ` [PATCH v2] " Shashank Sharma
  0 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2016-03-17  9:25 UTC (permalink / raw)
  To: Shashank Sharma, intel-gfx; +Cc: daniel.vetter

On Thu, 17 Mar 2016, Shashank Sharma <shashank.sharma@intel.com> wrote:
> [ text/plain ]
> This patch restricts usage of live status check for HDMI detection.
> While testing certain (monitor + cable) combinations with various
> intel  platforms, it seems that live status register is not reliable
> on some older devices. So limit the live_status check from VLV onwards.
>
> This fixes a regression introduced in:
> 	commit: 237ed86 "drm/i915: Check live status"
> 	Author: Sonika Jindal <sonika.jindal@intel.com>
> 	Date:   Tue Sep 15 09:44:20 2015 +0530
>

Fixes: 237ed86c693d ("drm/i915: Check live status before reading edid")
Cc: stable@vger.kernel.org # v4.4
Bugzilla: ?

> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdmi.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index e2dab48..d24d18a 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1397,7 +1397,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
>  	enum drm_connector_status status;
>  	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
>  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
> -	bool live_status = false;
> +	struct drm_device *dev = connector->dev;

This is unnecessary.

> +	bool live_status = true;
>  	unsigned int try;
>  
>  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> @@ -1405,16 +1406,21 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
>  
>  	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
>  
> -	for (try = 0; !live_status && try < 9; try++) {
> -		if (try)
> -			msleep(10);
> -		live_status = intel_digital_port_connected(dev_priv,
> +	/*
> +	* Live status check for HDMI detection is not very
> +	* reliable on older platforms. So insist the live
> +	* status check for EDID read from VLV onwards.
> +	*/
> +	if (INTEL_INFO(dev)->gen >= 7 && !IS_IVYBRIDGE(dev)) {

Replace dev with dev_priv. Both work, it's magic, but we prefer using
dev_priv where possible.

Move try variable declaration here.

> +		for (try = 0; !live_status && try < 9; try++) {

You'll now ignore live_status on all platforms. (But please do not turn
this into a do-while, keep it as a for loop.)

> +			if (try)
> +				msleep(10);
> +			live_status = intel_digital_port_connected(dev_priv,
>  				hdmi_to_dig_port(intel_hdmi));
> +		}
> +		DRM_DEBUG_KMS("Live status %s\n", live_status ? "up" : "down");

Consider using onoff(live_status) instead of live_status ? "up" :
"down".

>  	}
>  
> -	if (!live_status)
> -		DRM_DEBUG_KMS("Live status not up!");
> -
>  	intel_hdmi_unset_edid(connector);
>  
>  	if (intel_hdmi_set_edid(connector, live_status)) {

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-04-21  4:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 13:16 [PATCH v2] drm/i915: Restrict usage of live status check Shashank Sharma
2016-03-10 15:36 ` ✗ Fi.CI.BAT: failure for drm/i915: Restrict usage of live status check (rev2) Patchwork
2016-03-11  8:48 ` [PATCH v2] drm/i915: Restrict usage of live status check Jani Nikula
  -- strict thread matches above, loose matches on Subject: below --
2016-03-17  9:25 [PATCH] " Jani Nikula
2016-04-20 12:12 ` [PATCH v2] " Shashank Sharma
2016-04-20 14:48   ` Ville Syrjälä
2016-04-21  3:55     ` Sharma, Shashank
2016-04-21  4:45       ` Sharma, Shashank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox