All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Chander Kashyap <k.chander@samsung.com>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Tomasz Figa <t.figa@samsung.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Charles Garcia Tobin <Charles.Garcia-Tobin@arm.com>,
	Nicolas Pitre <nico@linaro.org>, Rob Herring <robh+dt@kernel.org>,
	Grant Likely <grant.likely@linaro.org>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Antti Miettinen <ananaza@iki.fi>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Kevin Hilman <khilman@linaro.org>,
	Sebastian Capella <sebcape@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Paul
Subject: [PATCH v8 8/8] drivers: cpuidle: initialize Exynos driver through DT
Date: Mon,  1 Sep 2014 16:28:44 +0100	[thread overview]
Message-ID: <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> (raw)
In-Reply-To: <1409585324-3678-1-git-send-email-lorenzo.pieralisi@arm.com>

With the introduction of DT based idle states, CPUidle drivers for
ARM can now initialize idle states data through properties in the device
tree.

This patch adds code to the Exynos CPUidle driver to dynamically
initialize idle states data through the updated device tree source
files.

Cc: Chander Kashyap <k.chander@samsung.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
 arch/arm/boot/dts/exynos4210.dtsi | 11 +++++++++++
 arch/arm/boot/dts/exynos5250.dtsi | 11 +++++++++++
 drivers/cpuidle/Kconfig.arm       |  1 +
 drivers/cpuidle/cpuidle-exynos.c  | 18 +++++++++++++++++-
 4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index eab7c7b..69fd1a0 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -48,12 +48,23 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0x900>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
 		};
 
 		cpu@901 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0x901>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
+		};
+
+		idle-states {
+			CLUSTER_SLEEP_0: cluster-sleep-0 {
+				compatible = "arm,idle-state";
+				entry-latency-us = <1000>;
+				exit-latency-us = <300>;
+				min-residency-us = <100000>;
+			};
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 492e1ef..3a758ff 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -63,12 +63,23 @@
 			compatible = "arm,cortex-a15";
 			reg = <0>;
 			clock-frequency = <1700000000>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
 		};
 		cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a15";
 			reg = <1>;
 			clock-frequency = <1700000000>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
+		};
+
+		idle-states {
+			CLUSTER_SLEEP_0: cluster-sleep-0 {
+				compatible = "arm,idle-state";
+				entry-latency-us = <1000>;
+				exit-latency-us = <300>;
+				min-residency-us = <100000>;
+			};
 		};
 	};
 
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index e339c7f..04cc229 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -55,6 +55,7 @@ config ARM_AT91_CPUIDLE
 config ARM_EXYNOS_CPUIDLE
 	bool "Cpu Idle Driver for the Exynos processors"
 	depends on ARCH_EXYNOS
+	select DT_IDLE_STATES
 	help
 	  Select this to enable cpuidle for Exynos processors
 
diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c
index ba9b34b..e66a426 100644
--- a/drivers/cpuidle/cpuidle-exynos.c
+++ b/drivers/cpuidle/cpuidle-exynos.c
@@ -18,6 +18,8 @@
 #include <asm/suspend.h>
 #include <asm/cpuidle.h>
 
+#include "dt_idle_states.h"
+
 static void (*exynos_enter_aftr)(void);
 
 static int exynos_enter_lowpower(struct cpuidle_device *dev,
@@ -56,13 +58,27 @@ static struct cpuidle_driver exynos_idle_driver = {
 	.safe_state_index = 0,
 };
 
+static const struct of_device_id exynos_idle_state_match[] __initconst = {
+	{ .compatible = "arm,idle-state",
+	  .data = exynos_enter_lowpower },
+	{ },
+};
+
 static int exynos_cpuidle_probe(struct platform_device *pdev)
 {
 	int ret;
+	struct cpuidle_driver *drv = &exynos_idle_driver;
 
 	exynos_enter_aftr = (void *)(pdev->dev.platform_data);
 
-	ret = cpuidle_register(&exynos_idle_driver, NULL);
+	/* Start at index 1, index 0 standard WFI */
+	ret = dt_init_idle_driver(drv, exynos_idle_state_match, 1);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to initialize idle states\n");
+		return ret;
+	}
+
+	ret = cpuidle_register(drv, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register cpuidle driver\n");
 		return ret;
-- 
1.9.1



WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 8/8] drivers: cpuidle: initialize Exynos driver through DT
Date: Mon,  1 Sep 2014 16:28:44 +0100	[thread overview]
Message-ID: <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> (raw)
In-Reply-To: <1409585324-3678-1-git-send-email-lorenzo.pieralisi@arm.com>

With the introduction of DT based idle states, CPUidle drivers for
ARM can now initialize idle states data through properties in the device
tree.

This patch adds code to the Exynos CPUidle driver to dynamically
initialize idle states data through the updated device tree source
files.

Cc: Chander Kashyap <k.chander@samsung.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
 arch/arm/boot/dts/exynos4210.dtsi | 11 +++++++++++
 arch/arm/boot/dts/exynos5250.dtsi | 11 +++++++++++
 drivers/cpuidle/Kconfig.arm       |  1 +
 drivers/cpuidle/cpuidle-exynos.c  | 18 +++++++++++++++++-
 4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index eab7c7b..69fd1a0 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -48,12 +48,23 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0x900>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
 		};
 
 		cpu at 901 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0x901>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
