Lines Matching defs:rate

54 	unsigned long		rate;
387 ret = core->rate;
444 static bool mux_is_better_rate(unsigned long rate, unsigned long now,
448 return abs(now - rate) < abs(best - rate);
450 return now <= rate && now > best;
471 best = parent_req.rate;
481 /* find the parent that can provide the fastest rate <= rate */
494 parent_req.rate = clk_core_get_rate_nolock(parent);
497 if (mux_is_better_rate(req->rate, parent_req.rate,
500 best = parent_req.rate;
511 req->rate = best;
789 long rate;
799 req->best_parent_rate = parent->rate;
808 rate = core->ops->round_rate(core->hw, req->rate,
810 if (rate < 0)
811 return rate;
813 req->rate = rate;
817 req->rate = core->rate;
824 * __clk_determine_rate - get the closest rate actually supported by a clock
825 * @hw: determine the rate of this clock
826 * @rate: target rate
827 * @min_rate: returned rate must be greater than this rate
828 * @max_rate: returned rate must be less than this rate
835 req->rate = 0;
843 unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
849 req.rate = rate;
855 return req.rate;
860 * clk_round_rate - round the given rate for a clk
861 * @clk: the clk for which we are rounding a rate
862 * @rate: the rate which is to be rounded
864 * Takes in a rate as input and rounds it to a rate that the clk can actually
866 * then the parent rate is returned.
868 long clk_round_rate(struct clk *clk, unsigned long rate)
879 req.rate = rate;
887 return req.rate;
893 * @core: clk that is changing rate
895 * @old_rate: old clk rate
896 * @new_rate: new clk rate
898 * Triggers a notifier call chain on the clk rate-change notification
1002 * it is assumed that the clock will take on the rate of its parent.
1015 old_rate = core->rate;
1018 parent_rate = core->parent->rate;
1020 core->rate = clk_recalc(core, parent_rate);
1027 __clk_notify(core, msg, old_rate, core->rate);
1035 unsigned long rate;
1042 rate = clk_core_get_rate_nolock(core);
1045 return rate;
1049 * clk_get_rate - return the rate of clk
1050 * @clk: the clk whose rate is being returned
1052 * Simply returns the cached rate of the clk, unless CLK_GET_RATE_NOCACHE flag
1229 * @parent_rate: the "future" rate of clk's parent
1235 * pre-rate change notifications and returns early if no clks in the
1238 * take on the rate of its parent.
1251 /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */
1253 ret = __clk_notify(core, PRE_RATE_CHANGE, core->rate, new_rate);
1295 unsigned long rate)
1310 /* save parent rate, if it exists */
1313 best_parent_rate = parent->rate;
1317 /* find the closest rate and parent clk/rate */
1321 req.rate = rate;
1326 req.best_parent_rate = parent->rate;
1337 new_rate = req.rate;
1340 ret = core->ops->round_rate(core->hw, rate,
1350 core->new_rate = core->rate;
1354 top = clk_calc_new_rates(parent, rate);
1378 best_parent_rate != parent->rate)
1388 * Notify about rate changes in a subtree. Always walk down the whole tree
1398 if (core->rate == core->new_rate)
1402 ret = __clk_notify(core, event, core->rate, core->new_rate);
1427 * walk down a subtree and set the new rates notifying the rate
1439 old_rate = core->rate;
1442 best_parent_rate = core->new_parent->rate;
1444 best_parent_rate = core->parent->rate;
1470 core->rate = clk_recalc(core, best_parent_rate);
1472 if (core->notifier_count && old_rate != core->rate)
1473 __clk_notify(core, POST_RATE_CHANGE, old_rate, core->rate);
1498 unsigned long rate = req_rate;
1505 if (rate == clk_core_get_rate_nolock(core))
1512 top = clk_calc_new_rates(core, rate);
1519 pr_debug("%s: failed to set %s rate\n", __func__,
1534 * clk_set_rate - specify a new rate for clk
1535 * @clk: the clk whose rate is being changed
1536 * @rate: the new rate for clk
1538 * In the simplest case clk_set_rate will only adjust the rate of clk.
1540 * Setting the CLK_SET_RATE_PARENT flag allows the rate change operation to
1544 * *parent_rate comes back with a new rate for clk's parent then we propagate
1545 * up to clk's parent and set its rate. Upward propagation will continue
1554 int clk_set_rate(struct clk *clk, unsigned long rate)
1564 ret = clk_core_set_rate_nolock(clk->core, rate);
1573 * clk_set_rate_range - set a rate range for a clock source
1575 * @min: desired minimum clock rate in Hz, inclusive
1576 * @max: desired maximum clock rate in Hz, inclusive
1609 * clk_set_min_rate - set a minimum clock rate for a clock source
1611 * @rate: desired minimum clock rate in Hz, inclusive
1615 int clk_set_min_rate(struct clk *clk, unsigned long rate)
1620 return clk_set_rate_range(clk, rate, clk->max_rate);
1625 * clk_set_max_rate - set a maximum clock rate for a clock source
1627 * @rate: desired maximum clock rate in Hz, inclusive
1631 int clk_set_max_rate(struct clk *clk, unsigned long rate)
1636 return clk_set_rate_range(clk, clk->min_rate, rate);
1794 p_rate = parent->rate;
1813 /* propagate rate an accuracy recalculation accordingly */
1839 * clk topology, sysfs topology and propagate rate recalculation via
2009 seq_puts(s, " clock enable_cnt prepare_cnt rate accuracy phase\n");
2045 seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c));
2122 (u32 *)&core->rate);
2293 * parent and rate and sets them both.
2301 unsigned long rate;
2424 * Set clk's rate. The preferred method is to use .recalc_rate. For
2426 * parent's rate. If a clock doesn't have a parent (or is orphaned)
2427 * then rate is set to zero.
2430 rate = core->ops->recalc_rate(core->hw,
2433 rate = core->parent->rate;
2435 rate = 0;
2436 core->rate = core->req_rate = rate;
2630 static int clk_nodrv_set_rate(struct clk_hw *hw, unsigned long rate,
2796 /*** clk rate change notifiers ***/
2799 * clk_notifier_register - add a clk rate change notifier
2803 * Request notification when clk's rate changes. This uses an SRCU
2809 * In all notification cases cases (pre, post and abort rate change) the
2810 * original clock rate is passed to the callback via struct
2858 * clk_notifier_unregister - remove a clk rate change notifier