hwmon fixes for v4.17-rc3

- 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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJa4h6GAAoJEMsfJm/On5mBwy8P+gOh3tqRsFZTRzMcVjjgUw7Z
 aCDuqix3qvD+utmNE5d/E7l0KUwqaEcBnsLoyJE6cOsC2z5xgoGMHCoN2sQXv/wU
 NDf2tE1n5IaEgZx5AgJcGlquCh5t/9KqRohqXZCJ/guncV3YW1XcrlaANgSpRYul
 w/jrVi4/2E2tf2v8RdOugZsAkbLscHnjbTgt+oPWbr1MkQshe1/9mxtIzv4zXkcB
 +bGOJiS7Wo3Fos8Wnd76VycWHQ27Sqdxxv0SDz811kMFq/HefZQvprb6izYSq4I3
 g8Lso7OULXFWQNaaiSegs5yOmGlreS9UBIrlYHHhkf50fgpvfe6kLeJFvtHWW+AA
 8oX1u1tXyt56y0Im6WwPtHRa9xyAaj9jL8kTRcZlLNzGFP/Jz3HKQxziXEQUIq9B
 ZYQccLdHBA8jfwCZ4nhy7RArYXCDsMHGeY4VEnsycWM5TnuKBjAipSVlbjcTVmbJ
 0+Xe2ug4lA1odEpJIb8vHAxTDSQg09M12hPRa8UGPmUKgfCHqSQidmd5xjdmQEbS
 N5yWjXXIHolIT0CxaEh46empFZjLJjYzfPDqgOmus7MGoMJ/I3VKsBuwpCDouw7N
 j5j4g2Il3fcwyHAWzHRfOQSzMeKPhikSbzT9dIX9I0/9oT6u96uShKVZAiXlUEhQ
 7EPv9hAsrMNM0KdSf6Yq
 =JV1n
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2018-04-26 16:33:54 -07:00
commit 0871062bf9
3 changed files with 20 additions and 6 deletions

View File

@ -40,6 +40,10 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463
#endif
#ifndef PCI_DEVICE_ID_AMD_17H_RR_NB
#define PCI_DEVICE_ID_AMD_17H_RR_NB 0x15d0
#endif
/* CPUID function 0x80000001, ebx */
#define CPUID_PKGTYPE_MASK 0xf0000000
#define CPUID_PKGTYPE_F 0x00000000
@ -72,6 +76,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 +89,7 @@ static const struct tctl_offset tctl_offset_table[] = {
{ 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 +135,8 @@ static ssize_t temp1_input_show(struct device *dev,
data->read_tempreg(data->pdev, &regval);
temp = (regval >> 21) * 125;
if (regval & data->temp_adjust_mask)
temp -= 49000;
if (temp > data->temp_offset)
temp -= data->temp_offset;
else
@ -259,12 +267,14 @@ static int k10temp_probe(struct pci_dev *pdev,
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];
@ -292,6 +302,7 @@ static const struct pci_device_id k10temp_id_table[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_RR_NB) },
{}
};
MODULE_DEVICE_TABLE(pci, k10temp_id_table);

View File

@ -1380,8 +1380,8 @@ static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data)
/* Activate logical device if needed */
val = superio_inb(sioaddr, SIO_REG_ENABLE);
if (!(val & 0x01)) {
pr_err("EC is disabled\n");
goto fail;
pr_warn("Forcibly enabling EC access. Data may be unusable.\n");
superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01);
}
superio_exit(sioaddr);

View File

@ -170,7 +170,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
scmi_chip_info.info = ptr_scmi_ci;
chip_info = &scmi_chip_info;
for (type = 0; type < hwmon_max && nr_count[type]; type++) {
for (type = 0; type < hwmon_max; type++) {
if (!nr_count[type])
continue;
scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type],
type, hwmon_attributes[type]);
*ptr_scmi_ci++ = scmi_hwmon_chan++;