Re: [RFC 07/13] drm/dp_helper: Add support for link status and link recovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Nautiyal, Ankit K <ankit.k.nautiyal@xxxxxxxxx>
> Sent: Thursday, October 15, 2020 4:23 PM
> To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx; Shankar, Uma <uma.shankar@xxxxxxxxx>;
> Kulkarni, Vandita <vandita.kulkarni@xxxxxxxxx>; ville.syrjala@xxxxxxxxxxxxxxx;
> Sharma, Swati2 <swati2.sharma@xxxxxxxxx>
> Subject: [RFC 07/13] drm/dp_helper: Add support for link status and link
> recovery

Move this in the start of the series along with rest of the generic DRM helpers.

> From: Swati Sharma <swati2.sharma@xxxxxxxxx>
> 
> This patch adds support for link status and link recovery. There are specific
> DPCD’s defined for link status check and recovery in case of any issues. PCON will
> communicate the same using an IRQ_HPD to source. HDMI sink would have
> indicated the same to PCON using SCDC interrupt mechanism. While source can
> always read final HDMI sink’s status using I2C over AUX, it’s easier and faster to
> read the PCON’s already read HDMI sink’s status registers.
> 
> Signed-off-by: Swati Sharma <swati2.sharma@xxxxxxxxx>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@xxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 33 +++++++++++++++++++++++++++++++++
>  include/drm/drm_dp_helper.h     | 16 ++++++++++++++++
>  2 files changed, 49 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c
> b/drivers/gpu/drm/drm_dp_helper.c index df858533dbf7..33a4ac2fb225 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -2896,3 +2896,36 @@ int drm_dp_pcon_hdmi_link_mode(struct
> drm_dp_aux *aux, u8 *frl_trained_mask)
>  	return mode;
>  }
>  EXPORT_SYMBOL(drm_dp_pcon_hdmi_link_mode);
> +
> +void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux,
> +					   struct drm_connector *connector) {

This just prints a message if error counts are detected. There isn't any recovery here.
May be you should re-phrase the patch header and description to reflect the same.

Also what will be the usage of this just prints a message, may be return the error to caller
to plan a recovery or link reset .

> +	u8 buf, error_count;
> +	int i, num_error;
> +	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi;
> +
> +	for (i = 0; i < hdmi->max_lanes; i++)
> +	{
> +		if (drm_dp_dpcd_readb(aux,
> DP_PCON_HDMI_ERROR_STATUS_LN0 + i , &buf) < 0)
> +			return;
> +
> +		error_count = buf & DP_PCON_HDMI_ERROR_COUNT_MASK;
> +
> +	switch(error_count) {

Alignment is off.

> +	case DP_PCON_HDMI_ERROR_COUNT_HUNDRED_PLUS:
> +		num_error = 100;
> +		break;
> +	case DP_PCON_HDMI_ERROR_COUNT_TEN_PLUS:
> +		num_error = 10;
> +		break;
> +	case DP_PCON_HDMI_ERROR_COUNT_THREE_PLUS:
> +		num_error = 3;
> +		break;
> +	default:
> +		num_error = 0;
> +	}
> +
> +		DRM_ERROR("More than %d errors since the last read for lane
> %d", num_error, i);
> +	}
> +}
> +EXPORT_SYMBOL(drm_dp_pcon_hdmi_frl_link_error_count);
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index
> d6f79b2d1287..eb26c86dc8ca 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -946,6 +946,11 @@ struct drm_device;
>  # define DP_CEC_IRQ                          (1 << 2)
> 
>  #define DP_LINK_SERVICE_IRQ_VECTOR_ESI0     0x2005   /* 1.2 */
> +# define RX_CAP_CHANGED                      (1 << 0)
> +# define LINK_STATUS_CHANGED                 (1 << 1)
> +# define STREAM_STATUS_CHANGED               (1 << 2)
> +# define HDMI_LINK_STATUS_CHANGED            (1 << 3)
> +# define CONNECTED_OFF_ENTRY_REQUESTED       (1 << 4)
> 
>  #define DP_PSR_ERROR_STATUS                 0x2006  /* XXX 1.2? */
>  # define DP_PSR_LINK_CRC_ERROR              (1 << 0)
> @@ -1130,6 +1135,16 @@ struct drm_device;
>  #define DP_PROTOCOL_CONVERTER_CONTROL_2		0x3052 /* DP 1.3
> */
>  # define DP_CONVERSION_TO_YCBCR422_ENABLE	(1 << 0) /* DP 1.3 */
> 
> +/* PCON Downstream HDMI ERROR Status per Lane */
> +#define DP_PCON_HDMI_ERROR_STATUS_LN0          0x3037
> +#define DP_PCON_HDMI_ERROR_STATUS_LN1          0x3038
> +#define DP_PCON_HDMI_ERROR_STATUS_LN2          0x3039
> +#define DP_PCON_HDMI_ERROR_STATUS_LN3          0x303A
> +# define DP_PCON_HDMI_ERROR_COUNT_MASK         (0x7 << 0)
> +# define DP_PCON_HDMI_ERROR_COUNT_THREE_PLUS   (1 << 0)
> +# define DP_PCON_HDMI_ERROR_COUNT_TEN_PLUS     (1 << 1)
> +# define DP_PCON_HDMI_ERROR_COUNT_HUNDRED_PLUS (1 << 2)
> +
>  /* HDCP 1.3 and HDCP 2.2 */
>  #define DP_AUX_HDCP_BKSV		0x68000
>  #define DP_AUX_HDCP_RI_PRIME		0x68005
> @@ -2047,4 +2062,5 @@ int drm_dp_pcon_frl_enable(struct drm_dp_aux *aux);
> 
>  bool drm_dp_pcon_hdmi_link_active(struct drm_dp_aux *aux);  int
> drm_dp_pcon_hdmi_link_mode(struct drm_dp_aux *aux, u8 *frl_trained_mask);
> +void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux,
> +struct drm_connector *connector);

Leave a blank line.

>  #endif /* _DRM_DP_HELPER_H_ */
> --
> 2.17.1

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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux