Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1933823imm; Thu, 2 Aug 2018 03:37:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcVNxhWPWmQcMU8oafJhRotfqwO+gKTGc0slW4ZayJpl+88KunPJgBCz7D/aQ0BJKR+6nEa X-Received: by 2002:a63:2647:: with SMTP id m68-v6mr2218535pgm.60.1533206256383; Thu, 02 Aug 2018 03:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533206256; cv=none; d=google.com; s=arc-20160816; b=N16vyEM+onfd1ZQDmD8zds61l5HovIZnHJZO0/V+VxI0wSQNR5vke2fAae+jnT3W+G pn1E55kmSDRNxxpsPKdeaskW/07XbLIYnws1Xx3qnMH01l04O3ugwuxiLTzmhKIinQ26 kWddjYkaOy2wtK+K3LH90Yn3rzRzeejkXKmHjP5synkRrac+UahjPJ0pvfRbD5AXO1y2 mqJSxmgU2TvlWf8Q+d2lW/nHTjOf29sD7bkDBpFx889AFr2G7L6dU0lIjxIz6Xdw9233 xslCqGdmuCtADQpvpvcQiFyCCFFjFy/d7gC96YVnW3WCSsm1WgnS0iGFw3rfD5LkKI4+ /fBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MCJcljT7x0WU6FCYbICtk+0PTFfISHdQQ1Fcw+t0HR0=; b=EhYJEFTgz3rm/pWQvkIYaJYzguVuqWDPXVAiJrVP8yxC3uUlLSIQ3GjvDZfZZTfbFd qxbfBH5vxHD5qE1dFYOc+IZC4MSbzKRkDlyrL+lq2BIHXwCsVfQqfXfSEnouURhBX0JR 1tLBoXe7dp66HwYdzJ3W9sis41F0LjZVWhF9vyZH65gjJVW27odQzk17kfvvQhE4o6Iv G20fj9RzBJ5gi4LDz0gi7IAWXXA2d0cxEH8I79JTMYqiRw8CPlGBms6XPA9AWsFill4G U3dCtU8AMf504pe9BEyaqfU69apKX/t92PcrtzSgIMw0xVvKeYWMIi2bD0tx7KYnNm1k /BHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o188-v6si1554689pfo.236.2018.08.02.03.37.21; Thu, 02 Aug 2018 03:37:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731993AbeHBMZI (ORCPT + 99 others); Thu, 2 Aug 2018 08:25:08 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:36223 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731622AbeHBMZI (ORCPT ); Thu, 2 Aug 2018 08:25:08 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1flAw9-0004Zv-Mm; Thu, 02 Aug 2018 12:34:29 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1flAw6-0000oX-Rs; Thu, 02 Aug 2018 12:34:26 +0200 From: Oleksij Rempel To: Shawn Guo , Mark Brown , "Rafael J. Wysocki" Cc: Oleksij Rempel , kernel@pengutronix.de, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , Liam Girdwood , Leonard Crestez , Rob Herring , Mark Rutland , Michael Turquette , Stephen Boyd , Fabio Estevam , Russell King , linux-imx@nxp.com, yibin.gong@nxp.com, "A.s. Dong" Subject: [PATCH v9 2/6] ARM: imx6: register pm_power_off handler if "fsl,pmic-stby-poweroff" is set Date: Thu, 2 Aug 2018 12:34:21 +0200 Message-Id: <20180802103425.3053-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180802103425.3053-1-o.rempel@pengutronix.de> References: <20180802103425.3053-1-o.rempel@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One of the Freescale recommended sequences for power off with external PMIC is the following: ... 3. SoC is programming PMIC for power off when standby is asserted. 4. In CCM STOP mode, Standby is asserted, PMIC gates SoC supplies. See: http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf page 5083 This patch implements step 4. of this sequence. Signed-off-by: Oleksij Rempel --- arch/arm/mach-imx/pm-imx6.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 017539dd712b..2f5c643f62fb 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -601,6 +601,28 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata IMX6Q_GPR1_GINT); } +static void imx6_pm_stby_poweroff(void) +{ + imx6_set_lpm(STOP_POWER_OFF); + imx6q_suspend_finish(0); + + mdelay(1000); + + pr_emerg("Unable to poweroff system\n"); +} + +static int imx6_pm_stby_poweroff_probe(void) +{ + if (pm_power_off) { + pr_warn("%s: pm_power_off already claimed %p %pf!\n", + __func__, pm_power_off, pm_power_off); + return -EBUSY; + } + + pm_power_off = imx6_pm_stby_poweroff; + return 0; +} + void __init imx6_pm_ccm_init(const char *ccm_compat) { struct device_node *np; @@ -617,6 +639,9 @@ void __init imx6_pm_ccm_init(const char *ccm_compat) val = readl_relaxed(ccm_base + CLPCR); val &= ~BM_CLPCR_LPM; writel_relaxed(val, ccm_base + CLPCR); + + if (of_property_read_bool(np, "fsl,pmic-stby-poweroff")) + imx6_pm_stby_poweroff_probe(); } void __init imx6q_pm_init(void) -- 2.18.0