.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/drivers/devfreq/governor_simpleondemand.c |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2011 Samsung Electronics |
---|
5 | 6 | * MyungJoo Ham <myungjoo.ham@samsung.com> |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License version 2 as |
---|
9 | | - * published by the Free Software Foundation. |
---|
10 | 7 | */ |
---|
11 | 8 | |
---|
12 | 9 | #include <linux/errno.h> |
---|
.. | .. |
---|
27 | 24 | unsigned int dfso_upthreshold = DFSO_UPTHRESHOLD; |
---|
28 | 25 | unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENCTIAL; |
---|
29 | 26 | struct devfreq_simple_ondemand_data *data = df->data; |
---|
30 | | - unsigned long min = (df->min_freq) ? df->min_freq : DEVFREQ_MIN_FREQ; |
---|
31 | 27 | |
---|
32 | 28 | err = devfreq_update_stats(df); |
---|
33 | 29 | if (err) |
---|
.. | .. |
---|
45 | 41 | dfso_upthreshold < dfso_downdifferential) |
---|
46 | 42 | return -EINVAL; |
---|
47 | 43 | |
---|
48 | | - /* Prevent overflow */ |
---|
49 | | - if (stat->busy_time >= (1 << 24) || stat->total_time >= (1 << 24)) { |
---|
50 | | - stat->busy_time >>= 7; |
---|
51 | | - stat->total_time >>= 7; |
---|
52 | | - } |
---|
53 | | - |
---|
54 | | - if (data && data->simple_scaling) { |
---|
55 | | - if (stat->busy_time * 100 > |
---|
56 | | - stat->total_time * dfso_upthreshold) |
---|
57 | | - *freq = DEVFREQ_MAX_FREQ; |
---|
58 | | - else if (stat->busy_time * 100 < |
---|
59 | | - stat->total_time * dfso_downdifferential) |
---|
60 | | - *freq = min; |
---|
61 | | - else |
---|
62 | | - *freq = df->previous_freq; |
---|
63 | | - return 0; |
---|
64 | | - } |
---|
65 | | - |
---|
66 | 44 | /* Assume MAX if it is going to be divided by zero */ |
---|
67 | 45 | if (stat->total_time == 0) { |
---|
68 | 46 | *freq = DEVFREQ_MAX_FREQ; |
---|
69 | 47 | return 0; |
---|
| 48 | + } |
---|
| 49 | + |
---|
| 50 | + /* Prevent overflow */ |
---|
| 51 | + if (stat->busy_time >= (1 << 24) || stat->total_time >= (1 << 24)) { |
---|
| 52 | + stat->busy_time >>= 7; |
---|
| 53 | + stat->total_time >>= 7; |
---|
70 | 54 | } |
---|
71 | 55 | |
---|
72 | 56 | /* Set MAX if it's busy enough */ |
---|
.. | .. |
---|
112 | 96 | devfreq_monitor_stop(devfreq); |
---|
113 | 97 | break; |
---|
114 | 98 | |
---|
115 | | - case DEVFREQ_GOV_INTERVAL: |
---|
116 | | - devfreq_interval_update(devfreq, (unsigned int *)data); |
---|
| 99 | + case DEVFREQ_GOV_UPDATE_INTERVAL: |
---|
| 100 | + devfreq_update_interval(devfreq, (unsigned int *)data); |
---|
117 | 101 | break; |
---|
118 | 102 | |
---|
119 | 103 | case DEVFREQ_GOV_SUSPEND: |
---|