From patchwork Mon Jul 21 16:06:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 33997 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54C6720492 for ; Mon, 21 Jul 2014 16:07:03 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf56516067pac.11 for ; Mon, 21 Jul 2014 09:07:02 -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=fYlm/+J9irlvxQReiJPyama5jIL4fYMm3tETrt5kCuU=; b=TSZK5eqVP1WKHeYnwQSE+LKUfsMefjd5YS2qSX5yy3TLkDZKAPbCUoeYZuJ5uQINCa gJmXjB2zTugG2SpCUlcfQxhjNUy2b0AKZ2uoe75GLldTkAZ3rAVGgJJFWe/LxL7gODFO QnVcKnVwgDPoWpPE3Oh9iHEpmOJdC/GUv0+JdGYMKrYCAYRTywUhHQ+1iTE+1aj92ZBH SUJpQsxSYFh+POi1Ga5f1Q86pUNv0oSIc3W5ycnBmpL5S1xnl5S04G+Odk1OvcSd6MKF gPidpsizawBNky+jrSuBEPbdBrpQkAVroA5OCL9PkwefPoUv/zP7GDAMXhbmNjzpzim8 E8uQ== X-Gm-Message-State: ALoCoQnu/zfHCTWdyzs1jjjlE4Wk+yeW9yrGUYanaSZ6KgRlo62rugJOdkkQ2SzhB6pDUVgZThyC X-Received: by 10.66.141.48 with SMTP id rl16mr1063723pab.1.1405958822655; Mon, 21 Jul 2014 09:07:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.6 with SMTP id u6ls2037389qgu.59.gmail; Mon, 21 Jul 2014 09:07:02 -0700 (PDT) X-Received: by 10.52.244.81 with SMTP id xe17mr25943452vdc.24.1405958822493; Mon, 21 Jul 2014 09:07:02 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id i4si2950395vdg.41.2014.07.21.09.07.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 09:07:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id hq11so11022102vcb.30 for ; Mon, 21 Jul 2014 09:07:02 -0700 (PDT) X-Received: by 10.220.50.8 with SMTP id x8mr23761105vcf.18.1405958820562; Mon, 21 Jul 2014 09:07:00 -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 tc5csp124844vcb; Mon, 21 Jul 2014 09:07:00 -0700 (PDT) X-Received: by 10.68.134.98 with SMTP id pj2mr15498119pbb.98.1405958819609; Mon, 21 Jul 2014 09:06:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qe5si14693995pac.103.2014.07.21.09.06.58; Mon, 21 Jul 2014 09:06:58 -0700 (PDT) Received-SPF: none (google.com: linux-pm-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 S932706AbaGUQGu (ORCPT + 15 others); Mon, 21 Jul 2014 12:06:50 -0400 Received: from service87.mimecast.com ([91.220.42.44]:42317 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932883AbaGUQGt (ORCPT ); Mon, 21 Jul 2014 12:06:49 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 21 Jul 2014 17:06:42 +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); Mon, 21 Jul 2014 17:06:41 +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 Subject: [PATCH v6 6/7] drivers: cpuidle: initialize big.LITTLE driver through DT Date: Mon, 21 Jul 2014 17:06:25 +0100 Message-Id: <1405958786-17243-7-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405958786-17243-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1405958786-17243-1-git-send-email-lorenzo.pieralisi@arm.com> X-OriginalArrivalTime: 21 Jul 2014 16:06:41.0305 (UTC) FILETIME=[C2734890:01CFA4FD] X-MC-Unique: 114072117064231601 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.171 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 --- 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 #include +#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;