From f797759ff5f9ca9829a63ad06aae5ebc7cf27a6a Mon Sep 17 00:00:00 2001 From: xubilv Date: Mon, 17 Jul 2017 18:05:48 +0800 Subject: [PATCH] drm/rockchip: dw-mipi-dsi: organize dw_mipi_dsi_get_hcomponent_lbcc function Use the common interface to calculate Change-Id: I21836061d1442048efaba3b2930811b8a0aab0aa Signed-off-by: xubilv --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index b2994b633958..6cf7da73e577 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -808,16 +808,16 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi) static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, u32 hcomponent) { - u32 frac, lbcc; + u32 lbcc; lbcc = hcomponent * dsi->lane_mbps * MSEC_PER_SEC / 8; - frac = lbcc % dsi->mode.clock; - lbcc = lbcc / dsi->mode.clock; - if (frac) - lbcc++; + if (dsi->mode.clock == 0) { + dev_err(dsi->dev, "dsi mode clock is 0!\n"); + return 0; + } - return lbcc; + return DIV_ROUND_CLOSEST_ULL(lbcc, dsi->mode.clock); } static void dw_mipi_dsi_line_timer_config(struct dw_mipi_dsi *dsi) -- 2.34.1