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

Commit e4766cf9 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: Allow mux source switching without using safe parent"

parents f82ecebd 1922db84
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -116,6 +116,9 @@ static int mux_set_rate(struct clk *c, unsigned long rate)
	for (i = 0; i < mux->num_parents && !new_parent; i++) {
	for (i = 0; i < mux->num_parents && !new_parent; i++) {
		if (clk_round_rate(mux->parents[i].src, rate) == rate) {
		if (clk_round_rate(mux->parents[i].src, rate) == rate) {
			new_parent = mux->parents[i].src;
			new_parent = mux->parents[i].src;
			if (!mux->try_new_parent)
				break;
			if (mux->try_new_parent && new_parent != c->parent)
				break;
				break;
		}
		}
	}
	}
@@ -126,9 +129,12 @@ static int mux_set_rate(struct clk *c, unsigned long rate)
	/*
	/*
	 * Switch to safe parent since the old and new parent might be the
	 * Switch to safe parent since the old and new parent might be the
	 * same and the parent might temporarily turn off while switching
	 * same and the parent might temporarily turn off while switching
	 * rates.
	 * rates. If the mux can switch between distinct sources safely
	 * (indicated by try_new_parent), and the new source is not the current
	 * parent, do not switch to the safe parent.
	 */
	 */
	if (mux->safe_sel >= 0) {
	if (mux->safe_sel >= 0 &&
		!(mux->try_new_parent && (new_parent != c->parent))) {
		/*
		/*
		 * The safe parent might be a clock with multiple sources;
		 * The safe parent might be a clock with multiple sources;
		 * to select the "safe" source, set a safe frequency.
		 * to select the "safe" source, set a safe frequency.
@@ -150,10 +156,11 @@ static int mux_set_rate(struct clk *c, unsigned long rate)
		spin_lock_irqsave(&c->lock, flags);
		spin_lock_irqsave(&c->lock, flags);
		rc = mux->ops->set_mux_sel(mux, mux->safe_sel);
		rc = mux->ops->set_mux_sel(mux, mux->safe_sel);
		spin_unlock_irqrestore(&c->lock, flags);
		spin_unlock_irqrestore(&c->lock, flags);
	}
		if (rc)
		if (rc)
			return rc;
			return rc;


	}

	new_par_curr_rate = clk_get_rate(new_parent);
	new_par_curr_rate = clk_get_rate(new_parent);
	rc = clk_set_rate(new_parent, rate);
	rc = clk_set_rate(new_parent, rate);
	if (rc)
	if (rc)
+7 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,13 @@ struct mux_clk {
	 */
	 */
	bool		try_get_rate;
	bool		try_get_rate;
	struct clk_mux_ops *ops;
	struct clk_mux_ops *ops;
	/*
	 * Set if you need the mux to try a new parent before falling back to
	 * the current parent. If the safe_parent field above is set, then the
	 * safe_sel intermediate source will only be used if we fall back to
	 * to the current parent during mux_set_rate.
	 */
	bool		try_new_parent;


	/* Fields not used by helper function. */
	/* Fields not used by helper function. */
	void *const __iomem *base;
	void *const __iomem *base;