Skip to content

Commit 4eee82e

Browse files
Antheas KapenekakisKyleGospo
authored andcommitted
[FROM-ML] platform/x86: msi-wmi-platform: Drop excess fans in dual fan devices
Currently, the platform driver always exposes 4 fans, since the underlying WMI interface reads 4 values from the EC. However, most devices only have two fans. Therefore, at least in the case of the Claw series, quirk the driver to only show two hwmon fans. Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
1 parent bce8680 commit 4eee82e

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

drivers/platform/x86/msi-wmi-platform.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ enum msi_wmi_platform_method {
121121
struct msi_wmi_platform_quirk {
122122
bool shift_mode; /* Shift mode is supported */
123123
bool charge_threshold; /* Charge threshold is supported */
124+
bool dual_fans; /* For devices with two hwmon fans */
124125
int pl_min; /* Minimum PLx value */
125126
int pl1_max; /* Maximum PL1 value */
126127
int pl2_max; /* Maximum PL2 value */
@@ -216,13 +217,15 @@ static struct msi_wmi_platform_quirk quirk_default = {};
216217
static struct msi_wmi_platform_quirk quirk_gen1 = {
217218
.shift_mode = true,
218219
.charge_threshold = true,
220+
.dual_fans = true,
219221
.pl_min = 8,
220222
.pl1_max = 43,
221223
.pl2_max = 45
222224
};
223225
static struct msi_wmi_platform_quirk quirk_gen2 = {
224226
.shift_mode = true,
225227
.charge_threshold = true,
228+
.dual_fans = true,
226229
.pl_min = 8,
227230
.pl1_max = 30,
228231
.pl2_max = 37
@@ -635,6 +638,23 @@ static const struct hwmon_chip_info msi_wmi_platform_chip_info = {
635638
.info = msi_wmi_platform_info,
636639
};
637640

641+
static const struct hwmon_channel_info * const msi_wmi_platform_info_dual[] = {
642+
HWMON_CHANNEL_INFO(fan,
643+
HWMON_F_INPUT,
644+
HWMON_F_INPUT
645+
),
646+
HWMON_CHANNEL_INFO(pwm,
647+
HWMON_PWM_ENABLE,
648+
HWMON_PWM_ENABLE
649+
),
650+
NULL
651+
};
652+
653+
static const struct hwmon_chip_info msi_wmi_platform_chip_info_dual = {
654+
.ops = &msi_wmi_platform_ops,
655+
.info = msi_wmi_platform_info_dual,
656+
};
657+
638658
static int msi_wmi_platform_profile_probe(void *drvdata, unsigned long *choices)
639659
{
640660
set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
@@ -1227,9 +1247,11 @@ static int msi_wmi_platform_hwmon_init(struct msi_wmi_platform_data *data)
12271247
{
12281248
struct device *hdev;
12291249

1230-
hdev = devm_hwmon_device_register_with_info(&data->wdev->dev, "msi_wmi_platform", data,
1231-
&msi_wmi_platform_chip_info,
1232-
msi_wmi_platform_hwmon_groups);
1250+
hdev = devm_hwmon_device_register_with_info(
1251+
&data->wdev->dev, "msi_wmi_platform", data,
1252+
data->quirks->dual_fans ? &msi_wmi_platform_chip_info_dual :
1253+
&msi_wmi_platform_chip_info,
1254+
msi_wmi_platform_hwmon_groups);
12331255

12341256
return PTR_ERR_OR_ZERO(hdev);
12351257
}

0 commit comments

Comments
 (0)