From patchwork Thu Sep 26 16:06:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2949521 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F01F09F288 for ; Thu, 26 Sep 2013 16:08:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98E0020328 for ; Thu, 26 Sep 2013 16:08:10 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 809762031A for ; Thu, 26 Sep 2013 16:08:05 +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 1VPE66-0007XA-Ng; Thu, 26 Sep 2013 16:07:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPE5t-0003Uy-Hs; Thu, 26 Sep 2013 16:07:09 +0000 Received: from mail-wg0-f52.google.com ([74.125.82.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPE5a-0003Ru-Rw for linux-arm-kernel@lists.infradead.org; Thu, 26 Sep 2013 16:06:53 +0000 Received: by mail-wg0-f52.google.com with SMTP id m15so1425887wgh.19 for ; Thu, 26 Sep 2013 09:06:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vsD6le3vfDkd4B1reVjeS86fwxCOOJx4+4fnVp57KGI=; b=bIMYJ65IRLuZf9Jm0kPu0a+FQWpvS/k1ekimWYTZxd7tnekp5V50QIXPpzCW8izQ74 6Vi6nFW4829RIWAztOKVCS99BcRl5tqwnqx8qExOdqPNqe5jFi0DkGccVieEivCoaL9H HYBD/wf53vZkfQFRJW/Xui1gKBNiFyCAcrzYAD2eo8896QRi8LWpozKkH4jQ+/CQTeDy s810f4vQNVjZqEqeyL08qKtna2AWKK+oQCgYUnnnrExQnrA2y1h3PwFBHFUU+yUJXSPk EgsVptqJHDa387TyGkCnLN2fR44GR7XCqS3MpiyN3QVV7of2a1ghXpRJe1REQ3rBoNZr wb9g== X-Gm-Message-State: ALoCoQmb/XFBAs/FLwM8ifoyfJD38zVFFOg/t+JLoWEfgVXMJQBQcmllKY4AUx5XwWGbxJxCY5Sy X-Received: by 10.194.123.8 with SMTP id lw8mr1639444wjb.40.1380211587141; Thu, 26 Sep 2013 09:06:27 -0700 (PDT) Received: from mai.home (AToulouse-654-1-326-179.w86-199.abo.wanadoo.fr. [86.199.213.179]) by mx.google.com with ESMTPSA id eg1sm1115636wib.11.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 09:06:26 -0700 (PDT) From: Daniel Lezcano To: linux@maxim.org.za, nicolas.ferre@atmel.com, plagnioj@jcrosoft.com Subject: [RFC PATCH 2/2] ARM: at91: cpuidle: Move driver to drivers/cpuidle Date: Thu, 26 Sep 2013 18:06:07 +0200 Message-Id: <1380211567-2972-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380211567-2972-1-git-send-email-daniel.lezcano@linaro.org> References: <1380211567-2972-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130926_120651_151171_4EDCC2E0 X-CRM114-Status: GOOD ( 20.71 ) X-Spam-Score: -2.6 (--) Cc: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.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 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As the cpuidle driver code has no more the dependency with the pm code, the 'standby' callback being passed as a parameter to the device's platform data, we can move the cpuidle driver in the drivers/cpuidle directory. Signed-off-by: Daniel Lezcano --- arch/arm/mach-at91/Makefile | 1 - arch/arm/mach-at91/cpuidle.c | 69 ---------------------------------------- drivers/cpuidle/Kconfig.arm | 6 ++++ drivers/cpuidle/Makefile | 1 + drivers/cpuidle/cpuidle-at91.c | 69 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 70 deletions(-) delete mode 100644 arch/arm/mach-at91/cpuidle.c create mode 100644 drivers/cpuidle/cpuidle-at91.c diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 3b0a953..c1b7370 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -98,7 +98,6 @@ obj-y += leds.o # Power Management obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o -obj-$(CONFIG_CPU_IDLE) += cpuidle.o ifeq ($(CONFIG_PM_DEBUG),y) CFLAGS_pm.o += -DDEBUG diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c deleted file mode 100644 index 6cdc76d..0000000 --- a/arch/arm/mach-at91/cpuidle.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * based on arch/arm/mach-kirkwood/cpuidle.c - * - * CPU idle support for AT91 SoC - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - * - * The cpu idle uses wait-for-interrupt and RAM self refresh in order - * to implement two idle states - - * #1 wait-for-interrupt - * #2 wait-for-interrupt and RAM self refresh - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define AT91_MAX_STATES 2 - -static void (*at91_standby)(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) -{ - at91_standby(); - return index; -} - -static struct cpuidle_driver at91_idle_driver = { - .name = "at91_idle", - .owner = THIS_MODULE, - .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[1] = { - .enter = at91_enter_idle, - .exit_latency = 10, - .target_residency = 10000, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "RAM_SR", - .desc = "WFI and DDR Self Refresh", - }, - .state_count = AT91_MAX_STATES, -}; - -/* Initialize CPU idle by registering the idle states */ -static int __init at91_cpuidle_probe(struct platform_device *dev) -{ - at91_standby = (void *)(dev->dev.platform_data); - - return cpuidle_register(&at91_idle_driver, NULL); -} - -static struct platform_driver at91_cpuidle_driver = { - .driver = { - .name = "cpuidle-at91", - .owner = THIS_MODULE, - }, - .probe = at91_cpuidle_probe, -}; - -module_platform_driver(at91_cpuidle_driver); diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index 8e36603..edecfc8 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -27,6 +27,12 @@ config ARM_U8500_CPUIDLE help Select this to enable cpuidle for ST-E u8500 processors +config ARM_AT91_CPUIDLE + bool "Cpu Idle Driver for the AT91 processors" + depends on ARCH_AT91 + help + Select this to enable cpuidle for AT91 processors + config CPU_IDLE_BIG_LITTLE bool "Support for ARM big.LITTLE processors" depends on ARCH_VEXPRESS_TC2_PM diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index cea5ef5..60c4ae5 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -11,4 +11,5 @@ obj-$(CONFIG_ARM_HIGHBANK_CPUIDLE) += cpuidle-calxeda.o obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o +obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o obj-$(CONFIG_CPU_IDLE_BIG_LITTLE) += cpuidle-big_little.o diff --git a/drivers/cpuidle/cpuidle-at91.c b/drivers/cpuidle/cpuidle-at91.c new file mode 100644 index 0000000..6cdc76d --- /dev/null +++ b/drivers/cpuidle/cpuidle-at91.c @@ -0,0 +1,69 @@ +/* + * based on arch/arm/mach-kirkwood/cpuidle.c + * + * CPU idle support for AT91 SoC + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + * + * The cpu idle uses wait-for-interrupt and RAM self refresh in order + * to implement two idle states - + * #1 wait-for-interrupt + * #2 wait-for-interrupt and RAM self refresh + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define AT91_MAX_STATES 2 + +static void (*at91_standby)(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) +{ + at91_standby(); + return index; +} + +static struct cpuidle_driver at91_idle_driver = { + .name = "at91_idle", + .owner = THIS_MODULE, + .states[0] = ARM_CPUIDLE_WFI_STATE, + .states[1] = { + .enter = at91_enter_idle, + .exit_latency = 10, + .target_residency = 10000, + .flags = CPUIDLE_FLAG_TIME_VALID, + .name = "RAM_SR", + .desc = "WFI and DDR Self Refresh", + }, + .state_count = AT91_MAX_STATES, +}; + +/* Initialize CPU idle by registering the idle states */ +static int __init at91_cpuidle_probe(struct platform_device *dev) +{ + at91_standby = (void *)(dev->dev.platform_data); + + return cpuidle_register(&at91_idle_driver, NULL); +} + +static struct platform_driver at91_cpuidle_driver = { + .driver = { + .name = "cpuidle-at91", + .owner = THIS_MODULE, + }, + .probe = at91_cpuidle_probe, +}; + +module_platform_driver(at91_cpuidle_driver);