drm/sun4i: dsi: Get the A100 mod clock at bind time

Message ID 20260926090532.126025-1-tien.nguyenminh@embeddedlinux.blog (mailing list archive)
State New
Headers
Series drm/sun4i: dsi: Get the A100 mod clock at bind time |

Commit Message

Nguyen Minh Tien Sept. 26, 2026, 9:05 a.m. UTC
The A100 variant gets its module clock from the TCON TOP, which only
registers its clocks when it is bound. Requesting the clock in probe
defers the DSI forever, so the display never comes up on the D1 and
T113, which use this variant:

  sun6i-mipi-dsi 5450000.dsi: Couldn't get the DSI mod clock

Request the clock at bind time instead, as the TCON driver does.

Tested on a T113-S3 with a DSI panel.

Fixes: 4b71e269f5a5 ("drm/sun4i: dsi: Add the A100 variant")
Signed-off-by: Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index d504ae583..69987bb5b 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1062,6 +1062,17 @@  static int sun6i_dsi_bind(struct device *dev, struct device *master,
 	struct sun6i_dsi *dsi = dev_get_drvdata(dev);
 	int ret;
 
+	/*
+	 * This module clock comes from the TCON TOP, which registers it only
+	 * when it is bound, so it cannot be requested in probe.
+	 */
+	if (dsi->variant->has_mod_clk && !dsi->variant->set_mod_clk) {
+		dsi->mod_clk = devm_clk_get(dev, "mod");
+		if (IS_ERR(dsi->mod_clk))
+			return dev_err_probe(dev, PTR_ERR(dsi->mod_clk),
+					     "Couldn't get the DSI mod clock\n");
+	}
+
 	drm_encoder_helper_add(&dsi->encoder,
 			       &sun6i_dsi_enc_helper_funcs);
 	ret = drm_encoder_init(drm, &dsi->encoder, &sun6i_dsi_enc_funcs,
@@ -1160,7 +1171,7 @@  static int sun6i_dsi_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (variant->has_mod_clk) {
+	if (variant->has_mod_clk && variant->set_mod_clk) {
 		dsi->mod_clk = devm_clk_get(dev, "mod");
 		if (IS_ERR(dsi->mod_clk)) {
 			dev_err(dev, "Couldn't get the DSI mod clock\n");