From patchwork Mon Jul 11 09:45:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 12913204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00B51C43334 for ; Mon, 11 Jul 2022 09:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lo+ISMnTVgXW70UVGljf1cZpAlk9UfSp2yKIqDeyeEk=; b=cbNGGos3Z2cB5n t/22bGD45PoSUPdQ67QsCpBySD7WNwgDV5rHb1oyqH4PyK6F3NP0K2g0pEJwbYPqLbn0WnFKAPUXN frJ0COUp7t8GemqS5R9xF2J7EL5tjX1mMsK2I+/G4jAwEL0D2waBXQN5wHhvz7NAXKtZTOpG1ezJ+ x4GPoYI5BjqmEXq9tHFN4Yy+s84P8jsQnhhvhkN20ibbs6n62sDO8TAbCoEc3zNjdkvjcWXTUk5ph nvayDv/o55NKl2Zs9QcFxKf1ks59cNGdshC+UwY28+1z/jan0W5PLKsfid4OFdLKdL7H7+VV37HBL WArbCqzLohrRNb9EjeKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAq0X-000JBV-Ba; Mon, 11 Jul 2022 09:47:13 +0000 Received: from comms.puri.sm ([159.203.221.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAq0L-000Ixm-Pf for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 09:47:03 +0000 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 986B6E0090; Mon, 11 Jul 2022 02:46:24 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uv09orjE0Q0L; Mon, 11 Jul 2022 02:46:23 -0700 (PDT) From: Martin Kepplinger DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=puri.sm; s=comms; t=1657532783; bh=xRZj8xi+fQlByAMa9+liyCTkl4j540l3J57WaZpwvHQ=; h=From:To:Cc:Subject:Date:From; b=GUw3eCZFeBYWQNkZyl5Jp57hvHC5GlKaA5jVjgVTKMY+0uvJkKJFXHceyGTZ8eOy+ CZIUVjJdszsYsp+9BOZkSZXdzzVIlmJWUXc7TOa+/fDzwxqbBMkiXKbVBQjB86ShK1 C0BDP/DGbrSqVzcz3olhT8HONGot8CBLi851YQA64GC0J+/G1kSUS/BEUiQtXryoEU j5yfvsymSjfWE5PRiRJxrm6la9cWMVGQ1/aNWCqqMGZT15YewF5YpGQwtDTokTFZzq 0wxlqpqdDezyVnS48iJt2cmCdqjBDLw9hbGhgtAkfYX+FJvI8hWaok3lQJkrXNu98p WJR5Yw1sMy9Hg== To: rafael@kernel.org, khilman@kernel.org, ulf.hansson@linaro.org, robh@kernel.org, krzysztof.kozlowski@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, pavel@ucw.cz Cc: kernel@puri.sm, linux-imx@nxp.com, broonie@kernel.org, l.stach@pengutronix.de, aford173@gmail.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Martin Kepplinger Subject: [PATCH v1 1/3] power: domain: handle power supplies that need irq Date: Mon, 11 Jul 2022 11:45:47 +0200 Message-Id: <20220711094549.3445566-1-martin.kepplinger@puri.sm> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_024701_855736_6AB3AF40 X-CRM114-Status: GOOD ( 10.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Handle a new DT property power-supply-needs-irq that boards can use if the power-domains' power-supply node (regulator) needs interrupts to function. An example is a pmic regulator on i2c. Since suspend/resume doesn't work in these cases currently, switch to the normal, outer suspend/resume callbacks. Usually such a regulator already times out during suspend_noirq: [ 41.024193] buck4: failed to disable: -ETIMEDOUT Initially systemd suspend problems had been discussed at https://lore.kernel.org/linux-arm-kernel/20211002005954.1367653-8-l.stach@pengutronix.de/ which led to discussing the pmic that contains the regulators which serve as power-domain power-supplies: https://lore.kernel.org/linux-pm/573166b75e524517782471c2b7f96e03fd93d175.camel@puri.sm/T/ So this enables boards to use power-supply-needs-irq and fix systemd suspend and resume. Possibly one can find more changes this property should configure. They can be added later when testing them. Signed-off-by: Martin Kepplinger --- drivers/base/power/domain.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 3e86772d5fac..c8fecba2c191 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2298,6 +2298,16 @@ static bool genpd_present(const struct generic_pm_domain *genpd) return ret; } +static void of_genpd_get_power_supply_irq(struct generic_pm_domain *pd) +{ + if (of_property_read_bool(pd->dev.of_node, "power-supply-needs-irq")) { + pd->domain.ops.suspend = genpd_suspend_noirq; + pd->domain.ops.resume = genpd_resume_noirq; + pd->domain.ops.suspend_noirq = NULL; + pd->domain.ops.resume_noirq = NULL; + } +} + /** * of_genpd_add_provider_simple() - Register a simple PM domain provider * @np: Device node pointer associated with the PM domain provider. @@ -2343,6 +2353,8 @@ int of_genpd_add_provider_simple(struct device_node *np, genpd->provider = &np->fwnode; genpd->has_provider = true; + of_genpd_get_power_supply_irq(genpd); + return 0; } EXPORT_SYMBOL_GPL(of_genpd_add_provider_simple); @@ -2394,6 +2406,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, genpd->provider = &np->fwnode; genpd->has_provider = true; + + of_genpd_get_power_supply_irq(genpd); } ret = genpd_add_provider(np, data->xlate, data); From patchwork Mon Jul 11 09:45:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 12913203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6EE9C43334 for ; Mon, 11 Jul 2022 09:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AVa5PbPaPCCArZg1ITX47v1FLhjCY4yZEhlHpbwB0Rk=; b=jmx31CD7u3uB0F JV56EG/hWtDz/bbjxiX9qu/r9tXtmX3xsO5cT5jbLbrmDNhulz7Lrti/dYa/pdpope+j2ArTRvUyF 9nk8cEw8tq4MitDzKYZQ2sKHaLi+hV1eJhgKnkUstcAfrIod4YLWE4wTNFkNYvYg6LGmcHpGdUdbu pEjet7HMEIo8Cbu8JDinmACF51LsLXK162kr/g3WSqdlXAPX+HBmLEyUD8i9RY80Eib3RKGwL6xo4 wSpTL18btzVIkkZ4rMaKr992pJ85QGZIG3AwIuI9nMYRynzdF0AGgk/thtSL3xbfeQoI82K1Ka+5W JPOgwk3zplEDFuW9ZxMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAq0O-000J1o-Jc; Mon, 11 Jul 2022 09:47:04 +0000 Received: from comms.puri.sm ([159.203.221.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAq0L-000IyC-Op for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 09:47:02 +0000 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id C1B8CE009F; Mon, 11 Jul 2022 02:46:29 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P0BZemjs-lfy; Mon, 11 Jul 2022 02:46:29 -0700 (PDT) From: Martin Kepplinger DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=puri.sm; s=comms; t=1657532789; bh=1v2XP+X0BV0+f8lDEvEGGuJl3IIyEoqp6P3bTpGegCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X7wts7AYrBwHrw2A/AKQVaDj0/QiuR67dbYSwOxWRq3uUKEC4jiMZ3kDWbNf/Iv2s x1tkIn84gzT35OIBWfYkMatpVMXtv4KqL3DehQ4He8rjMvftVfSTa8UC3fZy/MqTPE IAZDivY18pJQ30B4gqQIAdqKm9v+U+JAlrV1a5hmt4Pv8jHO9PlmuzSYwt3v+RSFS7 KsXZwEOLCeW3yxsKZm5EXK31F3M9mJkQo3/2YthjK9OFJ6EY3/Yzajp9J7Akvcu20Z 1gEXIrOkG1XC3ZnhbLZfJS7LTrO82zwz7pUY0KCta6Z0vjH1wSm29YGza9FDFDOlT9 WKFKx4WSpynFg== To: rafael@kernel.org, khilman@kernel.org, ulf.hansson@linaro.org, robh@kernel.org, krzysztof.kozlowski@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, pavel@ucw.cz Cc: kernel@puri.sm, linux-imx@nxp.com, broonie@kernel.org, l.stach@pengutronix.de, aford173@gmail.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Martin Kepplinger Subject: [PATCH v1 2/3] dt-binding: power: power-domain: add power-supply-needs-irq Date: Mon, 11 Jul 2022 11:45:48 +0200 Message-Id: <20220711094549.3445566-2-martin.kepplinger@puri.sm> In-Reply-To: <20220711094549.3445566-1-martin.kepplinger@puri.sm> References: <20220711094549.3445566-1-martin.kepplinger@puri.sm> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_024701_856013_C1E77F29 X-CRM114-Status: UNSURE ( 8.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the power-supply-needs-irq board description property for power domains. Signed-off-by: Martin Kepplinger --- .../devicetree/bindings/power/power-domain.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/power/power-domain.yaml b/Documentation/devicetree/bindings/power/power-domain.yaml index 889091b9814f..e82c2f7ccb97 100644 --- a/Documentation/devicetree/bindings/power/power-domain.yaml +++ b/Documentation/devicetree/bindings/power/power-domain.yaml @@ -70,6 +70,16 @@ properties: by the given provider should be subdomains of the domain specified by this binding. + power-supply: true + + power-supply-needs-irq: + type: boolean + description: + A power-supply can link for example to a regulator controlled via + i2c or otherwise needing interrupts enabled to be able to enable and + disable. This property makes various callbacks usually run in the + noirq phase, being run when interrupts are available. + required: - "#power-domain-cells" From patchwork Mon Jul 11 09:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 12913205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB54FC43334 for ; Mon, 11 Jul 2022 09:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jFR6InrnaBw0wIOLlUxVfUC75u840nzhIjqTG5/8KaQ=; b=vTpN0FbLMDBdOT uQYRGyJsrkUZHgMPSDiihH7fBE00egw7cuFWiObIBRVuUAFE7XbKV5njBctCEG5Jgp4tqYDxdWpS4 ukpIHu1tdoQnfQk/n9uyS8t5Ku+oobsuZtgf86G7wkf+EuK6plGiftVZc3BWn3nm0Cjzy7hpTWJN+ Dw698ka2RrX/qLMLsLKF3ol73n6f0l/KW+VQ5l9KSeMBkDuNNWnyUwOwzo0/M990x/SQTAKBbKk7y lRS+0Vu0EppefhxAozq1d+bN4Ix7T/7Dign80DgwmRl51LjNt9OvF/DafW7tH/HjqONk4gNMbkUuB UI/OgBYKss+7s/tsWB3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAq0f-000JLd-Ut; Mon, 11 Jul 2022 09:47:22 +0000 Received: from comms.puri.sm ([159.203.221.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAq0O-000J2M-Fu for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 09:47:05 +0000 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 4FD5CE008C; Mon, 11 Jul 2022 02:46:34 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WZ3W3IKfRroK; Mon, 11 Jul 2022 02:46:33 -0700 (PDT) From: Martin Kepplinger DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=puri.sm; s=comms; t=1657532793; bh=SIVg2R/dN6S1hh+ase98JVSdxk9pJlViqrkTdBueOtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=buz6fZx3y+cLK55HEj14phepTYXyAj71aD+cyoybxAxfN7gRYhvT8ypeXwmDkriNh bIqJ09oVJLi0BqNoIf/2pY0HBM4ABWN6YASayJISkCT7gg0k548ZWKlmhWxVD5Kp4o J1QH4YL2r/Adxzl8mxoewup2TymDC7CAKCadBKLAqd/7f2SjwAW+LNj38FVs+S7xLd tlNRuUC3EvdhaBKx6mpIFXIzfHvUO9n39QydkXGjfgRKDdzUSNk1sYC6K9fUVc3QQZ N2Bp4PQjOw8qnA24GmKCy3rIzAeDscdhL877ElJij6Sw3xKAVTFVmcy+rz82zDlj4r sON2J1NjvORHQ== To: rafael@kernel.org, khilman@kernel.org, ulf.hansson@linaro.org, robh@kernel.org, krzysztof.kozlowski@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, pavel@ucw.cz Cc: kernel@puri.sm, linux-imx@nxp.com, broonie@kernel.org, l.stach@pengutronix.de, aford173@gmail.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Martin Kepplinger Subject: [PATCH v1 3/3] arm64: dts: imx8mq-librem5: set pd power-supply-needs-irq when needed Date: Mon, 11 Jul 2022 11:45:49 +0200 Message-Id: <20220711094549.3445566-3-martin.kepplinger@puri.sm> In-Reply-To: <20220711094549.3445566-1-martin.kepplinger@puri.sm> References: <20220711094549.3445566-1-martin.kepplinger@puri.sm> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_024704_556136_A0B24ED5 X-CRM114-Status: UNSURE ( 7.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For the pgc power-supply nodes on the librem5 board, interrupts are always needed for them to work as they are regulators controlled via i2c. Signed-off-by: Martin Kepplinger --- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi index 9eec8a7eecfc..1b445cbfdc78 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi @@ -1159,14 +1159,17 @@ mipi_dsi_out: endpoint { &pgc_gpu { power-supply = <&buck3_reg>; + power-supply-needs-irq; }; &pgc_mipi { power-supply = <&ldo5_reg>; + power-supply-needs-irq; }; &pgc_vpu { power-supply = <&buck4_reg>; + power-supply-needs-irq; }; &pwm1 {