diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index bfabd94a474a..fa2c1b1c7dee 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "clk-mtk.h" @@ -470,6 +471,16 @@ int mtk_clk_simple_probe(struct platform_device *pdev) return IS_ERR(base) ? PTR_ERR(base) : -ENOMEM; } + + devm_pm_runtime_enable(&pdev->dev); + /* + * Do a pm_runtime_resume_and_get() to workaround a possible + * deadlock between clk_register() and the genpd framework. + */ + r = pm_runtime_resume_and_get(&pdev->dev); + if (r) + return r; + /* Calculate how many clk_hw_onecell_data entries to allocate */ num_clks = mcd->num_clks + mcd->num_composite_clks; num_clks += mcd->num_fixed_clks + mcd->num_factor_clks; @@ -531,6 +542,8 @@ int mtk_clk_simple_probe(struct platform_device *pdev) goto unregister_clks; } + pm_runtime_put(&pdev->dev); + return r; unregister_clks: @@ -556,6 +569,8 @@ free_data: mtk_free_clk_data(clk_data); if (mcd->shared_io && base) iounmap(base); + + pm_runtime_put(&pdev->dev); return r; } EXPORT_SYMBOL_GPL(mtk_clk_simple_probe);