Commit b02c6857 authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (k10temp) Swap Tdie and Tctl on Family 17h CPUs

Traditionally, the temperature displayed by k10temp was Tctl.
On Family 17h CPUs, Tdie was displayed instead. To reduce confusion,
Tctl was added later as second temperature. This resulted in Tdie
being reported as temp1_input, and Tctl as temp2_input. This is
different to non-Ryzen CPUs, where Tctl is displayed as temp1_input.
Swap temp1_input and temp2_input on Family 17h CPUs, such that Tctl
is now reported as temp1_input and Tdie is reported as temp2_input,
to align with other CPUs, streamline the code, and make it less
confusing. Coincidentally, this also aligns the code with its
documentation, which states that Tdie is reported as temp2_input.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent c21a12d0
...@@ -180,8 +180,8 @@ static long get_raw_temp(struct k10temp_data *data) ...@@ -180,8 +180,8 @@ static long get_raw_temp(struct k10temp_data *data)
} }
const char *k10temp_temp_label[] = { const char *k10temp_temp_label[] = {
"Tdie",
"Tctl", "Tctl",
"Tdie",
"Tccd1", "Tccd1",
"Tccd2", "Tccd2",
"Tccd3", "Tccd3",
...@@ -269,13 +269,13 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel, ...@@ -269,13 +269,13 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel,
switch (attr) { switch (attr) {
case hwmon_temp_input: case hwmon_temp_input:
switch (channel) { switch (channel) {
case 0: /* Tdie */ case 0: /* Tctl */
*val = get_raw_temp(data) - data->temp_offset; *val = get_raw_temp(data);
if (*val < 0) if (*val < 0)
*val = 0; *val = 0;
break; break;
case 1: /* Tctl */ case 1: /* Tdie */
*val = get_raw_temp(data); *val = get_raw_temp(data) - data->temp_offset;
if (*val < 0) if (*val < 0)
*val = 0; *val = 0;
break; break;
...@@ -334,9 +334,9 @@ static umode_t k10temp_is_visible(const void *_data, ...@@ -334,9 +334,9 @@ static umode_t k10temp_is_visible(const void *_data,
switch (attr) { switch (attr) {
case hwmon_temp_input: case hwmon_temp_input:
switch (channel) { switch (channel) {
case 0: /* Tdie, or Tctl if we don't show it */ case 0: /* Tctl */
break; break;
case 1: /* Tctl */ case 1: /* Tdie */
if (!data->show_tdie) if (!data->show_tdie)
return 0; return 0;
break; break;
...@@ -372,8 +372,8 @@ static umode_t k10temp_is_visible(const void *_data, ...@@ -372,8 +372,8 @@ static umode_t k10temp_is_visible(const void *_data,
if (!data->show_tdie) if (!data->show_tdie)
return 0; return 0;
switch (channel) { switch (channel) {
case 0: /* Tdie */ case 0: /* Tctl */
case 1: /* Tctl */ case 1: /* Tdie */
break; break;
case 2 ... 9: /* Tccd{1-8} */ case 2 ... 9: /* Tccd{1-8} */
if (!(data->show_tccd & BIT(channel - 2))) if (!(data->show_tccd & BIT(channel - 2)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment