[PATCH 08/12] drm/dp: Read eDP version from DPCD
Thierry Reding
thierry.reding at gmail.com
Mon Dec 14 04:56:00 PST 2015
From: Thierry Reding <treding at nvidia.com>
If the sink supports eDP, read the eDP revision from it's DPCD.
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
drivers/gpu/drm/drm_dp_helper.c | 15 +++++++++++++++
include/drm/drm_dp_helper.h | 8 ++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 0cf5b1c278ae..8d8112a4fee0 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -327,6 +327,7 @@ static void drm_dp_link_reset(struct drm_dp_link *link)
link->max_lanes = 0;
drm_dp_link_caps_reset(&link->caps);
+ link->edp = 0;
link->rate = 0;
link->lanes = 0;
@@ -363,6 +364,20 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link)
link->caps.fast_training = drm_dp_fast_training_cap(values);
link->caps.channel_coding = drm_dp_channel_coding_supported(values);
+ if (drm_dp_alternate_scrambler_reset_cap(values)) {
+ static const u8 edp_revs[] = { 0x11, 0x12, 0x13, 0x14 };
+ u8 value;
+
+ err = drm_dp_dpcd_readb(aux, DP_EDP_DPCD_REV, &value);
+ if (err < 0)
+ return err;
+
+ if (value >= ARRAY_SIZE(edp_revs))
+ DRM_ERROR("unsupported eDP version: %02x\n", value);
+ else
+ link->edp = edp_revs[value];
+ }
+
link->rate = link->max_rate;
link->lanes = link->max_lanes;
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 201e654b2257..1f7b137d01b6 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -659,6 +659,13 @@ drm_dp_channel_coding_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
return dpcd[DP_MAIN_LINK_CHANNEL_CODING] & DP_CAP_ANSI_8B10B;
}
+static inline bool
+drm_dp_alternate_scrambler_reset_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
+{
+ return dpcd[DP_EDP_CONFIGURATION_CAP] &
+ DP_ALTERNATE_SCRAMBLER_RESET_CAP;
+}
+
/*
* DisplayPort AUX channel
*/
@@ -785,6 +792,7 @@ struct drm_dp_link {
unsigned int max_lanes;
struct drm_dp_link_caps caps;
+ unsigned char edp;
unsigned int rate;
unsigned int lanes;
--
2.5.0
More information about the dri-devel
mailing list