Patrick Rudolph [Mon, 2 Sep 2024 07:53:13 +0000 (09:53 +0200)]
hwmon: pmbus: max15301: Use generic code
Use the generic pmbus bus access delay.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Message-ID: <
20240902075319.585656-2-patrick.rudolph@9elements.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Patrick Rudolph [Mon, 2 Sep 2024 07:53:12 +0000 (09:53 +0200)]
hwmon: pmbus: Implement generic bus access delay
Some drivers, like the max15301 or zl6100, are intentionally delaying
SMBus communications, to prevent transmission errors. As this is necessary
on additional PMBus compatible devices, implement a generic delay mechanism
in the pmbus core.
Introduces two delay settings in the pmbus_driver_info struct, one applies
to every SMBus transaction and the other is for write transaction only.
Once set by the driver the SMBus traffic, using the generic pmbus access
helpers, is automatically delayed when necessary.
The two settings are:
access_delay:
- Unit in microseconds
- Stores the accessed timestamp after every SMBus access
- Delays when necessary before the next SMBus access
write_delay:
- Unit in microseconds
- Stores the written timestamp after a write SMBus access
- Delays when necessary before the next SMBus access
This allows to drop the custom delay code from the drivers and easily
introduce this feature in additional pmbus drivers.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Message-ID: <
20240902075319.585656-1-patrick.rudolph@9elements.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 29 Aug 2024 00:21:41 +0000 (17:21 -0700)]
hwmon: (ina2xx) Use shunt voltage to calculate current
Since the shunt voltage and the current register report the same values
when the chip is calibrated, we can calculate the current directly
from the shunt voltage without relying on chip calibration.
With this change, the current register is no longer accessed. Its
register address is only used to indicate if reading or writing
current or shunt voltage is desired when accessing registers.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 28 Aug 2024 22:23:53 +0000 (15:23 -0700)]
hwmon: (ina2xx) Add support for current limits
While the chips supported by this driver do not directly support current
limits, they do support setting shunt voltage limits. The shunt voltage
divided by the shunt resistor value is the current. On top of that,
calibration values are set such that in the shunt voltage register and
the current register report the same values. That means we can report and
configure current limits based on shunt voltage limits, and we can do so
with much better accuracy than by setting shunt voltage limits.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 28 Aug 2024 22:18:51 +0000 (15:18 -0700)]
hwmon: (ina2xx) Pass register to alert limit write functions
Pass the to-be-limited register to alert functions and use it to determine
conversion from limit to register value.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 25 Jul 2024 05:41:16 +0000 (22:41 -0700)]
hwmon: (ina2xx) Convert to use with_info hwmon API
Convert driver to use the with_info hardware monitoring API
to reduce its dependency on sysfs attribute functions.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 1 Aug 2024 22:34:48 +0000 (15:34 -0700)]
hwmon: (ina2xx) Move ina2xx_get_value()
ina2xx_get_value() will be needed earlier in the next patch, so move it.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 23 Jul 2024 23:17:02 +0000 (16:17 -0700)]
hwmon: (ina2xx) Set alert latch
Alerts should only be cleared after reported, not immediately after the
alert condition has been cleared. Set the latch enable bit to keep alerts
latched until the alert register has been read from the chip.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 24 Jul 2024 16:31:08 +0000 (09:31 -0700)]
hwmon: (ina2xx) Consolidate chip initialization code
Move all chip initialization code into a single function.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 24 Jul 2024 16:42:16 +0000 (09:42 -0700)]
hwmon: (ina2xx) Fix various overflow issues
Module tests show various overflow problems when writing limits
and other attributes.
in0_crit: Suspected overflow: [max=82, read 0, written
2147483648]
in0_lcrit: Suspected overflow: [max=82, read 0, written
2147483648]
in1_crit: Suspected overflow: [max=40959, read 0, written
2147483647]
in1_lcrit: Suspected overflow: [max=40959, read 0, written
2147483647]
power1_crit: Suspected overflow: [max=
134218750, read 0, written
2147483648]
update_interval: Suspected overflow: [max=2253, read 2, written
2147483647]
Implement missing clamping on attribute write operations to avoid those
problems.
While at it, check in the probe function if the shunt resistor value
passed from devicetree is valid, and bail out if it isn't. Also limit
mutex use to the code calling ina2xx_set_shunt() since it isn't needed
when called from the probe function.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 23 Jul 2024 23:04:29 +0000 (16:04 -0700)]
hwmon: (ina2xx) Re-initialize chip using regmap functions
If it is necessary to re-initialize the chip, for example because
it has been power cycled, use regmap functions to update register
contents. This ensures that all registers, including the configuration
register and alert registers, are updated to previously configured
values without having to locally cache everything.
For this to work, volatile registers have to be marked as volatile.
Also, the cache needs to be bypassed when reading the calibration
and mask_enable registers. While the calibration register is not
volatile, it will be reset to 0 if the chip has been power cycled.
Most of the bits in the mask_enable register are configuration bits,
except for bit 4 which reports if an alert has been observed.
Both registers need to be marked as non-volatile to be updated
after a power cycle, but it is necessary to bypass the cache when
reading them to detect if the chip has been power cycled and to
read the alert status.
The chip does not support register auto-increments. It is therefore
necessary to configure regmap to use single register read/write
operations. Otherwise regmap tries to write all registers in a single
operation when synchronizing register contents with the hardware,
and the synchronization fails.
Another necessary change is to declare ina226_alert_to_reg() as u16.
So far it returned an s16 which is sign extended to a large negative
value which is then sent to regmap as unsigned int, causing an -EINVAL
error return.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 1 Aug 2024 21:57:39 +0000 (14:57 -0700)]
hwmon: (ina2xx) Use local regmap pointer if used more than once
If regmap is accessed more than once in a function, declare and used
local regmap variable.
While at it, drop low value debug messages.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 1 Aug 2024 23:43:03 +0000 (16:43 -0700)]
hwmon: (ina2xx) Mark regmap_config as const
Recent versions of checkpatch complain that struct regmap_config
should be declared as const.
WARNING: struct regmap_config should normally be const
Doing so reveals a potential problem in the driver: If both supported
chips are present in a single system, the maximum number of registers
may race when devices are instantiated since max_registers is updated
in the probe function. Solve the problem by setting .max_registers to the
maximum register address of all supported chips. This does not make a
practical difference while fixing the potential race condition and reducing
code complexity.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 23 Jul 2024 20:25:31 +0000 (13:25 -0700)]
hwmon: (ina2xx) Use bit operations
Use bit operations where possible to make the code more generic and to
align it with other drivers. Also use compile time conversion from bit
to mask to reduce runtime overhead.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 23 Jul 2024 20:23:30 +0000 (13:23 -0700)]
hwmon: (ina2xx) Replace platform data with device properties
There are no in-tree users of ina2xx platform data. Drop it and support
device properties instead as alternative if it should ever be needed.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 23 Jul 2024 20:21:12 +0000 (13:21 -0700)]
hwmon: (ina2xx) Reorder include files to alphabetic order
Simplify driver maintenance by reordering include files to alphabetic
order.
Whule at it, drop unnecessary / unused jiffies.h.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Frank Li [Thu, 29 Aug 2024 15:06:41 +0000 (11:06 -0400)]
dt-bindings: hwmon: Convert ltc2978.txt to yaml
Convert binding doc ltc2978.txt to yaml format.
Additional change:
- add i2c node.
Fix below warning:
arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-cx.dtb: /soc/i2c@
2000000/i2c-mux@77/i2c@2/regulator@5c:
failed to match any schema with compatible: ['lltc,ltc3882']
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <
20240829150641.
1307906-1-Frank.Li@nxp.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Nathan Chancellor [Wed, 28 Aug 2024 18:05:35 +0000 (11:05 -0700)]
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang
clang warns (or errors due to CONFIG_WERROR):
drivers/hwmon/oxp-sensors.c:481:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:553:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:556:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:607:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing breaks to
silence the warnings.
Fixes:
b82b38a49926 ("hwmon: (oxp-sensors) Add support for multiple new devices.")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <
20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-
dc48496ac67a@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Johannes Kirchmair [Tue, 27 Aug 2024 05:44:54 +0000 (07:44 +0200)]
hwmon: (pwmfan) Do not force disable pwm controller
The pwm1_enable attribute of the pwmfan driver influences the mode of
operation, especially in case of a requested pwm1 duty cycle of zero.
Especially setting pwm1_enable to two, should keep the pwm controller
enabled even if the duty cycle is set to zero [1].
This is not the case at the moment, as the pwm controller is disabled
always if pwm1 is set to zero.
This commit tries to fix this behavior.
[1] https://docs.kernel.org/hwmon/pwm-fan.html
Signed-off-by: Johannes Kirchmair <johannes.kirchmair@skidata.com>
Message-ID: <
20240827054454.521494-1-mailinglist1@johanneskirchmair.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Shen Lichuan [Tue, 27 Aug 2024 07:04:42 +0000 (15:04 +0800)]
hwmon: (pc87360) Use min() macro
Use the min() macro to simplify the pc87360_init_device() function
and improve its readability.
Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Message-ID: <
20240827070442.40667-1-shenlichuan@vivo.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Inochi Amaoto [Sat, 17 Aug 2024 02:22:57 +0000 (10:22 +0800)]
hwmon: Add sophgo SG2042 external hardware monitor support
SG2042 use an external MCU to provide basic hardware information
and thermal sensors.
Add driver support for the onboard MCU of SG2042.
Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
Message-ID: <IA1PR20MB49536C786048D1E676BB9C20BB822@IA1PR20MB4953.namprd20.prod.outlook.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Inochi Amaoto [Sat, 17 Aug 2024 02:22:56 +0000 (10:22 +0800)]
dt-bindings: hwmon: Add Sophgo SG2042 external hardware monitor support
Due to the design, Sophgo SG2042 use an external MCU to provide
hardware information, thermal information and reset control.
Add bindings for this monitor device.
Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Chen Wang <unicorn_wang@outlook.com>
Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
Message-ID: <IA1PR20MB49538276F283C4D01364AEB6BB822@IA1PR20MB4953.namprd20.prod.outlook.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:56 +0000 (14:29 +0800)]
hwmon: (tmp464): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <
20240822062956.
3490387-9-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:55 +0000 (14:29 +0800)]
hwmon: (tmp421): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <
20240822062956.
3490387-8-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:54 +0000 (14:29 +0800)]
hwmon: (npcm750-pwm-fan): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <
20240822062956.
3490387-7-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:53 +0000 (14:29 +0800)]
hwmon: (nct7802): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <
20240822062956.
3490387-6-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:52 +0000 (14:29 +0800)]
hwmon: (lm90): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <
20240822062956.
3490387-5-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:51 +0000 (14:29 +0800)]
hwmon: (ina3221): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <
20240822062956.
3490387-4-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:50 +0000 (14:29 +0800)]
hwmon: (aspeed-pwm-tacho): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <
20240822062956.
3490387-3-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Jinjie Ruan [Thu, 22 Aug 2024 06:29:49 +0000 (14:29 +0800)]
hwmon: (aspeed-g6-pwm-tacho): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <
20240822062956.
3490387-2-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Mario Limonciello [Tue, 20 Aug 2024 05:35:57 +0000 (00:35 -0500)]
hwmon: (k10temp): Use cpu_feature_enabled() for detecting zen
This removes some boilerplate from the code and will allow adding
future CPUs by just device IDs.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Message-ID: <
20240820053558.
1052853-1-superm1@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Chanh Nguyen [Thu, 22 Aug 2024 08:48:08 +0000 (08:48 +0000)]
dt-bindings: hwmon: Add maxim max31790
Add device tree bindings and an example for max31790 device.
Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Message-ID: <
20240822084808.299884-1-chanh@os.amperecomputing.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Derek J. Clark [Thu, 22 Aug 2024 18:35:25 +0000 (11:35 -0700)]
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <
20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Rob Herring (Arm) [Mon, 26 Aug 2024 19:18:11 +0000 (14:18 -0500)]
hwmon: (stts751) Add "st" vendor prefix to "stts751" compatible string
The documented compatible string is "st,stts751", not "stts751". Even if
"stts751" was in use, there's no need to list "stts751" in the DT match
table. The I2C core will strip any vendor prefix and match against the
i2c_device_id table which has an "stts751" entry.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <
20240826191811.
1416011-1-robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Yuntao Liu [Thu, 15 Aug 2024 08:30:21 +0000 (08:30 +0000)]
hwmon: (ntc_thermistor) fix module autoloading
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from of_device_id table.
Fixes:
9e8269de100d ("hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver")
Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
Message-ID: <
20240815083021.756134-1-liuyuntao12@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Yue Haibing [Fri, 16 Aug 2024 09:57:40 +0000 (17:57 +0800)]
hwmon: (sch5627) Remove unused declaration sch56xx_watchdog_unregister()
Commit
2be5f0d75325 ("hwmon: (sch56xx) Use devres functions for watchdog")
removed the implementation but leave declaration.
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Message-ID: <
20240816095740.877729-1-yuehaibing@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Liao Chen [Wed, 14 Aug 2024 02:45:55 +0000 (02:45 +0000)]
hwmon: (gsc-hwmon) fix module autoloading
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from of_device_id table.
Signed-off-by: Liao Chen <liaochen4@huawei.com>
Message-ID: <
20240814024555.
3875387-1-liaochen4@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Maximilian Luz [Sun, 11 Aug 2024 00:14:41 +0000 (02:14 +0200)]
hwmon: Add thermal sensor driver for Surface Aggregator Module
Some of the newer Microsoft Surface devices (such as the Surface Book
3 and Pro 9) have thermal sensors connected via the Surface Aggregator
Module (the embedded controller on those devices). Add a basic driver
to read out the temperature values of those sensors.
The EC can have up to 16 thermal sensors connected via a single
sub-device, each providing temperature readings and a label string.
Link: https://github.com/linux-surface/surface-aggregator-module/issues/59
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Co-developed-by: Ivor Wanders <ivor@iwanders.net>
Signed-off-by: Ivor Wanders <ivor@iwanders.net>
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Message-ID: <
20240811001503.753728-1-luzmaximilian@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Denis Pauk [Mon, 12 Aug 2024 15:26:38 +0000 (18:26 +0300)]
hwmon: (nct6775) add G15CF to ASUS WMI monitoring list
Boards G15CF has got a nct6775 chip, but by default there's no use of it
because of resource conflict with WMI method.
Add the board to the WMI monitoring list.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807
Signed-off-by: Denis Pauk <pauk.denis@gmail.com>
Tested-by: Attila <attila@fulop.one>
Message-ID: <
20240812152652.1303-1-pauk.denis@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Javier Carrasco [Mon, 12 Aug 2024 22:59:53 +0000 (00:59 +0200)]
hwmon: (chipcap2) Drop cc2_disable() in the probe and return dev_err_probe()
There is no need to actively disable a regulator that has not been
enabled by the driver, which makes the call to cc2_disable() in the
probe function meaningless, because the probe function never enables
the device's dedicated regulator.
Once the call to cc2_disable() is dropped, the error paths can directly
return dev_err_probe() in all cases.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Message-ID: <
20240813-chipcap2-probe-improvements-v2-1-
e9a2932a8a00@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sun, 28 Jul 2024 22:52:25 +0000 (15:52 -0700)]
hwmon: (lm92) Update documentation
Update datasheet references. Replace misleading 'force parameter needed'
with 'must be instantiated explicitly'. Explain the reason for the missing
auto-detection. Mention all supported chips in Kconfig.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 17 Jul 2024 04:46:43 +0000 (21:46 -0700)]
hwmon: (lm92) Convert to with_info hwmon API
Convert driver to with_info hwmon API to simplify the code and
to reduce its size.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 17 Jul 2024 00:54:25 +0000 (17:54 -0700)]
hwmon: (lm92) Convert to use regmap
Use regmap for local caching and for multi-byte operations to be able
to use regmap API functions and to reduce the need for locking in the
driver.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 17 Jul 2024 04:48:07 +0000 (21:48 -0700)]
hwmon: (lm92) Replace chip IDs with limit register resolution
The chip IDs are not used by the driver. Drop them. Use driver data to
store the limit register resolution instead, and use this information
when writing temperature limits to improve chip specific rounding and
to avoid writing into unused register bits.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 17 Jul 2024 03:57:19 +0000 (20:57 -0700)]
hwmon: (lm92) Reorder include files to alphabetic order
Simplify driver maintenance by reordering files to alphabetic order.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 17 Jul 2024 19:13:12 +0000 (12:13 -0700)]
hwmon: (lm92) Improve auto-detection accuracy
Checking three configuration register bits and the manufacturer ID
register to auto-detect LM92 is a bit vague. Repeat twice on replicated
register addresses to improve detection accuracy. Check the manufacturer
ID first and bail out immediately without reading the other register if
there is a mismatch to reduce the number of i2c transfers needed in that
case. Also explicitly test for an error from reading the configuration
register to avoid potential situations where the returned error masked
against 0xe0 is 0.
While at it, drop "lm92: Found National Semiconductor LM92 chip" detection
noise.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Rob Herring (Arm) [Wed, 31 Jul 2024 19:12:51 +0000 (13:12 -0600)]
hwmon: (vexpress) Use of_property_present()
Use of_property_present() to test for property presence rather than
of_get_property(). This is part of a larger effort to remove callers
of of_get_property() and similar functions. of_get_property() leaks
the DT property data pointer which is a problem for dynamically
allocated nodes which may be freed.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20240731191312.1710417-13-robh@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Fri, 26 Jul 2024 22:29:40 +0000 (15:29 -0700)]
hwmon: (max1619) Improve chip detection code
Bail out immediately if reading any of the registers used for chip
detection fails, or if it returns an unexpected value. Drop all log
messages from detection code.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 16:01:27 +0000 (09:01 -0700)]
hwmon: (max1619) Add support for update_interval attribute
The chip supports reading and writing the conversion rate.
Add support for the update_interval sysfs attribute.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 15:24:28 +0000 (08:24 -0700)]
hwmon: (max1619) Convert to with_info API
Convert driver to with_info hwmon API to simplify the code and
with it its maintainability.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 05:26:22 +0000 (22:26 -0700)]
hwmon: (max1619) Convert to use regmap
Use regmap for local caching, to hide register read/write address
differences, and for multi-byte operations. With this change,
the driver specific lock is no longer necessary.
While at it, check errors seen when initializing the chip and bail out
if chip initialization fails.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sun, 28 Jul 2024 14:09:54 +0000 (07:09 -0700)]
hwmon: (max1619) Mask valid alarm bits
Bit 0, 5, and 6 in the status register are reserved and, if set, do not
indicate an alarm. Bit 7 is the 'busy' bit and also does not indicate
an alarm. Mask the non-alarm bits to avoid reporting them to userspace.
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 03:28:58 +0000 (20:28 -0700)]
hwmon: (max1619) Reorder include files to alphabetic order
Simplify maintenance by reordering include files to alphabetic order.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 05:36:35 +0000 (22:36 -0700)]
hwmon: (max1619) Clamp temperature range when writing limits
Module test code reports underflows when writing sensor limits.
temp2_min: Suspected underflow: [min=-77000, read 101000, written -
2147483648]
temp2_max: Suspected underflow: [min=-77000, read 101000, written -
2147483648]
temp2_crit: Suspected underflow: [min=-77000, read 101000, written -
2147483648]
Clamp temperature ranges when writing limits to fix the problem.
While at it, use sign_extend32() when reading temperatures to make
the code easier to understand.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sat, 27 Jul 2024 19:06:04 +0000 (12:06 -0700)]
hwmon: (max6697) Document discrepancy in overtemperature status bit values
In the MAX6581 datasheet Revision 0 to 3, the local channel overtemperature
status is reported in bit 6 of register 0x45, and the overtemperature
status for remote channel 7 is reported in bit 7. In Revision 4 and later,
the local channel overtemperature status is reported in bit 7, and the
remote channel 7 overtemperature status is reported in bit 6. A real
chip was found to match the functionality documented in Revision 4 and
later.
The code was fixed with commit
1ea3fd1eb986 ("hwmon: (max6697) Fix swapped
temp{1,8} critical alarms"). At that time it looked like this was an
original bug. It only turned out later that the problem was the result of
incorrect information in the chip datasheet.
Document the discrepancy to avoid confusion caused by old versions of the
datasheet.
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Mon, 15 Jul 2024 14:48:24 +0000 (07:48 -0700)]
hwmon: (max1668) Convert to use with_info hwmon API
Convert to use with_info API to simplify the code and to reduce its size.
This patch reduces object file size by approximately 25%.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Mon, 15 Jul 2024 14:25:38 +0000 (07:25 -0700)]
hwmon: (max1668) Replace chip type with number of channels
The only difference between supported chips is the number of channels.
Drop enum chips and list the number of channels in struct i2c_device_id
directly.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Mon, 15 Jul 2024 14:18:57 +0000 (07:18 -0700)]
hwmon: (max1668) Convert to use regmap
Use regmap for caching to simplify the code and to hide read/write
register address differences.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Mon, 15 Jul 2024 14:22:44 +0000 (07:22 -0700)]
hwmon: (max1668) Use BIT macro
Use bit macro to make the code easier to understand and reduce duplication.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Mon, 15 Jul 2024 14:20:35 +0000 (07:20 -0700)]
hwmon: (max1668) Reorder include files to alphabetic order
Reorder include files to alphabetic order to simplify driver maintenance.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cryolitia PukNgae [Fri, 26 Jul 2024 01:21:14 +0000 (09:21 +0800)]
hwmon: (oxp-sensors) Fix typo in driver documentation
RMP -> RPM
Signed-off-by: Cryolitia PukNgae <Cryolitia@gmail.com>
Link: https://lore.kernel.org/r/20240726-typo-v1-1-3ca3f07f93e9@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Nuno Sa [Fri, 26 Jul 2024 12:07:33 +0000 (14:07 +0200)]
hwmon: (ltc2947) Move to firmware agnostic API
Use the device property APIs so the driver does not depend on OF to
work.
While at it, properly include mod_devicetable for struct of_device_id
and fix some parameter alignment in the changed places.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240726-dev-hwmon-ltc6947-fw-agnostic-v1-1-f7d6cab7d438@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Chris Packham [Mon, 22 Jul 2024 22:17:37 +0000 (10:17 +1200)]
hwmon: (adt7475) Add support for configuring initial PWM state
By default the PWM duty cycle in hardware is 100%. On some systems this
can cause unwanted fan noise. Add the ability to specify the fan
connections and initial state of the PWMs via device properties.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20240722221737.3407958-4-chris.packham@alliedtelesis.co.nz
[groeck: Cleaned up formatting]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Chris Packham [Mon, 22 Jul 2024 22:17:36 +0000 (10:17 +1200)]
dt-bindings: hwmon: adt7475: Deprecate adi,pwm-active-state
Now that we have fan child nodes that can specify flags for the PWM
outputs we no longer need the adi,pwm-active-state property.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240722221737.3407958-3-chris.packham@alliedtelesis.co.nz
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Chris Packham [Mon, 22 Jul 2024 22:17:35 +0000 (10:17 +1200)]
dt-bindings: hwmon: Add adt7475 fan/pwm properties
Add fan child nodes that allow describing the connections for the
ADT7475 to the fans it controls. This also allows setting some
initial values for the pwm duty cycle and frequency.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240722221737.3407958-2-chris.packham@alliedtelesis.co.nz
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sat, 13 Jul 2024 21:20:34 +0000 (14:20 -0700)]
hwmon: (max6697) Add support for tempX_min and tempX_min_alarm
MAX6581 supports setting the minimum temperature as well as minimum
temperature alarms. Add support for it.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sat, 13 Jul 2024 14:44:20 +0000 (07:44 -0700)]
hwmon: (max6697) Convert to with_info hwmon API
Convert to with_info hwmon API to simplify the code and reduce its size.
This patch reduces object file size by approximately 25%.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Fri, 12 Jul 2024 22:45:38 +0000 (15:45 -0700)]
hwmon: (max6697) Convert to use regmap
Use regmap for register caching, and use regmap API for bit operations
to simplify the code.
This patch reduces object file size by approximately 10%.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Fri, 12 Jul 2024 21:46:19 +0000 (14:46 -0700)]
hwmon: (max6697) Use bit operations where possible
Use bit operations to improve code maintainability.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Fri, 12 Jul 2024 20:57:13 +0000 (13:57 -0700)]
hwmon: (max6697) Drop platform data support
Platform data is not used anywhere in the upstram kernel.
Drop support for it to simplify code maintenance.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Fri, 12 Jul 2024 20:06:30 +0000 (13:06 -0700)]
hwmon: (max6697) Reorder include files
Reorder include files to alphabetic order to improve maintainability.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sun, 21 Jul 2024 13:41:17 +0000 (06:41 -0700)]
hwmon: (max16065) Fix alarm attributes
Chips reporting overcurrent alarms report it in the second alarm register.
That means the second alarm register has to be read, even if the chip only
supports 8 or fewer ADC channels.
MAX16067 and MAX16068 report undervoltage and overvoltage alarms in
separate registers. Fold register contents together to report both with
the existing alarm attribute. This requires actually storing the chip type
in struct max16065_data. Rename the variable 'chip' to match the variable
name used in the probe function.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Fixes:
f5bae2642e3d ("hwmon: Driver for MAX16065 System Manager and compatibles")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 18 Jul 2024 16:52:01 +0000 (09:52 -0700)]
hwmon: (max16065) Fix overflows seen when writing limits
Writing large limits resulted in overflows as reported by module tests.
in0_lcrit: Suspected overflow: [max=5538, read 0, written
2147483647]
in0_crit: Suspected overflow: [max=5538, read 0, written
2147483647]
in0_min: Suspected overflow: [max=5538, read 0, written
2147483647]
Fix the problem by clamping prior to multiplications and the use of
DIV_ROUND_CLOSEST, and by using consistent variable types.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Fixes:
f5bae2642e3d ("hwmon: Driver for MAX16065 System Manager and compatibles")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Javier Carrasco [Sun, 21 Jul 2024 15:19:02 +0000 (17:19 +0200)]
hwmon: (ltc2992) use device_for_each_child_node_scoped() to access child nodes
The iterated nodes are direct children of the device node, and the
`device_for_each_child_node()` macro accounts for child node
availability.
`fwnode_for_each_available_child_node()` is meant to access the child
nodes of an fwnode, and therefore not direct child nodes of the device
node.
In this case, the child nodes are not required outside the loop, and
the scoped version of the macro can be used to remove the repetitive
`goto put` pattern.
Use `device_for_each_child_node_scoped_scoped()` to indicate device's
direct child nodes.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240721-device_for_each_child_node-available-v2-2-f33748fd8b2d@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Armin Wolf [Fri, 19 Jul 2024 20:37:06 +0000 (22:37 +0200)]
hwmon: (dell-smm) Add Dell Latitude 7320 to fan control whitelist
Add the Dell Latitude 7320 to the fan control whitelist to allow
for manual fan control.
Closes: https://github.com/Wer-Wolf/i8kutils/issues/8
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20240719203706.19466-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Thu, 11 Jul 2024 00:37:54 +0000 (17:37 -0700)]
hwmon: (lm95234) Use multi-byte regmap operations
Use multi-byte regmap operations to simplify the code
and to reduce dependency on locking.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 10 Jul 2024 22:57:18 +0000 (15:57 -0700)]
hwmon: (lm95234) Add support for tempX_enable attribute
LM95233/LM95234 support enabling temperature channels one by one.
Add support for tempX_enable attribute to be able to use that
functionality.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 10 Jul 2024 14:11:12 +0000 (07:11 -0700)]
hwmon: (lm95234) Convert to with_info hwmon API
Convert to with_info API to simplify the code and reduce its size.
This patch reduces the object file size by about 30%.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sun, 7 Jul 2024 23:43:04 +0000 (16:43 -0700)]
hwmon: (lm95234) Convert to use regmap
Use regmap to replace local caching and to be able to use regmap API
functions.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Wed, 10 Jul 2024 04:23:30 +0000 (21:23 -0700)]
hwmon: (lm95234) Use find_closest to find matching update interval
Use find_closest() instead of manually coding it to find best update
interval.
Since find_closest() uses rounding to find the best match, the resulting
update interval will now reflect the update interval that is closest to
the requested value, not the value that is lower or equal to the requested
value.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Sun, 7 Jul 2024 14:49:51 +0000 (07:49 -0700)]
hwmon: (lm95234) Reorder include files to be in alphabetic order
Alphabetic include file order simplifies maintenance and makes it easier
to add or remove files.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 19:01:21 +0000 (12:01 -0700)]
hwmon: (amc6821) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size.
No functional changes.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 16 Jul 2024 19:14:12 +0000 (12:14 -0700)]
hwmon: (max6639) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional changes.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 9 Jul 2024 21:07:19 +0000 (14:07 -0700)]
hwmon: (tmp464) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional changes.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 9 Jul 2024 21:06:17 +0000 (14:06 -0700)]
hwmon: (adt7x10) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional changes.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 9 Jul 2024 21:03:06 +0000 (14:03 -0700)]
hwmon: (nct7802) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional changes.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 9 Jul 2024 14:21:19 +0000 (07:21 -0700)]
hwmon: (lm95245) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional change.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 9 Jul 2024 20:53:37 +0000 (13:53 -0700)]
hwmon: (tmp401) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional change.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck [Tue, 9 Jul 2024 14:16:43 +0000 (07:16 -0700)]
hwmon: (adt7470) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.
No functional change.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Linus Torvalds [Sun, 28 Jul 2024 21:19:55 +0000 (14:19 -0700)]
Linux 6.11-rc1
Linus Torvalds [Sun, 28 Jul 2024 21:02:48 +0000 (14:02 -0700)]
Merge tag 'kbuild-fixes-v6.11' of git://git./linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada:
- Fix RPM package build error caused by an incorrect locale setup
- Mark modules.weakdep as ghost in RPM package
- Fix the odd combination of -S and -c in stack protector scripts,
which is an error with the latest Clang
* tag 'kbuild-fixes-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kbuild: Fix '-S -c' in x86 stack protector scripts
kbuild: rpm-pkg: ghost modules.weakdep file
kbuild: rpm-pkg: Fix C locale setup
Linus Torvalds [Sun, 28 Jul 2024 20:50:01 +0000 (13:50 -0700)]
minmax: simplify and clarify min_t()/max_t() implementation
This simplifies the min_t() and max_t() macros by no longer making them
work in the context of a C constant expression.
That means that you can no longer use them for static initializers or
for array sizes in type definitions, but there were only a couple of
such uses, and all of them were converted (famous last words) to use
MIN_T/MAX_T instead.
Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Sun, 28 Jul 2024 20:03:48 +0000 (13:03 -0700)]
minmax: add a few more MIN_T/MAX_T users
Commit
3a7e02c040b1 ("minmax: avoid overly complicated constant
expressions in VM code") added the simpler MIN_T/MAX_T macros in order
to avoid some excessive expansion from the rather complicated regular
min/max macros.
The complexity of those macros stems from two issues:
(a) trying to use them in situations that require a C constant
expression (in static initializers and for array sizes)
(b) the type sanity checking
and MIN_T/MAX_T avoids both of these issues.
Now, in the whole (long) discussion about all this, it was pointed out
that the whole type sanity checking is entirely unnecessary for
min_t/max_t which get a fixed type that the comparison is done in.
But that still leaves min_t/max_t unnecessarily complicated due to
worries about the C constant expression case.
However, it turns out that there really aren't very many cases that use
min_t/max_t for this, and we can just force-convert those.
This does exactly that.
Which in turn will then allow for much simpler implementations of
min_t()/max_t(). All the usual "macros in all upper case will evaluate
the arguments multiple times" rules apply.
We should do all the same things for the regular min/max() vs MIN/MAX()
cases, but that has the added complexity of various drivers defining
their own local versions of MIN/MAX, so that needs another level of
fixes first.
Link: https://lore.kernel.org/all/b47fad1d0cf8449886ad148f8c013dae@AcuMS.aculab.com/
Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Sun, 28 Jul 2024 18:51:51 +0000 (11:51 -0700)]
Merge tag 'ubifs-for-linus-6.11-rc1-take2' of git://git./linux/kernel/git/rw/ubifs
Pull UBI and UBIFS updates from Richard Weinberger:
- Many fixes for power-cut issues by Zhihao Cheng
- Another ubiblock error path fix
- ubiblock section mismatch fix
- Misc fixes all over the place
* tag 'ubifs-for-linus-6.11-rc1-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
ubi: Fix ubi_init() ubiblock_exit() section mismatch
ubifs: add check for crypto_shash_tfm_digest
ubifs: Fix inconsistent inode size when powercut happens during appendant writing
ubi: block: fix null-pointer-dereference in ubiblock_create()
ubifs: fix kernel-doc warnings
ubifs: correct UBIFS_DFS_DIR_LEN macro definition and improve code clarity
mtd: ubi: Restore missing cleanup on ubi_init() failure path
ubifs: dbg_orphan_check: Fix missed key type checking
ubifs: Fix unattached inode when powercut happens in creating
ubifs: Fix space leak when powercut happens in linking tmpfile
ubifs: Move ui->data initialization after initializing security
ubifs: Fix adding orphan entry twice for the same inode
ubifs: Remove insert_dead_orphan from replaying orphan process
Revert "ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path"
ubifs: Don't add xattr inode into orphan area
ubifs: Fix unattached xattr inode if powercut happens after deleting
mtd: ubi: avoid expensive do_div() on 32-bit machines
mtd: ubi: make ubi_class constant
ubi: eba: properly rollback inside self_check_eba
Nathan Chancellor [Fri, 26 Jul 2024 18:05:00 +0000 (11:05 -0700)]
kbuild: Fix '-S -c' in x86 stack protector scripts
After a recent change in clang to stop consuming all instances of '-S'
and '-c' [1], the stack protector scripts break due to the kernel's use
of -Werror=unused-command-line-argument to catch cases where flags are
not being properly consumed by the compiler driver:
$ echo | clang -o - -x c - -S -c -Werror=unused-command-line-argument
clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
This results in CONFIG_STACKPROTECTOR getting disabled because
CONFIG_CC_HAS_SANE_STACKPROTECTOR is no longer set.
'-c' and '-S' both instruct the compiler to stop at different stages of
the pipeline ('-S' after compiling, '-c' after assembling), so having
them present together in the same command makes little sense. In this
case, the test wants to stop before assembling because it is looking at
the textual assembly output of the compiler for either '%fs' or '%gs',
so remove '-c' from the list of arguments to resolve the error.
All versions of GCC continue to work after this change, along with
versions of clang that do or do not contain the change mentioned above.
Cc: stable@vger.kernel.org
Fixes:
4f7fd4d7a791 ("[PATCH] Add the -fstack-protector option to the CFLAGS")
Fixes:
60a5317ff0f4 ("x86: implement x86_32 stack protector")
Link: https://github.com/llvm/llvm-project/commit/6461e537815f7fa68cef06842505353cf5600e9c
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Richard Weinberger [Sat, 13 Jul 2024 07:35:19 +0000 (09:35 +0200)]
ubi: Fix ubi_init() ubiblock_exit() section mismatch
Since ubiblock_exit() is now called from an init function,
the __exit section no longer makes sense.
Cc: Ben Hutchings <bwh@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202407131403.wZJpd8n2-lkp@intel.com/
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Linus Torvalds [Sun, 28 Jul 2024 17:52:15 +0000 (10:52 -0700)]
Merge tag 'v6.11-merge' of git://git./linux/kernel/git/lenb/linux
Pull turbostat updates from Len Brown:
- Enable turbostat extensions to add both perf and PMT (Intel
Platform Monitoring Technology) counters via the cmdline
- Demonstrate PMT access with built-in support for Meteor Lake's
Die C6 counter
* tag 'v6.11-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
tools/power turbostat: version 2024.07.26
tools/power turbostat: Include umask=%x in perf counter's config
tools/power turbostat: Document PMT in turbostat.8
tools/power turbostat: Add MTL's PMT DC6 builtin counter
tools/power turbostat: Add early support for PMT counters
tools/power turbostat: Add selftests for added perf counters
tools/power turbostat: Add selftests for SMI, APERF and MPERF counters
tools/power turbostat: Move verbose counter messages to level 2
tools/power turbostat: Move debug prints from stdout to stderr
tools/power turbostat: Fix typo in turbostat.8
tools/power turbostat: Add perf added counter example to turbostat.8
tools/power turbostat: Fix formatting in turbostat.8
tools/power turbostat: Extend --add option with perf counters
tools/power turbostat: Group SMI counter with APERF and MPERF
tools/power turbostat: Add ZERO_ARRAY for zero initializing builtin array
tools/power turbostat: Replace enum rapl_source and cstate_source with counter_source
tools/power turbostat: Remove anonymous union from rapl_counter_info_t
tools/power/turbostat: Switch to new Intel CPU model defines
Linus Torvalds [Sun, 28 Jul 2024 16:33:28 +0000 (09:33 -0700)]
Merge tag 'cxl-for-6.11' of git://git./linux/kernel/git/cxl/cxl
Pull CXL updates from Dave Jiang:
"Core:
- A CXL maturity map has been added to the documentation to detail
the current state of CXL enabling.
It provides the status of the current state of various CXL features
to inform current and future contributors of where things are and
which areas need contribution.
- A notifier handler has been added in order for a newly created CXL
memory region to trigger the abstract distance metrics calculation.
This should bring parity for CXL memory to the same level vs
hotplugged DRAM for NUMA abstract distance calculation. The
abstract distance reflects relative performance used for memory
tiering handling.
- An addition for XOR math has been added to address the CXL DPA to
SPA translation.
CXL address translation did not support address interleave math
with XOR prior to this change.
Fixes:
- Fix to address race condition in the CXL memory hotplug notifier
- Add missing MODULE_DESCRIPTION() for CXL modules
- Fix incorrect vendor debug UUID define
Misc:
- A warning has been added to inform users of an unsupported
configuration when mixing CXL VH and RCH/RCD hierarchies
- The ENXIO error code has been replaced with EBUSY for inject poison
limit reached via debugfs and cxl-test support
- Moving the PCI config read in cxl_dvsec_rr_decode() to avoid
unnecessary PCI config reads
- A refactor to a common struct for DRAM and general media CXL
events"
* tag 'cxl-for-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
cxl/core/pci: Move reading of control register to immediately before usage
cxl: Remove defunct code calculating host bridge target positions
cxl/region: Verify target positions using the ordered target list
cxl: Restore XOR'd position bits during address translation
cxl/core: Fold cxl_trace_hpa() into cxl_dpa_to_hpa()
cxl/test: Replace ENXIO with EBUSY for inject poison limit reached
cxl/memdev: Replace ENXIO with EBUSY for inject poison limit reached
cxl/acpi: Warn on mixed CXL VH and RCH/RCD Hierarchy
cxl/core: Fix incorrect vendor debug UUID define
Documentation: CXL Maturity Map
cxl/region: Simplify cxl_region_nid()
cxl/region: Support to calculate memory tier abstract distance
cxl/region: Fix a race condition in memory hotplug notifier
cxl: add missing MODULE_DESCRIPTION() macros
cxl/events: Use a common struct for DRAM and General Media events
Linus Torvalds [Sun, 28 Jul 2024 16:14:11 +0000 (09:14 -0700)]
Merge tag 'unicode-next-6.11' of git://git./linux/kernel/git/krisman/unicode
Pull unicode update from Gabriel Krisman Bertazi:
"Two small fixes to silence the compiler and static analyzers tools
from Ben Dooks and Jeff Johnson"
* tag 'unicode-next-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/krisman/unicode:
unicode: add MODULE_DESCRIPTION() macros
unicode: make utf8 test count static
Jose Ignacio Tornos Martinez [Fri, 26 Jul 2024 09:00:26 +0000 (11:00 +0200)]
kbuild: rpm-pkg: ghost modules.weakdep file
In the same way as for other similar files, mark as ghost the new file
generated by depmod for configured weak dependencies for modules,
modules.weakdep, so that although it is not included in the package,
claim the ownership on it.
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>