#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
static bool acpm_tmu_test_mode;
+static bool acpm_tmu_log;
bool exynos_acpm_tmu_is_test_mode(void)
{
{
acpm_tmu_test_mode = mode;
}
-#endif
-#define acpm_ipc_err_check() \
+void exynos_acpm_tmu_log(bool mode)
+{
+ acpm_tmu_log = mode;
+}
+
+#define acpm_ipc_latency_check() \
do { \
- if (ret < 0) { \
- pr_warn("[acpm_tmu] IPC error! type 0x%02x latency %llu ns ret %d\n", \
+ if (acpm_tmu_log) { \
+ pr_info("[acpm_tmu] type 0x%02x latency %llu ns ret %d\n", \
message.req.type, latency, ret); \
- return -1; \
} \
} while (0)
-#define acpm_ipc_latency_check() \
+#endif
+
+#define acpm_ipc_err_check() \
do { \
- if (latency > 2000000) { \
- pr_info("[acpm_tmu] type 0x%02x latency %llu ns ret %d\n", \
+ if (ret < 0) { \
+ pr_warn("[acpm_tmu] IPC error! type 0x%02x latency %llu ns ret %d\n", \
message.req.type, latency, ret); \
+ return -1; \
} \
} while (0)
{
struct ipc_config config;
union tmu_ipc_message message;
- unsigned long long before, after, latency;
int ret;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
+ unsigned long long before, after, latency;
+#endif
memset(&message, 0, sizeof(message));
config.response = true;
config.indirection = false;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
before = sched_clock();
+#endif
ret = acpm_ipc_send_data(acpm_tmu_ch_num, &config);
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
after = sched_clock();
latency = after - before;
+#endif
acpm_ipc_err_check();
acpm_ipc_latency_check();
{
struct ipc_config config;
union tmu_ipc_message message;
- unsigned long long before, after, latency;
int ret;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
+ unsigned long long before, after, latency;
+#endif
*cur_temp = 0;
config.response = true;
config.indirection = false;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
before = sched_clock();
+#endif
ret = acpm_ipc_send_data(acpm_tmu_ch_num, &config);
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
after = sched_clock();
latency = after - before;
+#endif
acpm_ipc_err_check();
acpm_ipc_latency_check();
memcpy(message.data, config.cmd, sizeof(message.data));
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
+ if (acpm_tmu_log) {
+ pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
+ message.data[0],
+ message.data[1],
+ message.data[2],
+ message.data[3]);
+ }
+#endif
cold_comp = message.resp.cold;
*cur_temp = message.resp.temp;
{
struct ipc_config config;
union tmu_ipc_message message;
- unsigned long long before, after, latency;
int ret;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
+ unsigned long long before, after, latency;
+#endif
memset(&message, 0, sizeof(message));
config.response = true;
config.indirection = false;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
before = sched_clock();
+#endif
ret = acpm_ipc_send_data(acpm_tmu_ch_num, &config);
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
after = sched_clock();
latency = after - before;
+#endif
acpm_ipc_err_check();
acpm_ipc_latency_check();
memcpy(message.data, config.cmd, sizeof(message.data));
#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
- pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
- message.data[0],
- message.data[1],
- message.data[2],
- message.data[3]);
+ if (acpm_tmu_log) {
+ pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
+ message.data[0],
+ message.data[1],
+ message.data[2],
+ message.data[3]);
+ }
#endif
cold_comp = message.resp.cold;
{
struct ipc_config config;
union tmu_ipc_message message;
- unsigned long long before, after, latency;
int ret;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
+ unsigned long long before, after, latency;
+#endif
memset(&message, 0, sizeof(message));
config.response = true;
config.indirection = false;
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
before = sched_clock();
+#endif
ret = acpm_ipc_send_data(acpm_tmu_ch_num, &config);
+#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
after = sched_clock();
latency = after - before;
+#endif
acpm_ipc_err_check();
acpm_ipc_latency_check();
memcpy(&message.data, config.cmd, sizeof(message.data));
#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
- pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
- message.data[0],
- message.data[1],
- message.data[2],
- message.data[3]);
+ if (acpm_tmu_log) {
+ pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
+ message.data[0],
+ message.data[1],
+ message.data[2],
+ message.data[3]);
+ }
#endif
return 0;
memcpy(&message.data, config.cmd, sizeof(message.data));
#ifdef CONFIG_EXYNOS_THERMAL_DEBUG
- pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
- message.data[0],
- message.data[1],
- message.data[2],
- message.data[3]);
+ if (acpm_tmu_log) {
+ pr_info("[acpm_tmu] data 0:0x%08x 1:0x%08x 2:0x%08x 3:0x%08x\n",
+ message.data[0],
+ message.data[1],
+ message.data[2],
+ message.data[3]);
+ }
#endif
return 0;
rising_threshold &= ~(EXYNOS_TMU_TEMP_MASK << bit_off);
rising_threshold |= threshold_code << bit_off;
writel(rising_threshold, data->base + reg_off);
+#ifdef TMU_DEBUG
+ pr_info("[TMU%d:%d:%d] addr 0x%04x bit-shift %d rise 0x%08x code 0x%x temp %d\n",
+ data->id, sensor, i, reg_off, bit_off,
+ rising_threshold, threshold_code, temp);
+#endif
/* Set 9-bit temperature code for falling threshold levels */
threshold_code = temp_to_code_with_sensorinfo(data, temp_hist, &data->sensor_info[count]);
falling_threshold &= ~(EXYNOS_TMU_TEMP_MASK << bit_off);
falling_threshold |= threshold_code << bit_off;
writel(falling_threshold, data->base + reg_off + 0x10);
+#ifdef TMU_DEBUG
+ pr_info("[TMU%d:%d:%d] addr 0x%04x bit-shift %d fall 0x%08x code 0x%x hyst %d\n",
+ data->id, sensor, i, reg_off + 0x10, bit_off,
+ falling_threshold, threshold_code, temp_hist);
+#endif
interrupt_count++;
}
.write = test_cp_call_write,
.llseek = default_llseek,
};
+
+static ssize_t acpm_tmu_log_write(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ ssize_t len;
+ char buf[32];
+
+ len = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
+ if (len < 0)
+ return len;
+
+ buf[len] = '\0';
+
+ if (buf[0] == '1')
+ exynos_acpm_tmu_log(true);
+ else if (buf[0] == '0')
+ exynos_acpm_tmu_log(false);
+ else
+ return -EINVAL;
+
+ return len;
+}
+
+static const struct file_operations acpm_tmu_log_ops = {
+ .open = simple_open,
+ .write = acpm_tmu_log_write,
+ .llseek = default_llseek,
+};
#endif
static struct dentry *debugfs_root;
#ifdef CONFIG_EXYNOS_ACPM_THERMAL
debugfs_create_file("test_cp_call", 0x200, debugfs_root, NULL, &test_cp_call_ops);
+ debugfs_create_file("acpm_tmu_log", 0x200, debugfs_root, NULL, &acpm_tmu_log_ops);
pr_info("Created exynos thermal debugfs\n");
#endif
return 0;