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

Commit 7c2b115d authored by Mike Tipton's avatar Mike Tipton
Browse files

clk: qcom: clk-debug: Resume devices before accessing HW



Resume and suspend devices in debugfs handlers around accessing HW
registers to prevent bus errors.

Change-Id: I9db208f0d82a504af60cf252e5d3691b9903f8cd
Signed-off-by: default avatarMike Tipton <mdtipton@codeaurora.org>
parent fdffc473
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -266,12 +266,22 @@ static u32 get_mux_divs(struct clk_hw *mux)

static int clk_debug_measure_get(void *data, u64 *val)
{
	struct clk_regmap *rclk = NULL;
	struct clk_debug_mux *mux;
	struct clk_hw *hw = data;
	struct clk_hw *parent;
	int ret = 0;
	u32 regval;

	if (clk_is_regmap_clk(hw))
		rclk = to_clk_regmap(hw);

	if (rclk) {
		ret = clk_runtime_get_regmap(rclk);
		if (ret)
			return ret;
	}

	mutex_lock(&clk_debug_lock);

	ret = clk_find_and_set_parent(measure, hw);
@@ -306,6 +316,8 @@ static int clk_debug_measure_get(void *data, u64 *val)
	}
exit:
	mutex_unlock(&clk_debug_lock);
	if (rclk)
		clk_runtime_put_regmap(rclk);
	return ret;
}

@@ -501,8 +513,14 @@ static void clk_debug_print_hw(struct clk_hw *hw, struct seq_file *f)

	if (clk_is_regmap_clk(hw)) {
		rclk = to_clk_regmap(hw);

		if (clk_runtime_get_regmap(rclk))
			return;

		if (rclk->ops && rclk->ops->list_registers)
			rclk->ops->list_registers(f, hw);

		clk_runtime_put_regmap(rclk);
	}
}