2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 09:43:59 +08:00

clk: qcom: use divider_ro_round_rate helper

There is now an helper function to round the rate when the
divider is read-only. Let's use it

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Jerome Brunet 2018-02-14 14:43:40 +01:00 committed by Stephen Boyd
parent b15ee490e1
commit f5edaefee2

View File

@ -28,22 +28,14 @@ static long div_round_ro_rate(struct clk_hw *hw, unsigned long rate,
{ {
struct clk_regmap_div *divider = to_clk_regmap_div(hw); struct clk_regmap_div *divider = to_clk_regmap_div(hw);
struct clk_regmap *clkr = &divider->clkr; struct clk_regmap *clkr = &divider->clkr;
u32 div; u32 val;
struct clk_hw *hw_parent = clk_hw_get_parent(hw);
regmap_read(clkr->regmap, divider->reg, &div); regmap_read(clkr->regmap, divider->reg, &val);
div >>= divider->shift; val >>= divider->shift;
div &= BIT(divider->width) - 1; val &= BIT(divider->width) - 1;
div += 1;
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { return divider_ro_round_rate(hw, rate, prate, NULL, divider->width,
if (!hw_parent) CLK_DIVIDER_ROUND_CLOSEST, val);
return -EINVAL;
*prate = clk_hw_round_rate(hw_parent, rate * div);
}
return DIV_ROUND_UP_ULL((u64)*prate, div);
} }
static long div_round_rate(struct clk_hw *hw, unsigned long rate, static long div_round_rate(struct clk_hw *hw, unsigned long rate,