Received: by 10.192.165.148 with SMTP id m20csp771280imm; Fri, 27 Apr 2018 07:16:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpZInGW8dO9ZbO+bZ/7IeD6q+FTasqwGNj5nCsQhC1uslyze6hjL2L++MyMTEB9BVIfvO87 X-Received: by 2002:a17:902:6b86:: with SMTP id p6-v6mr2538856plk.32.1524838606626; Fri, 27 Apr 2018 07:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524838606; cv=none; d=google.com; s=arc-20160816; b=sQ4MnjUPjdSEIvtPoN35AEVBCB00PTbVOS8FLMTVPNHwhnHOWRWFOH/iEJEYSrRoGM kWo5YqGFWryybqCtCZG3/LFG6soT1CNmnoSRGUqgtOh35AHwPv2xYrmDoEVK6KwARX4s zWkFeTvsn3JidBpD2jAmYoUNqF8fTakKfVd0BYQBPQaBzSCdCCrhaAFwErXXdlBKpRZn 5pO6LJ2SLI1Ph6e7IF7+2sGIuyQvoetT8rRpBMiVE7gJFTumlHoQyLjSoDGaebx6AUbb G5Lt01Ai5ShpuUCZg57WddML1/VfnJPcf/CTELmyp614782E2ZROHGSELKHuUCZTvuzF NddQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=xUflj9CjFArosWRmZ8RBufa+4cZUFzqY/sDF7w3hHSU=; b=ZD9KfVjQRwJPteRGsqP12ah66HLK5d/dB6HHYRY5ez1GFKyFbM4LwNL4nIyCvX59A2 aHFtS26SMVFXj2xBo4pguUjwzcNJs+U+2DrwvUY50SyzmsHT/uTT/C3iN/QMLvXHlheS zP+4O0cycq6q2NWj/njMyW4t7X6iUzM3lR46wOCyvgDwIft552u/XCDUJTkqc6P9N43V 6bHu9ASCJrjyJ00E2Qn9Fjq0y6e2REa0U0IlezAUJ20K9CqOVVjjes8Mvpi/x01EKYJU Z6r0JiVdtpRJAPo5PCNXF+ggYK2a53alvC+rIA8oEjAatT18Ua3baPztfnDOi3p7NYG3 3KtQ== 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 a66si122057pfb.81.2018.04.27.07.16.32; Fri, 27 Apr 2018 07:16:46 -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 S935380AbeD0OOw (ORCPT + 99 others); Fri, 27 Apr 2018 10:14:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:57514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935291AbeD0ONK (ORCPT ); Fri, 27 Apr 2018 10:13:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1358E218CA; Fri, 27 Apr 2018 14:13:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1358E218CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck Subject: [PATCH 4.16 74/81] hwmon: (k10temp) Add temperature offset for Ryzen 2700X Date: Fri, 27 Apr 2018 15:59:16 +0200 Message-Id: <20180427135747.577868131@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135743.216853156@linuxfoundation.org> References: <20180427135743.216853156@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck commit 1b59788979acd230b9627276c76f6e6ba2c4709c upstream. Ryzen 2700X has a temperature offset of 10 degrees C. If bit 19 of the Temperature Control register is set, there is an additional offset of 49 degrees C. Take this into account as well. Cc: stable@vger.kernel.org # v4.16+ Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/k10temp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c @@ -72,6 +72,7 @@ struct k10temp_data { struct pci_dev *pdev; void (*read_tempreg)(struct pci_dev *pdev, u32 *regval); int temp_offset; + u32 temp_adjust_mask; }; struct tctl_offset { @@ -84,6 +85,7 @@ static const struct tctl_offset tctl_off { 0x17, "AMD Ryzen 5 1600X", 20000 }, { 0x17, "AMD Ryzen 7 1700X", 20000 }, { 0x17, "AMD Ryzen 7 1800X", 20000 }, + { 0x17, "AMD Ryzen 7 2700X", 10000 }, { 0x17, "AMD Ryzen Threadripper 1950X", 27000 }, { 0x17, "AMD Ryzen Threadripper 1920X", 27000 }, { 0x17, "AMD Ryzen Threadripper 1900X", 27000 }, @@ -129,6 +131,8 @@ static ssize_t temp1_input_show(struct d data->read_tempreg(data->pdev, ®val); temp = (regval >> 21) * 125; + if (regval & data->temp_adjust_mask) + temp -= 49000; if (temp > data->temp_offset) temp -= data->temp_offset; else @@ -259,12 +263,14 @@ static int k10temp_probe(struct pci_dev data->pdev = pdev; if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 || - boot_cpu_data.x86_model == 0x70)) + boot_cpu_data.x86_model == 0x70)) { data->read_tempreg = read_tempreg_nb_f15; - else if (boot_cpu_data.x86 == 0x17) + } else if (boot_cpu_data.x86 == 0x17) { + data->temp_adjust_mask = 0x80000; data->read_tempreg = read_tempreg_nb_f17; - else + } else { data->read_tempreg = read_tempreg_pci; + } for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) { const struct tctl_offset *entry = &tctl_offset_table[i];