thermal: core: Workaround for xiaomi thermal mitigation

For some reason, leaving this unconfigured makes the charger voltage
become low and it's affecting UX, set this to Evaluation by default
to improve UX, also while on it, convert deprecated simple_strtol
to kstrtoint

Bug: Slow charging
Test: Charging speed normal, sconfig at 10 as defined

Change-Id: Id974ceaf31da0439502372a09ff6b5f4ef2982d8
Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Raphiel Rollerscaperers 2020-09-12 14:35:10 +05:30 committed by Richard Raya
parent fb520a1b30
commit 257f8e2b89

View File

@ -65,7 +65,7 @@ struct screen_monitor {
struct screen_monitor sm;
#endif
static atomic_t switch_mode = ATOMIC_INIT(-1);
static atomic_t switch_mode = ATOMIC_INIT(10);
static atomic_t temp_state = ATOMIC_INIT(0);
static char boost_buf[128];
const char *board_sensor;
@ -1683,12 +1683,15 @@ static ssize_t
thermal_sconfig_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
int val = -1;
int ret, val = -1;
val = simple_strtol(buf, NULL, 10);
ret = kstrtoint(buf, 10, &val);
atomic_set(&switch_mode, val);
if (ret)
return ret;
return len;
}
@ -1725,12 +1728,15 @@ static ssize_t
thermal_temp_state_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
int val = -1;
int ret, val = -1;
val = simple_strtol(buf, NULL, 10);
ret = kstrtoint(buf, 10, &val);
atomic_set(&temp_state, val);
if (ret)
return ret;
return len;
}