Skip to content

Commit f797759

Browse files
xubilvrkhuangtao
authored andcommitted
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 <xbl@rock-chips.com>
1 parent a96eb42 commit f797759

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/gpu/drm/rockchip/dw-mipi-dsi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -808,16 +808,16 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)
808808
static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,
809809
u32 hcomponent)
810810
{
811-
u32 frac, lbcc;
811+
u32 lbcc;
812812

813813
lbcc = hcomponent * dsi->lane_mbps * MSEC_PER_SEC / 8;
814814

815-
frac = lbcc % dsi->mode.clock;
816-
lbcc = lbcc / dsi->mode.clock;
817-
if (frac)
818-
lbcc++;
815+
if (dsi->mode.clock == 0) {
816+
dev_err(dsi->dev, "dsi mode clock is 0!\n");
817+
return 0;
818+
}
819819

820-
return lbcc;
820+
return DIV_ROUND_CLOSEST_ULL(lbcc, dsi->mode.clock);
821821
}
822822

823823
static void dw_mipi_dsi_line_timer_config(struct dw_mipi_dsi *dsi)

0 commit comments

Comments
 (0)