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

Commit 893c1f5b authored by Jagadeesh Kona's avatar Jagadeesh Kona Committed by Gerrit - the friendly Code Review server
Browse files

clk: qcom: clk-debug: Add support for debug clock API's



Add support for qcom_clk_dump and qcom_clk_bulk_dump API's
which can be used by the clients to dump the registers
associated with the clock and it's parents.

Change-Id: Iea7f30bb4e789e41dbae41b88514ffd53c136174
Signed-off-by: default avatarJagadeesh Kona <jkona@codeaurora.org>
parent 6949a466
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/bitops.h>
#include <linux/clk/qcom.h>
#include <linux/mfd/syscon.h>

#include "clk-regmap.h"
@@ -562,3 +563,48 @@ void clk_common_debug_init(struct clk_hw *hw, struct dentry *dentry)

};

/**
 * qcom_clk_dump - dump the HW specific registers associated with this clock
 * @clk: clock source
 * @calltrace: indicates whether calltrace is required
 *
 * This function attempts to print all the registers associated with the
 * clock and it's parents.
 */
void qcom_clk_dump(struct clk *clk, bool calltrace)
{
	struct clk_hw *hw;

	if (IS_ERR_OR_NULL(clk))
		return;

	hw = __clk_get_hw(clk);
	if (IS_ERR_OR_NULL(hw))
		return;

	pr_info("Dumping %s Registers:\n", clk_hw_get_name(hw));
	WARN_CLK(hw, calltrace, "");
}
EXPORT_SYMBOL(qcom_clk_dump);

/**
 * qcom_clk_bulk_dump - dump the HW specific registers associated with clocks
 * @clks: the clk_bulk_data table of consumer
 * @num_clks: the number of clk_bulk_data
 * @calltrace: indicates whether calltrace is required
 *
 * This function attempts to print all the registers associated with the
 * clock and it's parents for all the clocks in the list.
 */
void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks,
			bool calltrace)
{
	int i;

	if (IS_ERR_OR_NULL(clks))
		return;

	for (i = 0; i < num_clks; i++)
		qcom_clk_dump(clks[i].clk, calltrace);
}
EXPORT_SYMBOL(qcom_clk_bulk_dump);
+4 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
#ifndef __LINUX_CLK_QCOM_H_
#define __LINUX_CLK_QCOM_H_

#include <linux/clk-provider.h>
#include <linux/clk.h>

enum branch_mem_flags {
	CLKFLAG_RETAIN_PERIPH,
@@ -19,5 +19,8 @@ enum branch_mem_flags {

int qcom_clk_get_voltage(struct clk *clk, unsigned long rate);
int qcom_clk_set_flags(struct clk *clk, unsigned long flags);
void qcom_clk_dump(struct clk *clk, bool calltrace);
void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks,
			bool calltrace);

#endif  /* __LINUX_CLK_QCOM_H_ */