diff mbox series

crypto: qce - Add suspend and resume support

Message ID 20250606105808.2119280-1-quic_utiwari@quicinc.com
State New
Headers show
Series crypto: qce - Add suspend and resume support | expand

Commit Message

quic_utiwari@quicinc.com June 6, 2025, 10:58 a.m. UTC
From: Udit Tiwari <quic_utiwari@quicinc.com>

Add basic suspend and resume callbacks to the QCE platform driver to
manage interconnect bandwidth during system sleep and wake-up cycles.

Signed-off-by: Udit Tiwari <quic_utiwari@quicinc.com>
---
 drivers/crypto/qce/core.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index e95e84486d9a..2566bdad5d4a 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -249,6 +249,21 @@  static int qce_crypto_probe(struct platform_device *pdev)
 	return devm_qce_register_algs(qce);
 }
 
+static int qce_crypto_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct qce_device *qce = platform_get_drvdata(pdev);
+
+	return icc_set_bw(qce->mem_path, 0, 0);
+}
+
+static int qce_crypto_resume(struct platform_device *pdev)
+{
+	struct qce_device *qce = platform_get_drvdata(pdev);
+
+	return icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH,
+		QCE_DEFAULT_MEM_BANDWIDTH);
+}
+
 static const struct of_device_id qce_crypto_of_match[] = {
 	{ .compatible = "qcom,crypto-v5.1", },
 	{ .compatible = "qcom,crypto-v5.4", },
@@ -259,6 +274,8 @@  MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
 
 static struct platform_driver qce_crypto_driver = {
 	.probe = qce_crypto_probe,
+	.suspend = qce_crypto_suspend,
+	.resume = qce_crypto_resume,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = qce_crypto_of_match,