From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Lezcano Subject: Re: [PATCH v8 8/8] drivers: cpuidle: initialize Exynos driver through DT Date: Wed, 03 Sep 2014 15:32:14 +0200 Message-ID: <5407185E.6030308@linaro.org> References: <1409585324-3678-1-git-send-email-lorenzo.pieralisi@arm.com> <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> Sender: linux-pm-owner@vger.kernel.org To: Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: devicetree@vger.kernel.org, Chander Kashyap , Kukjin Kim , Tomasz Figa , Mark Rutland , Sudeep Holla , Catalin Marinas , Charles Garcia Tobin , Nicolas Pitre , Rob Herring , Grant Likely , Peter De Schrijver , Santosh Shilimkar , Amit Kucheria , Vincent Guittot , Antti Miettinen , Stephen Boyd , Kevin Hilman , Sebastian Capella , Mark Brown , Paul Walmsley , Geoff Levand , Bartlomiej Zolnierkiewicz List-Id: devicetree@vger.kernel.org On 09/01/2014 05:28 PM, Lorenzo Pieralisi wrote: > With the introduction of DT based idle states, CPUidle drivers for > ARM can now initialize idle states data through properties in the dev= ice > 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 > Cc: Kukjin Kim > Cc: Tomasz Figa > Acked-by: Catalin Marinas > Signed-off-by: Lorenzo Pieralisi Acked-by: Daniel Lezcano > --- > 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/ex= ynos4210.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 =3D "cpu"; > compatible =3D "arm,cortex-a9"; > reg =3D <0x900>; > + cpu-idle-states =3D <&CLUSTER_SLEEP_0>; > }; > > cpu@901 { > device_type =3D "cpu"; > compatible =3D "arm,cortex-a9"; > reg =3D <0x901>; > + cpu-idle-states =3D <&CLUSTER_SLEEP_0>; > + }; > + > + idle-states { > + CLUSTER_SLEEP_0: cluster-sleep-0 { > + compatible =3D "arm,idle-state"; > + entry-latency-us =3D <1000>; > + exit-latency-us =3D <300>; > + min-residency-us =3D <100000>; > + }; > }; > }; > > diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/ex= ynos5250.dtsi > index 492e1ef..3a758ff 100644 > --- a/arch/arm/boot/dts/exynos5250.dtsi > +++ b/arch/arm/boot/dts/exynos5250.dtsi > @@ -63,12 +63,23 @@ > compatible =3D "arm,cortex-a15"; > reg =3D <0>; > clock-frequency =3D <1700000000>; > + cpu-idle-states =3D <&CLUSTER_SLEEP_0>; > }; > cpu@1 { > device_type =3D "cpu"; > compatible =3D "arm,cortex-a15"; > reg =3D <1>; > clock-frequency =3D <1700000000>; > + cpu-idle-states =3D <&CLUSTER_SLEEP_0>; > + }; > + > + idle-states { > + CLUSTER_SLEEP_0: cluster-sleep-0 { > + compatible =3D "arm,idle-state"; > + entry-latency-us =3D <1000>; > + exit-latency-us =3D <300>; > + min-residency-us =3D <100000>; > + }; > }; > }; > > diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.ar= m > 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/cpuid= le-exynos.c > index ba9b34b..e66a426 100644 > --- a/drivers/cpuidle/cpuidle-exynos.c > +++ b/drivers/cpuidle/cpuidle-exynos.c > @@ -18,6 +18,8 @@ > #include > #include > > +#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 =3D= { > .safe_state_index =3D 0, > }; > > +static const struct of_device_id exynos_idle_state_match[] __initcon= st =3D { > + { .compatible =3D "arm,idle-state", > + .data =3D exynos_enter_lowpower }, > + { }, > +}; > + > static int exynos_cpuidle_probe(struct platform_device *pdev) > { > int ret; > + struct cpuidle_driver *drv =3D &exynos_idle_driver; > > exynos_enter_aftr =3D (void *)(pdev->dev.platform_data); > > - ret =3D cpuidle_register(&exynos_idle_driver, NULL); > + /* Start at index 1, index 0 standard WFI */ > + ret =3D 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 =3D cpuidle_register(drv, NULL); > if (ret) { > dev_err(&pdev->dev, "failed to register cpuidle driver\n"); > return ret; > --=20 Linaro.org =E2=94=82 Open source software fo= r ARM SoCs =46ollow Linaro: Facebook | Twitter | Blog From mboxrd@z Thu Jan 1 00:00:00 1970 From: daniel.lezcano@linaro.org (Daniel Lezcano) Date: Wed, 03 Sep 2014 15:32:14 +0200 Subject: [PATCH v8 8/8] drivers: cpuidle: initialize Exynos driver through DT In-Reply-To: <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> References: <1409585324-3678-1-git-send-email-lorenzo.pieralisi@arm.com> <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> Message-ID: <5407185E.6030308@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 09/01/2014 05:28 PM, Lorenzo Pieralisi wrote: > 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 > Cc: Kukjin Kim > Cc: Tomasz Figa > Acked-by: Catalin Marinas > Signed-off-by: Lorenzo Pieralisi Acked-by: Daniel Lezcano > --- > 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 > #include > > +#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; > -- Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog