Skip to content

Commit 55163a1

Browse files
weihuang-amdgroeck
authored andcommitted
hwmon: (k10temp) Add support for Zen3 CPUs
Zen3 thermal info is supported via a new PCI device ID. Also the voltage telemetry registers and the current factors need to be defined. k10temp driver then searches for CPU family 0x19 and configures k10temp_data accordingly. Signed-off-by: Wei Huang <wei.huang2@amd.com> Link: https://lore.kernel.org/r/20200914200715.1997757-1-wei.huang2@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 04e216d commit 55163a1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/hwmon/k10temp.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
9595
#define F17H_M31H_CFACTOR_ICORE 1000000 /* 1A / LSB */
9696
#define F17H_M31H_CFACTOR_ISOC 310000 /* 0.31A / LSB */
9797

98+
/* F19h thermal registers through SMN */
99+
#define F19H_M01_SVI_TEL_PLANE0 (ZEN_SVI_BASE + 0x14)
100+
#define F19H_M01_SVI_TEL_PLANE1 (ZEN_SVI_BASE + 0x10)
101+
102+
#define F19H_M01H_CFACTOR_ICORE 1000000 /* 1A / LSB */
103+
#define F19H_M01H_CFACTOR_ISOC 310000 /* 0.31A / LSB */
104+
98105
struct k10temp_data {
99106
struct pci_dev *pdev;
100107
void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
@@ -527,6 +534,22 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
527534
k10temp_get_ccd_support(pdev, data, 8);
528535
break;
529536
}
537+
} else if (boot_cpu_data.x86 == 0x19) {
538+
data->temp_adjust_mask = ZEN_CUR_TEMP_RANGE_SEL_MASK;
539+
data->read_tempreg = read_tempreg_nb_zen;
540+
data->show_temp |= BIT(TDIE_BIT);
541+
data->is_zen = true;
542+
543+
switch (boot_cpu_data.x86_model) {
544+
case 0x0 ... 0x1: /* Zen3 */
545+
data->show_current = true;
546+
data->svi_addr[0] = F19H_M01_SVI_TEL_PLANE0;
547+
data->svi_addr[1] = F19H_M01_SVI_TEL_PLANE1;
548+
data->cfactor[0] = F19H_M01H_CFACTOR_ICORE;
549+
data->cfactor[1] = F19H_M01H_CFACTOR_ISOC;
550+
k10temp_get_ccd_support(pdev, data, 8);
551+
break;
552+
}
530553
} else {
531554
data->read_htcreg = read_htcreg_pci;
532555
data->read_tempreg = read_tempreg_pci;
@@ -564,6 +587,7 @@ static const struct pci_device_id k10temp_id_table[] = {
564587
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) },
565588
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F3) },
566589
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) },
590+
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_19H_DF_F3) },
567591
{ PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) },
568592
{}
569593
};

0 commit comments

Comments
 (0)