From patchwork Fri Aug 1 09:48:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: keita kobayashi X-Patchwork-Id: 4662021 Return-Path: X-Original-To: patchwork-linux-sh@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 1CB3A9F319 for ; Fri, 1 Aug 2014 09:48:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F44D2021A for ; Fri, 1 Aug 2014 09:48:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AEC42020F for ; Fri, 1 Aug 2014 09:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753511AbaHAJso (ORCPT ); Fri, 1 Aug 2014 05:48:44 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:45620 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750783AbaHAJso (ORCPT ); Fri, 1 Aug 2014 05:48:44 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 01 Aug 2014 18:48:42 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 5DB503B5F4; Fri, 1 Aug 2014 18:48:42 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 436A1480A7; Fri, 1 Aug 2014 18:48:42 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 3E177480A6; Fri, 1 Aug 2014 18:48:42 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id UAR15251; Fri, 1 Aug 2014 18:48:42 +0900 X-IronPort-AV: E=Sophos;i="5.01,778,1399993200"; d="scan'208";a="165945334" Received: from mail-hk1lp0117.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.117]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 01 Aug 2014 18:48:41 +0900 Received: from [10.161.20.223] (211.11.155.147) by HKNPR06MB115.apcprd06.prod.outlook.com (10.242.102.146) with Microsoft SMTP Server (TLS) id 15.0.995.14; Fri, 1 Aug 2014 09:48:40 +0000 Message-ID: <53DB6275.1010707@renesas.com> Date: Fri, 1 Aug 2014 18:48:37 +0900 From: keita kobayashi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: , CC: , Magnus Damm , Subject: [PATCH 3/6] cpuidle: shmobile: Add CPUIdle driver X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: HKXPR06CA019.apcprd06.prod.outlook.com (10.141.129.49) To HKNPR06MB115.apcprd06.prod.outlook.com (10.242.102.146) X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 029097202E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(6049001)(6009001)(22564002)(189002)(199002)(77096002)(74662001)(87976001)(65806001)(59896001)(66066001)(50986999)(87266999)(65956001)(36756003)(42186005)(23736002)(54356999)(99396002)(74502001)(76482001)(85852003)(83506001)(80022001)(47776003)(86362001)(79102001)(64706001)(107046002)(20776003)(50466002)(86152002)(46102001)(102836001)(4396001)(80316001)(106356001)(95666004)(19580395003)(33656002)(21056001)(101416001)(83322001)(81342001)(65816999)(81542001)(83072002)(19580405001)(92726001)(77982001)(229853001)(85306004)(105586002); DIR:OUT; SFP:; SCL:1; SRVR:HKNPR06MB115; H:[10.161.20.223]; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; LANG:en; X-OriginatorOrg: renesas.com Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Add the wfi and Core-Standby for CPUIdle power states support for the shmobile SoCs. Signed-off-by: Keita Kobayashi --- drivers/cpuidle/Kconfig.arm | 6 +++ drivers/cpuidle/Makefile | 1 + drivers/cpuidle/cpuidle-shmobile.c | 71 ++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 drivers/cpuidle/cpuidle-shmobile.c diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index b6d69e8..2908cd0 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -61,3 +61,9 @@ config ARM_EXYNOS_CPUIDLE depends on ARCH_EXYNOS help Select this to enable cpuidle for Exynos processors + +config ARM_SHMOBILE_CPUIDLE + bool "Cpu Idle Driver for the shmobile SoCs" + depends on ARCH_SHMOBILE_MULTI + help + Select this to enable cpuidle for shmobile SoCs diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index d8bb1ff..0d24054 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -16,6 +16,7 @@ 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_ARM_EXYNOS_CPUIDLE) += cpuidle-exynos.o +obj-$(CONFIG_ARM_SHMOBILE_CPUIDLE) += cpuidle-shmobile.o ############################################################################### # MIPS drivers diff --git a/drivers/cpuidle/cpuidle-shmobile.c b/drivers/cpuidle/cpuidle-shmobile.c new file mode 100644 index 0000000..538c4ec --- /dev/null +++ b/drivers/cpuidle/cpuidle-shmobile.c @@ -0,0 +1,71 @@ +/* + * CPUIdle support code for SH-Mobile ARM + * + * Copyright (C) 2014 Renesas Electronics Corporation + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +static void (*shmobile_enter_corestandby)(void); + +int shmobile_enter_cpuidle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + shmobile_enter_corestandby(); + return index; +} + +static struct cpuidle_driver renesas_cpuidle_driver = { + .name = "shmobile_cpuidle", + .owner = THIS_MODULE, + .states = { + ARM_CPUIDLE_WFI_STATE, + { + .name = "C1", + .desc = "Core Standby Mode", + .exit_latency = 500, + .target_residency = 100000, + .flags = CPUIDLE_FLAG_TIME_VALID, + .enter = shmobile_enter_cpuidle, + }, + }, + .state_count = 2, +}; + +static int shmobile_cpuidle_probe(struct platform_device *pdev) +{ + int ret; + + shmobile_enter_corestandby = (void *)(pdev->dev.platform_data); + + ret = cpuidle_register(&renesas_cpuidle_driver, NULL); + if (ret) { + dev_err(&pdev->dev, "failed to register cpuidle driver\n"); + return ret; + } + + return 0; +} + +static struct platform_driver shmobile_cpuidle_driver = { + .probe = shmobile_cpuidle_probe, + .driver = { + .name = "cpuidle-shmobile", + .owner = THIS_MODULE, + }, +}; + +module_platform_driver(shmobile_cpuidle_driver);