[RFC 08/13] drm/i915: Add support for enabling link status and recovery

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Sun Nov 1 06:26:34 UTC 2020


On 10/19/2020 4:19 AM, Shankar, Uma wrote:
>
>> -----Original Message-----
>> From: Nautiyal, Ankit K <ankit.k.nautiyal at intel.com>
>> Sent: Thursday, October 15, 2020 4:23 PM
>> To: intel-gfx at lists.freedesktop.org
>> Cc: dri-devel at lists.freedesktop.org; Shankar, Uma <uma.shankar at intel.com>;
>> Kulkarni, Vandita <vandita.kulkarni at intel.com>; ville.syrjala at linux.intel.com;
>> Sharma, Swati2 <swati2.sharma at intel.com>
>> Subject: [RFC 08/13] drm/i915: Add support for enabling link status and recovery
>>
>> From: Swati Sharma <swati2.sharma at intel.com>
>>
>> In this patch enabled support for link status and recovery in i915 driver. HDMI
>> link loss indication to upstream DP source is indicated via IRQ_HPD. This is
>> followed by reading of HDMI link configuration status
>> (HDMI_TX_LINK_ACTIVE_STATUS). If the PCON → HDMI 2.1 link status is off;
>> reinitiate frl link training to recover.
>> Also, HDMI FRL link error count range for each individual FRL active lane is
>> indicated by DOWNSTREAM_HDMI_ERROR_STATUS_LN registers.
>>
>> Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
>> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_dp.c | 47 +++++++++++++++++++++++--
>>   1 file changed, 44 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
>> b/drivers/gpu/drm/i915/display/intel_dp.c
>> index 668165dd2b1a..e6c4cb844e37 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>> @@ -5955,6 +5955,29 @@ intel_dp_check_mst_status(struct intel_dp *intel_dp)
>>   return link_ok;
>>   }
>>
>> +static void
>> +intel_dp_handle_hdmi_link_status_change(struct intel_dp *intel_dp) {
>> +bool is_active;
>> +u8 buf = 0;
>> +
>> +is_active = drm_dp_pcon_hdmi_link_active(&intel_dp->aux);
>> +if (intel_dp->frl.is_trained && !is_active) {
>> +if (drm_dp_dpcd_readb(&intel_dp->aux,
>> DP_PCON_HDMI_LINK_CONFIG_1, &buf) < 0)
>> +return;
>> +
>> +buf &=  ~DP_PCON_ENABLE_HDMI_LINK;
>> +if (drm_dp_dpcd_writeb(&intel_dp->aux,
>> DP_PCON_HDMI_LINK_CONFIG_1, buf) < 0)
>> +return;
>> +
>> +intel_dp->frl.is_trained = false;
>> +intel_dp->frl.trained_rate_gbps = 0;
>> +
>> +intel_dp_check_frl_training(intel_dp);
>> +drm_dp_pcon_hdmi_frl_link_error_count(&intel_dp->aux,
>> &intel_dp->attached_connector->base);
> Just printing the error here may not help in recovery. If FRL is failing may be a TMDS fallback should be
> attempted. Also error count should be returned instead of just a print.

The function dp_check_frl_training() will restart the FRL link training 
if required and fall back to TMDS if FRL does not succeed.

The function for error count should be first and later the frl training 
should be checked. Will fix this in next patch version.

The error counts will be different for different lanes, so IMHO, this 
information is more for debugging. Not sure, if we can

use this to take any corrective action.


>> +}
>> +}
>> +
>>   static bool
>>   intel_dp_needs_link_retrain(struct intel_dp *intel_dp)  { @@ -6320,7 +6343,7
>> @@ intel_dp_hotplug(struct intel_encoder *encoder,
>>   return state;
>>   }
>>
>> -static void intel_dp_check_service_irq(struct intel_dp *intel_dp)
>> +static void intel_dp_check_device_service_irq(struct intel_dp
>> +*intel_dp)
>>   {
>>   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>>   u8 val;
>> @@ -6344,6 +6367,23 @@ static void intel_dp_check_service_irq(struct intel_dp
>> *intel_dp)
>>   drm_dbg_kms(&i915->drm, "Sink specific irq unhandled\n");  }
>>
>> +static void intel_dp_check_link_service_irq(struct intel_dp *intel_dp)
>> +{
>> +u8 val;
>> +
>> +if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
>> +return;
>> +
>> +if (drm_dp_dpcd_readb(&intel_dp->aux,
>> +      DP_LINK_SERVICE_IRQ_VECTOR_ESI0, &val) != 1 ||
>> !val)
> An error message would be handy here.


Alright, will be adding appropriate error message here.

>
>> +return;
>> +
>> +drm_dp_dpcd_writeb(&intel_dp->aux,
>> DP_LINK_SERVICE_IRQ_VECTOR_ESI0,
>> +val);
> Check for error message here.

As mentioned above, will take care in next version.

Thanks & Regards,

Ankit


>
>> +
>> +if (val & HDMI_LINK_STATUS_CHANGED)
>> +intel_dp_handle_hdmi_link_status_change(intel_dp);
>> +}
>> +
>>   /*
>>    * According to DP spec
>>    * 5.1.2:
>> @@ -6383,7 +6423,8 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
>>   return false;
>>   }
>>
>> -intel_dp_check_service_irq(intel_dp);
>> +intel_dp_check_device_service_irq(intel_dp);
>> +intel_dp_check_link_service_irq(intel_dp);
>>
>>   /* Handle CEC interrupts, if any */
>>   drm_dp_cec_irq(&intel_dp->aux);
>> @@ -6815,7 +6856,7 @@ intel_dp_detect(struct drm_connector *connector,
>>       to_intel_connector(connector)->detect_edid)
>>   status = connector_status_connected;
>>
>> -intel_dp_check_service_irq(intel_dp);
>> +intel_dp_check_device_service_irq(intel_dp);
>>
>>   out:
>>   if (status != connector_status_connected && !intel_dp->is_mst)
>> --
>> 2.17.1


More information about the dri-devel mailing list