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

Commit 0d88451b authored by Taniya Das's avatar Taniya Das
Browse files

clk: Add support to print parent clock names during suspend



The low power code invokes the function to print the enabled clocks,
add support to print enabled clock names along with their parent names.

Change-Id: If1a4fa862f08073253d4c4359f6dd6ba56b5f399
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent b99dda15
Loading
Loading
Loading
Loading
+6 −44
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
@@ -3503,45 +3503,6 @@ do { \
		pr_info(fmt, ##__VA_ARGS__);		\
} while (0)

/*
 * clock_debug_print_enabled_debug_suspend() - Print names of enabled clocks
 * during suspend.
 */
static void clock_debug_print_enabled_debug_suspend(struct seq_file *s)
{
	struct clk_core *core;
	int cnt = 0;

	if (!mutex_trylock(&clk_debug_lock))
		return;

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

	hlist_for_each_entry(core, &clk_debug_list, debug_node) {
		if (!core->prepare_count)
			continue;

		if (core->vdd_class)
			clock_debug_output(s, 0, " %s:%u:%u [%ld, %d]",
					core->name, core->prepare_count,
					core->enable_count, core->rate,
					clk_find_vdd_level(core, core->rate));

		else
			clock_debug_output(s, 0, " %s:%u:%u [%ld]",
					core->name, core->prepare_count,
					core->enable_count, core->rate);
		cnt++;
	}

	mutex_unlock(&clk_debug_lock);

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

static int clock_debug_print_clock(struct clk_core *c, struct seq_file *s)
{
	char *start = "";
@@ -3552,7 +3513,7 @@ static int clock_debug_print_clock(struct clk_core *c, struct seq_file *s)

	clk = c->hw->clk;

	clock_debug_output(s, 0, "\t");
	clock_debug_output(s, 0, "    ");

	do {
		if (clk->core->vdd_class)
@@ -3584,9 +3545,10 @@ static void clock_debug_print_enabled_clocks(struct seq_file *s)
	struct clk_core *core;
	int cnt = 0;

	clock_debug_output(s, 0, "Enabled clocks:\n");
	if (!mutex_trylock(&clk_debug_lock))
		return;

	mutex_lock(&clk_debug_lock);
	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);
@@ -3911,7 +3873,7 @@ void clock_debug_print_enabled(void)
	if (likely(!debug_suspend))
		return;

	clock_debug_print_enabled_debug_suspend(NULL);
	clock_debug_print_enabled_clocks(NULL);
}
EXPORT_SYMBOL_GPL(clock_debug_print_enabled);