[Intel-gfx] [PATCH 2/4] drm/i915: use drm DP helper to read DPCD desc

Daniel Vetter daniel at ffwll.ch
Thu May 18 06:03:25 UTC 2017


On Wed, May 17, 2017 at 05:25:14PM +0300, Jani Nikula wrote:
> Switch to using the common DP helpers instead of using our own.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Forgot to remove struct intel_dp_desc, otherwise lgtm.

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/i915/intel_dp.c     | 37 ++++---------------------------------
>  drivers/gpu/drm/i915/intel_drv.h    |  5 +----
>  drivers/gpu/drm/i915/intel_lspcon.c |  2 +-
>  3 files changed, 6 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 4a6feb6a69bd..2a5f385e8f44 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1548,37 +1548,6 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
>  	DRM_DEBUG_KMS("common rates: %s\n", str);
>  }
>  
> -bool
> -__intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc)
> -{
> -	u32 base = drm_dp_is_branch(intel_dp->dpcd) ? DP_BRANCH_OUI :
> -						      DP_SINK_OUI;
> -
> -	return drm_dp_dpcd_read(&intel_dp->aux, base, desc, sizeof(*desc)) ==
> -	       sizeof(*desc);
> -}
> -
> -bool intel_dp_read_desc(struct intel_dp *intel_dp)
> -{
> -	struct intel_dp_desc *desc = &intel_dp->desc;
> -	bool oui_sup = intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] &
> -		       DP_OUI_SUPPORT;
> -	int dev_id_len;
> -
> -	if (!__intel_dp_read_desc(intel_dp, desc))
> -		return false;
> -
> -	dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id));
> -	DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
> -		      drm_dp_is_branch(intel_dp->dpcd) ? "branch" : "sink",
> -		      (int)sizeof(desc->oui), desc->oui, oui_sup ? "" : "(NS)",
> -		      dev_id_len, desc->device_id,
> -		      desc->hw_rev >> 4, desc->hw_rev & 0xf,
> -		      desc->sw_major_rev, desc->sw_minor_rev);
> -
> -	return true;
> -}
> -
>  int
>  intel_dp_max_link_rate(struct intel_dp *intel_dp)
>  {
> @@ -3662,7 +3631,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	if (!intel_dp_read_dpcd(intel_dp))
>  		return false;
>  
> -	intel_dp_read_desc(intel_dp);
> +	drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc,
> +			 drm_dp_is_branch(intel_dp->dpcd));
>  
>  	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11)
>  		dev_priv->no_aux_handshake = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
> @@ -4677,7 +4647,8 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
>  
>  	intel_dp_print_rates(intel_dp);
>  
> -	intel_dp_read_desc(intel_dp);
> +	drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc,
> +			 drm_dp_is_branch(intel_dp->dpcd));
>  
>  	intel_dp_configure_mst(intel_dp);
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index bd500977b3fc..61a9981343d5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -996,7 +996,7 @@ struct intel_dp {
>  	/* Max rate for the current link */
>  	int max_link_rate;
>  	/* sink or branch descriptor */
> -	struct intel_dp_desc desc;
> +	struct drm_dp_desc desc;
>  	struct drm_dp_aux aux;
>  	enum intel_display_power_domain aux_power_domain;
>  	uint8_t train_set[4];
> @@ -1571,9 +1571,6 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count)
>  }
>  
>  bool intel_dp_read_dpcd(struct intel_dp *intel_dp);
> -bool __intel_dp_read_desc(struct intel_dp *intel_dp,
> -			  struct intel_dp_desc *desc);
> -bool intel_dp_read_desc(struct intel_dp *intel_dp);
>  int intel_dp_link_required(int pixel_clock, int bpp);
>  int intel_dp_max_data_rate(int max_link_clock, int max_lanes);
>  bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
> diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
> index 71cbe9c08932..5abef482eacf 100644
> --- a/drivers/gpu/drm/i915/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/intel_lspcon.c
> @@ -240,7 +240,7 @@ bool lspcon_init(struct intel_digital_port *intel_dig_port)
>  		return false;
>  	}
>  
> -	intel_dp_read_desc(dp);
> +	drm_dp_read_desc(&dp->aux, &dp->desc, drm_dp_is_branch(dp->dpcd));
>  
>  	DRM_DEBUG_KMS("Success: LSPCON init\n");
>  	return true;
> -- 
> 2.11.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list