Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8c8c422 authored by Vicky Wallace's avatar Vicky Wallace Committed by Gerrit - the friendly Code Review server
Browse files

clk: qcom: Add support to round the frequency to kHz



The divider round closest flag is designed for
the rounding to the Hz of the requested frequency.
Certain clock such as graphic clock on SDM845 needs
the divider to round to the kHz. This change support
this special round rate.

CRs-Fixed: 2048646
Change-Id: I1d5950faea30f94593321509dcf647af1b3fa57f
Signed-off-by: default avatarVicky Wallace <vwallace@codeaurora.org>
parent 8588eafd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -257,6 +257,9 @@ static bool _is_best_div(unsigned long rate, unsigned long now,
{
	if (flags & CLK_DIVIDER_ROUND_CLOSEST)
		return abs(rate - now) < abs(rate - best);
	else if (flags & CLK_DIVIDER_ROUND_KHZ)
		return (DIV_ROUND_CLOSEST(abs(rate - now), 1000)
			< DIV_ROUND_CLOSEST(abs(rate - best), 1000));

	return now <= rate && now > best;
}
+1 −0
Original line number Diff line number Diff line
@@ -495,6 +495,7 @@ struct clk_divider {
#define CLK_DIVIDER_ROUND_CLOSEST	BIT(4)
#define CLK_DIVIDER_READ_ONLY		BIT(5)
#define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
#define CLK_DIVIDER_ROUND_KHZ	BIT(7)

extern const struct clk_ops clk_divider_ops;
extern const struct clk_ops clk_divider_ro_ops;