From patchwork Mon Sep 1 15:28:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 36392 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E53EA20792 for ; Mon, 1 Sep 2014 15:29:03 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lf10sf63695211pab.5 for ; Mon, 01 Sep 2014 08:29:00 -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=JjQsWb8i96bdHdLvdV9Zde0mjqMjrOK7YYJJCxT5Oz8=; b=BSHJJ/CnILcpLNiy11MAr319FffVthsE/+g8pqGsWFPEXkp4shx5EDEsKEf8zBnEZi 8/jBWDZD3yeGd0rItNtnxkH5n7/GvWthwRINyQW8iYY7xOT5UUozw1F1l3W9WgDNUJj8 yBp7g4IqYVgJ0uBKWgHP0Pe2GzMLJJnDW4lG658ab0Lm8EzkfBWz8YjcaFklmTcjNlrl 833ynb3nZ7ORTDOpA+kGOSAytgXvRHchzmw7A3OBnkbUTjaKkVp7XW0eJwlO/zj7v8cz QYqWUOvk8wkSZH08uhAgRXwA7Jcp8fIEmaAh0B/gLO17NJ5d6RJlMfDlhoKF7RF82QKD +LaQ== X-Gm-Message-State: ALoCoQnCXfb+XwqCwwsnoBHKEali9pJH4nVlsCRdINFI5DLwGRJM9q4ECde9OkYoU+d6LYfWFW++ X-Received: by 10.66.66.3 with SMTP id b3mr15347957pat.6.1409585339783; Mon, 01 Sep 2014 08:28:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.182 with SMTP id i51ls2073791qge.20.gmail; Mon, 01 Sep 2014 08:28:59 -0700 (PDT) X-Received: by 10.52.175.130 with SMTP id ca2mr179310vdc.94.1409585339651; Mon, 01 Sep 2014 08:28:59 -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 cj7si711439vcb.44.2014.09.01.08.28.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 08:28:59 -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 la4so5635421vcb.15 for ; Mon, 01 Sep 2014 08:28:59 -0700 (PDT) X-Received: by 10.221.5.137 with SMTP id og9mr26246718vcb.18.1409585339580; Mon, 01 Sep 2014 08:28:59 -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.45.67 with SMTP id uj3csp403485vcb; Mon, 1 Sep 2014 08:28:59 -0700 (PDT) X-Received: by 10.68.239.201 with SMTP id vu9mr40336464pbc.35.1409585338419; Mon, 01 Sep 2014 08:28:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rl12si1523396pab.232.2014.09.01.08.28.57 for ; Mon, 01 Sep 2014 08:28:58 -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 S1754457AbaIAP2z (ORCPT + 5 others); Mon, 1 Sep 2014 11:28:55 -0400 Received: from service87.mimecast.com ([91.220.42.44]:59230 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754420AbaIAP2y (ORCPT ); Mon, 1 Sep 2014 11:28:54 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 01 Sep 2014 16:28:52 +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, 1 Sep 2014 16:28:50 +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 , 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 , Geoff Levand , Bartlomiej Zolnierkiewicz , Ashwin Chaugule , Lina Iyer Subject: [PATCH v8 8/8] drivers: cpuidle: initialize Exynos driver through DT Date: Mon, 1 Sep 2014 16:28:44 +0100 Message-Id: <1409585324-3678-9-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409585324-3678-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1409585324-3678-1-git-send-email-lorenzo.pieralisi@arm.com> X-OriginalArrivalTime: 01 Sep 2014 15:28:50.0402 (UTC) FILETIME=[6E3C7C20:01CFC5F9] X-MC-Unique: 114090116285207501 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: 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@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..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;