Skip to content

Commit f480ea9

Browse files
paligroeck
authored andcommitted
hwmon: (dell-smm) Disable fan support for Dell Inspiron 7720
Calling fan related SMM functions implemented by Dell BIOS firmware on Dell Inspiron 7720 freeze kernel for about 500ms. Until Dell fixes it we need to disable fan support for Dell Inspiron 7720 as it makes system unusable. Via "force" module param fan support can be enabled. Reported-by: vova7890@mail.ru Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Link: https://bugzilla.kernel.org/show_bug.cgi?id=195751 Cc: stable@vger.kernel.org # v4.0+, will need backport Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 836ad11 commit f480ea9

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

‎drivers/hwmon/dell-smm-hwmon.c‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static uint i8k_fan_mult = I8K_FAN_MULT;
7676
static uint i8k_pwm_mult;
7777
static uint i8k_fan_max = I8K_FAN_HIGH;
7878
static bool disallow_fan_type_call;
79+
static bool disallow_fan_support;
7980

8081
#define I8K_HWMON_HAVE_TEMP1 (1 << 0)
8182
#define I8K_HWMON_HAVE_TEMP2 (1 << 1)
@@ -242,6 +243,9 @@ static int i8k_get_fan_status(int fan)
242243
{
243244
struct smm_regs regs = { .eax = I8K_SMM_GET_FAN, };
244245

246+
if (disallow_fan_support)
247+
return -EINVAL;
248+
245249
regs.ebx = fan & 0xff;
246250
return i8k_smm(&regs) ? : regs.eax & 0xff;
247251
}
@@ -253,6 +257,9 @@ static int i8k_get_fan_speed(int fan)
253257
{
254258
struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, };
255259

260+
if (disallow_fan_support)
261+
return -EINVAL;
262+
256263
regs.ebx = fan & 0xff;
257264
return i8k_smm(&regs) ? : (regs.eax & 0xffff) * i8k_fan_mult;
258265
}
@@ -264,7 +271,7 @@ static int _i8k_get_fan_type(int fan)
264271
{
265272
struct smm_regs regs = { .eax = I8K_SMM_GET_FAN_TYPE, };
266273

267-
if (disallow_fan_type_call)
274+
if (disallow_fan_support || disallow_fan_type_call)
268275
return -EINVAL;
269276

270277
regs.ebx = fan & 0xff;
@@ -289,6 +296,9 @@ static int i8k_get_fan_nominal_speed(int fan, int speed)
289296
{
290297
struct smm_regs regs = { .eax = I8K_SMM_GET_NOM_SPEED, };
291298

299+
if (disallow_fan_support)
300+
return -EINVAL;
301+
292302
regs.ebx = (fan & 0xff) | (speed << 8);
293303
return i8k_smm(&regs) ? : (regs.eax & 0xffff) * i8k_fan_mult;
294304
}
@@ -300,6 +310,9 @@ static int i8k_set_fan(int fan, int speed)
300310
{
301311
struct smm_regs regs = { .eax = I8K_SMM_SET_FAN, };
302312

313+
if (disallow_fan_support)
314+
return -EINVAL;
315+
303316
speed = (speed < 0) ? 0 : ((speed > i8k_fan_max) ? i8k_fan_max : speed);
304317
regs.ebx = (fan & 0xff) | (speed << 8);
305318

@@ -772,6 +785,8 @@ static struct attribute *i8k_attrs[] = {
772785
static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr,
773786
int index)
774787
{
788+
if (disallow_fan_support && index >= 8)
789+
return 0;
775790
if (disallow_fan_type_call &&
776791
(index == 9 || index == 12 || index == 15))
777792
return 0;
@@ -1038,6 +1053,23 @@ static const struct dmi_system_id i8k_blacklist_fan_type_dmi_table[] __initconst
10381053
{ }
10391054
};
10401055

1056+
/*
1057+
* On some machines all fan related SMM functions implemented by Dell BIOS
1058+
* firmware freeze kernel for about 500ms. Until Dell fixes these problems fan
1059+
* support for affected blacklisted Dell machines stay disabled.
1060+
* See bug: https://bugzilla.kernel.org/show_bug.cgi?id=195751
1061+
*/
1062+
static struct dmi_system_id i8k_blacklist_fan_support_dmi_table[] __initdata = {
1063+
{
1064+
.ident = "Dell Inspiron 7720",
1065+
.matches = {
1066+
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1067+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Inspiron 7720"),
1068+
},
1069+
},
1070+
{ }
1071+
};
1072+
10411073
/*
10421074
* Probe for the presence of a supported laptop.
10431075
*/
@@ -1060,6 +1092,12 @@ static int __init i8k_probe(void)
10601092
i8k_get_dmi_data(DMI_BIOS_VERSION));
10611093
}
10621094

1095+
if (dmi_check_system(i8k_blacklist_fan_support_dmi_table)) {
1096+
pr_warn("broken Dell BIOS detected, disallow fan support\n");
1097+
if (!force)
1098+
disallow_fan_support = true;
1099+
}
1100+
10631101
if (dmi_check_system(i8k_blacklist_fan_type_dmi_table)) {
10641102
pr_warn("broken Dell BIOS detected, disallow fan type call\n");
10651103
if (!force)

0 commit comments

Comments
 (0)