All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] hwmon, via-cputem: support new centaur CPUs
@ 2018-03-29  6:36 David Wang
  2018-03-29 13:42 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: David Wang @ 2018-03-29  6:36 UTC (permalink / raw)
  To: jdelvare, linux, tglx, mingo, rjw, linux-hwmon, linux-kernel
  Cc: brucechang, cooperyan, qiyuanwang, benjaminpan, lukelin, timguo,
	David Wang

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

Signed-off-by: David Wang <davidwang@zhaoxin.com>
---
 drivers/hwmon/via-cputemp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
index 07a0cb0..2f5bd50 100644
--- a/drivers/hwmon/via-cputemp.c
+++ b/drivers/hwmon/via-cputemp.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] hwmon, via-cputem: support new centaur CPUs
  2018-03-29  6:36 [PATCH v1] hwmon, via-cputem: support new centaur CPUs David Wang
@ 2018-03-29 13:42 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-03-29 13:42 UTC (permalink / raw)
  To: David Wang, jdelvare, tglx, mingo, rjw, linux-hwmon, linux-kernel
  Cc: brucechang, cooperyan, qiyuanwang, benjaminpan, lukelin, timguo

On 03/28/2018 11:36 PM, David Wang wrote:
> Newer centaur CPUs(Family == 7) also support this cpu temperature sensor.
> 
> Signed-off-by: David Wang <davidwang@zhaoxin.com>
> ---

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

>   drivers/hwmon/via-cputemp.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
> index 07a0cb0..2f5bd50 100644
> --- a/drivers/hwmon/via-cputemp.c
> +++ b/drivers/hwmon/via-cputemp.c
> @@ -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

> +
>   	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);
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-29 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29  6:36 [PATCH v1] hwmon, via-cputem: support new centaur CPUs David Wang
2018-03-29 13:42 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.