[RFC 02/13] drm/dp: Set channel coding on link configuration
Thierry Reding
thierry.reding at gmail.com
Wed Aug 12 08:06:30 PDT 2015
From: Thierry Reding <treding at nvidia.com>
Make use of ANSI 8B/10B channel coding if the DisplayPort sink supports
it.
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
drivers/gpu/drm/drm_dp_helper.c | 16 ++++++++++++++--
include/drm/drm_dp_helper.h | 2 ++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index bf480a08d7f9..c48addaf4301 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -295,7 +295,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
*/
int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link)
{
- u8 values[4];
+ u8 values[7];
int err;
memset(link, 0, sizeof(*link));
@@ -314,6 +314,9 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link)
if (values[3] & DP_NO_AUX_HANDSHAKE_LINK_TRAINING)
link->capabilities |= DP_LINK_CAP_FAST_TRAINING;
+ if (values[6] & DP_SET_ANSI_8B10B)
+ link->capabilities |= DP_LINK_CAP_ANSI_8B10B;
+
return 0;
}
EXPORT_SYMBOL(drm_dp_link_probe);
@@ -396,7 +399,7 @@ EXPORT_SYMBOL(drm_dp_link_power_down);
*/
int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
{
- u8 values[2];
+ u8 values[2], value = 0;
int err;
values[0] = drm_dp_link_rate_to_bw_code(link->rate);
@@ -409,6 +412,15 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
if (err < 0)
return err;
+ if (link->capabilities & DP_LINK_CAP_ANSI_8B10B)
+ value = DP_SET_ANSI_8B10B;
+ else
+ value = 0;
+
+ err = drm_dp_dpcd_writeb(aux, DP_MAIN_LINK_CHANNEL_CODING_SET, value);
+ if (err < 0)
+ return err;
+
return 0;
}
EXPORT_SYMBOL(drm_dp_link_configure);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 61c0518704a3..83be142395ff 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -88,6 +88,7 @@
# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */
#define DP_MAIN_LINK_CHANNEL_CODING 0x006
+# define DP_CODING_ANSI_8B10B (1 << 0)
#define DP_DOWN_STREAM_PORT_COUNT 0x007
# define DP_PORT_COUNT_MASK 0x0f
@@ -743,6 +744,7 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
*/
#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
#define DP_LINK_CAP_FAST_TRAINING (1 << 1)
+#define DP_LINK_CAP_ANSI_8B10B (1 << 2)
struct drm_dp_link {
unsigned char revision;
--
2.4.5
More information about the dri-devel
mailing list