From patchwork Mon Apr 15 13:29:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2445201 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 E44083FD1A for ; Mon, 15 Apr 2013 13:31:26 +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 1URjUZ-0007y4-1Z; Mon, 15 Apr 2013 13:30:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1URjUD-0002VM-Hc; Mon, 15 Apr 2013 13:30:21 +0000 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URjTx-0002SX-9v for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2013 13:30:06 +0000 Received: by mail-wi0-f173.google.com with SMTP id l13so967699wie.12 for ; Mon, 15 Apr 2013 06:30:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=VRSYWMoynQFkV7vHv7eZz87SEuhH4m5vZQYwkJ1jneQ=; b=Zo/JnBBV9wQSXskl5ZBKoZfE6xPqpIWyp1vD4jBONdOil8Tw13QOVN36h9rDrb2TaY Mwb9yx+PnZ7CXxHm6w+IVEHzS0Eg6VTmduTkVbgarFwfRep6QP3CIsRQ1K3TFvZkRmLx AE10RtO+7SMuSJkOw1bXbJFqxNyNsm/WQg6OaxZleI1Xu4LZFWYDoVXsvLjcEJhWkTP3 iZb/nC3rB/fRv4TcduGx4md71fOm0zRr9xdX3nd4xd5qknLhOUK1VANeCNtD7D2FAJBM XltZQiFNKWPV4AfjheyVTX22bhdrcxSqjYSSEbPPwVCu9lz9spryupbIQ3sEPupZDbrN nEqQ== X-Received: by 10.194.82.104 with SMTP id h8mr32406024wjy.3.1366032602563; Mon, 15 Apr 2013 06:30:02 -0700 (PDT) Received: from mai.home (AToulouse-654-1-349-85.w90-55.abo.wanadoo.fr. [90.55.188.85]) by mx.google.com with ESMTPS id n2sm13520972wiy.6.2013.04.15.06.30.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Apr 2013 06:30:01 -0700 (PDT) From: Daniel Lezcano To: linux@maxim.org.za, nicolas.ferre@atmel.com, linux-arm-kernel@lists.infradead.org, rjw@sisk.pl, plagnioj@jcrosoft.com, linux-pm@vger.kernel.org Subject: [RFC patch 1/2] ARM: at91: cpuidle: encapsulate the standby code Date: Mon, 15 Apr 2013 15:29:57 +0200 Message-Id: <1366032598-23053-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366032598-23053-1-git-send-email-daniel.lezcano@linaro.org> References: <1366032598-23053-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQmiIj4qh4D/Hn3gEvq/DQEzTIcSyEguUEVh7OvtJO24u9QvDwsWqiVWfyJKr1AVaGxsrS7t X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130415_093005_476112_89AAECD9 X-CRM114-Status: GOOD ( 15.09 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-kernel@lists.linaro.org 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In order to split the pm code from the cpuidle driver, add an ops for the standby function which will be initialized by the pm init functions directly, thus no need of the SoC specific headers. Cleanup also the headers included in this file as they are no longer needed. Signed-off-by: Daniel Lezcano Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/mach-at91/cpuidle.c | 19 ++++--------------- arch/arm/mach-at91/pm.c | 8 +++++++- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c index 48f1228..b2bec92 100644 --- a/arch/arm/mach-at91/cpuidle.c +++ b/arch/arm/mach-at91/cpuidle.c @@ -13,32 +13,21 @@ * #2 wait-for-interrupt and RAM self refresh */ -#include +#include #include -#include #include -#include -#include -#include #include -#include - -#include "pm.h" #define AT91_MAX_STATES 2 +extern void (*at91_standby_ops)(void); + /* Actual code that puts the SoC in different idle states */ static int at91_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - if (cpu_is_at91rm9200()) - at91rm9200_standby(); - else if (cpu_is_at91sam9g45()) - at91sam9g45_standby(); - else - at91sam9_standby(); - + at91_standby_ops(); return index; } diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 73f1f25..f456e86 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -39,6 +39,8 @@ #include "at91_rstc.h" #include "at91_shdwc.h" +void (*at91_standby_ops)(void); + static void __init show_reset_status(void) { static char reset[] __initdata = "reset"; @@ -321,8 +323,12 @@ static int __init at91_pm_init(void) pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */ - if (cpu_is_at91rm9200()) + if (cpu_is_at91rm9200()) { at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); + at91_standby_ops = at91rm9200_standby; + } else if (cpu_is_at91sam9g45()) + at91_standby_ops= at91sam9g45_standby; + else at91_standby_ops = at91sam9_standby; suspend_set_ops(&at91_pm_ops);