aboutsummaryrefslogtreecommitdiff
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index faa879fd0..3b49b7948 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -941,6 +941,26 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att
return len;
}
+static ssize_t show_time_in_state(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct devfreq *devfreq = to_devfreq(dev);
+
+ ssize_t len = 0;
+ int i, err;
+ unsigned int max_state = devfreq->profile->max_state;
+
+ err = devfreq_update_status(devfreq, devfreq->previous_freq);
+ if (err)
+ return 0;
+
+ for (i = 0; i < max_state; i++) {
+ len += sprintf(buf + len, "%u %u\n", devfreq->profile->freq_table[i],
+ jiffies_to_msecs(devfreq->time_in_state[i]));
+ }
+ return len;
+}
+
static struct device_attribute devfreq_attrs[] = {
__ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor),
__ATTR(available_governors, S_IRUGO, show_available_governors, NULL),
@@ -952,6 +972,7 @@ static struct device_attribute devfreq_attrs[] = {
__ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq),
__ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq),
__ATTR(trans_stat, S_IRUGO, show_trans_table, NULL),
+ __ATTR(time_in_state, S_IRUGO, show_time_in_state, NULL),
{ },
};