rpm-smd: Flush the sleep sets in suspend prepare stage

The RPM channel have limit of maximum 24 sleep sets
however on certain SoCs there are more than 24 sleep sets.

This change adds the support to flush the sleep sets
in prepare stage which will flush the sleep votes till 24
and gets acked by RPM. The remaining sleep sets will gets
flushed when syscore ops invokes msm_rpm_flush_requests().

Change-Id: I6ea3cc635cf799cc64d5ee1cbc75a1b26dfb4636
Signed-off-by: Raghavendra Kakarla <quic_rkakarla@quicinc.com>
This commit is contained in:
Raghavendra Kakarla 2023-01-10 09:05:36 +05:30 committed by Tushar Nimkar
parent 8e592d784b
commit d6243420c7

View file

@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/suspend.h>
#include <linux/types.h>
#include <soc/qcom/rpm-smd.h>
#include <soc/qcom/mpm.h>
@ -1500,6 +1501,23 @@ static int rpm_smd_power_cb(struct notifier_block *nb, unsigned long action, voi
return NOTIFY_OK;
}
static int rpm_smd_pm_notifier(struct notifier_block *nb, unsigned long event, void *unused)
{
int ret;
if (event == PM_SUSPEND_PREPARE) {
ret = msm_rpm_flush_requests();
pr_debug("ret = %d\n", ret);
}
/* continue to suspend */
return NOTIFY_OK;
}
static struct notifier_block rpm_smd_pm_nb = {
.notifier_call = rpm_smd_pm_notifier,
};
static int qcom_smd_rpm_callback(struct rpmsg_device *rpdev, void *ptr,
int size, void *priv, u32 addr)
{
@ -1593,6 +1611,13 @@ static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev)
goto fail;
}
ret = register_pm_notifier(&rpm_smd_pm_nb);
if (ret) {
pr_err("%s: power state notif error %d\n", __func__, ret);
probe_status = -ENODEV;
goto fail;
}
rpm->dev = &rpdev->dev;
rpm->rpm_channel = rpdev->ept;
dev_set_drvdata(&rpdev->dev, rpm);