All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: Re: [PATCH v2] drm/i915/dp: Clean up intel_dp_check_mst_status
Date: Mon, 25 Sep 2017 15:39:10 +0300	[thread overview]
Message-ID: <87k20n3qc1.fsf@nikula.org> (raw)
In-Reply-To: <20170921185406.2353-1-dhinakaran.pandiyan@intel.com>

On Thu, 21 Sep 2017, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:
> Rewriting this code without the goto, I believe, makes it more readable.
> One functional change that has been included is the handling of failed ESI
> register reads. Instead of disabling MST only for the first failed read, we
> now disable MST on subsequent failed reads too. A failed ESI read is
> problematic irrespective of whether it is the first or not.
>
> v2: Don't ignore return from _mst_hpd_irq() (James)
>
> Cc: James Ausmus <james.ausmus@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

I pushed everything *except* this patch in the series, please repost in
a new thread for clean CI results.

Thanks,
Jani.


> ---
>  drivers/gpu/drm/i915/intel_dp.c | 78 ++++++++++++++++++-----------------------
>  1 file changed, 34 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 98e7b96ca826..aa97bd825369 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4191,57 +4191,47 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
>  static int
>  intel_dp_check_mst_status(struct intel_dp *intel_dp)
>  {
> -	bool bret;
> +	u8 esi[DP_DPRX_ESI_LEN] = { 0 };
> +	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
>  
> -	if (intel_dp->is_mst) {
> -		u8 esi[DP_DPRX_ESI_LEN] = { 0 };
> -		int ret = 0;
> -		int retry;
> +	if (!intel_dp->is_mst)
> +		return -EINVAL;
> +
> +	while (intel_dp_get_sink_irq_esi(intel_dp, esi)) {
> +		int ret, retry;
>  		bool handled;
> -		bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
> -go_again:
> -		if (bret == true) {
> -
> -			/* check link status - esi[10] = 0x200c */
> -			if (intel_dp->active_mst_links &&
> -			    !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
> -				DRM_DEBUG_KMS("channel EQ not ok, retraining\n");
> -				intel_dp_start_link_train(intel_dp);
> -				intel_dp_stop_link_train(intel_dp);
> -			}
>  
> -			DRM_DEBUG_KMS("got esi %3ph\n", esi);
> -			ret = drm_dp_mst_hpd_irq(&intel_dp->mst_mgr, esi, &handled);
> -
> -			if (handled) {
> -				for (retry = 0; retry < 3; retry++) {
> -					int wret;
> -					wret = drm_dp_dpcd_write(&intel_dp->aux,
> -								 DP_SINK_COUNT_ESI+1,
> -								 &esi[1], 3);
> -					if (wret == 3) {
> -						break;
> -					}
> -				}
> +		DRM_DEBUG_KMS("ESI %3ph\n", esi);
>  
> -				bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
> -				if (bret == true) {
> -					DRM_DEBUG_KMS("got esi2 %3ph\n", esi);
> -					goto go_again;
> -				}
> -			} else
> -				ret = 0;
> +		/* check link status - esi[10] = 0x200c */
> +		if (intel_dp->active_mst_links &&
> +		    !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
> +			intel_dp_start_link_train(intel_dp);
> +			intel_dp_stop_link_train(intel_dp);
> +		}
>  
> -			return ret;
> -		} else {
> -			struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> -			DRM_DEBUG_KMS("failed to get ESI - device may have failed\n");
> -			intel_dp->is_mst = false;
> -			drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
> -			/* send a hotplug event */
> -			drm_kms_helper_hotplug_event(intel_dig_port->base.base.dev);
> +		ret = drm_dp_mst_hpd_irq(&intel_dp->mst_mgr, esi, &handled);
> +		if (!handled)
> +			return 0;
> +
> +		if (ret)
> +			DRM_DEBUG_KMS("error handling MST IRQ_HPD %d\n", ret);
> +
> +		for (retry = 0; retry < 3; retry++) {
> +			int wret;
> +
> +			wret = drm_dp_dpcd_write(&intel_dp->aux,
> +						 DP_SINK_COUNT_ESI + 1, &esi[1],
> +						 3);
> +			if (wret == 3)
> +				break;
>  		}
>  	}
> +
> +	DRM_DEBUG_KMS("failed to get ESI - device may have failed\n");
> +	intel_dp->is_mst = false;
> +	drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
> +	drm_kms_helper_hotplug_event(intel_dig_port->base.base.dev);
>  	return -EINVAL;
>  }

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

  parent reply	other threads:[~2017-09-25 12:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 22:21 [PATCH 1/5] drm/i915/mst: Debug log connector name in destroy_connector() Dhinakaran Pandiyan
2017-09-18 22:21 ` [PATCH 2/5] drm/i915/mst: Print active mst links after update Dhinakaran Pandiyan
2017-09-18 22:21 ` [PATCH 3/5] drm/i915/dp: Fix buffer size for sink_irq_esi read Dhinakaran Pandiyan
2017-09-18 22:21 ` [PATCH 4/5] drm/i915/dp: Clean up intel_dp_check_mst_status Dhinakaran Pandiyan
2017-09-20 19:11   ` Ausmus, James
2017-09-20 19:55     ` Pandiyan, Dhinakaran
2017-09-20 20:02       ` Ausmus, James
2017-09-20 22:47         ` Pandiyan, Dhinakaran
2017-09-20 22:53           ` Ausmus, James
2017-09-21 18:54             ` [PATCH v2] " Dhinakaran Pandiyan
2017-09-22 17:53               ` Ausmus, James
2017-09-25 12:39               ` Jani Nikula [this message]
2017-09-18 22:21 ` [PATCH 5/5] drm/i915/dp: Remove useless debug about TPS3 support Dhinakaran Pandiyan
2017-09-19 10:13   ` Jani Nikula
2017-09-19 12:17 ` ✓ Fi.CI.BAT: success for series starting with [1/5] drm/i915/mst: Debug log connector name in destroy_connector() Patchwork
2017-09-19 16:18 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-09-21 19:18 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] drm/i915/mst: Debug log connector name in destroy_connector() (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k20n3qc1.fsf@nikula.org \
    --to=jani.nikula@intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.