Merge "msm: thermal: Update debug/error logs to be more informative"
diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c
index 81b683d..e5eb9b2 100644
--- a/drivers/thermal/msm_thermal.c
+++ b/drivers/thermal/msm_thermal.c
@@ -11,6 +11,8 @@
*
*/
+#define pr_fmt(fmt) "%s:%s " fmt, KBUILD_MODNAME, __func__
+
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
@@ -257,8 +259,8 @@
switch (event) {
case CPUFREQ_INCOMPATIBLE:
- pr_debug("%s: mitigating cpu %d to freq max: %u min: %u\n",
- KBUILD_MODNAME, policy->cpu, max_freq_req, min_freq_req);
+ pr_debug("mitigating CPU%d to freq max: %u min: %u\n",
+ policy->cpu, max_freq_req, min_freq_req);
cpufreq_verify_within_limits(policy, min_freq_req,
max_freq_req);
@@ -283,7 +285,7 @@
table = cpufreq_frequency_get_table(0);
if (!table) {
- pr_debug("%s: error reading cpufreq table\n", __func__);
+ pr_debug("error reading cpufreq table\n");
return -EINVAL;
}
freq_table_get = 1;
@@ -293,9 +295,13 @@
static void update_cpu_freq(int cpu)
{
+ int ret = 0;
+
if (cpu_online(cpu)) {
- if (cpufreq_update_policy(cpu))
- pr_err("Unable to update policy for cpu:%d\n", cpu);
+ ret = cpufreq_update_policy(cpu);
+ if (ret)
+ pr_err("Unable to update policy for cpu:%d. err:%d\n",
+ cpu, ret);
}
}
@@ -307,13 +313,14 @@
if (!freq_table_get) {
ret = check_freq_table();
if (ret) {
- pr_err("%s:Fail to get freq table\n", KBUILD_MODNAME);
+ pr_err("Fail to get freq table. err:%d\n", ret);
return ret;
}
}
/* If min is larger than allowed max */
min = min(min, table[limit_idx_high].frequency);
+ pr_debug("Requesting min freq:%u for all CPU's\n", min);
if (freq_mitigation_task) {
min_freq_limit = min;
complete(&freq_mitigation_complete);
@@ -362,7 +369,7 @@
int ret = 0;
if (r->reg == NULL) {
- pr_info("Do not have regulator handle:%s, can't apply vdd\n",
+ pr_err("%s don't have regulator handle. can't apply vdd\n",
r->name);
return -EFAULT;
}
@@ -375,11 +382,15 @@
r->levels[r->num_levels - 1]);
if (!ret)
r->curr_level = -1;
+ pr_debug("Requested min level for %s. curr level: %d\n",
+ r->name, r->curr_level);
} else if (level >= 0 && level < (r->num_levels)) {
ret = regulator_set_voltage(r->reg, r->levels[level],
r->levels[r->num_levels - 1]);
if (!ret)
r->curr_level = level;
+ pr_debug("Requesting level %d for %s. curr level: %d\n",
+ r->levels[level], r->name, r->levels[r->curr_level]);
} else {
pr_err("level input:%d is not within range\n", level);
return -EINVAL;
@@ -395,12 +406,13 @@
int fail_cnt = 0;
int ret = 0;
+ pr_debug("Requesting PMIC Mode: %d\n", mode);
for (i = 0; i < psm_rails_cnt; i++) {
if (psm_rails[i].mode != mode) {
ret = rpm_regulator_set_mode(psm_rails[i].reg, mode);
if (ret) {
- pr_err("Cannot set mode:%d for %s",
- mode, psm_rails[i].name);
+ pr_err("Cannot set mode:%d for %s. err:%d",
+ mode, psm_rails[i].name, ret);
fail_cnt++;
} else
psm_rails[i].mode = mode;
@@ -473,6 +485,8 @@
en->enabled = 1;
else if (!val && (dis_cnt == rails_cnt))
en->enabled = 0;
+ pr_debug("%s vdd restriction. curr: %d\n",
+ (val) ? "Enable" : "Disable", en->enabled);
done_vdd_rstr_en:
mutex_unlock(&vdd_rstr_mutex);
@@ -547,12 +561,14 @@
ret = vdd_restriction_apply_voltage(reg, val);
if (ret) {
pr_err( \
- "Set vdd restriction for regulator %s failed\n",
- reg->name);
+ "Set vdd restriction for regulator %s failed. err:%d\n",
+ reg->name, ret);
goto done_store_level;
}
}
reg->curr_level = val;
+ pr_debug("Request level %d for %s\n",
+ reg->curr_level, reg->name);
}
done_store_level:
@@ -668,16 +684,15 @@
}
if ((val != PMIC_PWM_MODE) && (val != PMIC_AUTO_MODE)) {
- pr_err(" Invalid number %d for mode\n", val);
+ pr_err("Invalid number %d for mode\n", val);
goto done_psm_store;
}
if (val != reg->mode) {
ret = rpm_regulator_set_mode(reg->reg, val);
if (ret) {
- pr_err( \
- "Fail to set PMIC SW Mode:%d for %s\n",
- val, reg->name);
+ pr_err("Fail to set Mode:%d for %s. err:%d\n",
+ val, reg->name, ret);
goto done_psm_store;
}
reg->mode = val;
@@ -701,7 +716,7 @@
}
}
if (!hw_id_found) {
- pr_err("%s: Invalid sensor hw id :%d\n", __func__, sensor_id);
+ pr_err("Invalid sensor hw id:%d\n", sensor_id);
return -EINVAL;
}
@@ -716,8 +731,7 @@
tsens_id_map = kzalloc(sizeof(int) * max_tsens_num,
GFP_KERNEL);
if (!tsens_id_map) {
- pr_err("%s: Cannot allocate memory for tsens_id_map\n",
- __func__);
+ pr_err("Cannot allocate memory for tsens_id_map\n");
return -ENOMEM;
}
@@ -729,9 +743,8 @@
tsens_id_map[i] = i;
ret = 0;
} else {
- pr_err( \
- "%s: Failed to get hw id for sw id %d\n",
- __func__, i);
+ pr_err("Failed to get hw id for id:%d.err:%d\n",
+ i, ret);
goto fail;
}
}
@@ -760,7 +773,9 @@
ret = vdd_restriction_apply_voltage(&rails[i],
en ? 0 : -1);
if (ret) {
- pr_err("Cannot set voltage for %s", rails[i].name);
+ pr_err("Failed to %s for %s. err:%d",
+ (en) ? "enable" : "disable",
+ rails[i].name, ret);
fail_cnt++;
} else {
if (en)
@@ -792,7 +807,7 @@
table = cpufreq_frequency_get_table(0);
if (table == NULL) {
- pr_debug("%s: error reading cpufreq table\n", KBUILD_MODNAME);
+ pr_err("error reading cpufreq table\n");
ret = -EINVAL;
goto fail;
}
@@ -814,15 +829,15 @@
ret = sensor_set_trip(sensor_id, threshold);
if (ret != 0) {
- pr_err("%s: Error in setting trip %d\n",
- KBUILD_MODNAME, threshold->trip);
+ pr_err("sensor:%u Error in setting trip:%d. err:%d\n",
+ sensor_id, threshold->trip, ret);
goto set_done;
}
ret = sensor_activate_trip(sensor_id, threshold, true);
if (ret != 0) {
- pr_err("%s: Error in enabling trip %d\n",
- KBUILD_MODNAME, threshold->trip);
+ pr_err("sensor:%u Error in enabling trip:%d. err:%d\n",
+ sensor_id, threshold->trip, ret);
goto set_done;
}
@@ -857,7 +872,7 @@
ret = tsens_get_temp(&tsens_dev, temp);
if (ret) {
- pr_err("Unable to read TSENS sensor %d\n",
+ pr_err("Unable to read TSENS sensor:%d\n",
tsens_dev.sensor_num);
goto get_temp_exit;
}
@@ -873,14 +888,17 @@
long temp;
if ((!threshold) || (zone_id >= max_tsens_num)) {
- pr_err("%s: Invalid input\n", KBUILD_MODNAME);
+ pr_err("Invalid input\n");
ret = -EINVAL;
goto set_threshold_exit;
}
ret = therm_get_temp(zone_id, THERM_ZONE_ID, &temp);
- if (ret)
+ if (ret) {
+ pr_err("Unable to read temperature for zone:%d. err:%d\n",
+ zone_id, ret);
goto set_threshold_exit;
+ }
while (i < MAX_THRESHOLD) {
switch (threshold[i].trip) {
@@ -901,6 +919,8 @@
}
break;
default:
+ pr_err("zone:%u Invalid trip:%d\n", zone_id,
+ threshold[i].trip);
break;
}
i++;
@@ -926,12 +946,12 @@
continue;
if (cpus_offlined & BIT(i) && !cpu_online(i))
continue;
- pr_info("%s: Set Offline: CPU%d Temp: %ld\n",
- KBUILD_MODNAME, i, temp);
+ pr_info("Set Offline: CPU%d Temp: %ld\n",
+ i, temp);
ret = cpu_down(i);
if (ret)
- pr_err("%s: Error %d offline core %d\n",
- KBUILD_MODNAME, ret, i);
+ pr_err("Error %d offline core %d\n",
+ ret, i);
cpus_offlined |= BIT(i);
break;
}
@@ -942,8 +962,8 @@
if (!(cpus_offlined & BIT(i)))
continue;
cpus_offlined &= ~BIT(i);
- pr_info("%s: Allow Online CPU%d Temp: %ld\n",
- KBUILD_MODNAME, i, temp);
+ pr_info("Allow Online CPU%d Temp: %ld\n",
+ i, temp);
/*
* If this core is already online, then bring up the
* next offlined core.
@@ -952,8 +972,8 @@
continue;
ret = cpu_up(i);
if (ret)
- pr_err("%s: Error %d online core %d\n",
- KBUILD_MODNAME, ret, i);
+ pr_err("Error %d online core %d\n",
+ ret, i);
break;
}
}
@@ -977,8 +997,10 @@
continue;
ret = cpu_down(cpu);
if (ret)
- pr_err("%s: Unable to offline cpu%d\n",
- KBUILD_MODNAME, cpu);
+ pr_err("Unable to offline CPU%d. err:%d\n",
+ cpu, ret);
+ else
+ pr_debug("Offlined CPU%d\n", cpu);
}
return ret;
}
@@ -988,8 +1010,10 @@
int ret = 0;
uint32_t cpu = 0, mask = 0;
- if (!core_control_enabled)
+ if (!core_control_enabled) {
+ pr_debug("Core control disabled\n");
return -EINVAL;
+ }
while (!kthread_should_stop()) {
while (wait_for_completion_interruptible(
@@ -1056,7 +1080,11 @@
ocr_rails[j].init = OPTIMUM_CURRENT_NR;
ret = ocr_set_mode_all(OPTIMUM_CURRENT_MAX);
if (ret)
- pr_err("Error setting max optimum current\n");
+ pr_err("Error setting max ocr. err:%d\n",
+ ret);
+ else
+ pr_debug("Requested MAX OCR. tsens:%d Temp:%ld",
+ tsens_id_map[i], temp);
goto do_ocr_exit;
} else if (temp <= (msm_thermal_info.ocr_temp_degC -
msm_thermal_info.ocr_temp_hyst_degC))
@@ -1077,6 +1105,8 @@
if (ret) {
pr_err("Error setting min optimum current\n");
goto do_ocr_exit;
+ } else {
+ pr_debug("Requested MIN OCR. Temp:%ld", temp);
}
}
@@ -1104,8 +1134,8 @@
for (i = 0; i < max_tsens_num; i++) {
ret = therm_get_temp(tsens_id_map[i], THERM_TSENS_ID, &temp);
if (ret) {
- pr_debug("Unable to read TSENS sensor %d\n",
- tsens_id_map[i]);
+ pr_err("Unable to read TSENS sensor:%d. err:%d\n",
+ tsens_id_map[i], ret);
dis_cnt++;
continue;
}
@@ -1113,9 +1143,13 @@
ret = vdd_restriction_apply_all(1);
if (ret) {
pr_err( \
- "Enable vdd rstr votlage for all failed\n");
+ "Enable vdd rstr for all failed. err:%d\n",
+ ret);
goto exit;
}
+ pr_debug("Enabled Vdd Restriction tsens:%d. Temp:%ld\n",
+ thresh[MSM_VDD_RESTRICTION].thresh_list[i].sensor_id,
+ temp);
goto exit;
} else if (temp > msm_thermal_info.vdd_rstr_temp_hyst_degC)
dis_cnt++;
@@ -1123,9 +1157,11 @@
if (dis_cnt == max_tsens_num) {
ret = vdd_restriction_apply_all(0);
if (ret) {
- pr_err("Disable vdd rstr votlage for all failed\n");
+ pr_err("Disable vdd rstr for all failed. err:%d\n",
+ ret);
goto exit;
}
+ pr_debug("Disabled Vdd Restriction\n");
}
exit:
mutex_unlock(&vdd_rstr_mutex);
@@ -1143,8 +1179,8 @@
for (i = 0; i < max_tsens_num; i++) {
ret = therm_get_temp(tsens_id_map[i], THERM_TSENS_ID, &temp);
if (ret) {
- pr_debug("%s: Unable to read TSENS sensor %d\n",
- __func__, tsens_id_map[i]);
+ pr_err("Unable to read TSENS sensor:%d. err:%d\n",
+ tsens_id_map[i], ret);
auto_cnt++;
continue;
}
@@ -1157,9 +1193,12 @@
if (temp > msm_thermal_info.psm_temp_degC) {
ret = psm_set_mode_all(PMIC_PWM_MODE);
if (ret) {
- pr_err("Set pwm mode for all failed\n");
+ pr_err("Set pwm mode for all failed. err:%d\n",
+ ret);
goto exit;
}
+ pr_debug("Requested PMIC PWM Mode tsens:%d. Temp:%ld\n",
+ tsens_id_map[i], temp);
break;
} else if (temp <= msm_thermal_info.psm_temp_hyst_degC)
auto_cnt++;
@@ -1168,9 +1207,10 @@
if (auto_cnt == max_tsens_num) {
ret = psm_set_mode_all(PMIC_AUTO_MODE);
if (ret) {
- pr_err("Set auto mode for all failed\n");
+ pr_err("Set auto mode for all failed. err:%d\n", ret);
goto exit;
}
+ pr_debug("Requested PMIC AUTO Mode\n");
}
exit:
@@ -1212,6 +1252,8 @@
for_each_possible_cpu(cpu) {
if (!(msm_thermal_info.bootup_freq_control_mask & BIT(cpu)))
continue;
+ pr_info("Limiting CPU%d max frequency to %u. Temp:%ld\n",
+ cpu, max_freq, temp);
cpus[cpu].limited_max_freq = max_freq;
update_cpu_freq(cpu);
}
@@ -1226,8 +1268,8 @@
ret = therm_get_temp(msm_thermal_info.sensor_id, THERM_TSENS_ID, &temp);
if (ret) {
- pr_debug("Unable to read TSENS sensor %d\n",
- msm_thermal_info.sensor_id);
+ pr_err("Unable to read TSENS sensor:%d. err:%d\n",
+ msm_thermal_info.sensor_id, ret);
goto reschedule;
}
@@ -1260,14 +1302,13 @@
if (core_control_enabled &&
(msm_thermal_info.core_control_mask & BIT(cpu)) &&
(cpus_offlined & BIT(cpu))) {
- pr_debug(
- "%s: Preventing cpu%d from coming online.\n",
- KBUILD_MODNAME, cpu);
+ pr_debug("Preventing CPU%d from coming online.\n",
+ cpu);
return NOTIFY_BAD;
}
}
-
+ pr_debug("voting for CPU%d to be online\n", cpu);
return NOTIFY_OK;
}
@@ -1312,8 +1353,7 @@
{
struct cpu_info *cpu_node = (struct cpu_info *)data;
- pr_info("%s: %s reach temp threshold: %d\n", KBUILD_MODNAME,
- cpu_node->sensor_type, temp);
+ pr_info("%s reach temp threshold: %d\n", cpu_node->sensor_type, temp);
if (!(msm_thermal_info.core_control_mask & BIT(cpu_node->cpu)))
return 0;
@@ -1333,7 +1373,7 @@
cpu_node->hotplug_thresh_clear = true;
complete(&hotplug_notify_complete);
} else {
- pr_err("%s: Hotplug task is not initialized\n", KBUILD_MODNAME);
+ pr_err("Hotplug task is not initialized\n");
}
return 0;
}
@@ -1352,8 +1392,8 @@
continue;
if (therm_get_temp(cpus[cpu].sensor_id, cpus[cpu].id_type,
&temp)) {
- pr_err("%s: Unable to read TSENS sensor %d\n",
- KBUILD_MODNAME, cpus[cpu].sensor_id);
+ pr_err("Unable to read TSENS sensor:%d.\n",
+ cpus[cpu].sensor_id);
mutex_unlock(&core_control_mutex);
return -EINVAL;
}
@@ -1369,8 +1409,7 @@
if (hotplug_task)
complete(&hotplug_notify_complete);
else {
- pr_err("%s: Hotplug task is not initialized\n",
- KBUILD_MODNAME);
+ pr_err("Hotplug task is not initialized\n");
return -EINVAL;
}
return 0;
@@ -1410,8 +1449,8 @@
init_completion(&hotplug_notify_complete);
hotplug_task = kthread_run(do_hotplug, NULL, "msm_thermal:hotplug");
if (IS_ERR(hotplug_task)) {
- pr_err("%s: Failed to create do_hotplug thread\n",
- KBUILD_MODNAME);
+ pr_err("Failed to create do_hotplug thread. err:%ld\n",
+ PTR_ERR(hotplug_task));
return;
}
/*
@@ -1471,7 +1510,7 @@
{
struct cpu_info *cpu_node = (struct cpu_info *) data;
- pr_debug("%s: %s reached temp threshold: %d\n", KBUILD_MODNAME,
+ pr_debug("%s reached temp threshold: %d\n",
cpu_node->sensor_type, temp);
if (!(msm_thermal_info.freq_mitig_control_mask &
@@ -1481,8 +1520,8 @@
switch (type) {
case THERMAL_TRIP_CONFIGURABLE_HI:
if (!cpu_node->max_freq) {
- pr_info("%s: Mitigating cpu %d frequency to %d\n",
- KBUILD_MODNAME, cpu_node->cpu,
+ pr_info("Mitigating CPU%d frequency to %d\n",
+ cpu_node->cpu,
msm_thermal_info.freq_limit);
cpu_node->max_freq = true;
@@ -1490,8 +1529,8 @@
break;
case THERMAL_TRIP_CONFIGURABLE_LOW:
if (cpu_node->max_freq) {
- pr_info("%s: Removing frequency mitigation for cpu%d\n",
- KBUILD_MODNAME, cpu_node->cpu);
+ pr_info("Removing frequency mitigation for CPU%d\n",
+ cpu_node->cpu);
cpu_node->max_freq = false;
}
@@ -1504,8 +1543,7 @@
cpu_node->freq_thresh_clear = true;
complete(&freq_mitigation_complete);
} else {
- pr_err("%s: Frequency mitigation task is not initialized\n",
- KBUILD_MODNAME);
+ pr_err("Frequency mitigation task is not initialized\n");
}
return 0;
@@ -1544,8 +1582,8 @@
"msm_thermal:freq_mitig");
if (IS_ERR(freq_mitigation_task)) {
- pr_err("%s: Failed to create frequency mitigation thread\n",
- KBUILD_MODNAME);
+ pr_err("Failed to create frequency mitigation thread. err:%ld\n",
+ PTR_ERR(freq_mitigation_task));
return;
}
}
@@ -1555,11 +1593,13 @@
int ret = 0;
if (cpu >= num_possible_cpus()) {
- pr_err("%s: Invalid input\n", KBUILD_MODNAME);
+ pr_err("Invalid input\n");
ret = -EINVAL;
goto set_freq_exit;
}
+ pr_debug("Userspace requested %s frequency %u for CPU%u\n",
+ (is_max) ? "Max" : "Min", freq, cpu);
if (is_max) {
if (cpus[cpu].user_max_freq == freq)
goto set_freq_exit;
@@ -1575,8 +1615,7 @@
if (freq_mitigation_task) {
complete(&freq_mitigation_complete);
} else {
- pr_err("%s: Frequency mitigation task is not initialized\n",
- KBUILD_MODNAME);
+ pr_err("Frequency mitigation task is not initialized\n");
ret = -ESRCH;
goto set_freq_exit;
}
@@ -1591,8 +1630,7 @@
struct therm_threshold *thresh_ptr;
if (!thresh_inp) {
- pr_err("%s: %s: Invalid input\n",
- KBUILD_MODNAME, __func__);
+ pr_err("Invalid input\n");
ret = -EINVAL;
goto therm_set_exit;
}
@@ -1621,16 +1659,17 @@
if (!vdd_rstr_enabled)
return;
if (!trig_thresh) {
- pr_err("%s:%s Invalid input\n", KBUILD_MODNAME, __func__);
+ pr_err("Invalid input\n");
return;
}
if (trig_thresh->trip_triggered < 0)
goto set_and_exit;
mutex_lock(&vdd_rstr_mutex);
- pr_debug("%s: sensor%d reached %d thresh for Vdd restriction\n",
- KBUILD_MODNAME, trig_thresh->sensor_id,
- trig_thresh->trip_triggered);
+ pr_debug("sensor:%d reached %s thresh for Vdd restriction\n",
+ tsens_id_map[trig_thresh->sensor_id],
+ (trig_thresh->trip_triggered == THERMAL_TRIP_CONFIGURABLE_HI) ?
+ "high" : "low");
switch (trig_thresh->trip_triggered) {
case THERMAL_TRIP_CONFIGURABLE_HI:
if (vdd_sens_status & BIT(trig_thresh->sensor_id))
@@ -1640,8 +1679,7 @@
vdd_sens_status |= BIT(trig_thresh->sensor_id);
break;
default:
- pr_err("%s:%s: Unsupported trip type\n",
- KBUILD_MODNAME, __func__);
+ pr_err("Unsupported trip type\n");
goto unlock_and_exit;
break;
}
@@ -1697,8 +1735,8 @@
thermal_monitor_task = kthread_run(do_thermal_monitor, NULL,
"msm_thermal:therm_monitor");
if (IS_ERR(thermal_monitor_task)) {
- pr_err("%s: Failed to create thermal monitor thread\n",
- KBUILD_MODNAME);
+ pr_err("Failed to create thermal monitor thread. err:%ld\n",
+ PTR_ERR(thermal_monitor_task));
goto init_exit;
}
@@ -1718,8 +1756,7 @@
thresh_data->parent->thresh_triggered = true;
complete(&thermal_monitor_complete);
} else {
- pr_err("%s: Thermal monitor task is not initialized\n",
- KBUILD_MODNAME);
+ pr_err("Thermal monitor task is not initialized\n");
}
return 0;
}
@@ -1733,14 +1770,13 @@
if (!callback || index >= MSM_LIST_MAX_NR || index < 0
|| sensor_id == -ENODEV) {
- pr_err("%s: Invalid input to init_threshold\n",
- KBUILD_MODNAME);
+ pr_err("Invalid input. sensor:%d. index:%d\n",
+ sensor_id, index);
ret = -EINVAL;
goto init_thresh_exit;
}
if (thresh[index].thresh_list) {
- pr_err("%s: threshold already initialized\n",
- KBUILD_MODNAME);
+ pr_err("threshold id:%d already initialized\n", index);
ret = -EEXIST;
goto init_thresh_exit;
}
@@ -1751,7 +1787,7 @@
thresh[index].thresh_list = kzalloc(sizeof(struct therm_threshold) *
thresh[index].thresh_ct, GFP_KERNEL);
if (!thresh[index].thresh_list) {
- pr_err("%s: kzalloc failed\n", KBUILD_MODNAME);
+ pr_err("kzalloc failed for thresh index:%d\n", index);
ret = -ENOMEM;
goto init_thresh_exit;
}
@@ -1813,6 +1849,7 @@
if (cpus[cpu].limited_max_freq == UINT_MAX &&
cpus[cpu].limited_min_freq == 0)
continue;
+ pr_info("Max frequency reset for CPU%d\n", cpu);
cpus[cpu].limited_max_freq = UINT_MAX;
cpus[cpu].limited_min_freq = 0;
update_cpu_freq(cpu);
@@ -1827,7 +1864,7 @@
return;
}
if (polling_enabled) {
- pr_info("%s: Interrupt mode init\n", KBUILD_MODNAME);
+ pr_info("Interrupt mode init\n");
polling_enabled = 0;
disable_msm_thermal();
hotplug_init();
@@ -1844,10 +1881,10 @@
if (!enabled)
interrupt_mode_init();
else
- pr_info("%s: no action for enabled = %d\n",
- KBUILD_MODNAME, enabled);
+ pr_info("no action for enabled = %d\n",
+ enabled);
- pr_info("%s: enabled = %d\n", KBUILD_MODNAME, enabled);
+ pr_info("enabled = %d\n", enabled);
return ret;
}
@@ -1874,7 +1911,7 @@
ret = kstrtoint(buf, 10, &val);
if (ret) {
- pr_err("%s: Invalid input %s\n", KBUILD_MODNAME, buf);
+ pr_err("Invalid input %s. err:%d\n", buf, ret);
goto done_store_cc;
}
@@ -1883,15 +1920,14 @@
core_control_enabled = !!val;
if (core_control_enabled) {
- pr_info("%s: Core control enabled\n", KBUILD_MODNAME);
+ pr_info("Core control enabled\n");
register_cpu_notifier(&msm_thermal_cpu_notifier);
if (hotplug_task)
complete(&hotplug_notify_complete);
else
- pr_err("%s: Hotplug task is not initialized\n",
- KBUILD_MODNAME);
+ pr_err("Hotplug task is not initialized\n");
} else {
- pr_info("%s: Core control disabled\n", KBUILD_MODNAME);
+ pr_info("Core control disabled\n");
unregister_cpu_notifier(&msm_thermal_cpu_notifier);
}
@@ -1915,13 +1951,12 @@
mutex_lock(&core_control_mutex);
ret = kstrtouint(buf, 10, &val);
if (ret) {
- pr_err("%s: Invalid input %s\n", KBUILD_MODNAME, buf);
+ pr_err("Invalid input %s. err:%d\n", buf, ret);
goto done_cc;
}
if (polling_enabled) {
- pr_err("%s: Ignoring request; polling thread is enabled.\n",
- KBUILD_MODNAME);
+ pr_err("Ignoring request; polling thread is enabled.\n");
goto done_cc;
}
@@ -1929,12 +1964,15 @@
if (!(msm_thermal_info.core_control_mask & BIT(cpu)))
continue;
cpus[cpu].user_offline = !!(val & BIT(cpu));
+ pr_debug("\"%s\"(PID:%i) requests %s CPU%d.\n", current->comm,
+ current->pid, (cpus[cpu].user_offline) ? "offline" :
+ "online", cpu);
}
if (hotplug_task)
complete(&hotplug_notify_complete);
else
- pr_err("%s: Hotplug task is not initialized\n", KBUILD_MODNAME);
+ pr_err("Hotplug task is not initialized\n");
done_cc:
mutex_unlock(&core_control_mutex);
return count;
@@ -2009,23 +2047,21 @@
module_kobj = kset_find_obj(module_kset, KBUILD_MODNAME);
if (!module_kobj) {
- pr_err("%s: cannot find kobject for module\n",
- KBUILD_MODNAME);
+ pr_err("cannot find kobject\n");
ret = -ENOENT;
goto done_cc_nodes;
}
cc_kobj = kobject_create_and_add("core_control", module_kobj);
if (!cc_kobj) {
- pr_err("%s: cannot create core control kobj\n",
- KBUILD_MODNAME);
+ pr_err("cannot create core control kobj\n");
ret = -ENOMEM;
goto done_cc_nodes;
}
ret = sysfs_create_group(cc_kobj, &cc_attr_group);
if (ret) {
- pr_err("%s: cannot create group\n", KBUILD_MODNAME);
+ pr_err("cannot create sysfs group. err:%d\n", ret);
goto done_cc_nodes;
}
@@ -2078,6 +2114,7 @@
tsens_get_max_sensor_num(&max_tsens_num);
if (create_sensor_id_map()) {
+ pr_err("Creating sensor id map failed\n");
ret = -EINVAL;
goto pre_init_exit;
}
@@ -2087,8 +2124,7 @@
sizeof(struct threshold_info) * MSM_LIST_MAX_NR,
GFP_KERNEL);
if (!thresh) {
- pr_err("%s:%s: kzalloc failed\n",
- KBUILD_MODNAME, __func__);
+ pr_err("kzalloc failed\n");
ret = -ENOMEM;
goto pre_init_exit;
}
@@ -2119,16 +2155,19 @@
BUG_ON(!pdata);
memcpy(&msm_thermal_info, pdata, sizeof(struct msm_thermal_data));
- if (check_sensor_id(msm_thermal_info.sensor_id))
+ if (check_sensor_id(msm_thermal_info.sensor_id)) {
+ pr_err("Invalid sensor:%d for polling\n",
+ msm_thermal_info.sensor_id);
return -EINVAL;
+ }
enabled = 1;
polling_enabled = 1;
ret = cpufreq_register_notifier(&msm_thermal_cpufreq_notifier,
CPUFREQ_POLICY_NOTIFIER);
if (ret)
- pr_err("%s: cannot register cpufreq notifier\n",
- KBUILD_MODNAME);
+ pr_err("cannot register cpufreq notifier. err:%d\n", ret);
+
INIT_DELAYED_WORK(&check_temp_work, check_temp);
schedule_delayed_work(&check_temp_work, 0);
@@ -2190,8 +2229,7 @@
if (freq_table_get)
ret = vdd_restriction_apply_freq(&rails[i], 0);
else
- pr_info("%s:Defer vdd rstr freq init\n",
- __func__);
+ pr_info("Defer vdd rstr freq init.\n");
} else {
rails[i].reg = devm_regulator_get(&pdev->dev,
rails[i].name);
@@ -2199,12 +2237,14 @@
ret = PTR_ERR(rails[i].reg);
if (ret != -EPROBE_DEFER) {
pr_err( \
- "%s, could not get regulator: %s\n",
- rails[i].name, __func__);
+ "could not get regulator: %s. err:%d\n",
+ rails[i].name, ret);
rails[i].reg = NULL;
rails[i].curr_level = -2;
return ret;
}
+ pr_info("Defer regulator %s probe\n",
+ rails[i].name);
return ret;
}
/*
@@ -2230,11 +2270,13 @@
if (IS_ERR_OR_NULL(psm_rails[i].reg)) {
ret = PTR_ERR(psm_rails[i].reg);
if (ret != -EPROBE_DEFER) {
- pr_err("%s, could not get rpm regulator: %s\n",
- psm_rails[i].name, __func__);
+ pr_err("couldn't get rpm regulator %s. err%d\n",
+ psm_rails[i].name, ret);
psm_rails[i].reg = NULL;
goto psm_reg_exit;
}
+ pr_info("Defer regulator %s probe\n",
+ psm_rails[i].name);
return ret;
}
/* Apps default vote for PWM mode */
@@ -2242,7 +2284,7 @@
ret = rpm_regulator_set_mode(psm_rails[i].reg,
psm_rails[i].init);
if (ret) {
- pr_err("%s: Cannot set PMIC PWM mode\n", __func__);
+ pr_err("Cannot set PMIC PWM mode. err:%d\n", ret);
return ret;
} else
psm_rails[i].mode = PMIC_PWM_MODE;
@@ -2311,22 +2353,21 @@
module_kobj = kset_find_obj(module_kset, KBUILD_MODNAME);
if (!module_kobj) {
- pr_err("%s: cannot find kobject for module %s\n",
- __func__, KBUILD_MODNAME);
+ pr_err("cannot find kobject\n");
rc = -ENOENT;
goto thermal_sysfs_add_exit;
}
vdd_rstr_kobj = kobject_create_and_add("vdd_restriction", module_kobj);
if (!vdd_rstr_kobj) {
- pr_err("%s: cannot create vdd_restriction kobject\n", __func__);
+ pr_err("cannot create vdd_restriction kobject\n");
rc = -ENOMEM;
goto thermal_sysfs_add_exit;
}
rc = sysfs_create_group(vdd_rstr_kobj, &vdd_rstr_en_attribs_gp);
if (rc) {
- pr_err("%s: cannot create kobject attribute group\n", __func__);
+ pr_err("cannot create kobject attribute group. err:%d\n", rc);
rc = -ENOMEM;
goto thermal_sysfs_add_exit;
}
@@ -2335,8 +2376,8 @@
vdd_rstr_reg_kobj[i] = kobject_create_and_add(rails[i].name,
vdd_rstr_kobj);
if (!vdd_rstr_reg_kobj[i]) {
- pr_err("%s: cannot create for kobject for %s\n",
- __func__, rails[i].name);
+ pr_err("cannot create kobject for %s\n",
+ rails[i].name);
rc = -ENOMEM;
goto thermal_sysfs_add_exit;
}
@@ -2344,6 +2385,7 @@
rails[i].attr_gp.attrs = kzalloc(sizeof(struct attribute *) * 3,
GFP_KERNEL);
if (!rails[i].attr_gp.attrs) {
+ pr_err("kzalloc failed\n");
rc = -ENOMEM;
goto thermal_sysfs_add_exit;
}
@@ -2355,8 +2397,8 @@
rc = sysfs_create_group(vdd_rstr_reg_kobj[i],
&rails[i].attr_gp);
if (rc) {
- pr_err("%s: cannot create attribute group for %s\n",
- __func__, rails[i].name);
+ pr_err("cannot create attribute group for %s. err:%d\n",
+ rails[i].name, rc);
goto thermal_sysfs_add_exit;
}
}
@@ -2467,15 +2509,14 @@
module_kobj = kset_find_obj(module_kset, KBUILD_MODNAME);
if (!module_kobj) {
- pr_err("%s: cannot find kobject for module %s\n",
- __func__, KBUILD_MODNAME);
+ pr_err("cannot find kobject\n");
rc = -ENOENT;
goto psm_node_exit;
}
psm_kobj = kobject_create_and_add("pmic_sw_mode", module_kobj);
if (!psm_kobj) {
- pr_err("%s: cannot create psm kobject\n", KBUILD_MODNAME);
+ pr_err("cannot create psm kobject\n");
rc = -ENOMEM;
goto psm_node_exit;
}
@@ -2484,14 +2525,15 @@
psm_reg_kobj[i] = kobject_create_and_add(psm_rails[i].name,
psm_kobj);
if (!psm_reg_kobj[i]) {
- pr_err("%s: cannot create for kobject for %s\n",
- KBUILD_MODNAME, psm_rails[i].name);
+ pr_err("cannot create kobject for %s\n",
+ psm_rails[i].name);
rc = -ENOMEM;
goto psm_node_exit;
}
psm_rails[i].attr_gp.attrs = kzalloc( \
sizeof(struct attribute *) * 2, GFP_KERNEL);
if (!psm_rails[i].attr_gp.attrs) {
+ pr_err("kzalloc failed\n");
rc = -ENOMEM;
goto psm_node_exit;
}
@@ -2501,8 +2543,8 @@
rc = sysfs_create_group(psm_reg_kobj[i], &psm_rails[i].attr_gp);
if (rc) {
- pr_err("%s: cannot create attribute group for %s\n",
- KBUILD_MODNAME, psm_rails[i].name);
+ pr_err("cannot create attribute group for %s. err:%d\n",
+ psm_rails[i].name, rc);
goto psm_node_exit;
}
}
@@ -2549,14 +2591,14 @@
if (rails_cnt == 0)
goto read_node_fail;
if (rails_cnt >= MAX_RAILS) {
- pr_err("%s: Too many rails.\n", __func__);
+ pr_err("Too many rails:%d.\n", rails_cnt);
return -EFAULT;
}
rails = kzalloc(sizeof(struct rail) * rails_cnt,
GFP_KERNEL);
if (!rails) {
- pr_err("%s: Fail to allocate memory for rails.\n", __func__);
+ pr_err("Fail to allocate memory for rails.\n");
return -ENOMEM;
}
@@ -2573,7 +2615,8 @@
rails[i].num_levels = arr_size/sizeof(__be32);
if (rails[i].num_levels >
sizeof(rails[i].levels)/sizeof(uint32_t)) {
- pr_err("%s: Array size too large\n", __func__);
+ pr_err("Array size:%d too large for index:%d\n",
+ rails[i].num_levels, i);
return -EFAULT;
}
ret = of_property_read_u32_array(child_node, key,
@@ -2601,23 +2644,26 @@
if (rails_cnt) {
ret = vdd_restriction_reg_init(pdev);
if (ret) {
- pr_info("%s:Failed to get regulators. KTM continues.\n",
- __func__);
+ pr_err("Err regulator init. err:%d. KTM continues.\n",
+ ret);
goto read_node_fail;
}
ret = init_threshold(MSM_VDD_RESTRICTION, MONITOR_ALL_TSENS,
data->vdd_rstr_temp_hyst_degC, data->vdd_rstr_temp_degC,
vdd_restriction_notify);
- if (ret)
+ if (ret) {
+ pr_err("Error in initializing thresholds. err:%d\n",
+ ret);
goto read_node_fail;
+ }
vdd_rstr_enabled = true;
}
read_node_fail:
vdd_rstr_probed = true;
if (ret) {
dev_info(&pdev->dev,
- "%s:Failed reading node=%s, key=%s. KTM continues\n",
- __func__, node->full_name, key);
+ "%s:Failed reading node=%s, key=%s. err=%d. KTM continues\n",
+ __func__, node->full_name, key, ret);
kfree(rails);
rails_cnt = 0;
}
@@ -2890,7 +2936,7 @@
psm_rails = kzalloc(sizeof(struct psm_rail) * psm_rails_cnt,
GFP_KERNEL);
if (!psm_rails) {
- pr_err("%s: Fail to allocate memory for psm rails\n", __func__);
+ pr_err("Fail to allocate memory for psm rails\n");
psm_rails_cnt = 0;
return -ENOMEM;
}
@@ -2905,8 +2951,8 @@
if (psm_rails_cnt) {
ret = psm_reg_init(pdev);
if (ret) {
- pr_info("%s:Failed to get regulators. KTM continues.\n",
- __func__);
+ pr_err("Err regulator init. err:%d. KTM continues.\n",
+ ret);
goto read_node_fail;
}
psm_enabled = true;
@@ -2916,8 +2962,8 @@
psm_probed = true;
if (ret) {
dev_info(&pdev->dev,
- "%s:Failed reading node=%s, key=%s. KTM continues\n",
- __func__, node->full_name, key);
+ "%s:Failed reading node=%s, key=%s. err=%d. KTM continues\n",
+ __func__, node->full_name, key, ret);
kfree(psm_rails);
psm_rails_cnt = 0;
}
@@ -2968,7 +3014,7 @@
key = "qcom,cpu-sensors";
cpu_cnt = of_property_count_strings(node, key);
if (cpu_cnt < num_possible_cpus()) {
- pr_err("%s: Wrong number of cpu sensors\n", KBUILD_MODNAME);
+ pr_err("Wrong number of cpu sensors:%d\n", cpu_cnt);
ret = -EINVAL;
goto hotplug_node_fail;
}
@@ -2983,8 +3029,8 @@
read_node_fail:
if (ret) {
dev_info(&pdev->dev,
- "%s:Failed reading node=%s, key=%s. KTM continues\n",
- KBUILD_MODNAME, node->full_name, key);
+ "%s:Failed reading node=%s, key=%s. err=%d. KTM continues\n",
+ KBUILD_MODNAME, node->full_name, key, ret);
core_control_enabled = 0;
}
@@ -2993,8 +3039,8 @@
hotplug_node_fail:
if (ret) {
dev_info(&pdev->dev,
- "%s:Failed reading node=%s, key=%s. KTM continues\n",
- KBUILD_MODNAME, node->full_name, key);
+ "%s:Failed reading node=%s, key=%s. err=%d. KTM continues\n",
+ KBUILD_MODNAME, node->full_name, key, ret);
hotplug_enabled = 0;
}
@@ -3034,8 +3080,8 @@
PROBE_FREQ_EXIT:
if (ret) {
dev_info(&pdev->dev,
- "%s:Failed reading node=%s, key=%s. KTM continues\n",
- __func__, node->full_name, key);
+ "%s:Failed reading node=%s, key=%s. err=%d. KTM continues\n",
+ __func__, node->full_name, key, ret);
freq_mitigation_enabled = 0;
}
return ret;
@@ -3050,8 +3096,10 @@
memset(&data, 0, sizeof(struct msm_thermal_data));
ret = msm_thermal_pre_init();
- if (ret)
+ if (ret) {
+ pr_err("thermal pre init failed. err:%d\n", ret);
goto fail;
+ }
key = "qcom,sensor-id";
ret = of_property_read_u32(node, key, &data.sensor_id);
@@ -3135,8 +3183,8 @@
return ret;
fail:
if (ret)
- pr_err("%s: Failed reading node=%s, key=%s\n",
- __func__, node->full_name, key);
+ pr_err("Failed reading node=%s, key=%s. err:%d\n",
+ node->full_name, key, ret);
return ret;
}