diff --git a/msm/vidc/hfi_common.c b/msm/vidc/hfi_common.c index 4fbbda3a8c15..0efab74faf33 100644 --- a/msm/vidc/hfi_common.c +++ b/msm/vidc/hfi_common.c @@ -3759,7 +3759,16 @@ void __disable_unprepare_clks(struct venus_hfi_device *device) "Failed set flag NORETAIN_MEM %s\n", cl->name); } + + if (!__clk_is_enabled(cl->clk)) + dprintk(VIDC_ERR, "%s: clock %s already disabled\n", + __func__, cl->name); + clk_disable_unprepare(cl->clk); + + if (__clk_is_enabled(cl->clk)) + dprintk(VIDC_ERR, "%s: clock %s not disabled\n", + __func__, cl->name); } } @@ -3829,6 +3838,11 @@ static inline int __prepare_enable_clks(struct venus_hfi_device *device) "Failed set flag RETAIN_MEM %s\n", cl->name); } + + if (__clk_is_enabled(cl->clk)) + dprintk(VIDC_ERR, "%s: clock %s already enabled\n", + __func__, cl->name); + rc = clk_prepare_enable(cl->clk); if (rc) { dprintk(VIDC_ERR, "Failed to enable clocks\n"); @@ -3836,6 +3850,10 @@ static inline int __prepare_enable_clks(struct venus_hfi_device *device) goto fail_clk_enable; } + if (!__clk_is_enabled(cl->clk)) + dprintk(VIDC_ERR, "%s: clock %s not enabled\n", + __func__, cl->name); + c++; dprintk(VIDC_HIGH, "Clock: %s prepared and enabled\n", cl->name); @@ -4153,6 +4171,10 @@ static int __disable_regulator(struct regulator_info *rinfo, goto disable_regulator_failed; } + if (!regulator_is_enabled(rinfo->regulator)) + dprintk(VIDC_ERR, "%s: regulator %s already disabled\n", + __func__, rinfo->name); + rc = regulator_disable(rinfo->regulator); if (rc) { dprintk(VIDC_ERR, @@ -4161,6 +4183,10 @@ static int __disable_regulator(struct regulator_info *rinfo, goto disable_regulator_failed; } + if (regulator_is_enabled(rinfo->regulator)) + dprintk(VIDC_ERR, "%s: regulator %s not disabled\n", + __func__, rinfo->name); + return 0; disable_regulator_failed: @@ -4189,6 +4215,10 @@ static int __enable_regulators(struct venus_hfi_device *device) dprintk(VIDC_HIGH, "Enabling regulators\n"); venus_hfi_for_each_regulator(device, rinfo) { + if (regulator_is_enabled(rinfo->regulator)) + dprintk(VIDC_ERR, "%s: regulator %s already enabled\n", + __func__, rinfo->name); + rc = regulator_enable(rinfo->regulator); if (rc) { dprintk(VIDC_ERR, @@ -4197,6 +4227,10 @@ static int __enable_regulators(struct venus_hfi_device *device) goto err_reg_enable_failed; } + if (!regulator_is_enabled(rinfo->regulator)) + dprintk(VIDC_ERR, "%s: regulator %s not enabled\n", + __func__, rinfo->name); + dprintk(VIDC_HIGH, "Enabled regulator %s\n", rinfo->name); c++; diff --git a/msm/vidc/hfi_common.h b/msm/vidc/hfi_common.h index c519f2f41f96..acbbe3b3d191 100644 --- a/msm/vidc/hfi_common.h +++ b/msm/vidc/hfi_common.h @@ -11,6 +11,7 @@ #include #include #include +#include #include "vidc_hfi_api.h" #include "vidc_hfi_helper.h" #include "vidc_hfi_api.h"