From patchwork Fri Mar 30 01:04:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: davidwang X-Patchwork-Id: 10316699 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 CFF716063D for ; Fri, 30 Mar 2018 01:05:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B55202A491 for ; Fri, 30 Mar 2018 01:05:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6E062A4A7; Fri, 30 Mar 2018 01:05:27 +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 0DEC12A491 for ; Fri, 30 Mar 2018 01:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751209AbeC3BF0 (ORCPT ); Thu, 29 Mar 2018 21:05:26 -0400 Received: from zxshcas1.zhaoxin.com ([180.169.121.91]:48092 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751191AbeC3BFZ (ORCPT ); Thu, 29 Mar 2018 21:05:25 -0400 Received: from zxbjmbx3.zhaoxin.com (10.29.252.165) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Fri, 30 Mar 2018 09:05:23 +0800 Received: from timguo-System-Product-Name.zhaoxin.com (10.29.8.54) by zxbjmbx3.zhaoxin.com (10.29.252.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Fri, 30 Mar 2018 09:05:21 +0800 From: David Wang To: , , , , , , CC: , , , , , , David Wang Subject: [PATCH v3] hwmon, via-cputem: support new centaur CPUs Date: Fri, 30 Mar 2018 09:04:48 +0800 Message-ID: <1522371888-30013-1-git-send-email-davidwang@zhaoxin.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.29.8.54] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx3.zhaoxin.com (10.29.252.165) 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 New centaur CPUs(Familiy == 7) also support this cpu temperature sensor. Change from v2 to v3: *replace "goto" with "if...else.." according to suggestion from Guenter Change from v1 to v2: *fixed the wrong if condition in patch v1. Signed-off-by: David Wang --- drivers/hwmon/via-cputemp.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index 07a0cb0..0e81f28 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -136,20 +136,24 @@ static int via_cputemp_probe(struct platform_device *pdev) data->id = pdev->id; data->name = "via_cputemp"; - switch (c->x86_model) { - case 0xA: - /* C7 A */ - case 0xD: - /* C7 D */ - data->msr_temp = 0x1169; - data->msr_vid = 0x198; - break; - case 0xF: - /* Nano */ + if (c->x86 == 7) { data->msr_temp = 0x1423; - break; - default: - return -ENODEV; + } else { + switch (c->x86_model) { + case 0xA: + /* C7 A */ + case 0xD: + /* C7 D */ + data->msr_temp = 0x1169; + data->msr_vid = 0x198; + break; + case 0xF: + /* Nano */ + data->msr_temp = 0x1423; + break; + default: + return -ENODEV; + } } /* test if we can access the TEMPERATURE MSR */ @@ -283,6 +287,7 @@ static int via_cputemp_down_prep(unsigned int cpu) { X86_VENDOR_CENTAUR, 6, 0xa, }, /* C7 A */ { X86_VENDOR_CENTAUR, 6, 0xd, }, /* C7 D */ { X86_VENDOR_CENTAUR, 6, 0xf, }, /* Nano */ + { X86_VENDOR_CENTAUR, 7, X86_MODEL_ANY, }, {} }; MODULE_DEVICE_TABLE(x86cpu, cputemp_ids);