aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-04-24 09:55:55 -0400
committerGuenter Roeck <linux@roeck-us.net>2018-04-25 08:23:20 -0400
commit1b59788979acd230b9627276c76f6e6ba2c4709c (patch)
tree2a4a9375e4dad059e8110dde763d3198ac1aa08f
parentdbac00f0cf634120d77edee10d25e3f6899d7636 (diff)
hwmon: (k10temp) Add temperature offset for Ryzen 2700X
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 <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/k10temp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 051a72eecb24..d19d08f81c6f 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -72,6 +72,7 @@ struct k10temp_data {
72 struct pci_dev *pdev; 72 struct pci_dev *pdev;
73 void (*read_tempreg)(struct pci_dev *pdev, u32 *regval); 73 void (*read_tempreg)(struct pci_dev *pdev, u32 *regval);
74 int temp_offset; 74 int temp_offset;
75 u32 temp_adjust_mask;
75}; 76};
76 77
77struct tctl_offset { 78struct tctl_offset {
@@ -84,6 +85,7 @@ static const struct tctl_offset tctl_offset_table[] = {
84 { 0x17, "AMD Ryzen 5 1600X", 20000 }, 85 { 0x17, "AMD Ryzen 5 1600X", 20000 },
85 { 0x17, "AMD Ryzen 7 1700X", 20000 }, 86 { 0x17, "AMD Ryzen 7 1700X", 20000 },
86 { 0x17, "AMD Ryzen 7 1800X", 20000 }, 87 { 0x17, "AMD Ryzen 7 1800X", 20000 },
88 { 0x17, "AMD Ryzen 7 2700X", 10000 },
87 { 0x17, "AMD Ryzen Threadripper 1950X", 27000 }, 89 { 0x17, "AMD Ryzen Threadripper 1950X", 27000 },
88 { 0x17, "AMD Ryzen Threadripper 1920X", 27000 }, 90 { 0x17, "AMD Ryzen Threadripper 1920X", 27000 },
89 { 0x17, "AMD Ryzen Threadripper 1900X", 27000 }, 91 { 0x17, "AMD Ryzen Threadripper 1900X", 27000 },
@@ -129,6 +131,8 @@ static ssize_t temp1_input_show(struct device *dev,
129 131
130 data->read_tempreg(data->pdev, &regval); 132 data->read_tempreg(data->pdev, &regval);
131 temp = (regval >> 21) * 125; 133 temp = (regval >> 21) * 125;
134 if (regval & data->temp_adjust_mask)
135 temp -= 49000;
132 if (temp > data->temp_offset) 136 if (temp > data->temp_offset)
133 temp -= data->temp_offset; 137 temp -= data->temp_offset;
134 else 138 else
@@ -259,12 +263,14 @@ static int k10temp_probe(struct pci_dev *pdev,
259 data->pdev = pdev; 263 data->pdev = pdev;
260 264
261 if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 || 265 if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 ||
262 boot_cpu_data.x86_model == 0x70)) 266 boot_cpu_data.x86_model == 0x70)) {
263 data->read_tempreg = read_tempreg_nb_f15; 267 data->read_tempreg = read_tempreg_nb_f15;
264 else if (boot_cpu_data.x86 == 0x17) 268 } else if (boot_cpu_data.x86 == 0x17) {
269 data->temp_adjust_mask = 0x80000;
265 data->read_tempreg = read_tempreg_nb_f17; 270 data->read_tempreg = read_tempreg_nb_f17;
266 else 271 } else {
267 data->read_tempreg = read_tempreg_pci; 272 data->read_tempreg = read_tempreg_pci;
273 }
268 274
269 for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) { 275 for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) {
270 const struct tctl_offset *entry = &tctl_offset_table[i]; 276 const struct tctl_offset *entry = &tctl_offset_table[i];