+		};
+
+		idle-states {
+			CLUSTER_SLEEP_0: cluster-sleep-0 {
+				compatible = "arm,idle-state";
+				entry-latency-us = <1000>;
+				exit-latency-us = <300>;
+				min-residency-us = <100000>;
+			};
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 492e1ef..3a758ff 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -63,12 +63,23 @@
 			compatible = "arm,cortex-a15";
 			reg = <0>;
 			clock-frequency = <1700000000>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a15";
 			reg = <1>;
 			clock-frequency = <1700000000>;
+			cpu-idle-states = <&CLUSTER_SLEEP_0>;
+		};
+
+		idle-states {
+			CLUSTER_SLEEP_0: cluster-sleep-0 {
+				compatible = "arm,idle-state";
+				entry-latency-us = <1000>;
+				exit-latency-us = <300>;
+				min-residency-us = <100000>;
+			};
 		};
 	};
 
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index e339c7f..04cc229 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -55,6 +55,7 @@ config ARM_AT91_CPUIDLE
 config ARM_EXYNOS_CPUIDLE
 	bool "Cpu Idle Driver for the Exynos processors"
 	depends on ARCH_EXYNOS
+	select DT_IDLE_STATES
 	help
 	  Select this to enable cpuidle for Exynos processors
 
diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c
index ba9b34b..e66a426 100644
--- a/drivers/cpuidle/cpuidle-exynos.c
+++ b/drivers/cpuidle/cpuidle-exynos.c
@@ -18,6 +18,8 @@
 #include <asm/suspend.h>
 #include <asm/cpuidle.h>
 
