[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <797319c5-9b03-704d-2e32-fadcec924019@roeck-us.net>
Date: Sat, 10 Jun 2023 13:58:56 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Baskaran Kannan <Baski.Kannan@....com>, Mario.Limonciello@....com,
babu.moger@....com, clemens@...isch.de, jdelvare@...e.com,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Baskaran Kannan <bakannan@....com>
Subject: Re: [PATCH] Enable AMD3255 Proc to show negative temperature
On 6/10/23 13:53, Baskaran Kannan wrote:
> From: Baskaran Kannan <bakannan@....com>
>
> Signed-off-by: Baskaran Kannan <Baski.Kannan@....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)) {
Powered by blists - more mailing lists