diff --git a/drivers/clk/qcom/clk-debug.c b/drivers/clk/qcom/clk-debug.c index 7f6fe22aad35..35528d1d2b98 100644 --- a/drivers/clk/qcom/clk-debug.c +++ b/drivers/clk/qcom/clk-debug.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #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); diff --git a/include/linux/clk/qcom.h b/include/linux/clk/qcom.h index 1ae1f16cca7a..8fe1d4afc775 100644 --- a/include/linux/clk/qcom.h +++ b/include/linux/clk/qcom.h @@ -6,7 +6,7 @@ #ifndef __LINUX_CLK_QCOM_H_ #define __LINUX_CLK_QCOM_H_ -#include +#include 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_ */