Message ID | 20171009092959.29021-1-jani.nikula@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Oct 09, 2017 at 12:29:57PM +0300, Jani Nikula wrote: > 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 > Signed-off-by: Jani Nikula <jani.nikula@intel.com> > --- > drivers/gpu/drm/drm_dp_helper.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c > index 08af8d6b844b..dca21b5a03ec 100644 > --- a/drivers/gpu/drm/drm_dp_helper.c > +++ b/drivers/gpu/drm/drm_dp_helper.c > @@ -137,8 +137,10 @@ EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); > u8 drm_dp_link_rate_to_bw_code(int link_rate) > { > switch (link_rate) { > - case 162000: > 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; > case 270000: > 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) > { > switch (link_bw) { > - case DP_LINK_BW_1_62: > default: > + WARN(1, "unknown DP link bw code %x, using 162000\n", link_bw); Nit: "DP link BW" because it is an abbreviation. Otherwise looks good: Reviewed-by: Thierry Reding <treding@nvidia.com>
> -----Original Message----- > From: Jani Nikula [mailto:jani.nikula@intel.com] > Sent: Monday, October 09, 2017 5:30 AM > To: intel-gfx@lists.freedesktop.org > Cc: jani.nikula@intel.com; Deucher, Alexander; Thierry Reding; Rob Clark; > Sean Paul; Manasi Navare; dri-devel@lists.freedesktop.org > Subject: [PATCH 1/3] 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 > Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> > --- > drivers/gpu/drm/drm_dp_helper.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_dp_helper.c > b/drivers/gpu/drm/drm_dp_helper.c > index 08af8d6b844b..dca21b5a03ec 100644 > --- a/drivers/gpu/drm/drm_dp_helper.c > +++ b/drivers/gpu/drm/drm_dp_helper.c > @@ -137,8 +137,10 @@ > EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); > u8 drm_dp_link_rate_to_bw_code(int link_rate) > { > switch (link_rate) { > - case 162000: > 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; > case 270000: > 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) > { > switch (link_bw) { > - case DP_LINK_BW_1_62: > default: > + WARN(1, "unknown DP link bw code %x, using 162000\n", > link_bw); > + case DP_LINK_BW_1_62: > return 162000; > case DP_LINK_BW_2_7: > return 270000; > -- > 2.11.0
On Mon, Oct 09, 2017 at 12:29:57PM +0300, Jani Nikula wrote: > 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 > Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Manasi Navare <manasi.d.navare@intel.com> > --- > drivers/gpu/drm/drm_dp_helper.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c > index 08af8d6b844b..dca21b5a03ec 100644 > --- a/drivers/gpu/drm/drm_dp_helper.c > +++ b/drivers/gpu/drm/drm_dp_helper.c > @@ -137,8 +137,10 @@ EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); > u8 drm_dp_link_rate_to_bw_code(int link_rate) > { > switch (link_rate) { > - case 162000: > 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; > case 270000: > 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) > { > switch (link_bw) { > - case DP_LINK_BW_1_62: > default: > + WARN(1, "unknown DP link bw code %x, using 162000\n", link_bw); > + case DP_LINK_BW_1_62: > return 162000; > case DP_LINK_BW_2_7: > return 270000; > -- > 2.11.0 >
On Mon, 09 Oct 2017, Thierry Reding <treding@nvidia.com> wrote: > On Mon, Oct 09, 2017 at 12:29:57PM +0300, Jani Nikula wrote: >> 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 >> Signed-off-by: Jani Nikula <jani.nikula@intel.com> >> --- >> drivers/gpu/drm/drm_dp_helper.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c >> index 08af8d6b844b..dca21b5a03ec 100644 >> --- a/drivers/gpu/drm/drm_dp_helper.c >> +++ b/drivers/gpu/drm/drm_dp_helper.c >> @@ -137,8 +137,10 @@ EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); >> u8 drm_dp_link_rate_to_bw_code(int link_rate) >> { >> switch (link_rate) { >> - case 162000: >> 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; >> case 270000: >> 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) >> { >> switch (link_bw) { >> - case DP_LINK_BW_1_62: >> default: >> + WARN(1, "unknown DP link bw code %x, using 162000\n", link_bw); > > Nit: "DP link BW" because it is an abbreviation. Otherwise looks good: Thanks for the reviews everyone, pushed patch 1 with BW upcased to drm-misc-next. BR, Jani. > > Reviewed-by: Thierry Reding <treding@nvidia.com>
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 08af8d6b844b..dca21b5a03ec 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -137,8 +137,10 @@ EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); u8 drm_dp_link_rate_to_bw_code(int link_rate) { switch (link_rate) { - case 162000: 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; case 270000: 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) { switch (link_bw) { - case DP_LINK_BW_1_62: default: + WARN(1, "unknown DP link bw code %x, using 162000\n", link_bw); + case DP_LINK_BW_1_62: return 162000; case DP_LINK_BW_2_7: return 270000;
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 Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/drm_dp_helper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)