* [PATCH] Enable AMD3255 Proc to show negative temperature
@ 2023-06-09 23:11 Baskaran Kannan
2023-06-09 23:30 ` Randy Dunlap
2023-06-10 2:00 ` Guenter Roeck
0 siblings, 2 replies; 6+ messages in thread
From: Baskaran Kannan @ 2023-06-09 23:11 UTC (permalink / raw)
To: Mario.Limonciello, babu.moger, baski.kannan, clemens, jdelvare,
linux, linux-hwmon, linux-kernel
From: Your Name <you@example.com>
Signed-off-by: Baski Kannan <Baski.Kannan@amd.com>
---
drivers/hwmon/k10temp.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 489ad0b1bc74..58e4d90de5e3 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -77,6 +77,11 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
#define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19)
#define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16)
+/* AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius.
+ * Do not round off to zero for negative Tctl or Tdie values
+ */
+#define AMD_I3255_STR "3255"
+
struct k10temp_data {
struct pci_dev *pdev;
void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
@@ -86,6 +91,7 @@ struct k10temp_data {
u32 show_temp;
bool is_zen;
u32 ccd_offset;
+ bool disp_negative; /*Flag set for AMD i3255. Family 17h, Model 0x0-0xf */
};
#define TCTL_BIT 0
@@ -204,9 +210,15 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel,
switch (channel) {
case 0: /* Tctl */
*val = get_raw_temp(data);
+ if (*val < 0 && (data->disp_negative == false) ){
+ *val = 0;
+ }
break;
case 1: /* Tdie */
*val = get_raw_temp(data) - data->temp_offset;
+ if (*val < 0 && (data->disp_negative == false) ){
+ *val = 0;
+ }
break;
case 2 ... 13: /* Tccd{1-12} */
amd_smn_read(amd_pci_dev_to_node_id(data->pdev),
@@ -401,6 +413,11 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
data->pdev = pdev;
data->show_temp |= BIT(TCTL_BIT); /* Always show Tctl */
+ if (boot_cpu_data.x86 == 0x17 &&
+ strstr(boot_cpu_data.x86_model_id, AMD_I3255_STR)) {
+ data->disp_negative = true;
+ }
+
if (boot_cpu_data.x86 == 0x15 &&
((boot_cpu_data.x86_model & 0xf0) == 0x60 ||
(boot_cpu_data.x86_model & 0xf0) == 0x70)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Enable AMD3255 Proc to show negative temperature
2023-06-09 23:11 [PATCH] Enable AMD3255 Proc to show negative temperature Baskaran Kannan
@ 2023-06-09 23:30 ` Randy Dunlap
2023-06-10 2:00 ` Guenter Roeck
1 sibling, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2023-06-09 23:30 UTC (permalink / raw)
To: Baskaran Kannan, Mario.Limonciello, babu.moger, clemens,
jdelvare, linux, linux-hwmon, linux-kernel
Hi--
Style issues:
On 6/9/23 16:11, Baskaran Kannan wrote:
> From: Your Name <you@example.com>
Fix that. ^^^^^
Provide a comment message (not empty).
>
> Signed-off-by: Baski Kannan <Baski.Kannan@amd.com>
> ---
> drivers/hwmon/k10temp.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
> index 489ad0b1bc74..58e4d90de5e3 100644
> --- a/drivers/hwmon/k10temp.c
> +++ b/drivers/hwmon/k10temp.c
> @@ -77,6 +77,11 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
> #define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19)
> #define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16)
>
> +/* AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius.
> + * Do not round off to zero for negative Tctl or Tdie values
> + */
Linux multi-line coding style (except for net/ and bpf/) is like:
/*
* AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius.
* Do not round off to zero for negative Tctl or Tdie values
*/
End the last sentence above with a period.
> +#define AMD_I3255_STR "3255"
> +
> struct k10temp_data {
> struct pci_dev *pdev;
> void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
For the next patch version, please make sure that it says v2
and explain the differences in v1 and v2.
thanks.
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enable AMD3255 Proc to show negative temperature
2023-06-09 23:11 [PATCH] Enable AMD3255 Proc to show negative temperature Baskaran Kannan
2023-06-09 23:30 ` Randy Dunlap
@ 2023-06-10 2:00 ` Guenter Roeck
1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2023-06-10 2:00 UTC (permalink / raw)
To: Baskaran Kannan, Mario.Limonciello, babu.moger, clemens,
jdelvare, linux-hwmon, linux-kernel
On 6/9/23 16:11, Baskaran Kannan wrote:
> From: Your Name <you@example.com>
>
Patch description missing here. Also, obviously, as Randy already mentioned,
"Your Name <you@example.com>" isn't acceptable.
> Signed-off-by: Baski Kannan <Baski.Kannan@amd.com>
> ---
> drivers/hwmon/k10temp.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
> index 489ad0b1bc74..58e4d90de5e3 100644
> --- a/drivers/hwmon/k10temp.c
> +++ b/drivers/hwmon/k10temp.c
> @@ -77,6 +77,11 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
> #define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19)
> #define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16)
>
> +/* AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius.
> + * Do not round off to zero for negative Tctl or Tdie values
> + */
> +#define AMD_I3255_STR "3255"
> +
> struct k10temp_data {
> struct pci_dev *pdev;
> void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
> @@ -86,6 +91,7 @@ struct k10temp_data {
> u32 show_temp;
> bool is_zen;
> u32 ccd_offset;
> + bool disp_negative; /*Flag set for AMD i3255. Family 17h, Model 0x0-0xf */
Space after '*'
> };
>
> #define TCTL_BIT 0
> @@ -204,9 +210,15 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel,
> switch (channel) {
> case 0: /* Tctl */
> *val = get_raw_temp(data);
> + if (*val < 0 && (data->disp_negative == false) ){
> + *val = 0;
> + }
It seems like this patch doesn't replace the previous version,
it is applied on top of it. Please don't do that. The previous version
was not accepted. Send a new version instead.
> break;
> case 1: /* Tdie */
> *val = get_raw_temp(data) - data->temp_offset;
> + if (*val < 0 && (data->disp_negative == false) ){
This violates Linux kernel style (space before {).
Also, () around the second expression is unnecessary, as is == false.
Please use !data->disp_negative instead. Also, the {} is unnecessary.
> + *val = 0;
> + }
> break;
> case 2 ... 13: /* Tccd{1-12} */
> amd_smn_read(amd_pci_dev_to_node_id(data->pdev),
> @@ -401,6 +413,11 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> data->pdev = pdev;
> data->show_temp |= BIT(TCTL_BIT); /* Always show Tctl */
>
> + if (boot_cpu_data.x86 == 0x17 &&
> + strstr(boot_cpu_data.x86_model_id, AMD_I3255_STR)) {
Multi-line alignment seems wrong, and there is no need for {}.
Please make sure that checkpatch --strict is clean.
> + data->disp_negative = true;
> + }
> +
> if (boot_cpu_data.x86 == 0x15 &&
> ((boot_cpu_data.x86_model & 0xf0) == 0x60 ||
> (boot_cpu_data.x86_model & 0xf0) == 0x70)) {
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enable AMD3255 Proc to show negative temperature
2023-06-10 20:58 ` Guenter Roeck
@ 2023-06-10 21:34 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2023-06-10 21:34 UTC (permalink / raw)
To: Guenter Roeck, Baskaran Kannan, Mario.Limonciello, babu.moger,
clemens, jdelvare, linux-hwmon, linux-kernel
Cc: Baskaran Kannan
On 6/10/23 13:58, Guenter Roeck wrote:
> On 6/10/23 13:53, Baskaran Kannan wrote:
>> From: Baskaran Kannan <bakannan@amd.com>
>>
>> Signed-off-by: Baskaran Kannan <Baski.Kannan@amd.com>
>
> Please resubmit and either make the changes you were asked to make,
> or explain why you did not follow them.
>
I don't know if anyone asked you to change the Subject: line, but you
should look at the output of
$ git log --oneline dirvers/hwmon/
to see appropriate Subject: lines.
thanks.
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enable AMD3255 Proc to show negative temperature
2023-06-10 20:53 Baskaran Kannan
@ 2023-06-10 20:58 ` Guenter Roeck
2023-06-10 21:34 ` Randy Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2023-06-10 20:58 UTC (permalink / raw)
To: Baskaran Kannan, Mario.Limonciello, babu.moger, clemens,
jdelvare, linux-hwmon, linux-kernel
Cc: Baskaran Kannan
On 6/10/23 13:53, Baskaran Kannan wrote:
> From: Baskaran Kannan <bakannan@amd.com>
>
> Signed-off-by: Baskaran Kannan <Baski.Kannan@amd.com>
Please resubmit and either make the changes you were asked to make,
or explain why you did not follow them.
Guenter
> ---
> drivers/hwmon/k10temp.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
> index 489ad0b1bc74..a79aac0596e5 100644
> --- a/drivers/hwmon/k10temp.c
> +++ b/drivers/hwmon/k10temp.c
> @@ -77,6 +77,12 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
> #define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19)
> #define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16)
>
> +/*
> + * AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius.
> + * Do not round off to zero for negative Tctl or Tdie values.
> + */
> +#define AMD_I3255_STR "3255"
> +
> struct k10temp_data {
> struct pci_dev *pdev;
> void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
> @@ -86,6 +92,7 @@ struct k10temp_data {
> u32 show_temp;
> bool is_zen;
> u32 ccd_offset;
> + bool disp_negative; /*Flag set for AMD i3255. Family 17h, Model 0x0-0xf */
> };
>
> #define TCTL_BIT 0
> @@ -204,9 +211,15 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel,
> switch (channel) {
> case 0: /* Tctl */
> *val = get_raw_temp(data);
> + if (*val < 0 && (data->disp_negative == false) ){
> + *val = 0;
> + }
> break;
> case 1: /* Tdie */
> *val = get_raw_temp(data) - data->temp_offset;
> + if (*val < 0 && (data->disp_negative == false) ){
> + *val = 0;
> + }
> break;
> case 2 ... 13: /* Tccd{1-12} */
> amd_smn_read(amd_pci_dev_to_node_id(data->pdev),
> @@ -401,6 +414,11 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> data->pdev = pdev;
> data->show_temp |= BIT(TCTL_BIT); /* Always show Tctl */
>
> + if (boot_cpu_data.x86 == 0x17 &&
> + strstr(boot_cpu_data.x86_model_id, AMD_I3255_STR)) {
> + data->disp_negative = true;
> + }
> +
> if (boot_cpu_data.x86 == 0x15 &&
> ((boot_cpu_data.x86_model & 0xf0) == 0x60 ||
> (boot_cpu_data.x86_model & 0xf0) == 0x70)) {
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Enable AMD3255 Proc to show negative temperature
@ 2023-06-10 20:53 Baskaran Kannan
2023-06-10 20:58 ` Guenter Roeck
0 siblings, 1 reply; 6+ messages in thread
From: Baskaran Kannan @ 2023-06-10 20:53 UTC (permalink / raw)
To: Mario.Limonciello, babu.moger, baski.kannan, clemens, jdelvare,
linux, linux-hwmon, linux-kernel
Cc: Baskaran Kannan, Baskaran Kannan
From: Baskaran Kannan <bakannan@amd.com>
Signed-off-by: Baskaran Kannan <Baski.Kannan@amd.com>
---
drivers/hwmon/k10temp.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 489ad0b1bc74..a79aac0596e5 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -77,6 +77,12 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
#define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19)
#define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16)
+/*
+ * AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius.
+ * Do not round off to zero for negative Tctl or Tdie values.
+ */
+#define AMD_I3255_STR "3255"
+
struct k10temp_data {
struct pci_dev *pdev;
void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
@@ -86,6 +92,7 @@ struct k10temp_data {
u32 show_temp;
bool is_zen;
u32 ccd_offset;
+ bool disp_negative; /*Flag set for AMD i3255. Family 17h, Model 0x0-0xf */
};
#define TCTL_BIT 0
@@ -204,9 +211,15 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel,
switch (channel) {
case 0: /* Tctl */
*val = get_raw_temp(data);
+ if (*val < 0 && (data->disp_negative == false) ){
+ *val = 0;
+ }
break;
case 1: /* Tdie */
*val = get_raw_temp(data) - data->temp_offset;
+ if (*val < 0 && (data->disp_negative == false) ){
+ *val = 0;
+ }
break;
case 2 ... 13: /* Tccd{1-12} */
amd_smn_read(amd_pci_dev_to_node_id(data->pdev),
@@ -401,6 +414,11 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
data->pdev = pdev;
data->show_temp |= BIT(TCTL_BIT); /* Always show Tctl */
+ if (boot_cpu_data.x86 == 0x17 &&
+ strstr(boot_cpu_data.x86_model_id, AMD_I3255_STR)) {
+ data->disp_negative = true;
+ }
+
if (boot_cpu_data.x86 == 0x15 &&
((boot_cpu_data.x86_model & 0xf0) == 0x60 ||
(boot_cpu_data.x86_model & 0xf0) == 0x70)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-10 21:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 23:11 [PATCH] Enable AMD3255 Proc to show negative temperature Baskaran Kannan
2023-06-09 23:30 ` Randy Dunlap
2023-06-10 2:00 ` Guenter Roeck
2023-06-10 20:53 Baskaran Kannan
2023-06-10 20:58 ` Guenter Roeck
2023-06-10 21:34 ` Randy Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).