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

Commit 35b060cd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: add support for AP suspend in ipa driver"

parents 2763016a 561adcb4
Loading
Loading
Loading
Loading
+48 −0
Original line number Original line Diff line number Diff line
@@ -3572,11 +3572,59 @@ static int ipa_plat_drv_probe(struct platform_device *pdev_p)
	return result;
	return result;
}
}


/**
* ipa_ap_suspend() - suspend callback for runtime_pm
* @dev: pointer to device
*
* This callback will be invoked by the runtime_pm framework when an AP suspend
* operation is invoked, usually by pressing a suspend button.
*
* Returns -EAGAIN to runtime_pm framework in case IPA is in use.
* This will postpone the suspend operation until all IPA clients release
* its resources and clocks can be turned off.
*/
static int ipa_ap_suspend(struct device *dev)
{
	int res = 0;

	IPADBG("Enter...\n");
	/* Do not allow A7 to suspend in case there are active clients of IPA */
	ipa_active_clients_lock();
	if (ipa_ctx->ipa_active_clients.cnt != 0) {
		IPADBG("IPA is in use, postponing AP suspend.\n");
		res = -EAGAIN;
	}
	ipa_active_clients_unlock();
	IPADBG("Exit\n");

	return res;
}

/**
* ipa_ap_resume() - resume callback for runtime_pm
* @dev: pointer to device
*
* This callback will be invoked by the runtime_pm framework when an AP resume
* operation is invoked.
*
* Always returns 0 since resume should always succeed.
*/
static int ipa_ap_resume(struct device *dev)
{
	return 0;
}

static const struct dev_pm_ops ipa_pm_ops = {
	.suspend_noirq = ipa_ap_suspend,
	.resume_noirq = ipa_ap_resume,
};

static struct platform_driver ipa_plat_drv = {
static struct platform_driver ipa_plat_drv = {
	.probe = ipa_plat_drv_probe,
	.probe = ipa_plat_drv_probe,
	.driver = {
	.driver = {
		.name = DRV_NAME,
		.name = DRV_NAME,
		.owner = THIS_MODULE,
		.owner = THIS_MODULE,
		.pm = &ipa_pm_ops,
		.of_match_table = ipa_plat_drv_match,
		.of_match_table = ipa_plat_drv_match,
	},
	},
};
};