All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Kepplinger <martin.kepplinger@puri.sm>
To: l.stach@pengutronix.de
Cc: aford173@gmail.com, devicetree@vger.kernel.org,
	festevam@gmail.com, frieder.schrempf@kontron.de,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-imx@nxp.com, marex@denx.de, patchwork-lst@pengutronix.de,
	robh@kernel.org, shawnguo@kernel.org, tharvey@gateworks.com,
	Martin Kepplinger <martin.kepplinger@puri.sm>
Subject: [PATCH] hack: soc: imx: gpcv2: avoid unbalanced powering off of one device
Date: Wed,  8 Dec 2021 14:47:25 +0100	[thread overview]
Message-ID: <20211208134725.3328030-1-martin.kepplinger@puri.sm> (raw)
In-Reply-To: <20211002005954.1367653-8-l.stach@pengutronix.de>


Hi Lucas,

I've posted this hack with a report here a few days back:
https://lore.kernel.org/linux-arm-kernel/20211122115145.177196-1-martin.kepplinger@puri.sm/

But now that I see these suspend/resume callback additions things
again go wrong on my imx8mq system.

With a v5.16-rc4 based tree and printing on regulator enable/disable,
system suspend + resume looks like so:

[   47.559681] imx-pgc imx-pgc-domain.5: enable
[   47.584679] imx-pgc imx-pgc-domain.0: disable
[   47.646592] imx-pgc imx-pgc-domain.5: disable
[   47.823627] imx-pgc imx-pgc-domain.5: enable
[   47.994805] imx-pgc imx-pgc-domain.5: disable
[   48.664018] imx-pgc imx-pgc-domain.5: enable
[   48.805828] imx-pgc imx-pgc-domain.5: disable
[   49.909579] imx-pgc imx-pgc-domain.6: enable
[   50.013079] imx-pgc imx-pgc-domain.6: failed to enable regulator: -110
[   50.013686] imx-pgc imx-pgc-domain.5: enable
[   50.120224] imx-pgc imx-pgc-domain.5: failed to enable regulator: -110
[   50.120324] imx-pgc imx-pgc-domain.0: enable
[   53.703468] imx-pgc imx-pgc-domain.0: disable
[   53.746368] imx-pgc imx-pgc-domain.5: disable
[   53.754452] imx-pgc imx-pgc-domain.5: failed to disable regulator: -5
[   53.765045] imx-pgc imx-pgc-domain.6: disable
[   53.822269] imx-pgc imx-pgc-domain.6: failed to disable regulator: -5


But my main point is that the situation is a bit hard to understand
right now. when transitioning to system suspend we expect (if disabled)
enable+disable to happen, right? and after resuming: enable (+ runtime disable).
Makes sense functinally, but I wonder if we could implement it a bit clearer?

Anyway I'm also not sure whether imx8mq might be different than your
imx8mm system.

When I revert your one patch and add my hack below again, things
work again and the system resumes without errors.

Can you imagine what might be missing here?

thanks a lot for working on this!

                               martin
---
 drivers/soc/imx/gpcv2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 07610bf87854..898886c9d799 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -319,6 +319,9 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd)
 	u32 reg_val, pgc;
 	int ret;
 
