]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
video: imx: ipuv3: enable ipu clk before writing registers in CCF
authorBrian Ruley <brian.ruley@gehealthcare.com>
Tue, 16 Jun 2026 12:51:39 +0000 (15:51 +0300)
committerFabio Estevam <festevam@gmail.com>
Sat, 27 Jun 2026 02:02:46 +0000 (23:02 -0300)
Obviously, the clock has to be enabled if writing to it's registers.
This was missed because the board I tested on had enabled the clocks in
early init.

Also, remove the completely useless "ipu_clk_enabled" struct member and
use the accurate usecount / enabled_count instead.

Signed-off-by: Brian Ruley <brian.ruley@gehealthcare.com>
drivers/video/imx/ipu.h
drivers/video/imx/ipu_common.c

index ae40e20bc2879ee9f1d545b5a9e061e3f99773dc..aecb6adffcee290c1e0fff17c1f3b8db38b29698 100644 (file)
@@ -136,7 +136,6 @@ struct ipu_ctx {
 
        struct clk *ipu_clk;
        struct clk *ldb_clk;
-       unsigned char ipu_clk_enabled;
        struct clk *di_clk[2];
        struct clk *pixel_clk[2];
 
index 8630374a055fdec7c610e128a6e8f8c3d6eaaa2a..d3b5260573147618267d74906c60ff43d44f23d6 100644 (file)
@@ -299,9 +299,9 @@ struct ipu_ctx *ipu_probe(struct udevice *dev)
 #if CONFIG_IS_ENABLED(IPU_CLK_LEGACY)
        clk_set_parent(ctx->pixel_clk[0], ctx->ipu_clk);
        clk_set_parent(ctx->pixel_clk[1], ctx->ipu_clk);
+#endif
 
        clk_enable(ctx->ipu_clk);
-#endif
 
        for (int i = 0; i <= 1; i++) {
                ret = ipu_di_clk_init(ctx, i);
@@ -384,10 +384,8 @@ int32_t ipu_init_channel(struct ipu_ctx *ctx, ipu_channel_t channel,
 
        debug("init channel = %d\n", IPU_CHAN_ID(channel));
 
-       if (ctx->ipu_clk_enabled == 0) {
-               ctx->ipu_clk_enabled = 1;
+       if (!ipu_clk_enabled(ctx))
                clk_enable(ipu_clk);
-       }
 
        if (*channel_init_mask & (1L << IPU_CHAN_ID(channel))) {
                printf("Warning: channel already initialized %d\n",
@@ -543,7 +541,6 @@ void ipu_uninit_channel(struct ipu_ctx *ctx, ipu_channel_t channel)
 
        if (ipu_conf == 0) {
                clk_disable(ctx->ipu_clk);
-               ctx->ipu_clk_enabled = 0;
        }
 }
 
@@ -1045,5 +1042,9 @@ ipu_color_space_t format_to_colorspace(u32 fmt)
 
 bool ipu_clk_enabled(struct ipu_ctx *ctx)
 {
-       return ctx->ipu_clk_enabled;
+#if CONFIG_IS_ENABLED(IPU_CLK_LEGACY)
+       return clk_get_usecount(ctx->ipu_clk);
+#else
+       return ctx->ipu_clk->enable_count;
+#endif
 }