linux-stable/drivers/hwmon
Guenter Roeck 625ee7d267 hwmon: (max31790) Fix pwmX_enable attributes
[ Upstream commit 148c847c9e ]

pwmX_enable supports three possible values:

0: Fan control disabled. Duty cycle is fixed to 0%
1: Fan control enabled, pwm mode. Duty cycle is determined by
   values written into Target Duty Cycle registers.
2: Fan control enabled, rpm mode
   Duty cycle is adjusted such that fan speed matches
   the values in Target Count registers

The current code does not do this; instead, it mixes pwm control
configuration with fan speed monitoring configuration. Worse, it
reports that pwm control would be disabled (pwmX_enable==0) when
it is in fact enabled in pwm mode. Part of the problem may be that
the chip sets the "TACH input enable" bit on its own whenever the
mode bit is set to RPM mode, but that doesn't mean that "TACH input
enable" accurately reflects the pwm mode.

Fix it up and only handle pwm control with the pwmX_enable attributes.
In the documentation, clarify that disabling pwm control (pwmX_enable=0)
sets the pwm duty cycle to 0%. In the code, explain why TACH_INPUT_EN
is set together with RPM_MODE.

While at it, only update the configuration register if the configuration
has changed, and only update the cached configuration if updating the
chip configuration was successful.

