linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jszhang@marvell.com (Jisheng Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] arm: psci: add cpuidle_ops support
Date: Wed, 8 Jul 2015 18:13:37 +0800	[thread overview]
Message-ID: <1436350417-6712-5-git-send-email-jszhang@marvell.com> (raw)
In-Reply-To: <1436350417-6712-1-git-send-email-jszhang@marvell.com>

This patch implements cpuidle_ops using psci. After this patch, we can use
cpuidle-arm.c with psci backend for both arm and arm64.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 arch/arm/kernel/psci.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
index 7f6ff02..c5b94f5 100644
--- a/arch/arm/kernel/psci.c
+++ b/arch/arm/kernel/psci.c
@@ -13,6 +13,7 @@
  * Author: Will Deacon <will.deacon@arm.com>
  */
 
+#include <linux/cpuidle.h>
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/of.h>
@@ -21,6 +22,7 @@
 
 #include <uapi/linux/psci.h>
 
+#include <asm/cpuidle.h>
 #include <asm/psci.h>
 #include <asm/smp_plat.h>
 
@@ -47,6 +49,24 @@
  *
  */
 
+#ifdef CONFIG_CPU_IDLE
+static int psci_cpuidle_suspend(int cpu, unsigned long arg)
+{
+	return cpu_psci_cpu_suspend(arg);
+}
+
+static int psci_cpuidle_init(struct device_node *node, int cpu)
+{
+	return cpu_psci_cpu_init_idle(cpu);
+}
+
+static struct cpuidle_ops psci_cpuidle_ops __initdata = {
+	.suspend = psci_cpuidle_suspend,
+	.init = psci_cpuidle_init,
+};
+CPUIDLE_METHOD_OF_DECLARE(psci_idle, "psci", &psci_cpuidle_ops);
+#endif
+
 #ifdef CONFIG_SMP
 extern void secondary_startup(void);
 
-- 
2.1.4

  parent reply	other threads:[~2015-07-08 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 10:13 [PATCH 0/4] arm: psci: implement cpuidle_ops Jisheng Zhang
2015-07-08 10:13 ` [PATCH 1/4] arm: psci: rename psci_smp.c to psci.c Jisheng Zhang
2015-07-08 10:13 ` [PATCH 2/4] arm: psci: enable PSCI on UP systems Jisheng Zhang
2015-07-08 10:13 ` [PATCH 3/4] firmware: psci: move cpu_suspend handling to generic code Jisheng Zhang
2015-07-08 10:13 ` Jisheng Zhang [this message]
2015-07-08 10:34   ` [PATCH 4/4] arm: psci: add cpuidle_ops support Russell King - ARM Linux
2015-07-08 11:38     ` Jisheng Zhang
2015-07-08 12:42       ` Jisheng Zhang

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=1436350417-6712-5-git-send-email-jszhang@marvell.com \
    --to=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).