From patchwork Tue Feb 2 21:45:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 577615 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49E27140B93 for ; Wed, 3 Feb 2016 08:47:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=HlqoK4zk; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQim7-0005Ix-LO; Tue, 02 Feb 2016 21:46:15 +0000 Received: from mail-yw0-x230.google.com ([2607:f8b0:4002:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQim0-00051C-Tj for linux-arm-kernel@lists.infradead.org; Tue, 02 Feb 2016 21:46:12 +0000 Received: by mail-yw0-x230.google.com with SMTP id g127so251815ywf.2 for ; Tue, 02 Feb 2016 13:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=RWIZJaZ4fJVBpfBNvkRD7Qcch+gq8GI5uBRkvdSjN/s=; b=HlqoK4zkImPepcXNq1kj01OtfMhHpm3F6UFIf+19zSaXGxMJcbWtoI11618saFSc7d 6EMHkMPEsyOk9ifYEXy3vu2Nb1XGu5VZTa2PL8IYcOGhcIom1CLLYhnHmQrtQiy/xTPd F0PXbKFtEDR5BDuKjAu15ShsqPjn8Q2HEhYjBkXE7ZRmMwR/zuc5TbM+Hjy1HfSqrtcE Wm30QeTdz0s/Zzsz2wWVle2lFw4v0DEYXtNpdSiLnauz+19qgF5ybDmgQb43/fGhsaIJ HhYKnSdMDvSCvXUbnEwGk0ZHznEEENhtph++x3OlPE+ZDzE9YyNUi99IGnGBMsHtVh4L jzCw== 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; bh=RWIZJaZ4fJVBpfBNvkRD7Qcch+gq8GI5uBRkvdSjN/s=; b=gZiBmD7aTTzWxJ9XGnUwr5wQ4bHpPebUPCX2ZvTciNOwcWh9iMK8GJ9vll+oeMvAML 7lcLt8WdjufHUn3GKllHT/3m4hp5Be7en0bb8PNLG0DBEPH7frqZYw4pugKJ55oKMTD8 yINur2ha6Z9KntdI1GAJF/pkTNOWNEepLY1ksIdv+v67NrhFZtBi5Q9GQJ/j2csxT19h KRnxd8U5rbPtUIiXaMKoHyK8dcKE99Juk7CQW0pFAG0wHjCxKFDbB8QUjDd4Ne7oMxWw kn982CNuiJtKHONf9uYwoceCIRhadIA/yDFP8Ak4Zoy15O+z2Iz4yyc8G91ByzJExYR9 cuBA== X-Gm-Message-State: AG10YORstGPNTsHO9jnLckO+NVMe6gI65Euslthkq7upJk7xf03ZLPsF2fiNB4bPXPO3UA== X-Received: by 10.13.235.134 with SMTP id u128mr6229722ywe.26.1454449547615; Tue, 02 Feb 2016 13:45:47 -0800 (PST) Received: from localhost.localdomain ([187.64.228.119]) by smtp.gmail.com with ESMTPSA id d145sm827873ywb.54.2016.02.02.13.45.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Feb 2016 13:45:46 -0800 (PST) From: Fabio Estevam To: shawnguo@kernel.org Subject: [PATCH v2] ARM: mx25: Add basic suspend/resume support Date: Tue, 2 Feb 2016 19:45:38 -0200 Message-Id: <1454449538-7620-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160202_134609_264542_CA1F59FB X-CRM114-Status: GOOD ( 18.30 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabio Estevam , arnd@arndb.de, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Fabio Estevam Tested basic suspend/resume on a mx25pdk: $ echo enabled > /sys/class/tty/ttymxc0/power/wakeup $ echo mem > /sys/power/state Then press any key in the serial console and the system wakes up. Signed-off-by: Fabio Estevam --- Changes since v1: - Use IS_ENABLED() instead of ifdef (Arnd). arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/common.h | 1 + arch/arm/mach-imx/mach-imx25.c | 1 + arch/arm/mach-imx/pm-imx25.c | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/pm-imx25.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index fb689d8..9fbe624 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -3,7 +3,7 @@ obj-y := cpu.o system.o irq-common.o obj-$(CONFIG_SOC_IMX1) += mm-imx1.o obj-$(CONFIG_SOC_IMX21) += mm-imx21.o -obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o +obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o pm-imx25.o obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o obj-$(CONFIG_SOC_IMX27) += mm-imx27.o ehci-imx27.o diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 32b83f0..58a3846 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -66,6 +66,7 @@ void imx_gpc_check_dt(void); void imx_gpc_set_arm_power_in_lpm(bool power_off); void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw); void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw); +void imx25_pm_init(void); enum mxc_cpu_pwr_mode { WAIT_CLOCKED, /* wfi only */ diff --git a/arch/arm/mach-imx/mach-imx25.c b/arch/arm/mach-imx/mach-imx25.c index 9379fd0..32dcb5e 100644 --- a/arch/arm/mach-imx/mach-imx25.c +++ b/arch/arm/mach-imx/mach-imx25.c @@ -41,6 +41,7 @@ static const char * const imx25_dt_board_compat[] __initconst = { DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") .init_early = imx25_init_early, + .init_late = imx25_pm_init, .init_irq = mx25_init_irq, .dt_compat = imx25_dt_board_compat, MACHINE_END diff --git a/arch/arm/mach-imx/pm-imx25.c b/arch/arm/mach-imx/pm-imx25.c new file mode 100644 index 0000000..8bba9fc --- /dev/null +++ b/arch/arm/mach-imx/pm-imx25.c @@ -0,0 +1,37 @@ +/* + * Copyright 2016 NXP Semiconductors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +static int imx25_suspend_enter(suspend_state_t state) +{ + if (!IS_ENABLED(CONFIG_PM)) + return 0; + + switch (state) { + case PM_SUSPEND_MEM: + cpu_do_idle(); + break; + default: + return -EINVAL; + } + + return 0; +} + +static const struct platform_suspend_ops imx25_suspend_ops = { + .enter = imx25_suspend_enter, + .valid = suspend_valid_only_mem, +}; + +void __init imx25_pm_init(void) +{ + suspend_set_ops(&imx25_suspend_ops); +}