Commit 7b3fc170 authored by Imre Deak's avatar Imre Deak

drm/i915/dp: Print full branch/sink descriptor

Extend the branch/sink descriptor info with the missing device ID
field. While at it also read out all the descriptor registers in one
transfer and make the debug print more compact.

v2: (Jani)
- Cache the descriptor in intel_dp.
- Split out this change into a separate patch.
v3: (Jani)
- Fix return value check of __intel_dp_read_desc().
- Use %pE instead of %s to print the device ID.

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477401159-15098-1-git-send-email-imre.deak@intel.com
parent 5e896677
...@@ -1451,34 +1451,35 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp) ...@@ -1451,34 +1451,35 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
DRM_DEBUG_KMS("common rates: %s\n", str); DRM_DEBUG_KMS("common rates: %s\n", str);
} }
static void intel_dp_print_hw_revision(struct intel_dp *intel_dp) static bool
__intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc)
{ {
uint8_t rev; u32 base = drm_dp_is_branch(intel_dp->dpcd) ? DP_BRANCH_OUI :
int len; DP_SINK_OUI;
if (!drm_dp_is_branch(intel_dp->dpcd))
return;
len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_HW_REV, &rev, 1); return drm_dp_dpcd_read(&intel_dp->aux, base, desc, sizeof(*desc)) ==
if (len < 0) sizeof(*desc);
return;
DRM_DEBUG_KMS("sink hw revision: %d.%d\n", (rev & 0xf0) >> 4, rev & 0xf);
} }
static void intel_dp_print_sw_revision(struct intel_dp *intel_dp) static bool intel_dp_read_desc(struct intel_dp *intel_dp)
{ {
uint8_t rev[2]; struct intel_dp_desc *desc = &intel_dp->desc;
int len; bool oui_sup = intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] &
DP_OUI_SUPPORT;
int dev_id_len;
if (!drm_dp_is_branch(intel_dp->dpcd)) if (!__intel_dp_read_desc(intel_dp, desc))
return; return false;
len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_SW_REV, &rev, 2); dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id));
if (len < 0) DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
return; 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);
DRM_DEBUG_KMS("sink sw revision: %d.%d\n", rev[0], rev[1]); return true;
} }
static int rate_to_index(int find, const int *rates) static int rate_to_index(int find, const int *rates)
...@@ -3621,23 +3622,6 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) ...@@ -3621,23 +3622,6 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
return true; return true;
} }
static void
intel_dp_probe_oui(struct intel_dp *intel_dp)
{
bool is_branch = drm_dp_is_branch(intel_dp->dpcd);
u8 buf[3];
if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT))
return;
if (drm_dp_dpcd_read(&intel_dp->aux,
is_branch ? DP_BRANCH_OUI : DP_SINK_OUI,
buf, 3) == 3)
DRM_DEBUG_KMS("%s OUI: %02hx%02hx%02hx\n",
is_branch ? "Branch" : "Sink",
buf[0], buf[1], buf[2]);
}
static bool static bool
intel_dp_can_mst(struct intel_dp *intel_dp) intel_dp_can_mst(struct intel_dp *intel_dp)
{ {
...@@ -4416,10 +4400,7 @@ intel_dp_long_pulse(struct intel_connector *intel_connector) ...@@ -4416,10 +4400,7 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
intel_dp_print_rates(intel_dp); intel_dp_print_rates(intel_dp);
intel_dp_probe_oui(intel_dp); intel_dp_read_desc(intel_dp);
intel_dp_print_hw_revision(intel_dp);
intel_dp_print_sw_revision(intel_dp);
intel_dp_configure_mst(intel_dp); intel_dp_configure_mst(intel_dp);
......
...@@ -883,6 +883,14 @@ enum link_m_n_set { ...@@ -883,6 +883,14 @@ enum link_m_n_set {
M2_N2 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 { struct intel_dp {
i915_reg_t output_reg; i915_reg_t output_reg;
i915_reg_t aux_ch_ctl_reg; i915_reg_t aux_ch_ctl_reg;
...@@ -905,6 +913,8 @@ struct intel_dp { ...@@ -905,6 +913,8 @@ struct intel_dp {
/* sink rates as reported by DP_SUPPORTED_LINK_RATES */ /* sink rates as reported by DP_SUPPORTED_LINK_RATES */
uint8_t num_sink_rates; uint8_t num_sink_rates;
int sink_rates[DP_MAX_SUPPORTED_RATES]; int sink_rates[DP_MAX_SUPPORTED_RATES];
/* sink or branch descriptor */
struct intel_dp_desc desc;
struct drm_dp_aux aux; struct drm_dp_aux aux;
uint8_t train_set[4]; uint8_t train_set[4];
int panel_power_up_delay; int panel_power_up_delay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment