Skip to contentSkip to conversation

hwmon, via-cputem: support new centaur CPUs

PATCH Superseded David Wang 2 participants 2 messages Mar 29, 2018 Hardware monitoring

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

David Wang

author
#0 lore raw

PATCH 1/1 hwmon, via-cputem: support new centaur CPUs

Newer centaur CPUs(Family == 7) also support this cpu temperature sensor.

---
 drivers/hwmon/via-cputemp.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/hwmon/via-cputemp.c +7 -0
index 07a0cb0..2f5bd50 100644
@@ -136,6 +136,11 @@ static int via_cputemp_probe(struct platform_device *pdev)
 	data->id = pdev->id;
 	data->name = "via_cputemp";
 
+	if (c->x86 == 7) {
+		data->msr_temp = 0x1423;
+		goto test_access;
+	}
+
 	switch (c->x86_model) {
 	case 0xA:
 		/* C7 A */
@@ -152,6 +157,7 @@ static int via_cputemp_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+test_access:
 	/* test if we can access the TEMPERATURE MSR */
 	err = rdmsr_safe_on_cpu(data->id, data->msr_temp, &eax, &edx);
 	if (err) {
@@ -283,6 +289,7 @@ static int via_cputemp_down_prep(unsigned int cpu)
 	{ X86_VENDOR_CENTAUR, 6, 0xa, }, /* C7 A */
 	{ X86_VENDOR_CENTAUR, 6, 0xd, }, /* C7 D */
 	{ X86_VENDOR_CENTAUR, 6, 0xf, }, /* Nano */
+	{ X86_VENDOR_CENTAUR, 7, X86_MODEL_ANY, },
 	{}
 };
 MODULE_DEVICE_TABLE(x86cpu, cputemp_ids);
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 4 lines · David Wang

Newer centaur CPUs(Family == 7) also support this cpu temperature sensor.

---

FWIW, this would be v2, not v1, and a changelog would be appreciated.

Quoted 8 lines
  drivers/hwmon/via-cputemp.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/hwmon/via-cputemp.c +0 -0
index 07a0cb0..2f5bd50 100644

drivers/hwmon/via-cputemp.c static int via_cputemp_probe(struct platform_device *pdev) · line 142

Quoted 7 lines
drivers/hwmon/via-cputemp.c +4 -0
@@ -136,6 +136,11 @@ static int via_cputemp_probe(struct platform_device *pdev)
  	data->id = pdev->id;
  	data->name = "via_cputemp";
 
+	if (c->x86 == 7) {
+		data->msr_temp = 0x1423;
+		goto test_access;
+	}

Please rework to not require a goto. Something like

	if (c->x86 == 7) {
		data->msr_temp = 0x1423;
	} else switch (c->x86_model) {
		...
	}

should do.

Thanks,
Guenter

Quoted 21 lines
drivers/hwmon/via-cputemp.c +3 -0
+
  	switch (c->x86_model) {
  	case 0xA:
  		/* C7 A */
@@ -152,6 +157,7 @@ static int via_cputemp_probe(struct platform_device *pdev)
  		return -ENODEV;
  	}
 
+test_access:
  	/* test if we can access the TEMPERATURE MSR */
  	err = rdmsr_safe_on_cpu(data->id, data->msr_temp, &eax, &edx);
  	if (err) {
@@ -283,6 +289,7 @@ static int via_cputemp_down_prep(unsigned int cpu)
  	{ X86_VENDOR_CENTAUR, 6, 0xa, }, /* C7 A */
  	{ X86_VENDOR_CENTAUR, 6, 0xd, }, /* C7 D */
  	{ X86_VENDOR_CENTAUR, 6, 0xf, }, /* Nano */
+	{ X86_VENDOR_CENTAUR, 7, X86_MODEL_ANY, },
  	{}
  };
  MODULE_DEVICE_TABLE(x86cpu, cputemp_ids);