From patchwork Tue Jan 8 09:52:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10751743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A38F13B5 for ; Tue, 8 Jan 2019 09:53:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 438C828B97 for ; Tue, 8 Jan 2019 09:53:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3463F28BC5; Tue, 8 Jan 2019 09:53:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B791B28B97 for ; Tue, 8 Jan 2019 09:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=axcdVRRPNlkVdWe8AwBy3Wzwm2zHZgbW+SuFFSVtYlQ=; b=GsnUsv8tjF3ims Bny9qKELf/0cnldOSJXdLyzj/UBdM+1EPOXa7QOB5qBy8AoMK4Jh1YiEeXW0WzYIR0P/aLCnNvy75 2sYK43M1DEjbhXggRNJAB/R6YVQ4y2r02wYN9wFdQqfl0BmW9KLGBoVYDSiis5AoZj39tc+VcjCBY sPLH0cmkQHKdhbSKzLz7GX8JpB937zhpKPv4NvEobc5hIVSD2ZzLqhC3U+6Kqy/UCf0N8l3/9txs5 /piglQlbqFzsTEZeBgHfIciMCctGda6gW5KNB6b9kpxf/ywthFHQ9WsBlBWpt05UFwuYWI1jaeMgD LuY00qNACgT72w23UQ8Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggo4f-0001ye-MI; Tue, 08 Jan 2019 09:53:29 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggo4B-0001Qk-Cz for linux-arm-kernel@lists.infradead.org; Tue, 08 Jan 2019 09:53:05 +0000 X-IronPort-AV: E=Sophos;i="5.56,453,1539673200"; d="scan'208";a="25050721" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Jan 2019 02:52:55 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.106) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 8 Jan 2019 02:52:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ypxnDuNXUxh1tSqLT/QnuKbcBjBZLpen7PC47MjcKo=; b=Y/OcdfeRp/VRonsmaG2jwCsT4saizdzuqGE/C9geqBLs5D4XOUx21drHPlMl7LWQWzzP6W23y3GFtIX6ylkdQAuJ3WJYeJAWwRjmpj2qsOtsbVKTi3IJq52SGo0J2Kr1zV2L89wu4HcW08kmj7aykwfpRuH/OyIdrMNodRkhiSQ= Received: from MWHPR11MB1920.namprd11.prod.outlook.com (10.175.54.19) by MWHPR11MB1838.namprd11.prod.outlook.com (10.175.53.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.13; Tue, 8 Jan 2019 09:52:53 +0000 Received: from MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::e553:ff9d:8c0b:9627]) by MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::e553:ff9d:8c0b:9627%6]) with mapi id 15.20.1516.010; Tue, 8 Jan 2019 09:52:53 +0000 From: To: , , , , , , , , Subject: [PATCH 1/3] PM / Suspend: Add support to check if platform's power is off in suspend Thread-Topic: [PATCH 1/3] PM / Suspend: Add support to check if platform's power is off in suspend Thread-Index: AQHUpzfs93rBcN8fLkunLXYHWnxjXQ== Date: Tue, 8 Jan 2019 09:52:53 +0000 Message-ID: <1546941147-18410-2-git-send-email-claudiu.beznea@microchip.com> References: <1546941147-18410-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1546941147-18410-1-git-send-email-claudiu.beznea@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0081.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::34) To MWHPR11MB1920.namprd11.prod.outlook.com (2603:10b6:300:110::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR11MB1838; 6:kQRGG7fok3dmfdZq1INsIm/iJDAkIILN6nK8LAnM/oJ1R5Mdy25D+h8JcFmoLSLxEHuElpTEWZZetJJMHtkjY3P509XtNp99cQxxlNB77LkqiJDr/9hIRbKFI49WtY3gStoVYoVQST6z7Nl+41dIzmQgXgVdoYOB0stKlL175ovbfnennkw00cXPFJ5Jbn4KwuNJuPIeUqmPeTUNCgPfLX5O+I+WDjAOoDUIJRimGBI9JVDJ1m9kZsA4SbT6GlHf5oO3mt50Qkz9Qq8hzD5HPCZa15wwbL5faTIBSVyQ6sxds4YaoPSylm4VWU7EKbWfGVJuAKeCN2Wzf2avW2fFHP1hFsctf3OgWgv+pnd6T3O+iwGcVI91/nsj0GieY2A9BcEJKmk585GVsZcURZ701OCCtEy5LM2Fh5AA5HRwW/2GYFiHc/andXgspud04NQ/G23nj/FUvU2D83m65HrNug==; 5:cKwpVYFRK4BSQXTfFe15GCiko7SZRKeuUIqaIKD+Irtd3k7q7kak+6LjSzMwBrVbeadalbA9LYDsJonlO96uyPiXIKyOcmLduhf0SuRWW64pahzn9IsDCjpfZeih1kzF766Kq3G84mcO+ID6tS5vsR6MQgia1wBViiwZBQqLfl9mGMQcekXpshBf63MDpcetq0OfK6rl6bgPRP/vSiM2Fw==; 7:KRS8vAeISmuQWJG25cwFuhn4pA/JU8VRJftSIKg/jkDLCXs0g+703cZQnVrSNRuHXuYMHg0WaB2uG/7UJmgD5qOuFqpkVrHALiw3KgHBJb/jMqW4TKq6vIoKLmBXjQUDnBOuZnaqe27LaOARQUiNKw== x-ms-office365-filtering-correlation-id: 81145ac0-d99f-4532-3e92-08d6754f0ea3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:MWHPR11MB1838; x-ms-traffictypediagnostic: MWHPR11MB1838: x-microsoft-antispam-prvs: x-forefront-prvs: 0911D5CE78 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(376002)(136003)(39860400002)(189003)(199004)(6436002)(110136005)(305945005)(107886003)(54906003)(6512007)(76176011)(52116002)(99286004)(8936002)(105586002)(53936002)(5660300001)(81166006)(7416002)(81156014)(8676002)(4326008)(39060400002)(7736002)(316002)(106356001)(25786009)(97736004)(36756003)(14454004)(72206003)(478600001)(6486002)(66066001)(68736007)(2501003)(15650500001)(486006)(386003)(6506007)(575784001)(86362001)(476003)(2616005)(2906002)(71190400001)(71200400001)(186003)(14444005)(6116002)(3846002)(2201001)(102836004)(6346003)(11346002)(446003)(256004)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1838; H:MWHPR11MB1920.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Claudiu.Beznea@microchip.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: KrudZr9xiBu89BgVPS3QMYOrtwg3ikhla3SW+HYSwJYhgTHftJp5ZXFwfuFb0qzomAePg0rLF5CGYNmL7e6I/wnBA1dtc9yJLbb0aaUl9BAg97HJGV3+aUVDnmZV/o5zK+O46zJuFoLZYWNFGkmqDwzbWKiBqmOUqs/86czMZYjt9YKVNsex0CsHGTd1gueZQGgOcpBMi6j4FcLEpgQCGFpdBxBExo57qhhtYerdPYykROBmhOdchxv96KGLxrZ28e9ytEQUa5qAwH6WmHYmR53JM2TwK6SFAMwYXQZR++YYQj4MVwhyYrD5bXAWEOeW spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 81145ac0-d99f-4532-3e92-08d6754f0ea3 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2019 09:52:53.1302 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1838 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190108_015300_416485_E602C312 X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Claudiu.Beznea@microchip.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Claudiu Beznea Add support to check if platform's power will be cut off in suspend. This will help drivers shared by multiple platforms to take only the necessary actions while suspending/resuming (some platform may not need to save/restore all the registers if platforms remains powered while suspended). In this way suspend/resume time could be improved. Signed-off-by: Claudiu Beznea --- include/linux/suspend.h | 6 ++++++ kernel/power/suspend.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 3f529ad9a9d2..21f19b167fe2 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -173,6 +173,9 @@ static inline void dpm_save_failed_step(enum suspend_stat_step step) * Called by the PM core if the suspending of devices fails. * This callback is optional and should only be implemented by platforms * which require special recovery actions in that situation. + * + * @off_in_suspend: Returns wheather the platform's power will be cut off at + * the end of suspend procedure or not. */ struct platform_suspend_ops { int (*valid)(suspend_state_t state); @@ -185,6 +188,7 @@ struct platform_suspend_ops { bool (*suspend_again)(void); void (*end)(void); void (*recover)(void); + bool (*off_in_suspend)(suspend_state_t state); }; struct platform_s2idle_ops { @@ -275,6 +279,7 @@ extern void arch_suspend_disable_irqs(void); extern void arch_suspend_enable_irqs(void); extern int pm_suspend(suspend_state_t state); +extern bool platform_off_in_suspend(suspend_state_t state); #else /* !CONFIG_SUSPEND */ #define suspend_valid_only_mem NULL @@ -287,6 +292,7 @@ static inline bool pm_suspend_via_s2idle(void) { return false; } static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } +static inline bool platform_off_in_suspend(suspend_state_t state) { return false; } static inline bool idle_should_enter_s2idle(void) { return false; } static inline void __init pm_states_init(void) {} static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {} diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 0bd595a0b610..e1f60c8a17b9 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -319,6 +319,19 @@ static bool platform_suspend_again(suspend_state_t state) suspend_ops->suspend_again() : false; } +/** + * platform_off_in_suspend() - specifies if SoC's power will pe cut off at the + * end of suspend procedure. + */ +bool platform_off_in_suspend(suspend_state_t state) +{ + if (!suspend_ops || !suspend_ops->off_in_suspend) + return false; + + return suspend_ops->off_in_suspend(state); +} +EXPORT_SYMBOL_GPL(platform_off_in_suspend); + #ifdef CONFIG_PM_DEBUG static unsigned int pm_test_delay = 5; module_param(pm_test_delay, uint, 0644); From patchwork Tue Jan 8 09:52:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10751745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F061014E5 for ; Tue, 8 Jan 2019 09:53:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA43D28B37 for ; Tue, 8 Jan 2019 09:53:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C747B28B61; Tue, 8 Jan 2019 09:53:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2EA5128B37 for ; Tue, 8 Jan 2019 09:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gTYIzaZMYzgnSQN3TgJO3U+F1yX/s1kmpod3TuSB/NI=; b=psS1ulANxVDTNf 4KXkoa0Wu7IVP9/Ca5JDMawiNRb1MyiK/ChlklwsGaaEFqPEN7XgwFCvWhueAlGg/7TE3EJOGaEi7 ESFkrpO0mlHaVPF+OVsOjyTupfffxp++fJv8lkgFyqoMkJct4MCyQUJEfLgKQexO9MqSZAXZYtOMO SAcwOcwU0rVug9ILSjxZ+cpwpljdNnuOgIzYCXumB++zkKwqbdgVg0YL3+uMzeltGcYz+R3y0o797 ZajE67FeYpHUf3bZSa6+QFeu9yXGRJ1P9lCGV87VN3i8zgQQp/b5MZwU/o9M1ePSAjQGMvkJa52vc Uy1ml35HioV6BRv5woig==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggo4v-0002DP-Kw; Tue, 08 Jan 2019 09:53:45 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggo4F-0001Xe-C3 for linux-arm-kernel@lists.infradead.org; Tue, 08 Jan 2019 09:53:11 +0000 X-IronPort-AV: E=Sophos;i="5.56,453,1539673200"; d="scan'208";a="25223860" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Jan 2019 02:52:59 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 8 Jan 2019 02:52:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XjbrXEvd0zPH7JipVlT1O9m5uxmU2/hsg98FIsTY8p0=; b=zTzH9c4eTDmAfhc5e1HZ5bZjDZNmw63WkzC6LTl4pxUSMzFE4V/oi5cdmIz9IaEJEtUXvDCu08YjVu9RGihVg6mVyqtLt0jS+nDitYoH8DUprxNh+azWW5CEKIDr2ju3E/3hCBSAAx3PVGaxAN62vW6XOKT0tTZlVz/tYcvAsdM= Received: from MWHPR11MB1920.namprd11.prod.outlook.com (10.175.54.19) by MWHPR11MB1838.namprd11.prod.outlook.com (10.175.53.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.13; Tue, 8 Jan 2019 09:52:57 +0000 Received: from MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::e553:ff9d:8c0b:9627]) by MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::e553:ff9d:8c0b:9627%6]) with mapi id 15.20.1516.010; Tue, 8 Jan 2019 09:52:57 +0000 From: To: , , , , , , , , Subject: [PATCH 2/3] regulator: core: add helper to check if regulator is disabled in suspend Thread-Topic: [PATCH 2/3] regulator: core: add helper to check if regulator is disabled in suspend Thread-Index: AQHUpzfuSbgXOYh/ZUy6GuHn+HLJVg== Date: Tue, 8 Jan 2019 09:52:57 +0000 Message-ID: <1546941147-18410-3-git-send-email-claudiu.beznea@microchip.com> References: <1546941147-18410-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1546941147-18410-1-git-send-email-claudiu.beznea@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0081.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::34) To MWHPR11MB1920.namprd11.prod.outlook.com (2603:10b6:300:110::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR11MB1838; 6:602outgIX2dsnktWSAyHb9hNItLEDmWWwWcFLsYrVorAdSAL0R2mnoFec3Zake0vD/hYycDzzeBJI7N5n+j4VNlBXmz2SdeRWP2MVTQXYWrDjr9LlUTqvgiPvh1v3S+QqV8x1eo7RzNIx99S3FgeKx9KpmqLipcvQ0mtBfFE52WyNfuk2pdso2uPOkNw7AYZvsmE8qrAYNr6PfxlDe0zR2am0fG9pnb8kZGjd0CsU73s7hEjp1ZfO3fjuDHMT0pM2g9kzwG8WcCCzGPnbUvzy2Kx/PxADO9EdJnWHJC7Fg3Ee1NyIvdibld0tdmQLuGCL9Mn0sfdij9D79hbBqPLkWN9jRKrCoTb3Xe+JNkdUUKKRI9qfKUI0Svdsn0dNj9Vo3gVvzH5XxvhU6cughgWgo60fFbRClrq1fdvTVyf1jb229oNJbiFlhi61ft5lUlfdocCONWWqXZv5cqOzAg7MA==; 5:oyYk+cZsM+o4/mnCLpE4ovd319EU280s+Xgm0zMbSM/rm/5NDT1hfSO9qaBcdT/KsrMrsqmaq35tYVxI5+XsoyPaTZ3VQq5vfd4RiKDWzD0OR2TvYFXvD41v2D72WRd91u8SXofudb7lEKqAI3W2yF81jh4g1056w73FD3293OG0n3Yew/D0ypJxp5RDoyysolj04434llts6xco/5ScWQ==; 7:EQzfr9LW7uOrBsanl7DRWltyXS+IAW9bAwXNysYsRlhKNlhDzmdwQq/NmrCFO/++gdLydIkEl8FXUizM+rArDqb58tMLRS2PuDfgtU1oQnPGhuh2BzCmjMo1O42hSyfCq9SkowIfBmU00lIt/eUUeA== x-ms-office365-filtering-correlation-id: 55135e29-257b-4285-c84e-08d6754f1105 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:MWHPR11MB1838; x-ms-traffictypediagnostic: MWHPR11MB1838: x-microsoft-antispam-prvs: x-forefront-prvs: 0911D5CE78 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(376002)(136003)(39860400002)(189003)(199004)(6436002)(110136005)(305945005)(107886003)(54906003)(6512007)(76176011)(52116002)(99286004)(8936002)(105586002)(53936002)(5660300001)(81166006)(7416002)(81156014)(8676002)(4326008)(39060400002)(7736002)(316002)(106356001)(25786009)(97736004)(36756003)(14454004)(72206003)(478600001)(6486002)(66066001)(68736007)(2501003)(15650500001)(486006)(386003)(6506007)(86362001)(476003)(2616005)(2906002)(71190400001)(71200400001)(186003)(14444005)(6116002)(3846002)(2201001)(102836004)(6346003)(11346002)(446003)(256004)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1838; H:MWHPR11MB1920.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Claudiu.Beznea@microchip.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: AqFDRG/eXvW6pL3P7KorPGW6hSvfWC9jyz1c8Jee0HCjqz77kX4WKCFUBQChw/VhsOZYIrPu56I/O/kcMs3Ym04rZVcP6LTprZv4nikQ7vr/rW00Ll2SRbEsfaPO3Dkb/a6CiSxDeEkiC53T6WZK0hJAk0N5n1Ztv65HuY/3ErJ1TsPo1h9QNPX9EvuZ/GruJv3/nYzFEBeRwvd3lmvLmR4I2SWBt8ieQt4LhTPdW6zbFuFFOITJkOVT2RIxXhh73Mp8iXEtJBPke+8fb9PF9J1sw8D6qlA6llYLdXmI15mpEFzCj9ZmsFxZSi98UBKD spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 55135e29-257b-4285-c84e-08d6754f1105 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2019 09:52:57.1674 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1838 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190108_015303_772572_E2A8E9D9 X-CRM114-Status: GOOD ( 10.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Claudiu.Beznea@microchip.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Claudiu Beznea Add helper to check if regulator will be disabled in suspend. Signed-off-by: Claudiu Beznea --- drivers/regulator/core.c | 17 +++++++++++++++++ include/linux/regulator/consumer.h | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index b9d7b45c7295..a876ec369450 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3786,6 +3786,23 @@ int regulator_suspend_disable(struct regulator_dev *rdev, } EXPORT_SYMBOL_GPL(regulator_suspend_disable); +bool regulator_is_disabled_in_suspend(struct regulator *regulator, + suspend_state_t state) +{ + struct regulator_state *rstate; + + if (!regulator->rdev->constraints) + return false; + + rstate = regulator_get_suspend_state(regulator->rdev, state); + if (!rstate) + return false; + + return !!(regulator->rdev->desc->ops->set_suspend_disable && + rstate->enabled == DISABLE_IN_SUSPEND); +} +EXPORT_SYMBOL_GPL(regulator_is_disabled_in_suspend); + static int _regulator_set_suspend_voltage(struct regulator *regulator, int min_uV, int max_uV, suspend_state_t state) diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f3f76051e8b0..cf5e71dc63ce 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -36,6 +36,7 @@ #define __LINUX_REGULATOR_CONSUMER_H_ #include +#include struct device; struct notifier_block; @@ -285,6 +286,9 @@ void devm_regulator_unregister_notifier(struct regulator *regulator, void *regulator_get_drvdata(struct regulator *regulator); void regulator_set_drvdata(struct regulator *regulator, void *data); +/* regulator suspend/resume state */ +bool regulator_is_disabled_in_suspend(struct regulator *regulator, + suspend_state_t state); #else /* @@ -579,6 +583,9 @@ static inline int regulator_list_voltage(struct regulator *regulator, unsigned s return -EINVAL; } +bool regulator_is_disabled_in_suspend(struct regulator *regulator, + suspend_state_t state); + #endif static inline int regulator_set_voltage_triplet(struct regulator *regulator, From patchwork Tue Jan 8 09:53:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10751747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D49FA13B5 for ; Tue, 8 Jan 2019 09:54:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF18228B37 for ; Tue, 8 Jan 2019 09:54:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B161928B61; Tue, 8 Jan 2019 09:54:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4890B28B37 for ; Tue, 8 Jan 2019 09:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d0TU3c/UoN6me3bxHOrX+bT1SvgCGkEqHf399qfVvDc=; b=gtMm25arlNw++G d4F4HxGPA8JqdUMusp68IrD+Nyt8I5t+UZ7p8rKeb45jAq6LWXPNwbC4FPL/dxRSvrzB9/y80RAcl C5HfDf+yVT6tTLMYKMEsHC4vXHdSUlTqett8e0eKR56w9/MRheuNxM9Fx4YAOI9Ryy8RHnRUBiJcd c8VapGiA36HBKMZD9EMb1dFb4At17ofhddNRTS9H/panyDy2vvW0fzvUAxmBx507zVQg5Ba5CNEnG ZH8QwD8fOs0XxaXwW3zAATfrC2oI6cIlxgiAyyKPtpL3Wyw0thjrAaGWdPDmk6jqJyB1+7dPOmkGd 28c25u06lJaXVoJKQcdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggo5B-0002SR-Ml; Tue, 08 Jan 2019 09:54:01 +0000 Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggo4H-0001b9-M4 for linux-arm-kernel@lists.infradead.org; Tue, 08 Jan 2019 09:53:17 +0000 X-IronPort-AV: E=Sophos;i="5.56,453,1539673200"; d="scan'208";a="22333610" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 08 Jan 2019 02:53:04 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 8 Jan 2019 02:53:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uau7BdXq5QSOlLW/aKr0JEZHPv8bSClmeerllYQSBZY=; b=JWbdhNHWAx/v+fCQ3ZkkC9aODwiI7xggfvjEVtSaQ9YNhpMqwlH691YvzemieW6w3woHUhkNQsAM+OvFCoM9T4g0vSKGckyZ/j/0hxSTfmAtabX0ZBREb+WBsLc9e2O7d6/2nR3QPwMDZdtfYrgy0ZrNRLkg5haO/Swjts35iw0= Received: from MWHPR11MB1920.namprd11.prod.outlook.com (10.175.54.19) by MWHPR11MB1838.namprd11.prod.outlook.com (10.175.53.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.13; Tue, 8 Jan 2019 09:53:01 +0000 Received: from MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::e553:ff9d:8c0b:9627]) by MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::e553:ff9d:8c0b:9627%6]) with mapi id 15.20.1516.010; Tue, 8 Jan 2019 09:53:01 +0000 From: To: , , , , , , , , Subject: [PATCH 3/3] ARM: at91: pm: add support for .off_in_suspend Thread-Topic: [PATCH 3/3] ARM: at91: pm: add support for .off_in_suspend Thread-Index: AQHUpzfx8DbDgJIZCk69o3YuClfTkQ== Date: Tue, 8 Jan 2019 09:53:01 +0000 Message-ID: <1546941147-18410-4-git-send-email-claudiu.beznea@microchip.com> References: <1546941147-18410-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1546941147-18410-1-git-send-email-claudiu.beznea@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0081.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::34) To MWHPR11MB1920.namprd11.prod.outlook.com (2603:10b6:300:110::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR11MB1838; 6:1Vq78gbFZTs0egHpUw2jz5XH0nckaT9KBJIrgjRPolSjd0WQhXG1++bVL+4c+bApTbN5YQQletz/HlSvWSDrCXOVM9weTgdHCd7UejorTWdYX9SYj3SE3UIMLXXiLHibmm75xhw4ho1egPOoPmIflPsWUSwfPGuDkyn+1Thpkqbzo04b2zCsQnXnj+dLSvaf1RHiKPDJ5DO6XccZLVtsjTIKBfm2UafWSjQj5QHmAxu6A/t/d9zYaFnusfi/CjLNGTji6sekuyNeeYpnLju02Wmakyce+9skL6WQpSIEzb1uqoNUOwu79ougu5ptgS5Qlnu26D8X2oFqmYhX9Zuxfjm4lgbR1g2UtMm81B6Ofq1mvCC2gVQsP3ULtW7s8vWANuwvgQQegAxEELAVYMynW40j03SQNSffdpT8lyrOqaUEzV+hd3ktWiOLYnUGX1SnSlqXpg8UQ7ZxizFQI/LZFw==; 5:6EWx5AakByioqhI2RrmW+ZZkga1w68w97GXVPjHWeR0vKWteWFq8a8/8BMhqeBynNkpIBvZ+Ke/PyaqKbbR/7qwBGfCuphXFIqyPMl641nNs9gTRemxXrn4h6+WiEur0iCL35DXKQnNwKkbjArf/svzE2UR5TwFYb6vnbUTeJRcfPsWie+YoAfHVlQ6BK/ZlmcyFsugIntOFQ3qLlBd2bg==; 7:Y9wYHRinGAy+4TpjSQ3EIz9nJqT6WlP2esirzRE7KfuK75ds/ZGi8/+hbzKpkuKOqkKjtneC4XcD89x/l5pYvc70ciWihZQziyinW5Vw6UMvrbyrDQIbPK/yS/FJgo7hVT88g+D5puq9LkyaTtBLtg== x-ms-office365-filtering-correlation-id: 5f760287-8539-46ac-7d20-08d6754f13a4 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:MWHPR11MB1838; x-ms-traffictypediagnostic: MWHPR11MB1838: x-microsoft-antispam-prvs: x-forefront-prvs: 0911D5CE78 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(396003)(366004)(346002)(376002)(136003)(39860400002)(189003)(199004)(6436002)(110136005)(305945005)(107886003)(54906003)(6512007)(76176011)(52116002)(99286004)(8936002)(105586002)(53936002)(5660300001)(81166006)(7416002)(81156014)(8676002)(4326008)(39060400002)(7736002)(316002)(106356001)(25786009)(97736004)(36756003)(14454004)(72206003)(478600001)(6486002)(66066001)(68736007)(2501003)(486006)(386003)(6506007)(86362001)(476003)(2616005)(2906002)(71190400001)(71200400001)(186003)(14444005)(6116002)(3846002)(2201001)(102836004)(6346003)(11346002)(446003)(256004)(26005)(142923001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1838; H:MWHPR11MB1920.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Claudiu.Beznea@microchip.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TgSauvBeWI+ueMtKJ0o9dcUL97nCBbSkq/CvL2qJUatiiOUGFvdRTSF07maDjPdv71AfOI4lFyrqMwOhTFAHTKM0U5/dYxcmSSCh+RbxJCRYsOtKMYrKgRa7R95P1kv1M0rwL8vONzRSH69ImCgeFD2czZZwsjB1U2RVxbquJ9RuaKYXlkC5EpKOQgTSU0aiwFG22WvWHRnA5Ioo34c75ZcUrGotHjlEiBqm2fAi1iEEVtYVXi16SJQgc6Ixiu0/c3aiaN0t+//rZ5COuJctHo7Uja5Yf22fAiz3pdFbmFSnM3taqTEIK7knso9wvdYL spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5f760287-8539-46ac-7d20-08d6754f13a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2019 09:53:01.5209 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1838 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190108_015306_623726_E4F8223A X-CRM114-Status: GOOD ( 13.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Claudiu.Beznea@microchip.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Claudiu Beznea Add support to check if platform is off in suspend. The check is based on pm_data.mode and CPU's regulator which will be turn off in suspend. Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 61 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 51e808adb00c..c404d92aa297 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -164,6 +165,47 @@ static int at91_pm_config_ws(unsigned int pm_mode, bool set) return mode ? 0 : -EPERM; } +static const struct of_device_id sama5d2_cpu_reg_ids[] = { + { .compatible = "active-semi,act8945a", .data = "VDD_1V2" }, + { /* sentinel */ } +}; + +static struct regulator *at91_pm_cpu_regulator_get(void) +{ + struct device *cpu_dev = get_cpu_device(0); + static struct regulator *cpu_reg; + const struct of_device_id *match; + struct platform_device *pdev; + struct device_node *np; + + if (!cpu_dev) + return cpu_reg; + + if (!cpu_reg) { + for_each_matching_node_and_match(np, sama5d2_cpu_reg_ids, + &match) { + pdev = of_find_device_by_node(np); + if (!pdev) + continue; + + cpu_reg = regulator_get(cpu_dev, match->data); + put_device(&pdev->dev); + break; + } + } + + return cpu_reg; +} + +static bool at91_pm_state_allowed(suspend_state_t state) +{ + struct regulator *reg; + + reg = at91_pm_cpu_regulator_get(); + + return !!(reg && regulator_is_disabled_in_suspend(reg, state)); +} + /* * Called after processes are frozen, but before we shutdown devices. */ @@ -182,6 +224,9 @@ static int at91_pm_begin(suspend_state_t state) pm_data.mode = -1; } + if (pm_data.mode == AT91_PM_BACKUP && !at91_pm_state_allowed(state)) + return -EPERM; + return at91_pm_config_ws(pm_data.mode, true); } @@ -321,12 +366,20 @@ static void at91_pm_end(void) at91_pm_config_ws(pm_data.mode, false); } +static bool at91_pm_off_in_suspend(suspend_state_t state) +{ + if (pm_data.mode != AT91_PM_BACKUP) + return false; + + return at91_pm_state_allowed(state); +} static const struct platform_suspend_ops at91_pm_ops = { - .valid = at91_pm_valid_state, - .begin = at91_pm_begin, - .enter = at91_pm_enter, - .end = at91_pm_end, + .valid = at91_pm_valid_state, + .begin = at91_pm_begin, + .enter = at91_pm_enter, + .end = at91_pm_end, + .off_in_suspend = at91_pm_off_in_suspend, }; static struct platform_device at91_cpuidle_device = {