From patchwork Wed Aug 13 15:52:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 35368 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BAA15203C5 for ; Wed, 13 Aug 2014 15:56:09 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j7sf30199134qaq.5 for ; Wed, 13 Aug 2014 08:56:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=vv1bfzRmNt7hI3+sBTPIFn7/ygajEG0yamNlOtqBk2E=; b=T0dxp6b8iw1kGQA/4pjoIPPE5jHMhOGL6W9Lst+iX4AUwi50kCK0Lv+ZDzg30LfhKl POc46rgWiuYQCxb2cTVPS+CHtWt3gd9STrefKv45SufWH8nBiggkV/2WY4+hiMJ4CGvr MhG5zWjpVn1HDYJsA24IJc/elYh3bjopg4DkkUFxISPp32ce5FWffgISgyUUuyGiuxpu Kq1LRzAoGZvIKOix5BLpnGjsqHFidSojXW1NWWRNaxy0zMRJeZqAk1oimk7dyOqT11/r 8wilGA5pFsKLlmeFtVnmZHb7J57Ekhe/YC/h6jdY3qMBP8I8I/nPX+hFAQA6u17hYf0I 7nOA== X-Gm-Message-State: ALoCoQkdoJDKH9WyByPi+vQ12T6kXmvudVjlYPOTWZo3AzewcSoutqZGrh+gq3+sDaKrgUvg+shN X-Received: by 10.236.157.193 with SMTP id o41mr2777758yhk.6.1407945369567; Wed, 13 Aug 2014 08:56:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.48 with SMTP id m45ls647457qgd.18.gmail; Wed, 13 Aug 2014 08:56:09 -0700 (PDT) X-Received: by 10.221.5.137 with SMTP id og9mr4639400vcb.18.1407945369467; Wed, 13 Aug 2014 08:56:09 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id y20si1346146vcu.71.2014.08.13.08.56.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Aug 2014 08:56:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so15220789vcb.18 for ; Wed, 13 Aug 2014 08:56:09 -0700 (PDT) X-Received: by 10.52.3.40 with SMTP id 8mr3879883vdz.24.1407945369360; Wed, 13 Aug 2014 08:56:09 -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 tc5csp341635vcb; Wed, 13 Aug 2014 08:56:08 -0700 (PDT) X-Received: by 10.70.131.199 with SMTP id oo7mr4741023pdb.95.1407945367898; Wed, 13 Aug 2014 08:56:07 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d17si1814955pdj.76.2014.08.13.08.56.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Aug 2014 08:56:07 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHat6-0003Qq-38; Wed, 13 Aug 2014 15:54:56 +0000 Received: from service88.mimecast.com ([195.130.217.12]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHasx-0002sR-L0 for linux-arm-kernel@lists.infradead.org; Wed, 13 Aug 2014 15:54:49 +0000 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:30 +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:27 +0100 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v7 8/8] drivers: cpuidle: initialize Exynos driver through DT Date: Wed, 13 Aug 2014 16:52:07 +0100 Message-Id: <1407945127-27554-9-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:27.0647 (UTC) FILETIME=[9521A8F0:01CFB70E] X-MC-Unique: 114081316523020201 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140813_085448_156178_FAD36F70 X-CRM114-Status: GOOD ( 12.13 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [195.130.217.12 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.130.217.12 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Mark Rutland , Catalin Marinas , Tomasz Figa , Kukjin Kim , Lina Iyer , Chander Kashyap , Lorenzo Pieralisi , Vincent Guittot , Nicolas Pitre , Daniel Lezcano , Grant Likely , Charles Garcia Tobin , devicetree@vger.kernel.org, Kevin Hilman , Bartlomiej Zolnierkiewicz , Sebastian Capella , Mark Brown , Antti Miettinen , Paul Walmsley , Geoff Levand , Peter De Schrijver , Stephen Boyd , Amit Kucheria , Rob Herring , Santosh Shilimkar , Sudeep Holla X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.173 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 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 Signed-off-by: Lorenzo Pieralisi Acked-by: Catalin Marinas --- arch/arm/boot/dts/exynos4210.dtsi | 11 +++++++++++ arch/arm/boot/dts/exynos5250.dtsi | 11 +++++++++++ drivers/cpuidle/Kconfig.arm | 1 + drivers/cpuidle/cpuidle-exynos.c | 27 ++++++++++++++++++++++++--- 4 files changed, 47 insertions(+), 3 deletions(-) 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@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@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..6dff982 100644 --- a/drivers/cpuidle/cpuidle-exynos.c +++ b/drivers/cpuidle/cpuidle-exynos.c @@ -13,11 +13,14 @@ #include #include #include +#include #include #include #include +#include "dt_idle_states.h" + static void (*exynos_enter_aftr)(void); static int exynos_enter_lowpower(struct cpuidle_device *dev, @@ -58,17 +61,35 @@ static struct cpuidle_driver exynos_idle_driver = { 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 = kzalloc(cpumask_size(), GFP_KERNEL); + if (!drv->cpumask) + return -ENOMEM; + + /* Start at index 1, index 0 standard WFI */ + ret = dt_init_idle_driver(drv, 1); + if (ret < 0) { + dev_err(&pdev->dev, "failed to initialize idle states\n"); + goto free_mem; + } + + 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; + goto free_mem; } return 0; +free_mem: + kfree(drv->cpumask); + return ret; } static struct platform_driver exynos_cpuidle_driver = {