Skip to content

Commit 2581efa

Browse files
committed
Merge tag 'hwmon-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - Update/fix inspur-ipsps1 and k10temp Documentation - Fix nct7904 driver - Fix HWMON_P_MIN_ALARM mask in hwmon core * tag 'hwmon-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: docs: Extend inspur-ipsps1 title underline hwmon: (nct7904) Add array fan_alarm and vsen_alarm to store the alarms in nct7904_data struct. docs: hwmon: Include 'inspur-ipsps1.rst' into docs hwmon: Fix HWMON_P_MIN_ALARM mask hwmon: (k10temp) Update documentation and add temp2_input info hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct
2 parents 71b1b55 + 11c943a commit 2581efa

File tree

5 files changed

+47
-9
lines changed

5 files changed

+47
-9
lines changed

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Linux Hardware Monitoring
77

88
hwmon-kernel-api
99
pmbus-core
10+
inspur-ipsps1
1011
submitting-patches
1112
sysfs-interface
1213
userspace-tools

Documentation/hwmon/inspur-ipsps1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Kernel driver inspur-ipsps1
2-
=======================
2+
===========================
33

44
Supported chips:
55

Documentation/hwmon/k10temp.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ Supported chips:
2121

2222
* AMD Family 14h processors: "Brazos" (C/E/G/Z-Series)
2323

24-
* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri", "Carrizo"
24+
* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri",
25+
"Carrizo", "Stoney Ridge", "Bristol Ridge"
2526

2627
* AMD Family 16h processors: "Kabini", "Mullins"
2728

29+
* AMD Family 17h processors: "Zen", "Zen 2"
30+
31+
* AMD Family 18h processors: "Hygon Dhyana"
32+
33+
* AMD Family 19h processors: "Zen 3"
34+
2835
Prefix: 'k10temp'
2936

3037
Addresses scanned: PCI space
@@ -110,3 +117,12 @@ The maximum value for Tctl is available in the file temp1_max.
110117
If the BIOS has enabled hardware temperature control, the threshold at
111118
which the processor will throttle itself to avoid damage is available in
112119
temp1_crit and temp1_crit_hyst.
120+
121+
On some AMD CPUs, there is a difference between the die temperature (Tdie) and
122+
the reported temperature (Tctl). Tdie is the real measured temperature, and
123+
Tctl is used for fan control. While Tctl is always available as temp1_input,
124+
the driver exports Tdie temperature as temp2_input for those CPUs which support
125+
it.
126+
127+
Models from 17h family report relative temperature, the driver aims to
128+
compensate and report the real temperature.

drivers/hwmon/nct7904.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ struct nct7904_data {
9999
u8 enable_dts;
100100
u8 has_dts;
101101
u8 temp_mode; /* 0: TR mode, 1: TD mode */
102+
u8 fan_alarm[2];
103+
u8 vsen_alarm[3];
102104
};
103105

104106
/* Access functions */
@@ -214,7 +216,15 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
214216
SMI_STS5_REG + (channel >> 3));
215217
if (ret < 0)
216218
return ret;
217-
*val = (ret >> (channel & 0x07)) & 1;
219+
if (!data->fan_alarm[channel >> 3])
220+
data->fan_alarm[channel >> 3] = ret & 0xff;
221+
else
222+
/* If there is new alarm showing up */
223+
data->fan_alarm[channel >> 3] |= (ret & 0xff);
224+
*val = (data->fan_alarm[channel >> 3] >> (channel & 0x07)) & 1;
225+
/* Needs to clean the alarm if alarm existing */
226+
if (*val)
227+
data->fan_alarm[channel >> 3] ^= 1 << (channel & 0x07);
218228
return 0;
219229
default:
220230
return -EOPNOTSUPP;
@@ -298,7 +308,15 @@ static int nct7904_read_in(struct device *dev, u32 attr, int channel,
298308
SMI_STS1_REG + (index >> 3));
299309
if (ret < 0)
300310
return ret;
301-
*val = (ret >> (index & 0x07)) & 1;
311+
if (!data->vsen_alarm[index >> 3])
312+
data->vsen_alarm[index >> 3] = ret & 0xff;
313+
else
314+
/* If there is new alarm showing up */
315+
data->vsen_alarm[index >> 3] |= (ret & 0xff);
316+
*val = (data->vsen_alarm[index >> 3] >> (index & 0x07)) & 1;
317+
/* Needs to clean the alarm if alarm existing */
318+
if (*val)
319+
data->vsen_alarm[index >> 3] ^= 1 << (index & 0x07);
302320
return 0;
303321
default:
304322
return -EOPNOTSUPP;
@@ -915,12 +933,15 @@ static int nct7904_probe(struct i2c_client *client,
915933

916934
data->temp_mode = 0;
917935
for (i = 0; i < 4; i++) {
918-
val = (ret & (0x03 << i)) >> (i * 2);
936+
val = (ret >> (i * 2)) & 0x03;
919937
bit = (1 << i);
920-
if (val == 0)
938+
if (val == 0) {
921939
data->tcpu_mask &= ~bit;
922-
else if (val == 0x1 || val == 0x2)
923-
data->temp_mode |= bit;
940+
} else {
941+
if (val == 0x1 || val == 0x2)
942+
data->temp_mode |= bit;
943+
data->vsen_mask &= ~(0x06 << (i * 2));
944+
}
924945
}
925946

926947
/* PECI */

include/linux/hwmon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ enum hwmon_power_attributes {
235235
#define HWMON_P_LABEL BIT(hwmon_power_label)
236236
#define HWMON_P_ALARM BIT(hwmon_power_alarm)
237237
#define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
238-
#define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm)
238+
#define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm)
239239
#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
240240
#define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
241241
#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)

0 commit comments

Comments
 (0)