hwmon fixes for v5.4-rc3

Update/fix inspur-ipsps1 and k10temp Documentation
 Fix nct7904 driver
 Fix HWMON_P_MIN_ALARM mask in hwmon core
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAl2iD0IACgkQyx8mb86f
 mYEnFQ//XJMPIukj659J3hwfzxEx3LXucQsQivUhmVXYzPAzdxa9eC97tj1I3pgz
 nKR2BIFvXtI+o3459TWuvj+Y7utmQXRQ5XiP6JBb+Wkn84IK6O0GNKSOPYDNI/3t
 /ii2XY3dERr8BuBPmRuYP7GorjFJH1P7B0FXrln5HLYAyS1yJVioLVhbrbi63NkL
 ngoxZhgcVP5QIbaSFC6ZJs1oqXXVIbvBEkt9bjkmDhJssmPtFweVxvIUnWUoPdAg
 A/GvmOddhRa/9vXzZbNThOFOLq7nHguIDvbIwizULMRHfDHB5aFEqyz9W/OFqSj5
 8s+GRiO1oYBxVrz4Bl32pR0aCJbZ5WlxhgKrLdlunRnATAzXpLzRAbKhOhoBchJZ
 xyC+96q0x8GIJ5dBqm2XqZhJssZgfgb/6SSlzSu+r6aQogHQc1/PDL26PHR517E5
 T/pUNY97LvOOgiosDuaLiGpiszoz0WdeHVqdUujnRiN5TtE5u0M6ACdumXGjFb8K
 0sPkep919yaaKNaPYA6u9PCHl4WG5EJdBkY44z4BkCt9scVvXEvATGUxNMwH8Bvm
 95w/swRlN2yq+fa4T4I3UtAAW9EgCJ3LIYYUo1me0SDld2cPwbVkMvOIirD3TBLC
 qoP178X34HaqeozOaW4Hi08QYLzktmCo5KFm6KKNFbFCQZ4oBo4=
 =d+np
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2019-10-13 08:40:31 -07:00
commit 2581efa9a4
5 changed files with 47 additions and 9 deletions

View File

@ -7,6 +7,7 @@ Linux Hardware Monitoring
hwmon-kernel-api hwmon-kernel-api
pmbus-core pmbus-core
inspur-ipsps1
submitting-patches submitting-patches
sysfs-interface sysfs-interface
userspace-tools userspace-tools

View File

@ -1,5 +1,5 @@
Kernel driver inspur-ipsps1 Kernel driver inspur-ipsps1
======================= ===========================
Supported chips: Supported chips:

View File

@ -21,10 +21,17 @@ Supported chips:
* AMD Family 14h processors: "Brazos" (C/E/G/Z-Series) * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series)
* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri", "Carrizo" * AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri",
"Carrizo", "Stoney Ridge", "Bristol Ridge"
* AMD Family 16h processors: "Kabini", "Mullins" * AMD Family 16h processors: "Kabini", "Mullins"
* AMD Family 17h processors: "Zen", "Zen 2"
* AMD Family 18h processors: "Hygon Dhyana"
* AMD Family 19h processors: "Zen 3"
Prefix: 'k10temp' Prefix: 'k10temp'
Addresses scanned: PCI space Addresses scanned: PCI space
@ -110,3 +117,12 @@ The maximum value for Tctl is available in the file temp1_max.
If the BIOS has enabled hardware temperature control, the threshold at If the BIOS has enabled hardware temperature control, the threshold at
which the processor will throttle itself to avoid damage is available in which the processor will throttle itself to avoid damage is available in
temp1_crit and temp1_crit_hyst. temp1_crit and temp1_crit_hyst.
On some AMD CPUs, there is a difference between the die temperature (Tdie) and
the reported temperature (Tctl). Tdie is the real measured temperature, and
Tctl is used for fan control. While Tctl is always available as temp1_input,
the driver exports Tdie temperature as temp2_input for those CPUs which support
it.
Models from 17h family report relative temperature, the driver aims to
compensate and report the real temperature.

View File

@ -99,6 +99,8 @@ struct nct7904_data {
u8 enable_dts; u8 enable_dts;
u8 has_dts; u8 has_dts;
u8 temp_mode; /* 0: TR mode, 1: TD mode */ u8 temp_mode; /* 0: TR mode, 1: TD mode */
u8 fan_alarm[2];
u8 vsen_alarm[3];
}; };
/* Access functions */ /* Access functions */
@ -214,7 +216,15 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
SMI_STS5_REG + (channel >> 3)); SMI_STS5_REG + (channel >> 3));
if (ret < 0) if (ret < 0)
return ret; return ret;
*val = (ret >> (channel & 0x07)) & 1; if (!data->fan_alarm[channel >> 3])
data->fan_alarm[channel >> 3] = ret & 0xff;
else
/* If there is new alarm showing up */
data->fan_alarm[channel >> 3] |= (ret & 0xff);
*val = (data->fan_alarm[channel >> 3] >> (channel & 0x07)) & 1;
/* Needs to clean the alarm if alarm existing */
if (*val)
data->fan_alarm[channel >> 3] ^= 1 << (channel & 0x07);
return 0; return 0;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -298,7 +308,15 @@ static int nct7904_read_in(struct device *dev, u32 attr, int channel,
SMI_STS1_REG + (index >> 3)); SMI_STS1_REG + (index >> 3));
if (ret < 0) if (ret < 0)
return ret; return ret;
*val = (ret >> (index & 0x07)) & 1; if (!data->vsen_alarm[index >> 3])
data->vsen_alarm[index >> 3] = ret & 0xff;
else
/* If there is new alarm showing up */
data->vsen_alarm[index >> 3] |= (ret & 0xff);
*val = (data->vsen_alarm[index >> 3] >> (index & 0x07)) & 1;
/* Needs to clean the alarm if alarm existing */
if (*val)
data->vsen_alarm[index >> 3] ^= 1 << (index & 0x07);
return 0; return 0;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -915,12 +933,15 @@ static int nct7904_probe(struct i2c_client *client,
data->temp_mode = 0; data->temp_mode = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
val = (ret & (0x03 << i)) >> (i * 2); val = (ret >> (i * 2)) & 0x03;
bit = (1 << i); bit = (1 << i);
if (val == 0) if (val == 0) {
data->tcpu_mask &= ~bit; data->tcpu_mask &= ~bit;
else if (val == 0x1 || val == 0x2) } else {
data->temp_mode |= bit; if (val == 0x1 || val == 0x2)
data->temp_mode |= bit;
data->vsen_mask &= ~(0x06 << (i * 2));
}
} }
/* PECI */ /* PECI */

View File

@ -235,7 +235,7 @@ enum hwmon_power_attributes {
#define HWMON_P_LABEL BIT(hwmon_power_label) #define HWMON_P_LABEL BIT(hwmon_power_label)
#define HWMON_P_ALARM BIT(hwmon_power_alarm) #define HWMON_P_ALARM BIT(hwmon_power_alarm)
#define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
#define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm) #define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm)
#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
#define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm) #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)