summaryrefslogtreecommitdiff
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorJunjie Wu <junjiew@codeaurora.org>2014-10-30 12:13:03 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:04:06 -0700
commite6ce87f53cb1d37f63fb247c3b2120c1e902ff86 (patch)
tree2925bc4af6aa5cb41fc5ae0102f69c31528a546a /drivers/devfreq
parent95f77a9ab3376192880883af3c76493df7f97e9d (diff)
PM / devfreq: cache_hwmon: Use array for reporting monitor stats
Using an array to report monitor stats instead of hard coded variable names would allow for cleaner implementations of some cache hwmon device drivers. Change-Id: I787bdc12f10a0c8ff3c4195ce229a2987acdfce7 Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/governor_cache_hwmon.c15
-rw-r--r--drivers/devfreq/governor_cache_hwmon.h11
-rw-r--r--drivers/devfreq/krait-l2pm.c8
3 files changed, 20 insertions, 14 deletions
diff --git a/drivers/devfreq/governor_cache_hwmon.c b/drivers/devfreq/governor_cache_hwmon.c
index 1bce21cabec8..c47175b4a0c1 100644
--- a/drivers/devfreq/governor_cache_hwmon.c
+++ b/drivers/devfreq/governor_cache_hwmon.c
@@ -134,7 +134,8 @@ static unsigned long measure_mrps_and_set_irq(struct cache_hwmon_node *node,
dev_dbg(hw->df->dev.parent,
"stat H=%3lu, M=%3lu, T=%3lu, b=%3u, f=%4lu, us=%d\n",
- stat->high, stat->med, stat->high + stat->med,
+ stat->mrps[HIGH], stat->mrps[MED],
+ stat->mrps[HIGH] + stat->mrps[MED],
stat->busy_percent, hw->df->previous_freq / 1000, us);
return 0;
@@ -146,9 +147,9 @@ static void compute_cache_freq(struct cache_hwmon_node *node,
unsigned long new_mhz;
unsigned int busy;
- new_mhz = mrps->high * node->cycles_per_high_req
- + mrps->med * node->cycles_per_med_req
- + mrps->low * node->cycles_per_low_req;
+ new_mhz = mrps->mrps[HIGH] * node->cycles_per_high_req
+ + mrps->mrps[MED] * node->cycles_per_med_req
+ + mrps->mrps[LOW] * node->cycles_per_low_req;
busy = max(node->min_busy, mrps->busy_percent);
busy = min(node->max_busy, busy);
@@ -278,9 +279,9 @@ static int start_monitoring(struct devfreq *df)
node->prev_ts = ktime_get();
node->prev_mhz = 0;
- mrps.high = (df->previous_freq / 1000) - node->guard_band_mhz;
- mrps.high /= node->cycles_per_high_req;
- mrps.med = mrps.low = 0;
+ mrps.mrps[HIGH] = (df->previous_freq / 1000) - node->guard_band_mhz;
+ mrps.mrps[HIGH] /= node->cycles_per_high_req;
+ mrps.mrps[MED] = mrps.mrps[LOW] = 0;
ret = hw->start_hwmon(hw, &mrps);
if (ret) {
diff --git a/drivers/devfreq/governor_cache_hwmon.h b/drivers/devfreq/governor_cache_hwmon.h
index e0de9c01c631..b3748ac266e9 100644
--- a/drivers/devfreq/governor_cache_hwmon.h
+++ b/drivers/devfreq/governor_cache_hwmon.h
@@ -17,10 +17,15 @@
#include <linux/kernel.h>
#include <linux/devfreq.h>
+enum request_group {
+ HIGH,
+ MED,
+ LOW,
+ MAX_NUM_GROUPS,
+};
+
struct mrps_stats {
- unsigned long high;
- unsigned long med;
- unsigned long low;
+ unsigned long mrps[MAX_NUM_GROUPS];
unsigned int busy_percent;
};
diff --git a/drivers/devfreq/krait-l2pm.c b/drivers/devfreq/krait-l2pm.c
index 979f5fa8a0eb..329d0422fe1b 100644
--- a/drivers/devfreq/krait-l2pm.c
+++ b/drivers/devfreq/krait-l2pm.c
@@ -328,9 +328,9 @@ static unsigned long meas_mrps_and_set_irq(struct cache_hwmon *hw,
mon_enable(L2_M_REQ_MON);
mon_enable(L2_CYC_MON);
- mrps->high = t_mrps - m_mrps;
- mrps->med = m_mrps;
- mrps->low = 0;
+ mrps->mrps[HIGH] = t_mrps - m_mrps;
+ mrps->mrps[MED] = m_mrps;
+ mrps->mrps[LOW] = 0;
mrps->busy_percent = mult_frac(l2_cyc, 1000, us) * 100 / f;
return 0;
@@ -363,7 +363,7 @@ static int start_mrps_hwmon(struct cache_hwmon *hw, struct mrps_stats *mrps)
mon_disable(L2_M_REQ_MON);
mon_disable(L2_CYC_MON);
- limit = mrps_to_count(mrps->high, hw->df->profile->polling_ms, 0);
+ limit = mrps_to_count(mrps->mrps[HIGH], hw->df->profile->polling_ms, 0);
prev_req_start_val = mon_set_limit(L2_H_REQ_MON, limit);
mon_set_limit(L2_M_REQ_MON, 0xFFFFFFFF);
mon_set_limit(L2_CYC_MON, 0xFFFFFFFF);