Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4b95d4a authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: add sanity checks for clocks and regulators



Add sanity checks before and after clocks and regulator
operations to get more information if these operations
not functional as expected.

Change-Id: Ib4985113200ed065e6acf6cb7ae406b88cc7f432
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent 1dcfc575
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -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++;
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
#include <linux/spinlock.h>
#include <linux/clk-provider.h>
#include "vidc_hfi_api.h"
#include "vidc_hfi_helper.h"
#include "vidc_hfi_api.h"