Cc: Jan Kundrát <jan.kundrat@cesnet.cz>
Cc: Václav Kubernát <kubernat@cesnet.cz>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Václav Kubernát <kubernat@cesnet.cz>
Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Link: https://lore.kernel.org/r/20210526154022.3223012-4-linux@roeck-us.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-14 16:55:55 +02:00
..
occ hwmon: (occ) Fix poll rate limiting 2021-05-19 10:13:13 +02:00
pmbus hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_3 for RAA228228 2021-06-10 13:39:13 +02:00
ab8500.c hwmon: ab8500: Convert to IIO ADC 2019-10-18 19:37:08 +01:00
abituguru.c hwmon: abituguru: make array probe_order static, makes object smaller 2019-11-06 14:37:19 -08:00
abituguru3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
abx500.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 197 2019-05-30 11:29:22 -07:00
abx500.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 197 2019-05-30 11:29:22 -07:00
acpi_power_meter.c hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add() 2020-06-25 16:06:06 -07:00
ad7314.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
ad7414.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ad7418.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adc128d818.c hwmon: use simple i2c probe function (take 2) 2020-09-23 09:42:40 -07:00
adcxx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
adm1021.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adm1025.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adm1026.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adm1029.c hwmon: (adm1029) use simple i2c probe 2020-09-23 09:42:39 -07:00
adm1031.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adm1177.c hwmon: (adm1177) use simple i2c probe 2020-09-23 09:42:39 -07:00
adm9240.c hwmon: (adm9240) Convert to regmap 2020-09-24 07:44:51 -07:00
ads7828.c hwmon: use simple i2c probe function (take 2) 2020-09-23 09:42:40 -07:00
ads7871.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 51 2019-05-24 17:36:42 +02:00
adt7x10.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
adt7x10.h
adt7310.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
adt7410.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adt7411.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adt7462.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adt7470.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
adt7475.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
amc6821.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
amd_energy.c hwmon: (amd_energy) fix allocation of hwmon_channel_info config 2021-01-12 20:18:22 +01:00
applesmc.c hwmon: (applesmc) Re-work SMC comms 2020-11-12 07:00:59 -08:00
as370-hwmon.c hwmon: (as370-hwmon) fix devm_platform_ioremap_resource.cocci warnings 2019-09-03 12:47:17 -07:00
asb100.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
asc7621.c hwmon: (asc7621) use simple i2c probe 2020-09-23 09:42:40 -07:00
aspeed-pwm-tacho.c hwmon: (aspeed-pwm-tacho) Avoid possible buffer overflow 2020-07-05 20:45:45 -07:00
asus_atk0110.c hwmon: (asus_atk0110) no need to check return value of debugfs_create functions 2019-06-23 18:33:01 -07:00
atxp1.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
axi-fan-control.c hwmon: (axi-fan-control) remove duplicate macros 2020-08-04 14:27:20 -07:00
bt1-pvt.c hwmon: (bt1-pvt) Wait for the completion with timeout 2020-10-04 08:40:10 -07:00
bt1-pvt.h hwmon: (bt1-pvt) Cache current update timeout 2020-10-04 08:40:10 -07:00
coretemp.c hwmon: Convert to new X86 CPU match macros 2020-03-24 21:33:36 +01:00
corsair-cpro.c hwmon: (corsair-cpro) add reading pwm values 2020-07-24 07:44:57 -07:00
da9052-hwmon.c hwmon: (da9052) Synchronize access with mfd 2020-05-13 10:06:09 -07:00
da9055-hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
dell-smm-hwmon.c hwmon: (dell-smm-hwmon) Fix index values 2021-06-10 13:39:13 +02:00
dme1737.c hwmon: (dme1737) use simple i2c probe 2020-09-23 09:42:40 -07:00
drivetemp.c hwmon: (drivetemp) Avoid SCT usage on Toshiba DT01ACA family drives 2020-07-18 08:11:44 -07:00
ds620.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ds1621.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
emc6w201.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
emc1403.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
emc2103.c hwmon: (emc2103) use simple i2c probe 2020-09-23 09:42:40 -07:00
f71805f.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
f71882fg.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
f75375s.c hwmon: (f75375s) use simple i2c probe 2020-09-23 09:42:40 -07:00
fam15h_power.c x86/msr: Lift AMD family 0x15 power-specific MSRs 2020-06-15 19:25:53 +02:00
fschmd.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ftsteutates.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
g760a.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
g762.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
gl518sm.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
gl520sm.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
gpio-fan.c hwmon: (gpio-fan) fix sysfs notifications and udev events for gpio-fan alarms 2019-07-08 18:11:32 -07:00
gsc-hwmon.c hwmon: (gsc-hwmon) add fan sensor 2020-09-23 09:42:41 -07:00
hih6130.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
hwmon-vid.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hwmon.c hwmon: (core) Add support for rated attributes 2020-09-23 09:42:39 -07:00
i5k_amb.c hwmon: (i5k_amb, vt8231) Drop uses of pci_read_config_*() return value 2020-08-04 14:24:39 -07:00
i5500_temp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
ibmaem.c hwmon: (ibmaem) Replace zero-length array with flexible-array member 2020-03-08 20:35:46 -07:00
ibmpex.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ibmpowernv.c hwmon: (ibmpowernv) Use scnprintf() for avoiding potential buffer overflow 2020-03-11 08:09:31 -07:00
iio_hwmon.c hwmon: (iio_hwmon) Enable power exporting from IIO 2019-09-03 12:47:17 -07:00
ina2xx.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ina209.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ina3221.c hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable 2020-12-30 11:53:31 +01:00
intel-m10-bmc-hwmon.c hwmon: Add hwmon driver for Intel MAX 10 BMC 2020-10-04 08:40:10 -07:00
it87.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
jc42.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
k8temp.c hwmon: (k8temp) update to use new hwmon registration API 2019-09-03 12:47:17 -07:00
k10temp.c hwmon: (k10temp) Remove support for displaying voltage and current on Zen CPUs 2020-12-30 11:52:55 +01:00
Kconfig - New Drivers 2020-10-14 15:56:58 -07:00
lineage-pem.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm63.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm70.c hwmon: (lm70) Add support for ACPI 2020-05-22 06:28:38 -07:00
lm73.c hwmon: (lm73) use simple i2c probe 2020-09-23 09:42:40 -07:00
lm75.c hwmon: (lm75) Add regulator support 2020-10-04 08:40:10 -07:00
lm75.h hwmon: (lm75) Fix all coding-style warnings on lm75 driver 2020-05-22 06:28:38 -07:00
lm77.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm78.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm80.c Revert "hwmon: (lm80) fix a missing check of bus read in lm80 probe" 2021-05-26 12:06:54 +02:00
lm83.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm85.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm87.c hwmon: use simple i2c probe function (take 2) 2020-09-23 09:42:40 -07:00
lm90.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm92.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm93.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm95234.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm95241.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lm95245.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
lochnagar-hwmon.c
ltc2945.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc2947-core.c hwmon: Add support for ltc2947 2019-11-06 14:37:19 -08:00
ltc2947-i2c.c hwmon: (ltc2947) use simple i2c probe 2020-09-23 09:42:40 -07:00
ltc2947-spi.c hwmon: Add support for ltc2947 2019-11-06 14:37:19 -08:00
ltc2947.h hwmon: Add support for ltc2947 2019-11-06 14:37:19 -08:00
ltc2990.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc4151.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc4215.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc4222.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc4245.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc4260.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltc4261.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
ltq-cputemp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
Makefile - New Drivers 2020-10-14 15:56:58 -07:00
max197.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
max1111.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 332 2019-06-05 17:37:06 +02:00
max1619.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max1668.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max6621.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max6639.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max6642.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max6650.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max6697.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max16065.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max31722.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
max31730.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
max31790.c hwmon: (max31790) Fix pwmX_enable attributes 2021-07-14 16:55:55 +02:00
mc13783-adc.c
mcp3021.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
menf21bmc_hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mlxreg-fan.c
mr75203.c hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller 2020-10-06 14:51:18 -07:00
nct6683.c hwmon: (nct6683) Replace container_of() with kobj_to_dev() 2020-07-19 16:25:20 -07:00
nct6775.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
nct7802.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
nct7904.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
npcm750-pwm-fan.c hwmon: (npcm750-pwm-fan) Remove dev_err() usage after platform_get_irq() 2019-09-03 12:47:17 -07:00
nsa320-hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 408 2019-06-05 17:37:14 +02:00
ntc_thermistor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
pc87360.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
pc87427.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pcf8591.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
powr1220.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
pwm-fan.c hwmon: (pwm-fan) Ensure that calculation doesn't discard big period values 2021-01-19 18:27:25 +01:00
raspberrypi-hwmon.c hwmon: (raspberrypi) update MODULE_AUTHOR() email address 2019-09-03 12:47:17 -07:00
s3c-hwmon.c ARM: s3c: adc: move header to linux/soc/samsung 2020-08-19 21:44:11 +02:00
sch56xx-common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sch56xx-common.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sch5627.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sch5636.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
scmi-hwmon.c hwmon: (scmi-hwmon) Avoid comma separated statements 2020-09-23 09:42:41 -07:00
scpi-hwmon.c hwmon: (scpi-hwmon) shows the negative temperature properly 2021-06-23 14:42:49 +02:00
sht3x.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
sht15.c
sht21.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
shtc1.c hwmon: shtc1: add support for device tree bindings 2020-09-23 09:42:40 -07:00
sis5595.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
sl28cpld-hwmon.c hwmon: Add support for the sl28cpld hardware monitoring controller 2020-09-17 16:02:42 +01:00
smm665.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
smsc47b397.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
smsc47m1.c hwmon: (smsc47m1) fix (suspicious) outside array bounds warnings 2019-06-23 18:33:01 -07:00
smsc47m192.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
sparx5-temp.c hwmon: (sparx5) Fix initial reading of temperature 2020-09-23 09:39:40 -07:00
stts751.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tc74.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tc654.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
thmc50.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tmp102.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tmp103.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tmp108.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tmp401.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tmp421.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
tmp513.c hwmon: (tmp513) fix spelling typo in comments 2020-10-04 08:40:10 -07:00
ultra45_env.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
vexpress-hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
via-cputemp.c hwmon: Convert to new X86 CPU match macros 2020-03-24 21:33:36 +01:00
via686a.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
vt1211.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
vt8231.c hwmon: (i5k_amb, vt8231) Drop uses of pci_read_config_*() return value 2020-08-04 14:24:39 -07:00
w83l785ts.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
w83l786ng.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
w83627ehf.c hwmon: (w83627ehf) Fix a resource leak in probe 2020-09-23 09:40:33 -07:00
w83627hf.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
w83773g.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
w83781d.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
w83791d.c hwmon: (w83791d) use simple i2c probe 2020-09-23 09:42:40 -07:00
w83792d.c hwmon: use simple i2c probe function 2020-09-23 09:42:39 -07:00
w83793.c hwmon: (w83793) use simple i2c probe 2020-09-23 09:42:39 -07:00
w83795.c hwmon: use simple i2c probe function (take 2) 2020-09-23 09:42:40 -07:00
wm831x-hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 271 2019-06-05 17:30:30 +02:00
wm8350-hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 271 2019-06-05 17:30:30 +02:00
xgene-hwmon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00