[RFC,3/4] soc: st: stm32mp2-syscfg: register the STM32MP25 clock device

Message ID 20261028135915.2665857-4-dario.binacchi@amarulasolutions.com
State New
Headers
Series Select the STM32MP25 LTDC pixel clock source for the RGB output |

Commit Message

Dario Binacchi Oct. 28, 2026, 1:59 p.m. UTC
The STM32MP25 SYSCFG provides the LTDC pixel clock mux, whose driver is
an auxiliary driver since the SYSCFG node is bound to this driver.

Create the auxiliary device for the clock driver on STM32MP25.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---

 drivers/soc/st/Kconfig           |  1 +
 drivers/soc/st/stm32mp2-syscfg.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/soc/st/Kconfig b/drivers/soc/st/Kconfig
index 2a9d6a77be45..62bbe8c63238 100644
--- a/drivers/soc/st/Kconfig
+++ b/drivers/soc/st/Kconfig
@@ -5,6 +5,7 @@  config SOC_STM32MP2
 	tristate "STM32MP2 SoC family support"
 	depends on ARCH_STM32 || COMPILE_TEST
 	default ARCH_STM32 && ARM64
+	select AUXILIARY_BUS
 	select SOC_BUS
 	help
 	  If you say yes here, you get support for the ST STM32MP2 family
diff --git a/drivers/soc/st/stm32mp2-syscfg.c b/drivers/soc/st/stm32mp2-syscfg.c
index 770321a4a6f7..300a949744c5 100644
--- a/drivers/soc/st/stm32mp2-syscfg.c
+++ b/drivers/soc/st/stm32mp2-syscfg.c
@@ -3,18 +3,42 @@ 
  * Copyright 2026 Marek Vasut
  */
 
+#include <linux/auxiliary_bus.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
+
+struct stm32mp2_syscfg_data {
+	bool has_clk;
+};
 
 static int stm32mp2_syscfg_probe(struct platform_device *pdev)
 {
-	return devm_of_platform_populate(&pdev->dev);
+	const struct stm32mp2_syscfg_data *data;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	ret = devm_of_platform_populate(dev);
+	if (ret)
+		return ret;
+
+	data = device_get_match_data(dev);
+	if (data && data->has_clk &&
+	    !devm_auxiliary_device_create(dev, "clk", NULL))
+		return dev_err_probe(dev, -ENODEV,
+				     "failed to register the clock device\n");
+
+	return 0;
 }
 
+static const struct stm32mp2_syscfg_data stm32mp25_syscfg_data = {
+	.has_clk = true,
+};
+
 static const struct of_device_id stm32mp2_syscfg_ids[] = {
 	{ .compatible = "st,stm32mp23-syscfg" },
-	{ .compatible = "st,stm32mp25-syscfg" },
+	{ .compatible = "st,stm32mp25-syscfg", .data = &stm32mp25_syscfg_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, stm32mp2_syscfg_ids);