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

Commit 8d8a84d4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qcom: clock-generic: Check if a parent is already at a requested rate"

parents f5c08a7a 2ee4021c
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -98,12 +98,27 @@ static int mux_set_rate(struct clk *c, unsigned long rate)
	unsigned long new_par_curr_rate;
	unsigned long flags;

	for (i = 0; i < mux->num_parents; i++) {
	/*
	 * Check if one of the possible parents is already at the requested
	 * rate.
	 */
	for (i = 0; i < mux->num_parents && mux->try_get_rate; i++) {
		if (mux->parents[i].src->rate == rate) {
			new_parent = mux->parents[i].src;
			break;
		}
	}

	if (new_parent == c->parent && rate == c->rate)
		return 0;

	for (i = 0; i < mux->num_parents && !new_parent; i++) {
		if (clk_round_rate(mux->parents[i].src, rate) == rate) {
			new_parent = mux->parents[i].src;
			break;
		}
	}

	if (new_parent == NULL)
		return -EINVAL;

+6 −0
Original line number Diff line number Diff line
@@ -59,6 +59,12 @@ struct mux_clk {
	struct clk	*safe_parent;
	int		safe_sel;
	unsigned long	safe_freq;
	/*
	 * Before attempting a clk_round_rate on available sources, attempt a
	 * clk_get_rate on all those sources. If one of them is already at the
	 * necessary rate, that source will be used.
	 */
	bool		try_get_rate;
	struct clk_mux_ops *ops;

	/* Fields not used by helper function. */