Control links and helpers on an activated path during CPU idle. Set the "path->in_idle" flag to true during idle to guide path control.
Since coresight_disable_path() doesn't handle a source device's helpers, explicitly disable them alongside the source device.
Reviewed-by: James Clark james.clark@linaro.org Tested-by: James Clark james.clark@linaro.org Signed-off-by: Leo Yan leo.yan@arm.com --- drivers/hwtracing/coresight/coresight-core.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index 420e5a9cf38e64f133aa6780987d2d7c2804feb4..8763ca1d81674efa3dea9479a6a6c4025b652559 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1729,12 +1729,33 @@ static bool coresight_pm_is_needed(struct coresight_device *csdev)
static int coresight_pm_save(struct coresight_device *csdev) { - return coresight_ops(csdev)->pm_save_disable(csdev); + int ret; + + if (WARN_ON(!csdev->path)) + return -EINVAL; + + /* in_idle flag will be used for path controlling */ + csdev->path->in_idle = true; + + ret = coresight_ops(csdev)->pm_save_disable(csdev); + if (ret) { + csdev->path->in_idle = false; + return ret; + } + + coresight_disable_helpers(csdev, csdev->path); + coresight_disable_path(csdev->path); + return 0; }
static void coresight_pm_restore(struct coresight_device *csdev) { + if (WARN_ON(!csdev->path)) + return; + + coresight_enable_path(csdev->path, coresight_get_mode(csdev)); coresight_ops(csdev)->pm_restore_enable(csdev); + csdev->path->in_idle = false; }
static int coresight_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,