Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5442621imm; Tue, 16 Oct 2018 10:17:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV61n/KGS6cmtvGo3UcPA02fmv82EohMqQHYa8QS2OQm/PU6Z3nUE9X5DAcGP2SE9C9qB50qI X-Received: by 2002:a62:3185:: with SMTP id x127-v6mr23652735pfx.88.1539710233748; Tue, 16 Oct 2018 10:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710233; cv=none; d=google.com; s=arc-20160816; b=vZ4FaxN5eBsvuRILbxZhrXjzy4EYV7fdI3ejGAlZHZv8sulyZ1HSCrxz+Acrc8qUe8 eRINb2qDgOybWo6E0zKq/UFJvAedoK/pYvlScLhRz+YI+rD3CKrcoNctiLu4TZT0VeM4 vinDkd0Ed2f88KQqjweMMwsp/zCV1KrJwkv75YDPFai3G7yKHo64JWBji992IgETAkXN jkugGytMaQrGwJ9BHZI6awYIX6w8XR9HO8GrX/qjRjsbTEdhNpzVUigOIyK6Bdb/HXxq /gTIUdvSX6BJs0ikwf3O3XILqIpeVi4YPCFbowA4XZ0yRGWEit5dFDnlbYFo7cokK1lX zLPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NyT/W+GHJQiVg36iWvGbLdQAP9cxOfaxxjFPDqvXojs=; b=UCAjsTbpETdRZQg9OKF50+PPJumuY1yQkonhDDgXq/GZ0eqdZmI2T9rg/KdV1drnKB nnASuHjl90KmOBCQOCso9KDv3RdhdqnAmI9azsEZLWr38bO4j7geer2nFHG2wzDznXUs lIDAAInmtuokm1Y5t2V1Vs9T0pp11s6tao8TQQt9z18FRYJ3g1IG0WvKjQ2xX37QfJ4W SmK9TWm3MkofMslv1CHAEVtCa2JZqQFHGJRLov42N4dHxz1gf1zV353Cy2DNqvIxl1dd rN06n1zWlaEJCZqlr9XONzT7pkK7yHABWTLyPhmHq9wnMvLE+1jusOmIVqTcOmH6KOMl PP9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sw4OEqgt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si2653708pld.419.2018.10.16.10.16.57; Tue, 16 Oct 2018 10:17:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sw4OEqgt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729153AbeJQBFz (ORCPT + 99 others); Tue, 16 Oct 2018 21:05:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:49516 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbeJQBFz (ORCPT ); Tue, 16 Oct 2018 21:05:55 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A60B020866; Tue, 16 Oct 2018 17:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710072; bh=plUjhf6vFOFKO6ICpDHffd7z4fOwaAsJfXzTHpYBgyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sw4OEqgt1zkNwd06y9LhDkcDiIoAerb5NRe6fHO7b06QS6oOzS51eljj229HOqkaZ zShbv4fK3IAUeyrrunIIytaMbrWbW0TD0kcmTu22572ATUiL1BixFzBUPzRd5yHZo/ JZczXTo4MKhb/9rY/R6G2FEDcfViVqr976DVCTKk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Kern , Guenter Roeck , Sasha Levin Subject: [PATCH 4.18 094/135] hwmon: (nct6775) Fix RPM output for fan7 on NCT6796D Date: Tue, 16 Oct 2018 19:05:24 +0200 Message-Id: <20181016170521.839174072@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170515.447235311@linuxfoundation.org> References: <20181016170515.447235311@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck [ Upstream commit f6de298806d9cbc63a4907bca34a06162b9d7dce ] fan7 on NCT6796D does not have a fan count register; it only has an RPM register. Switch to using RPM registers to read the fan speed for all chips supporting it to solve the problem for good. Reported-by: Robert Kern Cc: Robert Kern Fixes: 81820059a428 ("hwmon: (nct6775) Add support for NCT6796D") Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/nct6775.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c @@ -502,7 +502,7 @@ static const s8 NCT6779_BEEP_BITS[] = { 30, 31 }; /* intrusion0, intrusion1 */ static const u16 NCT6779_REG_FAN[] = { - 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x660 }; + 0x4c0, 0x4c2, 0x4c4, 0x4c6, 0x4c8, 0x4ca, 0x660 }; static const u16 NCT6779_REG_FAN_PULSES[NUM_FAN] = { 0x644, 0x645, 0x646, 0x647, 0x648, 0x649 }; @@ -924,6 +924,11 @@ static unsigned int fan_from_reg16(u16 r return 1350000U / (reg << divreg); } +static unsigned int fan_from_reg_rpm(u16 reg, unsigned int divreg) +{ + return reg; +} + static u16 fan_to_reg(u32 fan, unsigned int divreg) { if (!fan) @@ -1284,7 +1289,7 @@ static bool is_word_sized(struct nct6775 case nct6795: case nct6796: return reg == 0x150 || reg == 0x153 || reg == 0x155 || - ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || + (reg & 0xfff0) == 0x4c0 || reg == 0x402 || reg == 0x63a || reg == 0x63c || reg == 0x63e || reg == 0x640 || reg == 0x642 || reg == 0x64a || @@ -3868,7 +3873,7 @@ static int nct6775_probe(struct platform data->ALARM_BITS = NCT6779_ALARM_BITS; data->BEEP_BITS = NCT6779_BEEP_BITS; - data->fan_from_reg = fan_from_reg13; + data->fan_from_reg = fan_from_reg_rpm; data->fan_from_reg_min = fan_from_reg13; data->target_temp_mask = 0xff; data->tolerance_mask = 0x07; @@ -3949,7 +3954,7 @@ static int nct6775_probe(struct platform data->ALARM_BITS = NCT6791_ALARM_BITS; data->BEEP_BITS = NCT6779_BEEP_BITS; - data->fan_from_reg = fan_from_reg13; + data->fan_from_reg = fan_from_reg_rpm; data->fan_from_reg_min = fan_from_reg13; data->target_temp_mask = 0xff; data->tolerance_mask = 0x07;