From patchwork Wed Jun 25 14:10:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 32488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A53EC20C88 for ; Wed, 25 Jun 2014 14:11:06 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id ma3sf7493148pbc.11 for ; Wed, 25 Jun 2014 07:11:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=uMREvlDtKXHBaoIz+wgIQquJpdUFnCPIJan51/gX5Eg=; b=ThjuSy97lra7gPaxdldHDLpMepDru50YwoQ4HtySk1NA4XB8kAdjULovQz1fkO3x47 8RhNEWyHiFIAVfXjDR/oA6Rk1VHkU+XxVwqsnCd85OsYAc7zfKTyvZ7tNKuvmqLFslPp lSgcRmo3iA46omGTsOt6q+TRjwXlQ11XsV2dAJBDlsOVoH7XbbK18DHh6nmx/JsMkQWV IT4n2dBDOErY/868h3bk+bLoSvokyeY5NXoZ2rKFhvpBGrYfWOUbJybu8FiHgubIItQe Tz2y3DkQuHfpl7Mbr2tQpeRwP9ZPAplXUxeFqx52PQopr1dZSriQr26/awGPgeUZlEqp QiPA== X-Gm-Message-State: ALoCoQkU9IJAbjFBrGF8l5L989/zr+fIVN8p8E+NWjoWkNdL74pWsyHqYBUhpYPPIl+kiyhjYduq X-Received: by 10.66.220.34 with SMTP id pt2mr4376226pac.8.1403705465940; Wed, 25 Jun 2014 07:11:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.132 with SMTP id u4ls2725528qga.36.gmail; Wed, 25 Jun 2014 07:11:05 -0700 (PDT) X-Received: by 10.58.29.16 with SMTP id f16mr7337523veh.23.1403705465840; Wed, 25 Jun 2014 07:11:05 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id xx2si2324464vdc.54.2014.06.25.07.11.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 07:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hy10so1952415vcb.29 for ; Wed, 25 Jun 2014 07:11:05 -0700 (PDT) X-Received: by 10.53.8.162 with SMTP id dl2mr6076552vdd.24.1403705465750; Wed, 25 Jun 2014 07:11:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp292834vcb; Wed, 25 Jun 2014 07:11:05 -0700 (PDT) X-Received: by 10.68.196.168 with SMTP id in8mr12172038pbc.132.1403705464253; Wed, 25 Jun 2014 07:11:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xq1si5382347pbb.128.2014.06.25.07.11.03; Wed, 25 Jun 2014 07:11:03 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757058AbaFYOLA (ORCPT + 8 others); Wed, 25 Jun 2014 10:11:00 -0400 Received: from service87.mimecast.com ([91.220.42.44]:48746 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757365AbaFYOKf (ORCPT ); Wed, 25 Jun 2014 10:10:35 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 25 Jun 2014 15:10:33 +0100 Received: from red-moon.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 25 Jun 2014 15:10:23 +0100 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: Lorenzo Pieralisi , Kukjin Kim , Tomasz Figa , Mark Rutland , Sudeep Holla , Catalin Marinas , Charles Garcia Tobin , Nicolas Pitre , Rob Herring , Grant Likely , Peter De Schrijver , Santosh Shilimkar , Daniel Lezcano , Amit Kucheria , Vincent Guittot , Antti Miettinen , Stephen Boyd , Kevin Hilman , Sebastian Capella , Mark Brown , Paul Walmsley , Chander Kashyap Subject: [PATCH v5 7/8] drivers: cpuidle: initialize Exynos driver through DT Date: Wed, 25 Jun 2014 15:10:20 +0100 Message-Id: <1403705421-17597-8-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1403705421-17597-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1403705421-17597-1-git-send-email-lorenzo.pieralisi@arm.com> X-OriginalArrivalTime: 25 Jun 2014 14:10:23.0077 (UTC) FILETIME=[345CB150:01CF907F] X-MC-Unique: 114062515103309501 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lorenzo.pieralisi@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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: Kukjin Kim Cc: Tomasz Figa Signed-off-by: Lorenzo Pieralisi --- Compile tested, I am not sure I patched the right dts files, please check. .../devicetree/bindings/arm/exynos/idle-states.txt | 27 ++++++++++++++++++++ arch/arm/boot/dts/exynos3250.dtsi | 16 ++++++++++++ arch/arm/boot/dts/exynos5250.dtsi | 15 +++++++++++ arch/arm/boot/dts/exynos5410.dtsi | 17 +++++++++++++ drivers/cpuidle/Kconfig.arm | 1 + drivers/cpuidle/cpuidle-exynos.c | 29 +++++++++++++--------- 6 files changed, 93 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/exynos/idle-states.txt diff --git a/Documentation/devicetree/bindings/arm/exynos/idle-states.txt b/Documentation/devicetree/bindings/arm/exynos/idle-states.txt new file mode 100644 index 0000000..342ecb4 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/exynos/idle-states.txt @@ -0,0 +1,27 @@ +idle-states node +---------------- + +On Exynos platforms with power management capabilities, the device +tree source file must contain the idle-states node[1]. As defined in [1] the +idle-states node must contain an entry-method property that for Exynos +platforms can be one of: + + - "samsung,exynos" + +Exynos idle-states nodes example: + + idle-states { + entry-method = "samsung,exynos"; + + CLUSTER_SLEEP_0: cluster-sleep-0 { + compatible = "arm,idle-state"; + timer-state-retained; + power-rank = <0>; + entry-latency-us = <1000>; + exit-latency-us = <300>; + min-residency-us = <100000>; + }; + }; + +[1] ARM Linux Kernel documentation - Idle states bindings + Documentation/devicetree/bindings/arm/idle-states.txt diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi index 3e678fa..b0ccfca 100644 --- a/arch/arm/boot/dts/exynos3250.dtsi +++ b/arch/arm/boot/dts/exynos3250.dtsi @@ -45,11 +45,26 @@ #address-cells = <1>; #size-cells = <0>; + idle-states { + entry-method = "samsung,exynos"; + + CLUSTER_SLEEP_0: cluster-sleep-0 { + compatible = "arm,idle-state"; + timer-state-retained; + power-rank = <0>; + entry-latency-us = <1000>; + exit-latency-us = <300>; + min-residency-us = <100000>; + }; + + }; + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a7"; reg = <0>; clock-frequency = <1000000000>; + cpu-idle-states = <&CLUSTER_SLEEP_0>; }; cpu1: cpu@1 { @@ -57,6 +72,7 @@ compatible = "arm,cortex-a7"; reg = <1>; clock-frequency = <1000000000>; + cpu-idle-states = <&CLUSTER_SLEEP_0>; }; }; diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 834fb5a..b806653 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -58,17 +58,32 @@ #address-cells = <1>; #size-cells = <0>; + idle-states { + entry-method = "samsung,exynos"; + + CLUSTER_SLEEP_0: cluster-sleep-0 { + compatible = "arm,idle-state"; + timer-state-retained; + power-rank = <0>; + entry-latency-us = <1000>; + exit-latency-us = <300>; + min-residency-us = <100000>; + }; + }; + cpu@0 { device_type = "cpu"; 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>; }; }; diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi index 3839c26..82e4b7b 100644 --- a/arch/arm/boot/dts/exynos5410.dtsi +++ b/arch/arm/boot/dts/exynos5410.dtsi @@ -24,28 +24,45 @@ #address-cells = <1>; #size-cells = <0>; + idle-states { + entry-method = "samsung,exynos"; + + CLUSTER_SLEEP_0: cluster-sleep-0 { + compatible = "arm,idle-state"; + timer-state-retained; + power-rank = <0>; + entry-latency-us = <1000>; + exit-latency-us = <300>; + min-residency-us = <100000>; + }; + }; + CPU0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0x0>; + cpu-idle-states = <&CLUSTER_SLEEP_0>; }; CPU1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0x1>; + cpu-idle-states = <&CLUSTER_SLEEP_0>; }; CPU2: cpu@2 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0x2>; + cpu-idle-states = <&CLUSTER_SLEEP_0>; }; CPU3: cpu@3 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0x3>; + cpu-idle-states = <&CLUSTER_SLEEP_0>; }; }; diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index a9b089c..d8a9cd2 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -60,5 +60,6 @@ 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 7c01512..d76af54 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 idle_finisher(unsigned long flags) @@ -60,26 +62,29 @@ static struct cpuidle_driver exynos_idle_driver = { .owner = THIS_MODULE, .states = { [0] = ARM_CPUIDLE_WFI_STATE, - [1] = { - .enter = exynos_enter_lowpower, - .exit_latency = 300, - .target_residency = 100000, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "C1", - .desc = "ARM power down", - }, }, - .state_count = 2, - .safe_state_index = 0, }; static int exynos_cpuidle_probe(struct platform_device *pdev) { - int ret; + int ret, i; + struct cpuidle_driver *drv = &exynos_idle_driver; exynos_enter_aftr = (void *)(pdev->dev.platform_data); - ret = cpuidle_register(&exynos_idle_driver, NULL); + drv->cpumask = (struct cpumask *) cpu_possible_mask; + + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(drv, NULL, 1, false); + if (ret) { + dev_err(&pdev->dev, "failed to initialize idle states\n"); + return ret; + } + + for (i = 1; i < drv->state_count; i++) + drv->states[i].enter = exynos_enter_lowpower; + + ret = cpuidle_register(drv, NULL); if (ret) { dev_err(&pdev->dev, "failed to register cpuidle driver\n"); return ret;