Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84c36753 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/i915: use drm DP helper to read DPCD desc



Switch to using the common DP helpers instead of using our own.

v2: also remove leftover struct intel_dp_desc (Daniel)

Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 118b90f3
Loading
Loading
Loading
Loading
+4 −33
Original line number Diff line number Diff line
@@ -1507,37 +1507,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;
}

static int rate_to_index(int find, const int *rates)
{
	int i = 0;
@@ -3622,7 +3591,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] &
@@ -4624,7 +4594,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);

+1 −12
Original line number Diff line number Diff line
@@ -906,14 +906,6 @@ enum link_m_n_set {
	M2_N2
};

struct intel_dp_desc {
	u8 oui[3];
	u8 device_id[6];
	u8 hw_rev;
	u8 sw_major_rev;
	u8 sw_minor_rev;
} __packed;

struct intel_dp_compliance_data {
	unsigned long edid;
	uint8_t video_pattern;
@@ -957,7 +949,7 @@ struct intel_dp {
	/* Max link BW for the sink as per DPCD registers */
	int max_sink_link_bw;
	/* 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];
@@ -1532,9 +1524,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,
+1 −1
Original line number Diff line number Diff line
@@ -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;