From patchwork Thu Mar 29 06:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: davidwang X-Patchwork-Id: 10314549 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 1E1F26037E for ; Thu, 29 Mar 2018 06:36:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0157C2A22B for ; Thu, 29 Mar 2018 06:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9DAB2A22D; Thu, 29 Mar 2018 06:36: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.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 5DC892A22B for ; Thu, 29 Mar 2018 06:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750732AbeC2Gg5 (ORCPT ); Thu, 29 Mar 2018 02:36:57 -0400 Received: from zxshcas1.zhaoxin.com ([180.169.121.91]:22306 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750716AbeC2Gg4 (ORCPT ); Thu, 29 Mar 2018 02:36:56 -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; Thu, 29 Mar 2018 14:36:54 +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; Thu, 29 Mar 2018 14:36:52 +0800 From: David Wang To: , , , , , , CC: , , , , , , David Wang Subject: [PATCH v1] hwmon, via-cputem: support new centaur CPUs Date: Thu, 29 Mar 2018 14:36:43 +0800 Message-ID: <1522305403-21009-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 Newer centaur CPUs(Family == 7) also support this cpu temperature sensor. Signed-off-by: David Wang --- drivers/hwmon/via-cputemp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index 07a0cb0..2f5bd50 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -136,6 +136,11 @@ static int via_cputemp_probe(struct platform_device *pdev) data->id = pdev->id; data->name = "via_cputemp"; + if (c->x86 == 7) { + data->msr_temp = 0x1423; + goto test_access; + } + switch (c->x86_model) { case 0xA: /* C7 A */ @@ -152,6 +157,7 @@ static int via_cputemp_probe(struct platform_device *pdev) return -ENODEV; } +test_access: /* test if we can access the TEMPERATURE MSR */ err = rdmsr_safe_on_cpu(data->id, data->msr_temp, &eax, &edx); if (err) { @@ -283,6 +289,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);