All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] power-domain: Enable uclass refcounting
@ 2025-04-25  6:49 Miquel Raynal
  2025-04-25  6:49 ` [PATCH 1/2] power-domain: Add support for refcounting (again) Miquel Raynal
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Miquel Raynal @ 2025-04-25  6:49 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Jaehoon Chung
  Cc: Thomas Petazzoni, u-boot, Samuel Holland, Neha Malcom Francis,
	Wadim Egorov, Heiko Schocher, Fabio Estevam, Miquel Raynal

On one side we have a power domain uclass which is mostly clueless about
the topology of the power domains it manages.

On the other side we have SoCs which are getting more and more complex,
ie. with several layers of power domains. Sometimes (eg. on TI K3
platforms) all power domains are defined by a single device tree node
and the "subdomains" are referenced using an identification
cell (#power-domain-cells = <1 or more>). Sometimes however (eg. on NXP
i.MX8 SoCs), the description uses many device tree nodes.

When a power domain is referenced several times, it is likely that the
power_domain_on() function will be called several times in a row, which
in some cases may lead to glitches or even breakages. This situation is
problematic on i.MX8MP and only with proper reference counting we can
safely support the video pipeline.

There was a first attempt to bring refcount support to the power domain
uclass, but it miserably failed because of the details mentioned
above:
https://lore.kernel.org/u-boot/20250403-ge-mainline-display-support-v6-5-478b5e3dd872@bootlin.com/

So here is a new version of it, which takes into consideration:
- the fact that a single power domain udev can target several power
domain IDs (referred as "subdomains")
- the fact that some platforms might count on a uneven count of on/off
calls to work, and "fixing" this may break the platforms.

So refcounting is an opt-in parameter, it is a matter of filling the
platform (public part of a per-uclass structure) subdomains number with
the number of subdomains this device nodes features (one per
power_domain->id) in the probe function of the power domain driver.

This series shows how it can be done by enabling refcounting on i.MX8MP.

Samuel, Neha, Wadim, Heiko, could you please confirm it works on your
side?

For once, CI is green :-)
https://github.com/u-boot/u-boot/pull/753

---
Miquel Raynal (2):
      power-domain: Add support for refcounting (again)
      imx: power-domain: Enable refcounting on imx8mp

 arch/sandbox/include/asm/power-domain.h          |  2 +
 drivers/firmware/scmi/sandbox-scmi_devices.c     |  1 +
 drivers/power/domain/imx8m-power-domain.c        |  4 ++
 drivers/power/domain/imx8mp-hsiomix.c            |  4 ++
 drivers/power/domain/imx8mp-mediamix.c           |  4 ++
 drivers/power/domain/power-domain-uclass.c       | 90 ++++++++++++++++++++++--
 drivers/power/domain/sandbox-power-domain-test.c | 15 ++++
 drivers/power/domain/sandbox-power-domain.c      |  4 ++
 include/power-domain.h                           | 69 +++++++++++++++---
 test/dm/power-domain.c                           | 11 ++-
 10 files changed, 189 insertions(+), 15 deletions(-)
---
base-commit: 233fda6af674736dbc6ff37a9ef003b9fa4b8074
change-id: 20250424-ge-ian-display-support-a305ddb47f2b

Best regards,
-- 
Miquel Raynal <miquel.raynal@bootlin.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-07-22  8:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25  6:49 [PATCH 0/2] power-domain: Enable uclass refcounting Miquel Raynal
2025-04-25  6:49 ` [PATCH 1/2] power-domain: Add support for refcounting (again) Miquel Raynal
2025-04-25  8:57   ` Wadim Egorov
2025-04-25  9:49   ` Neha Malcom Francis
2025-04-25 11:12   ` Heiko Schocher
2025-04-25  6:49 ` [PATCH 2/2] imx: power-domain: Enable refcounting on imx8mp Miquel Raynal
2025-04-25 11:13   ` Heiko Schocher
2025-07-21 16:01   ` Frieder Schrempf
2025-07-22  4:43     ` Neha Malcom Francis
2025-07-22  7:26     ` Frieder Schrempf
2025-07-22  8:32       ` Frieder Schrempf
2025-04-25  8:56 ` [PATCH 0/2] power-domain: Enable uclass refcounting Wadim Egorov
2025-04-28 16:11 ` Fabio Estevam

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.