From 719013e9e0d572988467f815d6feb313daeca2b6 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 8 Aug 2014 16:38:23 +0000 Subject: [PATCH] drm/radeon/dp: fix lane/clock setup for dp 1.2 capable devices From Alex Deucher c9a1adc31f78a30f33c591b61171f02d13a5b1a7 in ubuntu 3.8 3b6d9fd23e015b5397c438fd3cd74147d2c805b6 in mainline linux --- sys/dev/pci/drm/radeon/atombios_dp.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/radeon/atombios_dp.c b/sys/dev/pci/drm/radeon/atombios_dp.c index 59f14d71221..409d740752c 100644 --- a/sys/dev/pci/drm/radeon/atombios_dp.c +++ b/sys/dev/pci/drm/radeon/atombios_dp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atombios_dp.c,v 1.3 2014/02/10 00:25:28 jsg Exp $ */ +/* $OpenBSD: atombios_dp.c,v 1.4 2014/08/08 16:38:23 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -387,6 +387,19 @@ static int dp_get_max_dp_pix_clock(int link_rate, /***** radeon specific DP functions *****/ +static int radeon_dp_get_max_link_rate(struct drm_connector *connector, + u8 dpcd[DP_DPCD_SIZE]) +{ + int max_link_rate; + + if (radeon_connector_is_dp12_capable(connector)) + max_link_rate = min(drm_dp_max_link_rate(dpcd), 540000); + else + max_link_rate = min(drm_dp_max_link_rate(dpcd), 270000); + + return max_link_rate; +} + /* First get the min lane# when low rate is used according to pixel clock * (prefer low rate), second check max lane# supported by DP panel, * if the max lane# < low rate lane# then use max lane# instead. @@ -396,7 +409,7 @@ static int radeon_dp_get_dp_lane_number(struct drm_connector *connector, int pix_clock) { int bpp = convert_bpc_to_bpp(radeon_get_monitor_bpc(connector)); - int max_link_rate = drm_dp_max_link_rate(dpcd); + int max_link_rate = radeon_dp_get_max_link_rate(connector, dpcd); int max_lane_num = drm_dp_max_lane_count(dpcd); int lane_num; int max_dp_pix_clock; @@ -434,7 +447,7 @@ static int radeon_dp_get_dp_link_clock(struct drm_connector *connector, return 540000; } - return drm_dp_max_link_rate(dpcd); + return radeon_dp_get_max_link_rate(connector, dpcd); } static u8 radeon_dp_encoder_service(struct radeon_device *rdev, -- 2.20.1