From patchwork Fri May 27 13:05:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thorsten Leemhuis X-Patchwork-Id: 9138313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4EF4F60759 for ; Fri, 27 May 2016 13:06:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40767208C2 for ; Fri, 27 May 2016 13:06:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3555628135; Fri, 27 May 2016 13:06:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 593FC208C2 for ; Fri, 27 May 2016 13:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750861AbcE0NF6 (ORCPT ); Fri, 27 May 2016 09:05:58 -0400 Received: from basicbox7.server-home.net ([195.137.212.29]:40969 "EHLO basicbox7.server-home.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbcE0NF6 (ORCPT ); Fri, 27 May 2016 09:05:58 -0400 Received: from thl.ct.heise.de (gatekeeper.heise.de [193.99.145.162]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by basicbox7.server-home.net (Postfix) with ESMTPSA id D75355EE7ED; Fri, 27 May 2016 15:05:54 +0200 (CEST) Subject: Re: [PATCH] dell-smm-hwmon: Cache fan_type() calls and use fan_status() for fan detection To: =?UTF-8?Q?Pali_Roh=c3=a1r?= References: <1463842001-17785-1-git-send-email-pali.rohar@gmail.com> <20160527094736.GL29844@pali> <10b66444-9405-9d4c-b1ec-ce57f7e8420f@leemhuis.info> <201605271245.47383@pali> Cc: Jan C Peters , =?UTF-8?Q?David_Santamar=c3=ada_Rogado?= , Peter Saunderson , Jean Delvare , Guenter Roeck , Tolga Cakir , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org From: Thorsten Leemhuis Message-ID: <01084692-618a-31db-76f8-60176d1cd2cc@leemhuis.info> Date: Fri, 27 May 2016 15:05:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <201605271245.47383@pali> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pali Rohár wrote on 27.05.2016 12:45: > […] > Looks like there are two different problems with dell-smm-hwmon driver: > 1) Fan speed going randomly up and down without system freeze > […] > So for problem 1) I need to know: > > * Is it regression? […] Yes, it is known to be a regression from f989e55452, as identified by Jan in https://bugzilla.kernel.org/show_bug.cgi?id=100121#c13 I just verified and reverted that change on top of 4.6; the problem with the fan speed indeed goes away. So I tried a few things and came to the conclusion: the problem shows up as soon as i8k_get_fan_type() (introduced in f989e55452) is called somewhere. Find below the minimal patch I could come up to that makes the fan act normal on the Studio 8000 I have here (it's just meant as a reference and not meant to be applied, as it leaves unused functions around). CU, knurd --- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- dell-smm-hwmon.c-unmodified 2016-05-27 13:05:58.441654144 +0200 +++ dell-smm-hwmon.c 2016-05-27 14:49:31.896224380 +0200 @@ -686,14 +686,10 @@ static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL, 3); static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, i8k_hwmon_show_fan, NULL, 0); -static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, i8k_hwmon_show_fan_label, NULL, - 0); static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, i8k_hwmon_show_pwm, i8k_hwmon_set_pwm, 0); static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, i8k_hwmon_show_fan, NULL, 1); -static SENSOR_DEVICE_ATTR(fan2_label, S_IRUGO, i8k_hwmon_show_fan_label, NULL, - 1); static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, i8k_hwmon_show_pwm, i8k_hwmon_set_pwm, 1); @@ -707,11 +703,9 @@ &sensor_dev_attr_temp4_input.dev_attr.attr, /* 6 */ &sensor_dev_attr_temp4_label.dev_attr.attr, /* 7 */ &sensor_dev_attr_fan1_input.dev_attr.attr, /* 8 */ - &sensor_dev_attr_fan1_label.dev_attr.attr, /* 9 */ - &sensor_dev_attr_pwm1.dev_attr.attr, /* 10 */ - &sensor_dev_attr_fan2_input.dev_attr.attr, /* 11 */ - &sensor_dev_attr_fan2_label.dev_attr.attr, /* 12 */ - &sensor_dev_attr_pwm2.dev_attr.attr, /* 13 */ + &sensor_dev_attr_pwm1.dev_attr.attr, /* 9 */ + &sensor_dev_attr_fan2_input.dev_attr.attr, /* 10 */ + &sensor_dev_attr_pwm2.dev_attr.attr, /* 11 */ NULL }; @@ -730,10 +724,10 @@ if (index >= 6 && index <= 7 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP4)) return 0; - if (index >= 8 && index <= 10 && + if (index >= 8 && index <= 9 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN1)) return 0; - if (index >= 11 && index <= 13 && + if (index >= 10 && index <= 11 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN2)) return 0; @@ -768,12 +762,14 @@ i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP4; /* First fan attributes, if fan type is OK */ - err = i8k_get_fan_type(0); + // err = i8k_get_fan_type(0); + err = i8k_get_fan_status(0); if (err >= 0) i8k_hwmon_flags |= I8K_HWMON_HAVE_FAN1; /* Second fan attributes, if fan type is OK */ - err = i8k_get_fan_type(1); + // err = i8k_get_fan_type(1); + err = i8k_get_fan_status(1); if (err >= 0) i8k_hwmon_flags |= I8K_HWMON_HAVE_FAN2; @@ -932,17 +928,6 @@ static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = { { /* - * CPU fan speed going up and down on Dell Studio XPS 8000 - * for unknown reasons. - */ - .ident = "Dell Studio XPS 8000", - .matches = { - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Studio XPS 8000"), - }, - }, - { - /* * CPU fan speed going up and down on Dell Studio XPS 8100 * for unknown reasons. */