drm/i915/dp: Report a rounded-down value as the maximum data rate
authorImre Deak <imre.deak@intel.com>
Thu, 16 Nov 2023 13:18:39 +0000 (15:18 +0200)
committerImre Deak <imre.deak@intel.com>
Tue, 21 Nov 2023 14:32:44 +0000 (16:32 +0200)
Callers of intel_dp_max_data_rate() use the return value as an upper
bound for the BW a given mode requires. As such the rounding shouldn't
result in a bigger value than the actual upper bound. Use round-down
instead of -closest accordingly.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231116131841.1588781-10-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index e7502a8240470a43c53625d2ac175cef05900245..7fd883b954a6f3a19b1817aa928b6a903c9234b5 100644 (file)
@@ -413,7 +413,7 @@ intel_dp_max_data_rate(int max_link_rate, int max_lanes)
                 */
                int max_link_rate_kbps = max_link_rate * 10;
 
-               max_link_rate_kbps = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(max_link_rate_kbps, 9671), 10000);
+               max_link_rate_kbps = DIV_ROUND_DOWN_ULL(mul_u32_u32(max_link_rate_kbps, 9671), 10000);
                max_link_rate = max_link_rate_kbps / 8;
        }
 
@@ -423,7 +423,7 @@ intel_dp_max_data_rate(int max_link_rate, int max_lanes)
         * out to be a nop by coincidence, and can be skipped:
         *
         *      int max_link_rate_kbps = max_link_rate * 10;
-        *      max_link_rate_kbps = DIV_ROUND_CLOSEST_ULL(max_link_rate_kbps * 8, 10);
+        *      max_link_rate_kbps = DIV_ROUND_DOWN_ULL(max_link_rate_kbps * 8, 10);
         *      max_link_rate = max_link_rate_kbps / 8;
         */