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

Commit 87ec7030 authored by Vivek Aknurwar's avatar Vivek Aknurwar
Browse files

clk: Print enabled clock tree when cpu/cluster enters LPM level



When idle, cpu/cluster can enter various LPM levels
and can be blocked by certain clk/clks as clks
are voted on. Printed clk tree in path of cpu/cluster entering
one of LPM level, helps to know/debug on what is blocking
cpu/cluster entering LPM.

Change-Id: I194c09fb65783c76628aae5702be5a53fa7001b5
Signed-off-by: default avatarVivek Aknurwar <viveka@codeaurora.org>
parent c28e8b3a
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -3268,10 +3268,12 @@ static void clk_debug_unregister(struct clk_core *core)
}

#ifdef CONFIG_COMMON_CLK_QCOM_DEBUG
#define clock_debug_output(m, fmt, ...)		\
#define clock_debug_output(m, c, fmt, ...)		\
do {							\
	if (m)						\
		seq_printf(m, fmt, ##__VA_ARGS__);	\
	else if (c)					\
		pr_cont(fmt, ##__VA_ARGS__);		\
	else						\
		pr_info(fmt, ##__VA_ARGS__);		\
} while (0)
@@ -3284,28 +3286,29 @@ static int clock_debug_print_clock(struct clk_core *c, struct seq_file *s)
	if (!c || !c->prepare_count)
		return 0;

	clock_debug_output(s, 0, "    ");

	clk = c->hw->clk;

	do {
		c = clk->core;
		if (c->ops->list_rate_vdd_level)
			clock_debug_output(s, "%s%s:%u:%u [%ld, %d]", start,
			clock_debug_output(s, 1, "%s%s:%u:%u [%ld, %d]", start,
				c->name,
				c->prepare_count,
				c->enable_count,
				c->rate,
				c->ops->list_rate_vdd_level(c->hw, c->rate));
		else
			clock_debug_output(s, "%s%s:%u:%u [%ld]", start,
			clock_debug_output(s, 1, "%s%s:%u:%u [%ld]", start,
				c->name,
				c->prepare_count,
				c->enable_count,
				c->rate);
		start = " -> ";
	} while (s && (clk = clk_get_parent(clk)));
	} while ((clk = clk_get_parent(clk)));

	if (s)
		clock_debug_output(s, "\n");
	clock_debug_output(s, 1, "\n");

	return 1;
}
@@ -3318,21 +3321,23 @@ static void clock_debug_print_enabled_clocks(struct seq_file *s)
	struct clk_core *core;
	int cnt = 0;

	clock_debug_output(s, "Enabled clocks:\n");
	clock_debug_output(s, 0, "Enabled clocks:\n");

	hlist_for_each_entry(core, &clk_debug_list, debug_node)
		cnt += clock_debug_print_clock(core, s);

	if (cnt)
		clock_debug_output(s, "Enabled clock count: %d\n", cnt);
		clock_debug_output(s, 0, "Enabled clock count: %d\n", cnt);
	else
		clock_debug_output(s, "No clocks enabled.\n");
		clock_debug_output(s, 0, "No clocks enabled.\n");
}

static int enabled_clocks_show(struct seq_file *s, void *unused)
{
	mutex_lock(&clk_debug_lock);

	clock_debug_print_enabled_clocks(s);

	mutex_unlock(&clk_debug_lock);

	return 0;
@@ -3365,6 +3370,7 @@ void clock_debug_print_enabled(void)
		return;

	clock_debug_print_enabled_clocks(NULL);

	mutex_unlock(&clk_debug_lock);
}
EXPORT_SYMBOL(clock_debug_print_enabled);