From patchwork Fri Jul 7 12:29:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13304864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F584EB64DA for ; Fri, 7 Jul 2023 12:30:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232151AbjGGMav (ORCPT ); Fri, 7 Jul 2023 08:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjGGMau (ORCPT ); Fri, 7 Jul 2023 08:30:50 -0400 Received: from ipmail06.adl3.internode.on.net (ipmail06.adl3.internode.on.net [150.101.137.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5FBDE19BD for ; Fri, 7 Jul 2023 05:30:49 -0700 (PDT) IronPort-SDR: 64a80568_xpBb06rxlStmKCUdsntSLoj8Lz1cEsV/kM7PO8vIrAvnz98 tJM3aAChdtYQbkFw54/8WSl6tVsm7SCJK+ibT5w== X-SMTP-MATCH: 0 X-IPAS-Result: A2AKAwASBahkjPQc8jxaHQEBAQEJARIBBQUBSYFGgjOCUbYfDwEPAQFEBAEBhQYChhUmOBMBAgQBAQEBAwIDAQEBAQEBAwEBBgEBAQEBAQYEFAEBAQFARYVoDYYFAgEDJwsBDQEBNwEPGThXBgESgn6CXaljM4EBggkBAQaCZa4xgV8JgUKMIIEZgzt6Qj+BToEVgTyBPm+LBo4ghV0HMo0UgSdvgR43Z3oCCQIRZ4EICF+Bbj4CDVQLC2OBHIJOAgIROg8FU18ZHQMHA4EFEC8HBDImBgkYLyUGUQcXFiQJExVBBINYCoELPxUOEYJX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GLI X-IronPort-Anti-Spam-Filtered: true Received: from 60-242-28-244.static.tpgi.com.au (HELO bits.crawford.emu.id.au) ([60.242.28.244]) by ipmail06.adl3.internode.on.net with ESMTP; 07 Jul 2023 22:00:32 +0930 Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.1/8.17.1) with ESMTPSA id 367CU7bM2026771 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 7 Jul 2023 22:30:28 +1000 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 367CU7bM2026771 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1688733028; bh=mKCGVZ5x8xE6L93ndv2Q/Q1AZxKevto8TXRk8sy6cyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0l9H3yXf6LZWGo8h6RCx5mG4+AhH6L6xsFBlK//Ps8dkJlS7fT5aWtydzJO02Wp9 PjOJY1SYnrgH/9+4Ei0fhWzDKIOtGE24HtWnGoyP1AUiVehgobSkXkdhwDL27oV/gY bP42wDnXnzoWjZpAo2RLDdX4XfFGsssN+CP3xMJpT+rvyLKV0OZMus/YxIdPL+xH0Y RUd7xOVa/33V7PF73CHLYAzERFEmqxWfVapMz8SbP4ppBW21+ix5dv27efVEjbUTzN cwmp4w2FV7Qkagu0EtmcNb2CCBez4n7GnGM7o0IEGKxcPsmrlL4JPyhhxxtwrYvNOB Bo/O1w89qIYoA== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v2 3/3] hwmon: (it87) Add support to detect sensor type AMDTSI Date: Fri, 7 Jul 2023 22:29:52 +1000 Message-ID: <20230707123005.956415-4-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230707123005.956415-1-frank@crawford.emu.id.au> References: <20230707123005.956415-1-frank@crawford.emu.id.au> MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Fri, 07 Jul 2023 22:30:28 +1000 (AEST) X-Virus-Scanned: clamav-milter 1.0.1 at bits.crawford.emu.id.au X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add test for sensor type AMDTSI which is available on certain recent chipsets. Signed-off-by: Frank Crawford --- v2: * Split single patch into multi-patch set following review. --- drivers/hwmon/it87.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index fb62f2a7017a..ba75f33301ce 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -221,6 +221,10 @@ static bool fix_pwm_polarity; * Super-I/O configuration space. */ #define IT87_REG_VID 0x0a + +/* Interface Selection register on other chips */ +#define IT87_REG_IFSEL 0x0a + /* * The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b * for fan divisors. Later IT8712F revisions must use 16-bit tachometer @@ -1170,14 +1174,37 @@ static int get_temp_type(struct it87_data *data, int index) * 0 = disabled */ u8 reg, extra; - int type = 0; + int ttype, type = 0; + + /* Detect PECI vs. AMDTSI */ + ttype = 6; + if ((has_temp_peci(data, index)) || data->type == it8721 || + data->type == it8720) { + extra = it87_read_value(data, IT87_REG_IFSEL); + if ((extra & 0x70) == 0x40) + ttype = 5; + } - reg = data->sensor; /* In case value is updated while used */ - extra = data->extra; + reg = it87_read_value(data, IT87_REG_TEMP_ENABLE); + + /* Per chip special detection */ + switch (data->type) { + case it8622: + if (!(reg & 0xc0) && index == 3) + type = ttype; + break; + default: + break; + } + + if (type || index >= 3) + return type; + + extra = it87_read_value(data, IT87_REG_TEMP_EXTRA); if ((has_temp_peci(data, index) && (reg >> 6 == index + 1)) || (has_temp_old_peci(data, index) && (extra & 0x80))) - type = 6; /* Intel PECI */ + type = ttype; /* Intel PECI or AMDTSI */ else if (reg & BIT(index)) type = 3; /* thermal diode */ else if (reg & BIT(index + 3))