From 0da771f275ac360bf917ce7128f2347ab1228c83 Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Tue, 27 Jun 2023 08:11:04 +0000 Subject: [PATCH] devfreq: Support suspend and resume in tegra_wmark When devfreq_suspend_device get called, tegra_wmark will disable the upper and lower watermark thresholds so that no DFS logic get triggered after the suspension. When devfreq_resume_device get called, tegra_wmark will enable back the upper and lower watermark thresholds so that interrupt-driven DFS logic can work properly. Bug 4168788 Signed-off-by: Johnny Liu Change-Id: I98fa1487db26fdfe95f5c958dbe15bf0f49035d5 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2927019 Reviewed-by: svcacv Reviewed-by: Mikko Perttunen GVS: Gerrit_Virtual_Submit --- drivers/devfreq/tegra_wmark.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/devfreq/tegra_wmark.c b/drivers/devfreq/tegra_wmark.c index f441d392..d4a42891 100644 --- a/drivers/devfreq/tegra_wmark.c +++ b/drivers/devfreq/tegra_wmark.c @@ -497,6 +497,8 @@ static int devfreq_tegra_wmark_event_handler(struct devfreq *df, unsigned int event, void *data) { + struct devfreq_tegra_wmark_data *drvdata = df->data; + struct devfreq_tegra_wmark_config wmark_config; int err; switch (event) { @@ -510,6 +512,14 @@ static int devfreq_tegra_wmark_event_handler(struct devfreq *df, case DEVFREQ_GOV_STOP: tegra_wmark_exit(df); break; + case DEVFREQ_GOV_SUSPEND: + wmark_config.upper_wmark_enabled = 0; + wmark_config.lower_wmark_enabled = 0; + drvdata->update_wmark_threshold(df, &wmark_config); + break; + case DEVFREQ_GOV_RESUME: + devfreq_update_wmark_threshold(df); + break; default: break; }