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,