Re: [PATCH v5 08/12] clk: actions: Add factor clock support
From: Stephen Boyd <sboyd@kernel.org>
Date: 2018-03-20 01:11:35
Also in:
linux-arm-kernel, linux-clk, lkml
From: Stephen Boyd <sboyd@kernel.org>
Date: 2018-03-20 01:11:35
Also in:
linux-arm-kernel, linux-clk, lkml
Quoting Manivannan Sadhasivam (2018-03-17 03:09:48)
+
+static int clk_val_best(struct clk_hw *hw, unsigned long rate,
+ unsigned long *best_parent_rate)
+{[...]
+ }
+
+ parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw),
+ try_parent_rate);
+ cur_rate = DIV_ROUND_UP(parent_rate, clkt->div) * clkt->mul;
+ if (cur_rate <= rate && cur_rate > best) {
+ bestval = clkt->val;
+ best = cur_rate;
+ *best_parent_rate = parent_rate;
+ }
+ }
+
+ if (!bestval) {
+ bestval = _get_table_maxval(clkt);
+ *best_parent_rate = clk_hw_round_rate(
+ clk_hw_get_parent(hw), 1);
+ }
+
+ return bestval;Also, if this is largely copy/paste from the factor clk code then perhaps those functions can be exported to here and reused instead of copy/paste.
+}