mirror of https://gitee.com/openkylin/linux.git
gpu: ipu-di: Switch to DIV_ROUND_CLOSEST for DI clock divider calc
We can use the DIV_ROUND_CLOSEST() macro when calculating the DI clock divider, rounded to nearest int. Suggested-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
b6835a719a
commit
503f1631ae
|
@ -440,8 +440,7 @@ static void ipu_di_config_clock(struct ipu_di *di,
|
||||||
clk_set_rate(clk, sig->mode.pixelclock);
|
clk_set_rate(clk, sig->mode.pixelclock);
|
||||||
|
|
||||||
in_rate = clk_get_rate(clk);
|
in_rate = clk_get_rate(clk);
|
||||||
div = (in_rate + sig->mode.pixelclock / 2) /
|
div = DIV_ROUND_CLOSEST(in_rate, sig->mode.pixelclock);
|
||||||
sig->mode.pixelclock;
|
|
||||||
if (div == 0)
|
if (div == 0)
|
||||||
div = 1;
|
div = 1;
|
||||||
|
|
||||||
|
@ -459,8 +458,7 @@ static void ipu_di_config_clock(struct ipu_di *di,
|
||||||
unsigned div, error;
|
unsigned div, error;
|
||||||
|
|
||||||
clkrate = clk_get_rate(di->clk_ipu);
|
clkrate = clk_get_rate(di->clk_ipu);
|
||||||
div = (clkrate + sig->mode.pixelclock / 2) /
|
div = DIV_ROUND_CLOSEST(clkrate, sig->mode.pixelclock);
|
||||||
sig->mode.pixelclock;
|
|
||||||
rate = clkrate / div;
|
rate = clkrate / div;
|
||||||
|
|
||||||
error = rate / (sig->mode.pixelclock / 1000);
|
error = rate / (sig->mode.pixelclock / 1000);
|
||||||
|
@ -482,8 +480,7 @@ static void ipu_di_config_clock(struct ipu_di *di,
|
||||||
clk_set_rate(clk, sig->mode.pixelclock);
|
clk_set_rate(clk, sig->mode.pixelclock);
|
||||||
|
|
||||||
in_rate = clk_get_rate(clk);
|
in_rate = clk_get_rate(clk);
|
||||||
div = (in_rate + sig->mode.pixelclock / 2) /
|
div = DIV_ROUND_CLOSEST(in_rate, sig->mode.pixelclock);
|
||||||
sig->mode.pixelclock;
|
|
||||||
if (div == 0)
|
if (div == 0)
|
||||||
div = 1;
|
div = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue