From patchwork Sun Sep 11 19:42:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9325565 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 EFBBE607D3 for ; Sun, 11 Sep 2016 19:42:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D54F228997 for ; Sun, 11 Sep 2016 19:42:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6198289A4; Sun, 11 Sep 2016 19:42:57 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 3D28728997 for ; Sun, 11 Sep 2016 19:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756454AbcIKTm4 (ORCPT ); Sun, 11 Sep 2016 15:42:56 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:53793 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756310AbcIKTmz (ORCPT ); Sun, 11 Sep 2016 15:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=HJe54qLYZS+d/r0g2OW801cTWLd1nF1LTprUFEErTr0=; b=nVSABBpNy9vPKghUFu4VqnPzrU yb/4AnM3dYTR+8cnlZrrP64/WW571R5Q02qMamQ4X4n1jl/zmNcaGWwVh+ZI2kdr1wmAUna6RNXp+ /PE8s3xpqDEhWlKZAtVwE8tEGrXpDWIWxWH4T7cejmNWds74wno2dM5eXVwx1LmGVeufpYXVCY+oe sw4fJzI4PJVA6z6yH/8BagE18z6AsIwaVh+Hm79DifXiqIG2BJ1BZdXGfCOsg6cFjYXo4lR4vgkly 70A/zE9PXdVGRTdh1O0D9i+e3oK2hPe7nbCxPNODFns2iBTeCmYzBWdsJ0xNa4CvteWd2D03YWe+l IPoQYIYQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:46784 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1bjAeR-0017dT-Oe; Sun, 11 Sep 2016 19:42:52 +0000 From: Guenter Roeck To: Hardware Monitoring Cc: Jean Delvare , Guenter Roeck Subject: [PATCH] hwmon: (nct6775) Add support for multiple virtual temperature sources Date: Sun, 11 Sep 2016 12:42:52 -0700 Message-Id: <1473622972-26377-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: 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 For virtual temperatures, the actual temperature values are written by software, presumably by the BIOS. This functionality is (as of right now) supported on NCT6791D, NCT6792D, and NCT6793D. On those chips, the temperatures are written into registers 0xea..0xef on page 0. This is known to be used on some Asus motherboards, where the actual temperature source can be configured in the BIOS. Report the 'virtual' temperatures for all monotoring sources to address this situation. Example for the resulting output (as seen with the 'sensors' command): nct6791-isa-0290 Adapter: ISA adapter ... Virtual_TEMP: +31.0°C PECI Agent 0: +38.5°C Virtual_TEMP: +32.0°C ... Signed-off-by: Guenter Roeck --- drivers/hwmon/nct6775.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 7859a30ce31e..ce75dd4db7eb 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c @@ -195,6 +195,8 @@ superio_exit(int ioreg) #define NUM_FAN 6 +#define TEMP_SOURCE_VIRTUAL 0x1f + /* Common and NCT6775 specific data */ /* Voltage min/max registers for nr=7..14 are in bank 5 */ @@ -3940,7 +3942,7 @@ static int nct6775_probe(struct platform_device *pdev) continue; src = nct6775_read_value(data, data->REG_TEMP_SEL[i]) & 0x1f; - if (!src || (mask & (1 << src))) + if (!src) continue; if (src >= data->temp_label_num || @@ -3952,7 +3954,16 @@ static int nct6775_probe(struct platform_device *pdev) continue; } - mask |= 1 << src; + /* + * For virtual temperature sources, the 'virtual' temperature + * for each fan reflects a different temperature, and there + * are no duplicates. + */ + if (src != TEMP_SOURCE_VIRTUAL) { + if (mask & (1 << src)) + continue; + mask |= 1 << src; + } /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */ if (src <= data->temp_fixed_num) {