summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/cpu-tegra.c
diff options
context:
space:
mode:
authorDiwakar Tundlam <dtundlam@nvidia.com>2012-09-26 15:22:24 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:39:22 -0700
commit6f8ed985ef8660b4cd0d2cd454c3210fb804a2d3 (patch)
treeaa6e0a5c8a88e7f4809c64bf7a812525365c30f5 /arch/arm/mach-tegra/cpu-tegra.c
parent01e9ae43dc9f72b3c014b3b81c9417edb68dd7f7 (diff)
arm: tegra: power: add throttle_count sysfs
Added counter to show number of throttling instances Change-Id: I3d1b4c0fe92aeb5b084edaea4051d48a3ce8b6d0 Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com> Reviewed-on: http://git-master/r/139094 (cherry picked from commit 8eb8dd9040260a7e703eff055994a8f5422ea062) Signed-off-by: Gaurav Batra <gbatra@nvidia.com> Reviewed-on: http://git-master/r/146671 Reviewed-by: Automatic_Commit_Validation_User Rebase-Id: R946eb680923d7b3d71959ed2e7717c01f1e92e99
Diffstat (limited to 'arch/arm/mach-tegra/cpu-tegra.c')
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index 3ade1eb66cdb..abb067414975 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -146,10 +146,34 @@ static unsigned int user_cap_speed(unsigned int requested_speed)
static ssize_t show_throttle(struct cpufreq_policy *policy, char *buf)
{
- return sprintf(buf, "%u\n", tegra_is_throttling());
+ return sprintf(buf, "%u\n", tegra_is_throttling(NULL));
}
cpufreq_freq_attr_ro(throttle);
+
+static ssize_t show_throttle_count(struct cpufreq_policy *policy, char *buf)
+{
+ int count;
+
+ tegra_is_throttling(&count);
+ return sprintf(buf, "%u\n", count);
+}
+
+static struct freq_attr _attr_throttle_count = {
+ .attr = {.name = "throttle_count", .mode = 0444, },
+ .show = show_throttle_count,
+};
+
+static struct attribute *new_attrs[] = {
+ &_attr_throttle_count.attr,
+ NULL
+};
+
+static struct attribute_group stats_attr_grp = {
+ .attrs = new_attrs,
+ .name = "stats"
+};
+
#endif /* CONFIG_TEGRA_THERMAL_THROTTLE */
#ifdef CONFIG_TEGRA_EDP_LIMITS
@@ -743,6 +767,7 @@ static int tegra_cpu_exit(struct cpufreq_policy *policy)
static int tegra_cpufreq_policy_notifier(
struct notifier_block *nb, unsigned long event, void *data)
{
+ static int once = 1;
int i, ret;
struct cpufreq_policy *policy = data;
@@ -751,6 +776,12 @@ static int tegra_cpufreq_policy_notifier(
policy->max, CPUFREQ_RELATION_H, &i);
policy_max_speed[policy->cpu] =
ret ? policy->max : freq_table[i].frequency;
+
+#ifdef CONFIG_TEGRA_THERMAL_THROTTLE
+ if (once && policy->cpu == 0 &&
+ sysfs_merge_group(&policy->kobj, &stats_attr_grp) == 0)
+ once = 0;
+#endif
}
return NOTIFY_OK;
}