From be3acc099a696f8fde14f9385b1d8c45cf8ba989 Mon Sep 17 00:00:00 2001 From: GlitchPunk Date: Sat, 1 Aug 2026 09:05:32 +0300 Subject: [PATCH 1/3] remove: Super Battery --- ec_memory_configuration.h | 6 -- msi-ec.c | 123 -------------------------------------- 2 files changed, 129 deletions(-) diff --git a/ec_memory_configuration.h b/ec_memory_configuration.h index ff9503f2..c0fdf70f 100644 --- a/ec_memory_configuration.h +++ b/ec_memory_configuration.h @@ -45,11 +45,6 @@ struct msi_ec_shift_mode_conf { struct msi_ec_mode modes[5]; // fixed size for easier hard coding }; -struct msi_ec_super_battery_conf { - int address; - int mask; -}; - struct msi_ec_fan_mode_conf { int address; struct msi_ec_mode modes[5]; // fixed size for easier hard coding @@ -90,7 +85,6 @@ struct msi_ec_conf { struct msi_ec_fn_win_swap_conf fn_win_swap; struct msi_ec_cooler_boost_conf cooler_boost; struct msi_ec_shift_mode_conf shift_mode; - struct msi_ec_super_battery_conf super_battery; struct msi_ec_fan_mode_conf fan_mode; struct msi_ec_cpu_conf cpu; struct msi_ec_gpu_conf gpu; diff --git a/msi-ec.c b/msi-ec.c index 7eb7a5c3..0268e7e6 100644 --- a/msi-ec.c +++ b/msi-ec.c @@ -92,9 +92,6 @@ static struct msi_ec_conf CONF_G1_0 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, // 0xd5 needs testing - }, .fan_mode = { .address = 0xf4, .modes = { @@ -178,9 +175,6 @@ static struct msi_ec_conf CONF_G1_1 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -248,10 +242,6 @@ static struct msi_ec_conf CONF_G1_2 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, // known. 0xd5. - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -334,10 +324,6 @@ static struct msi_ec_conf CONF_G1_3 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -405,10 +391,6 @@ static struct msi_ec_conf CONF_G1_4 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, // 0xd5 but has its own set of modes - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -479,10 +461,6 @@ static struct msi_ec_conf CONF_G1_5 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNSUPP, - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -557,10 +535,6 @@ static struct msi_ec_conf CONF_G1_6 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, // 0xed - .mask = 0x0f, // a5, a4, a2 - }, .fan_mode = { .address = 0xf4, .modes = { @@ -639,10 +613,6 @@ static struct msi_ec_conf CONF_G1_7 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNSUPP, - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -709,9 +679,6 @@ static struct msi_ec_conf CONF_G1_8 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNSUPP, // enabled by "Super Battery" shift mode - }, .fan_mode = { .address = 0xf4, .modes = { @@ -783,9 +750,6 @@ static struct msi_ec_conf CONF_G1_9 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNSUPP, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -851,9 +815,6 @@ static struct msi_ec_conf CONF_G1_10 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNSUPP, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -925,10 +886,6 @@ static struct msi_ec_conf CONF_G1_11 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = MSI_EC_ADDR_UNKNOWN, // 0xd5 (automatic switching with shift mode) - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -994,10 +951,6 @@ static struct msi_ec_conf CONF_G1_13 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xd5, - .mask = 0x0f, - }, .fan_mode = { .address = 0xf4, .modes = { @@ -1080,10 +1033,6 @@ static struct msi_ec_conf CONF_G2_0 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1204,10 +1153,6 @@ static struct msi_ec_conf CONF_G2_1 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1296,10 +1241,6 @@ static struct msi_ec_conf CONF_G2_2 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1395,10 +1336,6 @@ static struct msi_ec_conf CONF_G2_3 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1465,10 +1402,6 @@ static struct msi_ec_conf CONF_G2_4 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1541,10 +1474,6 @@ static struct msi_ec_conf CONF_G2_5 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1625,10 +1554,6 @@ static struct msi_ec_conf CONF_G2_6 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -1783,10 +1708,6 @@ static struct msi_ec_conf CONF_G2_10 __initdata = { MSI_EC_MODE_NULL }, }, - .super_battery = { - .address = 0xeb, - .mask = 0x0f, - }, .fan_mode = { .address = 0xd4, .modes = { @@ -2377,45 +2298,6 @@ static ssize_t shift_mode_store(struct device *dev, return -EINVAL; } -static ssize_t super_battery_show(struct device *device, - struct device_attribute *attr, char *buf) -{ - int result; - bool enabled; - - result = ec_check_by_mask(conf.super_battery.address, - conf.super_battery.mask, - &enabled); - if (result < 0) - return result; - - return sysfs_emit(buf, "%s\n", str_on_off(enabled)); -} - -static ssize_t super_battery_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - int result; - bool value; - - result = kstrtobool(buf, &value); - if (result) - return result; - - if (value) - result = ec_set_by_mask(conf.super_battery.address, - conf.super_battery.mask); - else - result = ec_unset_by_mask(conf.super_battery.address, - conf.super_battery.mask); - - if (result < 0) - return result; - - return count; -} - static ssize_t available_fan_modes_show(struct device *device, struct device_attribute *attr, char *buf) @@ -2532,7 +2414,6 @@ static DEVICE_ATTR_RW(win_key); static DEVICE_ATTR_RW(cooler_boost); static DEVICE_ATTR_RO(available_shift_modes); static DEVICE_ATTR_RW(shift_mode); -static DEVICE_ATTR_RW(super_battery); static DEVICE_ATTR_RO(available_fan_modes); static DEVICE_ATTR_RW(fan_mode); static DEVICE_ATTR_RO(fw_version); @@ -2546,7 +2427,6 @@ static struct attribute *msi_root_attrs[] = { &dev_attr_cooler_boost.attr, &dev_attr_available_shift_modes.attr, &dev_attr_shift_mode.attr, - &dev_attr_super_battery.attr, &dev_attr_available_fan_modes.attr, &dev_attr_fan_mode.attr, &dev_attr_fw_version.attr, @@ -2895,9 +2775,6 @@ static umode_t msi_ec_is_visible(struct kobject *kobj, attr == &dev_attr_shift_mode.attr) address = conf.shift_mode.address; - else if (attr == &dev_attr_super_battery.attr) - address = conf.super_battery.address; - else if (attr == &dev_attr_available_fan_modes.attr || attr == &dev_attr_fan_mode.attr) address = conf.fan_mode.address; From 4af4df7a3ade7b37f67d131bd09419b33339d9d3 Mon Sep 17 00:00:00 2001 From: GlitchPunk Date: Sat, 1 Aug 2026 09:16:58 +0300 Subject: [PATCH 2/3] comment out unused functions --- msi-ec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/msi-ec.c b/msi-ec.c index 0268e7e6..5cc5ed81 100644 --- a/msi-ec.c +++ b/msi-ec.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -40,8 +39,8 @@ #include #include -static DEFINE_MUTEX(ec_set_by_mask_mutex); -static DEFINE_MUTEX(ec_unset_by_mask_mutex); +//static DEFINE_MUTEX(ec_set_by_mask_mutex); +//static DEFINE_MUTEX(ec_unset_by_mask_mutex); static DEFINE_MUTEX(ec_set_bit_mutex); #define SM_ECO_NAME "eco" @@ -1798,6 +1797,7 @@ static int ec_read_seq(u8 addr, u8 *buf, u8 len) return 0; } +/* static int ec_set_by_mask(u8 addr, u8 mask) { int result; @@ -1847,6 +1847,7 @@ static int ec_check_by_mask(u8 addr, u8 mask, bool *output) return 0; } +*/ static int ec_set_bit(u8 addr, u8 bit, bool value) { From 70b9512b2c33957eef1d389b020e82845e685d8a Mon Sep 17 00:00:00 2001 From: GlitchPunk Date: Sat, 1 Aug 2026 09:39:48 +0300 Subject: [PATCH 3/3] remove super_battery from README.md and sysfs-platform-msi-ec --- README.md | 7 ------- docs/sysfs-platform-msi-ec | 5 ----- 2 files changed, 12 deletions(-) diff --git a/README.md b/README.md index a53649ed..f0f0eaf5 100644 --- a/README.md +++ b/README.md @@ -199,13 +199,6 @@ This driver exports a few files in its own platform device, msi-ec, and is avail - sport: full clock frequency and voltage for the CPU & GPU, aka default desktop mode - turbo: over-voltage and over-clock for the CPU & GPU, aka overclocking mode -- `/sys/devices/platform/msi-ec/super_battery` - - Description: This entry allows switching the super battery function. - - Access: Read, Write - - Valid values: - - on: super battery function is enabled - - off: super battery function is disabled - - `/sys/devices/platform/msi-ec/available_fan_modes` - Description: This entry reports all supported fan modes. - Access: Read diff --git a/docs/sysfs-platform-msi-ec b/docs/sysfs-platform-msi-ec index 78cd2763..61bbcf59 100644 --- a/docs/sysfs-platform-msi-ec +++ b/docs/sysfs-platform-msi-ec @@ -42,11 +42,6 @@ Description: Valid values: the values present in the available_shift_modes list. -What: /sys/devices/platform//super_battery -Description: - Allows to enable the super battery saving mode. - Valid values: "on", "off" - What: /sys/devices/platform//available_fan_modes Description: Read-only, shows the list of available fan modes for