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 <chander.kashyap@linaro.org>, 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>, Tomasz Figa <t.figa@samsung.com>, Mark Brown <broonie@kernel.org>, Paul Walmsley <paul@pwsan.com>, Geoff Subject: [PATCH v6 6/7] drivers: cpuidle: initialize big.LITTLE driver through DT Date: Mon, 21 Jul 2014 17:06:25 +0100 [thread overview] Message-ID: <1405958786-17243-7-git-send-email-lorenzo.pieralisi@arm.com> (raw) In-Reply-To: <1405958786-17243-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 big.LITTLE CPUidle driver to dynamically initialize idle states data through the updated device tree source file. Cc: Chander Kashyap <chander.kashyap@linaro.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> --- arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 23 ++++++++++++++++ drivers/cpuidle/Kconfig.arm | 1 + drivers/cpuidle/cpuidle-big_little.c | 43 +++++++++++++++--------------- 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index a25c262..d61da86 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts @@ -38,6 +38,7 @@ compatible = "arm,cortex-a15"; reg = <0>; cci-control-port = <&cci_control1>; + cpu-idle-states = <&CLUSTER_SLEEP_BIG>; }; cpu1: cpu@1 { @@ -45,6 +46,7 @@ compatible = "arm,cortex-a15"; reg = <1>; cci-control-port = <&cci_control1>; + cpu-idle-states = <&CLUSTER_SLEEP_BIG>; }; cpu2: cpu@2 { @@ -52,6 +54,7 @@ compatible = "arm,cortex-a7"; reg = <0x100>; cci-control-port = <&cci_control2>; + cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>; }; cpu3: cpu@3 { @@ -59,6 +62,7 @@ compatible = "arm,cortex-a7"; reg = <0x101>; cci-control-port = <&cci_control2>; + cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>; }; cpu4: cpu@4 { @@ -66,6 +70,25 @@ compatible = "arm,cortex-a7"; reg = <0x102>; cci-control-port = <&cci_control2>; + cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>; + }; + + idle-states { + CLUSTER_SLEEP_BIG: cluster-sleep-big { + compatible = "arm,idle-state"; + local-timer-stop; + entry-latency-us = <1000>; + exit-latency-us = <700>; + min-residency-us = <3500>; + }; + + CLUSTER_SLEEP_LITTLE: cluster-sleep-little { + compatible = "arm,idle-state"; + local-timer-stop; + entry-latency-us = <1000>; + exit-latency-us = <500>; + min-residency-us = <3000>; + }; }; }; diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index b6d69e8..a9b089c 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -12,6 +12,7 @@ config ARM_BIG_LITTLE_CPUIDLE depends on ARCH_VEXPRESS_TC2_PM select ARM_CPU_SUSPEND select CPU_IDLE_MULTIPLE_DRIVERS + select DT_IDLE_STATES help Select this option to enable CPU idle driver for big.LITTLE based ARM systems. Driver manages CPUs coordination through MCPM and diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c index b45fc62..0a88480 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c @@ -24,6 +24,8 @@ #include <asm/smp_plat.h> #include <asm/suspend.h> +#include "dt_idle_states.h" + static int bl_enter_powerdown(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx); @@ -61,32 +63,12 @@ static struct cpuidle_driver bl_idle_little_driver = { .name = "little_idle", .owner = THIS_MODULE, .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[1] = { - .enter = bl_enter_powerdown, - .exit_latency = 700, - .target_residency = 2500, - .flags = CPUIDLE_FLAG_TIME_VALID | - CPUIDLE_FLAG_TIMER_STOP, - .name = "C1", - .desc = "ARM little-cluster power down", - }, - .state_count = 2, }; static struct cpuidle_driver bl_idle_big_driver = { .name = "big_idle", .owner = THIS_MODULE, .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[1] = { - .enter = bl_enter_powerdown, - .exit_latency = 500, - .target_residency = 2000, - .flags = CPUIDLE_FLAG_TIME_VALID | - CPUIDLE_FLAG_TIMER_STOP, - .name = "C1", - .desc = "ARM big-cluster power down", - }, - .state_count = 2, }; /* @@ -165,7 +147,8 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id) static int __init bl_idle_init(void) { - int ret; + int ret, i; + struct cpuidle_driver *drv; /* * Initialize the driver just for a compliant set of machines @@ -187,6 +170,24 @@ static int __init bl_idle_init(void) if (ret) goto out_uninit_little; + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(&bl_idle_big_driver, 1); + if (ret) + goto out_uninit_big; + + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(&bl_idle_little_driver, 1); + if (ret) + goto out_uninit_big; + + drv = &bl_idle_big_driver; + for (i = 1; i < drv->state_count; i++) + drv->states[i].enter = bl_enter_powerdown; + + drv = &bl_idle_little_driver; + for (i = 1; i < drv->state_count; i++) + drv->states[i].enter = bl_enter_powerdown; + ret = cpuidle_register(&bl_idle_little_driver, NULL); if (ret) goto out_uninit_big; -- 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 v6 6/7] drivers: cpuidle: initialize big.LITTLE driver through DT Date: Mon, 21 Jul 2014 17:06:25 +0100 [thread overview] Message-ID: <1405958786-17243-7-git-send-email-lorenzo.pieralisi@arm.com> (raw) In-Reply-To: <1405958786-17243-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 big.LITTLE CPUidle driver to dynamically initialize idle states data through the updated device tree source file. Cc: Chander Kashyap <chander.kashyap@linaro.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> --- arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 23 ++++++++++++++++ drivers/cpuidle/Kconfig.arm | 1 + drivers/cpuidle/cpuidle-big_little.c | 43 +++++++++++++++--------------- 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index a25c262..d61da86 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts @@ -38,6 +38,7 @@ compatible = "arm,cortex-a15"; reg = <0>; cci-control-port = <&cci_control1>; + cpu-idle-states = <&CLUSTER_SLEEP_BIG>; }; cpu1: cpu at 1 { @@ -45,6 +46,7 @@ compatible = "arm,cortex-a15"; reg = <1>; cci-control-port = <&cci_control1>; + cpu-idle-states = <&CLUSTER_SLEEP_BIG>; }; cpu2: cpu at 2 { @@ -52,6 +54,7 @@ compatible = "arm,cortex-a7"; reg = <0x100>; cci-control-port = <&cci_control2>; + cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>; }; cpu3: cpu at 3 { @@ -59,6 +62,7 @@ compatible = "arm,cortex-a7"; reg = <0x101>; cci-control-port = <&cci_control2>; + cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>; }; cpu4: cpu at 4 { @@ -66,6 +70,25 @@ compatible = "arm,cortex-a7"; reg = <0x102>; cci-control-port = <&cci_control2>; + cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>; + }; + + idle-states { + CLUSTER_SLEEP_BIG: cluster-sleep-big { + compatible = "arm,idle-state"; + local-timer-stop; + entry-latency-us = <1000>; + exit-latency-us = <700>; + min-residency-us = <3500>; + }; + + CLUSTER_SLEEP_LITTLE: cluster-sleep-little { + compatible = "arm,idle-state"; + local-timer-stop; + entry-latency-us = <1000>; + exit-latency-us = <500>; + min-residency-us = <3000>; + }; }; }; diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index b6d69e8..a9b089c 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -12,6 +12,7 @@ config ARM_BIG_LITTLE_CPUIDLE depends on ARCH_VEXPRESS_TC2_PM select ARM_CPU_SUSPEND select CPU_IDLE_MULTIPLE_DRIVERS + select DT_IDLE_STATES help Select this option to enable CPU idle driver for big.LITTLE based ARM systems. Driver manages CPUs coordination through MCPM and diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c index b45fc62..0a88480 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c @@ -24,6 +24,8 @@ #include <asm/smp_plat.h> #include <asm/suspend.h> +#include "dt_idle_states.h" + static int bl_enter_powerdown(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx); @@ -61,32 +63,12 @@ static struct cpuidle_driver bl_idle_little_driver = { .name = "little_idle", .owner = THIS_MODULE, .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[1] = { - .enter = bl_enter_powerdown, - .exit_latency = 700, - .target_residency = 2500, - .flags = CPUIDLE_FLAG_TIME_VALID | - CPUIDLE_FLAG_TIMER_STOP, - .name = "C1", - .desc = "ARM little-cluster power down", - }, - .state_count = 2, }; static struct cpuidle_driver bl_idle_big_driver = { .name = "big_idle", .owner = THIS_MODULE, .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[1] = { - .enter = bl_enter_powerdown, - .exit_latency = 500, - .target_residency = 2000, - .flags = CPUIDLE_FLAG_TIME_VALID | - CPUIDLE_FLAG_TIMER_STOP, - .name = "C1", - .desc = "ARM big-cluster power down", - }, - .state_count = 2, }; /* @@ -165,7 +147,8 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id) static int __init bl_idle_init(void) { - int ret; + int ret, i; + struct cpuidle_driver *drv; /* * Initialize the driver just for a compliant set of machines @@ -187,6 +170,24 @@ static int __init bl_idle_init(void) if (ret) goto out_uninit_little; + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(&bl_idle_big_driver, 1); + if (ret) + goto out_uninit_big; + + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(&bl_idle_little_driver, 1); + if (ret) + goto out_uninit_big; + + drv = &bl_idle_big_driver; + for (i = 1; i < drv->state_count; i++) + drv->states[i].enter = bl_enter_powerdown; + + drv = &bl_idle_little_driver; + for (i = 1; i < drv->state_count; i++) + drv->states[i].enter = bl_enter_powerdown; + ret = cpuidle_register(&bl_idle_little_driver, NULL); if (ret) goto out_uninit_big; -- 1.9.1
next prev parent reply other threads:[~2014-07-21 16:06 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-21 16:06 [PATCH v6 0/7] ARM generic idle states Lorenzo Pieralisi 2014-07-21 16:06 ` Lorenzo Pieralisi 2014-07-21 16:06 ` [PATCH v6 1/7] Documentation: arm: define DT idle states bindings Lorenzo Pieralisi 2014-07-21 16:06 ` Lorenzo Pieralisi 2014-07-21 22:40 ` Nicolas Pitre 2014-07-21 22:40 ` Nicolas Pitre 2014-07-22 12:38 ` Rob Herring 2014-07-22 12:38 ` Rob Herring 2014-07-23 15:52 ` Daniel Lezcano 2014-07-23 15:52 ` Daniel Lezcano 2014-07-21 16:06 ` [PATCH v6 2/7] drivers: cpuidle: implement DT based idle states infrastructure Lorenzo Pieralisi 2014-07-21 16:06 ` Lorenzo Pieralisi 2014-07-23 16:07 ` Daniel Lezcano 2014-07-23 16:07 ` Daniel Lezcano 2014-07-23 17:19 ` Lorenzo Pieralisi 2014-07-23 17:19 ` Lorenzo Pieralisi 2014-07-23 16:34 ` Ashwin Chaugule 2014-07-23 16:34 ` Ashwin Chaugule 2014-07-23 17:32 ` Lorenzo Pieralisi 2014-07-23 17:32 ` Lorenzo Pieralisi 2014-07-23 19:08 ` Ashwin Chaugule 2014-07-23 19:08 ` Ashwin Chaugule 2014-07-21 16:06 ` [PATCH v6 3/7] arm64: kernel: introduce cpu_init_idle CPU operation Lorenzo Pieralisi 2014-07-21 16:06 ` Lorenzo Pieralisi 2014-07-21 22:55 ` Stephen Boyd 2014-07-21 22:55 ` Stephen Boyd 2014-07-22 9:12 ` Lorenzo Pieralisi 2014-07-22 9:12 ` Lorenzo Pieralisi [not found] ` <1405958786-17243-1-git-send-email-lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> 2014-07-21 16:06 ` [PATCH v6 4/7] arm64: add PSCI CPU_SUSPEND based cpu_suspend support Lorenzo Pieralisi 2014-07-21 16:06 ` Lorenzo Pieralisi 2014-07-23 16:15 ` Ashwin Chaugule 2014-07-23 16:15 ` Ashwin Chaugule 2014-07-21 16:06 ` [PATCH v6 5/7] drivers: cpuidle: CPU idle ARM64 driver Lorenzo Pieralisi 2014-07-21 16:06 ` Lorenzo Pieralisi 2014-07-23 16:34 ` Ashwin Chaugule 2014-07-23 16:34 ` Ashwin Chaugule 2014-07-21 16:06 ` Lorenzo Pieralisi [this message] 2014-07-21 16:06 ` [PATCH v6 6/7] drivers: cpuidle: initialize big.LITTLE driver through DT Lorenzo Pieralisi 2014-07-23 16:26 ` Catalin Marinas 2014-07-23 16:26 ` Catalin Marinas 2014-08-06 9:02 ` Lorenzo Pieralisi 2014-08-06 9:02 ` Lorenzo Pieralisi 2014-07-21 16:06 ` [PATCH v6 7/7] drivers: cpuidle: initialize Exynos " Lorenzo Pieralisi 2014-07-21 16:06 ` 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=1405958786-17243-7-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=chander.kashyap@linaro.org \ --cc=daniel.lezcano@linaro.org \ --cc=devicetree@vger.kernel.org \ --cc=grant.likely@linaro.org \ --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=paul@pwsan.com \ --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: linkBe 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.