Revert "drivers: thermal_core: add sysfs nodes to silence mi_thermald"

This reverts commit ba961c130942d852b3d99062e2d0581b5253eb00.

Change-Id: I401bd89fedcfdf32078bbba58862b963b759f34e
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Richard Raya 2024-09-08 19:22:39 -03:00
parent 3ddc64a88c
commit ece7c08d1d

View File

@ -56,10 +56,6 @@ static struct thermal_governor *def_governor;
static struct workqueue_struct *thermal_passive_wq;
static atomic_t switch_mode = ATOMIC_INIT(-1);
static atomic_t temp_state = ATOMIC_INIT(0);
static char boost_buf[128];
/*
* Governor section: set of functions to handle thermal governors
*
@ -953,8 +949,6 @@ static struct class thermal_class = {
.dev_release = thermal_release,
};
static struct device thermal_message_dev;
static inline
void print_bind_err_msg(struct thermal_zone_device *tz,
struct thermal_cooling_device *cdev, int ret)
@ -1642,133 +1636,6 @@ static struct notifier_block thermal_pm_nb = {
.notifier_call = thermal_pm_notify,
};
static ssize_t
thermal_sconfig_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&switch_mode));
}
static ssize_t
thermal_sconfig_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
int val = -1;
val = simple_strtol(buf, NULL, 10);
atomic_set(&switch_mode, val);
return len;
}
static DEVICE_ATTR(sconfig, 0664,
thermal_sconfig_show, thermal_sconfig_store);
static ssize_t
thermal_boost_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, boost_buf);
}
static ssize_t
thermal_boost_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
int ret;
ret = snprintf(boost_buf, 128, buf);
return len;
}
static DEVICE_ATTR(boost, 0644,
thermal_boost_show, thermal_boost_store);
static ssize_t
thermal_temp_state_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&temp_state));
}
static ssize_t
thermal_temp_state_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
int val = -1;
val = simple_strtol(buf, NULL, 10);
atomic_set(&temp_state, val);
return len;
}
static DEVICE_ATTR(temp_state, 0664,
thermal_temp_state_show, thermal_temp_state_store);
static ssize_t
cpu_limits_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return 0;
}
static ssize_t
cpu_limits_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
unsigned int cpu, max;
if (sscanf(buf, "cpu%u %u", &cpu, &max) != 2) {
pr_err("input param error, can not prase param\n");
return -EINVAL;
}
return len;
}
static DEVICE_ATTR(cpu_limits, 0664,
cpu_limits_show, cpu_limits_store);
static int create_thermal_message_node(void)
{
int ret = 0;
thermal_message_dev.class = &thermal_class;
dev_set_name(&thermal_message_dev, "thermal_message");
ret = device_register(&thermal_message_dev);
if (!ret) {
ret = sysfs_create_file(&thermal_message_dev.kobj, &dev_attr_sconfig.attr);
if (ret < 0)
pr_warn("Thermal: create sconfig node failed\n");
ret = sysfs_create_file(&thermal_message_dev.kobj, &dev_attr_boost.attr);
if (ret < 0)
pr_warn("Thermal: create boost node failed\n");
ret = sysfs_create_file(&thermal_message_dev.kobj, &dev_attr_temp_state.attr);
if (ret < 0)
pr_warn("Thermal: create temp state node failed\n");
ret = sysfs_create_file(&thermal_message_dev.kobj, &dev_attr_cpu_limits.attr);
if (ret < 0)
pr_warn("Thermal: create cpu limits node failed\n");
}
return ret;
}
static void destroy_thermal_message_node(void)
{
sysfs_remove_file(&thermal_message_dev.kobj, &dev_attr_cpu_limits.attr);
sysfs_remove_file(&thermal_message_dev.kobj, &dev_attr_temp_state.attr);
sysfs_remove_file(&thermal_message_dev.kobj, &dev_attr_boost.attr);
sysfs_remove_file(&thermal_message_dev.kobj, &dev_attr_sconfig.attr);
device_unregister(&thermal_message_dev);
}
static int __init thermal_init(void)
{
int result;
@ -1800,11 +1667,6 @@ static int __init thermal_init(void)
pr_warn("Thermal: Can not register suspend notifier, return %d\n",
result);
result = create_thermal_message_node();
if (result)
pr_warn("Thermal: create thermal message node failed, return %d\n",
result);
return 0;
exit_zone_parse:
@ -1828,7 +1690,6 @@ static void thermal_exit(void)
of_thermal_destroy_zones();
destroy_workqueue(thermal_passive_wq);
genetlink_exit();
destroy_thermal_message_node();
class_unregister(&thermal_class);
thermal_unregister_governors();
ida_destroy(&thermal_tz_ida);