Received: by 10.213.65.68 with SMTP id h4csp2106477imn; Thu, 29 Mar 2018 18:12:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx488I8lfPuYFiElU3hoJ5/uNytZ4imGaEtO2ZpXTq1QskK/MzpAHW5qj5g2NLAGVEu67BuOF X-Received: by 2002:a17:902:4303:: with SMTP id i3-v6mr10671108pld.302.1522372320979; Thu, 29 Mar 2018 18:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522372320; cv=none; d=google.com; s=arc-20160816; b=pcvIK/TZNlQ6dq5GoA4tBJ4jJrCRCE8R7HdyXklDvKXLc2/pVTaxf4EbxNY6Aq4SlL L65rQkTkwznYEOjM1GiQ8Rfw1YumY41LzKxFW+KnTKHm/UdZAgjUNva/tOU4FWOpJBsj QdFOlQcGc6mQU6jTHjSR1LWS+kaapw+WosKiMnjP64NU9leDz2cuGU1BCHIKP/shYvrE 4OWWFk+JIUiAhJVHV3Tf3PHGB4ocpMIHp447mFfvifdtdYlHnnbv3tvcCnKY12RiiN4D 976s5fzpoDH2D0Zj8cFI9mTKB/w021nsgFr0iQTzZLeKNoxAuCB9bCXhsiLJ3b1XDX4V mBuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=hDObmHV6l35hoAuMHRcC6CrTqzm0HMDX2i0/5BB6J2M=; b=sabu7qx8bN5yQzEmFMILa+rWjB6DyhwCIwPui9Vju/rIL3H16Q2WD2DOH8DJRPAkhG yen9HE/PcUkAwjKsXANgeFuOnJt7tTVHQ82iw75ZoseAJ9wuBj08ZaQGuyZwzJUBpzLh QSHREmAD7/LaWeWg3XZOCiA7u5Rkh5cn9MSmXY6YG63V0cuK0KyiIQ+Tp7kumKpcws8u zf2/S6acX/1n7tdpyjGZy2YO9g+iYKDmmv1SObcN05dAi0GoJXzrFh13Iq1eHQBGWz0e kQMG2d2Na7Z1AzihfuIcZh3GxU4V8eTn7sJXNXLmiXMoxYmW+mrYpcEWwyUAS8sGcAVq 1WIA== ARC-Authentication-Results: i=1; mx.google.com; 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 b2si4759241pgt.44.2018.03.29.18.11.11; Thu, 29 Mar 2018 18:12:00 -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; 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 S1752247AbeC3BF0 (ORCPT + 99 others); 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 Content-Type: text/plain 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 1.9.1