Commit 3a89b4a9 authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms/combios: verify dac_adj values are valid

Some vbios dac_adj tables are all zeros.  Check for that
case and use the default table if so.

Should fix fdo bug 27478.
Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent affd8589
...@@ -760,6 +760,8 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct ...@@ -760,6 +760,8 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
dac = RBIOS8(dac_info + 0x3) & 0xf; dac = RBIOS8(dac_info + 0x3) & 0xf;
p_dac->ps2_pdac_adj = (bg << 8) | (dac); p_dac->ps2_pdac_adj = (bg << 8) | (dac);
} }
/* if the values are all zeros, use the table */
if (p_dac->ps2_pdac_adj)
found = 1; found = 1;
} }
...@@ -895,6 +897,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct ...@@ -895,6 +897,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
bg = RBIOS8(dac_info + 0x10) & 0xf; bg = RBIOS8(dac_info + 0x10) & 0xf;
dac = RBIOS8(dac_info + 0x11) & 0xf; dac = RBIOS8(dac_info + 0x11) & 0xf;
tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
/* if the values are all zeros, use the table */
if (tv_dac->ps2_tvdac_adj)
found = 1; found = 1;
} else if (rev > 1) { } else if (rev > 1) {
bg = RBIOS8(dac_info + 0xc) & 0xf; bg = RBIOS8(dac_info + 0xc) & 0xf;
...@@ -908,6 +912,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct ...@@ -908,6 +912,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
bg = RBIOS8(dac_info + 0xe) & 0xf; bg = RBIOS8(dac_info + 0xe) & 0xf;
dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf; dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf;
tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
/* if the values are all zeros, use the table */
if (tv_dac->ps2_tvdac_adj)
found = 1; found = 1;
} }
tv_dac->tv_std = radeon_combios_get_tv_info(rdev); tv_dac->tv_std = radeon_combios_get_tv_info(rdev);
...@@ -925,6 +931,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct ...@@ -925,6 +931,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
(bg << 16) | (dac << 20); (bg << 16) | (dac << 20);
tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
/* if the values are all zeros, use the table */
if (tv_dac->ps2_tvdac_adj)
found = 1; found = 1;
} else { } else {
bg = RBIOS8(dac_info + 0x4) & 0xf; bg = RBIOS8(dac_info + 0x4) & 0xf;
...@@ -933,6 +941,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct ...@@ -933,6 +941,8 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
(bg << 16) | (dac << 20); (bg << 16) | (dac << 20);
tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
/* if the values are all zeros, use the table */
if (tv_dac->ps2_tvdac_adj)
found = 1; found = 1;
} }
} else { } else {
......
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