Commit 5a96a899 authored by Jerome Glisse's avatar Jerome Glisse Committed by Dave Airlie

drm/radeon/kms: fix DP training for DPEncoderService revision bigger than 1.1

DPEncoderService newer than 1.1 can't properly program the DP (display port)
link training. When facing such version use the DIGxEncoderControl method
instead. Fix DP link training on some R7XX.
Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 4639dd21
...@@ -627,6 +627,7 @@ struct radeon_dp_link_train_info { ...@@ -627,6 +627,7 @@ struct radeon_dp_link_train_info {
u8 train_set[4]; u8 train_set[4];
u8 link_status[DP_LINK_STATUS_SIZE]; u8 link_status[DP_LINK_STATUS_SIZE];
u8 tries; u8 tries;
bool use_dpencoder;
}; };
static void radeon_dp_update_vs_emph(struct radeon_dp_link_train_info *dp_info) static void radeon_dp_update_vs_emph(struct radeon_dp_link_train_info *dp_info)
...@@ -646,7 +647,7 @@ static void radeon_dp_set_tp(struct radeon_dp_link_train_info *dp_info, int tp) ...@@ -646,7 +647,7 @@ static void radeon_dp_set_tp(struct radeon_dp_link_train_info *dp_info, int tp)
int rtp = 0; int rtp = 0;
/* set training pattern on the source */ /* set training pattern on the source */
if (ASIC_IS_DCE4(dp_info->rdev)) { if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder) {
switch (tp) { switch (tp) {
case DP_TRAINING_PATTERN_1: case DP_TRAINING_PATTERN_1:
rtp = ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1; rtp = ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1;
...@@ -706,7 +707,7 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info) ...@@ -706,7 +707,7 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
radeon_write_dpcd_reg(dp_info->radeon_connector, DP_LINK_BW_SET, tmp); radeon_write_dpcd_reg(dp_info->radeon_connector, DP_LINK_BW_SET, tmp);
/* start training on the source */ /* start training on the source */
if (ASIC_IS_DCE4(dp_info->rdev)) if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder)
atombios_dig_encoder_setup(dp_info->encoder, atombios_dig_encoder_setup(dp_info->encoder,
ATOM_ENCODER_CMD_DP_LINK_TRAINING_START, 0); ATOM_ENCODER_CMD_DP_LINK_TRAINING_START, 0);
else else
...@@ -731,7 +732,7 @@ static int radeon_dp_link_train_finish(struct radeon_dp_link_train_info *dp_info ...@@ -731,7 +732,7 @@ static int radeon_dp_link_train_finish(struct radeon_dp_link_train_info *dp_info
DP_TRAINING_PATTERN_DISABLE); DP_TRAINING_PATTERN_DISABLE);
/* disable the training pattern on the source */ /* disable the training pattern on the source */
if (ASIC_IS_DCE4(dp_info->rdev)) if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder)
atombios_dig_encoder_setup(dp_info->encoder, atombios_dig_encoder_setup(dp_info->encoder,
ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE, 0); ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE, 0);
else else
...@@ -869,7 +870,8 @@ void radeon_dp_link_train(struct drm_encoder *encoder, ...@@ -869,7 +870,8 @@ void radeon_dp_link_train(struct drm_encoder *encoder,
struct radeon_connector *radeon_connector; struct radeon_connector *radeon_connector;
struct radeon_connector_atom_dig *dig_connector; struct radeon_connector_atom_dig *dig_connector;
struct radeon_dp_link_train_info dp_info; struct radeon_dp_link_train_info dp_info;
u8 tmp; int index;
u8 tmp, frev, crev;
if (!radeon_encoder->enc_priv) if (!radeon_encoder->enc_priv)
return; return;
...@@ -884,6 +886,18 @@ void radeon_dp_link_train(struct drm_encoder *encoder, ...@@ -884,6 +886,18 @@ void radeon_dp_link_train(struct drm_encoder *encoder,
(dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_eDP)) (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_eDP))
return; return;
/* DPEncoderService newer than 1.1 can't program properly the
* training pattern. When facing such version use the
* DIGXEncoderControl (X== 1 | 2)
*/
dp_info.use_dpencoder = true;
index = GetIndexIntoMasterTable(COMMAND, DPEncoderService);
if (atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) {
if (crev > 1) {
dp_info.use_dpencoder = false;
}
}
dp_info.enc_id = 0; dp_info.enc_id = 0;
if (dig->dig_encoder) if (dig->dig_encoder)
dp_info.enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER; dp_info.enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER;
......
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