summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-12-04 12:19:49 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2025-12-04 12:19:49 -0800
commit02892f90a9851f508e557b3c75e93fc178310d5f (patch)
treedce4a63d452b76b565919aef70e8edb401bd8f43 /drivers/hwmon
parentfca5327eaa8117b18c8faf79154d6eafecaf4892 (diff)
parent30ca0e049f507001c6377e28482a636689351f64 (diff)
downloadlinux-02892f90a9851f508e557b3c75e93fc178310d5f.tar.gz
linux-02892f90a9851f508e557b3c75e93fc178310d5f.tar.bz2
linux-02892f90a9851f508e557b3c75e93fc178310d5f.zip
Merge tag 'hwmon-for-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck: "New drivers: - Apple Silicon SMC - TSC1641 I2C power monitor - MPS MP9945 - MAX17616 - MP2925 and MP2929 Added support for new devices to existing drivers: - dell-smm: Add Dell G5 5505 to fan control whitelist - aspeed-g6-pwm-tach: Support for AST2700 - asus-ec-sensors: Support for ROG STRIX X470-I GAMING, ROG STRIX X870-F GAMING WIFI, ROG STRIX X870E-H GAMING WIFI7, and Pro WS TRX50-SAGE WIFI - k10temp: Support for AMD Steam Deck APU ID - pmbus/isl68137: Support for raa229141 - aht10: Support for dht20 - adt7410: Support for ADT7422 - peci: Support for Intel Emerald Rapids - nct6775: Support for ASUS ROG STRIX X870E-H GAMING WIFI7 - pmbus/max34440: Support for ADPM12200 - ntc-thermistor: Support for Murata ncp18wm474 Infrastructure updates: - Utilize subsystem locking in various drivers - ltc4282, ltc2947: Use the new energy64 attribute Bug fixes: - Various drivers: Fixes to avoid TOCTOU, mostly in macro functions evaluating parameters multiple times, as well as missing locks - max6697: Fix regmap leak on probe failure - sy7636a: Fix regulator_enable resource leak on error path - asus-ec-sensors: Correct Pro WS TRX50-SAGE WIFI entry Other changes and improvements: - w83781d, lm78: Drop REALLY_SLOW_IO - Fix broken datasheet links in various drivers And various other minor fixes and improvements" * tag 'hwmon-for-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (110 commits) hwmon: (dell-smm) Add Dell G5 5505 to fan control whitelist hwmon: (max16065) Use local variable to avoid TOCTOU hwmon: (w83l786ng) Convert macros to functions to avoid TOCTOU hwmon: (max6697) fix regmap leak on probe failure hwmon/w83781d: Drop REALLY_SLOW_IO setting hwmon/lm78: Drop REALLY_SLOW_IO setting hwmon: sy7636a: Fix regulator_enable resource leak on error path hwmon: (adm1026) Convert macros to functions to avoid TOCTOU hwmon: (adm1029) Add locking to avoid TOCTOU hwmon: (lm87) Convert macros to functions to avoid TOCTOU hwmon: (asus-ec-sensors) correct Pro WS TRX50-SAGE WIFI entry hwmon: (vt8231) Convert macros to functions to avoid TOCTOU hwmon: (emc2103) Add locking to avoid TOCTOU hwmon: (aspeed-g6-pwm-tach): Add AST2700 compatible string dt-bindings: hwmon: Add AST2700 compatible hwmon: (asus-ec-sensors) add ROG STRIX X470-I GAMING hwmon: (vt1211) Convert macros to functions to avoid TOCTOU hwmon: (k10temp) Add AMD Steam Deck APU ID hwmon: Add Apple Silicon SMC hwmon driver Documentation/hwmon: Fix broken datasheet links for zl6100 ...
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/Kconfig36
-rw-r--r--drivers/hwmon/Makefile2
-rw-r--r--drivers/hwmon/adm1026.c16
-rw-r--r--drivers/hwmon/adm1029.c3
-rw-r--r--drivers/hwmon/adm9240.c17
-rw-r--r--drivers/hwmon/adt7410.c11
-rw-r--r--drivers/hwmon/adt7411.c59
-rw-r--r--drivers/hwmon/adt7x10.c27
-rw-r--r--drivers/hwmon/aht10.c43
-rw-r--r--drivers/hwmon/aquacomputer_d5next.c37
-rw-r--r--drivers/hwmon/aspeed-g6-pwm-tach.c3
-rw-r--r--drivers/hwmon/asus-ec-sensors.c67
-rw-r--r--drivers/hwmon/asus_rog_ryujin.c48
-rw-r--r--drivers/hwmon/chipcap2.c7
-rw-r--r--drivers/hwmon/corsair-cpro.c8
-rw-r--r--drivers/hwmon/corsair-psu.c13
-rw-r--r--drivers/hwmon/dell-smm-hwmon.c9
-rw-r--r--drivers/hwmon/drivetemp.c5
-rw-r--r--drivers/hwmon/emc1403.c46
-rw-r--r--drivers/hwmon/emc2103.c4
-rw-r--r--drivers/hwmon/ftsteutates.c84
-rw-r--r--drivers/hwmon/gpd-fan.c56
-rw-r--r--drivers/hwmon/hs3001.c10
-rw-r--r--drivers/hwmon/i5500_temp.c3
-rw-r--r--drivers/hwmon/ina238.c26
-rw-r--r--drivers/hwmon/ina2xx.c28
-rw-r--r--drivers/hwmon/ina3221.c19
-rw-r--r--drivers/hwmon/jc42.c11
-rw-r--r--drivers/hwmon/k10temp.c12
-rw-r--r--drivers/hwmon/lm78.c5
-rw-r--r--drivers/hwmon/lm87.c16
-rw-r--r--drivers/hwmon/lm90.c25
-rw-r--r--drivers/hwmon/lm92.c11
-rw-r--r--drivers/hwmon/lm95234.c12
-rw-r--r--drivers/hwmon/lm95241.c16
-rw-r--r--drivers/hwmon/lm95245.c16
-rw-r--r--drivers/hwmon/lochnagar-hwmon.c18
-rw-r--r--drivers/hwmon/ltc2947-core.c92
-rw-r--r--drivers/hwmon/ltc4245.c8
-rw-r--r--drivers/hwmon/ltc4282.c68
-rw-r--r--drivers/hwmon/macsmc-hwmon.c851
-rw-r--r--drivers/hwmon/max127.c23
-rw-r--r--drivers/hwmon/max16065.c7
-rw-r--r--drivers/hwmon/max31790.c48
-rw-r--r--drivers/hwmon/max31827.c60
-rw-r--r--drivers/hwmon/max6620.c43
-rw-r--r--drivers/hwmon/max6639.c23
-rw-r--r--drivers/hwmon/max6697.c11
-rw-r--r--drivers/hwmon/mr75203.c1
-rw-r--r--drivers/hwmon/nct6775-platform.c1
-rw-r--r--drivers/hwmon/nct7363.c2
-rw-r--r--drivers/hwmon/nct7904.c63
-rw-r--r--drivers/hwmon/npcm750-pwm-fan.c11
-rw-r--r--drivers/hwmon/ntc_thermistor.c43
-rw-r--r--drivers/hwmon/peci/common.h3
-rw-r--r--drivers/hwmon/peci/cputemp.c90
-rw-r--r--drivers/hwmon/peci/dimmtemp.c36
-rw-r--r--drivers/hwmon/pmbus/Kconfig28
-rw-r--r--drivers/hwmon/pmbus/Makefile3
-rw-r--r--drivers/hwmon/pmbus/isl68137.c14
-rw-r--r--drivers/hwmon/pmbus/max17616.c73
-rw-r--r--drivers/hwmon/pmbus/max34440.c44
-rw-r--r--drivers/hwmon/pmbus/mp2925.c316
-rw-r--r--drivers/hwmon/pmbus/mp9945.c243
-rw-r--r--drivers/hwmon/powr1220.c17
-rw-r--r--drivers/hwmon/sbtsi_temp.c17
-rw-r--r--drivers/hwmon/scmi-hwmon.c9
-rw-r--r--drivers/hwmon/sfctemp.c36
-rw-r--r--drivers/hwmon/sht4x.c40
-rw-r--r--drivers/hwmon/sy7636a-hwmon.c7
-rw-r--r--drivers/hwmon/tmp102.c2
-rw-r--r--drivers/hwmon/tmp103.c3
-rw-r--r--drivers/hwmon/tmp108.c1
-rw-r--r--drivers/hwmon/tmp401.c8
-rw-r--r--drivers/hwmon/tmp421.c28
-rw-r--r--drivers/hwmon/tmp464.c13
-rw-r--r--drivers/hwmon/tsc1641.c748
-rw-r--r--drivers/hwmon/vt1211.c53
-rw-r--r--drivers/hwmon/vt8231.c18
-rw-r--r--drivers/hwmon/w83781d.c5
-rw-r--r--drivers/hwmon/w83l786ng.c26
81 files changed, 2953 insertions, 1112 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 2760feb9f83b..157678b821fc 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -175,7 +175,7 @@ config SENSORS_ADT7X10
select REGMAP
help
This module contains common code shared by the ADT7310/ADT7320 and
- ADT7410/ADT7420 temperature monitoring chip drivers.
+ ADT7410/ADT7420/ADT7422 temperature monitoring chip drivers.
If built as a module, the module will be called adt7x10.
@@ -191,12 +191,12 @@ config SENSORS_ADT7310
will be called adt7310.
config SENSORS_ADT7410
- tristate "Analog Devices ADT7410/ADT7420"
+ tristate "Analog Devices ADT7410/ADT7420/ADT7422"
depends on I2C
select SENSORS_ADT7X10
help
If you say yes here you get support for the Analog Devices
- ADT7410 and ADT7420 temperature monitoring chips.
+ ADT7410, ADT7420 and ADT7422 temperature monitoring chips.
This driver can also be built as a module. If so, the module
will be called adt7410.
@@ -245,12 +245,12 @@ config SENSORS_ADT7475
will be called adt7475.
config SENSORS_AHT10
- tristate "Aosong AHT10, AHT20"
+ tristate "Aosong AHT10, AHT20, DHT20"
depends on I2C
select CRC8
help
- If you say yes here, you get support for the Aosong AHT10 and AHT20
- temperature and humidity sensors
+ If you say yes here, you get support for the Aosong AHT10, AHT20 and
+ DHT20 temperature and humidity sensors
This driver can also be built as a module. If so, the module
will be called aht10.
@@ -1174,6 +1174,18 @@ config SENSORS_LTQ_CPUTEMP
If you say yes here you get support for the temperature
sensor inside your CPU.
+config SENSORS_MACSMC_HWMON
+ tristate "Apple SMC (Apple Silicon)"
+ depends on MFD_MACSMC && OF
+ help
+ This driver enables hwmon support for current, power, temperature,
+ and voltage sensors, as well as fan speed reporting and control
+ on Apple Silicon devices. Say Y here if you have an Apple Silicon
+ device.
+
+ This driver can also be built as a module. If so, the module will
+ be called macsmc-hwmon.
+
config SENSORS_MAX1111
tristate "Maxim MAX1111 Serial 8-bit ADC chip and compatibles"
depends on SPI_MASTER
@@ -2434,6 +2446,18 @@ config SENSORS_TMP513
This driver can also be built as a module. If so, the module
will be called tmp513.
+config SENSORS_TSC1641
+ tristate "ST Microelectronics TSC1641 Power Monitor"
+ depends on I2C
+ select REGMAP_I2C
+ help
+ If you say yes here you get support for TSC1641 power monitor chip.
+ The TSC1641 driver is configured for the default configuration of
+ the part except temperature is enabled by default.
+
+ This driver can also be built as a module. If so, the module
+ will be called tsc1641.
+
config SENSORS_VEXPRESS
tristate "Versatile Express"
depends on VEXPRESS_CONFIG
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 73b2abdcc6dd..eade8e3b1bde 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -148,6 +148,7 @@ obj-$(CONFIG_SENSORS_LTC4260) += ltc4260.o
obj-$(CONFIG_SENSORS_LTC4261) += ltc4261.o
obj-$(CONFIG_SENSORS_LTC4282) += ltc4282.o
obj-$(CONFIG_SENSORS_LTQ_CPUTEMP) += ltq-cputemp.o
+obj-$(CONFIG_SENSORS_MACSMC_HWMON) += macsmc-hwmon.o
obj-$(CONFIG_SENSORS_MAX1111) += max1111.o
obj-$(CONFIG_SENSORS_MAX127) += max127.o
obj-$(CONFIG_SENSORS_MAX16065) += max16065.o
@@ -233,6 +234,7 @@ obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
obj-$(CONFIG_SENSORS_TMP464) += tmp464.o
obj-$(CONFIG_SENSORS_TMP513) += tmp513.o
+obj-$(CONFIG_SENSORS_TSC1641) += tsc1641.o
obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress-hwmon.o
obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 80d09b017d3b..c38c932e5d2a 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -197,8 +197,16 @@ static int adm1026_scaling[] = { /* .001 Volts */
#define FAN_TO_REG(val, div) ((val) <= 0 ? 0xff : \
clamp_val(1350000 / ((val) * (div)), \
1, 254))
-#define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : (val) == 0xff ? 0 : \
- 1350000 / ((val) * (div)))
+
+static int fan_from_reg(int val, int div)
+{
+ if (val == 0)
+ return -1;
+ if (val == 0xff)
+ return 0;
+ return 1350000 / (val * div);
+}
+
#define DIV_FROM_REG(val) (1 << (val))
#define DIV_TO_REG(val) ((val) >= 8 ? 3 : (val) >= 4 ? 2 : (val) >= 2 ? 1 : 0)
@@ -656,7 +664,7 @@ static ssize_t fan_show(struct device *dev, struct device_attribute *attr,
struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
int nr = sensor_attr->index;
struct adm1026_data *data = adm1026_update_device(dev);
- return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr],
+ return sprintf(buf, "%d\n", fan_from_reg(data->fan[nr],
data->fan_div[nr]));
}
static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr,
@@ -665,7 +673,7 @@ static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr,
struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
int nr = sensor_attr->index;
struct adm1026_data *data = adm1026_update_device(dev);
- return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr],
+ return sprintf(buf, "%d\n", fan_from_reg(data->fan_min[nr],
data->fan_div[nr]));
}
static ssize_t fan_min_store(struct device *dev,
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 761c13092488..71eea8ae51b9 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -171,14 +171,17 @@ fan_show(struct device *dev, struct device_attribute *devattr, char *buf)
struct adm1029_data *data = adm1029_update_device(dev);
u16 val;
+ mutex_lock(&data->update_lock);
if (data->fan[attr->index] == 0 ||
(data->fan_div[attr->index] & 0xC0) == 0 ||
data->fan[attr->index] == 255) {
+ mutex_unlock(&data->update_lock);
return sprintf(buf, "0\n");
}
val = 1880 * 120 / DIV_FROM_REG(data->fan_div[attr->index])
/ data->fan[attr->index];
+ mutex_unlock(&data->update_lock);
return sprintf(buf, "%d\n", val);
}
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 6dfbeb6acf00..86f6044b5bd0 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -37,7 +37,6 @@
#include <linux/hwmon.h>
#include <linux/hwmon-vid.h>
#include <linux/err.h>
-#include <linux/mutex.h>
#include <linux/regmap.h>
/* Addresses to scan */
@@ -125,7 +124,6 @@ static inline unsigned int AOUT_FROM_REG(u8 reg)
struct adm9240_data {
struct device *dev;
struct regmap *regmap;
- struct mutex update_lock;
u8 fan_div[2]; /* rw fan1_div, read-only accessor */
u8 vrm; /* -- vrm set on startup, no accessor */
@@ -170,8 +168,6 @@ static int adm9240_fan_min_write(struct adm9240_data *data, int channel, long va
u8 fan_min;
int err;
- mutex_lock(&data->update_lock);
-
if (!val) {
fan_min = 255;
new_div = data->fan_div[channel];
@@ -206,8 +202,6 @@ static int adm9240_fan_min_write(struct adm9240_data *data, int channel, long va
}
err = regmap_write(data->regmap, ADM9240_REG_FAN_MIN(channel), fan_min);
- mutex_unlock(&data->update_lock);
-
return err;
}
@@ -501,23 +495,17 @@ static int adm9240_fan_read(struct device *dev, u32 attr, int channel, long *val
switch (attr) {
case hwmon_fan_input:
- mutex_lock(&data->update_lock);
err = regmap_read(data->regmap, ADM9240_REG_FAN(channel), &regval);
- if (err < 0) {
- mutex_unlock(&data->update_lock);
+ if (err < 0)
return err;
- }
if (regval == 255 && data->fan_div[channel] < 3) {
/* adjust fan clock divider on overflow */
err = adm9240_write_fan_div(data, channel,
++data->fan_div[channel]);
- if (err) {
- mutex_unlock(&data->update_lock);
+ if (err)
return err;
- }
}
*val = FAN_FROM_REG(regval, BIT(data->fan_div[channel]));
- mutex_unlock(&data->update_lock);
break;
case hwmon_fan_div:
*val = BIT(data->fan_div[channel]);
@@ -791,7 +779,6 @@ static int adm9240_probe(struct i2c_client *client)
return -ENOMEM;
data->dev = dev;
- mutex_init(&data->update_lock);
data->regmap = devm_regmap_init_i2c(client, &adm9240_regmap_config);
if (IS_ERR(data->regmap))
return PTR_ERR(data->regmap);
diff --git a/drivers/hwmon/adt7410.c b/drivers/hwmon/adt7410.c
index 3bf0e0a0882c..73b196a78f3a 100644
--- a/drivers/hwmon/adt7410.c
+++ b/drivers/hwmon/adt7410.c
@@ -7,6 +7,7 @@
*/
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
@@ -90,14 +91,24 @@ static int adt7410_i2c_probe(struct i2c_client *client)
static const struct i2c_device_id adt7410_ids[] = {
{ "adt7410" },
{ "adt7420" },
+ { "adt7422" },
{}
};
MODULE_DEVICE_TABLE(i2c, adt7410_ids);
+static const struct of_device_id adt7410_of_match[] = {
+ { .compatible = "adi,adt7410" },
+ { .compatible = "adi,adt7420" },
+ { .compatible = "adi,adt7422" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, adt7410_of_match);
+
static struct i2c_driver adt7410_driver = {
.driver = {
.name = "adt7410",
.pm = pm_sleep_ptr(&adt7x10_dev_pm_ops),
+ .of_match_table = adt7410_of_match,
},
.probe = adt7410_i2c_probe,
.id_table = adt7410_ids,
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
index 08d0effd97f7..b9991a69e6c6 100644
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -11,7 +11,6 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
-#include <linux/mutex.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
@@ -99,8 +98,6 @@ static const u8 adt7411_in_alarm_bits[] = {
};
struct adt7411_data {
- struct mutex device_lock; /* for "atomic" device accesses */
- struct mutex update_lock;
unsigned long next_update;
long vref_cached;
struct i2c_client *client;
@@ -110,55 +107,41 @@ struct adt7411_data {
/*
* When reading a register containing (up to 4) lsb, all associated
* msb-registers get locked by the hardware. After _one_ of those msb is read,
- * _all_ are unlocked. In order to use this locking correctly, reading lsb/msb
- * is protected here with a mutex, too.
+ * _all_ are unlocked.
*/
static int adt7411_read_10_bit(struct i2c_client *client, u8 lsb_reg,
- u8 msb_reg, u8 lsb_shift)
+ u8 msb_reg, u8 lsb_shift)
{
- struct adt7411_data *data = i2c_get_clientdata(client);
int val, tmp;
- mutex_lock(&data->device_lock);
-
val = i2c_smbus_read_byte_data(client, lsb_reg);
if (val < 0)
- goto exit_unlock;
+ return val;
tmp = (val >> lsb_shift) & 3;
val = i2c_smbus_read_byte_data(client, msb_reg);
+ if (val < 0)
+ return val;
- if (val >= 0)
- val = (val << 2)