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

Commit 646cafc6 authored by Tomeu Vizoso's avatar Tomeu Vizoso Committed by Michael Turquette
Browse files

clk: Change clk_ops->determine_rate to return a clk_hw as the best parent



This is in preparation for clock providers to not have to deal with struct clk.

Signed-off-by: default avatarTomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarMichael Turquette <mturquette@linaro.org>
parent 61c7cddf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ the operations defined in clk.h:
		long		(*determine_rate)(struct clk_hw *hw,
						unsigned long rate,
						unsigned long *best_parent_rate,
						struct clk **best_parent_clk);
						struct clk_hw **best_parent_clk);
		int		(*set_parent)(struct clk_hw *hw, u8 index);
		u8		(*get_parent)(struct clk_hw *hw);
		int		(*set_rate)(struct clk_hw *hw,
+5 −5
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ static long alchemy_calc_div(unsigned long rate, unsigned long prate,

static long alchemy_clk_fgcs_detr(struct clk_hw *hw, unsigned long rate,
					unsigned long *best_parent_rate,
					struct clk **best_parent_clk,
					struct clk_hw **best_parent_clk,
					int scale, int maxdiv)
{
	struct clk *pc, *bpc, *free;
@@ -454,7 +454,7 @@ static long alchemy_clk_fgcs_detr(struct clk_hw *hw, unsigned long rate,
	}

	*best_parent_rate = bpr;
	*best_parent_clk = bpc;
	*best_parent_clk = __clk_get_hw(bpc);
	return br;
}

@@ -548,7 +548,7 @@ static unsigned long alchemy_clk_fgv1_recalc(struct clk_hw *hw,

static long alchemy_clk_fgv1_detr(struct clk_hw *hw, unsigned long rate,
					unsigned long *best_parent_rate,
					struct clk **best_parent_clk)
					struct clk_hw **best_parent_clk)
{
	return alchemy_clk_fgcs_detr(hw, rate, best_parent_rate,
				     best_parent_clk, 2, 512);
@@ -680,7 +680,7 @@ static unsigned long alchemy_clk_fgv2_recalc(struct clk_hw *hw,

static long alchemy_clk_fgv2_detr(struct clk_hw *hw, unsigned long rate,
					unsigned long *best_parent_rate,
					struct clk **best_parent_clk)
					struct clk_hw **best_parent_clk)
{
	struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
	int scale, maxdiv;
@@ -899,7 +899,7 @@ static int alchemy_clk_csrc_setr(struct clk_hw *hw, unsigned long rate,

static long alchemy_clk_csrc_detr(struct clk_hw *hw, unsigned long rate,
					unsigned long *best_parent_rate,
					struct clk **best_parent_clk)
					struct clk_hw **best_parent_clk)
{
	struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
	int scale = c->dt[2] == 3 ? 1 : 2; /* au1300 check */
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw,
static long clk_programmable_determine_rate(struct clk_hw *hw,
					    unsigned long rate,
					    unsigned long *best_parent_rate,
					    struct clk **best_parent_clk)
					    struct clk_hw **best_parent_hw)
{
	struct clk *parent = NULL;
	long best_rate = -EINVAL;
@@ -84,7 +84,7 @@ static long clk_programmable_determine_rate(struct clk_hw *hw,
		if (best_rate < 0 || (rate - tmp_rate) < (rate - best_rate)) {
			best_rate = tmp_rate;
			*best_parent_rate = parent_rate;
			*best_parent_clk = parent;
			*best_parent_hw = __clk_get_hw(parent);
		}

		if (!best_rate)
+2 −2
Original line number Diff line number Diff line
@@ -1032,7 +1032,7 @@ static long kona_peri_clk_round_rate(struct clk_hw *hw, unsigned long rate,
}

static long kona_peri_clk_determine_rate(struct clk_hw *hw, unsigned long rate,
		unsigned long *best_parent_rate, struct clk **best_parent)
		unsigned long *best_parent_rate, struct clk_hw **best_parent)
{
	struct kona_clk *bcm_clk = to_kona_clk(hw);
	struct clk *clk = hw->clk;
@@ -1075,7 +1075,7 @@ static long kona_peri_clk_determine_rate(struct clk_hw *hw, unsigned long rate,
		if (delta < best_delta) {
			best_delta = delta;
			best_rate = other_rate;
			*best_parent = parent;
			*best_parent = __clk_get_hw(parent);
			*best_parent_rate = parent_rate;
		}
	}
+5 −4
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ static unsigned long clk_composite_recalc_rate(struct clk_hw *hw,

static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,
					unsigned long *best_parent_rate,
					struct clk **best_parent_p)
					struct clk_hw **best_parent_p)
{
	struct clk_composite *composite = to_clk_composite(hw);
	const struct clk_ops *rate_ops = composite->rate_ops;
@@ -80,8 +80,9 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,
		*best_parent_p = NULL;

		if (__clk_get_flags(hw->clk) & CLK_SET_RATE_NO_REPARENT) {
			*best_parent_p = clk_get_parent(mux_hw->clk);
			*best_parent_rate = __clk_get_rate(*best_parent_p);
			parent = clk_get_parent(mux_hw->clk);
			*best_parent_p = __clk_get_hw(parent);
			*best_parent_rate = __clk_get_rate(parent);

			return rate_ops->round_rate(rate_hw, rate,
						    best_parent_rate);
@@ -103,7 +104,7 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,

			if (!rate_diff || !*best_parent_p
				       || best_rate_diff > rate_diff) {
				*best_parent_p = parent;
				*best_parent_p = __clk_get_hw(parent);
				*best_parent_rate = parent_rate;
				best_rate_diff = rate_diff;
				best_rate = tmp_rate;
Loading