+	if (pm_runtime_suspended(domain->dev))
+		return 0;
+
 	/* Enable reset clocks for all devices in the domain */
 	if (!domain->keep_clocks) {
 		ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Martin Kepplinger <martin.kepplinger@puri.sm>
To: l.stach@pengutronix.de
Cc: aford173@gmail.com, devicetree@vger.kernel.org,
	festevam@gmail.com, frieder.schrempf@kontron.de,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-imx@nxp.com, marex@denx.de, patchwork-lst@pengutronix.de,
	robh@kernel.org, shawnguo@kernel.org, tharvey@gateworks.com,
	Martin Kepplinger <martin.kepplinger@puri.sm>
Subject: [PATCH] hack: soc: imx: gpcv2: avoid unbalanced powering off of one device
Date: Wed,  8 Dec 2021 14:47:25 +0100	[thread overview]
Message-ID: <20211208134725.3328030-1-martin.kepplinger@puri.sm> (raw)
In-Reply-To: <20211002005954.1367653-8-l.stach@pengutronix.de>


Hi Lucas,

I've posted this hack with a report here a few days back:
https://lore.kernel.org/linux-arm-kernel/20211122115145.177196-1-martin.kepplinger@puri.sm/

But now that I see these suspend/resume callback additions things
again go wrong on my imx8mq system.

With a v5.16-rc4 based tree and printing on regulator enable/disable,
system suspend + resume looks like so:

[   47.559681] imx-pgc imx-pgc-domain.5: enable
[   47.584679] imx-pgc imx-pgc-domain.0: disable
[   47.646592] imx-pgc imx-pgc-domain.5: disable
[   47.823627] imx-pgc imx-pgc-domain.5: enable
[   47.994805] imx-pgc imx-pgc-domain.5: disable
[   48.664018] imx-pgc imx-pgc-domain.5: enable
[   48.805828] imx-pgc imx-pgc-domain.5: disable
[   49.909579] imx-pgc imx-pgc-domain.6: enable
[   50.013079] imx-pgc imx-pgc-domain.6: failed to enable regulator: -110
[   50.013686] imx-pgc imx-pgc-domain.5: enable
[   50.120224] imx-pgc imx-pgc-domain.5: failed to enable regulator: -110
[   50.120324] imx-pgc imx-pgc-domain.0: enable
[   53.703468] imx-pgc imx-pgc-domain.0: disable
[   53.746368] imx-pgc imx-pgc-domain.5: disable
[   53.754452] imx-pgc imx-pgc-domain.5: failed to disable regulator: -5
[   53.765045] imx-pgc imx-pgc-domain.6: disable
[   53.822269] imx-pgc imx-pgc-domain.6: failed to disable regulator: -5


But my main point is that the situation is a bit hard to understand
right now. when transitioning to system suspend we expect (if disabled)
enable+disable to happen, right? and after resuming: enable (+ runtime disable).
Makes sense functinally, but I wonder if we could implement it a bit clearer?

Anyway I'm also not sure whether imx8mq might be different than your
imx8mm system.

When I revert your one patch and add my hack below again, things
work again and the system resumes without errors.

Can you imagine what might be missing here?

thanks a lot for working on this!

                               martin
---
 drivers/soc/imx/gpcv2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 07610bf87854..898886c9d799 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -319,6 +319,9 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd)
 	u32 reg_val, pgc;
 	int ret;
 
+	if (pm_runtime_suspended(domain->dev))
+		return 0;
+
 	/* Enable reset clocks for all devices in the domain */
 	if (!domain->keep_clocks) {
 		ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-08 13:48 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02  0:59 [PATCH v5 00/18] i.MX8MM GPC improvements and BLK_CTRL driver Lucas Stach
2021-10-02  0:59 ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 01/18] Revert "soc: imx: gpcv2: move reset assert after requesting domain power up" Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-03 10:43   ` Adam Ford
2021-10-03 10:43     ` Adam Ford
2021-10-03 19:46     ` Lucas Stach
2021-10-03 19:46       ` Lucas Stach
2021-10-04  0:03       ` Adam Ford
2021-10-04  0:03         ` Adam Ford
2021-10-02  0:59 ` [PATCH v5 02/18] soc: imx: gpcv2: Turn domain->pgc into bitfield Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 03/18] soc: imx: gpcv2: Set both GPC_PGC_nCTRL(GPU_2D|GPU_3D) for MX8MM GPU domain Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 04/18] soc: imx: gpcv2: add lockdep annotation Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 05/18] soc: imx: gpcv2: add domain option to keep domain clocks enabled Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 06/18] soc: imx: gpcv2: keep i.MX8M* bus " Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 07/18] soc: imx: gpcv2: support system suspend/resume Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-12-08 13:47   ` Martin Kepplinger [this message]
2021-12-08 13:47     ` [PATCH] hack: soc: imx: gpcv2: avoid unbalanced powering off of one device Martin Kepplinger
2021-12-08 14:05     ` Lucas Stach
2021-12-08 14:05       ` Lucas Stach
2021-12-22  8:12       ` Martin Kepplinger
2021-12-22  8:12         ` Martin Kepplinger
2021-10-02  0:59 ` [PATCH v5 08/18] dt-bindings: soc: add binding for i.MX8MM VPU blk-ctrl Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 09/18] dt-bindings: power: imx8mm: add defines for VPU blk-ctrl domains Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 10/18] soc: imx: add i.MX8M blk-ctrl driver Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 11/18] dt-bindings: soc: add binding for i.MX8MM DISP blk-ctrl Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 12/18] dt-bindings: power: imx8mm: add defines for DISP blk-ctrl domains Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 13/18] soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 14/18] arm64: dts: imx8mm: add GPC node Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 15/18] arm64: dts: imx8mm: put USB controllers into power-domains Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 16/18] arm64: dts: imx8mm: Add GPU nodes for 2D and 3D core Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 17/18] arm64: dts: imx8mm: add VPU blk-ctrl Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-02  0:59 ` [PATCH v5 18/18] arm64: dts: imx8mm: add DISP blk-ctrl Lucas Stach
2021-10-02  0:59   ` Lucas Stach
2021-10-05  6:40 ` [PATCH v5 00/18] i.MX8MM GPC improvements and BLK_CTRL driver Shawn Guo
2021-10-05  6:40   ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211208134725.3328030-1-martin.kepplinger@puri.sm \
    --to=martin.kepplinger@puri.sm \
    --cc=aford173@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=marex@denx.de \
    --cc=patchwork-lst@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.