summaryrefslogtreecommitdiff
path: root/drivers/hwmon
AgeCommit message (Collapse)AuthorFilesLines
2025-01-28Merge tag 'driver-core-6.14-rc1' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core and debugfs updates from Greg KH: "Here is the big set of driver core and debugfs updates for 6.14-rc1. Included in here is a bunch of driver core, PCI, OF, and platform rust bindings (all acked by the different subsystem maintainers), hence the merge conflict with the rust tree, and some driver core api updates to mark things as const, which will also require some fixups due to new stuff coming in through other trees in this merge window. There are also a bunch of debugfs updates from Al, and there is at least one user that does have a regression with these, but Al is working on tracking down the fix for it. In my use (and everyone else's linux-next use), it does not seem like a big issue at the moment. Here's a short list of the things in here: - driver core rust bindings for PCI, platform, OF, and some i/o functions. We are almost at the "write a real driver in rust" stage now, depending on what you want to do. - misc device rust bindings and a sample driver to show how to use them - debugfs cleanups in the fs as well as the users of the fs api for places where drivers got it wrong or were unnecessarily doing things in complex ways. - driver core const work, making more of the api take const * for different parameters to make the rust bindings easier overall. - other small fixes and updates All of these have been in linux-next with all of the aforementioned merge conflicts, and the one debugfs issue, which looks to be resolved "soon"" * tag 'driver-core-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (95 commits) rust: device: Use as_char_ptr() to avoid explicit cast rust: device: Replace CString with CStr in property_present() devcoredump: Constify 'struct bin_attribute' devcoredump: Define 'struct bin_attribute' through macro rust: device: Add property_present() saner replacement for debugfs_rename() orangefs-debugfs: don't mess with ->d_name octeontx2: don't mess with ->d_parent or ->d_parent->d_name arm_scmi: don't mess with ->d_parent->d_name slub: don't mess with ->d_name sof-client-ipc-flood-test: don't mess with ->d_name qat: don't mess with ->d_name xhci: don't mess with ->d_iname mtu3: don't mess wiht ->d_iname greybus/camera - stop messing with ->d_iname mediatek: stop messing with ->d_iname netdevsim: don't embed file_operations into your structs b43legacy: make use of debugfs_get_aux() b43: stop embedding struct file_operations into their objects carl9170: stop embedding file_operations into their objects ...
2025-01-25Merge tag 'i3c/for-6.14' of ↵Linus Torvalds1-7/+1
git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux Pull i3c updates from Alexandre Belloni: "The main change is the addition of PCI bus support for mipi-i3c-hci. I'm also carrying an hwmon patch as it makes use of the bitops addition that is then mainly used by i3c drivers. Core: - Improve initialization of numbered I2C adapters Drivers: - use parity8 helper - dw: fix possible use-after-free - mipi-i3c-hci: add support for PCI bus host - svc: many fixes for IBI and hotjoin" * tag 'i3c/for-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux: i3c: master: Improve initialization of numbered I2C adapters i3c: master: Fix missing 'ret' assignment in set_speed() i3c: cdns: use parity8 helper instead of open coding it i3c: mipi-i3c-hci: use parity8 helper instead of open coding it i3c: dw: use parity8 helper instead of open coding it hwmon: (spd5118) Use generic parity calculation bitops: add generic parity calculation for u8 i3c: mipi-i3c-hci: Add support for MIPI I3C HCI on PCI bus i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming i3c: fix kdoc parameter description for module_i3c_i2c_driver() i3c: dw: Fix use-after-free in dw_i3c_master driver due to race condition
2025-01-22Merge tag 'hwmon-for-v6.14-rc1' of ↵Linus Torvalds24-241/+1015
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - PMBus client driver for Intel CRPS185 power supply - PMBus client driver for Texas Instruments TPS25990 Chip support added to existing drivers: - pmbus/max15301: Add support for MAX15303 - pmbus/adm1275: Add adm1273 support - lm75: Add NXP P3T1755 support; with it, add I3C support to the driver - asus-ec-sensors: Add TUF GAMING X670E PLUS Other notable changes: - nct6683: Add customer IDs for several MSI and ASRock boards - tmp108: Add regulator support - Improve write protect support in PMBus core - pmbus/dps920ab: Add ability to instantiate through i2c - The hwmon core now accepts NULL as device name parameter to [devm_]hwmon_device_register_with_info ans uses the parent device name as fallback in that case - The PMBus core now provides the PMBUs revision in a debugfs file - asus-ec-sensors: Support for optional CPU fan on AMD 600 motherboards - raspberrypi: Add PM suspend/resume support - dell-smm: Enable manual fan control support on Dell XPS 9370 - pwm-fan: Default to maximum cooling level if provided And various other minor fixes and improvements" * tag 'hwmon-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (44 commits) hwmon: pmbus: dps920ab: Add ability to instantiate through i2c hwmon: (pwm-fan) Default to the Maximum cooling level if provided hwmon: (asus_atk0110) Use str_enabled_disabled() and str_enable_disable() helpers hwmon: Fix help text for aspeed-g6-pwm-tach hwmon: (dell-smm) Add Dell XPS 9370 to fan control whitelist hwmon: (acpi_power_meter) Fix update the power trip points on failure hwmon: (acpi_power_meter) Fix uninitialized variables hwmon: (core) Use device name as a fallback in devm_hwmon_device_register_with_info hwmon: (pmbus/max15301) Add support for MAX15303 hwmon: (pmbus/adm1275) add adm1273 support dt-bindings: hwmon: adm1275: add adm1273 hwmon: (nct6683) Add another customer ID for MSI hwmon: (pwm-fan): Make use of device properties everywhere hwmon: (lm75) add I3C support for P3T1755 hwmon: (lm75) separate probe into common and I2C parts hwmon: (lm75) Remove superfluous 'client' member from private struct hwmon: (lm75) simplify regulator handling hwmon: (lm75) simplify lm75_write_config() hwmon: (lm75) Hide register size differences in regmap access functions hwmon: (pmbus/crps) Add Intel CRPS185 power supply ...
2025-01-22Merge tag 'mfd-next-6.14' of ↵Linus Torvalds3-0/+377
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull mfd updates from Lee Jones: - Fix race in device_node_get_regmap() using more extensive locking - Remove unused platform driver support for syscon - Allow syscon nodes to be registered without a "syscon" compatible string - Make `platform_data` pointer const in struct mfd_cell - Revert support for multiple AXP PMICs to avoid regressions - Increase SoundWire attach timeout and use gpiod_set_raw() for GPIO operation - Store the result from fault_log() for use by other sub-components - Fix an invalid regmap-config max_register value - Add another Gemini Lake ISA bridge PCI device ID - Use devm_register_power_off_handler() to simplify code - Add support for QNAP microcontroller units, including LEDs, input, and hwmon - Use MFD_CELL macros and remove unused code - Add support for AAEON UP board FPGA - Remove unused includes - Fix various typos and compatibility issues in multiple bindings - Add new bindings for rk3562 QoS, LED1202, and qcom,tcsr-ipq5424 - Convert several bindings to YAML schema - Update sprd,sc2731 bindings to reference sprd,sc2731-efuse bindings directly - Fix rohm,bd71815 bindings by correcting resistor values and typos - Documentation improvements: - Add documentation for LED1202 and qnap-mcu-hwmon - Adjust the file entry for the qnap-mcu header in MAINTAINERS * tag 'mfd-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (35 commits) MAINTAINERS: Adjust the file entry for the qnap-mcu header dt-bindings: mfd: syscon: Fix ti,j784s4-acspcie-proxy-ctrl compatible dt-bindings: mfd: syscon: Fix al,alpine-sysfabric-service compatible Revert "mfd: axp20x: Allow multiple regulators" dt-bindings: mfd: syscon: Add rk3562 QoS register compatible mfd: syscon: Allow syscon nodes without a "syscon" compatible mfd: syscon: Remove the platform driver support mfd: syscon: Fix race in device_node_get_regmap() dt-bindings: mfd: atmel: Convert to YAML schema dt-bindings: mfd: atmel,at91sam9260: Convert to YAML schema dt-bindings: mfd: sprd,sc2731: Reference sprd,sc2731-efuse bindings mfd: tps65219: Remove unused macros & add regmap.h mfd: tps65219: Use MFD_CELL macros leds: Add LED1202 I2C driver dt-bindings: leds: Add LED1202 LED Controller Documentation:leds: Add leds-st1202.rst mfd: Add support for AAEON UP board FPGA mfd: da9052: Store result from fault_log mfd: intel_soc_pmic_chtdc_ti: Fix invalid regmap-config max_register value mfd: cs42l43: Use devres for remove as well ...
2025-01-21Merge tag 'x86_misc_for_v6.14_rc1' of ↵Linus Torvalds2-2/+7
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull misc x86 updates from Borislav Petkov: - The first part of a restructuring of AMD's representation of a northbridge which is legacy now, and the creation of the new AMD node concept which represents the Zen architecture of having a collection of I/O devices within an SoC. Those nodes comprise the so-called data fabric on Zen. This has at least one practical advantage of not having to add a PCI ID each time a new data fabric PCI device releases. Eventually, the lot more uniform provider of data fabric functionality amd_node.c will be used by all the drivers which need it - Smaller cleanups * tag 'x86_misc_for_v6.14_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/amd_node: Use defines for SMN register offsets x86/amd_node: Remove dependency on AMD_NB x86/amd_node: Update __amd_smn_rw() error paths x86/amd_nb: Move SMN access code to a new amd_node driver x86/amd_nb, hwmon: (k10temp): Simplify amd_pci_dev_to_node_id() x86/amd_nb: Simplify function 3 search x86/amd_nb: Use topology info to get AMD node count x86/amd_nb: Simplify root device search x86/amd_nb: Simplify function 4 search x86: Start moving AMD node functionality out of AMD_NB x86/amd_nb: Clean up early_is_amd_nb() x86/amd_nb: Restrict init function to AMD-based systems x86/mtrr: Rename mtrr_overwrite_state() to guest_force_mtrr_state()
2025-01-16hwmon: (ltc2991) Fix mixed signed/unsigned in DIV_ROUND_CLOSESTDavid Lechner1-1/+1
Fix use of DIV_ROUND_CLOSEST where a possibly negative value is divided by an unsigned type by casting the unsigned type to the signed type of the same size (st->r_sense_uohm[channel] has type of u32). The docs on the DIV_ROUND_CLOSEST macro explain that dividing a negative value by an unsigned type is undefined behavior. The actual behavior is that it converts both values to unsigned before doing the division, for example: int ret = DIV_ROUND_CLOSEST(-100, 3U); results in ret == 1431655732 instead of -33. Fixes: 2b9ea4262ae9 ("hwmon: Add driver for ltc2991") Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20250115-hwmon-ltc2991-fix-div-round-closest-v1-1-b4929667e457@baylibre.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-15hwmon: (drivetemp) Set scsi command timeout to 10sRussell Harmon1-1/+1
There's at least one drive (MaxDigitalData OOS14000G) such that if it receives a large amount of I/O while entering an idle power state will first exit idle before responding, including causing SMART temperature requests to be delayed. This causes the drivetemp request to exceed its timeout of 1 second. Signed-off-by: Russell Harmon <russ@har.mn> Link: https://lore.kernel.org/r/20250115131340.3178988-1-russ@har.mn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-15hwmon: (acpi_power_meter) Fix a check for the return value of ↵Kazuhiro Abe1-1/+1
read_domain_devices(). After commit fabb1f813ec0 ("hwmon: (acpi_power_meter) Fix fail to load module on platform without _PMD method"), the acpi_power_meter driver fails to load if the platform has _PMD method. To address this, add a check for successful read_domain_devices(). Tested on Nvidia Grace machine. Fixes: fabb1f813ec0 ("hwmon: (acpi_power_meter) Fix fail to load module on platform without _PMD method") Signed-off-by: Kazuhiro Abe <fj1078ii@aa.jp.fujitsu.com> Link: https://lore.kernel.org/r/20250115073532.3211000-1-fj1078ii@aa.jp.fujitsu.com [groeck: Dropped unnecessary () from expression] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-15hwmon: (tmp513) Fix division of negative numbersDavid Lechner1-3/+4
Fix several issues with division of negative numbers in the tmp513 driver. The docs on the DIV_ROUND_CLOSEST macro explain that dividing a negative value by an unsigned type is undefined behavior. The driver was doing this in several places, i.e. data->shunt_uohms has type of u32. The actual "undefined" behavior is that it converts both values to unsigned before doing the division, for example: int ret = DIV_ROUND_CLOSEST(-100, 3U); results in ret == 1431655732 instead of -33. Furthermore the MILLI macro has a type of unsigned long. Multiplying a signed long by an unsigned long results in an unsigned long. So, we need to cast both MILLI and data data->shunt_uohms to long when using the DIV_ROUND_CLOSEST macro. Fixes: f07f9d2467f4 ("hwmon: (tmp513) Use SI constants from units.h") Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.") Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20250114-fix-si-prefix-macro-sign-bugs-v1-1-696fd8d10f00@baylibre.com [groeck: Drop some continuation lines] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-13hwmon: pmbus: dps920ab: Add ability to instantiate through i2cDenis Kirjanov1-0/+7
Add support for instantiating the Delta DPS920AB PSU through I2C on systems without devicetree support. Signed-off-by: Denis Kirjanov <kirjanov@gmail.com> Link: https://lore.kernel.org/r/20250113092846.10786-1-kirjanov@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-13hwmon: (pwm-fan) Default to the Maximum cooling level if providedPeter Korsgaard1-6/+12
The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not always be desirable because of noise or power consumption peaks. The driver optionally accept a list of "cooling-levels" for the thermal subsystem. If provided, use the PWM value corresponding to the maximum cooling level rather than the full level as the initial PWM setting. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Link: https://lore.kernel.org/r/20250113135118.3994998-1-peter@korsgaard.com [groeck: Dropped double empty line] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-13Merge 6.13-rc7 into driver-core-nextGreg Kroah-Hartman2-6/+12
We need the debugfs / driver-core fixes in here as well for testing and to build on top of. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-13hwmon: (spd5118) Use generic parity calculationWolfram Sang1-7/+1
Make use of the new generic helper for calculating the parity. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com> Link: https://lore.kernel.org/r/20250107090204.6593-3-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-01-12hwmon: (asus_atk0110) Use str_enabled_disabled() and str_enable_disable() ↵Thorsten Blum1-9/+6
helpers Remove hard-coded strings by using the str_enabled_disabled() and str_enable_disable() helper functions. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://lore.kernel.org/r/20250112105128.86653-2-thorsten.blum@linux.dev [groeck: Fixed subject and continuation line alignments] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-12hwmon: Fix help text for aspeed-g6-pwm-tachJoel Stanley1-2/+2
The help text has the wrong module name mentioned, and the capitalisation of the title is inconsistent. Fixes: 7e1449cd15d1 ("hwmon: (aspeed-g6-pwm-tacho): Support for ASPEED g6 PWM/Fan tach") Signed-off-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/20250110114737.64035-1-joel@jms.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-10hwmon: (dell-smm) Add Dell XPS 9370 to fan control whitelistPovilas Kanapickas1-0/+8
Add the Dell XPS 9370 to the fan control whitelist to allow for manual fan control. Signed-off-by: Povilas Kanapickas <povilas@radix.lt> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Acked-by: Pali Rohár <pali@kernel.org> Link: https://lore.kernel.org/r/6e6b7a47-d0e3-4c5a-8be2-dfc58852da8e@radix.lt Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-09hwmon: (acpi_power_meter) Fix update the power trip points on failureHuisong Li1-5/+7
The power trip points maintained in local should not be updated when '_PTP' method fails to evaluate. Signed-off-by: Huisong Li <lihuisong@huawei.com> Link: https://lore.kernel.org/r/20250109081708.27366-3-lihuisong@huawei.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-09hwmon: (acpi_power_meter) Fix uninitialized variablesHuisong Li1-4/+23
The 'power1_alarm' attribute uses the 'power' and 'cap' in the acpi_power_meter_resource structure. Currently, these two fields are just updated when user query 'power' and 'cap' attribute. If user directly query the 'power1_alarm' attribute without queryng above two attributes, driver will use uninitialized variables to judge. So this patch adds the setting of alarm state and update 'cap' in the notification callback and update 'power' and 'cap' if needed to show the real alarm state. Signed-off-by: Huisong Li <lihuisong@huawei.com> Link: https://lore.kernel.org/r/20250109081708.27366-2-lihuisong@huawei.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-09hwmon: (core) Use device name as a fallback in ↵Heiner Kallweit1-0/+6
devm_hwmon_device_register_with_info A number of network PHY drivers use the following code: name = devm_hwmon_sanitize_name(dev, dev_name(dev)); if (IS_ERR(name)) return PTR_ERR(name); devm_hwmon_device_register_with_info(dev, name, ..); Make this a generic fallback option and use the device name if no name is provided to devm_hwmon_device_register_with_info(). This would allow to simplify the affected drivers. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/1ebe6961-6445-4408-bfb4-b56173af9db5@gmail.com [groeck: Update API document] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-08hwmon: (pmbus/max15301) Add support for MAX15303Nuno Sa2-1/+2
The MAX15303 is a full-featured, flexible, efficient, 6A digital point-of-load (PoL) controller with integrated switching MOSFETs. It contains advanced power management and telemetry features. Tested-by: Robin Getz <rgetz503@gmail.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250108-dev-max15303-v1-1-9154eb2c9d9e@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-08x86/amd_nb: Move SMN access code to a new amd_node driverMario Limonciello2-2/+2
SMN access was bolted into amd_nb mostly as convenience. This has limitations though that require incurring tech debt to keep it working. Move SMN access to the newly introduced AMD Node driver. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> # pdx86 Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> # PMF, PMC Link: https://lore.kernel.org/r/20241206161210.163701-11-yazen.ghannam@amd.com
2025-01-08x86/amd_nb, hwmon: (k10temp): Simplify amd_pci_dev_to_node_id()Mario Limonciello1-0/+5
amd_pci_dev_to_node_id() tries to find the AMD node ID of a device by searching and counting devices. The AMD node ID of an AMD node device is simply its slot number minus the AMD node 0 slot number. Simplify this function and move it to k10temp.c. [ Yazen: Update commit message and simplify function. ] Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Co-developed-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20241206161210.163701-10-yazen.ghannam@amd.com
2025-01-08hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occurDaniil Stas1-2/+6
scsi_execute_cmd() function can return both negative (linux codes) and positive (scsi_cmnd result field) error codes. Currently the driver just passes error codes of scsi_execute_cmd() to hwmon core, which is incorrect because hwmon only checks for negative error codes. This leads to hwmon reporting uninitialized data to userspace in case of SCSI errors (for example if the disk drive was disconnected). This patch checks scsi_execute_cmd() output and returns -EIO if it's error code is positive. Fixes: 5b46903d8bf37 ("hwmon: Driver for disk and solid state drives with temperature sensors") Signed-off-by: Daniil Stas <daniil.stas@posteo.net> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Chris Healy <cphealy@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Bart Van Assche <bvanassche@acm.org> Cc: linux-kernel@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: linux-ide@vger.kernel.org Cc: linux-hwmon@vger.kernel.org Link: https://lore.kernel.org/r/20250105213618.531691-1-daniil.stas@posteo.net [groeck: Avoid inline variable declaration for portability] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-07hwmon: (pmbus/adm1275) add adm1273 supportJohn Erasmus Mari Geronimo2-5/+7
Add support for adm1273 which is similar to adm1275 and other chips of the series. Signed-off-by: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com> Link: https://lore.kernel.org/r/20250106131740.305988-3-johnerasmusmari.geronimo@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-07hwmon: (nct6683) Add another customer ID for MSIJohn Audia1-0/+3
The new customer ID was found on a MPG X870E CARBON WIFI (MS-7E49) with a NCT6687D chip. Signed-off-by: John Audia <therealgraysky@proton.me> [groeck: Resolved conflicts in Documentation/hwmon/nct6683.rst] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-06hwmon: (pwm-fan): Make use of device properties everywherePeter Korsgaard1-4/+4
Commit 255ab27a0743 ("hwmon: (pwm-fan) Introduce start from stopped state handling") added two of_property_read_u32() calls after the driver was reworked to use device_property_* in commit dfd977d85b15 ("hwmon: (pwm-fan) Make use of device properties"), so convert those as well. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20250102170429.791912-1-peter@korsgaard.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-03driver core: Constify API device_find_child() and adapt for various usagesZijun Hu1-1/+1
Constify the following API: struct device *device_find_child(struct device *dev, void *data, int (*match)(struct device *dev, void *data)); To : struct device *device_find_child(struct device *dev, const void *data, device_match_t match); typedef int (*device_match_t)(struct device *dev, const void *data); with the following reasons: - Protect caller's match data @*data which is for comparison and lookup and the API does not actually need to modify @*data. - Make the API's parameters (@match)() and @data have the same type as all of other device finding APIs (bus|class|driver)_find_device(). - All kinds of existing device match functions can be directly taken as the API's argument, they were exported by driver core. Constify the API and adapt for various existing usages. BTW, various subsystem changes are squashed into this commit to meet 'git bisect' requirement, and this commit has the minimal and simplest changes to complement squashing shortcoming, and that may bring extra code improvement. Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Uwe Kleine-König <ukleinek@kernel.org> # for drivers/pwm Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20241224-const_dfc_done-v5-4-6623037414d4@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-22hwmon: (lm75) add I3C support for P3T1755Wolfram Sang2-4/+119
Introduce I3C support by defining I3C accessors for regmap and implementing an I3C driver. Enable I3C for the NXP P3T1755. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20241220093635.11218-1-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-20hwmon: (lm75) separate probe into common and I2C partsWolfram Sang1-30/+38
Put generic probe functionality into a separate function and let the I2C driver call it. This is a preparation for adding I3C support which will also use the generic probe function. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20241219225522.3490-11-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-20hwmon: (lm75) Remove superfluous 'client' member from private structWolfram Sang1-8/+5
The regmap-only conversion allows us to store the client-pointer as the 'context' parameter for regmap. This not only makes the private struct smaller, but also allows proper separation of I2C and I3C in the future. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20241219225522.3490-10-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-20hwmon: (lm75) simplify regulator handlingWolfram Sang1-22/+3
devm_regulator_get_enable() was introduced exactly to avoid open coding regulator handling like in this driver. Make use of this helper. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20241219225522.3490-9-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-20hwmon: (lm75) simplify lm75_write_config()Wolfram Sang1-10/+4
After previous refactoring, it is now possible to make lm75_write_config() a simple inline function. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20241219225522.3490-8-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-20hwmon: (lm75) Hide register size differences in regmap access functionsGuenter Roeck1-69/+62
Hide register size differences in regmap access functions to simplify runtime code and to simplify adding support for I3C devices. Also use regmap API functions for bit operations where possible. For this to work, the 16-bit and 8-bit configuration register has to be mapped to a 16-bit value. Unlike other registers, this register is a low-byte-first register, presumably for compatibility with chips with 8-bit wide configuration registers. Hide the differences in the regmap access code. While at it, enable alarm attribute support for TMP112. Cc: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-18hwmon: (pmbus/crps) Add Intel CRPS185 power supplyNinad Palsule3-0/+84
Add the driver to monitor Intel common redundant power supply (crps185) with hwmon over pmbus. Signed-off-by: Ninad Palsule <ninad@linux.ibm.com> Link: https://lore.kernel.org/r/20241217173537.192331-3-ninad@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-18hwmon: (lm75) Add NXP P3T1755 supportWolfram Sang1-0/+13
Add this LM75 compatible sensor which needs a separate entry because of its default sampling time and SMBusAlert handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20241218074131.4351-7-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-17hwmon: add driver for the hwmon parts of qnap-mcu devicesHeiko Stuebner3-0/+377
The MCU can be found on network-attached-storage devices made by QNAP and provides access to fan control including reading back its RPM as well as reading the temperature of the NAS case. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20241107114712.538976-8-heiko@sntech.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit ↵Murad Masimov1-1/+1
Registers The values returned by the driver after processing the contents of the Temperature Result and the Temperature Limit Registers do not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect. According to the TMP512 and TMP513 datasheets, the Temperature Result (08h to 0Bh) and Limit (11h to 14h) Registers are 13-bit two's complement integer values, shifted left by 3 bits. The value is scaled by 0.0625 degrees Celsius per bit. E.g., if regval = 1 1110 0111 0000 000, the output should be -25 degrees, but the driver will return +487 degrees. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.") Signed-off-by: Murad Masimov <m.masimov@maxima.ru> Link: https://lore.kernel.org/r/20241216173648.526-4-m.masimov@maxima.ru [groeck: fixed description line length] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-17hwmon: (tmp513) Fix Current Register value interpretationMurad Masimov1-1/+1
The value returned by the driver after processing the contents of the Current Register does not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect. Moreover, negative values will be reported as large positive due to missing sign extension from u32 to long. According to the TMP512 and TMP513 datasheets, the Current Register (07h) is a 16-bit two's complement integer value. E.g., if regval = 1000 0011 0000 0000, then the value must be (-32000 * lsb), but the driver will return (33536 * lsb). Fix off-by-one bug, and also cast data->curr_lsb_ua (which is of type u32) to long to prevent incorrect cast for negative values. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.") Signed-off-by: Murad Masimov <m.masimov@maxima.ru> Link: https://lore.kernel.org/r/20241216173648.526-3-m.masimov@maxima.ru [groeck: Fixed description line length] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-17hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit ↵Murad Masimov1-2/+4
Registers The values returned by the driver after processing the contents of the Shunt Voltage Register and the Shunt Limit Registers do not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect. Moreover, the PGA shift calculated with the tmp51x_get_pga_shift function is relevant only to the Shunt Voltage Register, but is also applied to the Shunt Limit Registers. According to the TMP512 and TMP513 datasheets, the Shunt Voltage Register (04h) is 13 to 16 bit two's complement integer value, depending on the PGA setting. The Shunt Positive (0Ch) and Negative (0Dh) Limit Registers are 16-bit two's complement integer values. Below are some examples: * Shunt Voltage Register If PGA = 8, and regval = 1000 0011 0000 0000, then the decimal value must be -32000, but the value calculated by the driver will be 33536. * Shunt Limit Register If regval = 1000 0011 0000 0000, then the decimal value must be -32000, but the value calculated by the driver will be 768, if PGA = 1. Fix sign bit index, and also correct misleading comment describing the tmp51x_get_pga_shift function. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.") Signed-off-by: Murad Masimov <m.masimov@maxima.ru> Link: https://lore.kernel.org/r/20241216173648.526-2-m.masimov@maxima.ru [groeck: Fixed description and multi-line alignments] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-16hwmon: (pmbus/core) Add PMBUS_REVISION in debugfsNinad Palsule1-2/+11
Add debugfs file for the PMBUS_REVISION command. This command provides information about PMBus protocol revision number. Signed-off-by: Ninad Palsule <ninad@linux.ibm.com> Link: https://lore.kernel.org/r/20241216175044.4144442-2-ninad@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-16hwmon: (occ/p9_sbe) Constify 'struct bin_attribute'Thomas Weißschuh1-2/+2
The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-hwmon-v1-1-ea72a6a46c36@weissschuh.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-16hwmon: (nct6683) Add customer ID for ASRock B650 Steel Legend WiFiMax Ammann1-0/+3
This value was found on an ASRock B650 Steel Legend WiFi with an NCT6686D chip. Signed-off-by: Max Ammann <max@maxammann.org> Link: https://lore.kernel.org/r/20241214102201.122851-1-max@maxammann.org [groeck: htmldocs fix] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (isl28022) Drop explicit initialization of struct ↵Uwe Kleine-König1-1/+1
i2c_device_id::driver_data to 0 This driver doesn't use the driver_data member of struct i2c_device_id, so don't explicitly initialize it. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20241204140857.1691402-2-u.kleine-koenig@baylibre.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (tmp108) Drop of_match_ptr() protectionGuenter Roeck1-5/+3
Limiting the scope of devicetree support to CONFIG_OF prevents use of this driver with ACPI via PRP0001. Drop the dependency. While at it, - Switch of.h for mod_devicetable.h include given the use of struct of_device_id which is defined in that header - Add I2C device ID for p3t1085 - Drop the unnecessary include of hwmon-sysfs.h. Cc: Frank Li <Frank.Li@nxp.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20241204141754.4051186-1-linux@roeck-us.net Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (tmp108) Add basic regulator supportStanislav Jakubek1-0/+5
TMP108/P3T1085 are powered by the V+/VCC regulator, add support for it. Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (asus-ec-sensors) Add TUF GAMING X670E PLUSLi XingYang1-0/+11
Add support for TUF GAMING X670E PLUS. Signed-off-by: Li XingYang <yanhuoguifan@gmail.com> [groeck: Massaged description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (asus-ec-sensors) Add support for fan cpu opt on AMD 600 motherboardsLi XingYang1-0/+2
According to the LibreHardwareMonitor project, LibreHardwareMonitorLib/ Hardware/Motherboard/Lpc/EC/EmbeddedController.cs file, fan cpu opt is supported by the AMD600 EC. Registers are described as follows. BoardFamily.Amd600, new Dictionary<ECSensor, EmbeddedControllerSource> { { ECSensor.FanCPUOpt, new EmbeddedControllerSource ("CPU Optional Fan", SensorType.Fan, 0x00b0, 2) }, } Add FanCPUOpt support for AMD600. Signed-off-by: Li XingYang <yanhuoguifan@gmail.com> [groeck: Massaged subject and description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (nct6775): Actually make use of the HWMON_NCT6775 symbol namespaceUwe Kleine-König1-3/+3
DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block. Fixes: c3963bc0a0cf ("hwmon: (nct6775) Split core and platform driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (pmbus/tps25990) Add initial supportJerome Brunet3-0/+454
Add initial support for the Texas Instruments TPS25990 eFuse. This adds the basic PMBUS telemetry support for the device. From Karol Przybylski: The tps25990_read_word_data function contains a block of unreachable code caused by the syntactic structure in the PMBUS_VIRT_READ_IIN_MAX case. Specifically, the return TPS25990_READ_IIN_PEAK; statement immediately exits the function, making the next lines unreachable. This patch removes the return statement, leaving the expected handling. Discovered in coverity: CID 1602227 Tested-by: Vaishnav Achath <vaishnav.a@ti.com> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> [groeck: Adjust to MODULE_IMPORT_NS API change] [karprzy7@gmail.com: Fix unreachable code in tps25990_read_word_data] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-14hwmon: (pmbus/core) add wp module paramJerome Brunet1-0/+29
Add a module parameter to force the write protection mode of pmbus chips. 4 protections modes are provided to start with: * 0: Remove the write protection * 1: Disable all writes except to the WRITE_PROTECT, OPERATION, PAGE, ON_OFF_CONFIG and VOUT_COMMAND commands * 2: Disable all writes except to the WRITE_PROTECT, OPERATION and PAGE commands * 3: Disable all writes except to the WRITE_PROTECT command Of course, if the parameter is not provided, the default write protection status of the pmbus chips is left untouched. Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>