Commit a7b78bef authored by Stephen Boyd's avatar Stephen Boyd
Browse files

Merge branch 'clk-rate-range' into clk-next

 - Various clk rate range fixes
 - Drop clk rate range constraints on clk_put() (redux)

* clk-rate-range: (28 commits)
  clk: mediatek: clk-mux: Add .determine_rate() callback
  clk: tests: Add tests for notifiers
  clk: Update req_rate on __clk_recalc_rates()
  clk: tests: Add missing test case for ranges
  clk: qcom: clk-rcg2: Take clock boundaries into consideration for gfx3d
  clk: Introduce the clk_hw_get_rate_range function
  clk: Zero the clk_rate_request structure
  clk: Stop forwarding clk_rate_requests to the parent
  clk: Constify clk_has_parent()
  clk: Introduce clk_core_has_parent()
  clk: Switch from __clk_determine_rate to clk_core_round_rate_nolock
  clk: Add our request boundaries in clk_core_init_rate_req
  clk: Introduce clk_hw_init_rate_request()
  clk: Move clk_core_init_rate_req() from clk_core_round_rate_nolock() to its caller
  clk: Change clk_core_init_rate_req prototype
  clk: Set req_rate on reparenting
  clk: Take into account uncached clocks in clk_set_rate_range()
  clk: tests: Add some tests for orphan with multiple parents
  clk: tests: Add tests for mux with multiple parents
  clk: tests: Add tests for single parent mux
  ...
parents c461c677 b05ea331
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
{
	struct clk_generated *gck = to_clk_generated(hw);
	struct clk_hw *parent = NULL;
	struct clk_rate_request req_parent = *req;
	long best_rate = -EINVAL;
	unsigned long min_rate, parent_rate;
	int best_diff = -1;
@@ -192,7 +191,9 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
		goto end;

	for (div = 1; div < GENERATED_MAX_DIV + 2; div++) {
		req_parent.rate = req->rate * div;
		struct clk_rate_request req_parent;

		clk_hw_forward_rate_request(hw, req, parent, &req_parent, req->rate * div);
		if (__clk_determine_rate(parent, &req_parent))
			continue;
		clk_generated_best_diff(req, parent, req_parent.rate, div,
+6 −3
Original line number Diff line number Diff line
@@ -581,7 +581,6 @@ static int clk_sama7g5_master_determine_rate(struct clk_hw *hw,
					     struct clk_rate_request *req)
{
	struct clk_master *master = to_clk_master(hw);
	struct clk_rate_request req_parent = *req;
	struct clk_hw *parent;
	long best_rate = LONG_MIN, best_diff = LONG_MIN;
	unsigned long parent_rate;
@@ -618,11 +617,15 @@ static int clk_sama7g5_master_determine_rate(struct clk_hw *hw,
		goto end;

	for (div = 0; div < MASTER_PRES_MAX + 1; div++) {
		struct clk_rate_request req_parent;
		unsigned long req_rate;

		if (div == MASTER_PRES_MAX)
			req_parent.rate = req->rate * 3;
			req_rate = req->rate * 3;
		else
			req_parent.rate = req->rate << div;
			req_rate = req->rate << div;

		clk_hw_forward_rate_request(hw, req, parent, &req_parent, req_rate);
		if (__clk_determine_rate(parent, &req_parent))
			continue;

+2 −2
Original line number Diff line number Diff line
@@ -269,7 +269,6 @@ static int clk_sam9x5_peripheral_determine_rate(struct clk_hw *hw,
{
	struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
	struct clk_hw *parent = clk_hw_get_parent(hw);
	struct clk_rate_request req_parent = *req;
	unsigned long parent_rate = clk_hw_get_rate(parent);
	unsigned long tmp_rate;
	long best_rate = LONG_MIN;
@@ -302,8 +301,9 @@ static int clk_sam9x5_peripheral_determine_rate(struct clk_hw *hw,
		goto end;

	for (shift = 0; shift <= PERIPHERAL_MAX_SHIFT; shift++) {
		req_parent.rate = req->rate << shift;
		struct clk_rate_request req_parent;

		clk_hw_forward_rate_request(hw, req, parent, &req_parent, req->rate << shift);
		if (__clk_determine_rate(parent, &req_parent))
			continue;

+4 −2
Original line number Diff line number Diff line
@@ -85,10 +85,11 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
		req->best_parent_hw = NULL;

		if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
			struct clk_rate_request tmp_req = *req;
			struct clk_rate_request tmp_req;

			parent = clk_hw_get_parent(mux_hw);

			clk_hw_forward_rate_request(hw, req, parent, &tmp_req, req->rate);
			ret = clk_composite_determine_rate_for_parent(rate_hw,
								      &tmp_req,
								      parent,
@@ -104,12 +105,13 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
		}

		for (i = 0; i < clk_hw_get_num_parents(mux_hw); i++) {
			struct clk_rate_request tmp_req = *req;
			struct clk_rate_request tmp_req;

			parent = clk_hw_get_parent_by_index(mux_hw, i);
			if (!parent)
				continue;

			clk_hw_forward_rate_request(hw, req, parent, &tmp_req, req->rate);
			ret = clk_composite_determine_rate_for_parent(rate_hw,
								      &tmp_req,
								      parent,
+10 −10
Original line number Diff line number Diff line
@@ -386,13 +386,13 @@ long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
			       const struct clk_div_table *table,
			       u8 width, unsigned long flags)
{
	struct clk_rate_request req = {
		.rate = rate,
		.best_parent_rate = *prate,
		.best_parent_hw = parent,
	};
	struct clk_rate_request req;
	int ret;

	clk_hw_init_rate_request(hw, &req, rate);
	req.best_parent_rate = *prate;
	req.best_parent_hw = parent;

	ret = divider_determine_rate(hw, &req, table, width, flags);
	if (ret)
		return ret;
@@ -408,13 +408,13 @@ long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
				  const struct clk_div_table *table, u8 width,
				  unsigned long flags, unsigned int val)
{
	struct clk_rate_request req = {
		.rate = rate,
		.best_parent_rate = *prate,
		.best_parent_hw = parent,
	};
	struct clk_rate_request req;
	int ret;

	clk_hw_init_rate_request(hw, &req, rate);
	req.best_parent_rate = *prate;
	req.best_parent_hw = parent;

	ret = divider_ro_determine_rate(hw, &req, table, width, flags, val);
	if (ret)
		return ret;
Loading