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

Commit e13704c6 authored by Laxminath Kasam's avatar Laxminath Kasam Committed by Gerrit - the friendly Code Review server
Browse files

soc: Handle system suspend for LPI pinctrl



System suspend is not handled in lpi pinctrl driver.
Register to system ops to release lpass hw vote
before apps suspend.

CRs-Fixed: 2439988
Change-Id: I334a993ead5d2abec5286fb5812d67b795d03f3c
Signed-off-by: default avatarLaxminath Kasam <lkasam@codeaurora.org>
parent c63ec8cd
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -788,7 +788,44 @@ int lpi_pinctrl_runtime_suspend(struct device *dev)
	return 0;
}

int lpi_pinctrl_suspend(struct device *dev)
{
	int ret = 0;

	dev_dbg(dev, "%s: system suspend\n", __func__);

	if ((!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev))) {
		ret = lpi_pinctrl_runtime_suspend(dev);
		if (!ret) {
			/*
			 * Synchronize runtime-pm and system-pm states:
			 * At this point, we are already suspended. If
			 * runtime-pm still thinks its active, then
			 * make sure its status is in sync with HW
			 * status. The three below calls let the
			 * runtime-pm know that we are suspended
			 * already without re-invoking the suspend
			 * callback
			 */
			pm_runtime_disable(dev);
			pm_runtime_set_suspended(dev);
			pm_runtime_enable(dev);
		}
	}

	return ret;
}

int lpi_pinctrl_resume(struct device *dev)
{
	return 0;
}

static const struct dev_pm_ops lpi_pinctrl_dev_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(
		lpi_pinctrl_suspend,
		lpi_pinctrl_resume
	)
	SET_RUNTIME_PM_OPS(
		lpi_pinctrl_runtime_suspend,
		lpi_pinctrl_runtime_resume,