diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2015-04-19 12:05:05 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-07-05 12:58:24 -0400 |
commit | 0cf8ae932508fa88facd40b15fc146a770ae368e (patch) | |
tree | 9617e488c43dacbe3c74332f140ed83427e326b0 | |
parent | 6c7bf5d6be05d6985ed06d2b5e10fed82553cf60 (diff) |
devfreq: Improve wmark_active initialization
The wmark_active governor initialization assumes that the device
frequency is the lowest possible frequency when the governor is
started or resumed. However, this may not be correct if the
governor was suspended/stopped before the clock had been slowed
down.
This patch modifies the governor to read the frequency during
governor initialization and resume.
Change-Id: I38d3256102b344bc8818c5623a015843678a8ce5
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/733007
Reviewed-on: http://git-master/r/1160009
(cherry picked from linux-4.9 commit 32e2561dffc5d7390fa4fd503651da9013403ecb)
Reviewed-on: https://git-master.nvidia.com/r/1770141
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/devfreq/governor_wmark_active.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/devfreq/governor_wmark_active.c b/drivers/devfreq/governor_wmark_active.c index c617271f8..7dc020dda 100644 --- a/drivers/devfreq/governor_wmark_active.c +++ b/drivers/devfreq/governor_wmark_active.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -233,33 +233,44 @@ static int devfreq_watermark_event_handler(struct devfreq *df, | |||
233 | unsigned int event, void *wmark_type) | 233 | unsigned int event, void *wmark_type) |
234 | { | 234 | { |
235 | int ret = 0; | 235 | int ret = 0; |
236 | struct wmark_gov_info *wmarkinfo = df->data; | ||
237 | 236 | ||
238 | switch (event) { | 237 | switch (event) { |
239 | case DEVFREQ_GOV_START: | 238 | case DEVFREQ_GOV_START: |
240 | devfreq_watermark_start(df); | 239 | { |
241 | wmarkinfo = df->data; | 240 | struct devfreq_dev_status dev_stat; |
242 | update_watermarks(df, wmarkinfo->freqlist[0]); | 241 | ret = df->profile->get_dev_status(df->dev.parent, &dev_stat); |
242 | if (ret < 0) | ||
243 | break; | ||
244 | |||
245 | ret = devfreq_watermark_start(df); | ||
246 | if (ret < 0) | ||
247 | break; | ||
248 | |||
249 | update_watermarks(df, dev_stat.current_frequency); | ||
243 | break; | 250 | break; |
251 | } | ||
244 | case DEVFREQ_GOV_STOP: | 252 | case DEVFREQ_GOV_STOP: |
245 | devfreq_watermark_debug_stop(df); | 253 | devfreq_watermark_debug_stop(df); |
246 | break; | 254 | break; |
247 | case DEVFREQ_GOV_SUSPEND: | 255 | case DEVFREQ_GOV_SUSPEND: |
248 | devfreq_monitor_suspend(df); | 256 | devfreq_monitor_suspend(df); |
249 | break; | 257 | break; |
250 | |||
251 | case DEVFREQ_GOV_RESUME: | 258 | case DEVFREQ_GOV_RESUME: |
252 | wmarkinfo = df->data; | 259 | { |
253 | update_watermarks(df, wmarkinfo->freqlist[0]); | 260 | struct devfreq_dev_status dev_stat; |
261 | ret = df->profile->get_dev_status(df->dev.parent, &dev_stat); | ||
262 | if (ret < 0) | ||
263 | break; | ||
264 | |||
265 | update_watermarks(df, dev_stat.current_frequency); | ||
254 | devfreq_monitor_resume(df); | 266 | devfreq_monitor_resume(df); |
255 | break; | 267 | break; |
256 | 268 | } | |
257 | case DEVFREQ_GOV_WMARK: | 269 | case DEVFREQ_GOV_WMARK: |
258 | mutex_lock(&df->lock); | 270 | mutex_lock(&df->lock); |
259 | update_devfreq(df); | 271 | update_devfreq(df); |
260 | mutex_unlock(&df->lock); | 272 | mutex_unlock(&df->lock); |
261 | break; | 273 | break; |
262 | |||
263 | default: | 274 | default: |
264 | break; | 275 | break; |
265 | } | 276 | } |