remoteproc: k3-m4: Move suspend to suspend_late

The remote core has to be able to query the DM for the next system mode
in the suspend path. To support this, ti_sci.c has to send the
prepare_sleep command before the suspend message is sent to the remote
core. This patch moves the suspend to suspend_late to be executed after
ti_sci's suspend call.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
This commit is contained in:
Markus Schneider-Pargmann
2024-07-11 15:16:00 +02:00
committed by Heinrich Toews
parent 1f4ef45bc2
commit 750daf2748
+22 -1
View File
@@ -819,7 +819,7 @@ static int m4_pm_notifier_call(struct notifier_block *bl, unsigned long state, v
case PM_HIBERNATION_PREPARE:
case PM_RESTORE_PREPARE:
case PM_SUSPEND_PREPARE:
return k3_m4_suspend(rproc);
break;
case PM_POST_HIBERNATION:
case PM_POST_RESTORE:
@@ -831,6 +831,20 @@ static int m4_pm_notifier_call(struct notifier_block *bl, unsigned long state, v
return 0;
}
static int k3_m4_suspend_late(struct device *dev)
{
struct rproc *rproc = dev_get_drvdata(dev);
struct k3_m4_rproc *kproc = rproc->priv;
/* Check if pm notifier call is set. if it is, suspend/resume is
* supported
*/
if (!kproc->pm_notifier.notifier_call)
return 0;
return k3_m4_suspend(rproc);
}
static const struct rproc_ops k3_m4_rproc_ops = {
.start = k3_m4_rproc_start,
.stop = k3_m4_rproc_stop,
@@ -952,6 +966,8 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)
}
}
dev_set_drvdata(dev, rproc);
ret = devm_rproc_add(dev, rproc);
if (ret)
return dev_err_probe(dev, ret,
@@ -977,10 +993,15 @@ static const struct of_device_id k3_m4_of_match[] = {
};
MODULE_DEVICE_TABLE(of, k3_m4_of_match);
static const struct dev_pm_ops k3_m4_pm_ops = {
LATE_SYSTEM_SLEEP_PM_OPS(k3_m4_suspend_late, NULL)
};
static struct platform_driver k3_m4_rproc_driver = {
.probe = k3_m4_rproc_probe,
.driver = {
.name = "k3-m4-rproc",
.pm = &k3_m4_pm_ops,
.of_match_table = k3_m4_of_match,
},
};