[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251108-jh7110-clean-send-v1-8-06bf43bb76b1@samsung.com>
Date: Sat, 08 Nov 2025 02:04:42 +0100
From: Michal Wilczynski <m.wilczynski@...sung.com>
To: Michal Wilczynski <m.wilczynski@...sung.com>, Conor Dooley
<conor@...nel.org>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Emil Renner Berthing <kernel@...il.dk>, Hal Feng
<hal.feng@...rfivetech.com>, Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Xingyu
Wu <xingyu.wu@...rfivetech.com>, Vinod Koul <vkoul@...nel.org>, Kishon
Vijay Abraham I <kishon@...nel.org>, Andrzej Hajda
<andrzej.hajda@...el.com>, Neil Armstrong <neil.armstrong@...aro.org>,
Robert Foss <rfoss@...nel.org>, Laurent Pinchart
<Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>, David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, Lee Jones <lee@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, Paul Walmsley
<paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, Albert Ou
<aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>, Marek Szyprowski
<m.szyprowski@...sung.com>, Icenowy Zheng <uwu@...nowy.me>, Maud Spierings
<maudspierings@...ontroll.com>, Andy Yan <andyshrk@....com>, Heiko Stuebner
<heiko@...ech.de>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, linux-phy@...ts.infradead.org,
dri-devel@...ts.freedesktop.org, linux-riscv@...ts.infradead.org
Subject: [PATCH RFC 08/13] soc: starfive: Add jh7110-vout-subsystem driver
Add the wrapper driver for the StarFive JH7110 VOUT subsystem.
This driver is responsible for managing the shared resources for all
video output devices. It enables the PD_VOUT power domain, enables the
top-level NoC bus clock, and deasserts the main bus reset.
Once these resources are active, it calls of_platform_populate() to
create and probe the child devices (DC8200, VOUTCRG, HDMI MFD) that
reside within this subsystem.
Signed-off-by: Michal Wilczynski <m.wilczynski@...sung.com>
---
MAINTAINERS | 1 +
drivers/soc/Kconfig | 1 +
drivers/soc/Makefile | 1 +
drivers/soc/starfive/Kconfig | 25 ++++++
drivers/soc/starfive/Makefile | 2 +
drivers/soc/starfive/jh7110-vout-subsystem.c | 117 +++++++++++++++++++++++++++
6 files changed, 147 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 052876c6538f980f75ff64e78b6ebea460307904..74e562a6b57ac9f776c4be2d6f0977c62bc03d46 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -24051,6 +24051,7 @@ F: Documentation/devicetree/bindings/display/bridge/starfive,jh7110-inno-hdmi-co
F: Documentation/devicetree/bindings/mfd/starfive,jh7110-hdmi-mfd.yaml
F: Documentation/devicetree/bindings/phy/starfive,jh7110-inno-hdmi-phy.yaml
F: Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-vout-subsystem.yaml
+F: drivers/soc/starfive/jh7110-vout-subsystem.c
STARFIVE JH7110 DPHY RX DRIVER
M: Jack Zhu <jack.zhu@...rfivetech.com>
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index a2d65adffb8052c0ac5a6b60bf33fa9c644701bb..b3b01fc38139d98076c14f626a42ae3b7ef7c5d6 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -24,6 +24,7 @@ source "drivers/soc/renesas/Kconfig"
source "drivers/soc/rockchip/Kconfig"
source "drivers/soc/samsung/Kconfig"
source "drivers/soc/sophgo/Kconfig"
+source "drivers/soc/starfive/Kconfig"
source "drivers/soc/sunxi/Kconfig"
source "drivers/soc/tegra/Kconfig"
source "drivers/soc/ti/Kconfig"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index c9e689080ceb759384f690c2b65a82b3cb451c74..009f85ff891a15e0455f92c5d5a4059d8b1fcd3f 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -30,6 +30,7 @@ obj-y += renesas/
obj-y += rockchip/
obj-$(CONFIG_SOC_SAMSUNG) += samsung/
obj-y += sophgo/
+obj-y += starfive/
obj-y += sunxi/
obj-$(CONFIG_ARCH_TEGRA) += tegra/
obj-y += ti/
diff --git a/drivers/soc/starfive/Kconfig b/drivers/soc/starfive/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..47e82aaaa7e0af9d5c718166601c59c1ca683d3a
--- /dev/null
+++ b/drivers/soc/starfive/Kconfig
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Starfive SoC drivers
+#
+
+if ARCH_STARFIVE || COMPILE_TEST
+menu "Starfive SoC drivers"
+
+config SOC_STARFIVE_JH7110_VOUT_SUBSYSTEM
+ tristate "StarFive JH7110 VOUT Subsystem Manager"
+ help
+ Enable this option to support the VOUT (Video Output) subsystem on
+ the StarFive JH7110 SoC.
+
+ This driver acts as a parent wrapper for all display related
+ hardware blocks (DC8200, VOUTCRG, HDMI MFD). Its primary
+ responsibility is to manage the shared PD_VOUT power domain,
+ enabling power, clocks, and resets for the entire subsystem
+ before the individual child drivers are probed.
+
+ This is essential for the display hardware to be detected and
+ to function correctly.
+
+endmenu
+endif
diff --git a/drivers/soc/starfive/Makefile b/drivers/soc/starfive/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..17081cd67635b02f495230b117c9acb691ef33ba
--- /dev/null
+++ b/drivers/soc/starfive/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_SOC_STARFIVE_JH7110_VOUT_SUBSYSTEM) += 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..a67fd1cbac6b97c0c78c5dff444450579beca91d
--- /dev/null
+++ b/drivers/soc/starfive/jh7110-vout-subsystem.c
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
+ * Author: Michal Wilczynski <m.wilczynski@...sung.com>
+ */
+
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/reset.h>
+
+static void devm_clk_disable_unprepare(void *data)
+{
+ struct clk *clk = data;
+
+ clk_disable_unprepare(clk);
+}
+
+static void devm_reset_control_assert(void *data)
+{
+ struct reset_control *rst = data;
+
+ reset_control_assert(rst);
+}
+
+static int jh7110_vout_subsystem_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct clk *bus_clk;
+ struct reset_control *bus_rst;
+ int ret;
+
+ bus_clk = devm_clk_get(dev, NULL);
+ if (IS_ERR(bus_clk))
+ return dev_err_probe(dev, PTR_ERR(bus_clk), "Failed to get bus clock\n");
+
+ bus_rst = devm_reset_control_get_exclusive(dev, NULL);
+ if (IS_ERR(bus_rst))
+ return dev_err_probe(dev, PTR_ERR(bus_rst), "Failed to get bus reset\n");
+
+ pm_runtime_enable(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0) {
+ dev_err(dev, "Failed to enable power domain: %d\n", ret);
+ pm_runtime_disable(dev);
+ return ret;
+ }
+
+ ret = clk_prepare_enable(bus_clk);
+ if (ret) {
+ dev_err(dev, "Failed to enable bus clock: %d\n", ret);
+ goto err_pm_put;
+ }
+
+ ret = devm_add_action_or_reset(dev, devm_clk_disable_unprepare, bus_clk);
+ if (ret) {
+ dev_err(dev, "Failed to register clk disable action: %d\n", ret);
+ goto err_pm_put;
+ }
+
+ ret = reset_control_deassert(bus_rst);
+ if (ret) {
+ dev_err(dev, "Failed to deassert bus reset: %d\n", ret);
+ goto err_pm_put;
+ }
+
+ ret = devm_add_action_or_reset(dev, devm_reset_control_assert, bus_rst);
+ if (ret) {
+ dev_err(dev, "Failed to register reset assert action: %d\n", ret);
+ goto err_pm_put;
+ }
+
+ dev_info(dev, "VOUT subsystem bus interface is powered on\n");
+
+ ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
+ if (ret) {
+ dev_err(dev, "Failed to populate child devices: %d\n", ret);
+ goto err_pm_put;
+ }
+
+ return 0;
+
+err_pm_put:
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
+ return ret;
+}
+
+static void jh7110_vout_subsystem_remove(struct platform_device *pdev)
+{
+ of_platform_depopulate(&pdev->dev);
+
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+}
+
+static const struct of_device_id vout_subsystem_of_match[] = {
+ { .compatible = "starfive,jh7110-vout-subsystem", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, vout_subsystem_of_match);
+
+static struct platform_driver jh7110_vout_subsystem_driver = {
+ .probe = jh7110_vout_subsystem_probe,
+ .remove = jh7110_vout_subsystem_remove,
+ .driver = {
+ .name = "jh7110-vout-subsystem",
+ .of_match_table = vout_subsystem_of_match,
+ },
+};
+module_platform_driver(jh7110_vout_subsystem_driver);
+
+MODULE_AUTHOR("Michal Wilczynski <m.wilczynski@...sung.com>");
+MODULE_DESCRIPTION("StarFive JH7110 VOUT Subsystem Manager");
+MODULE_LICENSE("GPL");
--
2.34.1
Powered by blists - more mailing lists