Skip to contentSkip to conversation

drm: kirin: Fix missing clk_disable_unprepare in ade_power_up()

PATCH In review Shang XiaoJing 3 participants 3 messages Dec 2, 2022 – Dec 5, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: kirin: Fix missing clk_disable_unprepare in ade_power_up()

The clk_disable_unprepare() should be called in the error handling of ade_power_up(). So as reset_control_assert().

Fixes 783ad972c9a0 ("drm/hisilicon: Add crtc driver for ADE")
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3 -0
index 871f79a6b17e..439e87923bcf 100644
@@ -229,12 +229,15 @@ static int ade_power_up(struct ade_hw_ctx *ctx)
 	ret = reset_control_deassert(ctx->reset);
 	if (ret) {
 		DRM_ERROR("failed to deassert reset\n");
+		clk_disable_unprepare(ctx->media_noc_clk);
 		return ret;
 	}
 
 	ret = clk_prepare_enable(ctx->ade_core_clk);
 	if (ret) {
 		DRM_ERROR("failed to enable ade_core_clk (%d)\n", ret);
+		reset_control_assert(ctx->reset);
+		clk_disable_unprepare(ctx->media_noc_clk);
 		return ret;
 	}
 
Signature · 1 line
2.17.1
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Shang XiaoJing

The clk_disable_unprepare() should be called in the error handling of ade_power_up(). So as reset_control_assert().

Fixes 783ad972c9a0 ("drm/hisilicon: Add crtc driver for ADE")

Looks reasonable to me. Thanks for sending this out! CC'ing YongQin and Sumit as they have hardware to test against.

Quoted 27 lines
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3 -1
index 871f79a6b17e..439e87923bcf 100644
@@ -229,12 +229,15 @@ static int ade_power_up(struct ade_hw_ctx *ctx)
        ret = reset_control_deassert(ctx->reset);
        if (ret) {
                DRM_ERROR("failed to deassert reset\n");
+               clk_disable_unprepare(ctx->media_noc_clk);
                return ret;
        }
 
        ret = clk_prepare_enable(ctx->ade_core_clk);
        if (ret) {
                DRM_ERROR("failed to enable ade_core_clk (%d)\n", ret);
+               reset_control_assert(ctx->reset);
+               clk_disable_unprepare(ctx->media_noc_clk);
                return ret;
        }
 
--

2.17.1

reviewer
#2 lore raw

Hi, John

Thanks for sharing this information!

Hi, XiaoJing

I boot tested this change with hikey and hikey960 android-mainline builds, both could boot to the home screen.

But I am not sure what the problem is without this change, so I could not check if this change
helps fix any problem, just checked that it did not cause any problem for the boot.

Thanks,
Yongqin Liu

Quoted 42 lines · John Stultz
Quoted 6 lines · Shang XiaoJing

The clk_disable_unprepare() should be called in the error handling of ade_power_up(). So as reset_control_assert().

Fixes 783ad972c9a0 ("drm/hisilicon: Add crtc driver for ADE")

Looks reasonable to me. Thanks for sending this out! CC'ing YongQin and Sumit as they have hardware to test against.

Quoted 27 lines
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3 -1
index 871f79a6b17e..439e87923bcf 100644
@@ -229,12 +229,15 @@ static int ade_power_up(struct ade_hw_ctx *ctx)
        ret = reset_control_deassert(ctx->reset);
        if (ret) {
                DRM_ERROR("failed to deassert reset\n");
+               clk_disable_unprepare(ctx->media_noc_clk);
                return ret;
        }
 
        ret = clk_prepare_enable(ctx->ade_core_clk);
        if (ret) {
                DRM_ERROR("failed to enable ade_core_clk (%d)\n", ret);
+               reset_control_assert(ctx->reset);
+               clk_disable_unprepare(ctx->media_noc_clk);
                return ret;
        }
 
--

2.17.1

Signature · 6 lines
Best Regards,
Yongqin Liu
---------------------------------------------------------------
#mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/linaro-android