Commit 754172e0 authored by Mauro Ribeiro's avatar Mauro Ribeiro Committed by Gerrit Code Review

Merge "exynos: thermal: show throttle counters." into odroidxu3-3.10.y

parents 87a3c28f bf33772f
......@@ -226,6 +226,8 @@ static enum mif_noti_state_t mif_old_state = MIF_TH_LV1;
static bool is_suspending;
static bool is_cpu_hotplugged_out;
static unsigned long ctmu_normal, ctmu_cold, ctmu_hot, ctmu_critical, throttle_cpu;
static BLOCKING_NOTIFIER_HEAD(exynos_tmu_notifier);
static BLOCKING_NOTIFIER_HEAD(exynos_gpu_notifier);
......@@ -540,18 +542,35 @@ static void exynos_check_tmu_noti_state(int min_temp, int max_temp)
enum tmu_noti_state_t cur_state;
/* check current temperature state */
if (max_temp > HOT_CRITICAL_TEMP)
if (max_temp > HOT_CRITICAL_TEMP) {
cur_state = TMU_CRITICAL;
else if (max_temp > HOT_NORMAL_TEMP && max_temp <= HOT_CRITICAL_TEMP)
ctmu_critical++;
} else if (max_temp > HOT_NORMAL_TEMP && max_temp <= HOT_CRITICAL_TEMP) {
cur_state = TMU_HOT;
else if (max_temp > COLD_TEMP && max_temp <= HOT_NORMAL_TEMP)
ctmu_hot++;
} else if (max_temp > COLD_TEMP && max_temp <= HOT_NORMAL_TEMP) {
cur_state = TMU_NORMAL;
else
ctmu_normal++;
} else {
cur_state = TMU_COLD;
ctmu_cold++;
}
if (min_temp <= COLD_TEMP)
cur_state = TMU_COLD;
/* Just to check for overflow */
if (ctmu_critical >= ULONG_MAX)
ctmu_critical = 0;
if (ctmu_hot >= ULONG_MAX)
ctmu_hot = 0;
if (ctmu_normal >= ULONG_MAX)
ctmu_normal = 0;
if (ctmu_cold > ULONG_MAX)
ctmu_cold = 0;
if (throttle_cpu > ULONG_MAX)
throttle_cpu = 0;
exynos_tmu_call_notifier(cur_state, max_temp);
}
......@@ -666,6 +685,7 @@ static int __ref exynos_throttle_cpu_hotplug(struct thermal_zone_device *thermal
* If current temperature is lower than low threshold,
* call big_cores_hotplug(false) for hotplugged out cpus.
*/
throttle_cpu++;
ret = big_cores_hotplug(false);
if (ret)
pr_err("%s: failed big cores hotplug in\n",
......@@ -679,6 +699,7 @@ static int __ref exynos_throttle_cpu_hotplug(struct thermal_zone_device *thermal
* If current temperature is higher than high threshold,
* call big_cores_hotplug(true) to hold temperature down.
*/
throttle_cpu++;
ret = big_cores_hotplug(true);
if (ret)
pr_err("%s: failed big cores hotplug out\n",
......@@ -1778,8 +1799,25 @@ exynos_thermal_sensor_temp(struct device *dev,
static DEVICE_ATTR(temp, S_IRUSR | S_IRGRP, exynos_thermal_sensor_temp, NULL);
static ssize_t exynos_throttle_counter(struct device *dev,
struct device_attribute *attr, char *buf)
{
int len = 0;
len += snprintf(&buf[len], PAGE_SIZE, "TMU_NORMAL :%ld\n", ctmu_normal);
len += snprintf(&buf[len], PAGE_SIZE, "TMU_COLD :%ld\n", ctmu_cold);
len += snprintf(&buf[len], PAGE_SIZE, "TMU_HOT :%ld\n", ctmu_hot);
len += snprintf(&buf[len], PAGE_SIZE, "TMU_CRITICAL :%ld\n", ctmu_critical);
len += snprintf(&buf[len], PAGE_SIZE, "THROTTLE_CPU :%ld\n", throttle_cpu);
return len;
}
static DEVICE_ATTR(throttle, S_IRUGO, exynos_throttle_counter, NULL);
static struct attribute *exynos_thermal_sensor_attributes[] = {
&dev_attr_temp.attr,
&dev_attr_throttle.attr,
NULL
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment