From patchwork Tue Jun 4 10:47:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 2658371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 97EAE40077 for ; Tue, 4 Jun 2013 10:49:35 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjonA-0004fa-MU; Tue, 04 Jun 2013 10:48:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ujomw-0000Fx-Vv; Tue, 04 Jun 2013 10:48:26 +0000 Received: from hqemgate14.nvidia.com ([216.228.121.143]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ujomf-0000Cw-4q for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2013 10:48:10 +0000 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Tue, 04 Jun 2013 03:47:45 -0700 Received: from hqemhub01.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Tue, 04 Jun 2013 03:47:45 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Tue, 04 Jun 2013 03:47:45 -0700 Received: from jlo-ubuntu-64.nvidia.com (172.20.144.16) by hqemhub01.nvidia.com (172.20.150.30) with Microsoft SMTP Server (TLS) id 8.3.298.1; Tue, 4 Jun 2013 03:47:44 -0700 From: Joseph Lo To: Stephen Warren Subject: [PATCH V2 1/4] ARM: tegra: cpuidle: move the init function behind the suspend init function Date: Tue, 4 Jun 2013 18:47:32 +0800 Message-ID: <1370342855-32705-2-git-send-email-josephl@nvidia.com> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1370342855-32705-1-git-send-email-josephl@nvidia.com> References: <1370342855-32705-1-git-send-email-josephl@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130604_064809_383085_98655EBA X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joseph Lo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org One of the state of CPUidle on Tegra can power gate the CPU and the vdd_cpu rail. But it depends on some configurations from DT and a common hook function for different Tegra SoCs to power gate the CPU rail. And these stuffs are initialized after common Tegra suspend init function. So we move the CPUidle init behind the suspend init function. And making the CPUidle driver more generic. Signed-off-by: Joseph Lo --- V2: * no change --- arch/arm/mach-tegra/common.c | 2 ++ arch/arm/mach-tegra/cpuidle.c | 14 ++++---------- arch/arm/mach-tegra/cpuidle.h | 6 ++++++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 95ce2a0..b25153e 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -29,6 +29,7 @@ #include "board.h" #include "common.h" +#include "cpuidle.h" #include "fuse.h" #include "iomap.h" #include "irq.h" @@ -108,5 +109,6 @@ void __init tegra_init_early(void) void __init tegra_init_late(void) { tegra_init_suspend(); + tegra_cpuidle_init(); tegra_powergate_debugfs_init(); } diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c index 4b744c4..4a7a788 100644 --- a/arch/arm/mach-tegra/cpuidle.c +++ b/arch/arm/mach-tegra/cpuidle.c @@ -27,25 +27,19 @@ #include "fuse.h" #include "cpuidle.h" -static int __init tegra_cpuidle_init(void) +void __init tegra_cpuidle_init(void) { - int ret; - switch (tegra_chip_id) { case TEGRA20: - ret = tegra20_cpuidle_init(); + tegra20_cpuidle_init(); break; case TEGRA30: - ret = tegra30_cpuidle_init(); + tegra30_cpuidle_init(); break; case TEGRA114: - ret = tegra114_cpuidle_init(); + tegra114_cpuidle_init(); break; default: - ret = -ENODEV; break; } - - return ret; } -device_initcall(tegra_cpuidle_init); diff --git a/arch/arm/mach-tegra/cpuidle.h b/arch/arm/mach-tegra/cpuidle.h index d733f75..9bcf61f 100644 --- a/arch/arm/mach-tegra/cpuidle.h +++ b/arch/arm/mach-tegra/cpuidle.h @@ -35,4 +35,10 @@ int tegra114_cpuidle_init(void); static inline int tegra114_cpuidle_init(void) { return -ENODEV; } #endif +#ifdef CONFIG_CPU_IDLE +void tegra_cpuidle_init(void); +#else +static inline void tegra_cpuidle_init(void) {} +#endif + #endif