From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC49C50254F; Tue, 29 Sep 2026 15:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790694330; cv=none; b=Dvxvq8+cDQysmscnxnYP61TZbKjF6C+Fj9qiU0Vq1Y3FbUlH6jkvvxK5nISUoKjUNaZaRutir6M1nPA2u+5P/diFIHBCEGigm40jIisUQJP/O3bUfYDeuw7YIF/c1xws/7CsCYI0HLOSUP5r0D6uEFMl5FuwBDgDZFSj9Wd5FWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790694330; c=relaxed/simple; bh=WWqjJQEjkD0s7A4uSP2PjCi96i5sa4nI4z/Kd/L3/o4=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=iFthsBqukDxTuIBcI2zo9FUNLCVSUOXjJjv3MRL5VR8YpGIZaMpq5efcf3bNqEX9XWFbq9kinTcrezPnPON+apl747RImKuxyBu0LILy4tVWMz+I5n0Dei98X27qVHA8xR7jv8jMst/sL33lB6s4lCbIU3b4yNLRmNGdbCqkBOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from edelgard.fodlan.icenowy.me (unknown [112.94.101.54]) by APP-05 (Coremail) with SMTP id zQCowADHMTyP07tq9ZavCQ--.14155S2; Tue, 29 Sep 2026 23:04:48 +0800 (CST) Message-ID: Subject: Re: [PATCH v4 13/20] soc: starfive: Add jh7110-vout-subsystem driver From: Icenowy Zheng To: Michal Wilczynski , Vinod Koul , Neil Armstrong , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrzej Hajda , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lee Jones , Andy Yan , Philipp Zabel , Emil Renner Berthing , Hal Feng , Michael Turquette , Stephen Boyd , Heiko Stuebner , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dominique Belhachemi , Brian Masney , Jerome Brunet Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, mfd@lists.linux.dev, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, Marek Szyprowski , Maud Spierings , Graham Markall , Chaoyi Chen , Joshua Peisach , Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= Date: Tue, 29 Sep 2026 23:04:46 +0800 In-Reply-To: <20260915-jh7110-clean-send-v4-13-f0e4fd6f2cc8@samsung.com> References: <20260915-jh7110-clean-send-v4-0-f0e4fd6f2cc8@samsung.com> <20260915-jh7110-clean-send-v4-13-f0e4fd6f2cc8@samsung.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID:zQCowADHMTyP07tq9ZavCQ--.14155S2 X-Coremail-Antispam: 1UD129KBjvJXoW3WrW3XFy7GFW7uFW7WrWDCFg_yoW7KF4rpF 4vyFy3CrW8Jr1fG3yFqa1jvFyrCw1Iva4j9r97X3W0vr1UCw12gwn2vryF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9=81=93=EF=BC=9A > Nothing in the video output subsystem can reach its own registers > until > the NoC display bus clock and reset are up and PD_VOUT is powered, > and > those are shared by every device in the region. Leaving them to > whichever > consumer probes first works by accident and stops working as soon as > the > probe order changes. >=20 > Add a driver for the subsystem node that takes the bus clock and > reset, > holds a runtime PM reference so genpd keeps PD_VOUT powered, and then > populates its children. All three are released only once the last > child > is gone. >=20 > Signed-off-by: Michal Wilczynski ``` Tested-by: Icenowy Zheng ``` Thanks, Icenowy > --- > =C2=A0drivers/soc/starfive/Kconfig=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 15 +++++ > =C2=A0drivers/soc/starfive/Makefile=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0drivers/soc/starfive/jh7110-vout-subsystem.c | 82 > ++++++++++++++++++++++++++++ > =C2=A03 files changed, 98 insertions(+) >=20 > diff --git a/drivers/soc/starfive/Kconfig > b/drivers/soc/starfive/Kconfig > index > e738638ab0f755fbbabca259264abb56f3b6101f..cf5e626b8a39a75768917eee188 > a79256b36f1aa 100644 > --- a/drivers/soc/starfive/Kconfig > +++ b/drivers/soc/starfive/Kconfig > @@ -6,6 +6,21 @@ > =C2=A0if ARCH_STARFIVE || COMPILE_TEST > =C2=A0menu "Starfive SoC drivers" > =C2=A0 > +config SOC_STARFIVE_JH7110_VOUT_SUBSYSTEM > + tristate "StarFive JH7110 video output subsystem driver" > + depends on OF > + select PM > + help > + =C2=A0 This option enables the parent driver for the StarFive > JH7110 > + =C2=A0 video output subsystem, which the documentation calls > dom_vout_top. > + > + =C2=A0 The subsystem covers the DC8200 display controller, the > HDMI > + =C2=A0 transmitter, the video output clock generator and the > video output > + =C2=A0 system controller. They share one NoC port whose clock and > reset > + =C2=A0 gate access to the whole register region, and the region > sits in > + =C2=A0 the PD_VOUT power domain. This driver owns those resources > and > + =C2=A0 holds them for as long as any of its children exist. > + > =C2=A0config SOC_STARFIVE_JH7110_HDMI_SUBSYSTEM > =C2=A0 tristate "StarFive JH7110 HDMI subsystem driver" > =C2=A0 depends on OF > diff --git a/drivers/soc/starfive/Makefile > b/drivers/soc/starfive/Makefile > index > be89d8119212b7a7038817c2f0e8eac1984ada88..6c229020c1e563b37df43f6ac16 > 65465a11333cc 100644 > --- a/drivers/soc/starfive/Makefile > +++ b/drivers/soc/starfive/Makefile > @@ -1,2 +1,3 @@ > =C2=A0# SPDX-License-Identifier: GPL-2.0-only > =C2=A0obj-$(CONFIG_SOC_STARFIVE_JH7110_HDMI_SUBSYSTEM) +=3D jh7110-hdmi- > subsystem.o > +obj-$(CONFIG_SOC_STARFIVE_JH7110_VOUT_SUBSYSTEM) +=3D jh7110-vout- > subsystem.o > diff --git a/drivers/soc/starfive/jh7110-vout-subsystem.c > b/drivers/soc/starfive/jh7110-vout-subsystem.c > new file mode 100644 > index > 0000000000000000000000000000000000000000..af632692e2139d9d07edd478a29 > 9b170ad1b7104 > --- /dev/null > +++ b/drivers/soc/starfive/jh7110-vout-subsystem.c > @@ -0,0 +1,82 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Driver for the StarFive JH7110 video output subsystem > + * > + * Copyright (c) 2025 Samsung Electronics Co., Ltd. > + * Author: Michal Wilczynski > + * > + * The display hardware sits behind a single NoC port whose clock > and reset > + * gate access to every register in the region, inside the PD_VOUT > power > + * domain. Nothing below this node can reach its own registers until > all three > + * are up, so bring them up here and hold them for as long as any > child device > + * exists, rather than leaving them to whichever consumer happens to > probe > + * first. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +static void jh7110_vout_subsys_pm_put(void *data) > +{ > + pm_runtime_put_sync(data); > +} > + > +static int jh7110_vout_subsys_probe(struct platform_device *pdev) > +{ > + struct device *dev =3D &pdev->dev; > + struct reset_control *bus_rst; > + struct clk *bus_clk; > + int ret; > + > + /* > + * Take a runtime PM reference for the lifetime of this > device. genpd > + * only keeps PD_VOUT powered while something actually holds > it, and > + * an unclocked or unpowered access to this region wedges > the bus. > + */ > + ret =3D devm_pm_runtime_enable(dev); > + if (ret) > + return ret; > + > + ret =3D pm_runtime_resume_and_get(dev); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to power on > PD_VOUT\n"); > + > + ret =3D devm_add_action_or_reset(dev, > jh7110_vout_subsys_pm_put, dev); > + if (ret) > + return ret; > + > + bus_clk =3D devm_clk_get_enabled(dev, NULL); > + if (IS_ERR(bus_clk)) > + return dev_err_probe(dev, PTR_ERR(bus_clk), > + =C2=A0=C2=A0=C2=A0=C2=A0 "Failed to enable NoC bus > clock\n"); > + > + bus_rst =3D devm_reset_control_get_exclusive_deasserted(dev, > NULL); > + if (IS_ERR(bus_rst)) > + return dev_err_probe(dev, PTR_ERR(bus_rst), > + =C2=A0=C2=A0=C2=A0=C2=A0 "Failed to deassert NoC bus > reset\n"); > + > + return devm_of_platform_populate(dev); > +} > + > +static const struct of_device_id jh7110_vout_subsys_of_match[] =3D { > + { .compatible =3D "starfive,jh7110-vout-subsystem", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, jh7110_vout_subsys_of_match); > + > +static struct platform_driver jh7110_vout_subsys_driver =3D { > + .probe =3D jh7110_vout_subsys_probe, > + .driver =3D { > + .name =3D "jh7110-vout-subsystem", > + .of_match_table =3D jh7110_vout_subsys_of_match, > + }, > +}; > +module_platform_driver(jh7110_vout_subsys_driver); > + > +MODULE_AUTHOR("Michal Wilczynski "); > +MODULE_DESCRIPTION("StarFive JH7110 video output subsystem driver"); > +MODULE_LICENSE("GPL");