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

Commit 7c73b4c8 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: add sanity checks for clocks and regulators"

parents 495a0403 d4b95d4a
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -3790,7 +3790,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);
	}
}

@@ -3860,6 +3869,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");
@@ -3867,6 +3881,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);
@@ -4184,6 +4202,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,
@@ -4192,6 +4214,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:

@@ -4220,6 +4246,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,
@@ -4228,6 +4258,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"