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

Commit 5a2e3083 authored by Jayaprakash's avatar Jayaprakash
Browse files

msm/sde/rotator: disable rotator clock during pm suspend



In few cases, rotator sessions can be opened when pm suspend
is called. Its corresponding clock votes are removed before
pm_suspend and added back when pm_resume occurs.

Change-Id: Ic7f4ea98a51c31949933fb9145a088d1e70bc3c3
Signed-off-by: default avatarJayaprakash <jmadiset@codeaurora.org>
parent 74ec0d4f
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -3331,6 +3331,7 @@ int sde_rotator_runtime_idle(struct device *dev)
int sde_rotator_pm_suspend(struct device *dev)
{
	struct sde_rot_mgr *mgr;
	int i;

	mgr = sde_rot_mgr_from_device(dev);

@@ -3345,8 +3346,20 @@ int sde_rotator_pm_suspend(struct device *dev)
	sde_rotator_suspend_cancel_rot_work(mgr);
	mgr->minimum_bw_vote = 0;
	sde_rotator_update_perf(mgr);
	mgr->pm_rot_enable_clk_cnt = mgr->rot_enable_clk_cnt;

	if (mgr->pm_rot_enable_clk_cnt) {
		for (i = 0; i < mgr->pm_rot_enable_clk_cnt; i++)
			sde_rotator_clk_ctrl(mgr, false);

		sde_rotator_update_clk(mgr);
	}

	ATRACE_END("pm_active");
	SDEROT_DBG("end pm active %d\n", atomic_read(&mgr->device_suspended));
	SDEROT_DBG("end pm active %d clk_cnt %d\n",
	 atomic_read(&mgr->device_suspended), mgr->pm_rot_enable_clk_cnt);
	SDEROT_EVTLOG(mgr->pm_rot_enable_clk_cnt,
			 atomic_read(&mgr->device_suspended));
	sde_rot_mgr_unlock(mgr);
	return 0;
}
@@ -3358,6 +3371,7 @@ int sde_rotator_pm_suspend(struct device *dev)
int sde_rotator_pm_resume(struct device *dev)
{
	struct sde_rot_mgr *mgr;
	int i;

	mgr = sde_rot_mgr_from_device(dev);

@@ -3377,10 +3391,20 @@ int sde_rotator_pm_resume(struct device *dev)
	pm_runtime_enable(dev);

	sde_rot_mgr_lock(mgr);
	SDEROT_DBG("begin pm active %d\n", atomic_read(&mgr->device_suspended));
	SDEROT_DBG("begin pm active %d clk_cnt %d\n",
	 atomic_read(&mgr->device_suspended), mgr->pm_rot_enable_clk_cnt);
	ATRACE_BEGIN("pm_active");
	SDEROT_EVTLOG(mgr->pm_rot_enable_clk_cnt,
			 atomic_read(&mgr->device_suspended));
	atomic_dec(&mgr->device_suspended);
	sde_rotator_update_perf(mgr);

	if (mgr->pm_rot_enable_clk_cnt) {
		sde_rotator_update_clk(mgr);
		for (i = 0; i < mgr->pm_rot_enable_clk_cnt; i++)
			sde_rotator_clk_ctrl(mgr, true);
	}

	sde_rot_mgr_unlock(mgr);
	return 0;
}
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -393,6 +393,7 @@ struct sde_rot_bus_data_type {
 * @regulator_enable: true if foot switch is enabled; false otherwise
 * @res_ref_cnt: reference count of how many times resource is requested
 * @rot_enable_clk_cnt: reference count of how many times clock is requested
 * @pm_rot_enable_clk_cnt : tracks the clock enable count on pm suspend
 * @rot_clk: array of rotator and periphery clocks
 * @num_rot_clk: size of the rotator clock array
 * @rdot_limit: current read OT limit
@@ -439,6 +440,7 @@ struct sde_rot_mgr {

	int res_ref_cnt;
	int rot_enable_clk_cnt;
	int pm_rot_enable_clk_cnt;
	struct sde_rot_clk *rot_clk;
	int num_rot_clk;
	u32 rdot_limit;