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

Commit a1c4085f authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

msm: clock-krait-8974: Change ref count behavior at boot



Set up the refcount of the L2 clock to be equal to the number of online
cores. This allows the clients of the CPU/L2 clocks that enable/disable
them to be agnostic of the no. of cores that are online.

For example, the CPU idle code can call clk_disable() on the L2 clock
from all the cores' idle path without having to figure out if it's the
last active core. If the core is the last core that's active, the ref
count will go from 1 to 0 and the clock would get disabled.

Also update cpufreq driver behavior to accomodate this change.

Change-Id: If253a85ad62f0a6a78452dafc7afe86bd112cf73
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent 96c5c4bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -829,8 +829,8 @@ static int clock_krait_8974_driver_probe(struct platform_device *pdev)
	 * that the clocks have already been prepared and enabled by the time
	 * they take over.
	 */
	clk_prepare_enable(&l2_clk.c);
	for_each_online_cpu(cpu) {
		clk_prepare_enable(&l2_clk.c);
		WARN(clk_prepare_enable(cpu_clk[cpu]),
			"Unable to turn on CPU%d clock", cpu);
	}
+8 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * MSM architecture cpufreq driver
 *
 * Copyright (C) 2007 Google, Inc.
 * Copyright (c) 2007-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2007-2014, The Linux Foundation. All rights reserved.
 * Author: Mike A. Chan <mikechan@google.com>
 *
 * This software is licensed under the terms of the GNU General Public
@@ -315,12 +315,18 @@ static int msm_cpufreq_cpu_callback(struct notifier_block *nfb,
	case CPU_DEAD:
	case CPU_UP_CANCELED:
		clk_disable_unprepare(cpu_clk[cpu]);
		clk_disable_unprepare(l2_clk);
		update_l2_bw(NULL);
		break;
	case CPU_UP_PREPARE:
		rc = clk_prepare_enable(cpu_clk[cpu]);
		rc = clk_prepare_enable(l2_clk);
		if (rc < 0)
			return NOTIFY_BAD;
		rc = clk_prepare_enable(cpu_clk[cpu]);
		if (rc < 0) {
			clk_disable_unprepare(l2_clk);
			return NOTIFY_BAD;
		}
		update_l2_bw(&cpu);
		break;
	default: