drm/dp: WARN about invalid/unknown link rates and bw codes

Falling back to the lowest value is likely the only thing we can do, but
doing it silently seems like a bad thing to do. Catch it early and make
loud noises.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171009092959.29021-1-jani.nikula@intel.com
This commit is contained in:
Jani Nikula 2017-10-09 12:29:57 +03:00
parent 7c0f24a4c4
commit cccf4e3fe3
1 changed files with 5 additions and 2 deletions

View File

@ -137,8 +137,10 @@ EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay);
u8 drm_dp_link_rate_to_bw_code(int link_rate) u8 drm_dp_link_rate_to_bw_code(int link_rate)
{ {
switch (link_rate) { switch (link_rate) {
case 162000:
default: default:
WARN(1, "unknown DP link rate %d, using %x\n", link_rate,
DP_LINK_BW_1_62);
case 162000:
return DP_LINK_BW_1_62; return DP_LINK_BW_1_62;
case 270000: case 270000:
return DP_LINK_BW_2_7; return DP_LINK_BW_2_7;
@ -151,8 +153,9 @@ EXPORT_SYMBOL(drm_dp_link_rate_to_bw_code);
int drm_dp_bw_code_to_link_rate(u8 link_bw) int drm_dp_bw_code_to_link_rate(u8 link_bw)
{ {
switch (link_bw) { switch (link_bw) {
case DP_LINK_BW_1_62:
default: default:
WARN(1, "unknown DP link BW code %x, using 162000\n", link_bw);
case DP_LINK_BW_1_62:
return 162000; return 162000;
case DP_LINK_BW_2_7: case DP_LINK_BW_2_7:
return 270000; return 270000;