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

Commit d5d06c27 authored by Chandan Uddaraju's avatar Chandan Uddaraju Committed by Gerrit - the friendly Code Review server
Browse files

clk: msm: mdss: add locking mechanism for critical section



The PLL resources are accessed by multiple tasks. Add mutex
to protect the critical section is avoid any configuration
issues with the shared resources.

Change-Id: Ifa6d93c50f528c6d25e85a2701c3ffd280a8a8f7
Signed-off-by: default avatarChandan Uddaraju <chandanu@codeaurora.org>
parent 16bd12a5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ int mdss_pll_util_resource_init(struct platform_device *pdev,
		goto clk_err;
	}

	mutex_init(&pll_res->res_lock);
	return rc;

clk_err:
@@ -90,6 +91,8 @@ void mdss_pll_util_resource_deinit(struct platform_device *pdev,
	msm_dss_put_clk(mp->clk_config, mp->num_clk);

	msm_dss_config_vreg(&pdev->dev, mp->vreg_config, mp->num_vreg, 0);

	mutex_destroy(&pll_res->res_lock);
}

void mdss_pll_util_resource_release(struct platform_device *pdev,
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable)
		return rc;
	}

	mutex_lock(&pll_res->res_lock);
	if (enable) {
		if (pll_res->resource_ref_cnt == 0)
			changed++;
@@ -67,6 +68,7 @@ int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable)
			pll_res->resource_enable = enable;
	}

	mutex_unlock(&pll_res->res_lock);
	return rc;
}

+5 −0
Original line number Diff line number Diff line
@@ -160,6 +160,11 @@ struct mdss_pll_resources {
	 */
	uint32_t index;

	/*
	 * Mutex to handle pll resource access
	 */
	struct mutex res_lock;

	struct dfps_info *dfps;
};