diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-26 19:33:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-26 19:33:54 -0400 |
commit | 0871062bf9c6e6f0cc91247b3e743a37b87a970f (patch) | |
tree | df35fac91382c10c50f5e1d4294198d41d0b0d52 | |
parent | 7f5d15735588bc14e7c399e7214c0a36f3808dcf (diff) | |
parent | 877d8948d0aa402fbbede138fc73432bb335b65f (diff) |
Merge tag 'hwmon-for-linus-v4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck:
- Add support for new Ryzen chips to k10temp driver
... making Phoronix happy
- Fix inconsistent chip access in nct6683 driver
- Handle absence of few types of sensors in scmi driver
* tag 'hwmon-for-linus-v4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (k10temp) Add support for AMD Ryzen w/ Vega graphics
hwmon: (k10temp) Add temperature offset for Ryzen 2700X
hwmon: (nct6683) Enable EC access if disabled at boot
hwmon: (scmi) handle absence of few types of sensors
-rw-r--r-- | drivers/hwmon/k10temp.c | 17 | ||||
-rw-r--r-- | drivers/hwmon/nct6683.c | 4 | ||||
-rw-r--r-- | drivers/hwmon/scmi-hwmon.c | 5 |
3 files changed, 20 insertions, 6 deletions
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 051a72eecb24..d2cc55e21374 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -40,6 +40,10 @@ static DEFINE_MUTEX(nb_smu_ind_mutex); | |||
40 | #define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 | 40 | #define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifndef PCI_DEVICE_ID_AMD_17H_RR_NB | ||
44 | #define PCI_DEVICE_ID_AMD_17H_RR_NB 0x15d0 | ||
45 | #endif | ||
46 | |||
43 | /* CPUID function 0x80000001, ebx */ | 47 | /* CPUID function 0x80000001, ebx */ |
44 | #define CPUID_PKGTYPE_MASK 0xf0000000 | 48 | #define CPUID_PKGTYPE_MASK 0xf0000000 |
45 | #define CPUID_PKGTYPE_F 0x00000000 | 49 | #define CPUID_PKGTYPE_F 0x00000000 |
@@ -72,6 +76,7 @@ struct k10temp_data { | |||
72 | struct pci_dev *pdev; | 76 | struct pci_dev *pdev; |
73 | void (*read_tempreg)(struct pci_dev *pdev, u32 *regval); | 77 | void (*read_tempreg)(struct pci_dev *pdev, u32 *regval); |
74 | int temp_offset; | 78 | int temp_offset; |
79 | u32 temp_adjust_mask; | ||
75 | }; | 80 | }; |
76 | 81 | ||
77 | struct tctl_offset { | 82 | struct tctl_offset { |
@@ -84,6 +89,7 @@ static const struct tctl_offset tctl_offset_table[] = { | |||
84 | { 0x17, "AMD Ryzen 5 1600X", 20000 }, | 89 | { 0x17, "AMD Ryzen 5 1600X", 20000 }, |
85 | { 0x17, "AMD Ryzen 7 1700X", 20000 }, | 90 | { 0x17, "AMD Ryzen 7 1700X", 20000 }, |
86 | { 0x17, "AMD Ryzen 7 1800X", 20000 }, | 91 | { 0x17, "AMD Ryzen 7 1800X", 20000 }, |
92 | { 0x17, "AMD Ryzen 7 2700X", 10000 }, | ||
87 | { 0x17, "AMD Ryzen Threadripper 1950X", 27000 }, | 93 | { 0x17, "AMD Ryzen Threadripper 1950X", 27000 }, |
88 | { 0x17, "AMD Ryzen Threadripper 1920X", 27000 }, | 94 | { 0x17, "AMD Ryzen Threadripper 1920X", 27000 }, |
89 | { 0x17, "AMD Ryzen Threadripper 1900X", 27000 }, | 95 | { 0x17, "AMD Ryzen Threadripper 1900X", 27000 }, |
@@ -129,6 +135,8 @@ static ssize_t temp1_input_show(struct device *dev, | |||
129 | 135 | ||
130 | data->read_tempreg(data->pdev, ®val); | 136 | data->read_tempreg(data->pdev, ®val); |
131 | temp = (regval >> 21) * 125; | 137 | temp = (regval >> 21) * 125; |
138 | if (regval & data->temp_adjust_mask) | ||
139 | temp -= 49000; | ||
132 | if (temp > data->temp_offset) | 140 | if (temp > data->temp_offset) |
133 | temp -= data->temp_offset; | 141 | temp -= data->temp_offset; |
134 | else | 142 | else |
@@ -259,12 +267,14 @@ static int k10temp_probe(struct pci_dev *pdev, | |||
259 | data->pdev = pdev; | 267 | data->pdev = pdev; |
260 | 268 | ||
261 | if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 || | 269 | if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 || |
262 | boot_cpu_data.x86_model == 0x70)) | 270 | boot_cpu_data.x86_model == 0x70)) { |
263 | data->read_tempreg = read_tempreg_nb_f15; | 271 | data->read_tempreg = read_tempreg_nb_f15; |
264 | else if (boot_cpu_data.x86 == 0x17) | 272 | } else if (boot_cpu_data.x86 == 0x17) { |
273 | data->temp_adjust_mask = 0x80000; | ||
265 | data->read_tempreg = read_tempreg_nb_f17; | 274 | data->read_tempreg = read_tempreg_nb_f17; |
266 | else | 275 | } else { |
267 | data->read_tempreg = read_tempreg_pci; | 276 | data->read_tempreg = read_tempreg_pci; |
277 | } | ||
268 | 278 | ||
269 | for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) { | 279 | for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) { |
270 | const struct tctl_offset *entry = &tctl_offset_table[i]; | 280 | const struct tctl_offset *entry = &tctl_offset_table[i]; |
@@ -292,6 +302,7 @@ static const struct pci_device_id k10temp_id_table[] = { | |||
292 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, | 302 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, |
293 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | 303 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, |
294 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, | 304 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, |
305 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_RR_NB) }, | ||
295 | {} | 306 | {} |
296 | }; | 307 | }; |
297 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 308 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index 8b0bc4fc06e8..b0bc77bf2cd9 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c | |||
@@ -1380,8 +1380,8 @@ static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data) | |||
1380 | /* Activate logical device if needed */ | 1380 | /* Activate logical device if needed */ |
1381 | val = superio_inb(sioaddr, SIO_REG_ENABLE); | 1381 | val = superio_inb(sioaddr, SIO_REG_ENABLE); |
1382 | if (!(val & 0x01)) { | 1382 | if (!(val & 0x01)) { |
1383 | pr_err("EC is disabled\n"); | 1383 | pr_warn("Forcibly enabling EC access. Data may be unusable.\n"); |
1384 | goto fail; | 1384 | superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); |
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | superio_exit(sioaddr); | 1387 | superio_exit(sioaddr); |
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 363bf56eb0f2..91976b6ca300 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c | |||
@@ -170,7 +170,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) | |||
170 | scmi_chip_info.info = ptr_scmi_ci; | 170 | scmi_chip_info.info = ptr_scmi_ci; |
171 | chip_info = &scmi_chip_info; | 171 | chip_info = &scmi_chip_info; |
172 | 172 | ||
173 | for (type = 0; type < hwmon_max && nr_count[type]; type++) { | 173 | for (type = 0; type < hwmon_max; type++) { |
174 | if (!nr_count[type]) | ||
175 | continue; | ||
176 | |||
174 | scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], | 177 | scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], |
175 | type, hwmon_attributes[type]); | 178 | type, hwmon_attributes[type]); |
176 | *ptr_scmi_ci++ = scmi_hwmon_chan++; | 179 | *ptr_scmi_ci++ = scmi_hwmon_chan++; |