#include <soc/samsung/acpm_ipc_ctrl.h>
#include "exynos_acpm_tmu.h"
-static bool cold_comp;
static unsigned int acpm_tmu_ch_num, acpm_tmu_size;
static bool acpm_tmu_test_mode;
*
* - tz: thermal zone index registered in device tree
*/
-int exynos_acpm_tmu_set_read_temp(int tz, int *cur_temp)
+int exynos_acpm_tmu_set_read_temp(int tz, int *temp, int *stat)
{
struct ipc_config config;
union tmu_ipc_message message;
int ret;
unsigned long long before, after, latency;
- *cur_temp = 0;
-
if (acpm_tmu_test_mode)
return -1;
message.data[3]);
}
- cold_comp = message.resp.cold;
- *cur_temp = message.resp.temp;
+ *temp = message.resp.temp;
+ *stat = message.resp.stat;
return 0;
}
message.data[3]);
}
- cold_comp = message.resp.cold;
-
return 0;
}
* ---------------------------------------------
* | temp | tz_id | ret | type |
* ---------------------------------------------
- * | | | | cold |
+ * | | | | stat |
* ---------------------------------------------
* | | | | |
* ---------------------------------------------
s8 ret;
u8 tzid;
u8 temp;
- u8 cold;
+ u8 stat;
u8 rsvd;
u8 rsvd2;
u8 rsvd3;
};
int exynos_acpm_tmu_set_init(struct acpm_tmu_cap *cap);
-int exynos_acpm_tmu_set_read_temp(int tz, int *temp);
+int exynos_acpm_tmu_set_read_temp(int tz, int *temp, int *stat);
int exynos_acpm_tmu_set_suspend(void);
int exynos_acpm_tmu_set_cp_call(void);
int exynos_acpm_tmu_set_resume(void);
{ return -EINVAL; }
#endif /* CONFIG_THERMAL_EMULATION */
+static bool cpufreq_limited;
+static struct pm_qos_request thermal_cpu_limit_request;
+
static int exynos9810_tmu_read(struct exynos_tmu_data *data)
{
- int temp = 0;
+ int temp = 0, stat = 0;
#ifdef CONFIG_EXYNOS_ACPM_THERMAL
- exynos_acpm_tmu_set_read_temp(data->tzd->id, &temp);
+ exynos_acpm_tmu_set_read_temp(data->tzd->id, &temp, &stat);
#endif
+ if (data->hotplug_enable) {
+ if ((stat & 0x2) && !cpufreq_limited) {
+ pm_qos_update_request(&thermal_cpu_limit_request,
+ data->limited_frequency);
+ cpufreq_limited = true;
+ } else if (!(stat & 0x2) && cpufreq_limited) {
+ pm_qos_update_request(&thermal_cpu_limit_request,
+ PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE);
+ cpufreq_limited = false;
+ }
+ }
+
return temp;
}
void *block;
struct ect_pidtm_block *pidtm_block;
int i, temperature, value;
- int hotplug_out_threshold = 0, hotplug_in_threshold = 0;
+ int hotplug_out_threshold = 0, hotplug_in_threshold = 0, limited_frequency = 0;
block = ect_get_block(BLOCK_PIDTM);
if (block == NULL) {
hotplug_in_threshold = value;
}
+ if ((value = exynos_tmu_ect_get_param(pidtm_block, "limited_frequency")) != -1) {
+ pr_info("Parse from ECT limited_frequency: %d\n", value);
+ limited_frequency = value;
+ }
+
if (hotplug_out_threshold != 0 && hotplug_in_threshold != 0) {
data->hotplug_out_threshold = hotplug_out_threshold;
data->hotplug_in_threshold = hotplug_in_threshold;
+ data->limited_frequency = limited_frequency;
data->hotplug_enable = true;
} else
data->hotplug_enable = false;
pm_qos_add_request(&thermal_cpu_hotplug_request,
PM_QOS_CPU_ONLINE_MAX,
PM_QOS_CPU_ONLINE_MAX_DEFAULT_VALUE);
+ pm_qos_add_request(&thermal_cpu_limit_request,
+ PM_QOS_CLUSTER1_FREQ_MAX,
+ PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE);
exynos_cpuhotplug_register_notifier(&thermal_cpu_hotplug_notifier, 0);
}
struct platform_device *pdev = to_platform_device(dev);
#ifdef CONFIG_EXYNOS_ACPM_THERMAL
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
- int temp;
+ int temp, stat;
if (suspended_count == num_of_devices)
exynos_acpm_tmu_set_resume();
exynos_tmu_control(pdev, true);
}
- exynos_acpm_tmu_set_read_temp(data->tzd->id, &temp);
+ exynos_acpm_tmu_set_read_temp(data->tzd->id, &temp, &stat);
enable_irq(data->irq);
suspended_count--;