From patchwork Wed Aug 13 15:52:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 35366 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f199.google.com (mail-ig0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A70E2203C5 for ; Wed, 13 Aug 2014 15:52:41 +0000 (UTC) Received: by mail-ig0-f199.google.com with SMTP id l13sf4432209iga.2 for ; Wed, 13 Aug 2014 08:52:40 -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=bb0TfzMV/InJnWsIK64s12pvzF49vkyH4NLZD+gavK0=; b=IxTpkwgzbC78HJGtGhX1Gb77oOdxO/UDWduL0HtVDNyNWp/H7zjlgrxBo0LF8VVcwI xqz+7Uy2TPNcwGDd3D7d3mRP+bbHsEK4ubpmgE4fa/sXYac5ZYC2Galr5dfNhp4Pbf8s CUuqC5q7P3PMhYYtNZ4pcgV162NN7WA3Bs4+hdsBI0ulf/Cr5ChHCHJCefbN2XhNAE8L Rcpx+Hr/q5gvUyMDJWGO6fS2fUigpPi+jC/VtEHfjVHYnWmFEYgBib0OTYVSArl8iRIY FP0RfX9pfFsARR7UzMjQpLDaXwFlJTD4WfAlli9n49wH3oCv9KDSV35jIApvRS/HXc6Z WCVA== X-Gm-Message-State: ALoCoQmV3qR4DEWy56carfdvcTD1Gx677QYHsVyrjayj8jG6qy2Th7Shc/EcPcVeZMb0UVCfqqi3 X-Received: by 10.182.135.194 with SMTP id pu2mr2481461obb.35.1407945160946; Wed, 13 Aug 2014 08:52:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.235 with SMTP id q98ls640919qga.91.gmail; Wed, 13 Aug 2014 08:52:40 -0700 (PDT) X-Received: by 10.52.26.206 with SMTP id n14mr3865630vdg.0.1407945160719; Wed, 13 Aug 2014 08:52:40 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id m18si1339138vcn.79.2014.08.13.08.52.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Aug 2014 08:52:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ik5so15007100vcb.6 for ; Wed, 13 Aug 2014 08:52:40 -0700 (PDT) X-Received: by 10.52.3.40 with SMTP id 8mr3863078vdz.24.1407945160628; Wed, 13 Aug 2014 08:52:40 -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 tc5csp341374vcb; Wed, 13 Aug 2014 08:52:39 -0700 (PDT) X-Received: by 10.66.136.48 with SMTP id px16mr4926097pab.10.1407945158478; Wed, 13 Aug 2014 08:52:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si1819318pdj.12.2014.08.13.08.52.37 for ; Wed, 13 Aug 2014 08:52:38 -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 S1753424AbaHMPwg (ORCPT + 6 others); Wed, 13 Aug 2014 11:52:36 -0400 Received: from service87.mimecast.com ([91.220.42.44]:38805 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753418AbaHMPwf (ORCPT ); Wed, 13 Aug 2014 11:52:35 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 13 Aug 2014 16:52:28 +0100 Received: from red-moon.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 13 Aug 2014 16:52:26 +0100 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: devicetree@vger.kernel.org, Lorenzo Pieralisi , Chander Kashyap , 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 , Tomasz Figa , Mark Brown , Paul Walmsley , Geoff Levand , Bartlomiej Zolnierkiewicz , Lina Iyer Subject: [PATCH v7 7/8] drivers: cpuidle: initialize big.LITTLE driver through DT Date: Wed, 13 Aug 2014 16:52:06 +0100 Message-Id: <1407945127-27554-8-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407945127-27554-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1407945127-27554-1-git-send-email-lorenzo.pieralisi@arm.com> X-OriginalArrivalTime: 13 Aug 2014 15:52:26.0366 (UTC) FILETIME=[945E31E0:01CFB70E] X-MC-Unique: 114081316522805301 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.175 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 big.LITTLE CPUidle driver to dynamically initialize idle states data through the updated device tree source file. Cc: Chander Kashyap Signed-off-by: Lorenzo Pieralisi Acked-by: Catalin Marinas --- arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 23 +++++++++++++++++++++++ drivers/cpuidle/Kconfig.arm | 1 + drivers/cpuidle/cpuidle-big_little.c | 23 ++++++++++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index a25c262..322fd15 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 = <2000>; + }; + + CLUSTER_SLEEP_LITTLE: cluster-sleep-little { + compatible = "arm,idle-state"; + local-timer-stop; + entry-latency-us = <1000>; + exit-latency-us = <500>; + min-residency-us = <2500>; + }; }; }; diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index 38cff69..e339c7f 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -7,6 +7,7 @@ config ARM_BIG_LITTLE_CPUIDLE depends on MCPM 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 344d79fa..38bdd28 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c @@ -24,6 +24,8 @@ #include #include +#include "dt_idle_states.h" + static int bl_enter_powerdown(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx); @@ -171,7 +173,8 @@ static const struct of_device_id compatible_machine_match[] = { static int __init bl_idle_init(void) { - int ret; + int ret, i; + struct cpuidle_driver *drv; struct device_node *root = of_find_node_by_path("/"); if (!root) @@ -197,6 +200,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 < 0) + goto out_uninit_big; + + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(&bl_idle_little_driver, 1); + if (ret < 0) + 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;