From patchwork Wed Jun 26 10:15:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 2783841 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50C8FC0AB1 for ; Wed, 26 Jun 2013 10:16:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E63D7201DE for ; Wed, 26 Jun 2013 10:16:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5BC82013E for ; Wed, 26 Jun 2013 10:16:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853Ab3FZKQV (ORCPT ); Wed, 26 Jun 2013 06:16:21 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:40694 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803Ab3FZKQU (ORCPT ); Wed, 26 Jun 2013 06:16:20 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOZ00F57WJ7O801@mailout2.samsung.com> for linux-pm@vger.kernel.org; Wed, 26 Jun 2013 19:16:19 +0900 (KST) X-AuditID: cbfee61b-b7f8e6d00000524c-cb-51cabf728f48 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DE.E3.21068.27FBAC15; Wed, 26 Jun 2013 19:16:19 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOZ008XEWIOKP80@mmp2.samsung.com>; Wed, 26 Jun 2013 19:16:18 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: linux-arm-kernel@lists.infradead.org Cc: linux-pm@vger.kernel.org, linux@maxim.org.za, nicolas.ferre@atmel.com, plagnioj@jcrosoft.com, nsekhar@ti.com, khilman@deeprootsystems.com, kernel@pengutronix.de, shawn.guo@linaro.org, tony@atomide.com, ben-linux@fluff.org, kgene.kim@samsung.com, horms@verge.net.au, magnus.damm@gmail.com, swarren@wwwdotorg.org, srinidhi.kasagar@stericsson.com, linus.walleij@linaro.org, daniel.lezcano@linaro.org, rjw@sisk.pl, kyungmin.park@samsung.com, b.zolnierkie@samsung.com Subject: [PATCH 1/8] ARM: at91: move cpuidle driver to drivers/cpuidle/ Date: Wed, 26 Jun 2013 12:15:40 +0200 Message-id: <1372241747-21083-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1372241747-21083-1-git-send-email-b.zolnierkie@samsung.com> References: <1372241747-21083-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xoG7x/lOBBj8fM1psnLGe1WLSugNM FvM+y1o0b/3KaLFq6k4Wi94FV9ks7qxgtjjb9IbdYsqf5UwWmx5fY7X43HuE0WL5iqfMFg9W v2Wz+Ha5md1if+8GJot1D18wWfQv7GWyeLpuCbPFrS1NbBavDraxWOy/4uUg6rHg11YWj29f J7F4XH/1n8nj76oXzB47Z91l93h14Q6Lx51re9g8Ni+p95h4exqLR/9fA4++LasYPR4tbmH0 +L50DbvH8RvbmTzm/PzG4vF5k1yAYBSXTUpqTmZZapG+XQJXxqWOR+wFs3UrXq84ydbAuEe1 i5GTQ0LAROL8nS/sELaYxIV769m6GLk4hASmM0qc+viWCcLpYpLYcngxWBWbgJXExPZVjCC2 iICGxJSux2BxZoF7zBL7PuZ2MXJwCAu4S0xf4g0SZhFQlehs/ssGYvMKeEhs2neZGWKZvMTT +31gcU4BT4m5M5eC2UJANUvXLmWcwMi7gJFhFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkZw FD2T3sG4qsHiEKMAB6MSD6/C1pOBQqyJZcWVuYcYJTiYlUR438w/FSjEm5JYWZValB9fVJqT WnyIUZqDRUmc92CrdaCQQHpiSWp2ampBahFMlomDU6qBsfhT6Iu1/v9+/uXoefQhd6sw78Ht P162B4bGVB9uWLdCbi3D8Yu7z7Uf2nFgs8GUHcJbdrsoZXELhL9fIZHU/qe+rfHcy66Svmsl rG80bk+6x3RGq+v6/w/XHidbpX5/uzgmTsPowqyaW0v0art5dq/a8vuondjEmmmKQVLLT/DV ef0M74ucG6PEUpyRaKjFXFScCACO+SEJngIAAA== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Compile tested only. Cc: Andrew Victor Cc: Nicolas Ferre Cc: Jean-Christophe Plagniol-Villard Cc: Daniel Lezcano Cc: "Rafael J. Wysocki" Signed-off-by: Kyungmin Park Signed-off-by: Bartlomiej Zolnierkiewicz --- arch/arm/mach-at91/Makefile | 1 - arch/arm/mach-at91/cpuidle.c | 68 ------------------------------------------ drivers/cpuidle/Makefile | 3 ++ drivers/cpuidle/cpuidle-at91.c | 68 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 69 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 69f9e3b..0000000 --- a/arch/arm/mach-at91/cpuidle.c +++ /dev/null @@ -1,68 +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 -#include - -#include "pm.h" - -#define AT91_MAX_STATES 2 - -/* 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 if (cpu_is_at91sam9263()) - at91sam9263_standby(); - else - at91sam9_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 = 100000, - .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_init_cpuidle(void) -{ - return cpuidle_register(&at91_idle_driver, NULL); -} - -device_initcall(at91_init_cpuidle); diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 8767a7b..9dd4091 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -5,6 +5,9 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o +ifeq ($(CONFIG_ARCH_AT91),y) + obj-y += cpuidle-at91.o +endif obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o diff --git a/drivers/cpuidle/cpuidle-at91.c b/drivers/cpuidle/cpuidle-at91.c new file mode 100644 index 0000000..2545218 --- /dev/null +++ b/drivers/cpuidle/cpuidle-at91.c @@ -0,0 +1,68 @@ +/* + * 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 +#include + +#include "../../arch/arm/mach-at91/pm.h" + +#define AT91_MAX_STATES 2 + +/* 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 if (cpu_is_at91sam9263()) + at91sam9263_standby(); + else + at91sam9_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 = 100000, + .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_init_cpuidle(void) +{ + return cpuidle_register(&at91_idle_driver, NULL); +} + +device_initcall(at91_init_cpuidle);