linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chander Kashyap <chander.kashyap@linaro.org>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org
Cc: Chander Kashyap <k.chander@samsung.com>,
	lorenzo.pieralisi@arm.com, daniel.lezcano@linaro.org,
	rjw@rjwysocki.net, tomasz.figa@gmail.com,
	Chander Kashyap <chander.kashyap@linaro.org>,
	kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 6/6] mcpm: exynos: populate suspend and powered_up callbacks
Date: Fri, 16 May 2014 13:33:58 +0530	[thread overview]
Message-ID: <1400227438-27155-7-git-send-email-chander.kashyap@linaro.org> (raw)
In-Reply-To: <1400227438-27155-1-git-send-email-chander.kashyap@linaro.org>

In order to support cpuidle through mcpm, suspend and powered-up
callbacks are required in mcpm platform code.
Hence populate the same callbacks.

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
---
Changes in v6: None
Changes in v5:
	1. Add comment to address cache access while c-bit is cleared in SCLTR
	2. Make exynos_powered_up static
Changes in v4: None
Changes in v3:
	1. Removed coherency enablement after suspend failure.
	2. Use generic function to poweron cpu.
changes in v2:
	1. Fixed typo: enynos_pmu_cpunr to exynos_pmu_cpunr
 arch/arm/mach-exynos/mcpm-exynos.c |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index c6bb3a4..623dfa7 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -253,10 +253,46 @@ static int exynos_power_down_finish(unsigned int cpu, unsigned int cluster)
 	return -ETIMEDOUT; /* timeout */
 }
 
+static void exynos_powered_up(void)
+{
+	unsigned int mpidr, cpu, cluster;
+
+	mpidr = read_cpuid_mpidr();
+	cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+	cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
+
+	arch_spin_lock(&exynos_mcpm_lock);
+	if (cpu_use_count[cpu][cluster] == 0)
+		cpu_use_count[cpu][cluster] = 1;
+	arch_spin_unlock(&exynos_mcpm_lock);
+}
+
+static void exynos_suspend(u64 residency)
+{
+	unsigned int mpidr, cpunr;
+
+	exynos_power_down();
+
+	/*
+	 * Execution reaches here only if cpu did not power down.
+	 * Hence roll back the changes done in exynos_power_down function.
+	 *
+	 * CAUTION: "This function requires the stack data to be visible through
+	 * power down and can only be executed on processors like A15 and A7
+	 * that hit the cache with the C bit clear in the SCTLR register."
+	*/
+	mpidr = read_cpuid_mpidr();
+	cpunr = exynos_pmu_cpunr(mpidr);
+
+	exynos_cpu_power_up(cpunr);
+}
+
 static const struct mcpm_platform_ops exynos_power_ops = {
 	.power_up		= exynos_power_up,
 	.power_down		= exynos_power_down,
 	.power_down_finish	= exynos_power_down_finish,
+	.suspend		= exynos_suspend,
+	.powered_up		= exynos_powered_up,
 };
 
 static void __init exynos_mcpm_usage_count_init(void)
-- 
1.7.9.5

  parent reply	other threads:[~2014-05-16  8:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ANuQgHGSPJ45tbrVppAVpOqF0OfHacPWfX=S5mOVxTPr66f7vg@mail.gmail.com>
2014-05-14  8:03 ` [PATCH v5 0/6] add cpuidle support for Exynos5420 Chander Kashyap
2014-05-14  8:03   ` [PATCH v5 1/6] driver: cpuidle-big-little: add of_device_id structure Chander Kashyap
2014-05-14  8:03   ` [PATCH v5 2/6] arm: exynos: add generic function to calculate cpu number Chander Kashyap
2014-05-14  8:03   ` [PATCH v5 3/6] cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little driver Chander Kashyap
2014-05-14  8:03   ` [PATCH v5 4/6] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420 Chander Kashyap
2014-05-14 13:04     ` Arnd Bergmann
2014-05-14 14:06       ` Lorenzo Pieralisi
2014-05-14  8:03   ` [PATCH v5 5/6] exynos: cpuidle: do not allow cpuidle registration " Chander Kashyap
2014-05-15 21:26     ` Tomasz Figa
2014-05-16  4:01       ` Chander Kashyap
2014-05-16  8:03         ` [PATCH v6 0/6] add cpuidle support " Chander Kashyap
2014-05-16  8:03           ` [PATCH v6 1/6] driver: cpuidle-big-little: add of_device_id structure Chander Kashyap
2014-05-28  8:58             ` Daniel Lezcano
2014-05-16  8:03           ` [PATCH v6 2/6] arm: exynos: add generic function to calculate cpu number Chander Kashyap
2014-05-16  8:03           ` [PATCH v6 3/6] cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little driver Chander Kashyap
2014-05-28  9:00             ` Daniel Lezcano
2014-05-16  8:03           ` [PATCH v6 4/6] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420 Chander Kashyap
2014-05-16  8:03           ` [PATCH v6 5/6] exynos: cpuidle: do not allow cpuidle registration " Chander Kashyap
2014-05-16  8:03           ` Chander Kashyap [this message]
2014-05-19  5:40           ` [PATCH v6 0/6] add cpuidle support " Chander Kashyap
2014-05-26  4:40             ` Chander Kashyap
2014-05-26 10:29           ` Tomasz Figa
2014-05-28  4:28             ` Chander Kashyap
2014-05-28  4:35               ` Kukjin Kim
2014-05-28  9:02                 ` Daniel Lezcano
2014-05-29  4:37                   ` Chander Kashyap
2014-06-10 12:38                     ` Chander M. Kashyap
2014-05-14  8:03   ` [PATCH v5 6/6] mcpm: exynos: populate suspend and powered_up callbacks Chander Kashyap
2014-05-14  9:56   ` [PATCH v5 0/6] add cpuidle support for Exynos5420 Daniel Lezcano
2014-05-14 10:43     ` Chander Kashyap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400227438-27155-7-git-send-email-chander.kashyap@linaro.org \
    --to=chander.kashyap@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=k.chander@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=tomasz.figa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).