+#include "dt_idle_states.h"
+
 static void (*exynos_enter_aftr)(void);
 
 static int exynos_enter_lowpower(struct cpuidle_device *dev,
@@ -56,13 +58,27 @@ static struct cpuidle_driver exynos_idle_driver = {
 	.safe_state_index = 0,
 };
 
+static const struct of_device_id exynos_idle_state_match[] __initconst = {
+	{ .compatible = "arm,idle-state",
+	  .data = exynos_enter_lowpower },
+	{ },
+};
+
 static int exynos_cpuidle_probe(struct platform_device *pdev)
 {
 	int ret;
+	struct cpuidle_driver *drv = &exynos_idle_driver;
 
 	exynos_enter_aftr = (void *)(pdev->dev.platform_data);
 
-	ret = cpuidle_register(&exynos_idle_driver, NULL);
+	/* Start at index 1, index 0 standard WFI */
+	ret = dt_init_idle_driver(drv, exynos_idle_state_match, 1);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to initialize idle states\n");
+		return ret;
+	}
+
+	ret = cpuidle_register(drv, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register cpuidle driver\n");
 		return ret;
-- 
1.9.1

  parent reply	other threads:[~2014-09-01 15:28 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 15:28 [PATCH v8 0/8] ARM generic idle states Lorenzo Pieralisi
2014-09-01 15:28 ` Lorenzo Pieralisi
2014-09-01 15:28 ` [PATCH v8 1/8] arm64: kernel: refactor the CPU suspend API for retention states Lorenzo Pieralisi
2014-09-01 15:28   ` Lorenzo Pieralisi
     [not found] ` <1409585324-3678-1-git-send-email-lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>
2014-09-01 15:28   ` [PATCH v8 2/8] Documentation: arm: define DT idle states bindings Lorenzo Pieralisi
2014-09-01 15:28     ` Lorenzo Pieralisi
2014-09-01 15:28 ` [PATCH v8 3/8] drivers: cpuidle: implement DT based idle states infrastructure Lorenzo Pieralisi
2014-09-01 15:28   ` Lorenzo Pieralisi
2014-09-03 13:25   ` Daniel Lezcano
2014-09-03 13:25     ` Daniel Lezcano
2014-09-03 17:30     ` Lorenzo Pieralisi
2014-09-03 17:30       ` Lorenzo Pieralisi
2014-09-01 15:28 ` [PATCH v8 4/8] arm64: kernel: introduce cpu_init_idle CPU operation Lorenzo Pieralisi
2014-09-01 15:28   ` Lorenzo Pieralisi
2014-09-03 17:34   ` Lina Iyer
2014-09-03 17:34     ` Lina Iyer
2014-09-03 17:46     ` Lorenzo Pieralisi
2014-09-03 17:46       ` Lorenzo Pieralisi
2014-09-03 19:16       ` Lina Iyer
2014-09-03 19:16         ` Lina Iyer
2014-09-01 15:28 ` [PATCH v8 5/8] arm64: add PSCI CPU_SUSPEND based cpu_suspend support Lorenzo Pieralisi
2014-09-01 15:28   ` Lorenzo Pieralisi
2014-09-01 15:28 ` [PATCH v8 6/8] drivers: cpuidle: CPU idle ARM64 driver Lorenzo Pieralisi
2014-09-01 15:28   ` Lorenzo Pieralisi
2014-09-03 17:37   ` Lorenzo Pieralisi
2014-09-03 17:37     ` Lorenzo Pieralisi
2014-09-04 16:03     ` Catalin Marinas
2014-09-04 16:03       ` Catalin Marinas
2014-09-04 17:29       ` Lorenzo Pieralisi
2014-09-04 17:29         ` Lorenzo Pieralisi
2014-09-05  9:21         ` Will Deacon
2014-09-05  9:21           ` Will Deacon
2014-09-05 15:34           ` Lorenzo Pieralisi
2014-09-05 15:34             ` Lorenzo Pieralisi
2014-09-11  8:28             ` Daniel Lezcano
2014-09-11  8:28               ` Daniel Lezcano
2014-09-11  8:57               ` Lorenzo Pieralisi
2014-09-11  8:57                 ` Lorenzo Pieralisi
     [not found]                 ` <20140911085727.GA25773-7AyDDHkRsp3ZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-09-11  9:32                   ` Daniel Lezcano
2014-09-11  9:32                     ` Daniel Lezcano
2014-09-12 10:32                     ` Catalin Marinas
2014-09-12 10:32                       ` Catalin Marinas
2014-09-12 11:26                       ` Lorenzo Pieralisi
2014-09-12 11:26                         ` Lorenzo Pieralisi
2014-09-23 13:35                         ` Bartlomiej Zolnierkiewicz
2014-09-23 13:35                           ` Bartlomiej Zolnierkiewicz
2014-09-23 18:14                           ` Lorenzo Pieralisi
2014-09-23 18:14                             ` Lorenzo Pieralisi
2014-09-14 16:59                 ` Tomasz Figa
2014-09-14 16:59                   ` Tomasz Figa
2014-09-23 13:42                   ` Bartlomiej Zolnierkiewicz
2014-09-23 13:42                     ` Bartlomiej Zolnierkiewicz
2014-09-23 18:16                     ` Lorenzo Pieralisi
2014-09-23 18:16                       ` Lorenzo Pieralisi
2014-09-29 11:08                   ` Lorenzo Pieralisi
2014-09-29 11:08                     ` Lorenzo Pieralisi
2014-09-01 15:28 ` [PATCH v8 7/8] drivers: cpuidle: initialize big.LITTLE driver through DT Lorenzo Pieralisi
2014-09-01 15:28   ` Lorenzo Pieralisi
2014-09-03 13:29   ` Daniel Lezcano
2014-09-03 13:29     ` Daniel Lezcano
2014-09-01 15:28 ` Lorenzo Pieralisi [this message]
2014-09-01 15:28   ` [PATCH v8 8/8] drivers: cpuidle: initialize Exynos " Lorenzo Pieralisi
2014-09-03 13:32   ` Daniel Lezcano
2014-09-03 13:32     ` Daniel Lezcano
2014-09-03 17:29     ` Lorenzo Pieralisi
2014-09-03 17:29       ` Lorenzo Pieralisi

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=1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=Charles.Garcia-Tobin@arm.com \
    --cc=amit.kucheria@linaro.org \
    --cc=ananaza@iki.fi \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=k.chander@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nico@linaro.org \
    --cc=pdeschrijver@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=sboyd@codeaurora.org \
    --cc=sebcape@gmail.com \
    --cc=sudeep.holla@arm.com \
    --cc=t.figa@samsung.com \
    --cc=vincent.guittot@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.